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

+12 -12
View File
@@ -17,10 +17,10 @@ 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/domain/binding"
"github.com/samcharles93/archie-core/internal/domain/curator"
"github.com/samcharles93/archie-core/internal/domain/mapping"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/domain/workflow"
"github.com/samcharles93/archie-core/internal/domain/workintake"
"github.com/samcharles93/archie-core/internal/eventbus"
@@ -100,26 +100,26 @@ type Daemon struct {
// remote archie-state-store service; it is always the configured
// [services.state].target after the in-process serving path is deleted.
ConnectedStateStore StateStoreEndpoint
Store storev1.TaskStore
Store storecontract.TaskStore
// Mappings persists payload field mappings (docs/prds/payload-field-mapping.md).
// Used by the binding dispatch loop to resolve capture bodies against
// the mapping a binding names. Optional: nil disables the binding
// dispatch loop (legacy behaviour).
Mappings storev1.MappingStore
Mappings storecontract.MappingStore
// Bindings persists playbook bindings (docs/prds/playbook-binding.md).
// Optional: nil disables the binding dispatch loop (legacy behaviour).
Bindings storev1.BindingStore
Bindings storecontract.BindingStore
// BindingDispatcher is the dispatch-time helper surface for bindings:
// list undispatched captures, look up armed bindings by source for the
// matcher, and write the at-most-once dedup ledger row. Split from
// BindingStore to keep the CRUD interface under the interfacebloat
// limit. Optional: nil disables the dispatch loop.
BindingDispatcher storev1.BindingDispatcher
BindingDispatcher storecontract.BindingDispatcher
// BindingTaskCreator enqueues a task triggered by a binding. Split
// off TaskLifecycle so the lifecycle surface stays narrow and the
// dispatch loop does not acquire the full task-creation contract.
// Optional: nil disables the dispatch loop.
BindingTaskCreator storev1.BindingTaskCreator
BindingTaskCreator storecontract.BindingTaskCreator
Forge forge.Forge
Trees *worktree.Manager
Bus *events.Bus
@@ -517,7 +517,7 @@ const bindingDispatchBatchLimit = 100
//
// The binding_dispatches ledger is the at-most-once guarantee across
// cycles and daemon restarts: RecordDispatch returns
// storev1.ErrAlreadyDispatched on a duplicate (binding_id, capture_id)
// storecontract.ErrAlreadyDispatched on a duplicate (binding_id, capture_id)
// pair, and dispatchOneBinding treats that as a normal "another cycle
// raced us" outcome rather than an error.
//
@@ -580,7 +580,7 @@ func (d *Daemon) dispatchBindings(ctx context.Context) {
// repo (when exactly one is configured); binding.Owner/Repo is a
// follow-up so multi-repo deployments don't have to live with the
// ambiguity.
func (d *Daemon) dispatchOneBinding(ctx context.Context, b binding.Binding, c storev1.CapturedEvent) {
func (d *Daemon) dispatchOneBinding(ctx context.Context, b binding.Binding, c storecontract.CapturedEvent) {
if d.Mappings == nil {
d.Log.Warn("binding dispatch: mapping store unavailable", "binding", b.ID)
return
@@ -623,7 +623,7 @@ func (d *Daemon) dispatchOneBinding(ctx context.Context, b binding.Binding, c st
}
if err := d.BindingDispatcher.RecordDispatch(ctx, b.ID, int64(b.Version), c.ID, task.ID); err != nil {
if errors.Is(err, storev1.ErrAlreadyDispatched) {
if errors.Is(err, storecontract.ErrAlreadyDispatched) {
// Another cycle or daemon instance raced us and already
// recorded the dispatch. The duplicate task remains
// queued (delete-on-races is its own can of worms),
@@ -664,7 +664,7 @@ func hasBlockingFailure(fields []mapping.Field, failures []mapping.Failure) bool
// resolved, one "key=value" pair per line. Empty maps still produce
// a body that records the source capture id so the workflow has
// provenance to hand back to the operator.
func renderBindingBody(values map[string]any, c storev1.CapturedEvent) string {
func renderBindingBody(values map[string]any, c storecontract.CapturedEvent) string {
if len(values) == 0 {
return fmt.Sprintf("(no fields resolved from capture %d)", c.ID)
}
@@ -1283,7 +1283,7 @@ func (d *Daemon) acquireTaskContainer(
// that survives cancellation while preserving values.
//
// The transition remains guarded from StatusRunning: if the worker already
// recorded a terminal state over storerpc, storev1.ErrStaleTransition is returned
// recorded a terminal state over storerpc, storecontract.ErrStaleTransition is returned
// and ignored. Unexpected store errors are logged as warnings.
func (d *Daemon) parkRunningTask(ctx context.Context, taskID int64, reason string) {
if d.Store == nil {
@@ -1293,7 +1293,7 @@ func (d *Daemon) parkRunningTask(ctx context.Context, taskID int64, reason strin
defer cancel()
if err := d.Store.Transition(writeCtx, taskID, workflow.StatusRunning, workflow.StatusParked, reason); err != nil {
if !errors.Is(err, storev1.ErrStaleTransition) {
if !errors.Is(err, storecontract.ErrStaleTransition) {
d.Log.Warn("terminal park transition failed", "task", taskID, "reason", reason, "err", err)
}
}