refactor(ui): sever the archie-ui binary from every daemon runtime package

Completes the objective deletion gate for the UI Service
(archie-core-8cda.5.6): go list -deps ./cmd/archie-ui now links zero
banned packages -- no modernc.org/sqlite, no internal/store, gateway,
channels, memory, secret, agentexec, tools, skill, yaegiutil, curator,
or the workflow engine. The closure shrinks from 68 to 26 archie-core
packages. Each cut is a producer-side move; no consumer-side defensive
shims.

- Store contracts (TaskStore family, value types, sentinels) moved from
  internal/store to internal/domain/storecontract -- the approved contract
  location per state-store-contract rev. 2d, and NOT internal/contracts:
  that tree is buf generate output and tools/proto.sh check deletes
  hand-written files there. internal/store keeps aliases; sentinel
  message strings are byte-identical and remain the wire contract.
- Chat contracts (ChatContract, sessions, turns, streaming, commands)
  moved from internal/gateway to internal/domain/messaging; gateway keeps
  aliases. ToolCallEvent rendering helpers become gateway functions
  (methods cannot live on alias types).
- Task vocabulary (Task, statuses, mid-run Store, Definition) split into
  internal/domain/workflow/task; the pipeline engine stays in package
  workflow with aliases, so daemon-side callers are unchanged.
- overlay.DeniedKeys moved to internal/infrastructure/configuration:
  webui referenced the constant and that dragged the overlay SQLite
  store in.
- webui.Server's concrete runtime handles become webui-owned view
  interfaces with daemon-side bootstrap adapters: channel lifecycle
  (internal/channels/status), MemoryStatus, CuratorStatus, and a
  SkillCatalog seam replacing the direct skill.DefaultRoots/CatalogRoots
  calls. Each degrades to an empty page when unwired.
- config.SecretRef moved into internal/config (config vocabulary);
  internal/secret keeps an alias and Registry.Resolve absorbs the
  zero-value short-circuit.

Docs: state-store-contract rev. 2d relocation record; ui-service-boundary
deletion gate marked satisfied; ARCHITECTURE.md package map rows.
This commit is contained in:
sam committed 2026-09-10 03:03:33 +10:00
1 parent 3699f51f9b
commit da28ddb5e6
84 files changed
+1492 -1053

No files matched your search

+2 -2
View File
@@ -17,7 +17,7 @@ func bindingCipherFromConfig(cfg config.Config, secrets *secret.Registry) (store
if cfg.Bindings.EncryptionKey == (secret.SecretRef{}) {
return nil, nil
}
active, err := cfg.Bindings.EncryptionKey.Resolve(secrets)
active, err := secrets.Resolve(cfg.Bindings.EncryptionKey)
if err != nil {
return nil, fmt.Errorf("resolve bindings encryption_key: %w", err)
}
@@ -28,7 +28,7 @@ func bindingCipherFromConfig(cfg config.Config, secrets *secret.Registry) (store
previous := make([]string, 0, len(cfg.Bindings.PreviousEncryptionKeys))
for _, ref := range cfg.Bindings.PreviousEncryptionKeys {
v, err := ref.Resolve(secrets)
v, err := secrets.Resolve(ref)
if err != nil {
return nil, fmt.Errorf("resolve bindings previous_encryption_key: %w", err)
}
+19 -19
View File
@@ -24,18 +24,18 @@ import (
"github.com/samcharles93/ai-sdk/runtime"
channelruntime "github.com/samcharles93/archie-core/internal/channels"
"github.com/samcharles93/archie-core/internal/channels/email"
"github.com/samcharles93/archie-core/internal/channels/status"
"github.com/samcharles93/archie-core/internal/channels/webhook"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/container"
storev1 "github.com/samcharles93/archie-core/internal/contracts/store/v1"
"github.com/samcharles93/archie-core/internal/daemon"
"github.com/samcharles93/archie-core/internal/domain/curator"
"github.com/samcharles93/archie-core/internal/domain/eda/module"
"github.com/samcharles93/archie-core/internal/domain/eda/playbook"
domainembedding "github.com/samcharles93/archie-core/internal/domain/embedding"
domainmemory "github.com/samcharles93/archie-core/internal/domain/memory"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/domain/workflow"
"github.com/samcharles93/archie-core/internal/domain/workflow/skillbuild"
"github.com/samcharles93/archie-core/internal/domain/workintake"
@@ -99,7 +99,7 @@ type boot struct {
playbooks *playbook.Store
st storev1.TaskStore
st storecontract.TaskStore
// stateStore is the State Store contract adapter every daemon and gateway
// store consumer depends on. It is ALWAYS the remote *staterpc.Client
// dialed to the standalone archie-state-store gRPC service at
@@ -108,7 +108,7 @@ type boot struct {
// by openStateStoreAdapter, which requires [services.state].target to be
// set. The b.st field remains solely for the standalone archie-state-store
// binary, which owns the single SQLite file.
stateStore storev1.TaskStore
stateStore storecontract.TaskStore
// stateStoreGrants issues per-task, scoped State Store credentials for
// agent containers (daemon.StateStoreGrantIssuer), wrapping the same
// *staterpc.Client as stateStore. Nil when the State Store adapter isn't
@@ -123,7 +123,7 @@ type boot struct {
bus *events.Bus
restartTelegram func() error
channelManager *channelruntime.Manager
channelManager *status.Manager
web *webui.Server
natsClient *nats.Client
@@ -378,7 +378,7 @@ func (b *boot) setupObservability(ctx context.Context) {
if (cfg.Chat.Telegram.Token != (secret.SecretRef{}) || cfg.Chat.Telegram.TokenEnv != "") && len(cfg.Chat.Telegram.AllowedUserIDs) == 0 {
telegramDetail = "Token set, but the allowlist is empty -- the bot answers nobody."
}
b.channelManager = channelruntime.NewManager([]channelruntime.Descriptor{
b.channelManager = status.NewManager([]status.Descriptor{
{ID: "telegram", Name: "Telegram", Configured: cfg.Chat.Telegram.Token != (secret.SecretRef{}) || cfg.Chat.Telegram.TokenEnv != "", ReloadSupported: cfg.Chat.Telegram.Token != (secret.SecretRef{}) || cfg.Chat.Telegram.TokenEnv != "", Detail: telegramDetail},
{ID: "email", Name: "Email", Configured: cfg.Chat.Email.ListenAddr != ""},
{ID: "webhook", Name: "Webhook gateway", Configured: cfg.Chat.WebhookAddr != ""},
@@ -389,7 +389,7 @@ func (b *boot) setupObservability(ctx context.Context) {
Path: origin.Path, Role: string(origin.Role), Layer: string(origin.Layer), Feature: string(origin.Feature),
})
}
b.web = &webui.Server{Log: log.With("component", "webui"), Cfg: config.NewHolder(cfg), Channels: b.channelManager}
b.web = &webui.Server{Log: log.With("component", "webui"), Cfg: config.NewHolder(cfg), Channels: b.channelManager, Skills: skillCatalogAdapter{config.NewHolder(cfg)}}
// The watchdog leaves its verdict in a file on this host, so the daemon
// reads it and publishes the outcome as an event; the dashboard renders
// what it receives, wherever it runs (archie-core-8cda.5.4).
@@ -895,7 +895,7 @@ func (b *boot) setupMemory() error {
// The dashboard is built before memory exists, so it is wired in here
// rather than at construction.
if b.web != nil {
b.web.Memory = memManager
b.web.Memory = memoryUIAdapter{memManager}
}
if err := memManager.Initialize("daemon"); err != nil {
@@ -1181,7 +1181,7 @@ func (b *boot) registerMinimaxTool(cfg config.Config, log *slog.Logger) {
return
}
apiKey, err := cfg.Tools.Minimax.APIKey.Resolve(b.secrets)
apiKey, err := b.secrets.Resolve(cfg.Tools.Minimax.APIKey)
if err != nil {
log.Warn("minimax video generation enabled but the API key failed to resolve; tool not registered", "err", err)
return
@@ -1223,15 +1223,15 @@ func (b *boot) buildDaemon() {
ContainerPool: b.containerPool,
Guardrails: b.guardrails,
ToolRegistry: b.toolReg,
Curators: b.curatorRegistry,
Identities: b.identityRunners,
TaskLogs: b.taskLogs,
AgentStatus: b.agentStatus,
}
// Curator observability (archie-core-1786637489932-6): GET
// /api/curators reads registered names, health and recent activity
// straight off the live registry the daemon already holds.
b.web.Curators = b.curatorRegistry
// off the live registry the daemon already holds, narrowed to the
// webui's own view type.
b.web.Curators = curatorsUIAdapter{b.curatorRegistry}
// web and the daemon must share ONE Holder: a reload swaps d.Cfg and
// the dashboard reads the running config from the same snapshot. The
// webui Holder seeded in the literal above is replaced here; after
@@ -1241,16 +1241,16 @@ func (b *boot) buildDaemon() {
// Consumer mapping/binding surfaces resolve from b.stateStore (the State
// Store contract adapter): local by default, remote *staterpc.Client when
// [services.state].target is set. See docs/prds/state-store-contract.md §10.
if ms, ok := b.stateStore.(storev1.MappingStore); ok {
if ms, ok := b.stateStore.(storecontract.MappingStore); ok {
b.d.Mappings = ms
}
if bs, ok := b.stateStore.(storev1.BindingStore); ok {
if bs, ok := b.stateStore.(storecontract.BindingStore); ok {
b.d.Bindings = bs
}
if bd, ok := b.stateStore.(storev1.BindingDispatcher); ok {
if bd, ok := b.stateStore.(storecontract.BindingDispatcher); ok {
b.d.BindingDispatcher = bd
}
if btc, ok := b.stateStore.(storev1.BindingTaskCreator); ok {
if btc, ok := b.stateStore.(storecontract.BindingTaskCreator); ok {
b.d.BindingTaskCreator = btc
}
b.setupForgeWebhook()
@@ -1288,7 +1288,7 @@ func (b *boot) setupForgeWebhook() {
log.Error("forge webhook disabled: multi-identity deployments are not supported yet (each identity's own poll loop is unaffected)")
return
}
secretValue, err := cfg.Forge.WebhookSecret.Resolve(b.secrets)
secretValue, err := b.secrets.Resolve(cfg.Forge.WebhookSecret)
if err != nil || secretValue == "" {
log.Error("forge webhook disabled: secret unavailable",
"engine", cfg.Forge.WebhookSecret.Engine, "key", cfg.Forge.WebhookSecret.Key, "err", err)
@@ -1340,7 +1340,7 @@ func (b *boot) publishConfig(ctx context.Context, cfg config.Config, provenance
// propagated: it must never fail the reload or dashboard write that produced
// the new configuration, both of which have already taken effect.
func (b *boot) publishConfigSnapshot(ctx context.Context) {
snapshots, ok := b.stateStore.(storev1.ConfigSnapshotStore)
snapshots, ok := b.stateStore.(storecontract.ConfigSnapshotStore)
if !ok || b.web == nil {
return
}
@@ -1362,7 +1362,7 @@ func (b *boot) publishConfigSnapshot(ctx context.Context) {
b.log.Warn("config snapshot not published", "err", err)
return
}
err = snapshots.PutConfigSnapshot(ctx, storev1.ConfigSnapshot{
err = snapshots.PutConfigSnapshot(ctx, storecontract.ConfigSnapshot{
Schema: webui.ConfigViewSchema,
Document: document,
PublishedAt: time.Now().UTC(),
@@ -7,7 +7,7 @@ import (
"testing"
"time"
channelruntime "github.com/samcharles93/archie-core/internal/channels"
"github.com/samcharles93/archie-core/internal/channels/status"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/store"
"github.com/samcharles93/archie-core/internal/webui"
@@ -42,7 +42,7 @@ func TestConfiguredNetworkGatewaysBecomeRunning(t *testing.T) {
t.Fatal(err)
}
t.Cleanup(func() { _ = st.Close() })
manager := channelruntime.NewManager([]channelruntime.Descriptor{{
manager := status.NewManager([]status.Descriptor{{
ID: test.id, Name: test.name, Configured: true,
}})
b := &boot{
@@ -66,13 +66,13 @@ func TestConfiguredNetworkGatewaysBecomeRunning(t *testing.T) {
deadline := time.Now().Add(250 * time.Millisecond)
for time.Now().Before(deadline) {
if got := manager.Snapshot()[0].State; got == channelruntime.StateRunning {
if got := manager.Snapshot()[0].State; got == status.StateRunning {
return
}
time.Sleep(time.Millisecond)
}
t.Fatalf("channel state = %q, want %q after successful startup",
manager.Snapshot()[0].State, channelruntime.StateRunning)
manager.Snapshot()[0].State, status.StateRunning)
})
}
}
+50
View File
@@ -0,0 +1,50 @@
package archied
import (
"context"
"github.com/samcharles93/archie-core/internal/domain/curator"
"github.com/samcharles93/archie-core/internal/webui"
)
// curatorsUIAdapter narrows the running curator registry to the webui-owned
// CuratorStatus view. The webui deliberately does not link the curator
// pass-engine contract (archie-core-8cda.5.6), so the process that owns the
// registry supplies this adapter at bootstrap. It converts health and
// activity records to their wire views; it never hands the UI a live
// engine.
type curatorsUIAdapter struct{ r *curator.Registry }
var _ webui.CuratorStatus = curatorsUIAdapter{}
func (a curatorsUIAdapter) Names() []string { return a.r.Names() }
func (a curatorsUIAdapter) Health(ctx context.Context) map[string]webui.CuratorHealthView {
health := a.r.Health(ctx)
views := make(map[string]webui.CuratorHealthView, len(health))
for name, h := range health {
views[name] = webui.CuratorHealthView{Status: string(h.Status), Message: h.Message}
}
return views
}
func (a curatorsUIAdapter) Activity(name string) (webui.CuratorActivity, bool) {
activity, ok := a.r.Activity(name)
if !ok {
return webui.CuratorActivity{}, false
}
view := webui.CuratorActivity{
LastRunAt: activity.LastRunAt,
LastRunActions: activity.LastRunActions,
Recent: make([]webui.CuratorActionView, 0, len(activity.Recent)),
}
for _, a2 := range activity.Recent {
view.Recent = append(view.Recent, webui.CuratorActionView{
At: a2.At,
Type: a2.Type,
Detail: a2.Detail,
Reason: a2.Reason,
})
}
return view, true
}
+5 -5
View File
@@ -29,9 +29,9 @@ import (
"github.com/samcharles93/archie-core/internal/agentexec"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/container"
storev1 "github.com/samcharles93/archie-core/internal/contracts/store/v1"
"github.com/samcharles93/archie-core/internal/daemon"
"github.com/samcharles93/archie-core/internal/domain/curator"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/domain/workflow"
"github.com/samcharles93/archie-core/internal/events"
"github.com/samcharles93/archie-core/internal/forge"
@@ -269,7 +269,7 @@ func resolveForge(cfg config.Forge, secrets *secret.Registry, log *slog.Logger)
if configuration.ForgeDisabled(cfg.Type) {
return forge.NewNoop(log), ""
}
token, err := cfg.Token.Resolve(secrets)
token, err := secrets.Resolve(cfg.Token)
if err != nil || token == "" {
log.Warn("forge disabled: token unavailable",
"forge_type", cfg.Type,
@@ -287,7 +287,7 @@ func resolveForge(cfg config.Forge, secrets *secret.Registry, log *slog.Logger)
return client, token
}
func openProductionTaskStore(ctx context.Context, path string, opts ...store.OpenOption) (storev1.TaskStore, error) {
func openProductionTaskStore(ctx context.Context, path string, opts ...store.OpenOption) (storecontract.TaskStore, error) {
return store.Open(ctx, path, opts...)
}
@@ -304,7 +304,7 @@ func configDBPath(configuredPath string) string {
return configuredPath + "-config.sqlite"
}
func manualRequeueTask(ctx context.Context, st storev1.TaskStore, taskID int64) error {
func manualRequeueTask(ctx context.Context, st storecontract.TaskStore, taskID int64) error {
task, err := st.TaskByID(ctx, taskID)
if err != nil {
return err
@@ -517,7 +517,7 @@ func recordBootOverlayError(p *atomic.Pointer[string], log *slog.Logger, err err
// The insert deliberately outlives ctx: this loop ends when the bus closes,
// which is part of shutdown, and the last events of a run are exactly the
// ones an operator wants to read afterwards.
func persistEvents(ctx context.Context, sink *events.Sub, st storev1.TaskStore, log *slog.Logger) {
func persistEvents(ctx context.Context, sink *events.Sub, st storecontract.TaskStore, log *slog.Logger) {
ctx = context.WithoutCancel(ctx)
for e := range sink.C {
if e.ID != 0 {
+41
View File
@@ -0,0 +1,41 @@
package archied
import (
"github.com/samcharles93/archie-core/internal/memory"
"github.com/samcharles93/archie-core/internal/webui"
)
// memoryUIAdapter narrows the running memory runtime to the webui-owned
// MemoryStatus view. The webui deliberately does not link the memory
// package (archie-core-8cda.5.6), so the process that owns the runtime
// supplies this adapter at bootstrap. It renders names, readiness, and the
// tool vocabulary by name; it never hands the UI a live tool.
type memoryUIAdapter struct{ m *memory.Manager }
var _ webui.MemoryStatus = memoryUIAdapter{}
func (a memoryUIAdapter) Builtin() webui.MemoryProviderHandle {
return memoryProviderUIAdapter{a.m.Builtin()}
}
func (a memoryUIAdapter) External() webui.MemoryProviderHandle {
return memoryProviderUIAdapter{a.m.External()}
}
// memoryProviderUIAdapter converts one provider's runtime tool entries into
// the webui's name/description view. A nil provider renders as absent.
type memoryProviderUIAdapter struct{ p memory.MemoryProvider }
func (a memoryProviderUIAdapter) Name() string { return a.p.Name() }
func (a memoryProviderUIAdapter) IsAvailable() bool { return a.p.IsAvailable() }
func (a memoryProviderUIAdapter) ToolViews() []webui.MemoryToolView {
if a.p == nil {
return nil
}
schemas := a.p.GetToolSchemas()
views := make([]webui.MemoryToolView, 0, len(schemas))
for _, t := range schemas {
views = append(views, webui.MemoryToolView{Name: t.Name, Description: t.Description})
}
return views
}
+1 -1
View File
@@ -53,7 +53,7 @@ func resolveProviderMap(scope string, providers map[string]config.Provider, regi
if provider.APIKey == (secret.SecretRef{}) {
continue
}
value, err := provider.APIKey.Resolve(registry)
value, err := registry.Resolve(provider.APIKey)
if err != nil {
return fmt.Errorf("provider %q: %w", id, err)
}
+2 -2
View File
@@ -12,7 +12,7 @@ import (
"strings"
"time"
channelruntime "github.com/samcharles93/archie-core/internal/channels"
"github.com/samcharles93/archie-core/internal/channels/status"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/domain/health"
"github.com/samcharles93/archie-core/internal/infrastructure/configuration"
@@ -42,7 +42,7 @@ func (b *boot) setupReadinessProbes() {
// channelStates projects a channel lifecycle snapshot into the readiness
// probe's view, so the probe does not depend on the channels package's
// concrete type.
func channelStates(m *channelruntime.Manager) []readiness.ChannelState {
func channelStates(m *status.Manager) []readiness.ChannelState {
if m == nil {
return nil
}
+3 -3
View File
@@ -5,7 +5,7 @@ import (
"path/filepath"
"testing"
channelruntime "github.com/samcharles93/archie-core/internal/channels"
"github.com/samcharles93/archie-core/internal/channels/status"
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/gateway"
"github.com/samcharles93/archie-core/internal/store"
@@ -33,7 +33,7 @@ func TestDiskProbePath_FallsBackToCwd(t *testing.T) {
}
func TestChannelStates_ProjectsSnapshot(t *testing.T) {
m := channelruntime.NewManager([]channelruntime.Descriptor{
m := status.NewManager([]status.Descriptor{
{ID: "telegram", Name: "Telegram", Configured: true},
{ID: "email", Name: "Email", Configured: false},
})
@@ -95,7 +95,7 @@ func TestSetupReadinessProbes_WiresEverySubsystem(t *testing.T) {
st: st,
web: &webui.Server{
Cfg: config.NewHolder(cfg),
Channels: channelruntime.NewManager([]channelruntime.Descriptor{{ID: "telegram", Name: "Telegram", Configured: true}}),
Channels: status.NewManager([]status.Descriptor{{ID: "telegram", Name: "Telegram", Configured: true}}),
Chat: &webui.ChatService{
Contract: &gateway.LocalChatAdapter{
Router: &gateway.Router{},
+54
View File
@@ -0,0 +1,54 @@
package archied
import (
"github.com/samcharles93/archie-core/internal/config"
"github.com/samcharles93/archie-core/internal/skill"
"github.com/samcharles93/archie-core/internal/webui"
)
// skillCatalogAdapter serves the webui's skill catalogue view from the
// runtime cataloguer. The webui deliberately does not link internal/skill
// (archie-core-8cda.5.6), so the process that owns the config and the
// runtime supplies this adapter at bootstrap.
type skillCatalogAdapter struct{ cfg *config.Holder }
var _ webui.SkillCatalog = skillCatalogAdapter{}
// Skills discovers and renders the catalogue: project, explicitly shared,
// and user-global skills; earlier roots win when names collide. A discovery
// failure renders as an empty catalogue -- the page answers "what can
// Archie do" from whatever loaded, never a failed dashboard.
func (a skillCatalogAdapter) Skills() []webui.SkillView {
cfg := a.cfg.Get()
roots := skill.DefaultRoots(cfg.WorkDir, cfg.SkillsDir)
catalog, err := skill.CatalogRoots(roots...)
if err != nil {
return []webui.SkillView{}
}
views := make([]webui.SkillView, 0, len(catalog))
for _, entry := range catalog {
views = append(views, webui.SkillView{
Name: entry.Name,
Description: entry.Description,
Workflow: entry.Workflow,
Source: skillSource(entry.Root, cfg.WorkDir, cfg.SkillsDir),
})
}
return views
}
// skillSource labels where a skill was loaded from.
//
// sharedDir is checked first: when it equals workDir the roots collapse to one
// entry, and matching workDir first labelled every shared skill as a project
// skill.
func skillSource(root, workDir, sharedDir string) string {
switch root {
case sharedDir:
return "shared skills"
case workDir:
return "project skills"
default:
return "user-global skills"
}
}
+8 -8
View File
@@ -20,8 +20,8 @@ import (
"google.golang.org/grpc"
storev1 "github.com/samcharles93/archie-core/internal/contracts/store/v1"
"github.com/samcharles93/archie-core/internal/domain/health"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/infrastructure/readiness"
"github.com/samcharles93/archie-core/internal/infrastructure/staterpc"
"github.com/samcharles93/archie-core/internal/store"
@@ -120,28 +120,28 @@ func (b *boot) openStateStore(ctx context.Context) error {
}
// stateStoreDeps assembles the store surfaces the StateStore service fronts.
// b.st is the narrow storev1.TaskStore; the wide *store.Store also implements
// b.st is the narrow storecontract.TaskStore; the wide *store.Store also implements
// the capture/mapping/binding surfaces, so each is asserted here (the same
// pattern the daemon's wireWebStoreSurfaces uses) and a store that lacks one
// degrades that group rather than aborting boot.
func (b *boot) stateStoreDeps(grants *staterpc.TaskGrants) staterpc.Deps {
deps := staterpc.Deps{Tasks: b.st, Log: b.log, Grants: grants}
if cs, ok := b.st.(storev1.CaptureStore); ok {
if cs, ok := b.st.(storecontract.CaptureStore); ok {
deps.Captures = cs
}
if ms, ok := b.st.(storev1.MappingStore); ok {
if ms, ok := b.st.(storecontract.MappingStore); ok {
deps.Mappings = ms
}
if bs, ok := b.st.(storev1.BindingStore); ok {
if bs, ok := b.st.(storecontract.BindingStore); ok {
deps.Bindings = bs
}
if bd, ok := b.st.(storev1.BindingDispatcher); ok {
if bd, ok := b.st.(storecontract.BindingDispatcher); ok {
deps.BindingDispatcher = bd
}
if btc, ok := b.st.(storev1.BindingTaskCreator); ok {
if btc, ok := b.st.(storecontract.BindingTaskCreator); ok {
deps.BindingTaskCreator = btc
}
if css, ok := b.st.(storev1.ConfigSnapshotStore); ok {
if css, ok := b.st.(storecontract.ConfigSnapshotStore); ok {
deps.ConfigSnapshots = css
}
return deps
+5 -5
View File
@@ -13,11 +13,11 @@ import (
"github.com/samcharles93/ai-sdk/core"
"github.com/samcharles93/ai-sdk/runtime"
channelruntime "github.com/samcharles93/archie-core/internal/channels"
"github.com/samcharles93/archie-core/internal/channels/status"
"github.com/samcharles93/archie-core/internal/channels/telegram"
"github.com/samcharles93/archie-core/internal/config"
storev1 "github.com/samcharles93/archie-core/internal/contracts/store/v1"
"github.com/samcharles93/archie-core/internal/daemon"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/events"
"github.com/samcharles93/archie-core/internal/gateway"
"github.com/samcharles93/archie-core/internal/infrastructure/configuration"
@@ -38,7 +38,7 @@ type telegramSetup struct {
Cfg *config.Holder
CfgPath string
OverlayPath string
St storev1.TaskStore
St storecontract.TaskStore
LLM *runtime.Runtime
ChatModels gateway.ModelManager
ToolReg *tools.Registry
@@ -59,7 +59,7 @@ type telegramSetup struct {
// disables turn events (tests, minimal setups).
Bus *events.Bus
Log *slog.Logger
ChannelManager *channelruntime.Manager
ChannelManager *status.Manager
// AgentStatus is the composition root's shared tracker for the most
// recently observed archie-agent version (see daemon.AgentStatus).
// Nil disables the agent component of RunningVersions.
@@ -69,7 +69,7 @@ type telegramSetup struct {
func resolveTelegramToken(cfg config.TelegramConfig, registry *secret.Registry) (string, error) {
if cfg.Token != (secret.SecretRef{}) {
return cfg.Token.Resolve(registry)
return registry.Resolve(cfg.Token)
}
if cfg.TokenEnv == "" {
return "", nil
+9 -9
View File
@@ -5,10 +5,10 @@ import (
"log/slog"
"time"
storev1 "github.com/samcharles93/archie-core/internal/contracts/store/v1"
"github.com/samcharles93/archie-core/internal/domain/health"
"github.com/samcharles93/archie-core/internal/domain/messaging"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/events"
"github.com/samcharles93/archie-core/internal/gateway"
"github.com/samcharles93/archie-core/internal/infrastructure/captureintake"
"github.com/samcharles93/archie-core/internal/webhookguard"
"github.com/samcharles93/archie-core/internal/webui"
@@ -20,8 +20,8 @@ import (
type deps struct {
Options Options
Log *slog.Logger
Store storev1.TaskStore
Chat gateway.ChatContract
Store storecontract.TaskStore
Chat messaging.ChatContract
Health *health.Registry
}
@@ -61,17 +61,17 @@ func compose(d deps) *webui.Server {
TrustForwardedHeaders: d.Options.trustForwardedHeaders(),
Health: d.Health,
}
if snapshots, ok := d.Store.(storev1.ConfigSnapshotStore); ok {
if snapshots, ok := d.Store.(storecontract.ConfigSnapshotStore); ok {
srv.ConfigSource = webui.RemoteConfigView(snapshots)
}
// Mappings and bindings are ratified State Store contracts, and the same
// client already carries them: withholding them would degrade two pages
// that have an owner, which is a different thing from the intake surfaces
// below.
if mappings, ok := d.Store.(storev1.MappingStore); ok {
if mappings, ok := d.Store.(storecontract.MappingStore); ok {
srv.Mappings = mappings
}
if bindings, ok := d.Store.(storev1.BindingStore); ok {
if bindings, ok := d.Store.(storecontract.BindingStore); ok {
srv.Bindings = bindings
}
if d.Chat != nil {
@@ -88,8 +88,8 @@ func compose(d deps) *webui.Server {
// implement one degrades that half with a warning rather than aborting the
// process, mirroring the daemon's own adapter selection.
func wireCaptureSurfaces(d deps, srv *webui.Server) {
captures, hasCaptures := d.Store.(storev1.CaptureStore)
bindings, hasBindings := d.Store.(storev1.BindingDispatcher)
captures, hasCaptures := d.Store.(storecontract.CaptureStore)
bindings, hasBindings := d.Store.(storecontract.BindingDispatcher)
if !hasCaptures {
d.Log.Warn("capture storage unavailable: state store does not implement CaptureStore")
return
+3 -3
View File
@@ -3,9 +3,9 @@ package archieui
import (
"context"
storev1 "github.com/samcharles93/archie-core/internal/contracts/store/v1"
"github.com/samcharles93/archie-core/internal/domain/health"
"github.com/samcharles93/archie-core/internal/gateway"
"github.com/samcharles93/archie-core/internal/domain/messaging"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/infrastructure/readiness"
)
@@ -17,7 +17,7 @@ import (
//
// The component names match the daemon dashboard's, so the readiness view
// reads the same whichever process serves it.
func newReadinessRegistry(o Options, tasks storev1.TaskStore, chat gateway.ChatContract) *health.Registry {
func newReadinessRegistry(o Options, tasks storecontract.TaskStore, chat messaging.ChatContract) *health.Registry {
return health.NewRegistry(
readiness.NewContractProbe("state_db", o.DependencyTimeout, func(ctx context.Context) error {
_, err := tasks.StatusCounts(ctx)