@sema-agent/sdk 30.1.0 → 32.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 (72) hide show
  1. package/README.md +156 -0
  2. package/dist/errors.d.ts +59 -5
  3. package/dist/errors.d.ts.map +1 -1
  4. package/dist/errors.js +39 -3
  5. package/dist/errors.js.map +1 -1
  6. package/dist/events.d.ts +106 -26
  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/idempotency.d.ts +2 -1
  13. package/dist/idempotency.d.ts.map +1 -1
  14. package/dist/idempotency.js +2 -1
  15. package/dist/idempotency.js.map +1 -1
  16. package/dist/index.d.ts +19 -6
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +10 -1
  19. package/dist/index.js.map +1 -1
  20. package/dist/resources/approvals.d.ts +7 -1
  21. package/dist/resources/approvals.d.ts.map +1 -1
  22. package/dist/resources/approvals.js +5 -0
  23. package/dist/resources/approvals.js.map +1 -1
  24. package/dist/resources/attachments.d.ts +7 -1
  25. package/dist/resources/attachments.d.ts.map +1 -1
  26. package/dist/resources/attachments.js +7 -1
  27. package/dist/resources/attachments.js.map +1 -1
  28. package/dist/resources/fleet.d.ts +59 -5
  29. package/dist/resources/fleet.d.ts.map +1 -1
  30. package/dist/resources/fleet.js +25 -0
  31. package/dist/resources/fleet.js.map +1 -1
  32. package/dist/resources/memory.d.ts +10 -3
  33. package/dist/resources/memory.d.ts.map +1 -1
  34. package/dist/resources/memory.js +10 -3
  35. package/dist/resources/memory.js.map +1 -1
  36. package/dist/resources/runs.d.ts +67 -2
  37. package/dist/resources/runs.d.ts.map +1 -1
  38. package/dist/resources/runs.js +35 -1
  39. package/dist/resources/runs.js.map +1 -1
  40. package/dist/resources/session-sync.d.ts +9 -0
  41. package/dist/resources/session-sync.d.ts.map +1 -1
  42. package/dist/resources/session-sync.js +9 -0
  43. package/dist/resources/session-sync.js.map +1 -1
  44. package/dist/resources/sessions.d.ts +32 -5
  45. package/dist/resources/sessions.d.ts.map +1 -1
  46. package/dist/resources/sessions.js +36 -4
  47. package/dist/resources/sessions.js.map +1 -1
  48. package/dist/resources/side-query.d.ts +20 -2
  49. package/dist/resources/side-query.d.ts.map +1 -1
  50. package/dist/resources/side-query.js.map +1 -1
  51. package/dist/resources/tasks.d.ts +13 -7
  52. package/dist/resources/tasks.d.ts.map +1 -1
  53. package/dist/resources/tasks.js +13 -7
  54. package/dist/resources/tasks.js.map +1 -1
  55. package/dist/resources/tool-approvals.d.ts +4 -3
  56. package/dist/resources/tool-approvals.d.ts.map +1 -1
  57. package/dist/resources/tool-approvals.js +4 -3
  58. package/dist/resources/tool-approvals.js.map +1 -1
  59. package/dist/settings.d.ts +44 -9
  60. package/dist/settings.d.ts.map +1 -1
  61. package/dist/settings.js +6 -1
  62. package/dist/settings.js.map +1 -1
  63. package/dist/sse.d.ts +11 -5
  64. package/dist/sse.d.ts.map +1 -1
  65. package/dist/sse.js +8 -3
  66. package/dist/sse.js.map +1 -1
  67. package/dist/types.d.ts +322 -91
  68. package/dist/types.d.ts.map +1 -1
  69. package/dist/types.js +7 -0
  70. package/dist/types.js.map +1 -1
  71. package/openapi.yaml +713 -107
  72. package/package.json +2 -2
package/openapi.yaml CHANGED
@@ -430,9 +430,11 @@ paths:
430
430
  as 200 with a failed body (`terminal.code`; billed; a same-key resend replays). Multi-tier callers must read both
431
431
  forms. On a park the 200 body is the result itself plus the three poll-receipt keys (`SyncSubmitResult`, S-173).
432
432
  🔴 IDEMPOTENT REPLAY (server >= 7.125.0, contract §0.7): a same-key resubmit that finds the run row the key already built (another process, another
433
- replica, a restart, or an original request that has since settled) does NOT run again and does NOT answer the first answer's engine-result shape —
434
- it answers `200` with that run's READ FACE (`GET /v1/runs/{taskId}`) plus `replay: true` (`RunReplayRecord`). Branch on `replay === true`; the outcome is
435
- in `result` (a nested `TaskResult`), and `wiringManifest` / `notice` are absent. A same-key duplicate that is still IN FLIGHT in the same process is merged
433
+ replica, a restart, or an original request that has since settled) does NOT run again. server >= 7.142.0 answers `200` with the FIRST ANSWER'S ENVELOPE plus
434
+ `replay: true` (`SyncSubmitOutcome`): the row holds an engine result ⇒ that result (a park adds the three receipt keys, as on a first answer); it holds none
435
+ (still running, or lost) ⇒ the three receipt keys `{taskId, sessionId, status}` (`SyncReceiptBody`; read the row at `GET /v1/runs/{taskId}`).
436
+ server 7.125.0–7.141.x answered the row's read face plus `replay: true` instead — that body has no `stats` and reads as the receipt arm.
437
+ `replay: true` says "this is a same-key replay", never which shape. A same-key duplicate that is still IN FLIGHT in the same process is merged
436
438
  instead and gets the first answer's bytes (no `replay` key). Only a submit that builds a row can be replayed this way (a run store AND a `sessionId`);
437
439
  otherwise a settled key re-runs. A key whose row the caller cannot read answers 409 `conflict.run_exists`.
438
440
  🔴 SAME KEY = SAME BODY (server >= 7.126.0, contract §0.7): resubmitting the same `Idempotency-Key` with a DIFFERENT request body is 409
@@ -447,17 +449,12 @@ paths:
447
449
  responses:
448
450
  '200':
449
451
  description: >-
450
- One of two shapes, told apart by the `replay` key. (1) The task result (`SyncSubmitResult`): the sealed + redacted engine result; on a park (`terminal.kind:"paused"`)
451
- it additionally carries the poll receipt `{taskId, sessionId, status}` with `status` ∈ {suspended, needs_review}
452
- (server >= 7.104.0 / S-173 — before that a park answered ONLY those three keys). Terminal bodies carry no `status`
453
- on >= 7.64; a server <= 7.63 answers the flat form instead (terminal word in `status`, no `terminal`) — see SyncSubmitResult.
454
- (2) server >= 7.125.0, same-key replay: the existing run's read face with `replay: true` (`RunReplayRecord`) — NOT an engine result.
452
+ `SyncSubmitOutcome` — one rule: is there an engine result in hand? `stats` present ⇒ the engine result (`SyncSubmitResult`; a park adds the poll receipt;
453
+ a server <= 7.63 answers the flat `LegacyPlaneTaskResult`); `stats` absent ⇒ the run receipt `{taskId, sessionId, status}` (`SyncReceiptBody`). A same-key
454
+ replay (server >= 7.125.0) carries `replay: true` on whichever arm it is.
455
455
  content:
456
456
  application/json:
457
- schema:
458
- oneOf:
459
- - $ref: '#/components/schemas/SyncSubmitResult'
460
- - $ref: '#/components/schemas/RunReplayRecord'
457
+ schema: { $ref: '#/components/schemas/SyncSubmitOutcome' }
461
458
  '400': { $ref: '#/components/responses/BadRequest' }
462
459
  '401': { $ref: '#/components/responses/Unauthorized' }
463
460
  '403': { $ref: '#/components/responses/Forbidden' } # (declared 2026-08-01) 带 `sessionId` 复用他人会话:归属不匹配 ⇒ 403(自公开快照起点即有,spec 此前漏登记)。server 3.15.0 起多一个触发条件:多租部署上 session store 无归属判别能力时,复用**任何** caller 自报的 sessionId 都 403(含本 worker 自己刚铸的 —— 无 register seam 时归属从未被记下)。core 2.11.0 起默认内存店自带该能力 ⇒ 该触发条件在默认部署上不再出现。 ⚠️ (declared 2026-08-05,server >=7.0.0)`memory.admission_denied` 也走本状态 —— 本状态的 producer 全清单与分支判据写在 `Forbidden` 组件的 description 里(**那段是被解析的**,本行注释只是指路,不复述以免两处漂移)。
@@ -481,6 +478,10 @@ paths:
481
478
  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
482
479
  NOT silently resolve it to that run: `activeTaskId` may be the caller's own first attempt OR an unrelated
483
480
  concurrent run on the same session — 409 alone cannot tell (same text as the `Conflict` response component).
481
+ 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
482
+ 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) —
483
+ 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
484
+ absent. Async / live legs answer 2xx with the same code on the terminal run row / `done` frame's `terminal.code`.
484
485
  K-24 (server >= 7.104.0 / S-724, zero-work submissions only): `rewind.store_unconfigured` — this
485
486
  deployment has NO file-history store but the request asks to restore files; the request is well-formed, the
486
487
  deployment shape conflicts with it (change the deployment, not the request; `capabilities.rewindFiles` is false
@@ -614,6 +615,12 @@ paths:
614
615
  sessionId?}` — the X-Task-Id response header as a first-class in-stream signal (EventSource and
615
616
  some proxies cannot read headers). Same source, same condition: no durable ledger => neither the
616
617
  header nor the meta frame.
618
+ FRAME NAMING (server >= 7.141.0): EVERY frame on this stream is `[id: <eventId>\n]event: <type>\ndata: <json>` — the
619
+ event name is the payload's `type` (engine frames and `done` included; heartbeat = `event: heartbeat` + `data: {}`), the
620
+ same frame shape as `GET /v1/runs/{taskId}/events`. On <= 7.140.x the engine frames and `done` were unnamed `data:` frames
621
+ (only `meta`, the heartbeat and the out-of-band approval / question / form frames were named). A reader on the default
622
+ `message` channel (`EventSource.onmessage`) receives no content frame and no `done` from a 7.141.0 server: listen by event
623
+ name, or parse each `data:` line and dispatch on its `type` (what the SDK's `tasks.stream` does — unchanged).
617
624
  content:
618
625
  text/event-stream:
619
626
  schema: { $ref: '#/components/schemas/AgentEvent' }
@@ -652,7 +659,8 @@ paths:
652
659
  Async; runs in the background. Requires a TiDB run store (absent → 501). Auto `Idempotency-Key`.
653
660
  Poll `GET /v1/runs/:id` or stream `GET /v1/runs/:id/events`. A client disconnect does NOT stop the run.
654
661
  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
655
- `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).
662
+ `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
663
+ `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).
656
664
  parameters:
657
665
  - $ref: '#/components/parameters/IdempotencyKey'
658
666
  requestBody:
@@ -1034,6 +1042,80 @@ paths:
1034
1042
  application/json:
1035
1043
  schema: { $ref: '#/components/schemas/ErrorResponse' }
1036
1044
 
1045
+ /v1/runs/{taskId}/permission-mode:
1046
+ parameters:
1047
+ - $ref: '#/components/parameters/PrincipalHeader'
1048
+ - $ref: '#/components/parameters/TaskIdPath'
1049
+ - name: session
1050
+ in: query
1051
+ required: false
1052
+ schema: { type: string }
1053
+ description: >-
1054
+ 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
1055
+ (the shared run-face session assertion; absence is accepted today).
1056
+ post:
1057
+ tags: [runs]
1058
+ operationId: runsSetPermissionMode
1059
+ 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.
1060
+ summary: Switch the permission mode of a RUNNING run.
1061
+ description: >
1062
+ server >= 7.141.0. Body is exactly `{ mode }` (the six engine words); passes straight to the engine's switch verb and answers 200 with
1063
+ its receipt (`PermissionModeSwitchResult`). The submit door and this door share ONE admission judge: the operator `AUTONOMY` floor,
1064
+ the hosted write fence and the task settings' `disableAutoMode` fold / refuse identically on both (refusal `422
1065
+ request.host_posture_refused`, same sentence as the submit door). The admitted word is written back to the run's stored request under
1066
+ the run's claim fence (a later leg that took over is never overwritten); a miss answers `persisted: false` + `persistMiss`. Concurrent
1067
+ switches on one run are serialized server-side. Gate: `capabilities.permissionModeWrite`.
1068
+ requestBody:
1069
+ required: true
1070
+ content:
1071
+ application/json:
1072
+ schema:
1073
+ type: object
1074
+ required: [mode]
1075
+ additionalProperties: false
1076
+ properties:
1077
+ mode: { $ref: '#/components/schemas/PermissionMode' }
1078
+ responses:
1079
+ '200':
1080
+ description: Switched.
1081
+ content:
1082
+ application/json:
1083
+ schema: { $ref: '#/components/schemas/PermissionModeSwitchResult' }
1084
+ '400':
1085
+ description: '`request.body_shape` — the body is not exactly `{ mode: <string> }`.'
1086
+ content:
1087
+ application/json:
1088
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
1089
+ '401': { $ref: '#/components/responses/Unauthorized' }
1090
+ '404':
1091
+ description: '`not_found.run` — unknown run, not yours, or the `session` assertion does not match.'
1092
+ content:
1093
+ application/json:
1094
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
1095
+ '409':
1096
+ description: >-
1097
+ `steering.not_running` — the run is parked on a pending decision, already ended, live on another replica, or has no live switchable
1098
+ face on this replica (a verify / cascade submission); the sentence says which. `conflict.resume_context_unavailable` — the run's
1099
+ stored request is missing; `conflict.checkpoint_ctx_unsealable` — it holds credentials this server cannot unseal.
1100
+ content:
1101
+ application/json:
1102
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
1103
+ '422':
1104
+ 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).'
1105
+ content:
1106
+ application/json:
1107
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
1108
+ '429': { $ref: '#/components/responses/RateLimited' }
1109
+ '500':
1110
+ description: '`corrupt` — the stored request cannot be read (the operator repairs or removes the row named in `where`).'
1111
+ content:
1112
+ application/json:
1113
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
1114
+ '501':
1115
+ 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`.'
1116
+ content:
1117
+ application/json:
1118
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
1037
1119
  /v1/runs/{taskId}/interrupt:
1038
1120
  parameters:
1039
1121
  - $ref: '#/components/parameters/PrincipalHeader'
@@ -3057,6 +3139,53 @@ paths:
3057
3139
  # three-conjunct predicate was disproven in the field ([2024]) when a warm-cache wrapper store forwarded the
3058
3140
  # other three and dropped the staging family, so caps said true while PUSH Phase A 501'd forever.
3059
3141
  # Owner-gated like fork/delete (§9): a PULL 404s a non-owner; a PUSH is own-or-FRESH.
3142
+ /v1/sessions/{sessionId}/memory/sync:
3143
+ parameters:
3144
+ - $ref: '#/components/parameters/PrincipalHeader'
3145
+ - in: path
3146
+ name: sessionId
3147
+ required: true
3148
+ schema: { type: string }
3149
+ post:
3150
+ tags: [sessions]
3151
+ operationId: sessionsSyncMemory
3152
+ x-status: gated # server 7.142.0 `routes/session-memory-sync.js`; capability bit `sessionMemorySync` (501 without the facilities). SDK sessions.syncMemory.
3153
+ summary: Push the memory layers this session reads to the engine it is going to (local shell, before a fork to the cloud).
3154
+ description: >
3155
+ server >= 7.142.0. On the local shape (file memory engine + `MEMORY_SYNC_URL` + a durable run ledger) a shell calls this BEFORE forking the session to another
3156
+ engine. The body is exactly `{ "target": <that engine's GET /v1/capabilities memorySyncServe.identity, verbatim> }`. Gate order: 501 (no sync leg
3157
+ `feature.memory_sync_disabled` / no durable run store `capability.run_store_required` / no session-ownership face `capability.session_ownership_required`) →
3158
+ principal → rate limit → 404 `not_found.session` (unknown and foreign alike) → 400 `request.body_shape` (not exactly `{target}`) → 400 `request.field_invalid`
3159
+ (`field: "target"`, `reason` one of the seven sync-identity flaws; the value is never echoed) → 409 `conflict.session_memory_unobserved` (no read set: the session has no
3160
+ settled run with a memory observation; `activeTaskId` when a run is in flight) → 200 with the engine's sync report (`SessionMemorySyncReport`): a whole-round `refused`
3161
+ (`config.memory_sync_target_mismatch` — the target is not the engine this machine's sync leg reaches; `session_active` — a run is in flight, or the session moved after
3162
+ its read set was taken) or one outcome per layer. The read set is the memory observation of the session's latest settled run; each project layer of it the sync leg
3163
+ covers JOINS THIS PROCESS'S BACKGROUND SYNC SET PERMANENTLY (until the process exits: one more cursor, a few more round trips per round).
3164
+ requestBody:
3165
+ required: true
3166
+ content:
3167
+ application/json:
3168
+ schema: { $ref: '#/components/schemas/SessionMemorySyncRequest' }
3169
+ responses:
3170
+ '200':
3171
+ description: The engine's sync report.
3172
+ content:
3173
+ application/json:
3174
+ schema: { $ref: '#/components/schemas/SessionMemorySyncReport' }
3175
+ '400':
3176
+ description: '`request.path_malformed` · `request.body_shape` (the body is not exactly `{target}`) · `request.field_invalid` (`field: "target"`, `reason` = a sync-identity flaw: not-http-url / userinfo / query / fragment / credential / too-long / not-canonical).'
3177
+ content:
3178
+ application/json:
3179
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
3180
+ '401': { $ref: '#/components/responses/Unauthorized' }
3181
+ '404': { description: 'errorCode "not_found.session" — unknown session AND another principal''s session, byte-identical (anti-enumeration).' }
3182
+ '409':
3183
+ description: '`conflict.session_memory_unobserved` — no read set yet (the session has no settled run with a memory observation); carries `activeTaskId` when a run is in flight.'
3184
+ content:
3185
+ application/json:
3186
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
3187
+ '500': { description: 'errorCode "internal.error" — the engine refused to mint the report.' }
3188
+ '501': { description: '`feature.memory_sync_disabled` (no local sync leg) · `capability.run_store_required` · `capability.session_ownership_required` — capability bit `sessionMemorySync` is false.' }
3060
3189
  /v1/sessions/{sessionId}/sync/manifest:
3061
3190
  parameters:
3062
3191
  - $ref: '#/components/parameters/PrincipalHeader'
@@ -4894,13 +5023,17 @@ paths:
4894
5023
  boundary) -> 415 `attachment.mime_not_allowed` with the allowed set. Unreferenced uploads are
4895
5024
  reaped after a TTL (default 24h) — submit soon after uploading. 501 without an attachment store
4896
5025
  (local without backend / cloud backend without object storage configured).
5026
+ PROJECT BUNDLE (server >= 7.142.0): content-type `application/vnd.sema.project-bundle` (SDK `PROJECT_BUNDLE_MIME`) = a gzip POSIX tar whose top level is the
5027
+ work root — the seed of an isolated-lane session's workspace. It is read at upload: unreadable => 400 `attachment.bundle_invalid` with `reason` (seven-word closed set,
5028
+ SDK `PROJECT_BUNDLE_INVALID_REASONS`: not_archive / unsafe_path / entry_type / reserved_path / duplicate_path / expanded_too_large / too_many_entries) and `path`
5029
+ (present when readable and not an over-long path). A deployment with a mime allowlist must add this mime (else 415). An older server stores it as a plain attachment.
4897
5030
  responses:
4898
5031
  '201':
4899
5032
  description: Uploaded.
4900
5033
  content:
4901
5034
  application/json:
4902
5035
  schema: { $ref: '#/components/schemas/AttachmentInfo' }
4903
- '400': { description: 'missing/unsafe name, malformed mime' }
5036
+ '400': { description: 'missing/unsafe name, malformed mime (`request.query_invalid`); server >= 7.142.0 `attachment.bundle_invalid` (`reason`, `path?`) for an unreadable project bundle' }
4904
5037
  '401':
4905
5038
  description: >-
4906
5039
  (declared 2026-07-31) errorCode "auth.principal_required" — `routes/attachments.ts` requires a
@@ -4998,6 +5131,54 @@ paths:
4998
5131
  '401': { $ref: '#/components/responses/Unauthorized' }
4999
5132
  '501': { $ref: '#/components/responses/NotImplemented' }
5000
5133
 
5134
+ /v1/agents/roster:
5135
+ parameters:
5136
+ - $ref: '#/components/parameters/PrincipalHeader'
5137
+ get:
5138
+ tags: [fleet]
5139
+ operationId: agentsRoster
5140
+ 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()`.
5141
+ summary: List the background-agent roster (cross-session, newest first).
5142
+ description: >
5143
+ 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
5144
+ whitelist (`AgentRosterRow`): `handle` / `name` / `agentType?` / `status` / `spawnedAt` / `updatedAt` / `settledAt?` / `anonymous?` — NO `owner`, NO session id (the roster is not an addressing face),
5145
+ 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.
5146
+ 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`
5147
+ (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):
5148
+ `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
5149
+ "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).
5150
+ parameters:
5151
+ - in: query
5152
+ name: limit
5153
+ required: false
5154
+ schema: { type: integer, minimum: 1, maximum: 100 }
5155
+ - in: query
5156
+ name: before
5157
+ required: false
5158
+ schema: { type: string }
5159
+ - in: query
5160
+ name: status
5161
+ required: false
5162
+ schema: { $ref: '#/components/schemas/AgentRosterStatus' }
5163
+ - in: query
5164
+ name: session
5165
+ required: false
5166
+ schema: { type: string }
5167
+ - in: query
5168
+ name: scope
5169
+ required: false
5170
+ schema: { type: string }
5171
+ description: Fleet-wide callers only; ignored for principal callers (pinned).
5172
+ responses:
5173
+ '200':
5174
+ description: 'One page of the roster: `{ agents, total, nextBefore?, truncated? }`.'
5175
+ content:
5176
+ application/json:
5177
+ schema: { $ref: '#/components/schemas/AgentRosterPage' }
5178
+ '400': { $ref: '#/components/responses/BadRequest' }
5179
+ '401': { $ref: '#/components/responses/Unauthorized' }
5180
+ '501': { $ref: '#/components/responses/NotImplemented' }
5181
+
5001
5182
  /v1/leader:
5002
5183
  parameters:
5003
5184
  - $ref: '#/components/parameters/PrincipalHeader'
@@ -7530,7 +7711,11 @@ components:
7530
7711
  multi-tenant DB memory face it moves the derived scope from the user shelf to the project shelf
7531
7712
  (`proj:<tenant>/<projectId>`) and seeds `memory.scopes` from that project's `defaultScopes`;
7532
7713
  single-user deployments ignore the derivation and only apply the seed. Rides the persisted body
7533
- onto resume legs.
7714
+ onto resume legs. server >= 7.138.0 (engine 7.58.0) reconciles the declaration with the checkout's `.sema/project` marker BEFORE the leg
7715
+ 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
7716
+ `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 →
7717
+ `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`
7718
+ (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.
7534
7719
  jobId:
7535
7720
  type: string
7536
7721
  minLength: 1
@@ -7752,6 +7937,10 @@ components:
7752
7937
  objective gets an appended notice (names/mime/sizes only — content never enters the durable
7753
7938
  stream). Unknown/foreign id -> 400 on a fresh submit. Named `attachmentIds` because `attachments`
7754
7939
  is taken by the system-reminder attachment config key.
7940
+ server >= 7.142.0, three 409s on a fresh submit (body carries `id`, plus `lane` on the second): `attachment.bound_elsewhere` (an attachment, once bound,
7941
+ stays with that session — upload it again for this one), `attachment.bundle_lane_not_isolated` (a project bundle binds only into an isolated lane:
7942
+ e2b / k8s / local-docker), `attachment.bundle_seed_fixed` (a session takes one project bundle). One refused id => none of the body's attachments bind.
7943
+ A resume replay of a stored body skips the refused id instead (operator warn). On isolated lanes the attachments are placed by the restore point.
7755
7944
  scratchpadDir:
7756
7945
  type: string
7757
7946
  description: >-
@@ -7972,9 +8161,19 @@ components:
7972
8161
  model + outputStyle + env shipped in the 1.26.0 v1 scope; hooks was deferred at that point and wired
7973
8162
  in a later batch — both are live and interpreted today, not a raw uninterpreted passthrough);
7974
8163
  `permissions.defaultMode`'s specific fold is documented on `TaskRequest.permissionMode`.
8164
+ LAYERED RULE ENTRIES (server >= 7.141.0, gate `capabilities.settings.permissions.layers`): an entry of `permissions.deny` /
8165
+ `permissions.ask` is a plain string OR `{ rule, layer }` (exactly those two keys; `layer` one of `userSettings` /
8166
+ `projectSettings` / `localSettings` / `flagSettings` / `policySettings` / `foreignProjectSettings`). The layer only moves
8167
+ WHERE a `/`-rooted path rule reads: `userSettings` reads under the execution environment's configuration root (host lane
8168
+ `SEMA_CONFIG_DIR`, default `~/.sema`; sandbox lanes the forwarded `SEMA_CONFIG_DIR`, else `.sema` under the execution home;
8169
+ unresolvable => whole-request 422 `request.unprocessable` with entry-problem reason `home_unresolvable`), every other layer
8170
+ reads under the task root like a plain string; `~/`, `//` and relative forms read the same in every layer. `allow` takes
8171
+ plain strings only (a layered entry there => 400 `bad_entry`). A malformed layered entry => 400 `bad_entry` + the first
8172
+ bad index. Up to 1000 entries per bucket, both forms counted.
7975
8173
  🔴 ON THIS SUBMIT FACE THE KEY SET IS CLOSED (server >= 7.57.0 for the sub-tree): accepted top-level keys
7976
8174
  are `env` / `hooks` / `model` / `outputStyle` / `permissions` / `skillListingBudgetFraction` /
7977
- `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
8175
+ `skillListingMaxDescChars` / `ultracode` / `webSearch` (server >= 7.133.0 adds the three TIGHTEN-ONLY seats `complianceAdditionalDenies` / `readDenyPatterns` / `writeProtectedExtra`; server >= 7.134.0 adds `approvalFrameFamilies`;
8176
+ server >= 7.142.0 adds the two http-hook allowlists `allowedHttpHookUrls` / `httpHookAllowedEnvVars` — the SDK's `SemaSettings` named keys are that set, key for key), and accepted `permissions.*` keys are
7978
8177
  `allow` / `ask` / `defaultMode` / `deny` / `disableAutoMode` (server >= 7.133.0 adds `neverAuto`); anything else is 400 `request.body_shape`
7979
8178
  with the names in the refusal's `unknownKeys` / `unsupportedKeys` arrays (REFUSED, not dropped — a dropped
7980
8179
  key reads as "in effect" to the caller). The object stays OPEN here because the same `SemaSettings`
@@ -7997,6 +8196,12 @@ components:
7997
8196
  🔴 `settings.hooks[]` (server >= 7.133.0; probe `capabilities.taskSettings.pluginHooks` / `managedHookGroups` — an absent or false bit = the keys are STRIPPED SILENTLY): group key `source` (closed: `managedPolicy` / `user` / `project` / `local` / `flag` /
7998
8197
  `managedPlugin:<name>` / `plugin:<name>`; absent = unmanaged; managed groups run in an independent lane after the unmanaged rewrites), command-entry keys `plugin { name, root, dataDir?, options? }` and exec-form `args`; a malformed one =>
7999
8198
  400 `request.field_invalid` with `detail: { reason: "wire_key_invalid", key, path }`; the plugin context has one 8192-character budget.
8199
+ 🔴 HTTP-HOOK ALLOWLISTS (server >= 7.142.0; send them only when `capabilities.taskSettings.httpHookAllowlists` is `true` — an older server answers 400 `request.body_shape`):
8200
+ `allowedHttpHookUrls` (string array of URL patterns, grammar owned by the settings-schema package) — present => every `type: "http"` entry of `settings.hooks` asks the
8201
+ package's judge BEFORE dialing out; a URL that does not match, an empty list `[]` or a malformed list => the hook sends ZERO bytes (rule word url / empty / malformed),
8202
+ an unmanaged group records `hook_non_blocking_failure{reason:"url_not_allowed"}`, a managed group fails closed (PreToolUse folds to ask) and also emits
8203
+ `hook_managed_unrun{reason:"url_not_allowed"}`; `httpHookAllowedEnvVars` (string array) — the header can interpolate only the entry's `allowedEnvVars` INTERSECTED with this list.
8204
+ Absent => unrestricted. The submit face accepts the key names only and does not judge the values; the multi-tenant lane ignores `settings.hooks` wholesale (bit false).
8000
8205
  🔴 `skillListingBudgetFraction` (number in (0,1]) / `skillListingMaxDescChars` (positive integer),
8001
8206
  server >= 7.78.1: the SKILL-LISTING RENDER BUDGET, passed to the engine with ZERO processing
8002
8207
  (no clamping, no conversion, no folding) — ABSENT means the key is not written at all (the server does
@@ -8789,7 +8994,10 @@ components:
8789
8994
  stats: { $ref: '#/components/schemas/TaskStats' }
8790
8995
  verification:
8791
8996
  type: object
8792
- description: Present when run behind the verify gate.
8997
+ description: >-
8998
+ Present when run behind the verify gate. Only `verdict` / `rounds` / `findings` are declared here; the engine outcome can
8999
+ carry more (`unverifiedReason`, `verifierPause`), not declared yet. From server 7.141.0 on `verifierPause` never carries the
9000
+ verifier session's resume credential `checkpointToken` outward (the exit seal strips it); a <= 7.140.x server could.
8793
9001
  properties:
8794
9002
  verdict: { type: string, enum: [PASS, FAIL, PARTIAL, unverified] }
8795
9003
  rounds: { type: integer }
@@ -8951,21 +9159,6 @@ components:
8951
9159
  toolCallId: { type: string }
8952
9160
  retryAfterMs: { type: integer }
8953
9161
 
8954
- RunReplayRecord:
8955
- description: >
8956
- server >= 7.125.0 (contract §0.7). The idempotent-REPLAY body of a submit whose `Idempotency-Key` had already built a run row: `RunRecord` (the
8957
- `GET /v1/runs/{taskId}` read face, same projection) plus `replay: true`. It answers `POST /v1/tasks` (200) and is the `done.result` of
8958
- `POST /v1/tasks/stream`. 🔴 IT IS NOT A `TaskResult`: a synchronous first answer carries the engine result at the top level (`terminal`, `stats`, `result` as a
8959
- string); a replay has only the row, so `result` is the NESTED `TaskResult` (or absent while the run has no result), there is no top-level `terminal` / `stats`, and
8960
- `wiringManifest` / `notice` are absent (the wiring receipt is a live capture that is not stored on the row). `taskId` is the row's id — on the stream leg, when the
8961
- replay is discovered only after the stream opened (another replica created the row first), the `x-task-id` header and `meta` frame carried an id this leg minted
8962
- and never created: the id in this body is the real one. Narrow on `replay === true` (the two shapes cannot both match). A same-key duplicate still IN FLIGHT in the same
8963
- process is merged instead and gets the first answer's bytes with no `replay` key.
8964
- allOf:
8965
- - $ref: '#/components/schemas/RunRecord'
8966
- - type: object
8967
- required: [replay]
8968
-
8969
9162
  SubmitRefusalDoneResult:
8970
9163
  type: object
8971
9164
  description: >
@@ -9164,39 +9357,126 @@ components:
9164
9357
  enum: [enforced, not-enforced, exhausted, unobserved]
9165
9358
  description: '`enforced` (a live lease with budget) · `not-enforced` (center said "no lease" and the negative cache is live — render unlimited) · `exhausted` (with `retryAfterSec`) · `unobserved` (no entry / expired / exhausted-not-renewed / evicted / no principal — server ruling F-1: nobody is judging quota right now, NOT "the last state").'
9166
9359
  retryAfterSec: { type: integer, minimum: 1, description: 'Only beside `exhausted`.' }
9167
- SyncParkReceipt:
9360
+ SyncRunReceipt:
9168
9361
  type: object
9169
9362
  description: >
9170
- K-24 (server >= 7.104.0 / S-173) — the three POLL-RECEIPT keys a synchronous `POST /v1/tasks` adds on a PARK (the
9171
- whole park body before 7.104.0, values byte-identical), key-for-key the server's `http/sync-submit-body.ts`
9172
- `SyncParkReceipt`. `status` is the word on the `GET /v1/runs/{taskId}` row — the server derives the two words from
9173
- its `RUN_STATUS_CLASS` table (the `parked` class).
9174
- additionalProperties: false
9363
+ The three RUN-RECEIPT keys (server `SyncRunReceipt`, `http/sync-submit-body.ts`; key-for-key) — the one definition of these keys: `SyncParkReceipt`
9364
+ narrows `status` to the park words, `SyncReceiptBody` is the receipt-only arm of `SyncSubmitOutcome`. The server mints exactly these three keys; the
9365
+ schema stays open because the receipt arm also receives the 7.125.0–7.141.x replay that was the read face (a superset, see `SyncReceiptBody`).
9175
9366
  required: [taskId, sessionId, status]
9176
9367
  properties:
9177
9368
  taskId: { type: string, description: 'The durable run id minted at submit — the `GET /v1/runs/{taskId}` poll key.' }
9178
9369
  sessionId: { type: string }
9370
+ status: { $ref: '#/components/schemas/RunStatus' }
9371
+ SyncParkReceipt:
9372
+ type: object
9373
+ description: >
9374
+ K-24 (server >= 7.104.0 / S-173) — the three POLL-RECEIPT keys a synchronous `POST /v1/tasks` adds on a PARK (the
9375
+ whole park body before 7.104.0, values byte-identical), key-for-key the server's `http/sync-submit-body.ts`
9376
+ `SyncParkReceipt` (= `SyncRunReceipt` with `status` narrowed). `status` is the word on the `GET /v1/runs/{taskId}` row — the server derives the two
9377
+ words from its `RUN_STATUS_CLASS` table (the `parked` class).
9378
+ allOf:
9379
+ - $ref: '#/components/schemas/SyncRunReceipt'
9380
+ properties:
9179
9381
  status: { type: string, enum: [suspended, needs_review] }
9180
9382
  SyncSubmitResult:
9181
9383
  description: >
9182
- K-24 — the synchronous `POST /v1/tasks` 200 body (server name `SyncSubmitBody`, one mint `buildSyncSubmitBody`).
9183
- ONE RULE (contract §5.0c): it is ALWAYS the result itself (the sealed + redacted engine result — `TaskResult`); when
9184
- the run is parked (`terminal.kind === "paused"`) it additionally carries the `SyncParkReceipt` keys, so `status`
9185
- appears ONLY on a park — terminal bodies carry none (since 7.64.0). A park here is byte-identical to the same park
9186
- on `/v1/tasks/stream`'s `done.result` except for the identity keys; the resume credential is never on it.
9187
- Read "is it parked" off `terminal.kind === "paused"`; the old reading `status ∈ {suspended, needs_review}` still
9188
- holds. ⚠️ THREE GENERATIONS behind one type (the SDK's support floor is 3.0.0): server <= 7.63 answers the FLAT form
9189
- (`LegacyPlaneTaskResult`: `status` is the terminal word — completed / failed / blocked or a park word — and there is
9190
- no `terminal`); 7.64–7.103 answers the current `terminal` form on terminal bodies but a park with ONLY the three receipt
9191
- keys (no `terminal`, no `stats`); >= 7.104 follows the rule above. Read `status` for "parked" first (all three carry
9192
- a park word on a park), then tell the generations apart by whether `terminal` is present.
9384
+ K-24 — the ENGINE-RESULT arm of the synchronous `POST /v1/tasks` 200 body (server name `SyncSubmitBody`, one mint `buildSyncSubmitBody`).
9385
+ It is the result itself (the sealed + redacted engine result — `TaskResult`); when the run is parked (`terminal.kind === "paused"`) it
9386
+ additionally carries the `SyncParkReceipt` keys, so `status` appears ONLY on a park, and only as a park word (server >= 7.104.0). A park here
9387
+ is byte-identical to the same park on `/v1/tasks/stream`'s `done.result` except for the identity keys; the resume credential is never on it.
9388
+ server >= 7.142.0: a same-key replay of a run whose row holds a result answers exactly this envelope plus `replay: true`.
9389
+ The other generations are the other arms of `SyncSubmitOutcome`: a server <= 7.63 answers the flat `LegacyPlaneTaskResult`; a 7.64–7.103 park
9390
+ answered only the three receipt keys (`SyncReceiptBody`).
9193
9391
  allOf:
9194
9392
  - $ref: '#/components/schemas/TaskResult'
9195
9393
  - type: object
9196
9394
  properties:
9197
9395
  status:
9198
- allOf: [{ $ref: '#/components/schemas/RunStatus' }]
9199
- 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).'
9396
+ type: string
9397
+ enum: [suspended, needs_review]
9398
+ description: 'The poll-receipt word on a park (`SyncParkReceipt.status`); absent on a terminal body.'
9399
+ replay:
9400
+ const: true
9401
+ description: 'server >= 7.125.0 — present only on a same-key replay (never `false`). It says "replayed", not which shape.'
9402
+ SyncReceiptBody:
9403
+ type: object
9404
+ description: >
9405
+ The RUN-RECEIPT arm of `SyncSubmitOutcome` — no engine result in hand, so the body is the three receipt keys `{taskId, sessionId, status}`
9406
+ (server `SyncRunReceipt`): read the run at `GET /v1/runs/{taskId}`. Three producers: a 7.64.0–7.103.x park (the whole park body then);
9407
+ server >= 7.142.0, a same-key replay of a row that holds no result (still running, or lost: a stale row's `status` reads `failed`);
9408
+ and server 7.125.0–7.141.x, whose same-key replay was the row's read face plus `replay: true` — a superset of these three keys with no
9409
+ `stats`, hence `additionalProperties: true` here (read the three keys, then the row).
9410
+ additionalProperties: true
9411
+ not: { required: [stats] }
9412
+ allOf:
9413
+ - $ref: '#/components/schemas/SyncRunReceipt'
9414
+ properties:
9415
+ replay:
9416
+ const: true
9417
+ description: 'server >= 7.125.0 — present only on a same-key replay (never `false`).'
9418
+ SyncSubmitOutcome:
9419
+ description: >
9420
+ The synchronous `POST /v1/tasks` 200 body, and the shape of `/v1/tasks/stream`'s `done.result` on a run. ONE RULE (server >= 7.142.0): is there an
9421
+ engine result in hand? `stats` present ⇒ the engine result (`SyncSubmitResult`; on a server <= 7.63 the flat `LegacyPlaneTaskResult`, told apart by
9422
+ `terminal`); `stats` absent ⇒ the run receipt (`SyncReceiptBody`) — read the row at `GET /v1/runs/{taskId}`. A same-key replay is the
9423
+ first answer's envelope plus `replay: true` (server >= 7.142.0; a row whose stored result is the <= 7.63 flat form replays as that flat form
9424
+ plus `replay: true`); `replay` says "replayed", never which shape. server 7.125.0–7.141.x
9425
+ answered a replay with the row's read face instead: it has no `stats` and falls in the receipt arm, which is the right reading of it.
9426
+ oneOf:
9427
+ - $ref: '#/components/schemas/SyncSubmitResult'
9428
+ - $ref: '#/components/schemas/LegacyPlaneTaskResult'
9429
+ - $ref: '#/components/schemas/SyncReceiptBody'
9430
+ PermissionModeSwitchResult:
9431
+ type: object
9432
+ description: >-
9433
+ server >= 7.141.0 — the 200 body of `POST /v1/runs/{taskId}/permission-mode` (SDK `runs.setPermissionMode`). Closed (the server's
9434
+ self-minted `permissionModeVerbBodyKey` set). Render `permissionMode.effective` (the mode the engine actually runs now), not the word
9435
+ you sent; `persisted: false` => a resume returns to the pre-switch word — switch again after the resume.
9436
+ Two arms on `persisted` (the server mints both keys from one value, `persisted` = `persistMiss` absent): `persisted: true` carries no
9437
+ `persistMiss`; `persisted: false` carries exactly one `persistMiss` word.
9438
+ additionalProperties: false
9439
+ required: [taskId, sessionId, status, permissionMode, persisted]
9440
+ oneOf:
9441
+ - properties: { persisted: { const: true } }
9442
+ not: { required: [persistMiss] }
9443
+ - properties: { persisted: { const: false } }
9444
+ required: [persistMiss]
9445
+ properties:
9446
+ taskId: { type: string }
9447
+ sessionId: { type: string }
9448
+ status: { type: string, enum: [running], description: 'Always `running` — only a running run can switch (a run that is not running answers 409).' }
9449
+ permissionMode:
9450
+ allOf: [{ $ref: '#/components/schemas/WiringManifestPermissionMode' }]
9451
+ description: 'The engine switch verb''s receipt, verbatim — the same segment shape as `wiring_manifest.permissionMode`.'
9452
+ admission:
9453
+ type: object
9454
+ additionalProperties: false
9455
+ required: [requested, admitted, foldedBy]
9456
+ 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.'
9457
+ properties:
9458
+ requested: { $ref: '#/components/schemas/PermissionMode' }
9459
+ admitted: { $ref: '#/components/schemas/PermissionMode' }
9460
+ foldedBy: { $ref: '#/components/schemas/PermissionModeAdmissionFold' }
9461
+ persisted: { type: boolean, description: 'Whether the admitted word was written back to this run''s stored request (a resume rebuilds the mode from it).' }
9462
+ persistMiss:
9463
+ allOf: [{ $ref: '#/components/schemas/PermissionModePersistMiss' }]
9464
+ description: 'Present iff `persisted` is `false` (exactly one word; the `oneOf` arms above say so).'
9465
+ PermissionModeAdmissionFold:
9466
+ type: string
9467
+ enum: [entry_floor, disable_auto_mode]
9468
+ description: >-
9469
+ server >= 7.141.0 — which admission rule folded the word on `POST /v1/runs/{taskId}/permission-mode` (SDK `PERMISSION_MODE_ADMISSION_FOLDS`,
9470
+ the server's self-minted closed set): `entry_floor` = the operator `AUTONOMY` floor; `disable_auto_mode` = the task settings'
9471
+ `disableAutoMode`. A different layer from the engine receipt's own `permissionMode.foldedBy`.
9472
+ PermissionModePersistMiss:
9473
+ type: string
9474
+ enum: [claim_released, context_absent, store_failed]
9475
+ description: >-
9476
+ server >= 7.141.0 — why a permission-mode switch was not written back to the run's stored request (SDK `PERMISSION_MODE_PERSIST_MISSES`,
9477
+ 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 /
9478
+ stopped running / a resume leg took over) — zero write; `context_absent` = held, but the run's stored request is gone — zero write;
9479
+ `store_failed` = the store write failed.
9200
9480
  RunRecord:
9201
9481
  type: object
9202
9482
  description: >
@@ -9224,13 +9504,6 @@ components:
9224
9504
  taskId: { type: string }
9225
9505
  sessionId: { type: string }
9226
9506
  status: { $ref: '#/components/schemas/RunStatus' }
9227
- replay:
9228
- const: true
9229
- description: >
9230
- server >= 7.125.0 (additive; contract §0.7). Present ONLY on the IDEMPOTENT-REPLAY body of a submit — `POST /v1/tasks` 200, and the same body as
9231
- `done.result` on `POST /v1/tasks/stream` (see `RunReplayRecord`) — where it is always `true`: the submit's key had already built this run row, so the
9232
- answer is the row's read face plus this marker, NOT the first answer's engine result. ABSENT on `GET /v1/runs/{taskId}` and
9233
- `GET /v1/runs?idempotencyKey=` (those are the read face itself) and never `false`. Branch on `replay === true`; the outcome is in `result`.
9234
9507
  msSinceLastActivity:
9235
9508
  type: integer
9236
9509
  description: >
@@ -9308,13 +9581,16 @@ components:
9308
9581
  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
9309
9582
  did not declare it) — the replica HOLDING this run NOW (the row's `instance_id`: written at create, TAKEN OVER by a
9310
9583
  cross-replica resume claim), so it answers "where is the live leg", not "who created the row". Always present on a
9311
- server that has it, and an explicit `null` (never a missing key) means no replica holds it. 🔴 `heldBy` becoming
9312
- `null` OR the run reaching a terminal status = the claim is released (either one); on a terminal row `heldBy` reads
9313
- as a HISTORICAL fact ("which replica finished it"), not "still occupied". ⚠️ The one exception is the stale fold: a
9314
- `running` row older than the stale window is shown with `status: "failed"` + `error: "run stalled (instance lost?)"`
9315
- — that is the READ's judgement; the ledger row is still `running` and its claim is held until the reaper's next beat,
9316
- and `heldBy` still names the LOST replica (the one useful coordinate when debugging). A deployment-internal replica
9317
- identity, not a user-readable location. Absent on a server < 7.73.0.
9584
+ server that has it, and an explicit `null` (never a missing key) means no replica holds it. 🔴 ONE CONDITION
9585
+ (server >= 7.141.0): `heldBy === null` <=> the run's claim is released; non-null <=> a replica holds it right now. A
9586
+ TERMINAL row (`completed` / `failed` / `blocked`, reaped rows with `errorCode` `cancelled` / `run.stalled` /
9587
+ `run.orphaned` / `approval.expired` included) is ALWAYS `null`; `running` / `suspended` / `needs_review` name the
9588
+ holder. The same read face serves `GET /v1/runs?idempotencyKey=` and a submit's same-key replay (`replay: true`).
9589
+ ⚠️ The read fold: a `running` row whose heartbeat went stale is shown `failed` (`errorCode: "run.stalled"`) while the
9590
+ ledger row is still `running` and its claim still held — `heldBy` names the LOST replica (the one useful coordinate when
9591
+ debugging); after the reaper writes it, `null`. On <= 7.140.x a terminal row still named the replica that ran it (the
9592
+ contract read "becomes `null` OR terminal = released"): against such a server test either one. A deployment-internal
9593
+ replica identity, not a user-readable location. Absent on a server < 7.73.0.
9318
9594
  cancelRequested:
9319
9595
  type: boolean
9320
9596
  description: >
@@ -10268,7 +10544,7 @@ components:
10268
10544
  `GET /v1/sessions/{sessionId}/head`. NOTE (server [2373]A-5): no consumer is wired to it yet — it is
10269
10545
  a prepared slot, correct to gate on, wrong to read as "widely consumed".
10270
10546
  policy: { type: boolean, description: "`GET /v1/policy` (autonomy/permission READ side)." }
10271
- permissionModeWrite: { type: boolean, description: "Runtime permission-mode WRITE. Advertised false by design — autonomy is CONFIG, not steer; the READ side is `policy`." }
10547
+ 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)." }
10272
10548
  modelSelection: { type: boolean, description: "`model` accepted per request." }
10273
10549
  effortSelection: { type: boolean, description: "`reasoningEffort` accepted per request." }
10274
10550
  compactionModel: { type: boolean, description: "A separate model may be pinned for compaction." }
@@ -10301,6 +10577,16 @@ components:
10301
10577
  lane) or 422 (hosted).
10302
10578
  mcp: { type: boolean, description: "MCP servers can be attached." }
10303
10579
  mcpInjection: { type: boolean, description: "Per-request MCP injection is accepted." }
10580
+ mcpTransportKinds:
10581
+ type: array
10582
+ items: { type: string }
10583
+ description: >-
10584
+ server >= 7.141.0 — the MCP transport kinds the request reader and the engine can dial today, in writing order; today
10585
+ always `["stdio", "http"]`, present on every deployment shape. It answers only "which kinds are supported" (whether this
10586
+ deployment accepts caller-supplied `mcpServers` is still `mcpInjection`; end-to-end reachability is promised by no bit).
10587
+ Filter `mcpServers` entries with it before submitting (the submit face is unchanged: a kind outside it is still a whole-request
10588
+ 400). Read OPEN — no enum here: an unknown word means "this client does not support that kind", never a failed parse (the
10589
+ bit grows words with new kinds). ABSENT = an older server (7.135.0–7.140.x: read it as `["stdio", "http"]`).
10304
10590
  mcpAssertionHeaderSent:
10305
10591
  type: boolean
10306
10592
  description: >-
@@ -10535,6 +10821,7 @@ components:
10535
10821
  hooks: { type: boolean, description: 'Single-user deployments only (`requirePrincipal !== true`).' }
10536
10822
  pluginHooks: { type: boolean, description: 'server >= 7.133.0 — the request `settings.hooks[]` PLUGIN-CONTEXT keys (command entry `plugin { name, root, dataDir?, options? }` / exec-form `args`) are accepted; same predicate as `hooks` (single-user true, multi-tenant false). ABSENT or false = the keys are stripped silently — send only on sight of the bit.' }
10537
10823
  managedHookGroups: { type: boolean, description: 'server >= 7.133.0 — the request `settings.hooks[]` GROUP `source` key (managed lanes `managedPolicy` / `managedPlugin:<name>`) is accepted; same predicate as `hooks`. ABSENT or false = stripped silently (the managed-lane semantics do not apply, it is not a refusal).' }
10824
+ httpHookAllowlists: { type: boolean, description: 'server >= 7.142.0 — the request keys `settings.allowedHttpHookUrls` / `settings.httpHookAllowedEnvVars` (the settings-schema package''s two http-hook allowlists) are read and enforced at the dial-out point. The SAME predicate as `hooks` (true on the single-user lane; false where `settings.hooks` is ignored). ABSENT = server <= 7.141.x, which answers 400 `request.body_shape` for those keys — send only on sight of the bit.' }
10538
10825
  tightenOnlySeats: { type: boolean, description: 'server >= 7.133.0, constant true — the four tighten-only request seats `settings.readDenyPatterns` / `settings.writeProtectedExtra` / `settings.complianceAdditionalDenies` / `settings.permissions.neverAuto` are accepted (each seat = deployment table UNION request list, only ever growing; an empty array is the same as not sent). ABSENT = server <= 7.132.x, which answers 400 `request.body_shape` for those keys — send only on sight of the bit.' }
10539
10826
  approvalFrameFamilies: { type: boolean, description: 'server >= 7.134.0, constant true — the request key `settings.approvalFrameFamilies` (which approval opening-frame families this run''s client renders) is accepted. THIS is the trigger bit for that key, NOT the top-level `approvalFrameFamilies`: servers <= 7.133.x already carry the top-level bit yet answer 400 `request.body_shape` (`unknownKeys: ["settings.approvalFrameFamilies"]`) for the key. ABSENT = do not send it.' }
10540
10827
  settings:
@@ -10565,6 +10852,7 @@ components:
10565
10852
  properties:
10566
10853
  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.' }
10567
10854
  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).' }
10855
+ 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.' }
10568
10856
  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.' }
10569
10857
  memoryWrite:
10570
10858
  type: boolean
@@ -10649,7 +10937,7 @@ components:
10649
10937
  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).' }
10650
10938
  maxInflightPerDevice: { type: integer }
10651
10939
  wsPath: { type: string }
10652
- 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.' }
10940
+ 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.' }
10653
10941
  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.' }
10654
10942
  memoryEngine:
10655
10943
  description: >
@@ -10665,7 +10953,7 @@ components:
10665
10953
  required: [backend, vectorMode]
10666
10954
  additionalProperties: true
10667
10955
  properties:
10668
- backend: { type: string, enum: [file, pg, tidb] }
10956
+ 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.' }
10669
10957
  # 🔴 openapi **3.1**:可空用 `type: [T, "null"]`,`nullable` 不是 3.1 关键字(会被静默忽略)。
10670
10958
  # `null` 也必须进 enum,否则真校验器把 file 引擎的常态答判非法。
10671
10959
  vectorMode: { type: ["string", "null"], enum: [native, portable, lexical, null] }
@@ -10742,6 +11030,28 @@ components:
10742
11030
  memory-capture opt-out GRANT table admin (four routes under `/v1/admin/memory-optout`,
10743
11031
  operator-only) — capabilities.ts:307. FALSE ⇒ **501** `capability.memory_optout_grant_required`
10744
11032
  (change the deployment shape), as opposed to `memoryConsolidationDriver`'s 404 (turn the knob on).
11033
+ sessionMemorySync:
11034
+ type: boolean
11035
+ description: >
11036
+ server >= 7.142.0 — the session memory-sync trigger `POST /v1/sessions/{sessionId}/memory/sync` (SDK `sessions.syncMemory`) is served: it needs the
11037
+ local sync leg (file memory engine + `MEMORY_SYNC_URL`), a durable run store and the session-ownership face. FALSE => that route answers 501
11038
+ (`feature.memory_sync_disabled` / `capability.run_store_required` / `capability.session_ownership_required`, by what is missing). ABSENT = an older server (no route).
11039
+ memorySyncServe:
11040
+ description: >
11041
+ server >= 7.142.0 — the MEMORY-SYNC CENTER's identity bit: `{ identity }` iff this is a DB memory plane (`MEMORY_ENGINE_BACKEND=pg|mysql`) with the sync perform
11042
+ seat AND the operator declared `MEMORY_SYNC_SERVE_IDENTITY`; otherwise `false` (not a center, or no identity declared — then `POST /v1/memory/sync/{scope}` answers
11043
+ 501 `feature.memory_sync_serve_disabled`). A composite bit (the server's composite-member table `memorySyncServe: ["identity"]`); there is no `true`.
11044
+ `identity` = the canonical base address clients reach this center's sync face at (lower-case scheme and host, no default port, no trailing slash, no query /
11045
+ fragment / credential), verbatim: a local shell passes it as the `target` of `POST /v1/sessions/{sessionId}/memory/sync`; the center compares an inbound `peer`
11046
+ to it as a string. ABSENT = an older server.
11047
+ oneOf:
11048
+ - { const: false }
11049
+ - $ref: '#/components/schemas/MemorySyncServeCapability'
11050
+ memoryExport:
11051
+ type: boolean
11052
+ description: >
11053
+ server >= 7.142.0 — the export read face `GET /v1/memory/export` (SDK `memory.exportScope`) is served (a DB memory plane has it). FALSE => that route answers
11054
+ 501 `capability.memory_store_required` (which reads the capability fact from 7.142.0 on, no longer the backend word). ABSENT = an older server.
10745
11055
  permissionModeAuto:
10746
11056
  type: object
10747
11057
  additionalProperties: true
@@ -11315,10 +11625,19 @@ components:
11315
11625
  description: >-
11316
11626
  server >= 7.132.0 (an accepted key; core `McpServerSpec.startupTimeoutMs`): THIS server's startup bound in whole milliseconds — the handshake
11317
11627
  (connect + initialize) and the initial tool listing each carry it. One read order: this member, else the process-level `MCP_TIMEOUT`, else the MCP
11318
- 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
11319
- 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
11320
- (`config.mcp_startup_timeout_invalid`; siblings mount) — never clamped, never read as the default. A <= 7.131.x server answers `400
11321
- request.body_shape` (named in `unknownKeys`).
11628
+ 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
11629
+ (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
11630
+ `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
11631
+ default. A durable resume replays a stored body without judging it. A <= 7.131.x server answers `400 request.body_shape` (named in `unknownKeys`).
11632
+ sessionMetaKey:
11633
+ type: string
11634
+ description: >-
11635
+ 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
11636
+ 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);
11637
+ 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
11638
+ 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
11639
+ 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
11640
+ `400 request.body_shape` naming it in `unknownKeys` (derived from that law, not measured on the old bytes).
11322
11641
 
11323
11642
  A2aServerSpec:
11324
11643
  type: object
@@ -11437,14 +11756,7 @@ components:
11437
11756
  applied:
11438
11757
  type: array
11439
11758
  description: The center's own-round applied ops (backend `PatchReport.applied` verbatim; empty on an idempotent replay).
11440
- items:
11441
- type: object
11442
- required: [op, id]
11443
- additionalProperties: false
11444
- properties:
11445
- op: { type: string, enum: [add, update, delete] }
11446
- id: { type: string }
11447
- slug: { type: string }
11759
+ items: { $ref: '#/components/schemas/MemorySyncAppliedOp' }
11448
11760
  conflicts:
11449
11761
  type: array
11450
11762
  items:
@@ -11680,6 +11992,110 @@ components:
11680
11992
  400 `request.memory_layer`; a personal-mount store ⇒ 409 `memory.erasure_store_unjudged`; `select.ids` without it on a two-store deployment ⇒ 400
11681
11993
  `request.memory_layer`).
11682
11994
 
11995
+ SessionMemorySyncRequest:
11996
+ type: object
11997
+ description: 'server >= 7.142.0 — the body of `POST /v1/sessions/{sessionId}/memory/sync`: exactly one key.'
11998
+ additionalProperties: false
11999
+ required: [target]
12000
+ properties:
12001
+ target: { type: string, description: 'The sync identity of the engine the session goes to — that engine''s `GET /v1/capabilities` `memorySyncServe.identity`, verbatim.' }
12002
+ MemorySyncAppliedOp:
12003
+ type: object
12004
+ description: One applied op of a memory sync (the backend's `PatchReport.applied` item) — the one definition, used by `MemorySyncResponse.applied` and both halves of `MemorySyncLayerReport.applied`.
12005
+ additionalProperties: false
12006
+ required: [op, id]
12007
+ properties:
12008
+ op: { type: string, enum: [add, update, delete] }
12009
+ id: { type: string }
12010
+ slug: { type: string }
12011
+ MemorySyncConflict:
12012
+ type: object
12013
+ description: 'server >= 7.142.0 — one conflict of a session memory sync layer (`MemorySyncLayerReport.conflicts`): which half (`side`), the entry, why, and the two revisions when known.'
12014
+ additionalProperties: false
12015
+ required: [side, id, reason]
12016
+ properties:
12017
+ side: { type: string, enum: [server, local] }
12018
+ id: { type: string }
12019
+ reason: { type: string }
12020
+ baseRev: { type: string }
12021
+ currentRev: { type: string }
12022
+ MemorySyncServeCapability:
12023
+ type: object
12024
+ description: 'server >= 7.142.0 — the object arm of `Capabilities.memorySyncServe`: this center''s declared sync identity.'
12025
+ additionalProperties: false
12026
+ required: [identity]
12027
+ properties:
12028
+ identity: { type: string, description: 'The declared sync identity (`MEMORY_SYNC_SERVE_IDENTITY`, canonical form) — pass it verbatim as the `target` of `POST /v1/sessions/{sessionId}/memory/sync`.' }
12029
+ MemorySyncLayerReport:
12030
+ type: object
12031
+ description: >
12032
+ server >= 7.142.0 — ONE LAYER of a memory sync (the engine's `memorySyncReportOf`, passed through): one scope, one outcome, what all its calls landed. Branch on
12033
+ `outcome`: `synced` (the layer arrived — `applied` counts do not say so, the outcome does); `incomplete` (`why`: `conflicts` — the last call's conflicts listed in
12034
+ full — or `truncated`; `warnings` = the server answers the client refused); `refused` before any request (`code` `config.memory_sync_cursor_mismatch` with
12035
+ `detail {axis, found}` or `config.memory_sync_store`; `outs` = the two ways out the sentence names); `failed` (`error` = the message; one failed layer ends only itself).
12036
+ additionalProperties: false
12037
+ required: [scope, applied, outcome]
12038
+ properties:
12039
+ scope: { type: string }
12040
+ applied:
12041
+ type: object
12042
+ additionalProperties: false
12043
+ required: [server, local]
12044
+ properties:
12045
+ server: { type: array, items: { $ref: '#/components/schemas/MemorySyncAppliedOp' } }
12046
+ local: { type: array, items: { $ref: '#/components/schemas/MemorySyncAppliedOp' } }
12047
+ outcome: { type: string, enum: [synced, incomplete, refused, failed] }
12048
+ why: { type: string, enum: [conflicts, truncated] }
12049
+ conflicts: { type: array, items: { $ref: '#/components/schemas/MemorySyncConflict' } }
12050
+ warnings: { type: array, items: { type: string } }
12051
+ code: { type: string, enum: [config.memory_sync_cursor_mismatch, config.memory_sync_store] }
12052
+ detail:
12053
+ type: object
12054
+ additionalProperties: false
12055
+ required: [axis, found]
12056
+ properties:
12057
+ axis: { type: string, enum: [scope, peer, store] }
12058
+ found: { type: string, enum: [absent, other] }
12059
+ outs: { type: array, minItems: 2, maxItems: 2, items: { type: string } }
12060
+ message: { type: string }
12061
+ error: { type: string }
12062
+ # each arm names the ONLY keys it carries (core `memorySyncReportOf` writes exactly these per outcome) — a key of another outcome is a violation
12063
+ oneOf:
12064
+ - properties: { outcome: { const: synced } }
12065
+ propertyNames: { enum: [scope, applied, outcome] }
12066
+ - properties: { outcome: { const: incomplete } }
12067
+ required: [why, conflicts]
12068
+ propertyNames: { enum: [scope, applied, outcome, why, conflicts, warnings] }
12069
+ - properties: { outcome: { const: refused } }
12070
+ required: [code, outs, message]
12071
+ propertyNames: { enum: [scope, applied, outcome, code, detail, outs, message] }
12072
+ - properties: { outcome: { const: failed } }
12073
+ required: [error]
12074
+ propertyNames: { enum: [scope, applied, outcome, error] }
12075
+ SessionMemorySyncReport:
12076
+ type: object
12077
+ description: >
12078
+ server >= 7.142.0 — the 200 body of `POST /v1/sessions/{sessionId}/memory/sync` (the engine's `MemorySyncRoundReport`, passed through). Two round arms, told
12079
+ apart by `refused` being present: `layers` (one outcome per layer; a scope of the read set with no layer was not synced) or `refused` (the whole round, zero
12080
+ requests: `config.memory_sync_target_mismatch` / `session_active`). Common keys: `target` (as given), `sourceRevision` (the session revision the sync ran
12081
+ against — the leaf of the session head; align a fork on it) and `scopes` (the session's read set, in its order).
12082
+ additionalProperties: false
12083
+ required: [target, sourceRevision, scopes]
12084
+ properties:
12085
+ target: { type: string }
12086
+ sourceRevision: { type: string }
12087
+ scopes: { type: array, items: { type: string } }
12088
+ layers: { type: array, items: { $ref: '#/components/schemas/MemorySyncLayerReport' } }
12089
+ refused:
12090
+ type: object
12091
+ additionalProperties: false
12092
+ required: [code, message]
12093
+ properties:
12094
+ code: { type: string, enum: [config.memory_sync_target_mismatch, session_active] }
12095
+ message: { type: string }
12096
+ oneOf:
12097
+ - required: [layers]
12098
+ - required: [refused]
11683
12099
  SessionMemoryEraseRequest:
11684
12100
  type: object
11685
12101
  description: >
@@ -14005,7 +14421,7 @@ components:
14005
14421
  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`.'
14006
14422
  boundGrantAbsence:
14007
14423
  allOf: [{ $ref: '#/components/schemas/BoundGrantAbsence' }]
14008
- 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`.'
14424
+ 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`.'
14009
14425
  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.' }
14010
14426
  boundGrants:
14011
14427
  allOf: [{ $ref: '#/components/schemas/BoundSkillGrants' }]
@@ -14566,6 +14982,12 @@ components:
14566
14982
  lastRunId:
14567
14983
  type: ['string', 'null']
14568
14984
  description: The most recent run's id (null when the session has no run yet) — lets a picker deep-link.
14985
+ lastTaskRunId:
14986
+ type: string
14987
+ description: >-
14988
+ The most recent run's ENGINE run id (`TaskResult.runId`) when known — OMITTED when absent, never `null` (no run, the latest run
14989
+ is running — a resume claim clears it — or an older server). A different identity axis from `lastRunId` (the latest run's
14990
+ task id): re-attach a live tail with `lastRunId`, match engine-side records (trace / journal) with this key.
14569
14991
  title:
14570
14992
  type: ['string', 'null']
14571
14993
  description: >
@@ -14599,7 +15021,21 @@ components:
14599
15021
  changed back is unchanged (no value-judging round trip). The `PATCH` 200 row and the `currentRow` of a `409 conflict.session_row_changed` are the SAME projection and carry it too.
14600
15022
  PRESENT-IFF the row can be written conditionally (all three durable session backends); a lister face with no session metadata (the in-memory run-store aggregate) does not carry it.
14601
15023
  ABSENT = an older server (<= 7.138.x) or such a face — read as "no tag, unconditional write only". Never parse it, compare its order or use it across sessions. Not an ETag, no capability bit.
15024
+ unreadable: { $ref: '#/components/schemas/SessionUnreadable' }
14602
15025
 
15026
+ SessionUnreadable:
15027
+ type: object
15028
+ additionalProperties: false
15029
+ required: [errorCode]
15030
+ description: >
15031
+ server >= 7.142.0 (additive; contract section 17.2 corrected) — THIS SESSION'S ARCHIVE CANNOT BE READ. Present-iff the leaf of the session head
15032
+ cannot be read; the key set is closed (the server's self-minted `sessionsListRowUnreadableKey`). Only on the file backend (`DB_BACKEND=local`):
15033
+ a broken / truncated session head => `corrupt_session`; an I/O-level failure (permissions, disk) => `internal.error` — the code the read faces answer
15034
+ for that session (`GET /v1/sessions/{sessionId}` and `.../head` answer 500 with it). Before 7.142.0 such sessions vanished from the list. The rest of
15035
+ the row reads like a good row, with `objectivePreview: null` (a `?q=` search does not hit it). Branch on presence (grey out / say unreadable / offer delete
15036
+ only); `DELETE /v1/sessions/{sessionId}` deletes it for its owner as usual. SQL backends never carry it.
15037
+ properties:
15038
+ errorCode: { type: string, description: '`corrupt_session` or `internal.error` — the code the read faces answer for this session. Branch on the code.' }
14603
15039
  SessionPatchBody:
14604
15040
  type: object
14605
15041
  description: >
@@ -14907,6 +15343,9 @@ components:
14907
15343
  version: { type: string }
14908
15344
  toolNames: { type: array, items: { type: string } }
14909
15345
  error: { type: string }
15346
+ authorization:
15347
+ allOf: [{ $ref: '#/components/schemas/McpAuthorization' }]
15348
+ 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.'
14910
15349
 
14911
15350
  McpStatusPanel:
14912
15351
  type: object
@@ -15066,6 +15505,37 @@ components:
15066
15505
  THIS SESSION enter long-term memory) — do not read them together.
15067
15506
  The same fact is readable by an operator as `wiring_manifest.autoConsolidation` (present-iff armed);
15068
15507
  one fact, one source — the tenant face has only this key.
15508
+ memorySync:
15509
+ allOf: [{ $ref: '#/components/schemas/SessionMemorySync' }]
15510
+ description: >-
15511
+ server >= 7.141.0 — THIS DEPLOYMENT's memory-sync park reading (a deployment fact: present <=> the deployment has a sync leg;
15512
+ independent of the session and of `?scope=`). `parked: []` = syncing. ABSENT = no sync leg, or an older server.
15513
+
15514
+ SessionMemorySync:
15515
+ type: object
15516
+ 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.'
15517
+ additionalProperties: true
15518
+ required: [parked]
15519
+ properties:
15520
+ parked:
15521
+ type: array
15522
+ items: { $ref: '#/components/schemas/MemorySyncParkedLayer' }
15523
+ 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.'
15524
+ MemorySyncParkedLayer:
15525
+ type: object
15526
+ 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).'
15527
+ additionalProperties: true
15528
+ required: [scope, wayOut]
15529
+ properties:
15530
+ scope: { type: string, description: 'The parked layer''s scope, verbatim.' }
15531
+ wayOut:
15532
+ type: string
15533
+ description: >-
15534
+ The one way out for this layer. Known word today: `delete_cursor` — delete this layer''s cursor file; the next round re-converges
15535
+ from an empty baseline (pull what the center has, push what the local store has, push no deletions; entries changed on both sides
15536
+ are reported as conflicts) — a CONSERVATIVE merge: an entry deleted on one side since the last round comes back from the other.
15537
+ The service never writes, edits or deletes a cursor itself. Read OPEN: no enum — an unknown word means "way out unknown, do not
15538
+ act for the user".
15069
15539
 
15070
15540
  McpReconnectServerStatus:
15071
15541
  type: object
@@ -15087,6 +15557,9 @@ components:
15087
15557
  errorCode: { type: string, description: 'core `McpFailureKind`. Open set; switch with a default arm.' }
15088
15558
  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.' }
15089
15559
  delivered: { type: string, enum: [yes, no, unknown], description: 'Did the request reach that server — read together with errorCode.' }
15560
+ authorization:
15561
+ allOf: [{ $ref: '#/components/schemas/McpAuthorization' }]
15562
+ 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.'
15090
15563
  serverInfo:
15091
15564
  type: object
15092
15565
  properties:
@@ -16506,6 +16979,14 @@ components:
16506
16979
  type: array
16507
16980
  items: { $ref: '#/components/schemas/GateRecordAskClass' }
16508
16981
  description: 'Beside `mode`: the whole folded class set (archive read, see `GateRecordAskClass`).'
16982
+ extension:
16983
+ type: string
16984
+ minLength: 1
16985
+ description: >
16986
+ 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
16987
+ 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
16988
+ 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
16989
+ 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.
16509
16990
 
16510
16991
  PermissionMode:
16511
16992
  type: string
@@ -16719,6 +17200,7 @@ components:
16719
17200
  delivered: { $ref: '#/components/schemas/WiringManifestMcpEntry/properties/delivered' }
16720
17201
  httpStatus: { $ref: '#/components/schemas/WiringManifestMcpEntry/properties/httpStatus' }
16721
17202
  liveness: { $ref: '#/components/schemas/WiringManifestMcpEntry/properties/liveness' }
17203
+ authorization: { $ref: '#/components/schemas/WiringManifestMcpEntry/properties/authorization' }
16722
17204
  toolNames: { type: array, items: { type: string }, maxItems: 200 }
16723
17205
  toolNamesTruncated: { type: boolean, enum: [true] }
16724
17206
  McpProbeFace:
@@ -16839,6 +17321,14 @@ components:
16839
17321
  allOf: [{ $ref: '#/components/schemas/ExtensionRequester' }]
16840
17322
  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.'
16841
17323
  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.' }
17324
+ rewrite:
17325
+ allOf: [{ $ref: '#/components/schemas/ToolInputRewrite' }]
17326
+ description: >
17327
+ 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`,
17328
+ 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
17329
+ 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
17330
+ 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` /
17331
+ `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.
16842
17332
  # 🔴 census 轴一(2026-07-30)回填:`toolEndEventData`(trace/project.ts)真发 `label` 与
16843
17333
  # `structured`,spec 此前两者都漏 —— SDK 的 events.ts 早已声明,漂移只在 spec 这一侧。
16844
17334
  label: { type: string, description: 'core 展示名(同 tool_start.label)。' }
@@ -16847,8 +17337,14 @@ components:
16847
17337
  enum: [true]
16848
17338
  description: >
16849
17339
  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
16850
- 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 —
16851
- 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`.
17340
+ 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
17341
+ 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
17342
+ 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
17343
+ 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
17344
+ `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`
17345
+ 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);
17346
+ 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
17347
+ paired `tool_start.recovered`.
16852
17348
  wireName:
16853
17349
  type: string
16854
17350
  description: >
@@ -17090,6 +17586,8 @@ components:
17090
17586
  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." }
17091
17587
  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." }
17092
17588
  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)." }
17589
+ 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`." }
17590
+ 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." }
17093
17591
  eventId: { type: string }
17094
17592
  parentToolCallId: { type: string }
17095
17593
  sourceTaskId: { type: string }
@@ -17922,6 +18420,16 @@ components:
17922
18420
  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
17923
18421
  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);
17924
18422
  a reasoning knob the model declares off is not reported here (that is `effectiveReasoning.dropped`).
18423
+ 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:
18424
+ `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
18425
+ 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
18426
+ 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.
18427
+ `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
18428
+ 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
18429
+ `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
18430
+ 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
18431
+ `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)
18432
+ and `route.credential_rebound` (the HOST moved a per-model credential's binding, outside any run) are audience `operator` — they never reach this stream.
17925
18433
  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
17926
18434
  `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 —
17927
18435
  neutralize at render); before it was the engine-neutralized single-line form (at most 201 code points). Same keys.
@@ -18013,6 +18521,13 @@ components:
18013
18521
  description: 'Machine-readable facts (per code). Redacted + bounded server-side; open set of keys.'
18014
18522
  sessionId: { type: string, description: 'Owning session — this frame only ever appears on that session stream.' }
18015
18523
  ts: { type: integer, format: int64, description: 'SERVER observation time (ms epoch), NOT the engine mint time.' }
18524
+ eventId:
18525
+ type: string
18526
+ description: >-
18527
+ server >= 7.142.0 — the identity of THIS delivery (a uuidv7 the server mints when it delivers the notice), the same identity seat as
18528
+ `EventIdentity.eventId` on content events; the live frame also carries an SSE `id:` line with this value. Use it to DEDUP (a reconnect or a
18529
+ switch from the live leg to `GET /v1/runs/{taskId}/events` can bring the same notice again). It is NOT a durable cursor (the events lane reads
18530
+ `Last-Event-ID` as a row `seq`; a uuidv7 does not read as a number, so that lane replays from 0). ABSENT on older servers and on ledger rows written before it.
18016
18531
  Event_workspace_changed:
18017
18532
  type: object
18018
18533
  description: >
@@ -18468,6 +18983,26 @@ components:
18468
18983
  kind: { type: string, enum: [extension] }
18469
18984
  name: { type: string, minLength: 1, description: 'The registration name (registrant text, UNTRUSTED-for-display).' }
18470
18985
 
18986
+ RewriteAuthor:
18987
+ description: >
18988
+ 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`),
18989
+ 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
18990
+ whole `rewrite` whose `by` carries any other form.
18991
+ oneOf:
18992
+ - { $ref: '#/components/schemas/ExtensionRequester' }
18993
+ - { type: object, additionalProperties: false, required: [kind], properties: { kind: { const: policy } } }
18994
+ - { type: object, additionalProperties: false, required: [kind], properties: { kind: { const: approver } } }
18995
+ ToolInputRewrite:
18996
+ type: object
18997
+ additionalProperties: false
18998
+ required: [by, input]
18999
+ description: >
19000
+ `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,
19001
+ 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).
19002
+ properties:
19003
+ by: { type: array, minItems: 1, items: { $ref: '#/components/schemas/RewriteAuthor' } }
19004
+ input: {}
19005
+
18471
19006
  ToolApprovalFrame:
18472
19007
  type: object
18473
19008
  description: >
@@ -20214,35 +20749,28 @@ components:
20214
20749
  description: >
20215
20750
  The stream's terminal frame. `result` is a DISCRIMINATED UNION of real shapes (契约调和车1 E,
20216
20751
  2026-08-02) — do NOT assume the full TaskResult:
20217
- · `TaskResult` — the normal terminal (output string at `.result`, stats at `.stats`), service Drift 4;
20752
+ · `SyncSubmitOutcome` — a run's outcome, the same three arms as the synchronous `POST /v1/tasks` 200 body: the engine result (`SyncSubmitResult`,
20753
+ service Drift 4), the flat `LegacyPlaneTaskResult` an older generation left in the durable ledger (a REPLAYED frame on an upgraded deployment
20754
+ can be that shape), or the run receipt `SyncReceiptBody`. A same-key replay (server >= 7.125.0, contract §0.7) is, on server >= 7.142.0, the FIRST
20755
+ ANSWER'S ENVELOPE plus `replay: true` (the engine result when the row holds one, else the receipt); server 7.125.0–7.141.x sent the row's read face
20756
+ plus `replay: true`, which has no `stats` and reads as the receipt arm. The frame carries `replay: true` as well;
20218
20757
  · `ActiveRunConflictDoneResult` — the SSE lane's REJECTION terminal: when the session already has an
20219
20758
  active run, the submit's 409 is encoded as this done frame (`src/http/routes/tasks.ts`), and it
20220
20759
  carries NO `taskId` / `sessionId` / `stats`;
20221
- · `RunReplayRecord` (server >= 7.125.0, contract §0.7) — the IDEMPOTENT-REPLAY terminal of `POST /v1/tasks/stream`: the submit's key had already built a run row, so
20222
- `result` is that row's read face plus `replay: true` — NOT an engine result (no top-level `terminal` / `stats`; the outcome is the nested `result`). The frame carries
20223
- `replay: true` as well. (A same-key duplicate still in flight in the same process is merged instead: the frame has `replay: true` but `result` is the first answer's
20224
- `TaskResult` verbatim — so the FRAME's `replay` does not tell the shapes apart; `result.replay` does.)
20225
20760
  · `SubmitRefusalDoneResult` — a submit refused after the stream was already open, as `{status:"failed", errorCode, errorMessage}` (server >= 7.125.0: `conflict.run_exists` when
20226
20761
  the replay is discovered at row-creation time and the caller cannot read that row; also the device-placement refusal). Not an engine result; carries no `taskId` / `stats`.
20227
- Narrow in TWO steps: `stats` present (an engine result) vs absent (the conflict envelope) — or match
20228
- `errorCode === "conflict.session_active_run"` — and then, among the engine results, `"terminal" in result`
20229
- (the current cause form) vs absent (`LegacyPlaneTaskResult`, the flat bytes an older generation left in
20230
- the durable ledger; a REPLAYED frame on an upgraded deployment can be that shape).
20231
- 🔴 server >= 7.64.0 — the two arms are now told apart by their KEYS, not by a shared word: the normal
20232
- terminal carries `terminal` (the tagged cause) and NO `status`; the conflict shape carries the flat
20233
- `status: "failed"` + `errorCode` because it is the SERVICE's own rejection envelope, not an engine
20234
- result, and it did not change. `status` therefore appears on exactly one arm — but keep narrowing on
20235
- `stats` / `errorCode`, which are the discriminants the service pins.
20762
+ Narrow on KEYS: `stats` present ⇒ an engine result (then `terminal` present ⇒ the current cause form, absent ⇒ `LegacyPlaneTaskResult`);
20763
+ else `activeTaskId` present ⇒ the session-occupied refusal; else `taskId` present ⇒ the run receipt; else the refusal triple.
20764
+ 🔴 server >= 7.64.0 — the normal terminal carries `terminal` (the tagged cause) and `status` only as a park word; the refusal shapes carry the flat
20765
+ `status: "failed"` + `errorCode` because they are the SERVICE's own rejection envelopes, not engine results. Branch on `errorCode`, never on the sentence.
20236
20766
  additionalProperties: false # 封闭:帧本身只有 {type,result,replay?};`result` 内部按臂各自裁定(TaskResult 开集,冲突形封闭)
20237
20767
  required: [type, result]
20238
20768
  properties:
20239
20769
  type: { const: done }
20240
20770
  result:
20241
20771
  oneOf:
20242
- - $ref: '#/components/schemas/TaskResult'
20772
+ - $ref: '#/components/schemas/SyncSubmitOutcome'
20243
20773
  - $ref: '#/components/schemas/ActiveRunConflictDoneResult'
20244
- - $ref: '#/components/schemas/LegacyPlaneTaskResult'
20245
- - $ref: '#/components/schemas/RunReplayRecord'
20246
20774
  - $ref: '#/components/schemas/SubmitRefusalDoneResult'
20247
20775
  replay:
20248
20776
  type: boolean
@@ -20251,8 +20779,8 @@ components:
20251
20779
  marks the IDEMPOTENT-REPLAY leg: this terminal was NOT produced by a live run of your submit. Either
20252
20780
  your call was deduplicated into a concurrent identical submit still in flight in the same process (then `result` is the original
20253
20781
  run's terminal, verbatim, and you received no live events at all), or — server >= 7.125.0 — the `Idempotency-Key` had already built a run
20254
- row and `result` is that row's read face plus `replay: true` (`RunReplayRecord`; NOT an engine result). The frame's flag does not
20255
- tell the two apart; `result.replay === true` does. ABSENT on every live leg (never `false`) — a UI can use it to say "replayed"
20782
+ row and `result` is the first answer's envelope plus `replay: true` (server >= 7.142.0; 7.125.0–7.141.x sent the row's read face). Read
20783
+ `result` by its keys (`stats` ⇒ engine result, else the receipt); neither flag names the shape. ABSENT on every live leg (never `false`) — a UI can use it to say "replayed"
20256
20784
  instead of implying the work just ran twice.
20257
20785
 
20258
20786
  ActiveRunConflictDoneResult:
@@ -20675,6 +21203,16 @@ components:
20675
21203
  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
20676
21204
  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
20677
21205
  (`GET /v1/workflows/{id}` etc.) deliberately never carry it. Older servers' re-delivered frames have no such key.
21206
+ diagnostics:
21207
+ type: string
21208
+ maxLength: 4000
21209
+ description: >-
21210
+ server >= 7.141.0 — the diagnostic teaching text the engine minted for the same completion (up to 5 lines of unfinished-agent
21211
+ summaries, the full-record read-handle sentence, the journal coordinate, the resume sentence); the live `task_notification`
21212
+ (`task_type: "workflow"`) frame carries the same text under the same key, but on this path host paths and URLs were already
21213
+ masked for a human reader, so the two faces are not byte-equal. Minted only when non-empty; redacted before it leaves; at most
21214
+ 4000 code units (cut at the bound). UNTRUSTED-for-display. ABSENT = no diagnostic text for this one (crash-recovery
21215
+ re-delivery, an orphan the service terminated itself, an older server, an entry an older replica queued) — not a failure.
20678
21216
 
20679
21217
  # ── 🔴 #185a (2026-08-08): the DURABLE leg's three APPROVAL arms ────────────────────────────────
20680
21218
  # Shape rule for all three: `allOf: [<frame schema>, {the narrowed discriminant}]`. The keys are NOT
@@ -21020,7 +21558,7 @@ components:
21020
21558
  reason:
21021
21559
  # 🔴 NO `enum` — same open-on-read ruling as kind 1 (SDK type is `... | (string & {})`).
21022
21560
  type: string
21023
- description: 'Machine-branchable failure shape. CLOSED server-side, OPEN ON READ — KNOWN WORDS TODAY: exit_nonzero | timeout | spawn_failed | bad_json | matcher_over_budget (server >= 7.133.0: the group matcher / the entry `if` name part did not finish evaluating within its 1000 ms budget on this name — NOT a broken hook script but an unevaluable selection condition; the server treats it as selected, the entry still runs; ONE frame per group, `if` one per entry, no exitCode / stderr).'
21561
+ description: 'Machine-branchable failure shape. CLOSED server-side, OPEN ON READ — KNOWN WORDS TODAY: exit_nonzero | timeout | spawn_failed | bad_json | matcher_over_budget (server >= 7.133.0: the group matcher / the entry `if` name part did not finish evaluating within its 1000 ms budget on this name — NOT a broken hook script but an unevaluable selection condition; the server treats it as selected, the entry still runs; ONE frame per group, `if` one per entry, no exitCode / stderr) | url_not_allowed (server >= 7.142.0: NOT a broken endpoint — the http entry was withheld by the request''s `settings.allowedHttpHookUrls` and sent zero bytes; `detail` names `settings.hooks.<event>`, the list and the judge''s rule word url / empty / malformed).'
21024
21562
  hookName: { type: string, description: 'Hook identity (statusMessage, else command/URL/prompt; redacted + bounded, http entries stripped of query/fragment). Always sent.' }
21025
21563
  entryType: { type: string, description: 'command | http | prompt | agent — without it, hookName''s nature is a guess. Closed server-side, open on read. Always sent.' }
21026
21564
  exitCode: { type: integer, description: 'Absent for timeout/spawn_failed (no exit code exists — the server never mints a legit-looking 0).' }
@@ -21044,8 +21582,9 @@ components:
21044
21582
  # NO `enum` — same open-on-read ruling as kinds 1 and 2.
21045
21583
  type: string
21046
21584
  description: >-
21047
- Why it did not complete. CLOSED on the server (thirteen words), OPEN ON READ — KNOWN WORDS TODAY: matcher_invalid | llm_carrier_unavailable | llm_cap | powershell_unsupported | if_unevaluable | budget_exhausted |
21048
- spawn_failed | timeout | exit_nonzero | bad_json | decision_out_of_set | evidence_unavailable | rewrite_unsettled. `input_truncated` / `matcher_over_budget` are NOT in this kind (they belong to kind 4).
21585
+ Why it did not complete. CLOSED on the server (fourteen words), OPEN ON READ — KNOWN WORDS TODAY: matcher_invalid | llm_carrier_unavailable | llm_cap | powershell_unsupported | if_unevaluable | budget_exhausted |
21586
+ spawn_failed | timeout | exit_nonzero | bad_json | decision_out_of_set | evidence_unavailable | rewrite_unsettled | url_not_allowed (server >= 7.142.0: a managed http entry withheld by
21587
+ `settings.allowedHttpHookUrls` — fail-closed). `input_truncated` / `matcher_over_budget` are NOT in this kind (they belong to kind 4).
21049
21588
  source: { type: string, description: 'The group''s source word (`managedPolicy` or `managedPlugin:<name>`; the name is trace only, never a criterion).' }
21050
21589
  hookName: { type: string, description: 'Hook identity (same rule as kind 2); redacted + bounded.' }
21051
21590
  entryType: { type: string, description: 'command | http | prompt | agent — closed server-side, open on read.' }
@@ -21769,6 +22308,54 @@ components:
21769
22308
  description: >
21770
22309
  Which lanes are live — core's closed three (`tool` / `diagnostics` / `tool_and_diagnostics`), read as
21771
22310
  open. ABSENT = neither lane is live (not "unknown").
22311
+ AgentRosterStatus:
22312
+ type: string
22313
+ enum: [running, parked, completed, failed, killed]
22314
+ 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.'
22315
+ AgentRosterRow:
22316
+ type: object
22317
+ additionalProperties: false
22318
+ required: [handle, name, status, spawnedAt, updatedAt]
22319
+ description: >
22320
+ 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
22321
+ 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
22322
+ 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
22323
+ 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
22324
+ 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`.
22325
+ properties:
22326
+ handle: { type: string }
22327
+ name: { type: string }
22328
+ anonymous: { type: boolean, enum: [true] }
22329
+ agentType: { type: string }
22330
+ status: { type: string, description: 'running | parked | completed | failed | killed (core `BackgroundAgentRecord["status"]`; read as an open set).' }
22331
+ spawnedAt: { type: number, description: 'epoch ms' }
22332
+ updatedAt: { type: number, description: 'epoch ms' }
22333
+ settledAt: { type: number, description: 'epoch ms; absent until the agent settles.' }
22334
+ AgentRosterPage:
22335
+ type: object
22336
+ additionalProperties: false
22337
+ required: [agents, total]
22338
+ description: >
22339
+ 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);
22340
+ `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`.
22341
+ properties:
22342
+ agents: { type: array, items: { $ref: '#/components/schemas/AgentRosterRow' } }
22343
+ total: { type: integer, minimum: 0 }
22344
+ nextBefore: { type: string }
22345
+ truncated: { type: boolean, enum: [true] }
22346
+ McpAuthorization:
22347
+ type: object
22348
+ additionalProperties: false
22349
+ required: [reason]
22350
+ description: >
22351
+ 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`
22352
+ 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
22353
+ 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.
22354
+ 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`.
22355
+ properties:
22356
+ reason:
22357
+ type: string
22358
+ 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).'
21772
22359
  WiringManifestMcpEntry:
21773
22360
  # 8.9.0:从 `Event_wiring_manifest.mcp.items` 的内联形**提取**为具名 schema —— 同一份行形现在被
21774
22361
  # 两处引用(live 帧与 `WiringManifest` 的静态/两半形),内联会立刻变成两份会各自漂的镜像。
@@ -21821,6 +22408,9 @@ components:
21821
22408
  is the engine's STRONGER claim (it looked and the answer does not decide reach). Do not infer "was it
21822
22409
  dialed" from absence. Declared here as of sdk 11.2.0 — the key had been on the wire since server 7.91.2
21823
22410
  while this row schema stayed closed, so a strict consumer was rejecting a LEGITIMATE response.
22411
+ authorization:
22412
+ allOf: [{ $ref: '#/components/schemas/McpAuthorization' }]
22413
+ 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.'
21824
22414
 
21825
22415
  ServerWiringGates:
21826
22416
  type: object
@@ -22186,6 +22776,19 @@ components:
22186
22776
  description: 'Tool DEFINITIONS (so the model can emit toolCalls data) — the server NEVER executes them.'
22187
22777
  maxOutputTokens: { type: integer }
22188
22778
 
22779
+ SideQueryAccountRow:
22780
+ type: object
22781
+ additionalProperties: false
22782
+ required: [origin, tokens]
22783
+ description: >-
22784
+ 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
22785
+ (`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
22786
+ 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.
22787
+ properties:
22788
+ origin: { const: side_query }
22789
+ tokens: { type: integer, minimum: 0 }
22790
+ costMicroUsd: { type: integer, minimum: 0 }
22791
+ usageMissing: { type: boolean, enum: [true] }
22189
22792
  SideQueryResult:
22190
22793
  type: object
22191
22794
  description: >
@@ -22235,8 +22838,11 @@ components:
22235
22838
  `http` / `stream_torn` / `refusal` / `length_empty`). ABSENT on success and on older servers.
22236
22839
  errorKind:
22237
22840
  type: string
22238
- enum: [input_too_long, degenerate, length_empty]
22239
- 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.'
22841
+ enum: [input_too_long, degenerate, length_empty, image_unprocessable]
22842
+ 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.'
22843
+ account:
22844
+ allOf: [{ $ref: '#/components/schemas/SideQueryAccountRow' }]
22845
+ 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.'
22240
22846
  inputTooLongRuledOut:
22241
22847
  type: boolean
22242
22848
  enum: [true]