feat(gateway): delete in-process ChatContract path, make remote the only mode

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.
This commit is contained in:
sam committed 2026-09-06 02:07:02 +10:00
1 parent 10e76e7528
commit bec9caa24e
12 files changed
+108 -123

No files matched your search

@@ -60,7 +60,8 @@ const (
// inspected, and reasoned about independently of whether the result is valid.
func (l *Loader) applyDefaults(cfg *config.Config) {
if cfg.Services.Gateway.Mode == "" {
cfg.Services.Gateway.Mode = "inproc"
cfg.Services.Gateway.Mode = "remote"
cfg.Services.Gateway.Target = "127.0.0.1:8585"
}
l.applyGeneralDefaults(cfg)
applyForgeDefaults(cfg)
@@ -10,13 +10,13 @@ func TestLoadGatewayServiceMode(t *testing.T) {
for _, tt := range []struct {
name, section string
wantError bool
wantTarget string
}{
{name: "default"},
{name: "local", section: "[services.gateway]\nmode = 'inproc'"},
{name: "remote", section: "[services.gateway]\nmode = 'remote'\ntarget = 'dns:///gateway:8443'"},
{name: "default", wantTarget: "127.0.0.1:8585"},
{name: "remote", section: "[services.gateway]\nmode = 'remote'\ntarget = 'dns:///gateway:8443'", wantTarget: "dns:///gateway:8443"},
{name: "invalid mode", section: "[services.gateway]\nmode = 'typo'", wantError: true},
{name: "inproc removed", section: "[services.gateway]\nmode = 'inproc'", wantError: true},
{name: "remote without target", section: "[services.gateway]\nmode = 'remote'", wantError: true},
{name: "local with ignored target", section: "[services.gateway]\nmode = 'inproc'\ntarget = 'gateway:8443'", wantError: true},
} {
t.Run(tt.name, func(t *testing.T) {
path := filepath.Join(t.TempDir(), "config.toml")
@@ -28,15 +28,11 @@ func TestLoadGatewayServiceMode(t *testing.T) {
t.Fatalf("load error = %v, want error %v", err, tt.wantError)
}
if err == nil {
want := "inproc"
if tt.name == "remote" {
want = "remote"
if cfg.Services.Gateway.Target != "dns:///gateway:8443" {
t.Fatalf("target = %q", cfg.Services.Gateway.Target)
}
if cfg.Services.Gateway.Mode != "remote" {
t.Fatalf("mode = %q, want %q", cfg.Services.Gateway.Mode, "remote")
}
if cfg.Services.Gateway.Mode != want {
t.Fatalf("mode = %q, want %q", cfg.Services.Gateway.Mode, want)
if cfg.Services.Gateway.Target != tt.wantTarget {
t.Fatalf("target = %q, want %q", cfg.Services.Gateway.Target, tt.wantTarget)
}
}
})
@@ -98,16 +98,12 @@ func validate(cfg *config.Config) error {
func validateGatewayService(service config.ServiceConnection) error {
switch service.Mode {
case "", "inproc":
if service.Target != "" {
return fmt.Errorf("%w: services.gateway.target requires remote mode", ErrInvalidInput)
}
case "remote":
if strings.TrimSpace(service.Target) == "" {
return fmt.Errorf("%w: services.gateway.target is required in remote mode", ErrInvalidInput)
}
default:
return fmt.Errorf("%w: services.gateway.mode must be inproc or remote", ErrInvalidInput)
return fmt.Errorf("%w: services.gateway.mode must be remote", ErrInvalidInput)
}
return nil
}
@@ -26,6 +26,9 @@ func minimalValidConfig() config.Config {
Containers: config.ContainerConfig{
Image: "ghcr.io/samcharles93/archie-agent:latest",
},
Services: config.Services{
Gateway: config.ServiceConnection{Mode: "remote", Target: "127.0.0.1:8585"},
},
}
}