feat(capabilities): metadata, frozen registry, scoped grants and requests
- Capabilities declare access (read/write, unknown fails closed as write), side effects, idempotency, timeout, cost estimate and the trust of their output (web content is low trust). A capability may derive its policy target from its parameters; a disagreeing target is refused, and approvals whose modified parameters change the target are refused. - The registry is frozen at start-up; registration afterwards panics. - Invocation.RequireApproval turns ALLOW into ASK for commitments; it can only tighten, and scoped grants never satisfy it. - Scoped grants (migration 0025): capability, target and parameter globs, access, expiry of at most seven days and an optional operation count consumed atomically; applied only where policy says ASK. A sweep marks lapsed grants and refreshes the self-model, which now lists live grants. - Capability requests carry scope, duration, operation cap, reason, evidence, risk, mitigation, fallback, alternatives and explicit decision history; they batch per intention, are capped per mind (operator attention budget) and can be decided only by a named person. Component names are refused as deciders, for approvals too, and as usernames. - API routes, OpenAPI entries, scheduler sweeps and approval-centre sections for requests and temporary grants.
This commit is contained in:
+9
-1
@@ -166,6 +166,7 @@ func run() error {
|
||||
for _, c := range integrations.Capabilities(deps.Integrations, integrations.GitPoller{DataDir: "./data/git"}, integrations.PrometheusPoller{Secrets: sec}) {
|
||||
capReg.Add(c)
|
||||
}
|
||||
capReg.Freeze()
|
||||
deps.Capabilities = &capabilities.Service{Registry: capReg, DB: db, Events: deps.Events, Log: log, Metrics: metrics, ApprovalTTL: 24 * time.Hour, SessionTTL: 8 * time.Hour}
|
||||
selfSync := cognition.SelfModelSync{Minds: deps.Minds, Caps: deps.Capabilities, Events: deps.Events, Log: log}
|
||||
deps.Capabilities.OnSelfModel = selfSync.Sync
|
||||
@@ -202,7 +203,14 @@ func run() error {
|
||||
}}
|
||||
selfSync.Sync(ctx, ids.Nil)
|
||||
group.Every("integrations.tick", time.Minute, deps.Integrations.Tick)
|
||||
group.Every("approvals.expire", 5*time.Minute, func(ctx context.Context) error { _, err := deps.Capabilities.ExpirePending(ctx); return err })
|
||||
group.Every("approvals.expire", 5*time.Minute, func(ctx context.Context) error {
|
||||
if _, err := deps.Capabilities.ExpirePending(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
_, err := deps.Capabilities.ExpireCapabilityRequests(ctx)
|
||||
return err
|
||||
})
|
||||
group.Every("grants.sweep", time.Minute, func(ctx context.Context) error { _, err := deps.Capabilities.SweepGrants(ctx); return err })
|
||||
group.Every("predictions.resolve", time.Minute, deps.Resolver.Run)
|
||||
group.Every("cognition.background", 5*time.Minute, func(ctx context.Context) error { return backgroundCognition(ctx, deps) })
|
||||
group.Every("memory.decay", 6*time.Hour, func(ctx context.Context) error { return decayMemories(ctx, deps) })
|
||||
|
||||
Reference in New Issue
Block a user