archie-gateway is now the sole owner of ChatContract; the daemon always dials it over gRPC for webui chat, no in-process fallback left. Telegram and email keep their own in-process routers unchanged (their streaming responder is a callback that can't cross the wire-safe contract). - composeChatContract only accepts mode="remote"; config defaults Services.Gateway to remote + 127.0.0.1:8585 when unset - deleted taskActionsActor (dead code once the local branch is gone) - task dev now launches archie-gateway alongside archied + Vite Verified end-to-end: archie-gateway + archied booted against a shared NATS/store, webui's /api/chat/sessions round-tripped through the gRPC hop.
55 lines
1.4 KiB
Go
55 lines
1.4 KiB
Go
package archied
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/samcharles93/archie-core/internal/config"
|
|
"github.com/samcharles93/archie-core/internal/domain/taskactions"
|
|
"github.com/samcharles93/archie-core/internal/events"
|
|
taskactionstore "github.com/samcharles93/archie-core/internal/infrastructure/taskactions"
|
|
)
|
|
|
|
// taskActions assembles the daemon-owned operator action service. The daemon
|
|
// retains execution cancellation, retry policy, forge closure and event
|
|
// ownership; the dashboard's webui service and the NATS responder both build
|
|
// through the same constructor so the surfaces cannot diverge.
|
|
func (b *boot) taskActions() taskactions.Service {
|
|
return taskactionstore.NewService(
|
|
taskactionstore.Store{TaskStore: b.st},
|
|
taskactionstore.MaxRetries(config.NewHolder(b.cfg)),
|
|
b.cancelTask,
|
|
b.closeIssue,
|
|
b.removeTaskLogs,
|
|
b.publishEvent,
|
|
b.log.Warn,
|
|
)
|
|
}
|
|
|
|
func (b *boot) cancelTask(id int64) bool {
|
|
if b.d == nil {
|
|
return false
|
|
}
|
|
return b.d.CancelTask(id)
|
|
}
|
|
|
|
func (b *boot) closeIssue(ctx context.Context, owner, repo string, number int, comment string) error {
|
|
if b.forgeClient == nil {
|
|
return fmt.Errorf("forge is not configured")
|
|
}
|
|
return b.forgeClient.CloseIssue(ctx, owner, repo, number, comment)
|
|
}
|
|
|
|
func (b *boot) removeTaskLogs(id int64) error {
|
|
if b.taskLogs == nil {
|
|
return nil
|
|
}
|
|
return b.taskLogs.Remove(id)
|
|
}
|
|
|
|
func (b *boot) publishEvent(e events.Event) {
|
|
if b.bus != nil {
|
|
b.bus.Publish(e)
|
|
}
|
|
}
|