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

+16 -3
View File
@@ -16,10 +16,11 @@ import (
"sync"
"github.com/samcharles93/archie-core/internal/channels/status"
controlpb "github.com/samcharles93/archie-core/internal/contracts/controlplane/v1"
"github.com/samcharles93/archie-core/internal/domain/health"
"github.com/samcharles93/archie-core/internal/domain/identity"
"github.com/samcharles93/archie-core/internal/domain/messaging"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/domain/workflow/task"
"github.com/samcharles93/archie-core/internal/events"
"github.com/samcharles93/archie-core/internal/logging"
"github.com/samcharles93/archie-core/ui"
@@ -35,8 +36,6 @@ type Server struct {
// from the configuration it holds (LocalConfigView).
ConfigSource ConfigViewSource
// Workflows is the executable registry snapshot supplied by composition.
Workflows []task.Definition
// WorkRequests admits dashboard requests through the same task-creation
// boundary used by chat; it never invokes a workflow runner directly.
WorkRequests messaging.TaskCreator
@@ -103,6 +102,12 @@ type Server struct {
// deployment that has not wired probes never looks healthy by accident.
Health *health.Registry
// ControlPlane is the State Store's versioned runtime administration
// contract. The HTTP adapter supplies operator attribution; browser JSON
// never carries actor, source, or request IDs.
ControlPlane controlpb.ControlPlaneServiceClient
Identities identity.Repository
// Token gates access. Empty means no check, which is how loopback binds
// stay frictionless -- see IsLoopback.
Token string
@@ -262,6 +267,14 @@ func (s *Server) registerMappingAndBindingRoutes(mux *http.ServeMux) {
}
func (s *Server) registerConfigAndLogRoutes(mux *http.ServeMux) {
mux.HandleFunc("GET /api/control-plane/catalog", s.handleControlPlaneCatalog)
mux.HandleFunc("GET /api/control-plane/resources/{kind}", s.handleControlPlaneQuery)
mux.HandleFunc("POST /api/control-plane/resources/{kind}/commands/{command}", s.handleControlPlaneCommand)
mux.HandleFunc("GET /api/control-plane/watch/{kind}", s.handleControlPlaneWatch)
mux.HandleFunc("GET /api/identities", s.handleIdentitiesList)
mux.HandleFunc("GET /api/identities/watch", s.handleIdentitiesWatch)
mux.HandleFunc("POST /api/identities", s.handleIdentityCreate)
mux.HandleFunc("POST /api/identities/{id}/{command}", s.handleIdentityCommand)
mux.HandleFunc("GET /api/config", s.handleConfig)
mux.HandleFunc("PATCH /api/config", s.handleConfigUpdate)
mux.HandleFunc("POST /api/config/reset", s.handleConfigReset)