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:
Andy Dixon
2026-09-06 22:29:03 +01:00
parent 286d40a2d9
commit 937c5fb2ff
23 changed files with 2094 additions and 33 deletions
+332
View File
@@ -8498,6 +8498,338 @@
}
}
}
},
"/api/v1/capability-requests": {
"get": {
"operationId": "capabilityRequestsList",
"summary": "capability requests list",
"x-required-role": "observer",
"tags": [
"capability-requests"
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"401": {
"$ref": "#/components/responses/Error"
},
"403": {
"$ref": "#/components/responses/Error"
},
"404": {
"$ref": "#/components/responses/Error"
},
"422": {
"$ref": "#/components/responses/Error"
}
}
}
},
"/api/v1/capability-requests/{id}": {
"get": {
"operationId": "capabilityRequestGet",
"summary": "capability request get",
"x-required-role": "observer",
"tags": [
"capability-requests"
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"401": {
"$ref": "#/components/responses/Error"
},
"403": {
"$ref": "#/components/responses/Error"
},
"404": {
"$ref": "#/components/responses/Error"
},
"422": {
"$ref": "#/components/responses/Error"
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "identifier"
}
]
}
},
"/api/v1/capability-requests/{id}/grant": {
"post": {
"operationId": "capabilityRequestGrant",
"summary": "capability request grant",
"x-required-role": "operator",
"tags": [
"capability-requests"
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"401": {
"$ref": "#/components/responses/Error"
},
"403": {
"$ref": "#/components/responses/Error"
},
"404": {
"$ref": "#/components/responses/Error"
},
"422": {
"$ref": "#/components/responses/Error"
},
"201": {
"description": "Created"
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "identifier"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
},
"/api/v1/capability-requests/{id}/deny": {
"post": {
"operationId": "capabilityRequestDeny",
"summary": "capability request deny",
"x-required-role": "operator",
"tags": [
"capability-requests"
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"401": {
"$ref": "#/components/responses/Error"
},
"403": {
"$ref": "#/components/responses/Error"
},
"404": {
"$ref": "#/components/responses/Error"
},
"422": {
"$ref": "#/components/responses/Error"
},
"201": {
"description": "Created"
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "identifier"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
},
"/api/v1/scoped-grants": {
"get": {
"operationId": "scopedGrantsList",
"summary": "scoped grants list",
"x-required-role": "observer",
"tags": [
"scoped-grants"
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"401": {
"$ref": "#/components/responses/Error"
},
"403": {
"$ref": "#/components/responses/Error"
},
"404": {
"$ref": "#/components/responses/Error"
},
"422": {
"$ref": "#/components/responses/Error"
}
}
}
},
"/api/v1/minds/{mind}/scoped-grants": {
"post": {
"operationId": "scopedGrantCreate",
"summary": "scoped grant create",
"x-required-role": "operator",
"tags": [
"scoped-grants"
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"401": {
"$ref": "#/components/responses/Error"
},
"403": {
"$ref": "#/components/responses/Error"
},
"404": {
"$ref": "#/components/responses/Error"
},
"422": {
"$ref": "#/components/responses/Error"
},
"201": {
"description": "Created"
}
},
"parameters": [
{
"name": "mind",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "mind"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
}
}
},
"/api/v1/scoped-grants/{id}": {
"delete": {
"operationId": "scopedGrantRevoke",
"summary": "scoped grant revoke",
"x-required-role": "operator",
"tags": [
"scoped-grants"
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object"
}
}
}
},
"401": {
"$ref": "#/components/responses/Error"
},
"403": {
"$ref": "#/components/responses/Error"
},
"404": {
"$ref": "#/components/responses/Error"
},
"422": {
"$ref": "#/components/responses/Error"
},
"204": {
"description": "No Content"
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "identifier"
}
]
}
}
}
}