diff --git a/CLAUDE.md b/CLAUDE.md index eccdfe835..059ac66d0 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -29,9 +29,9 @@ and calls its composition root in `internal/app/`. | --- | --- | --- | | `archie-state-store` | State Store and Control Plane contracts; owns the task and control-plane PostgreSQL tables | PostgreSQL | | `archie-gateway` | Chat, conversation state, task tools | State Store | -| `archied` | Scheduling, workflow runs, harness, Daemon contract | State Store, Gateway, Messaging | +| `archied` | Scheduling, workflow runs, task containers, Daemon contract | State Store, Gateway, Messaging | | `archie-messaging` | External channel frontends | Gateway | -| `archie-ui` | Dashboard HTTP API (`internal/webui`) and the embedded SPA | State Store, Gateway, daemon, harness | +| `archie-ui` | Dashboard HTTP API (`internal/webui`) and the embedded SPA | State Store, Gateway, daemon | | `archie-agent` | The worker inside each task container | NATS | `internal/domain` holds behaviour and interfaces; `internal/infrastructure` diff --git a/internal/container/pool.go b/internal/container/pool.go index c45953446..72b7845f4 100644 --- a/internal/container/pool.go +++ b/internal/container/pool.go @@ -147,9 +147,6 @@ func (p *Pool) current() Config { // daemonLabel marks containers a pool owns; its value is the instance name. const daemonLabel = "archie-daemon" -// Instance is the name of the archie instance the pool belongs to. -func (p *Pool) Instance() string { return p.cfg.Instance } - // Config is the subset of daemon container configuration the pool needs. type Config struct { Image string @@ -616,13 +613,6 @@ func (p *Pool) Close() error { // ── helpers ────────────────────────────────────────────────────────── -// EnsureImage pulls ref under the live pull policy unless the pool has -// already made it available. The configured image was pulled by NewPool and -// recorded, so a caller naming it skips a second pull. -func (p *Pool) EnsureImage(ctx context.Context, ref string) error { - return p.ensureImage(ctx, p.current(), ref) -} - // ensureImage pulls ref under cfg's pull policy unless it is already present // in the pool. It is the live read an acquire uses; EnsureImage is the // exported form for callers that only name a ref. diff --git a/internal/contracts/state/v1/task_grant.pb.go b/internal/contracts/state/v1/task_grant.pb.go index c668861a9..ded359dcf 100644 --- a/internal/contracts/state/v1/task_grant.pb.go +++ b/internal/contracts/state/v1/task_grant.pb.go @@ -248,10 +248,8 @@ type ResolveTaskGrantResponse struct { TaskId int64 `protobuf:"varint,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` // Canonical execution identity; empty names the instance root RPC route. ExecutionIdentity string `protobuf:"bytes,2,opt,name=execution_identity,json=executionIdentity,proto3" json:"execution_identity,omitempty"` - // Canonical principal, including the instance root. - PrincipalId string `protobuf:"bytes,3,opt,name=principal_id,json=principalId,proto3" json:"principal_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *ResolveTaskGrantResponse) Reset() { @@ -298,13 +296,6 @@ func (x *ResolveTaskGrantResponse) GetExecutionIdentity() string { return "" } -func (x *ResolveTaskGrantResponse) GetPrincipalId() string { - if x != nil { - return x.PrincipalId - } - return "" -} - var File_state_v1_task_grant_proto protoreflect.FileDescriptor const file_state_v1_task_grant_proto_rawDesc = "" + @@ -319,11 +310,10 @@ const file_state_v1_task_grant_proto_rawDesc = "" + "\x05token\x18\x01 \x01(\tR\x05token\"\x19\n" + "\x17RevokeTaskGrantResponse\"/\n" + "\x17ResolveTaskGrantRequest\x12\x14\n" + - "\x05token\x18\x01 \x01(\tR\x05token\"\x85\x01\n" + + "\x05token\x18\x01 \x01(\tR\x05token\"v\n" + "\x18ResolveTaskGrantResponse\x12\x17\n" + "\atask_id\x18\x01 \x01(\x03R\x06taskId\x12-\n" + - "\x12execution_identity\x18\x02 \x01(\tR\x11executionIdentity\x12!\n" + - "\fprincipal_id\x18\x03 \x01(\tR\vprincipalId2\xa3\x02\n" + + "\x12execution_identity\x18\x02 \x01(\tR\x11executionIdentityJ\x04\b\x03\x10\x04R\fprincipal_id2\xa3\x02\n" + "\x10TaskGrantService\x12\\\n" + "\x11RegisterTaskGrant\x12\".state.v1.RegisterTaskGrantRequest\x1a#.state.v1.RegisterTaskGrantResponse\x12V\n" + "\x0fRevokeTaskGrant\x12 .state.v1.RevokeTaskGrantRequest\x1a!.state.v1.RevokeTaskGrantResponse\x12Y\n" + diff --git a/internal/domain/agentrun/runner.go b/internal/domain/agentrun/runner.go index 1b4c73085..a0b31114c 100644 --- a/internal/domain/agentrun/runner.go +++ b/internal/domain/agentrun/runner.go @@ -27,13 +27,6 @@ type Reporter struct { Transcript func(TranscriptEntry) } -// ReportToolCall forwards report to r.ToolCall, if set. -func (r Reporter) ReportToolCall(report ToolCallReport) { - if r.ToolCall != nil { - r.ToolCall(report) - } -} - // ReportTranscript forwards entry to r.Transcript, if set. func (r Reporter) ReportTranscript(entry TranscriptEntry) { if r.Transcript != nil { diff --git a/internal/domain/audit/audit.go b/internal/domain/audit/audit.go index 64723965d..a6bf9a453 100644 --- a/internal/domain/audit/audit.go +++ b/internal/domain/audit/audit.go @@ -109,7 +109,7 @@ func TargetKinds() []string { "capture", "secret", "member", "dashboard", "event", "orgs", "workspaces", "memberships", "org_agents", "mappings", "bindings", "event_types", "sources", - "installed_packages", "harness_secrets", + "installed_packages", // audit_retention is the retention sweep's coverage table, audit is // the resource kind a denied feed read names, and audit_export is the // row a completed export writes; all reach the feed as target kinds. diff --git a/internal/domain/storepkg/descriptor.go b/internal/domain/storepkg/descriptor.go index b66a6f517..4a601434d 100644 --- a/internal/domain/storepkg/descriptor.go +++ b/internal/domain/storepkg/descriptor.go @@ -165,7 +165,7 @@ func validSurface(surface string) bool { return surface == SurfaceSecretEngine || surface == SurfaceForge || surface == SurfaceChannel } -// PackageRef identifies a required package or Kit. References are pinned to +// PackageRef identifies a required package. References are pinned to // immutable content digests so dependency resolution cannot drift by tag. type PackageRef struct { Name string `yaml:"name"` diff --git a/internal/events/events.go b/internal/events/events.go index 3e9c7c552..1a8bafdfb 100644 --- a/internal/events/events.go +++ b/internal/events/events.go @@ -29,7 +29,7 @@ const ( // entry kind; data: agentrun.TranscriptEntry's fields. KindAgentTranscript = "agent_transcript" // KindDeliveryRecorded records one outward delivery a test run did not - // perform: a forge write, a push, an HTTP request, a central tool call. + // perform: a forge write, a push or an HTTP request. // detail: what it would have done, phrased "would ...". KindDeliveryRecorded = "delivery_recorded" KindParked = "parked" // data: reason diff --git a/internal/infrastructure/bindingcipher/cipher.go b/internal/infrastructure/bindingcipher/cipher.go index 97ad8c0c3..f371c3fda 100644 --- a/internal/infrastructure/bindingcipher/cipher.go +++ b/internal/infrastructure/bindingcipher/cipher.go @@ -23,17 +23,17 @@ const bindingEnvelopeVersion = "v1" // bindingNonceLen is GCM's recommended 12-byte nonce. const bindingNonceLen = 12 -// Domain is an envelope's marker and additional-authenticated-data: the +// domain is an envelope's marker and additional-authenticated-data: the // separator that stops a ciphertext sealed for one column being relocated to // a different one and still authenticating. // Domains share the same keyring; only the marker and AAD differ. -type Domain struct { +type domain struct { marker string aad []byte } -// BindingDomain seals binding and source webhook secrets. Not row-bound. -var BindingDomain = Domain{marker: "arcie-binding", aad: []byte("arcie-binding-secret")} +// bindingDomain seals binding and source webhook secrets. Not row-bound. +var bindingDomain = domain{marker: "arcie-binding", aad: []byte("arcie-binding-secret")} // bindingKeyFingerprintLen is the number of hex characters of the // SHA-256(material) fingerprint embedded in the envelope (8 bytes, far more @@ -46,16 +46,11 @@ const bindingKeyFingerprintLen = 16 // use. type BindingCipher interface { // Encrypt returns the sealed envelope for a plaintext secret, under - // BindingDomain. + // bindingDomain. Encrypt(plaintext string) (string, error) // Decrypt returns the plaintext secret for a sealed envelope sealed - // under BindingDomain. + // under bindingDomain. Decrypt(envelope string) (string, error) - // EncryptDomain and DecryptDomain are Encrypt/Decrypt for a caller-named - // domain, so a second column can share this - // cipher's keyring without sharing BindingDomain's AAD. - EncryptDomain(d Domain, plaintext string) (string, error) - DecryptDomain(d Domain, envelope string) (string, error) } // bindingCipher is AES-256-GCM with keys SHA-256(material). The active key @@ -88,19 +83,19 @@ func NewBindingCipher(active string, previous []string) (*bindingCipher, error) return c, nil } -// Encrypt seals plaintext under BindingDomain with the active key. +// Encrypt seals plaintext under bindingDomain with the active key. func (c *bindingCipher) Encrypt(plaintext string) (string, error) { - return c.EncryptDomain(BindingDomain, plaintext) + return c.encryptDomain(bindingDomain, plaintext) } -// Decrypt opens an envelope sealed under BindingDomain. +// Decrypt opens an envelope sealed under bindingDomain. func (c *bindingCipher) Decrypt(envelope string) (string, error) { - return c.DecryptDomain(BindingDomain, envelope) + return c.decryptDomain(bindingDomain, envelope) } -// EncryptDomain seals plaintext with the active key and returns the versioned +// encryptDomain seals plaintext with the active key and returns the versioned // envelope: ":v1::". -func (c *bindingCipher) EncryptDomain(d Domain, plaintext string) (string, error) { +func (c *bindingCipher) encryptDomain(d domain, plaintext string) (string, error) { block, err := aes.NewCipher(c.activeKey) if err != nil { return "", fmt.Errorf("store: binding cipher: %w", err) @@ -121,9 +116,9 @@ func (c *bindingCipher) EncryptDomain(d Domain, plaintext string) (string, error c.activeFingerprint, base64.RawURLEncoding.EncodeToString(payload)), nil } -// DecryptDomain decrypts an envelope sealed under d. An unknown key or wrong +// decryptDomain decrypts an envelope sealed under d. An unknown key or wrong // domain is an error. -func (c *bindingCipher) DecryptDomain(d Domain, envelope string) (string, error) { +func (c *bindingCipher) decryptDomain(d domain, envelope string) (string, error) { parts := strings.SplitN(envelope, ":", 4) if len(parts) != 4 || parts[0] != d.marker || parts[1] != bindingEnvelopeVersion { return "", errors.New("store: binding cipher: unrecognised envelope") diff --git a/internal/infrastructure/staterpc/task_grants.go b/internal/infrastructure/staterpc/task_grants.go index e08b3854d..60a59dc27 100644 --- a/internal/infrastructure/staterpc/task_grants.go +++ b/internal/infrastructure/staterpc/task_grants.go @@ -282,7 +282,7 @@ func (s *taskGrantServer) ResolveTaskGrant(ctx context.Context, r *pb.ResolveTas if err != nil { return nil, status.Error(codes.Unavailable, "execution identity unavailable") } - return &pb.ResolveTaskGrantResponse{TaskId: id, ExecutionIdentity: string(principal), PrincipalId: string(principal)}, nil + return &pb.ResolveTaskGrantResponse{TaskId: id, ExecutionIdentity: string(principal)}, nil } // RegisterTaskGrant creates fresh random material at the daemon and registers @@ -421,15 +421,6 @@ func (s *server) executionPrincipal(ctx context.Context, t *task.Task) (identity return value.ID, nil } -// TaskPrincipalForCredential resolves the task and its canonical execution principal. -func (c *Client) TaskPrincipalForCredential(ctx context.Context, token string) (*task.Task, identity.IdentityID, error) { - r, err := c.taskGrant.ResolveTaskGrant(ctx, &pb.ResolveTaskGrantRequest{Token: token}) - if err != nil { - return nil, "", unmapError(err) - } - t, err := c.TaskByID(ctx, r.TaskId) - return t, identity.IdentityID(r.PrincipalId), err -} type taskGrantServer struct { pb.UnimplementedTaskGrantServiceServer diff --git a/proto/state/v1/task_grant.proto b/proto/state/v1/task_grant.proto index 9cb899112..3bd7dac43 100644 --- a/proto/state/v1/task_grant.proto +++ b/proto/state/v1/task_grant.proto @@ -26,6 +26,6 @@ message ResolveTaskGrantResponse { int64 task_id = 1; // Canonical execution identity; empty names the instance root RPC route. string execution_identity = 2; - // Canonical principal, including the instance root. - string principal_id = 3; + reserved 3; + reserved "principal_id"; }