feat(controlplane): runtime administration over the State Store's gRPC server

The Web UI and messaging channels now read and write Archie's runtime
settings through one versioned, audited control-plane API hosted on the
State Store's existing gRPC server: catalog, query, command, watch. Each
feature owns its resource, validation and commands; storage only writes
versions and audit records.

Workflows move with it. Definitions become portable YAML compiled through
a closed, typed step registry and stored as a control-plane resource, so
the yaegi interpretation paths (internal/gate, wfeval, wfextract,
gateeval, gateextract, skillbuild) are deleted rather than carried.

The UI process reads definitions as data: the JSON projection lives in
internal/domain/workflow/task so a dashboard decodes the stored
collection without linking the workflow engine, which cmd/archie-ui's
deletion gate forbids. Shipped definitions ride the catalog descriptor
rather than a bespoke REST route, keeping the API to its four operations.

archie-messaging gains -state-store-target/-state-store-token and reads
channel settings from the database, failing closed when the State Store
is unreachable: the database is authoritative for those settings.
This commit is contained in:
sam committed 2026-09-21 08:17:42 +10:00
1 parent 2e172c679c
commit 924b02a1b0
131 files changed
+8510 -3371

No files matched your search

+3 -9
View File
@@ -8,15 +8,9 @@ package task
// its base, so this is the only record of what an attempt actually changed.
// Nothing re-derives it after the fact.
//
// The value types live in this subpackage rather than in package workflow or
// internal/worktree, for two reasons that were checked rather than assumed.
// Package workflow must never import internal/worktree -- it has no such
// import today -- so a shared value cannot live there. And this subpackage is
// not projected into the interpreted-stage symbol table (the generated
// wfextract table names no type from here), whereas a new exported type in
// package workflow would be reachable from repository-authored
// `.archie/stages/*.go`. Declaring it here widens nothing and needs no
// symbol-table regeneration.
// The value types live in this subpackage because package workflow must not
// import internal/worktree. Both the workflow engine and persistence boundary
// can use the measurement without depending on git infrastructure.
type ChangeStats struct {
BaseSHA string `json:"base_sha"`
HeadSHA string `json:"head_sha"`
@@ -0,0 +1,28 @@
package task
// WorkflowDefinitionEntry is one workflow's portable YAML as the control plane
// stores and serves it. YAML stays canonical and can be copied between Archie
// installations.
//
// It lives with the task vocabulary rather than with the engine for the same
// reason Definition does: a dashboard reads the stored collection without
// linking the workflow engine, which the UI process must never pull in.
type WorkflowDefinitionEntry struct {
ID string `json:"id"`
YAML string `json:"yaml"`
}
// WorkflowDefinitionCollection is the workflow-definitions resource value.
type WorkflowDefinitionCollection struct {
Definitions []WorkflowDefinitionEntry `json:"definitions"`
}
// DefinitionByID resolves one workflow from a collection.
func (c WorkflowDefinitionCollection) DefinitionByID(id string) (WorkflowDefinitionEntry, bool) {
for _, entry := range c.Definitions {
if entry.ID == id {
return entry, true
}
}
return WorkflowDefinitionEntry{}, false
}
+20 -14
View File
@@ -44,15 +44,22 @@ type Task struct {
Labels string `json:"labels"` // comma-separated, as seen at enqueue time
Status string `json:"status"`
Workflow string `json:"workflow"`
Stage string `json:"stage"`
Branch string `json:"branch"`
Plan string `json:"plan"`
Notes string `json:"notes"`
PRNumber int `json:"pr_number"`
TokensUsed int `json:"tokens_used"`
Iterations int `json:"iterations"`
Attempt int `json:"attempt"`
ParkReason string `json:"park_reason"`
// WorkflowDefinitionVersion and WorkflowDefinitionDigest pin the exact
// database definition selected for this execution. WorkflowDefinitionYAML
// is the immutable worker handoff; retries reuse it instead of re-reading
// the active control-plane resource.
WorkflowDefinitionVersion int64 `json:"workflow_definition_version"`
WorkflowDefinitionDigest string `json:"workflow_definition_digest"`
WorkflowDefinitionYAML string `json:"workflow_definition_yaml"`
Stage string `json:"stage"`
Branch string `json:"branch"`
Plan string `json:"plan"`
Notes string `json:"notes"`
PRNumber int `json:"pr_number"`
TokensUsed int `json:"tokens_used"`
Iterations int `json:"iterations"`
Attempt int `json:"attempt"`
ParkReason string `json:"park_reason"`
// RetryCount tracks how many times a parked task has been retried
// (parking-to-queued transitions). When it reaches the configured
// max_retries the daemon moves the task to StatusDead.
@@ -124,9 +131,8 @@ type Store interface {
// workflow) for the same reason this package exists: dashboards render
// Definitions without linking the engine.
type Definition struct {
ID string `json:"id"`
Name string `json:"name"`
Origin string `json:"origin"`
Enabled bool `json:"enabled"`
Stages []string `json:"stages"`
ID string `json:"id"`
Name string `json:"name"`
Origin string `json:"origin"`
Enabled bool `json:"enabled"`
}