@sema-agent/sdk 30.0.0 → 31.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +134 -0
  2. package/dist/errors.d.ts +40 -4
  3. package/dist/errors.d.ts.map +1 -1
  4. package/dist/errors.js +38 -3
  5. package/dist/errors.js.map +1 -1
  6. package/dist/events.d.ts +86 -11
  7. package/dist/events.d.ts.map +1 -1
  8. package/dist/events.js.map +1 -1
  9. package/dist/health.d.ts +14 -0
  10. package/dist/health.d.ts.map +1 -1
  11. package/dist/health.js.map +1 -1
  12. package/dist/index.d.ts +13 -6
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +6 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/resources/approvals.d.ts +2 -1
  17. package/dist/resources/approvals.d.ts.map +1 -1
  18. package/dist/resources/approvals.js.map +1 -1
  19. package/dist/resources/fleet.d.ts +52 -0
  20. package/dist/resources/fleet.d.ts.map +1 -1
  21. package/dist/resources/fleet.js +25 -0
  22. package/dist/resources/fleet.js.map +1 -1
  23. package/dist/resources/memory.d.ts +26 -11
  24. package/dist/resources/memory.d.ts.map +1 -1
  25. package/dist/resources/memory.js +27 -6
  26. package/dist/resources/memory.js.map +1 -1
  27. package/dist/resources/runs.d.ts +62 -1
  28. package/dist/resources/runs.d.ts.map +1 -1
  29. package/dist/resources/runs.js +32 -0
  30. package/dist/resources/runs.js.map +1 -1
  31. package/dist/resources/session-sync.d.ts +9 -0
  32. package/dist/resources/session-sync.d.ts.map +1 -1
  33. package/dist/resources/session-sync.js +9 -0
  34. package/dist/resources/session-sync.js.map +1 -1
  35. package/dist/resources/sessions.d.ts +23 -14
  36. package/dist/resources/sessions.d.ts.map +1 -1
  37. package/dist/resources/sessions.js +23 -11
  38. package/dist/resources/sessions.js.map +1 -1
  39. package/dist/resources/side-query.d.ts +20 -2
  40. package/dist/resources/side-query.d.ts.map +1 -1
  41. package/dist/resources/side-query.js.map +1 -1
  42. package/dist/resources/tasks.d.ts +6 -1
  43. package/dist/resources/tasks.d.ts.map +1 -1
  44. package/dist/resources/tasks.js +6 -1
  45. package/dist/resources/tasks.js.map +1 -1
  46. package/dist/resources/tool-approvals.d.ts +4 -3
  47. package/dist/resources/tool-approvals.d.ts.map +1 -1
  48. package/dist/resources/tool-approvals.js +4 -3
  49. package/dist/resources/tool-approvals.js.map +1 -1
  50. package/dist/settings.d.ts +29 -5
  51. package/dist/settings.d.ts.map +1 -1
  52. package/dist/settings.js +6 -1
  53. package/dist/settings.js.map +1 -1
  54. package/dist/sse.d.ts +5 -1
  55. package/dist/sse.d.ts.map +1 -1
  56. package/dist/sse.js +8 -3
  57. package/dist/sse.js.map +1 -1
  58. package/dist/types.d.ts +228 -26
  59. package/dist/types.d.ts.map +1 -1
  60. package/dist/types.js +7 -0
  61. package/dist/types.js.map +1 -1
  62. package/openapi.yaml +552 -39
  63. package/package.json +2 -2
package/openapi.yaml CHANGED
@@ -474,9 +474,17 @@ paths:
474
474
  '409':
475
475
  description: >-
476
476
  Conflict (ConflictError). 409 — session already has an active run (`conflict.session_active_run`, `activeTaskId`,
477
- `pendingGate`), OR an idempotency/session-CAS conflict. ⚠️ The SDK surfaces it as a TYPED ConflictError and does
477
+ `pendingGate`), OR an idempotency/session-CAS conflict. Server >= 7.140.0, zero-work submissions only: `config.read_deny_floor_unkept` — the
478
+ deployment sets `READ_DENY_FLOOR_REQUIRED=true` and this run's read-deny table has rows while its execution environment does not keep the byte floor (all
479
+ seven lanes today): refused at prepare, no command started, zero tokens. NOT a request error — the deployment state conflicts with it (use an execution
480
+ environment that keeps the floor, or the operator drops the knob; then the run proceeds and each run raises one operator notice with the same code, off the
481
+ user stream). Only reachable when the operator set the knob; a retry does not change the verdict. ⚠️ The SDK surfaces it as a TYPED ConflictError and does
478
482
  NOT silently resolve it to that run: `activeTaskId` may be the caller's own first attempt OR an unrelated
479
483
  concurrent run on the same session — 409 alone cannot tell (same text as the `Conflict` response component).
484
+ Server >= 7.138.0 (engine 7.58.0), zero-work submissions only, the project-identity reconciliation: `config.project_identity_mismatch` (the declared `projectId`, or the project the session's previous leg declared, is not the
485
+ checkout's `.sema/project` marker), `config.memory_project_marker` (the marker is unreadable and this leg needs a project identity) and `config.memory_project_marker_nested` (the marker is nested below the repo root) —
486
+ refused before the run starts, zero tokens; the request is well-formed, the checkout state conflicts with it (declare the marker's id / fix the marker / use another session; a verbatim retry does not change the verdict). `activeTaskId` is
487
+ absent. Async / live legs answer 2xx with the same code on the terminal run row / `done` frame's `terminal.code`.
480
488
  K-24 (server >= 7.104.0 / S-724, zero-work submissions only): `rewind.store_unconfigured` — this
481
489
  deployment has NO file-history store but the request asks to restore files; the request is well-formed, the
482
490
  deployment shape conflicts with it (change the deployment, not the request; `capabilities.rewindFiles` is false
@@ -610,6 +618,12 @@ paths:
610
618
  sessionId?}` — the X-Task-Id response header as a first-class in-stream signal (EventSource and
611
619
  some proxies cannot read headers). Same source, same condition: no durable ledger => neither the
612
620
  header nor the meta frame.
621
+ FRAME NAMING (server >= 7.141.0): EVERY frame on this stream is `[id: <eventId>\n]event: <type>\ndata: <json>` — the
622
+ event name is the payload's `type` (engine frames and `done` included; heartbeat = `event: heartbeat` + `data: {}`), the
623
+ same frame shape as `GET /v1/runs/{taskId}/events`. On <= 7.140.x the engine frames and `done` were unnamed `data:` frames
624
+ (only `meta`, the heartbeat and the out-of-band approval / question / form frames were named). A reader on the default
625
+ `message` channel (`EventSource.onmessage`) receives no content frame and no `done` from a 7.141.0 server: listen by event
626
+ name, or parse each `data:` line and dispatch on its `type` (what the SDK's `tasks.stream` does — unchanged).
613
627
  content:
614
628
  text/event-stream:
615
629
  schema: { $ref: '#/components/schemas/AgentEvent' }
@@ -647,6 +661,9 @@ paths:
647
661
  description: >
648
662
  Async; runs in the background. Requires a TiDB run store (absent → 501). Auto `Idempotency-Key`.
649
663
  Poll `GET /v1/runs/:id` or stream `GET /v1/runs/:id/events`. A client disconnect does NOT stop the run.
664
+ Prepare-time refusals do not answer an HTTP error here: the 202 receipt is followed by a run that ends `failed` with the code (e.g. server >= 7.140.0
665
+ `config.read_deny_floor_unkept` when the deployment sets `READ_DENY_FLOOR_REQUIRED=true`; the synchronous `POST /v1/tasks` answers 409 for the same state; server >= 7.138.0 the project-identity codes
666
+ `config.project_identity_mismatch` / `config.memory_project_marker` / `config.memory_project_marker_nested` land the same way — a 202 receipt, then a run that ends `failed` with the code on its terminal row).
650
667
  parameters:
651
668
  - $ref: '#/components/parameters/IdempotencyKey'
652
669
  requestBody:
@@ -1028,6 +1045,80 @@ paths:
1028
1045
  application/json:
1029
1046
  schema: { $ref: '#/components/schemas/ErrorResponse' }
1030
1047
 
1048
+ /v1/runs/{taskId}/permission-mode:
1049
+ parameters:
1050
+ - $ref: '#/components/parameters/PrincipalHeader'
1051
+ - $ref: '#/components/parameters/TaskIdPath'
1052
+ - name: session
1053
+ in: query
1054
+ required: false
1055
+ schema: { type: string }
1056
+ description: >-
1057
+ For a session-bound run a non-operator caller sends the run's session id here — a mismatch answers the same 404 as an unknown run
1058
+ (the shared run-face session assertion; absence is accepted today).
1059
+ post:
1060
+ tags: [runs]
1061
+ operationId: runsSetPermissionMode
1062
+ x-status: gated # server 7.141.0 route `run-permission-mode`; gate = capabilities.permissionModeWrite (durable run store AND checkpoint store) => 501 when unmet. SDK runs.setPermissionMode() consumes it.
1063
+ summary: Switch the permission mode of a RUNNING run.
1064
+ description: >
1065
+ server >= 7.141.0. Body is exactly `{ mode }` (the six engine words); passes straight to the engine's switch verb and answers 200 with
1066
+ its receipt (`PermissionModeSwitchResult`). The submit door and this door share ONE admission judge: the operator `AUTONOMY` floor,
1067
+ the hosted write fence and the task settings' `disableAutoMode` fold / refuse identically on both (refusal `422
1068
+ request.host_posture_refused`, same sentence as the submit door). The admitted word is written back to the run's stored request under
1069
+ the run's claim fence (a later leg that took over is never overwritten); a miss answers `persisted: false` + `persistMiss`. Concurrent
1070
+ switches on one run are serialized server-side. Gate: `capabilities.permissionModeWrite`.
1071
+ requestBody:
1072
+ required: true
1073
+ content:
1074
+ application/json:
1075
+ schema:
1076
+ type: object
1077
+ required: [mode]
1078
+ additionalProperties: false
1079
+ properties:
1080
+ mode: { $ref: '#/components/schemas/PermissionMode' }
1081
+ responses:
1082
+ '200':
1083
+ description: Switched.
1084
+ content:
1085
+ application/json:
1086
+ schema: { $ref: '#/components/schemas/PermissionModeSwitchResult' }
1087
+ '400':
1088
+ description: '`request.body_shape` — the body is not exactly `{ mode: <string> }`.'
1089
+ content:
1090
+ application/json:
1091
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
1092
+ '401': { $ref: '#/components/responses/Unauthorized' }
1093
+ '404':
1094
+ description: '`not_found.run` — unknown run, not yours, or the `session` assertion does not match.'
1095
+ content:
1096
+ application/json:
1097
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
1098
+ '409':
1099
+ description: >-
1100
+ `steering.not_running` — the run is parked on a pending decision, already ended, live on another replica, or has no live switchable
1101
+ face on this replica (a verify / cascade submission); the sentence says which. `conflict.resume_context_unavailable` — the run's
1102
+ stored request is missing; `conflict.checkpoint_ctx_unsealable` — it holds credentials this server cannot unseal.
1103
+ content:
1104
+ application/json:
1105
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
1106
+ '422':
1107
+ description: '`steering.invalid_content` — `mode` is not one of the six words (judged before the run is read); `request.host_posture_refused` — the hosted write fence refuses that mode (same sentence as the submit door).'
1108
+ content:
1109
+ application/json:
1110
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
1111
+ '429': { $ref: '#/components/responses/RateLimited' }
1112
+ '500':
1113
+ description: '`corrupt` — the stored request cannot be read (the operator repairs or removes the row named in `where`).'
1114
+ content:
1115
+ application/json:
1116
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
1117
+ '501':
1118
+ description: '`capability.run_store_required` (no durable run store) / `capability.checkpoint_store_required` (no checkpoint store, `DURABLE_APPROVAL`) — the two causes of `capabilities.permissionModeWrite: false`.'
1119
+ content:
1120
+ application/json:
1121
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
1031
1122
  /v1/runs/{taskId}/interrupt:
1032
1123
  parameters:
1033
1124
  - $ref: '#/components/parameters/PrincipalHeader'
@@ -2901,6 +2992,19 @@ paths:
2901
2992
  Cross-incarnation caveat (server-side, cannot be fixed at this layer): the capture record and the
2902
2993
  lineage ledger are keyed by the BARE sessionId and outlive the session, so a re-claimed id reads the
2903
2994
  PREVIOUS incarnation's counts/opt-out (metadata only, no content bytes).
2995
+
2996
+ 🔴 TWO STORES, ONE ANSWER (server >= 7.140.0; contract §9 head): a session can span two memory stores (file backend: the typed personal layers live
2997
+ in a second store under the personal mount). Without `scope` the server reads EVERY store of this deployment (at most two) and folds the answers key by
2998
+ key, never minting a stand-in value: `committedCount` / `foldedCount` are summed, and ABSENT if any store's ledger could not be read (not 0);
2999
+ `lastCaptureAt` is the maximum over the stores that answer it, absent when `committedCount` is absent (`foldedCount` absent on its own does not suppress it) or when no store answers it (no contribution anywhere); `captureOptedOut` is `true` as soon as ANY store holds a
3000
+ capture record (with `optOutSource: "record"`), `false` only when every store answers `false`, and otherwise (a store's record unreadable) absent with
3001
+ `optOutSource: "fault"`. One store ⇒ exactly that store's answer (single-store deployments answer byte-for-byte as 7.139.x). The optional query `scope=<layer key>`
3002
+ answers only the store that layer lives in. The fold is a TRANSITIONAL form (deleted when the engine serves a deployment-wide status); the cache is keyed
3003
+ by (session, store control plane). Without `scope` this verb never answers `request.memory_layer` form (3); an unreadable `scope` (or an unreadable
3004
+ deployment layer) ⇒ 400 `request.memory_layer` with a FIXED sentence for the session owner; `scope` present but not a non-empty string ⇒ 400
3005
+ `request.field_invalid`. 7.139.x and earlier read the deployment's store only (the personal half read as 0).
3006
+ parameters:
3007
+ - $ref: '#/components/parameters/MemoryLayerSeatQuery'
2904
3008
  responses:
2905
3009
  '200':
2906
3010
  description: >-
@@ -2947,15 +3051,25 @@ paths:
2947
3051
  there is no operator override arm), and the attestation's `select` echoes exactly that. The body is
2948
3052
  `SessionMemoryEraseRequest` handed through as sent: no `select` (a body carrying one is a loud 400
2949
3053
  `request.body_shape`, never silently ignored — while any OTHER unknown key IS silently ignored and not forwarded),
2950
- `allowUnevidenced` NEVER INJECTED (the degraded lane is a human authorization statement).
3054
+ `allowUnevidenced` NEVER INJECTED (the degraded lane is a human authorization statement). The one added key is the optional layer seat `scope`
3055
+ (server >= 7.140.0).
2951
3056
 
2952
3057
  🔴 `requestId` IS THIS ERASURE'S IDEMPOTENCY IDENTITY — the same two-lane law as the operator face (read
2953
3058
  `evidenceCapability`): `"journal"` ⇒ a resend with the SAME id reads back the anchor's pinned ids and never re-resolves
2954
3059
  (retry after a lost ack, or after the operator removed the link behind a 409 `memory.target_outside_store`, with the SAME
2955
3060
  id); `"none"` ⇒ same id = a NEW request (a second real delete). The only memory backend that mounts this face today (file:
2956
3061
  owns the engine control plane and the evidence face) takes the journal lane. Mint a NEW id per erase action per session:
2957
- reusing an id on ANOTHER session is a different selector, which core refuses (`memory.erasure_selector_mismatch`) — and
2958
- THIS face does not classify that refusal (see 500). 🔴 DO NOT put an automatic retry policy on this endpoint.
3062
+ reusing an id on ANOTHER session is a different selector, which core refuses (409 `memory.erasure_selector_mismatch`; since
3063
+ server 7.108.0 this face classifies it like the operator face does — <= 7.107.x answered 500 `internal.error`). 🔴 DO NOT put an
3064
+ automatic retry policy on this endpoint.
3065
+
3066
+ 🔴 ERASURE EXECUTES ONLY ON THE DEPLOYMENT'S STORE (server >= 7.140.0, a transitional guard — the engine has no deployment-wide erasure request identity yet).
3067
+ Without `scope`: the by-session erasure runs on the deployment's store, and if this session has contributions in the OTHER store (the personal mount) or that
3068
+ store's ledger cannot be read ⇒ 409 `memory.erasure_store_unjudged` — NOTHING erased (7.139.x answered 200 and erased the deployment-store half). With `scope`
3069
+ naming a layer that lives in the deployment's store (e.g. `local`) ⇒ it runs there, 200, the attestation covers the deployment's store only (the layer seat does
3070
+ not reach the engine or the attestation) and the other store's half is neither judged nor mentioned; `scope` naming a layer on the personal mount ⇒ 409
3071
+ `memory.erasure_store_unjudged`. The audience is the session owner, so every refusal on this face is a FIXED sentence (layer keys and paths never ride the wire;
3072
+ the engine's sentence goes to the operator log). 400 `request.memory_layer` here means the `scope` (or this deployment's configured layer) cannot be read.
2959
3073
 
2960
3074
  GATE ORDER (release bytes): 503 destructive-session-write guard → 401 → 501 (no owner audit face — BEFORE the 404: a
2961
3075
  deployment without one must not fake a 404) → 404 (unknown AND non-owner, SAME code SAME message) → 501 (compliance face
@@ -2979,7 +3093,9 @@ paths:
2979
3093
  path; the operator face takes explicit selectors). "request.request_id_required" — `requestId` missing / empty /
2980
3094
  non-string. "request.field_invalid" — `allowUnevidenced` present but not a boolean. "request.path_malformed" — the
2981
3095
  session id segment is not valid percent-encoding. "config.memory_erasure_request" — core's own selector verdict (the
2982
- route keeps the arm; today the server's own gates answer first, so it is not reached).
3096
+ route keeps the arm; today the server's own gates answer first, so it is not reached). Server >= 7.140.0: "request.memory_layer" — the
3097
+ `scope` (or this deployment's configured layer) cannot be read (a FIXED sentence for the session owner); "request.field_invalid" also
3098
+ covers a `scope` that is present but not a non-empty string.
2983
3099
  content:
2984
3100
  application/json:
2985
3101
  schema: { $ref: '#/components/schemas/ErrorResponse' }
@@ -2990,18 +3106,22 @@ paths:
2990
3106
  errorCode "memory.target_outside_store" — a directory in this deployment's memory store leads outside it (a link). FIXED
2991
3107
  text on this face (the host path is not echoed; core's sentence goes to the operator log `session_memory_erase_refused`).
2992
3108
  A refusal before the commit point changed nothing; one after it keeps the deletions already made plus a journal. Ask
2993
- the operator to remove the link, then resend with the SAME `requestId`.
3109
+ the operator to remove the link, then resend with the SAME `requestId`. Since server 7.108.0 the other classified refusals of the
3110
+ operator face arrive here too, each with its own code and a FIXED sentence: "memory.erasure_selector_mismatch" /
3111
+ "memory.erasure_evidence_unavailable" / "memory.erasure_census_incomplete"; "memory.scope_home_not_directory" (server >= 7.118.0, same
3112
+ reading as the link code). Server >= 7.140.0: "memory.erasure_store_unjudged" — the erasure lands on the memory store other than the
3113
+ deployment's (a `scope` naming a personal-mount layer, or no `scope` and this session has contributions there / that store's ledger cannot be
3114
+ read): NOTHING erased; a transitional guard, do NOT retry.
2994
3115
  content:
2995
3116
  application/json:
2996
3117
  schema: { $ref: '#/components/schemas/ErrorResponse' }
2997
3118
  '500':
2998
3119
  description: >
2999
- errorCode "internal.error" ("session memory erasure failed") — anything else the engine threw. ⚠️ UNLIKE the operator
3000
- face, this face does NOT forward core's coded refusals: 409 `memory.erasure_selector_mismatch` /
3001
- `memory.erasure_evidence_unavailable` / `memory.erasure_census_incomplete` and the two-meaninged 500
3002
- `internal.memory_control_plane_corrupt` all land HERE — including "deletions COMMITTED, only the residue enumeration
3003
- failed". Never read this 500 as "nothing was deleted": resend with the SAME `requestId` (the journal lane replays and
3004
- converges).
3120
+ errorCode "internal.error" ("session memory erasure failed") — anything the classified map does not cover. Since server 7.108.0 this face
3121
+ shares the operator face's classified map (codes and statuses identical, only the audience wording differs), so core's coded refusals arrive under their
3122
+ own codes. The two-meaninged 500 `internal.memory_control_plane_corrupt` is also classified here (a fixed sentence): either nothing changed, or the deletions
3123
+ were COMMITTED and only the residue enumeration failed — never read a 500 as "nothing was deleted": resend with the SAME `requestId` (the journal lane
3124
+ replays and converges).
3005
3125
  content:
3006
3126
  application/json:
3007
3127
  schema: { $ref: '#/components/schemas/ErrorResponse' }
@@ -4963,6 +5083,54 @@ paths:
4963
5083
  '401': { $ref: '#/components/responses/Unauthorized' }
4964
5084
  '501': { $ref: '#/components/responses/NotImplemented' }
4965
5085
 
5086
+ /v1/agents/roster:
5087
+ parameters:
5088
+ - $ref: '#/components/parameters/PrincipalHeader'
5089
+ get:
5090
+ tags: [fleet]
5091
+ operationId: agentsRoster
5092
+ x-status: gated # server src/http/routes/agents-roster.ts — deployment switch = capability `agentRoster` (no durable background-agent store → the route self-answers 501); sdk 31.0.0 `client.fleet.agentRoster()`.
5093
+ summary: List the background-agent roster (cross-session, newest first).
5094
+ description: >
5095
+ The background-agent ROSTER read face: which background agents does this tenant have, and in what state — across sessions (`?session=` is only an optional narrowing). Rows are a content-free
5096
+ whitelist (`AgentRosterRow`): `handle` / `name` / `agentType?` / `status` / `spawnedAt` / `updatedAt` / `settledAt?` / `anonymous?` — NO `owner`, NO session id (the roster is not an addressing face),
5097
+ NO `usage`. `name` is always present (engine 7.57.0+: an unnamed agent carries the engine-derived name `agent-<12 hex>`); `anonymous: true` (server >= 7.138.0) is present exactly when `name` IS that derived name.
5098
+ Query: `limit` 1..100 (default 20), `before` (the opaque `nextBefore` of the previous page), `status` (closed: running / parked / completed / failed / killed), `session` (narrow to one session tree), `scope`
5099
+ (fleet-wide callers only; a principal caller is pinned to its own scope). All strictly validated (400 `request.query_invalid`, never a silent default). `total` is the owner-scoped row count of the roster WINDOW (500 rows):
5100
+ `truncated: true` means the tenant has more rows than the window — do not read `total` as the whole. 🔴 Another tenant's rows do not EXIST here (not a 403, not an "empty 200 whose total is one more") — there is no
5101
+ "exists but not yours" face. Identity is judged BEFORE store availability. 501 `capability.background_agent_store_required` without a durable background-agent store (read `capabilities.agentRoster` first).
5102
+ parameters:
5103
+ - in: query
5104
+ name: limit
5105
+ required: false
5106
+ schema: { type: integer, minimum: 1, maximum: 100 }
5107
+ - in: query
5108
+ name: before
5109
+ required: false
5110
+ schema: { type: string }
5111
+ - in: query
5112
+ name: status
5113
+ required: false
5114
+ schema: { $ref: '#/components/schemas/AgentRosterStatus' }
5115
+ - in: query
5116
+ name: session
5117
+ required: false
5118
+ schema: { type: string }
5119
+ - in: query
5120
+ name: scope
5121
+ required: false
5122
+ schema: { type: string }
5123
+ description: Fleet-wide callers only; ignored for principal callers (pinned).
5124
+ responses:
5125
+ '200':
5126
+ description: 'One page of the roster: `{ agents, total, nextBefore?, truncated? }`.'
5127
+ content:
5128
+ application/json:
5129
+ schema: { $ref: '#/components/schemas/AgentRosterPage' }
5130
+ '400': { $ref: '#/components/responses/BadRequest' }
5131
+ '401': { $ref: '#/components/responses/Unauthorized' }
5132
+ '501': { $ref: '#/components/responses/NotImplemented' }
5133
+
4966
5134
  /v1/leader:
4967
5135
  parameters:
4968
5136
  - $ref: '#/components/parameters/PrincipalHeader'
@@ -5440,6 +5608,7 @@ paths:
5440
5608
  `org:*`/`userproj:*` keys are operator-only until the S3 registry; repo-backed `proj:*` keys never
5441
5609
  live in this DB (git is their authority — an owner asking gets an honestly empty set). 501 on a
5442
5610
  file memory backend (present ONLY with MEMORY_ENGINE_BACKEND=pg|tidb).
5611
+ Server >= 7.140.0: a `scope` the engine cannot read as a layer key ⇒ 400 `request.memory_layer` (it was a 200 / 500 before — on EVERY deployment, single-store included).
5443
5612
  parameters:
5444
5613
  - in: query
5445
5614
  name: scope
@@ -5485,6 +5654,7 @@ paths:
5485
5654
  zero-oracle: own user disk or explicit operator) → shape validation (422 typed
5486
5655
  `memory_sync_invalid_body`). A 500 after partial application is an HONEST signal: replaying with the
5487
5656
  same baseRevs is idempotent self-healing (identical revs no-op throughout) — never silently swallowed.
5657
+ Server >= 7.140.0: a `:scope` the engine cannot read as a layer key ⇒ 400 `request.memory_layer` (it was a 500 before).
5488
5658
  requestBody:
5489
5659
  required: true
5490
5660
  content:
@@ -5535,13 +5705,18 @@ paths:
5535
5705
  structure that drifts with core. This is DELIBERATELY THE OPPOSITE of the import report (an explicit
5536
5706
  whitelist there): the test is "is a new key silently reaching the wire dangerous?" — in a disposition
5537
5707
  list, yes; in a STATEMENT OF FACT, withholding a field is the dangerous half.
5708
+
5709
+ 🔴 LAYER SEAT (server >= 7.140.0; contract §9 head; the key is defined once, in `components.schemas.MemoryLayerSeat`): An entry id names no layer, so the optional query `scope=<layer key>` says which store answers.
5710
+ Where it is missing, on a two-store deployment, for a verb that names no layer ⇒ 400 `request.memory_layer`; single-store deployments answer exactly as 7.139.x; older servers ignore the key.
5711
+ parameters:
5712
+ - $ref: '#/components/parameters/MemoryLayerSeatQuery'
5538
5713
  responses:
5539
5714
  '200':
5540
5715
  description: The entry's assembled provenance account (core's, verbatim).
5541
5716
  content:
5542
5717
  application/json:
5543
5718
  schema: { $ref: '#/components/schemas/EntryProvenanceAccount' }
5544
- '400': { description: 'errorCode "request.id_invalid" — the entry id could not be decoded.' }
5719
+ '400': { description: 'errorCode "request.id_invalid" — the entry id could not be decoded. Server >= 7.140.0: "request.memory_layer" — the request cannot be placed on one memory store (two-store deployment and no `scope`, or the layer key cannot be read); "request.field_invalid" — `scope` present but not a non-empty string.' }
5545
5720
  '401': { $ref: '#/components/responses/Unauthorized' }
5546
5721
  '403': { description: 'errorCode "auth.operator_only" — provenance and erasure are operator-only deployment actions. With an EMPTY `OPERATOR_PRINCIPALS` the answer is instead 501 `capability.operator_principals_required` (server >= 7.116.0; any identity, ahead of authorization — branch on `errorCode`, not the status).' }
5547
5722
  '500':
@@ -5589,6 +5764,14 @@ paths:
5589
5764
  guards "files quietly vanished during harvest"; an explicitly authorized erasure vouches for itself by
5590
5765
  enumerating every id in the attestation). `residuals.propagation` is core's self-declared boundary:
5591
5766
  deletion is a THIS-STORE fact, remote-peer convergence is the sync deployment's half to prove.
5767
+
5768
+ 🔴 LAYER SEAT (server >= 7.140.0; contract §9 head; the key is defined once, in `components.schemas.MemoryLayerSeat`): This face has NO top-level `scope` key (the body goes to the engine as sent): `select.scope` names the layer; for `select.ids` / `select.sessionId` the layer seat is `expectedScopes` (the authorization set); `select.ids` without it on a two-store deployment ⇒ 400 `request.memory_layer`.
5769
+
5770
+ 🔴 ERASURE EXECUTES ONLY ON THE DEPLOYMENT'S STORE (server >= 7.140.0, a transitional guard): the erasure `requestId` idempotency judgment
5771
+ (replay convergence; the same id under another selector ⇒ 409 `memory.erasure_selector_mismatch`) lives on EACH store's own evidence chain, and the
5772
+ engine has no deployment-wide erasure request identity yet. An erasure that lands on the OTHER store (the named layer lives on the personal mount; or,
5773
+ by session, the session has contributions there or that store's ledger cannot be read) ⇒ 409 `memory.erasure_store_unjudged`: NOTHING was erased and
5774
+ nothing recorded; the request is legal, the way out is the engine's deployment-wide request identity (the guard is deleted when it lands).
5592
5775
  requestBody:
5593
5776
  required: true
5594
5777
  content:
@@ -5602,7 +5785,9 @@ paths:
5602
5785
  schema: { $ref: '#/components/schemas/MemoryErasureAttestation' }
5603
5786
  '400':
5604
5787
  description: >
5605
- Three codes, three different operator actions — deliberately not folded into one.
5788
+ Three codes, three different operator actions — deliberately not folded into one (server >= 7.140.0 adds "request.memory_layer" — the request
5789
+ cannot be placed on one memory store: `select.ids` without `expectedScopes` on a two-store deployment, layers spanning two stores, or an unreadable
5790
+ layer key — and, from 7.138.0, "config.memory_erasure_scope" — the request reaches outside its `expectedScopes`, nothing erased).
5606
5791
  "request.request_id_required": `requestId` missing / empty / non-string. It is THIS request's
5607
5792
  idempotency identity and the server never mints one for you, so a RETRY MUST CARRY THE SAME ID (a lost
5608
5793
  ack must not open a second real delete). "request.body_shape": the top-level JSON shape is wrong, or a
@@ -5616,8 +5801,10 @@ paths:
5616
5801
  '403': { description: 'errorCode "auth.operator_only" — provenance and erasure are operator-only deployment actions. With an EMPTY `OPERATOR_PRINCIPALS` the answer is instead 501 `capability.operator_principals_required` (server >= 7.116.0; any identity, ahead of authorization — branch on `errorCode`, not the status).' }
5617
5802
  '409':
5618
5803
  description: >
5619
- Three core-minted codes, passed through verbatim; branch on `errorCode` (the status cannot tell them
5620
- apart). "memory.erasure_evidence_unavailable": this backend has NO evidence face and the caller did not
5804
+ Core-minted codes passed through verbatim, plus one server-minted code; branch on `errorCode` (the status cannot tell them
5805
+ apart). Server >= 7.140.0: "memory.erasure_store_unjudged" (server-minted) — the erasure lands on the memory store other than the deployment's
5806
+ (the named layer lives on the personal mount, or the session has contributions there / that store's ledger cannot be read): NOTHING erased, nothing
5807
+ recorded; the request is legal; do NOT retry. "memory.erasure_evidence_unavailable": this backend has NO evidence face and the caller did not
5621
5808
  opt into the degraded lane — deliberately NOT 501, because the caller holds a real choice
5622
5809
  (`allowUnevidenced: true`) and a 501 would send someone off to change a deployment that is fine.
5623
5810
  "memory.erasure_selector_mismatch": this `requestId` was first executed under a DIFFERENT selector —
@@ -5684,6 +5871,8 @@ paths:
5684
5871
  Each row's `provenance` IS the `EntryProvenanceAccount` of item ③ (same discriminated form, same
5685
5872
  pass-through discipline). An entry that is also CHALLENGED is still listed here — the exclusion rides
5686
5873
  inside the provenance account, and a human must SEE it in order to adjudicate it.
5874
+
5875
+ 🔴 LAYER SEAT (server >= 7.140.0; contract §9 head; the key is defined once, in `components.schemas.MemoryLayerSeat`): This face names its layers in `scopes`, so it needs no `scope`: `scopes` spanning two stores ⇒ 400 `request.memory_layer` (one request, one store — split it per store).
5687
5876
  responses:
5688
5877
  '200':
5689
5878
  description: The audited scopes (normalized, echoed) and one row per marked entry.
@@ -5735,12 +5924,18 @@ paths:
5735
5924
  else's name. The deployment-side counterpart is a server log line (`memory_origin_cleared`) carrying the
5736
5925
  VERIFIED principal beside the CLAIMED requestId and the `clearanceId` to join on — DO NOT draw a compliance
5737
5926
  conclusion from the ledger alone.
5927
+
5928
+ 🔴 LAYER SEAT (server >= 7.140.0; contract §9 head; the key is defined once, in `components.schemas.MemoryLayerSeat`): The ledger is kept PER STORE (on that store's control plane), so on a two-store deployment `scope=<layer key>` says whose ledger to read; to audit both stores, ask twice.
5929
+ Where it is missing, on a two-store deployment, for a verb that names no layer ⇒ 400 `request.memory_layer`; single-store deployments answer exactly as 7.139.x; older servers ignore the key.
5930
+ parameters:
5931
+ - $ref: '#/components/parameters/MemoryLayerSeatQuery'
5738
5932
  responses:
5739
5933
  '200':
5740
5934
  description: The clearance ledger (whitelist projection, newest-first not guaranteed).
5741
5935
  content:
5742
5936
  application/json:
5743
5937
  schema: { $ref: '#/components/schemas/MemoryOriginClearancesResult' }
5938
+ '400': { description: 'Server >= 7.140.0: errorCode "request.memory_layer" (two-store deployment and no `scope`, or the layer key cannot be read) or "request.field_invalid" (`scope` present but not a non-empty string).' }
5744
5939
  '401': { $ref: '#/components/responses/Unauthorized' }
5745
5940
  '403': { description: 'errorCode "auth.operator_only" — origin marking and clearance are operator-only deployment actions. With an EMPTY `OPERATOR_PRINCIPALS` the answer is instead 501 `capability.operator_principals_required` (server >= 7.116.0; any identity, ahead of authorization — branch on `errorCode`, not the status).' }
5746
5941
  '500':
@@ -5786,6 +5981,9 @@ paths:
5786
5981
  the terminal EVENT carries yours. So operator B, who resent after a 409 `memory.origin_clear_pending` as
5787
5982
  instructed and got a 200, may have completed operator A's row. ⇒ AFTER A 200, READ
5788
5983
  `GET /v1/memory/origin/clearances` BACK and check `reason` / `requestId`; `clearanceId` is that row's key.
5984
+
5985
+ 🔴 LAYER SEAT (server >= 7.140.0; contract §9 head; the key is defined once, in `components.schemas.MemoryLayerSeat`): An entry id names no layer, so the optional body key `scope` says which store answers; it is not passed to the engine. On a two-store deployment send it (and read the clearances ledger with the same `scope`).
5986
+ Where it is missing, on a two-store deployment, for a verb that names no layer ⇒ 400 `request.memory_layer`; single-store deployments answer exactly as 7.139.x; older servers ignore the key.
5789
5987
  requestBody:
5790
5988
  required: true
5791
5989
  content:
@@ -5801,7 +5999,8 @@ paths:
5801
5999
  description: >
5802
6000
  "request.id_invalid" (the entry id could not be decoded) / "request.request_id_required" (`requestId`
5803
6001
  missing / empty / non-string — mint a stable id and resend; unlike the erase face, a retry here MAY
5804
- carry a new one) / "request.body_shape" (the top-level JSON shape is wrong).
6002
+ carry a new one) / "request.body_shape" (the top-level JSON shape is wrong). Server >= 7.140.0: "request.memory_layer" (two-store deployment and no
6003
+ body `scope`, or the layer key cannot be read) / "request.field_invalid" (`scope` present but not a non-empty string).
5805
6004
  content:
5806
6005
  application/json:
5807
6006
  schema: { $ref: '#/components/schemas/ErrorResponse' }
@@ -7016,6 +7215,16 @@ components:
7016
7215
  Authenticated end-user identity (REQUIRED; principal-first, CORE-PRINCIPLES §3). Opaque to the service
7017
7216
  (memory scope + session owner key; its meaning is not interpreted, but the server refuses a value that is not a principal name: 400 `principal_not_a_name` (server >= 7.137.0 — empty / whitespace-only, control, line-separator or invisible format characters; a proxy that writes raw UTF-8 bytes into the header is read as latin1 and refused), 400 `principal_reserved` (a reserved sentinel) and 400 `principal_too_long` (over 190 characters)). The SDK normalizes; anonymous must
7018
7217
  be explicit (`anon:<id>`). On the multi-tenant doors this is set PER REQUEST.
7218
+ MemoryLayerSeatQuery:
7219
+ in: query
7220
+ name: scope
7221
+ required: false
7222
+ description: >
7223
+ Layer seat (server >= 7.140.0; contract §9 head) — the memory layer key (e.g. `user:alice`, `local`) whose store answers this request.
7224
+ Needed only on a TWO-STORE deployment for verbs that name no layer (an entry id, a store-level ledger); absent there ⇒ 400
7225
+ `request.memory_layer`. Present but not a non-empty string ⇒ 400 `request.field_invalid`. It only decides WHICH store answers.
7226
+ The key is defined once, in `components.schemas.MemoryLayerSeat`.
7227
+ schema: { $ref: '#/components/schemas/MemoryLayerSeat/properties/scope' }
7019
7228
  IdempotencyKey:
7020
7229
  in: header
7021
7230
  name: idempotency-key
@@ -7454,7 +7663,11 @@ components:
7454
7663
  multi-tenant DB memory face it moves the derived scope from the user shelf to the project shelf
7455
7664
  (`proj:<tenant>/<projectId>`) and seeds `memory.scopes` from that project's `defaultScopes`;
7456
7665
  single-user deployments ignore the derivation and only apply the seed. Rides the persisted body
7457
- onto resume legs.
7666
+ onto resume legs. server >= 7.138.0 (engine 7.58.0) reconciles the declaration with the checkout's `.sema/project` marker BEFORE the leg
7667
+ runs (no token burned): the project a leg declares (this field; else the project the session's previous leg declared — the last `workspace_changed` frame's `project.id`, only when its
7668
+ `project.source` is `declared`) must equal the marker's, else `config.project_identity_mismatch` (409); with no marker the declaration IS the identity. An unreadable marker the leg needs →
7669
+ `config.memory_project_marker` (409), a marker nested below the repo root → `config.memory_project_marker_nested` (409); a declared id that is not a UUID is the engine's `config.project_id_invalid`
7670
+ (400) — this server's request face cannot mint it (the authorizer answers 422 `invalid_project_id` first). Synchronous legs answer the HTTP status; async / live legs answer 2xx with the same code on the terminal run row.
7458
7671
  jobId:
7459
7672
  type: string
7460
7673
  minLength: 1
@@ -7896,6 +8109,15 @@ components:
7896
8109
  model + outputStyle + env shipped in the 1.26.0 v1 scope; hooks was deferred at that point and wired
7897
8110
  in a later batch — both are live and interpreted today, not a raw uninterpreted passthrough);
7898
8111
  `permissions.defaultMode`'s specific fold is documented on `TaskRequest.permissionMode`.
8112
+ LAYERED RULE ENTRIES (server >= 7.141.0, gate `capabilities.settings.permissions.layers`): an entry of `permissions.deny` /
8113
+ `permissions.ask` is a plain string OR `{ rule, layer }` (exactly those two keys; `layer` one of `userSettings` /
8114
+ `projectSettings` / `localSettings` / `flagSettings` / `policySettings` / `foreignProjectSettings`). The layer only moves
8115
+ WHERE a `/`-rooted path rule reads: `userSettings` reads under the execution environment's configuration root (host lane
8116
+ `SEMA_CONFIG_DIR`, default `~/.sema`; sandbox lanes the forwarded `SEMA_CONFIG_DIR`, else `.sema` under the execution home;
8117
+ unresolvable => whole-request 422 `request.unprocessable` with entry-problem reason `home_unresolvable`), every other layer
8118
+ reads under the task root like a plain string; `~/`, `//` and relative forms read the same in every layer. `allow` takes
8119
+ plain strings only (a layered entry there => 400 `bad_entry`). A malformed layered entry => 400 `bad_entry` + the first
8120
+ bad index. Up to 1000 entries per bucket, both forms counted.
7899
8121
  🔴 ON THIS SUBMIT FACE THE KEY SET IS CLOSED (server >= 7.57.0 for the sub-tree): accepted top-level keys
7900
8122
  are `env` / `hooks` / `model` / `outputStyle` / `permissions` / `skillListingBudgetFraction` /
7901
8123
  `skillListingMaxDescChars` / `ultracode` / `webSearch` (server >= 7.133.0 adds the three TIGHTEN-ONLY seats `complianceAdditionalDenies` / `readDenyPatterns` / `writeProtectedExtra`; server >= 7.134.0 adds `approvalFrameFamilies`), and accepted `permissions.*` keys are
@@ -8713,7 +8935,10 @@ components:
8713
8935
  stats: { $ref: '#/components/schemas/TaskStats' }
8714
8936
  verification:
8715
8937
  type: object
8716
- description: Present when run behind the verify gate.
8938
+ description: >-
8939
+ Present when run behind the verify gate. Only `verdict` / `rounds` / `findings` are declared here; the engine outcome can
8940
+ carry more (`unverifiedReason`, `verifierPause`), not declared yet. From server 7.141.0 on `verifierPause` never carries the
8941
+ verifier session's resume credential `checkpointToken` outward (the exit seal strips it); a <= 7.140.x server could.
8717
8942
  properties:
8718
8943
  verdict: { type: string, enum: [PASS, FAIL, PARTIAL, unverified] }
8719
8944
  rounds: { type: integer }
@@ -9121,6 +9346,56 @@ components:
9121
9346
  status:
9122
9347
  allOf: [{ $ref: '#/components/schemas/RunStatus' }]
9123
9348
  description: 'Poll-receipt word on a park (>= 7.64: suspended / needs_review only), or the flat terminal word of a server <= 7.63 (LegacyPlaneTaskResult.status).'
9349
+ PermissionModeSwitchResult:
9350
+ type: object
9351
+ description: >-
9352
+ server >= 7.141.0 — the 200 body of `POST /v1/runs/{taskId}/permission-mode` (SDK `runs.setPermissionMode`). Closed (the server's
9353
+ self-minted `permissionModeVerbBodyKey` set). Render `permissionMode.effective` (the mode the engine actually runs now), not the word
9354
+ you sent; `persisted: false` => a resume returns to the pre-switch word — switch again after the resume.
9355
+ Two arms on `persisted` (the server mints both keys from one value, `persisted` = `persistMiss` absent): `persisted: true` carries no
9356
+ `persistMiss`; `persisted: false` carries exactly one `persistMiss` word.
9357
+ additionalProperties: false
9358
+ required: [taskId, sessionId, status, permissionMode, persisted]
9359
+ oneOf:
9360
+ - properties: { persisted: { const: true } }
9361
+ not: { required: [persistMiss] }
9362
+ - properties: { persisted: { const: false } }
9363
+ required: [persistMiss]
9364
+ properties:
9365
+ taskId: { type: string }
9366
+ sessionId: { type: string }
9367
+ status: { type: string, enum: [running], description: 'Always `running` — only a running run can switch (a run that is not running answers 409).' }
9368
+ permissionMode:
9369
+ allOf: [{ $ref: '#/components/schemas/WiringManifestPermissionMode' }]
9370
+ description: 'The engine switch verb''s receipt, verbatim — the same segment shape as `wiring_manifest.permissionMode`.'
9371
+ admission:
9372
+ type: object
9373
+ additionalProperties: false
9374
+ required: [requested, admitted, foldedBy]
9375
+ description: 'Present only when the service''s admission judge FOLDED the word (the same judge as the submit door): `requested` = the word you sent, `admitted` = the word handed to the engine.'
9376
+ properties:
9377
+ requested: { $ref: '#/components/schemas/PermissionMode' }
9378
+ admitted: { $ref: '#/components/schemas/PermissionMode' }
9379
+ foldedBy: { $ref: '#/components/schemas/PermissionModeAdmissionFold' }
9380
+ persisted: { type: boolean, description: 'Whether the admitted word was written back to this run''s stored request (a resume rebuilds the mode from it).' }
9381
+ persistMiss:
9382
+ allOf: [{ $ref: '#/components/schemas/PermissionModePersistMiss' }]
9383
+ description: 'Present iff `persisted` is `false` (exactly one word; the `oneOf` arms above say so).'
9384
+ PermissionModeAdmissionFold:
9385
+ type: string
9386
+ enum: [entry_floor, disable_auto_mode]
9387
+ description: >-
9388
+ server >= 7.141.0 — which admission rule folded the word on `POST /v1/runs/{taskId}/permission-mode` (SDK `PERMISSION_MODE_ADMISSION_FOLDS`,
9389
+ the server's self-minted closed set): `entry_floor` = the operator `AUTONOMY` floor; `disable_auto_mode` = the task settings'
9390
+ `disableAutoMode`. A different layer from the engine receipt's own `permissionMode.foldedBy`.
9391
+ PermissionModePersistMiss:
9392
+ type: string
9393
+ enum: [claim_released, context_absent, store_failed]
9394
+ description: >-
9395
+ server >= 7.141.0 — why a permission-mode switch was not written back to the run's stored request (SDK `PERMISSION_MODE_PERSIST_MISSES`,
9396
+ the server's self-minted closed set): `claim_released` = the leg that took the switch no longer holds the run at write-back (it parked /
9397
+ stopped running / a resume leg took over) — zero write; `context_absent` = held, but the run's stored request is gone — zero write;
9398
+ `store_failed` = the store write failed.
9124
9399
  RunRecord:
9125
9400
  type: object
9126
9401
  description: >
@@ -9232,13 +9507,16 @@ components:
9232
9507
  server >= 7.73.0 (S-230 P-45; contract §5.5 (c); K-43 — the mint has carried it since 7.73.0, this closed schema
9233
9508
  did not declare it) — the replica HOLDING this run NOW (the row's `instance_id`: written at create, TAKEN OVER by a
9234
9509
  cross-replica resume claim), so it answers "where is the live leg", not "who created the row". Always present on a
9235
- server that has it, and an explicit `null` (never a missing key) means no replica holds it. 🔴 `heldBy` becoming
9236
- `null` OR the run reaching a terminal status = the claim is released (either one); on a terminal row `heldBy` reads
9237
- as a HISTORICAL fact ("which replica finished it"), not "still occupied". ⚠️ The one exception is the stale fold: a
9238
- `running` row older than the stale window is shown with `status: "failed"` + `error: "run stalled (instance lost?)"`
9239
- — that is the READ's judgement; the ledger row is still `running` and its claim is held until the reaper's next beat,
9240
- and `heldBy` still names the LOST replica (the one useful coordinate when debugging). A deployment-internal replica
9241
- identity, not a user-readable location. Absent on a server < 7.73.0.
9510
+ server that has it, and an explicit `null` (never a missing key) means no replica holds it. 🔴 ONE CONDITION
9511
+ (server >= 7.141.0): `heldBy === null` <=> the run's claim is released; non-null <=> a replica holds it right now. A
9512
+ TERMINAL row (`completed` / `failed` / `blocked`, reaped rows with `errorCode` `cancelled` / `run.stalled` /
9513
+ `run.orphaned` / `approval.expired` included) is ALWAYS `null`; `running` / `suspended` / `needs_review` name the
9514
+ holder. The same read face serves `GET /v1/runs?idempotencyKey=` and a submit's same-key replay (`replay: true`).
9515
+ ⚠️ The read fold: a `running` row whose heartbeat went stale is shown `failed` (`errorCode: "run.stalled"`) while the
9516
+ ledger row is still `running` and its claim still held — `heldBy` names the LOST replica (the one useful coordinate when
9517
+ debugging); after the reaper writes it, `null`. On <= 7.140.x a terminal row still named the replica that ran it (the
9518
+ contract read "becomes `null` OR terminal = released"): against such a server test either one. A deployment-internal
9519
+ replica identity, not a user-readable location. Absent on a server < 7.73.0.
9242
9520
  cancelRequested:
9243
9521
  type: boolean
9244
9522
  description: >
@@ -10192,7 +10470,7 @@ components:
10192
10470
  `GET /v1/sessions/{sessionId}/head`. NOTE (server [2373]A-5): no consumer is wired to it yet — it is
10193
10471
  a prepared slot, correct to gate on, wrong to read as "widely consumed".
10194
10472
  policy: { type: boolean, description: "`GET /v1/policy` (autonomy/permission READ side)." }
10195
- permissionModeWrite: { type: boolean, description: "Runtime permission-mode WRITE. Advertised false by design — autonomy is CONFIG, not steer; the READ side is `policy`." }
10473
+ permissionModeWrite: { type: boolean, description: "server >= 7.141.0: whether `POST /v1/runs/{taskId}/permission-mode` (the SDK's `runs.setPermissionMode`) is wired on this deployment — a FACILITY bit: a durable run store AND the checkpoint store (`DURABLE_APPROVAL`) => `true`; either missing => `false`, and the route answers 501 `capability.run_store_required` / `capability.checkpoint_store_required`. On <= 7.140.x it was not tied to a facility (always `false`: no such route)." }
10196
10474
  modelSelection: { type: boolean, description: "`model` accepted per request." }
10197
10475
  effortSelection: { type: boolean, description: "`reasoningEffort` accepted per request." }
10198
10476
  compactionModel: { type: boolean, description: "A separate model may be pinned for compaction." }
@@ -10225,6 +10503,16 @@ components:
10225
10503
  lane) or 422 (hosted).
10226
10504
  mcp: { type: boolean, description: "MCP servers can be attached." }
10227
10505
  mcpInjection: { type: boolean, description: "Per-request MCP injection is accepted." }
10506
+ mcpTransportKinds:
10507
+ type: array
10508
+ items: { type: string }
10509
+ description: >-
10510
+ server >= 7.141.0 — the MCP transport kinds the request reader and the engine can dial today, in writing order; today
10511
+ always `["stdio", "http"]`, present on every deployment shape. It answers only "which kinds are supported" (whether this
10512
+ deployment accepts caller-supplied `mcpServers` is still `mcpInjection`; end-to-end reachability is promised by no bit).
10513
+ Filter `mcpServers` entries with it before submitting (the submit face is unchanged: a kind outside it is still a whole-request
10514
+ 400). Read OPEN — no enum here: an unknown word means "this client does not support that kind", never a failed parse (the
10515
+ bit grows words with new kinds). ABSENT = an older server (7.135.0–7.140.x: read it as `["stdio", "http"]`).
10228
10516
  mcpAssertionHeaderSent:
10229
10517
  type: boolean
10230
10518
  description: >-
@@ -10489,6 +10777,7 @@ components:
10489
10777
  properties:
10490
10778
  allowGrant: { type: boolean, description: 'Constant `true` on server >= 7.115.0: `settings.permissions.allow` is read as allow RULES, not as a list. The whole `settings` key being absent = an older server.' }
10491
10779
  allowLayer: { type: boolean, description: 'Constant `true` on server >= 7.117.0 (core 7.42.0): the whole `settings.permissions.allow` list goes to the engine allow layer (listed calls are not asked; content forms accepted; entries read as nothing get an `engine_notice` `permission.allowed_tool_not_granted`). Absent = a server without it (7.115.0–7.116.x: allow is a statement; older: a list).' }
10780
+ layers: { type: boolean, description: 'Constant `true` on server >= 7.141.0 (both deployment shapes): `settings.permissions.deny` / `ask` accept a layered entry `{ rule, layer }` beside a plain string (see `TaskRequest.settings`). Send layered entries only when this bit is `true`: an older server refuses them (a new submit 400, a resume 409) — loud, never silently dropped.' }
10492
10781
  callerTrust: { type: string, description: 'server >= 7.133.0 — THIS caller''s trust tier (per caller / per credential, NOT a version bit). Request rule tables that take effect without a person answering (`settings.permissions` buckets; a named-invoked skill''s `allowedTools` / `disallowedTools`) are admitted by it: `allow` loosens the no-ask surface and needs `global`; `deny` / `ask` only tighten and are admitted at any tier. Today `global` (single-user turnkey; multi-tenant with the deployment service credential; multi-tenant sign-in token whose scope role >= the governance write role) or `project` (everything else). Read OPEN: an unknown word is treated as `project` (fail-closed). A request below the floor is refused whole with 400 `request.field_invalid` (`detail.problems[].reason: below_trust_floor`, `detail.callerTrust`). ABSENT = server <= 7.132.x: no per-tier admission.' }
10493
10782
  memoryWrite:
10494
10783
  type: boolean
@@ -10573,7 +10862,7 @@ components:
10573
10862
  protocolVersion: { type: integer, description: 'The protocol REVISION this server speaks (the `challenge` frame carries the same value; accepted window [1, 3] on server >= 7.137.0). Server >= 7.137.0 reads 3 (7.133.x-7.136.x read 2, <= 7.132.x read 1). An executor declares the SMALLER of its own highest revision and this value, and takes its outcome-code set from the declared revision (revision 2 added `liveness_no_output`; revision 3 added `name_too_long`, file instructions only).' }
10574
10863
  maxInflightPerDevice: { type: integer }
10575
10864
  wsPath: { type: string }
10576
- relayUrl: { type: string, description: 'server >= 7.137.0. PRESENT-IFF the operator declared `DEVICE_RELAY_URL`: the device-facing direct entry — an absolute ws(s) URL (no userinfo / query / fragment), verbatim. A dialer dials it instead of building engine address + `wsPath`; absent = build it as before.' }
10865
+ relayUrl: { type: string, description: 'server >= 7.137.0. PRESENT-IFF the operator declared `DEVICE_RELAY_URL` as a ws(s) URL: the device-facing direct entry — an absolute ws(s) URL (no userinfo / query / fragment), verbatim. A dialer dials it instead of building engine address + `wsPath`; absent = build it as before. server >= 7.141.0 requires the env on the device lane (a ws(s) URL, or the literal `none` = no relay => this key absent); on <= 7.140.x absence may also mean the operator wrote nothing.' }
10577
10866
  management: { type: boolean, description: 'server >= 7.88.0. `/v1/devices/*` admin verbs present. PRESENT-IFF — absent means a pre-7.88.0 peer (unknown), not false.' }
10578
10867
  memoryEngine:
10579
10868
  description: >
@@ -10589,7 +10878,7 @@ components:
10589
10878
  required: [backend, vectorMode]
10590
10879
  additionalProperties: true
10591
10880
  properties:
10592
- backend: { type: string, enum: [file, pg, tidb] }
10881
+ backend: { type: string, description: 'OPEN word (not an enum: the supported server range answers two generations of it). Known words = the settings-schema `MEMORY_ENGINE_BACKENDS`: `file` / `pg` / `mysql` — server >= 7.141.0 answers `mysql` on a MySQL-family deployment (the same word as `DB_BACKEND=mysql`); a <= 7.140.x server answers `tidb` there (the retired spelling of the same backend, no alias in the SDK type). Treat any other word as an unknown backend.' }
10593
10882
  # 🔴 openapi **3.1**:可空用 `type: [T, "null"]`,`nullable` 不是 3.1 关键字(会被静默忽略)。
10594
10883
  # `null` 也必须进 enum,否则真校验器把 file 引擎的常态答判非法。
10595
10884
  vectorMode: { type: ["string", "null"], enum: [native, portable, lexical, null] }
@@ -11239,10 +11528,19 @@ components:
11239
11528
  description: >-
11240
11529
  server >= 7.132.0 (an accepted key; core `McpServerSpec.startupTimeoutMs`): THIS server's startup bound in whole milliseconds — the handshake
11241
11530
  (connect + initialize) and the initial tool listing each carry it. One read order: this member, else the process-level `MCP_TIMEOUT`, else the MCP
11242
- SDK's own 60 000 ms. Range 1 000 – 2 147 483 647. The value-shape judge lives ONLY in the engine: neither server door (new submit / probe) checks
11243
- it at intake; a bad value (a string, a fraction, 0, a negative, NaN, `null`, out of range) refuses ONLY THIS server at its dial
11244
- (`config.mcp_startup_timeout_invalid`; siblings mount) — never clamped, never read as the default. A <= 7.131.x server answers `400
11245
- request.body_shape` (named in `unknownKeys`).
11531
+ SDK's own 60 000 ms. Range 1 000 – 2 147 483 647. server >= 7.134.0: the value-shape judge is the engine's `mcpStartupTimeoutMs`, run at the INTAKE door — a bad value
11532
+ (a string, a fraction, 0, a negative, NaN, `null`, out of range) on a new submit or on `POST /v1/capabilities/mcp/probe` is `400 request.field_invalid` (the engine's reason sentence; the named path is
11533
+ `mcpServers[i].startupTimeoutMs`). server 7.132.0 – 7.133.x accepted it and the engine refused ONLY THIS server at its dial (`config.mcp_startup_timeout_invalid`; siblings mount) — never clamped, never read as the
11534
+ default. A durable resume replays a stored body without judging it. A <= 7.131.x server answers `400 request.body_shape` (named in `unknownKeys`).
11535
+ sessionMetaKey:
11536
+ type: string
11537
+ description: >-
11538
+ server >= 7.138.0 (an accepted key; core `McpServerSpec.sessionMetaKey`): a server that declares it receives THIS leg's own session id in `params._meta[<this key>]` of every `tools/call` and `resources/read` the engine
11539
+ sends it (stdio and Streamable HTTP alike) — so a connector can keep state per (principal, session). Absent = nothing is sent. A delegated child is another session (its calls carry its own id; the engine does not guess a root);
11540
+ a dial with no leg (the library entrance, the no-run probe) sends nothing. The deployment legs (central config / local `config.d`) carry the key from server >= 7.139.0 on (before that the config reader stripped it with an unknown-key warning); a bad one keeps that whole server from mounting. The one judge is the engine's `judgeSessionMetaKey`: a non-empty string of at most 128 characters in the MCP `_meta` key-name format that names no `_meta` member
11541
+ of anyone else's — not the SDK's own `progressToken`, not a key under the engine's `sema/` namespace, not under a prefix MCP reserves. A bad key is `400 request.field_invalid` naming `mcpServers[i].sessionMetaKey` (new submit and
11542
+ the probe door); server >= 7.139.0 the sentence does NOT echo the key you wrote (where it must refer to it, it reads `[redacted] (N characters)`; an over-long / empty / non-string key is refused by length or type without mentioning the key) — branch on the code and the named path. A server < 7.138.0 does not list the key among the accepted ones: by the entry-key law it answers
11543
+ `400 request.body_shape` naming it in `unknownKeys` (derived from that law, not measured on the old bytes).
11246
11544
 
11247
11545
  A2aServerSpec:
11248
11546
  type: object
@@ -11548,6 +11846,27 @@ components:
11548
11846
  events: { type: array, items: { $ref: '#/components/schemas/MemoryTransferEvidence' } }
11549
11847
  reason: { type: string }
11550
11848
 
11849
+ MemoryLayerSeat:
11850
+ type: object
11851
+ description: >
11852
+ The LAYER SEAT (server >= 7.140.0; contract §9 head) — the one definition of the optional key `scope` that the memory verbs naming no layer carry.
11853
+ One memory request lands on ONE store: the store the named layer lives in (file backend: the typed personal layers `user:` / `userproj:` / `org:` live in a
11854
+ SECOND store under the personal mount; the project layers and the un-typed layers, `local` included, live in the deployment's store). It rides the query string
11855
+ (`GET /v1/memory/entries/{entryId}/provenance`, `GET /v1/memory/origin/clearances`, `GET /v1/sessions/{sessionId}/memory-status`) or the body
11856
+ (`MemoryOriginClearRequest`, `SessionMemoryEraseRequest`); `POST /v1/memory/erase` has no such key (the layer comes from `select.scope` / `expectedScopes`).
11857
+ Needed only on a TWO-STORE deployment for verbs that name no layer; a single-store deployment answers byte-for-byte as 7.139.x. This schema is open: it only
11858
+ defines the key, and is embedded by property reference — it is not a request body of its own.
11859
+ additionalProperties: true
11860
+ properties:
11861
+ scope:
11862
+ type: string
11863
+ minLength: 1
11864
+ description: >
11865
+ The memory layer key (e.g. `user:alice`, `local`) whose store answers. Absent ⇒ no layer named: on a two-store deployment the verbs that name no layer
11866
+ answer 400 `request.memory_layer` (the session-id verbs fold or run on the deployment's store instead); present but not a non-empty string ⇒ 400
11867
+ `request.field_invalid` (sentence only); a layer key the engine cannot read ⇒ 400 `request.memory_layer`. It only decides WHICH store answers — it never
11868
+ reaches the engine.
11869
+
11551
11870
  MemoryErasureRequest:
11552
11871
  type: object
11553
11872
  description: >
@@ -11572,12 +11891,22 @@ components:
11572
11891
  allowUnevidenced:
11573
11892
  type: boolean
11574
11893
  description: "Opt-in to the evidence-capability-ABSENT degradation lane. Default = a loud refusal (409 `memory.erasure_evidence_unavailable`)."
11894
+ expectedScopes:
11895
+ type: array
11896
+ items: { type: string }
11897
+ description: >
11898
+ The authorization set of this erasure (server >= 7.138.0; the judge is core): when present, the selector's own scope and the bound scope of EVERY
11899
+ resolved id must lie in the set, else the whole request is refused 400 `config.memory_erasure_scope` (nothing erased or recorded; an id whose scope the
11900
+ store cannot attribute, or that never existed, counts as outside). The empty set authorizes no scope; absent = no narrowing. Server >= 7.140.0: it ALSO
11901
+ serves as the layer seat of `select.ids` / `select.sessionId` on a two-store deployment (a non-empty set decides which store answers; spanning two stores ⇒
11902
+ 400 `request.memory_layer`; a personal-mount store ⇒ 409 `memory.erasure_store_unjudged`; `select.ids` without it on a two-store deployment ⇒ 400
11903
+ `request.memory_layer`).
11575
11904
 
11576
11905
  SessionMemoryEraseRequest:
11577
11906
  type: object
11578
11907
  description: >
11579
11908
  Request body of POST /v1/sessions/{sessionId}/memory/erase (contract §12.5; release bytes server 7.107.0
11580
- `dist/http/routes/sessions.js:508-523`). Two NAMED keys. `select` is FORBIDDEN (the selector is minted by the path; a body
11909
+ `dist/http/routes/sessions.js:508-523`; the layer seat `scope` is server >= 7.140.0). Three NAMED keys. `select` is FORBIDDEN (the selector is minted by the path; a body
11581
11910
  carrying it is a loud 400 `request.body_shape`). Any OTHER unknown key is NOT refused — the route silently ignores it and
11582
11911
  forwards only `requestId` / `allowUnevidenced` (`:526`) — so this schema is open except for `select` (codex r1 F1: a closed
11583
11912
  schema would make a strict consumer reject a body the server accepts). `requestId` has the SAME meaning as
@@ -11591,6 +11920,11 @@ components:
11591
11920
  allowUnevidenced:
11592
11921
  type: boolean
11593
11922
  description: "Opt-in to the evidence-capability-ABSENT degradation lane — a human signature; never injected. Non-boolean ⇒ 400 `request.field_invalid`."
11923
+ scope:
11924
+ # the one definition of the layer seat key: `components.schemas.MemoryLayerSeat`. On THIS face (server >= 7.140.0): a layer living in the deployment's store
11925
+ # (e.g. `local`) ⇒ the erasure runs there (200; the attestation covers that store only, the seat reaches neither the engine nor the attestation); a layer on the
11926
+ # personal mount ⇒ 409 `memory.erasure_store_unjudged`; unreadable ⇒ 400 `request.memory_layer`.
11927
+ $ref: '#/components/schemas/MemoryLayerSeat/properties/scope'
11594
11928
 
11595
11929
  MemoryErasedBinding:
11596
11930
  description: "core `ErasedBinding` — one erased row's coordinates: the scope it was bound in, NEVER its file name (a model-chosen name can restate the content being erased; attestation v2)."
@@ -11880,6 +12214,10 @@ components:
11880
12214
  properties:
11881
12215
  requestId: { type: string, minLength: 1 }
11882
12216
  reason: { type: string }
12217
+ scope:
12218
+ # the one definition of the layer seat key: `components.schemas.MemoryLayerSeat`. On THIS face: required in practice on a TWO-STORE deployment
12219
+ # (absent ⇒ 400 `request.memory_layer`); not passed to the engine.
12220
+ $ref: '#/components/schemas/MemoryLayerSeat/properties/scope'
11883
12221
 
11884
12222
  MemoryOriginClearReceipt:
11885
12223
  type: object
@@ -13889,7 +14227,7 @@ components:
13889
14227
  description: 'server >= 7.100.0 (S-700): WHY the park row offers no rule — the same narrow read and closed set (four words from server >= 7.129.0) as the live card frame and `card_json`.'
13890
14228
  boundGrantAbsence:
13891
14229
  allOf: [{ $ref: '#/components/schemas/BoundGrantAbsence' }]
13892
- description: 'server >= 7.129.0 (core 7.51.0 #1688; park-row fact eight): why this parked card has no grant-binding digest — the park-row twin seat `PendingAction.tool_approval.boundGrantAbsence`, the same narrow read and the same name / value as the live frame and the inbox row. ABSENT on this face = a skill card (it carries the digest) / a row parked before engine 7.51.0 (says neither — the inbox face projects `unreadable` for the same row) / a word outside the set / an old server — NOT `not_bindable`.'
14230
+ description: 'server >= 7.129.0 (core 7.51.0 #1688; park-row fact eight): why this parked card has no grant-binding digest — the park-row twin seat `PendingAction.tool_approval.boundGrantAbsence`, the same narrow read and the same name / value as the live frame and the inbox row. server >= 7.141.0: a tool-approval row carries EXACTLY ONE of `boundGrantDigest` / this key, the inbox row''s reading — a string digest => the digest; else no digest key and a word in the set => that word; else `unreadable` (a row parked before engine 7.51.0 that says neither, a word outside the set, a non-string digest even beside `not_bindable`). On <= 7.140.x those rows carried neither key on this face (the inbox face projected `unreadable`), and <= 7.128.x never carries this key — ABSENT is NOT `not_bindable`.'
13893
14231
  boundGrantDigest: { type: string, description: 'server >= 7.136.0 — a parked `Skill` card''s grant-binding digest; the same value as the inbox row''s and the live frame''s `boundGrantDigest` (one projection feeds this operator queue row, the `/v1/approvals/stream` `pending` frame and the inbox row — byte-equal for the same parked row). Present only on a skill card; absent on an ordinary card. `card_json` does not carry it. Server <= 7.135.x: not on this face.' }
13894
14232
  boundGrants:
13895
14233
  allOf: [{ $ref: '#/components/schemas/BoundSkillGrants' }]
@@ -14450,6 +14788,12 @@ components:
14450
14788
  lastRunId:
14451
14789
  type: ['string', 'null']
14452
14790
  description: The most recent run's id (null when the session has no run yet) — lets a picker deep-link.
14791
+ lastTaskRunId:
14792
+ type: string
14793
+ description: >-
14794
+ The most recent run's ENGINE run id (`TaskResult.runId`) when known — OMITTED when absent, never `null` (no run, the latest run
14795
+ is running — a resume claim clears it — or an older server). A different identity axis from `lastRunId` (the latest run's
14796
+ task id): re-attach a live tail with `lastRunId`, match engine-side records (trace / journal) with this key.
14453
14797
  title:
14454
14798
  type: ['string', 'null']
14455
14799
  description: >
@@ -14791,6 +15135,9 @@ components:
14791
15135
  version: { type: string }
14792
15136
  toolNames: { type: array, items: { type: string } }
14793
15137
  error: { type: string }
15138
+ authorization:
15139
+ allOf: [{ $ref: '#/components/schemas/McpAuthorization' }]
15140
+ description: 'server >= 7.138.0 (core 7.59.0) — PRESENT-IFF this server is unauthorized (this face carries no `errorCode`, so presence reads "the principal must authorize this server first"): only the closed word `reason`. Absent = not an authorization door, or an older server.'
14794
15141
 
14795
15142
  McpStatusPanel:
14796
15143
  type: object
@@ -14950,6 +15297,37 @@ components:
14950
15297
  THIS SESSION enter long-term memory) — do not read them together.
14951
15298
  The same fact is readable by an operator as `wiring_manifest.autoConsolidation` (present-iff armed);
14952
15299
  one fact, one source — the tenant face has only this key.
15300
+ memorySync:
15301
+ allOf: [{ $ref: '#/components/schemas/SessionMemorySync' }]
15302
+ description: >-
15303
+ server >= 7.141.0 — THIS DEPLOYMENT's memory-sync park reading (a deployment fact: present <=> the deployment has a sync leg;
15304
+ independent of the session and of `?scope=`). `parked: []` = syncing. ABSENT = no sync leg, or an older server.
15305
+
15306
+ SessionMemorySync:
15307
+ type: object
15308
+ description: 'server >= 7.141.0 — the `memorySync` segment of `GET /v1/sessions/{sessionId}/memory-status`. A response projection: declared key by key and left open.'
15309
+ additionalProperties: true
15310
+ required: [parked]
15311
+ properties:
15312
+ parked:
15313
+ type: array
15314
+ items: { $ref: '#/components/schemas/MemorySyncParkedLayer' }
15315
+ description: 'The parked layers (empty = syncing). A layer parks when the sync engine refuses its cursor on any axis (scope / peer / store) or the cursor cannot be read: zero requests, files untouched, every round parks again until the cursor is deleted.'
15316
+ MemorySyncParkedLayer:
15317
+ type: object
15318
+ description: 'server >= 7.141.0 — one parked memory-sync layer. The cursor file path never rides the wire (the operator line `memory_sync_layer_parked` carries it).'
15319
+ additionalProperties: true
15320
+ required: [scope, wayOut]
15321
+ properties:
15322
+ scope: { type: string, description: 'The parked layer''s scope, verbatim.' }
15323
+ wayOut:
15324
+ type: string
15325
+ description: >-
15326
+ The one way out for this layer. Known word today: `delete_cursor` — delete this layer''s cursor file; the next round re-converges
15327
+ from an empty baseline (pull what the center has, push what the local store has, push no deletions; entries changed on both sides
15328
+ are reported as conflicts) — a CONSERVATIVE merge: an entry deleted on one side since the last round comes back from the other.
15329
+ The service never writes, edits or deletes a cursor itself. Read OPEN: no enum — an unknown word means "way out unknown, do not
15330
+ act for the user".
14953
15331
 
14954
15332
  McpReconnectServerStatus:
14955
15333
  type: object
@@ -14971,6 +15349,9 @@ components:
14971
15349
  errorCode: { type: string, description: 'core `McpFailureKind`. Open set; switch with a default arm.' }
14972
15350
  httpStatus: { type: integer, description: 'Only alongside errorCode `http_status` (5xx = that end is down; from server >= 7.138.0 a 401, and a 403 with an `insufficient_scope` challenge, are errorCode `unauthorized` without this key). ABSENT rather than 0.' }
14973
15351
  delivered: { type: string, enum: [yes, no, unknown], description: 'Did the request reach that server — read together with errorCode.' }
15352
+ authorization:
15353
+ allOf: [{ $ref: '#/components/schemas/McpAuthorization' }]
15354
+ description: 'server >= 7.138.0 (core 7.59.0) — PRESENT-IFF `errorCode` is `unauthorized`: why the principal must authorize this server (only the closed word `reason`; the addresses never leave the server). Absent = not an authorization door, or an older server.'
14974
15355
  serverInfo:
14975
15356
  type: object
14976
15357
  properties:
@@ -16390,6 +16771,14 @@ components:
16390
16771
  type: array
16391
16772
  items: { $ref: '#/components/schemas/GateRecordAskClass' }
16392
16773
  description: 'Beside `mode`: the whole folded class set (archive read, see `GateRecordAskClass`).'
16774
+ extension:
16775
+ type: string
16776
+ minLength: 1
16777
+ description: >
16778
+ server >= 7.138.0 (core 7.59.0, engine invariant I12) — PRESENT-IFF `deniedBy` is `hook` AND the refusing handler's extension registration is known: the registration's name (through the
16779
+ registrant-text egress discipline). An extension's `tool.check` / `classic.PreToolUse` / `tool.call` answered deny, or it failed (threw, overran its budget, answered a shape the station cannot take — the engine fails
16780
+ the call closed). ABSENT beside every other layer word (an ancestor leg's screening reaches a descendant as a `policy` refusal, and a refusal an inherited installation's question settled is that question's), on the
16781
+ allowed arm, and beside a `hook` refusal that names no registration (the engine's own failed raise, a cancel). A display and audit fact: the call is refused whatever the name. Older servers: absent = unknowable.
16393
16782
 
16394
16783
  PermissionMode:
16395
16784
  type: string
@@ -16603,6 +16992,7 @@ components:
16603
16992
  delivered: { $ref: '#/components/schemas/WiringManifestMcpEntry/properties/delivered' }
16604
16993
  httpStatus: { $ref: '#/components/schemas/WiringManifestMcpEntry/properties/httpStatus' }
16605
16994
  liveness: { $ref: '#/components/schemas/WiringManifestMcpEntry/properties/liveness' }
16995
+ authorization: { $ref: '#/components/schemas/WiringManifestMcpEntry/properties/authorization' }
16606
16996
  toolNames: { type: array, items: { type: string }, maxItems: 200 }
16607
16997
  toolNamesTruncated: { type: boolean, enum: [true] }
16608
16998
  McpProbeFace:
@@ -16723,6 +17113,14 @@ components:
16723
17113
  allOf: [{ $ref: '#/components/schemas/ExtensionRequester' }]
16724
17114
  description: 'server >= 7.138.0: this call was initiated by an extension registration through `$.tool.call` (appears only when the deployment seat mounted operator-declared packages). Absent = model-initiated.'
16725
17115
  answeredBy: { type: string, description: 'server >= 7.138.0 (core 7.56.0): the registration that stood in for the tool body at the `tool.call` station with its own result or refusal (always beside `notExecuted: true`). Absent = no extension answered for the call.' }
17116
+ rewrite:
17117
+ allOf: [{ $ref: '#/components/schemas/ToolInputRewrite' }]
17118
+ description: >
17119
+ server >= 7.138.0 (core 7.58.0): the gate let the call go with arguments other than the ones it took — `input` is what it let the call go with (the engine's frozen plain-data projection, through the same redaction as `tool_start.args`,
17120
+ which stays the model's own), `by` who replaced them. PRESENT EXACTLY WHEN the gate's allow exit let the call go, no extension answered in place of the body, and the arguments it let go differ from those at its entry (both as the
17121
+ tool reads them — argument preparation and schema coercion are no rewrite). ABSENT: nobody changed them, or changed and changed back, or the call was refused / parked / answered in place before it was let go, or this is a resumed
17122
+ leg's frame. A refusal recorded AFTER the call was let go (the shell read admission, the loop's own refusal of the cleared arguments) leaves it beside that refusal. NEVER evidence that the body ran — read `isError` / `errorCode` /
17123
+ `notExecuted`. A malformed record (`by` not a non-empty list, a member outside the three forms, no `input`) is dropped whole by the server and the frame is still sent.
16726
17124
  # 🔴 census 轴一(2026-07-30)回填:`toolEndEventData`(trace/project.ts)真发 `label` 与
16727
17125
  # `structured`,spec 此前两者都漏 —— SDK 的 events.ts 早已声明,漂移只在 spec 这一侧。
16728
17126
  label: { type: string, description: 'core 展示名(同 tool_start.label)。' }
@@ -16731,8 +17129,14 @@ components:
16731
17129
  enum: [true]
16732
17130
  description: >
16733
17131
  server >= 7.126.0 (core 7.49.0, contract table B `notExecuted` row, passed through verbatim) — ABSENT IS NEVER "it ran": present, always the literal `true` (never `false`), when the engine has
16734
- POSITIVE evidence the call was never executed; absent only means the engine has no such evidence (a call interrupted mid-execution, or one closed by the reconciliation on the next process start, does not carry it —
16735
- telling the model "it did not run" there could invite a replay of a write that already took effect). Read it together with the paired `tool_start.recovered`.
17132
+ POSITIVE evidence the call was never executed. The classes that carry it, in the order the engine added them: the loop closed the call without running it (a sibling settled by a halted batch, a call a turn interrupt
17133
+ reached before it started, a reconcile-closed call that never started — 7.126.0); the gate refused the call and never released it (a person's refusal, the host's SLA sweep, a policy / `PreToolUse` hook / plan-mode deny, a
17134
+ post-approval veto before the run — engine 7.52.0); server >= 7.138.0 (engine 7.59.0) the gate RELEASED the call and the loop itself then refused it before the body started — the arguments the gate cleared failed the loop's
17135
+ own re-validation or re-reading (a rewrite the tool's input check refuses, a form the tool would read as other bytes), or the run was aborted in that gap: such a frame reads `gate.disposition.kind` `allowed` + `isError` (with an
17136
+ `errorCode` when the refusal carries one) + this mark — render it as "not executed", not "failed to execute" — and, when the gate replaced the arguments, `rewrite` beside them; and an extension answered for the call at `tool.call`
17137
+ in place of its body (`answeredBy` names it and is always beside this mark). NOT carried: a call refused before any gate saw it (an unknown tool, arguments the model's own call got wrong — nothing says the loop got that far);
17138
+ a call interrupted mid-execution or closed by the reconciliation on the next process start (telling the model "it did not run" there could invite a replay of a write that already took effect). Read it together with the
17139
+ paired `tool_start.recovered`.
16736
17140
  wireName:
16737
17141
  type: string
16738
17142
  description: >
@@ -16974,6 +17378,8 @@ components:
16974
17378
  errorStatus: { type: integer, description: "server >= 7.54.0 (core 7.1.0): the HTTP status of the attempt that just failed, present ONLY when that status names the failure (absent on a transport non-answer, a mid-stream tear, a local circuit-open verdict and the `recovered` / `gave_up` frames). Absent = no status named the failure — not 0; a 2xx never appears." }
16975
17379
  elapsedMs: { type: number, description: "server >= 7.58.0 (core 7.3.1): ONLY on the `waiting_first_token` phase — how long the current segment has waited so far (at emit, emitting process's clock). Absent = unknown, not 0. A waiting frame never carries `retryInMs` / `retryAtMs` (it OBSERVES a wait, it does not ANNOUNCE one) — do not merge the two families into one countdown." }
16976
17380
  timeoutMs: { type: number, description: "server >= 7.58.0 (core 7.3.1): present with `elapsedMs` on the same phase — the bound of the segment being waited on (core 7.33.0+: the first-byte window before the response head, the first-token watchdog after it; each segment counts from 0)." }
17381
+ waitSegment: { type: string, description: "server >= 7.138.0 (core 7.59.0 `BrainStatus.waitSegment`, passed through verbatim, minted only when a non-empty string): on EVERY `waiting_first_token` frame — WHICH segment is being waited on: `response_headers` (from the `fetch()` call to the response headers: connecting, sending the request body, whatever the gateway does before it starts answering — the engine cannot tell these apart) or `first_token` (response headers to the first content delta; a thinking delta counts). ABSENT on every other phase, and on servers <= 7.137.x (read as 'unknown which segment', never as 'response headers'). Closed in core (two words), read as an OPEN set (keep a default arm). Render it with `elapsedMs` / `timeoutMs`." }
17382
+ sleptMs: { type: number, description: "server >= 7.138.0 (core 7.59.0 `BrainStatus.sleptMs`): ONLY on a retry-wait frame (`phase: reconnecting`, `errClass: stall`) for an attempt the engine ended because the HOST WAS SUSPENDED across the wait (the machine slept / the process was stopped) — how long, in MILLISECONDS: the sum of the gaps longer than five seconds between the engine's once-a-second wall-clock readings, from the start of that wait (response headers, first token, or the silence between deltas); the attempt ends at the first reading where it exceeds half of the wait's window and is re-sent on a fresh connection. ABSENT on every other frame (a stall a deadline cut carries none); absent = no suspension evidence, not 0." }
16977
17383
  eventId: { type: string }
16978
17384
  parentToolCallId: { type: string }
16979
17385
  sourceTaskId: { type: string }
@@ -17806,6 +18212,16 @@ components:
17806
18212
  sessionId, runId }`: `capability` is `image` today; `status` is `declared_off` or `unknown` (engine words, the server echoes them — read OPEN; for images 7.56.0 only emits `declared_off`). Once per session per (model, capability). It replaces the server's
17807
18213
  own submit-time image pre-check (ops-log line `images_omitted_no_vision_model` and counter `images_omitted_total`, both retired in 7.137.0: the engine mints the fact at the moment it really replaces the image);
17808
18214
  a reasoning knob the model declares off is not reported here (that is `effectiveReasoning.dropped`).
18215
+ server 7.138.0 adds two codes to the user whitelist (appendix D.3 44 -> 46; both audience `user` in core's register), described here because their `detail` is not self-evident:
18216
+ `context.image_removed` (core 7.59.0) — the provider said an image in this turn's request could not be processed (the failed turn's `errorKind` is `image_unprocessable`), so the engine took the images out of the NEWEST message still
18217
+ carrying any (each replaced by a one-line note), re-sent the turn without them, and every later request of the session reads the same removal; the session transcript keeps the original images. The way out is another image format (admission
18218
+ separately refuses images whose header is incomplete for png / jpeg / gif / webp, and does not send this code). `{ images, sessionId, runId }` — `images` = how many were taken out of that message; no body text. Once per run per refusal.
18219
+ `mcp.authorization_required` (core 7.59.0) — an MCP server the user must authorize before it serves them: the leg's dial failed `unauthorized`, or a request was refused that way and that refusal is its answer (a repeat-safe call refused with 401
18220
+ and sent once more on a renewed credential announces only if that send is refused too). The leg does not park on it. `{ server, reason, authorizeUrl?, principal?, sessionId, runId }` — `reason` is `rejected` (401) / `scope` (403
18221
+ `insufficient_scope`) / `none` (the authorization seat holds no authorization for this user), the engine's closed set, echoed by the server (read OPEN); `authorizeUrl` only ever comes from the deployment's authorization seat (this deployment
18222
+ has none, so it is always absent and the sentence points at connector settings); `principal` is the run's principal when it has one. Once per leg per server (a resume is a new leg and may announce again). The same fact on the status faces is
18223
+ `errorCode: "unauthorized"` + `authorization`. NOT on the user whitelist, though core 7.59.0's register holds them: `model.role_defaulted` (a role seat names a model word the catalog does not hold, so the role reads as unset and the run goes on)
18224
+ and `route.credential_rebound` (the HOST moved a per-model credential's binding, outside any run) are audience `operator` — they never reach this stream.
17809
18225
  Value change: `permission.rule_row_dropped`'s `detail.rows[].rule` is, since core 7.53.0, the rule's original text (the same reading as
17810
18226
  `allowed_tool_not_granted`'s `entries[].entry`: at most 1 024 code points, longer cut to 1 024 + a truncation mark, CONTROL CHARACTERS RIDE AS DATA —
17811
18227
  neutralize at render); before it was the engine-neutralized single-line form (at most 201 code points). Same keys.
@@ -18352,6 +18768,26 @@ components:
18352
18768
  kind: { type: string, enum: [extension] }
18353
18769
  name: { type: string, minLength: 1, description: 'The registration name (registrant text, UNTRUSTED-for-display).' }
18354
18770
 
18771
+ RewriteAuthor:
18772
+ description: >
18773
+ Who replaced a tool call's arguments (one entry of `tool_end.rewrite.by`; core `RewriteAuthor`, server >= 7.138.0): an extension registration (`{ kind: extension, name }` — the SAME shape as `ExtensionRequester`),
18774
+ the restriction chain (`{ kind: policy }`) or an approver who answered with changes (`{ kind: approver }`; who it was is `gate.settlement.who`). Closed in core (three forms) — read with a default arm; the server drops a
18775
+ whole `rewrite` whose `by` carries any other form.
18776
+ oneOf:
18777
+ - { $ref: '#/components/schemas/ExtensionRequester' }
18778
+ - { type: object, additionalProperties: false, required: [kind], properties: { kind: { const: policy } } }
18779
+ - { type: object, additionalProperties: false, required: [kind], properties: { kind: { const: approver } } }
18780
+ ToolInputRewrite:
18781
+ type: object
18782
+ additionalProperties: false
18783
+ required: [by, input]
18784
+ description: >
18785
+ `tool_end.rewrite` (core `ToolInputRewrite`, server >= 7.138.0): the arguments the gate let a call go with when they are not the ones it took. `by` — NON-EMPTY, one entry per replacement that changed the arguments,
18786
+ in the order they were made (a judge that changed them twice is named twice). `input` — what the gate let the call go with (frozen plain-data projection; a member that is not plain data reads as a `[not recorded: …]` marker).
18787
+ properties:
18788
+ by: { type: array, minItems: 1, items: { $ref: '#/components/schemas/RewriteAuthor' } }
18789
+ input: {}
18790
+
18355
18791
  ToolApprovalFrame:
18356
18792
  type: object
18357
18793
  description: >
@@ -20559,6 +20995,16 @@ components:
20559
20995
  server >= 7.135.0 — the idempotency anchor of this workflow completion: the SAME id rides every notification path of one completion (this frame / `task_notification` / fleet `bg_notification` / inbox replay) and
20560
20996
  is the dedup key ACROSS paths (the same value domain as `task_notification.completionId`). ABSENT when the engine gave none (an orphan the service terminated itself) — dedup on `runId` as before. The read faces
20561
20997
  (`GET /v1/workflows/{id}` etc.) deliberately never carry it. Older servers' re-delivered frames have no such key.
20998
+ diagnostics:
20999
+ type: string
21000
+ maxLength: 4000
21001
+ description: >-
21002
+ server >= 7.141.0 — the diagnostic teaching text the engine minted for the same completion (up to 5 lines of unfinished-agent
21003
+ summaries, the full-record read-handle sentence, the journal coordinate, the resume sentence); the live `task_notification`
21004
+ (`task_type: "workflow"`) frame carries the same text under the same key, but on this path host paths and URLs were already
21005
+ masked for a human reader, so the two faces are not byte-equal. Minted only when non-empty; redacted before it leaves; at most
21006
+ 4000 code units (cut at the bound). UNTRUSTED-for-display. ABSENT = no diagnostic text for this one (crash-recovery
21007
+ re-delivery, an orphan the service terminated itself, an older server, an entry an older replica queued) — not a failure.
20562
21008
 
20563
21009
  # ── 🔴 #185a (2026-08-08): the DURABLE leg's three APPROVAL arms ────────────────────────────────
20564
21010
  # Shape rule for all three: `allOf: [<frame schema>, {the narrowed discriminant}]`. The keys are NOT
@@ -21653,6 +22099,54 @@ components:
21653
22099
  description: >
21654
22100
  Which lanes are live — core's closed three (`tool` / `diagnostics` / `tool_and_diagnostics`), read as
21655
22101
  open. ABSENT = neither lane is live (not "unknown").
22102
+ AgentRosterStatus:
22103
+ type: string
22104
+ enum: [running, parked, completed, failed, killed]
22105
+ description: 'A background agent''s state (core `BackgroundAgentRecord["status"]`; the `status` filter of `GET /v1/agents/roster` takes exactly these five words). The ROW''s `status` is read as an open set.'
22106
+ AgentRosterRow:
22107
+ type: object
22108
+ additionalProperties: false
22109
+ required: [handle, name, status, spawnedAt, updatedAt]
22110
+ description: >
22111
+ One row of `GET /v1/agents/roster` (core `BackgroundAgentRowSummary` projected through a keep/strip whitelist — a new core key must pass the server's disposition table before it can reach the wire). `handle` is the background
22112
+ agent's id (the durable agent row's `a…` key — the SAME string as the fleet row's `id` and the `remaining[]` items of a 409 `conflict.session_children_alive`). `name` is ALWAYS present: engine 7.57.0+ gives every background agent
22113
+ a name, an unnamed one the engine-derived `agent-<12 hex>`, and a row written before the upgrade reads as that same derived name. `anonymous` (server >= 7.138.0, additive) is present — always `true` — exactly when `name` IS the name the
22114
+ engine derived for this `handle` (nobody named it); a row that was named lacks the key (absence is the meaning, no `false` is minted). Its value is the engine's own answer (`chosenAgentName`): a reader need not know the derivation
22115
+ and must not recompute it; a caller who happened to name the agent with the derived string reads as anonymous too (the engine cannot tell). NOT carried: `owner`, any session id (not an addressing face), `usage`.
22116
+ properties:
22117
+ handle: { type: string }
22118
+ name: { type: string }
22119
+ anonymous: { type: boolean, enum: [true] }
22120
+ agentType: { type: string }
22121
+ status: { type: string, description: 'running | parked | completed | failed | killed (core `BackgroundAgentRecord["status"]`; read as an open set).' }
22122
+ spawnedAt: { type: number, description: 'epoch ms' }
22123
+ updatedAt: { type: number, description: 'epoch ms' }
22124
+ settledAt: { type: number, description: 'epoch ms; absent until the agent settles.' }
22125
+ AgentRosterPage:
22126
+ type: object
22127
+ additionalProperties: false
22128
+ required: [agents, total]
22129
+ description: >
22130
+ The 200 body of `GET /v1/agents/roster`. `total` is the OWNER-scoped row count of the roster window (a row of another tenant is in neither the page nor this number — a count that differed would be an existence oracle);
22131
+ `truncated: true` says the tenant has more rows than the 500-row window, so `total` is the window, not the whole. `nextBefore` (present = another page exists) is the opaque cursor to send back as `before`.
22132
+ properties:
22133
+ agents: { type: array, items: { $ref: '#/components/schemas/AgentRosterRow' } }
22134
+ total: { type: integer, minimum: 0 }
22135
+ nextBefore: { type: string }
22136
+ truncated: { type: boolean, enum: [true] }
22137
+ McpAuthorization:
22138
+ type: object
22139
+ additionalProperties: false
22140
+ required: [reason]
22141
+ description: >
22142
+ server >= 7.138.0 (core 7.59.0 `McpAuthorization`) — an MCP server the principal must authorize first. Rides WITH `errorCode: "unauthorized"` on three faces: the `wiring_manifest.mcp[]` row, the reconnect receipt's `status`
22143
+ and the `GET /v1/sessions/{sessionId}/mcp` panel's `servers[]` (the panel row carries no `errorCode`, so presence there reads "this server is unauthorized"). ONLY the closed word `reason` leaves the server: the engine record's two
22144
+ addresses (`authorizeUrl` — only ever from the deployment's authorization seat, which this deployment does not have — and `resourceMetadataUrl`, which the remote self-reports in its challenge header and is untrusted) never go on the wire.
22145
+ A record whose word is outside the set, or that is not an object, is absent as a whole (the weakest claim, no minted word). The user-facing "go authorize" is the session notice `mcp.authorization_required`.
22146
+ properties:
22147
+ reason:
22148
+ type: string
22149
+ description: '`rejected` (the endpoint answered 401 and the authorization seat''s re-ask gave no credential that passes) | `scope` (403 with an `insufficient_scope` challenge) | `none` (the authorization seat answered "not authorized"). Core''s closed `MCP_AUTHORIZATION_REASONS`, read as an OPEN set (keep a default arm).'
21656
22150
  WiringManifestMcpEntry:
21657
22151
  # 8.9.0:从 `Event_wiring_manifest.mcp.items` 的内联形**提取**为具名 schema —— 同一份行形现在被
21658
22152
  # 两处引用(live 帧与 `WiringManifest` 的静态/两半形),内联会立刻变成两份会各自漂的镜像。
@@ -21705,6 +22199,9 @@ components:
21705
22199
  is the engine's STRONGER claim (it looked and the answer does not decide reach). Do not infer "was it
21706
22200
  dialed" from absence. Declared here as of sdk 11.2.0 — the key had been on the wire since server 7.91.2
21707
22201
  while this row schema stayed closed, so a strict consumer was rejecting a LEGITIMATE response.
22202
+ authorization:
22203
+ allOf: [{ $ref: '#/components/schemas/McpAuthorization' }]
22204
+ description: 'server >= 7.138.0 (core 7.59.0) — PRESENT-IFF `errorCode` is `unauthorized`: why the principal must authorize this server (only the closed word `reason`; the addresses never leave the server). Absent = not an authorization door, or an older server.'
21708
22205
 
21709
22206
  ServerWiringGates:
21710
22207
  type: object
@@ -22070,6 +22567,19 @@ components:
22070
22567
  description: 'Tool DEFINITIONS (so the model can emit toolCalls data) — the server NEVER executes them.'
22071
22568
  maxOutputTokens: { type: integer }
22072
22569
 
22570
+ SideQueryAccountRow:
22571
+ type: object
22572
+ additionalProperties: false
22573
+ required: [origin, tokens]
22574
+ description: >-
22575
+ server >= 7.138.0 (engine 7.59.0, core `AccountRow` with `origin: side_query`): this side query's line in the session's account, priced by the engine from the deployment's price table and passed through verbatim
22576
+ (`usage.cost` stays the provider's own figure). `origin` is always `side_query` here. `costMicroUsd` is whole micro-USD and ABSENT as soon as any spend was unpriced (unknown, not 0); `usageMissing: true` marks a figure that is
22577
+ a lower bound because the reply reported no usage (`tokens: 0` then). The session total is the engine's `foldAccount` (run lines + side_query lines), folded by whoever holds the lines — this server mints no session total.
22578
+ properties:
22579
+ origin: { const: side_query }
22580
+ tokens: { type: integer, minimum: 0 }
22581
+ costMicroUsd: { type: integer, minimum: 0 }
22582
+ usageMissing: { type: boolean, enum: [true] }
22073
22583
  SideQueryResult:
22074
22584
  type: object
22075
22585
  description: >
@@ -22119,8 +22629,11 @@ components:
22119
22629
  `http` / `stream_torn` / `refusal` / `length_empty`). ABSENT on success and on older servers.
22120
22630
  errorKind:
22121
22631
  type: string
22122
- enum: [input_too_long, degenerate, length_empty]
22123
- description: 'server >= 7.135.0 (failure only): the STRUCTURAL failure kind the reply carried, forwarded as is — `input_too_long` (the provider refused the request as over its window), `degenerate`, `length_empty`. Absent when the reply carried none.'
22632
+ enum: [input_too_long, degenerate, length_empty, image_unprocessable]
22633
+ description: 'server >= 7.135.0 (failure only): the STRUCTURAL failure kind the reply carried, forwarded as is — `input_too_long` (the provider refused the request as over its window), `degenerate`, `length_empty`; server >= 7.138.0 (engine 7.59.0) also `image_unprocessable` (the provider could not process an image in the request). Absent when the reply carried none. Closed (the engine''s four words): adding a word is an output-type widening.'
22634
+ account:
22635
+ allOf: [{ $ref: '#/components/schemas/SideQueryAccountRow' }]
22636
+ description: 'server >= 7.138.0 (engine 7.59.0; always present on newer servers, absent on older ones): this side query''s line in the session''s account — see `SideQueryAccountRow`. This server mints no session total.'
22124
22637
  inputTooLongRuledOut:
22125
22638
  type: boolean
22126
22639
  enum: [true]