@sema-agent/sdk 30.1.0 → 31.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +85 -0
  2. package/dist/errors.d.ts +18 -2
  3. package/dist/errors.d.ts.map +1 -1
  4. package/dist/errors.js +16 -1
  5. package/dist/errors.js.map +1 -1
  6. package/dist/events.d.ts +86 -11
  7. package/dist/events.d.ts.map +1 -1
  8. package/dist/events.js.map +1 -1
  9. package/dist/health.d.ts +14 -0
  10. package/dist/health.d.ts.map +1 -1
  11. package/dist/health.js.map +1 -1
  12. package/dist/index.d.ts +13 -6
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +6 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/resources/approvals.d.ts +2 -1
  17. package/dist/resources/approvals.d.ts.map +1 -1
  18. package/dist/resources/approvals.js.map +1 -1
  19. package/dist/resources/fleet.d.ts +52 -0
  20. package/dist/resources/fleet.d.ts.map +1 -1
  21. package/dist/resources/fleet.js +25 -0
  22. package/dist/resources/fleet.js.map +1 -1
  23. package/dist/resources/memory.d.ts +1 -1
  24. package/dist/resources/memory.js +1 -1
  25. package/dist/resources/runs.d.ts +62 -1
  26. package/dist/resources/runs.d.ts.map +1 -1
  27. package/dist/resources/runs.js +32 -0
  28. package/dist/resources/runs.js.map +1 -1
  29. package/dist/resources/session-sync.d.ts +9 -0
  30. package/dist/resources/session-sync.d.ts.map +1 -1
  31. package/dist/resources/session-sync.js +9 -0
  32. package/dist/resources/session-sync.js.map +1 -1
  33. package/dist/resources/sessions.d.ts +5 -3
  34. package/dist/resources/sessions.d.ts.map +1 -1
  35. package/dist/resources/sessions.js +5 -3
  36. package/dist/resources/sessions.js.map +1 -1
  37. package/dist/resources/side-query.d.ts +20 -2
  38. package/dist/resources/side-query.d.ts.map +1 -1
  39. package/dist/resources/side-query.js.map +1 -1
  40. package/dist/resources/tasks.d.ts +6 -1
  41. package/dist/resources/tasks.d.ts.map +1 -1
  42. package/dist/resources/tasks.js +6 -1
  43. package/dist/resources/tasks.js.map +1 -1
  44. package/dist/resources/tool-approvals.d.ts +4 -3
  45. package/dist/resources/tool-approvals.d.ts.map +1 -1
  46. package/dist/resources/tool-approvals.js +4 -3
  47. package/dist/resources/tool-approvals.js.map +1 -1
  48. package/dist/settings.d.ts +29 -5
  49. package/dist/settings.d.ts.map +1 -1
  50. package/dist/settings.js +6 -1
  51. package/dist/settings.js.map +1 -1
  52. package/dist/sse.d.ts +5 -1
  53. package/dist/sse.d.ts.map +1 -1
  54. package/dist/sse.js +8 -3
  55. package/dist/sse.js.map +1 -1
  56. package/dist/types.d.ts +145 -16
  57. package/dist/types.d.ts.map +1 -1
  58. package/dist/types.js +7 -0
  59. package/dist/types.js.map +1 -1
  60. package/openapi.yaml +419 -22
  61. package/package.json +2 -2
package/openapi.yaml CHANGED
@@ -481,6 +481,10 @@ paths:
481
481
  user stream). Only reachable when the operator set the knob; a retry does not change the verdict. ⚠️ The SDK surfaces it as a TYPED ConflictError and does
482
482
  NOT silently resolve it to that run: `activeTaskId` may be the caller's own first attempt OR an unrelated
483
483
  concurrent run on the same session — 409 alone cannot tell (same text as the `Conflict` response component).
484
+ Server >= 7.138.0 (engine 7.58.0), zero-work submissions only, the project-identity reconciliation: `config.project_identity_mismatch` (the declared `projectId`, or the project the session's previous leg declared, is not the
485
+ checkout's `.sema/project` marker), `config.memory_project_marker` (the marker is unreadable and this leg needs a project identity) and `config.memory_project_marker_nested` (the marker is nested below the repo root) —
486
+ refused before the run starts, zero tokens; the request is well-formed, the checkout state conflicts with it (declare the marker's id / fix the marker / use another session; a verbatim retry does not change the verdict). `activeTaskId` is
487
+ absent. Async / live legs answer 2xx with the same code on the terminal run row / `done` frame's `terminal.code`.
484
488
  K-24 (server >= 7.104.0 / S-724, zero-work submissions only): `rewind.store_unconfigured` — this
485
489
  deployment has NO file-history store but the request asks to restore files; the request is well-formed, the
486
490
  deployment shape conflicts with it (change the deployment, not the request; `capabilities.rewindFiles` is false
@@ -614,6 +618,12 @@ paths:
614
618
  sessionId?}` — the X-Task-Id response header as a first-class in-stream signal (EventSource and
615
619
  some proxies cannot read headers). Same source, same condition: no durable ledger => neither the
616
620
  header nor the meta frame.
621
+ FRAME NAMING (server >= 7.141.0): EVERY frame on this stream is `[id: <eventId>\n]event: <type>\ndata: <json>` — the
622
+ event name is the payload's `type` (engine frames and `done` included; heartbeat = `event: heartbeat` + `data: {}`), the
623
+ same frame shape as `GET /v1/runs/{taskId}/events`. On <= 7.140.x the engine frames and `done` were unnamed `data:` frames
624
+ (only `meta`, the heartbeat and the out-of-band approval / question / form frames were named). A reader on the default
625
+ `message` channel (`EventSource.onmessage`) receives no content frame and no `done` from a 7.141.0 server: listen by event
626
+ name, or parse each `data:` line and dispatch on its `type` (what the SDK's `tasks.stream` does — unchanged).
617
627
  content:
618
628
  text/event-stream:
619
629
  schema: { $ref: '#/components/schemas/AgentEvent' }
@@ -652,7 +662,8 @@ paths:
652
662
  Async; runs in the background. Requires a TiDB run store (absent → 501). Auto `Idempotency-Key`.
653
663
  Poll `GET /v1/runs/:id` or stream `GET /v1/runs/:id/events`. A client disconnect does NOT stop the run.
654
664
  Prepare-time refusals do not answer an HTTP error here: the 202 receipt is followed by a run that ends `failed` with the code (e.g. server >= 7.140.0
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).
665
+ `config.read_deny_floor_unkept` when the deployment sets `READ_DENY_FLOOR_REQUIRED=true`; the synchronous `POST /v1/tasks` answers 409 for the same state; server >= 7.138.0 the project-identity codes
666
+ `config.project_identity_mismatch` / `config.memory_project_marker` / `config.memory_project_marker_nested` land the same way — a 202 receipt, then a run that ends `failed` with the code on its terminal row).
656
667
  parameters:
657
668
  - $ref: '#/components/parameters/IdempotencyKey'
658
669
  requestBody:
@@ -1034,6 +1045,80 @@ paths:
1034
1045
  application/json:
1035
1046
  schema: { $ref: '#/components/schemas/ErrorResponse' }
1036
1047
 
1048
+ /v1/runs/{taskId}/permission-mode:
1049
+ parameters:
1050
+ - $ref: '#/components/parameters/PrincipalHeader'
1051
+ - $ref: '#/components/parameters/TaskIdPath'
1052
+ - name: session
1053
+ in: query
1054
+ required: false
1055
+ schema: { type: string }
1056
+ description: >-
1057
+ For a session-bound run a non-operator caller sends the run's session id here — a mismatch answers the same 404 as an unknown run
1058
+ (the shared run-face session assertion; absence is accepted today).
1059
+ post:
1060
+ tags: [runs]
1061
+ operationId: runsSetPermissionMode
1062
+ x-status: gated # server 7.141.0 route `run-permission-mode`; gate = capabilities.permissionModeWrite (durable run store AND checkpoint store) => 501 when unmet. SDK runs.setPermissionMode() consumes it.
1063
+ summary: Switch the permission mode of a RUNNING run.
1064
+ description: >
1065
+ server >= 7.141.0. Body is exactly `{ mode }` (the six engine words); passes straight to the engine's switch verb and answers 200 with
1066
+ its receipt (`PermissionModeSwitchResult`). The submit door and this door share ONE admission judge: the operator `AUTONOMY` floor,
1067
+ the hosted write fence and the task settings' `disableAutoMode` fold / refuse identically on both (refusal `422
1068
+ request.host_posture_refused`, same sentence as the submit door). The admitted word is written back to the run's stored request under
1069
+ the run's claim fence (a later leg that took over is never overwritten); a miss answers `persisted: false` + `persistMiss`. Concurrent
1070
+ switches on one run are serialized server-side. Gate: `capabilities.permissionModeWrite`.
1071
+ requestBody:
1072
+ required: true
1073
+ content:
1074
+ application/json:
1075
+ schema:
1076
+ type: object
1077
+ required: [mode]
1078
+ additionalProperties: false
1079
+ properties:
1080
+ mode: { $ref: '#/components/schemas/PermissionMode' }
1081
+ responses:
1082
+ '200':
1083
+ description: Switched.
1084
+ content:
1085
+ application/json:
1086
+ schema: { $ref: '#/components/schemas/PermissionModeSwitchResult' }
1087
+ '400':
1088
+ description: '`request.body_shape` — the body is not exactly `{ mode: <string> }`.'
1089
+ content:
1090
+ application/json:
1091
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
1092
+ '401': { $ref: '#/components/responses/Unauthorized' }
1093
+ '404':
1094
+ description: '`not_found.run` — unknown run, not yours, or the `session` assertion does not match.'
1095
+ content:
1096
+ application/json:
1097
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
1098
+ '409':
1099
+ description: >-
1100
+ `steering.not_running` — the run is parked on a pending decision, already ended, live on another replica, or has no live switchable
1101
+ face on this replica (a verify / cascade submission); the sentence says which. `conflict.resume_context_unavailable` — the run's
1102
+ stored request is missing; `conflict.checkpoint_ctx_unsealable` — it holds credentials this server cannot unseal.
1103
+ content:
1104
+ application/json:
1105
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
1106
+ '422':
1107
+ description: '`steering.invalid_content` — `mode` is not one of the six words (judged before the run is read); `request.host_posture_refused` — the hosted write fence refuses that mode (same sentence as the submit door).'
1108
+ content:
1109
+ application/json:
1110
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
1111
+ '429': { $ref: '#/components/responses/RateLimited' }
1112
+ '500':
1113
+ description: '`corrupt` — the stored request cannot be read (the operator repairs or removes the row named in `where`).'
1114
+ content:
1115
+ application/json:
1116
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
1117
+ '501':
1118
+ description: '`capability.run_store_required` (no durable run store) / `capability.checkpoint_store_required` (no checkpoint store, `DURABLE_APPROVAL`) — the two causes of `capabilities.permissionModeWrite: false`.'
1119
+ content:
1120
+ application/json:
1121
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
1037
1122
  /v1/runs/{taskId}/interrupt:
1038
1123
  parameters:
1039
1124
  - $ref: '#/components/parameters/PrincipalHeader'
@@ -4998,6 +5083,54 @@ paths:
4998
5083
  '401': { $ref: '#/components/responses/Unauthorized' }
4999
5084
  '501': { $ref: '#/components/responses/NotImplemented' }
5000
5085
 
5086
+ /v1/agents/roster:
5087
+ parameters:
5088
+ - $ref: '#/components/parameters/PrincipalHeader'
5089
+ get:
5090
+ tags: [fleet]
5091
+ operationId: agentsRoster
5092
+ x-status: gated # server src/http/routes/agents-roster.ts — deployment switch = capability `agentRoster` (no durable background-agent store → the route self-answers 501); sdk 31.0.0 `client.fleet.agentRoster()`.
5093
+ summary: List the background-agent roster (cross-session, newest first).
5094
+ description: >
5095
+ The background-agent ROSTER read face: which background agents does this tenant have, and in what state — across sessions (`?session=` is only an optional narrowing). Rows are a content-free
5096
+ whitelist (`AgentRosterRow`): `handle` / `name` / `agentType?` / `status` / `spawnedAt` / `updatedAt` / `settledAt?` / `anonymous?` — NO `owner`, NO session id (the roster is not an addressing face),
5097
+ NO `usage`. `name` is always present (engine 7.57.0+: an unnamed agent carries the engine-derived name `agent-<12 hex>`); `anonymous: true` (server >= 7.138.0) is present exactly when `name` IS that derived name.
5098
+ Query: `limit` 1..100 (default 20), `before` (the opaque `nextBefore` of the previous page), `status` (closed: running / parked / completed / failed / killed), `session` (narrow to one session tree), `scope`
5099
+ (fleet-wide callers only; a principal caller is pinned to its own scope). All strictly validated (400 `request.query_invalid`, never a silent default). `total` is the owner-scoped row count of the roster WINDOW (500 rows):
5100
+ `truncated: true` means the tenant has more rows than the window — do not read `total` as the whole. 🔴 Another tenant's rows do not EXIST here (not a 403, not an "empty 200 whose total is one more") — there is no
5101
+ "exists but not yours" face. Identity is judged BEFORE store availability. 501 `capability.background_agent_store_required` without a durable background-agent store (read `capabilities.agentRoster` first).
5102
+ parameters:
5103
+ - in: query
5104
+ name: limit
5105
+ required: false
5106
+ schema: { type: integer, minimum: 1, maximum: 100 }
5107
+ - in: query
5108
+ name: before
5109
+ required: false
5110
+ schema: { type: string }
5111
+ - in: query
5112
+ name: status
5113
+ required: false
5114
+ schema: { $ref: '#/components/schemas/AgentRosterStatus' }
5115
+ - in: query
5116
+ name: session
5117
+ required: false
5118
+ schema: { type: string }
5119
+ - in: query
5120
+ name: scope
5121
+ required: false
5122
+ schema: { type: string }
5123
+ description: Fleet-wide callers only; ignored for principal callers (pinned).
5124
+ responses:
5125
+ '200':
5126
+ description: 'One page of the roster: `{ agents, total, nextBefore?, truncated? }`.'
5127
+ content:
5128
+ application/json:
5129
+ schema: { $ref: '#/components/schemas/AgentRosterPage' }
5130
+ '400': { $ref: '#/components/responses/BadRequest' }
5131
+ '401': { $ref: '#/components/responses/Unauthorized' }
5132
+ '501': { $ref: '#/components/responses/NotImplemented' }
5133
+
5001
5134
  /v1/leader:
5002
5135
  parameters:
5003
5136
  - $ref: '#/components/parameters/PrincipalHeader'
@@ -7530,7 +7663,11 @@ components:
7530
7663
  multi-tenant DB memory face it moves the derived scope from the user shelf to the project shelf
7531
7664
  (`proj:<tenant>/<projectId>`) and seeds `memory.scopes` from that project's `defaultScopes`;
7532
7665
  single-user deployments ignore the derivation and only apply the seed. Rides the persisted body
7533
- onto resume legs.
7666
+ onto resume legs. server >= 7.138.0 (engine 7.58.0) reconciles the declaration with the checkout's `.sema/project` marker BEFORE the leg
7667
+ runs (no token burned): the project a leg declares (this field; else the project the session's previous leg declared — the last `workspace_changed` frame's `project.id`, only when its
7668
+ `project.source` is `declared`) must equal the marker's, else `config.project_identity_mismatch` (409); with no marker the declaration IS the identity. An unreadable marker the leg needs →
7669
+ `config.memory_project_marker` (409), a marker nested below the repo root → `config.memory_project_marker_nested` (409); a declared id that is not a UUID is the engine's `config.project_id_invalid`
7670
+ (400) — this server's request face cannot mint it (the authorizer answers 422 `invalid_project_id` first). Synchronous legs answer the HTTP status; async / live legs answer 2xx with the same code on the terminal run row.
7534
7671
  jobId:
7535
7672
  type: string
7536
7673
  minLength: 1
@@ -7972,6 +8109,15 @@ components:
7972
8109
  model + outputStyle + env shipped in the 1.26.0 v1 scope; hooks was deferred at that point and wired
7973
8110
  in a later batch — both are live and interpreted today, not a raw uninterpreted passthrough);
7974
8111
  `permissions.defaultMode`'s specific fold is documented on `TaskRequest.permissionMode`.
8112
+ LAYERED RULE ENTRIES (server >= 7.141.0, gate `capabilities.settings.permissions.layers`): an entry of `permissions.deny` /
8113
+ `permissions.ask` is a plain string OR `{ rule, layer }` (exactly those two keys; `layer` one of `userSettings` /
8114
+ `projectSettings` / `localSettings` / `flagSettings` / `policySettings` / `foreignProjectSettings`). The layer only moves
8115
+ WHERE a `/`-rooted path rule reads: `userSettings` reads under the execution environment's configuration root (host lane
8116
+ `SEMA_CONFIG_DIR`, default `~/.sema`; sandbox lanes the forwarded `SEMA_CONFIG_DIR`, else `.sema` under the execution home;
8117
+ unresolvable => whole-request 422 `request.unprocessable` with entry-problem reason `home_unresolvable`), every other layer
8118
+ reads under the task root like a plain string; `~/`, `//` and relative forms read the same in every layer. `allow` takes
8119
+ plain strings only (a layered entry there => 400 `bad_entry`). A malformed layered entry => 400 `bad_entry` + the first
8120
+ bad index. Up to 1000 entries per bucket, both forms counted.
7975
8121
  🔴 ON THIS SUBMIT FACE THE KEY SET IS CLOSED (server >= 7.57.0 for the sub-tree): accepted top-level keys
7976
8122
  are `env` / `hooks` / `model` / `outputStyle` / `permissions` / `skillListingBudgetFraction` /
7977
8123
  `skillListingMaxDescChars` / `ultracode` / `webSearch` (server >= 7.133.0 adds the three TIGHTEN-ONLY seats `complianceAdditionalDenies` / `readDenyPatterns` / `writeProtectedExtra`; server >= 7.134.0 adds `approvalFrameFamilies`), and accepted `permissions.*` keys are
@@ -8789,7 +8935,10 @@ components:
8789
8935
  stats: { $ref: '#/components/schemas/TaskStats' }
8790
8936
  verification:
8791
8937
  type: object
8792
- description: Present when run behind the verify gate.
8938
+ description: >-
8939
+ Present when run behind the verify gate. Only `verdict` / `rounds` / `findings` are declared here; the engine outcome can
8940
+ carry more (`unverifiedReason`, `verifierPause`), not declared yet. From server 7.141.0 on `verifierPause` never carries the
8941
+ verifier session's resume credential `checkpointToken` outward (the exit seal strips it); a <= 7.140.x server could.
8793
8942
  properties:
8794
8943
  verdict: { type: string, enum: [PASS, FAIL, PARTIAL, unverified] }
8795
8944
  rounds: { type: integer }
@@ -9197,6 +9346,56 @@ components:
9197
9346
  status:
9198
9347
  allOf: [{ $ref: '#/components/schemas/RunStatus' }]
9199
9348
  description: 'Poll-receipt word on a park (>= 7.64: suspended / needs_review only), or the flat terminal word of a server <= 7.63 (LegacyPlaneTaskResult.status).'
9349
+ PermissionModeSwitchResult:
9350
+ type: object
9351
+ description: >-
9352
+ server >= 7.141.0 — the 200 body of `POST /v1/runs/{taskId}/permission-mode` (SDK `runs.setPermissionMode`). Closed (the server's
9353
+ self-minted `permissionModeVerbBodyKey` set). Render `permissionMode.effective` (the mode the engine actually runs now), not the word
9354
+ you sent; `persisted: false` => a resume returns to the pre-switch word — switch again after the resume.
9355
+ Two arms on `persisted` (the server mints both keys from one value, `persisted` = `persistMiss` absent): `persisted: true` carries no
9356
+ `persistMiss`; `persisted: false` carries exactly one `persistMiss` word.
9357
+ additionalProperties: false
9358
+ required: [taskId, sessionId, status, permissionMode, persisted]
9359
+ oneOf:
9360
+ - properties: { persisted: { const: true } }
9361
+ not: { required: [persistMiss] }
9362
+ - properties: { persisted: { const: false } }
9363
+ required: [persistMiss]
9364
+ properties:
9365
+ taskId: { type: string }
9366
+ sessionId: { type: string }
9367
+ status: { type: string, enum: [running], description: 'Always `running` — only a running run can switch (a run that is not running answers 409).' }
9368
+ permissionMode:
9369
+ allOf: [{ $ref: '#/components/schemas/WiringManifestPermissionMode' }]
9370
+ description: 'The engine switch verb''s receipt, verbatim — the same segment shape as `wiring_manifest.permissionMode`.'
9371
+ admission:
9372
+ type: object
9373
+ additionalProperties: false
9374
+ required: [requested, admitted, foldedBy]
9375
+ description: 'Present only when the service''s admission judge FOLDED the word (the same judge as the submit door): `requested` = the word you sent, `admitted` = the word handed to the engine.'
9376
+ properties:
9377
+ requested: { $ref: '#/components/schemas/PermissionMode' }
9378
+ admitted: { $ref: '#/components/schemas/PermissionMode' }
9379
+ foldedBy: { $ref: '#/components/schemas/PermissionModeAdmissionFold' }
9380
+ persisted: { type: boolean, description: 'Whether the admitted word was written back to this run''s stored request (a resume rebuilds the mode from it).' }
9381
+ persistMiss:
9382
+ allOf: [{ $ref: '#/components/schemas/PermissionModePersistMiss' }]
9383
+ description: 'Present iff `persisted` is `false` (exactly one word; the `oneOf` arms above say so).'
9384
+ PermissionModeAdmissionFold:
9385
+ type: string
9386
+ enum: [entry_floor, disable_auto_mode]
9387
+ description: >-
9388
+ server >= 7.141.0 — which admission rule folded the word on `POST /v1/runs/{taskId}/permission-mode` (SDK `PERMISSION_MODE_ADMISSION_FOLDS`,
9389
+ the server's self-minted closed set): `entry_floor` = the operator `AUTONOMY` floor; `disable_auto_mode` = the task settings'
9390
+ `disableAutoMode`. A different layer from the engine receipt's own `permissionMode.foldedBy`.
9391
+ PermissionModePersistMiss:
9392
+ type: string
9393
+ enum: [claim_released, context_absent, store_failed]
9394
+ description: >-
9395
+ server >= 7.141.0 — why a permission-mode switch was not written back to the run's stored request (SDK `PERMISSION_MODE_PERSIST_MISSES`,
9396
+ the server's self-minted closed set): `claim_released` = the leg that took the switch no longer holds the run at write-back (it parked /
9397
+ stopped running / a resume leg took over) — zero write; `context_absent` = held, but the run's stored request is gone — zero write;
9398
+ `store_failed` = the store write failed.
9200
9399
  RunRecord:
9201
9400
  type: object
9202
9401
  description: >
@@ -9308,13 +9507,16 @@ components:
9308
9507
  server >= 7.73.0 (S-230 P-45; contract §5.5 (c); K-43 — the mint has carried it since 7.73.0, this closed schema
9309
9508
  did not declare it) — the replica HOLDING this run NOW (the row's `instance_id`: written at create, TAKEN OVER by a
9310
9509
  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.
9510
+ server that has it, and an explicit `null` (never a missing key) means no replica holds it. 🔴 ONE CONDITION
9511
+ (server >= 7.141.0): `heldBy === null` <=> the run's claim is released; non-null <=> a replica holds it right now. A
9512
+ TERMINAL row (`completed` / `failed` / `blocked`, reaped rows with `errorCode` `cancelled` / `run.stalled` /
9513
+ `run.orphaned` / `approval.expired` included) is ALWAYS `null`; `running` / `suspended` / `needs_review` name the
9514
+ holder. The same read face serves `GET /v1/runs?idempotencyKey=` and a submit's same-key replay (`replay: true`).
9515
+ ⚠️ The read fold: a `running` row whose heartbeat went stale is shown `failed` (`errorCode: "run.stalled"`) while the
9516
+ ledger row is still `running` and its claim still held — `heldBy` names the LOST replica (the one useful coordinate when
9517
+ debugging); after the reaper writes it, `null`. On <= 7.140.x a terminal row still named the replica that ran it (the
9518
+ contract read "becomes `null` OR terminal = released"): against such a server test either one. A deployment-internal
9519
+ replica identity, not a user-readable location. Absent on a server < 7.73.0.
9318
9520
  cancelRequested:
9319
9521
  type: boolean
9320
9522
  description: >
@@ -10268,7 +10470,7 @@ components:
10268
10470
  `GET /v1/sessions/{sessionId}/head`. NOTE (server [2373]A-5): no consumer is wired to it yet — it is
10269
10471
  a prepared slot, correct to gate on, wrong to read as "widely consumed".
10270
10472
  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`." }
10473
+ permissionModeWrite: { type: boolean, description: "server >= 7.141.0: whether `POST /v1/runs/{taskId}/permission-mode` (the SDK's `runs.setPermissionMode`) is wired on this deployment — a FACILITY bit: a durable run store AND the checkpoint store (`DURABLE_APPROVAL`) => `true`; either missing => `false`, and the route answers 501 `capability.run_store_required` / `capability.checkpoint_store_required`. On <= 7.140.x it was not tied to a facility (always `false`: no such route)." }
10272
10474
  modelSelection: { type: boolean, description: "`model` accepted per request." }
10273
10475
  effortSelection: { type: boolean, description: "`reasoningEffort` accepted per request." }
10274
10476
  compactionModel: { type: boolean, description: "A separate model may be pinned for compaction." }
@@ -10301,6 +10503,16 @@ components:
10301
10503
  lane) or 422 (hosted).
10302
10504
  mcp: { type: boolean, description: "MCP servers can be attached." }
10303
10505
  mcpInjection: { type: boolean, description: "Per-request MCP injection is accepted." }
10506
+ mcpTransportKinds:
10507
+ type: array
10508
+ items: { type: string }
10509
+ description: >-
10510
+ server >= 7.141.0 — the MCP transport kinds the request reader and the engine can dial today, in writing order; today
10511
+ always `["stdio", "http"]`, present on every deployment shape. It answers only "which kinds are supported" (whether this
10512
+ deployment accepts caller-supplied `mcpServers` is still `mcpInjection`; end-to-end reachability is promised by no bit).
10513
+ Filter `mcpServers` entries with it before submitting (the submit face is unchanged: a kind outside it is still a whole-request
10514
+ 400). Read OPEN — no enum here: an unknown word means "this client does not support that kind", never a failed parse (the
10515
+ bit grows words with new kinds). ABSENT = an older server (7.135.0–7.140.x: read it as `["stdio", "http"]`).
10304
10516
  mcpAssertionHeaderSent:
10305
10517
  type: boolean
10306
10518
  description: >-
@@ -10565,6 +10777,7 @@ components:
10565
10777
  properties:
10566
10778
  allowGrant: { type: boolean, description: 'Constant `true` on server >= 7.115.0: `settings.permissions.allow` is read as allow RULES, not as a list. The whole `settings` key being absent = an older server.' }
10567
10779
  allowLayer: { type: boolean, description: 'Constant `true` on server >= 7.117.0 (core 7.42.0): the whole `settings.permissions.allow` list goes to the engine allow layer (listed calls are not asked; content forms accepted; entries read as nothing get an `engine_notice` `permission.allowed_tool_not_granted`). Absent = a server without it (7.115.0–7.116.x: allow is a statement; older: a list).' }
10780
+ layers: { type: boolean, description: 'Constant `true` on server >= 7.141.0 (both deployment shapes): `settings.permissions.deny` / `ask` accept a layered entry `{ rule, layer }` beside a plain string (see `TaskRequest.settings`). Send layered entries only when this bit is `true`: an older server refuses them (a new submit 400, a resume 409) — loud, never silently dropped.' }
10568
10781
  callerTrust: { type: string, description: 'server >= 7.133.0 — THIS caller''s trust tier (per caller / per credential, NOT a version bit). Request rule tables that take effect without a person answering (`settings.permissions` buckets; a named-invoked skill''s `allowedTools` / `disallowedTools`) are admitted by it: `allow` loosens the no-ask surface and needs `global`; `deny` / `ask` only tighten and are admitted at any tier. Today `global` (single-user turnkey; multi-tenant with the deployment service credential; multi-tenant sign-in token whose scope role >= the governance write role) or `project` (everything else). Read OPEN: an unknown word is treated as `project` (fail-closed). A request below the floor is refused whole with 400 `request.field_invalid` (`detail.problems[].reason: below_trust_floor`, `detail.callerTrust`). ABSENT = server <= 7.132.x: no per-tier admission.' }
10569
10782
  memoryWrite:
10570
10783
  type: boolean
@@ -10649,7 +10862,7 @@ components:
10649
10862
  protocolVersion: { type: integer, description: 'The protocol REVISION this server speaks (the `challenge` frame carries the same value; accepted window [1, 3] on server >= 7.137.0). Server >= 7.137.0 reads 3 (7.133.x-7.136.x read 2, <= 7.132.x read 1). An executor declares the SMALLER of its own highest revision and this value, and takes its outcome-code set from the declared revision (revision 2 added `liveness_no_output`; revision 3 added `name_too_long`, file instructions only).' }
10650
10863
  maxInflightPerDevice: { type: integer }
10651
10864
  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.' }
10865
+ relayUrl: { type: string, description: 'server >= 7.137.0. PRESENT-IFF the operator declared `DEVICE_RELAY_URL` as a ws(s) URL: the device-facing direct entry — an absolute ws(s) URL (no userinfo / query / fragment), verbatim. A dialer dials it instead of building engine address + `wsPath`; absent = build it as before. server >= 7.141.0 requires the env on the device lane (a ws(s) URL, or the literal `none` = no relay => this key absent); on <= 7.140.x absence may also mean the operator wrote nothing.' }
10653
10866
  management: { type: boolean, description: 'server >= 7.88.0. `/v1/devices/*` admin verbs present. PRESENT-IFF — absent means a pre-7.88.0 peer (unknown), not false.' }
10654
10867
  memoryEngine:
10655
10868
  description: >
@@ -10665,7 +10878,7 @@ components:
10665
10878
  required: [backend, vectorMode]
10666
10879
  additionalProperties: true
10667
10880
  properties:
10668
- backend: { type: string, enum: [file, pg, tidb] }
10881
+ backend: { type: string, description: 'OPEN word (not an enum: the supported server range answers two generations of it). Known words = the settings-schema `MEMORY_ENGINE_BACKENDS`: `file` / `pg` / `mysql` — server >= 7.141.0 answers `mysql` on a MySQL-family deployment (the same word as `DB_BACKEND=mysql`); a <= 7.140.x server answers `tidb` there (the retired spelling of the same backend, no alias in the SDK type). Treat any other word as an unknown backend.' }
10669
10882
  # 🔴 openapi **3.1**:可空用 `type: [T, "null"]`,`nullable` 不是 3.1 关键字(会被静默忽略)。
10670
10883
  # `null` 也必须进 enum,否则真校验器把 file 引擎的常态答判非法。
10671
10884
  vectorMode: { type: ["string", "null"], enum: [native, portable, lexical, null] }
@@ -11315,10 +11528,19 @@ components:
11315
11528
  description: >-
11316
11529
  server >= 7.132.0 (an accepted key; core `McpServerSpec.startupTimeoutMs`): THIS server's startup bound in whole milliseconds — the handshake
11317
11530
  (connect + initialize) and the initial tool listing each carry it. One read order: this member, else the process-level `MCP_TIMEOUT`, else the MCP
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`).
11531
+ SDK's own 60 000 ms. Range 1 000 – 2 147 483 647. server >= 7.134.0: the value-shape judge is the engine's `mcpStartupTimeoutMs`, run at the INTAKE door — a bad value
11532
+ (a string, a fraction, 0, a negative, NaN, `null`, out of range) on a new submit or on `POST /v1/capabilities/mcp/probe` is `400 request.field_invalid` (the engine's reason sentence; the named path is
11533
+ `mcpServers[i].startupTimeoutMs`). server 7.132.0 – 7.133.x accepted it and the engine refused ONLY THIS server at its dial (`config.mcp_startup_timeout_invalid`; siblings mount) — never clamped, never read as the
11534
+ default. A durable resume replays a stored body without judging it. A <= 7.131.x server answers `400 request.body_shape` (named in `unknownKeys`).
11535
+ sessionMetaKey:
11536
+ type: string
11537
+ description: >-
11538
+ server >= 7.138.0 (an accepted key; core `McpServerSpec.sessionMetaKey`): a server that declares it receives THIS leg's own session id in `params._meta[<this key>]` of every `tools/call` and `resources/read` the engine
11539
+ sends it (stdio and Streamable HTTP alike) — so a connector can keep state per (principal, session). Absent = nothing is sent. A delegated child is another session (its calls carry its own id; the engine does not guess a root);
11540
+ a dial with no leg (the library entrance, the no-run probe) sends nothing. The deployment legs (central config / local `config.d`) carry the key from server >= 7.139.0 on (before that the config reader stripped it with an unknown-key warning); a bad one keeps that whole server from mounting. The one judge is the engine's `judgeSessionMetaKey`: a non-empty string of at most 128 characters in the MCP `_meta` key-name format that names no `_meta` member
11541
+ of anyone else's — not the SDK's own `progressToken`, not a key under the engine's `sema/` namespace, not under a prefix MCP reserves. A bad key is `400 request.field_invalid` naming `mcpServers[i].sessionMetaKey` (new submit and
11542
+ the probe door); server >= 7.139.0 the sentence does NOT echo the key you wrote (where it must refer to it, it reads `[redacted] (N characters)`; an over-long / empty / non-string key is refused by length or type without mentioning the key) — branch on the code and the named path. A server < 7.138.0 does not list the key among the accepted ones: by the entry-key law it answers
11543
+ `400 request.body_shape` naming it in `unknownKeys` (derived from that law, not measured on the old bytes).
11322
11544
 
11323
11545
  A2aServerSpec:
11324
11546
  type: object
@@ -14005,7 +14227,7 @@ components:
14005
14227
  description: 'server >= 7.100.0 (S-700): WHY the park row offers no rule — the same narrow read and closed set (four words from server >= 7.129.0) as the live card frame and `card_json`.'
14006
14228
  boundGrantAbsence:
14007
14229
  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`.'
14230
+ description: 'server >= 7.129.0 (core 7.51.0 #1688; park-row fact eight): why this parked card has no grant-binding digest — the park-row twin seat `PendingAction.tool_approval.boundGrantAbsence`, the same narrow read and the same name / value as the live frame and the inbox row. server >= 7.141.0: a tool-approval row carries EXACTLY ONE of `boundGrantDigest` / this key, the inbox row''s reading — a string digest => the digest; else no digest key and a word in the set => that word; else `unreadable` (a row parked before engine 7.51.0 that says neither, a word outside the set, a non-string digest even beside `not_bindable`). On <= 7.140.x those rows carried neither key on this face (the inbox face projected `unreadable`), and <= 7.128.x never carries this key — ABSENT is NOT `not_bindable`.'
14009
14231
  boundGrantDigest: { type: string, description: 'server >= 7.136.0 — a parked `Skill` card''s grant-binding digest; the same value as the inbox row''s and the live frame''s `boundGrantDigest` (one projection feeds this operator queue row, the `/v1/approvals/stream` `pending` frame and the inbox row — byte-equal for the same parked row). Present only on a skill card; absent on an ordinary card. `card_json` does not carry it. Server <= 7.135.x: not on this face.' }
14010
14232
  boundGrants:
14011
14233
  allOf: [{ $ref: '#/components/schemas/BoundSkillGrants' }]
@@ -14566,6 +14788,12 @@ components:
14566
14788
  lastRunId:
14567
14789
  type: ['string', 'null']
14568
14790
  description: The most recent run's id (null when the session has no run yet) — lets a picker deep-link.
14791
+ lastTaskRunId:
14792
+ type: string
14793
+ description: >-
14794
+ The most recent run's ENGINE run id (`TaskResult.runId`) when known — OMITTED when absent, never `null` (no run, the latest run
14795
+ is running — a resume claim clears it — or an older server). A different identity axis from `lastRunId` (the latest run's
14796
+ task id): re-attach a live tail with `lastRunId`, match engine-side records (trace / journal) with this key.
14569
14797
  title:
14570
14798
  type: ['string', 'null']
14571
14799
  description: >
@@ -14907,6 +15135,9 @@ components:
14907
15135
  version: { type: string }
14908
15136
  toolNames: { type: array, items: { type: string } }
14909
15137
  error: { type: string }
15138
+ authorization:
15139
+ allOf: [{ $ref: '#/components/schemas/McpAuthorization' }]
15140
+ description: 'server >= 7.138.0 (core 7.59.0) — PRESENT-IFF this server is unauthorized (this face carries no `errorCode`, so presence reads "the principal must authorize this server first"): only the closed word `reason`. Absent = not an authorization door, or an older server.'
14910
15141
 
14911
15142
  McpStatusPanel:
14912
15143
  type: object
@@ -15066,6 +15297,37 @@ components:
15066
15297
  THIS SESSION enter long-term memory) — do not read them together.
15067
15298
  The same fact is readable by an operator as `wiring_manifest.autoConsolidation` (present-iff armed);
15068
15299
  one fact, one source — the tenant face has only this key.
15300
+ memorySync:
15301
+ allOf: [{ $ref: '#/components/schemas/SessionMemorySync' }]
15302
+ description: >-
15303
+ server >= 7.141.0 — THIS DEPLOYMENT's memory-sync park reading (a deployment fact: present <=> the deployment has a sync leg;
15304
+ independent of the session and of `?scope=`). `parked: []` = syncing. ABSENT = no sync leg, or an older server.
15305
+
15306
+ SessionMemorySync:
15307
+ type: object
15308
+ description: 'server >= 7.141.0 — the `memorySync` segment of `GET /v1/sessions/{sessionId}/memory-status`. A response projection: declared key by key and left open.'
15309
+ additionalProperties: true
15310
+ required: [parked]
15311
+ properties:
15312
+ parked:
15313
+ type: array
15314
+ items: { $ref: '#/components/schemas/MemorySyncParkedLayer' }
15315
+ description: 'The parked layers (empty = syncing). A layer parks when the sync engine refuses its cursor on any axis (scope / peer / store) or the cursor cannot be read: zero requests, files untouched, every round parks again until the cursor is deleted.'
15316
+ MemorySyncParkedLayer:
15317
+ type: object
15318
+ description: 'server >= 7.141.0 — one parked memory-sync layer. The cursor file path never rides the wire (the operator line `memory_sync_layer_parked` carries it).'
15319
+ additionalProperties: true
15320
+ required: [scope, wayOut]
15321
+ properties:
15322
+ scope: { type: string, description: 'The parked layer''s scope, verbatim.' }
15323
+ wayOut:
15324
+ type: string
15325
+ description: >-
15326
+ The one way out for this layer. Known word today: `delete_cursor` — delete this layer''s cursor file; the next round re-converges
15327
+ from an empty baseline (pull what the center has, push what the local store has, push no deletions; entries changed on both sides
15328
+ are reported as conflicts) — a CONSERVATIVE merge: an entry deleted on one side since the last round comes back from the other.
15329
+ The service never writes, edits or deletes a cursor itself. Read OPEN: no enum — an unknown word means "way out unknown, do not
15330
+ act for the user".
15069
15331
 
15070
15332
  McpReconnectServerStatus:
15071
15333
  type: object
@@ -15087,6 +15349,9 @@ components:
15087
15349
  errorCode: { type: string, description: 'core `McpFailureKind`. Open set; switch with a default arm.' }
15088
15350
  httpStatus: { type: integer, description: 'Only alongside errorCode `http_status` (5xx = that end is down; from server >= 7.138.0 a 401, and a 403 with an `insufficient_scope` challenge, are errorCode `unauthorized` without this key). ABSENT rather than 0.' }
15089
15351
  delivered: { type: string, enum: [yes, no, unknown], description: 'Did the request reach that server — read together with errorCode.' }
15352
+ authorization:
15353
+ allOf: [{ $ref: '#/components/schemas/McpAuthorization' }]
15354
+ description: 'server >= 7.138.0 (core 7.59.0) — PRESENT-IFF `errorCode` is `unauthorized`: why the principal must authorize this server (only the closed word `reason`; the addresses never leave the server). Absent = not an authorization door, or an older server.'
15090
15355
  serverInfo:
15091
15356
  type: object
15092
15357
  properties:
@@ -16506,6 +16771,14 @@ components:
16506
16771
  type: array
16507
16772
  items: { $ref: '#/components/schemas/GateRecordAskClass' }
16508
16773
  description: 'Beside `mode`: the whole folded class set (archive read, see `GateRecordAskClass`).'
16774
+ extension:
16775
+ type: string
16776
+ minLength: 1
16777
+ description: >
16778
+ server >= 7.138.0 (core 7.59.0, engine invariant I12) — PRESENT-IFF `deniedBy` is `hook` AND the refusing handler's extension registration is known: the registration's name (through the
16779
+ registrant-text egress discipline). An extension's `tool.check` / `classic.PreToolUse` / `tool.call` answered deny, or it failed (threw, overran its budget, answered a shape the station cannot take — the engine fails
16780
+ the call closed). ABSENT beside every other layer word (an ancestor leg's screening reaches a descendant as a `policy` refusal, and a refusal an inherited installation's question settled is that question's), on the
16781
+ allowed arm, and beside a `hook` refusal that names no registration (the engine's own failed raise, a cancel). A display and audit fact: the call is refused whatever the name. Older servers: absent = unknowable.
16509
16782
 
16510
16783
  PermissionMode:
16511
16784
  type: string
@@ -16719,6 +16992,7 @@ components:
16719
16992
  delivered: { $ref: '#/components/schemas/WiringManifestMcpEntry/properties/delivered' }
16720
16993
  httpStatus: { $ref: '#/components/schemas/WiringManifestMcpEntry/properties/httpStatus' }
16721
16994
  liveness: { $ref: '#/components/schemas/WiringManifestMcpEntry/properties/liveness' }
16995
+ authorization: { $ref: '#/components/schemas/WiringManifestMcpEntry/properties/authorization' }
16722
16996
  toolNames: { type: array, items: { type: string }, maxItems: 200 }
16723
16997
  toolNamesTruncated: { type: boolean, enum: [true] }
16724
16998
  McpProbeFace:
@@ -16839,6 +17113,14 @@ components:
16839
17113
  allOf: [{ $ref: '#/components/schemas/ExtensionRequester' }]
16840
17114
  description: 'server >= 7.138.0: this call was initiated by an extension registration through `$.tool.call` (appears only when the deployment seat mounted operator-declared packages). Absent = model-initiated.'
16841
17115
  answeredBy: { type: string, description: 'server >= 7.138.0 (core 7.56.0): the registration that stood in for the tool body at the `tool.call` station with its own result or refusal (always beside `notExecuted: true`). Absent = no extension answered for the call.' }
17116
+ rewrite:
17117
+ allOf: [{ $ref: '#/components/schemas/ToolInputRewrite' }]
17118
+ description: >
17119
+ server >= 7.138.0 (core 7.58.0): the gate let the call go with arguments other than the ones it took — `input` is what it let the call go with (the engine's frozen plain-data projection, through the same redaction as `tool_start.args`,
17120
+ which stays the model's own), `by` who replaced them. PRESENT EXACTLY WHEN the gate's allow exit let the call go, no extension answered in place of the body, and the arguments it let go differ from those at its entry (both as the
17121
+ tool reads them — argument preparation and schema coercion are no rewrite). ABSENT: nobody changed them, or changed and changed back, or the call was refused / parked / answered in place before it was let go, or this is a resumed
17122
+ leg's frame. A refusal recorded AFTER the call was let go (the shell read admission, the loop's own refusal of the cleared arguments) leaves it beside that refusal. NEVER evidence that the body ran — read `isError` / `errorCode` /
17123
+ `notExecuted`. A malformed record (`by` not a non-empty list, a member outside the three forms, no `input`) is dropped whole by the server and the frame is still sent.
16842
17124
  # 🔴 census 轴一(2026-07-30)回填:`toolEndEventData`(trace/project.ts)真发 `label` 与
16843
17125
  # `structured`,spec 此前两者都漏 —— SDK 的 events.ts 早已声明,漂移只在 spec 这一侧。
16844
17126
  label: { type: string, description: 'core 展示名(同 tool_start.label)。' }
@@ -16847,8 +17129,14 @@ components:
16847
17129
  enum: [true]
16848
17130
  description: >
16849
17131
  server >= 7.126.0 (core 7.49.0, contract table B `notExecuted` row, passed through verbatim) — ABSENT IS NEVER "it ran": present, always the literal `true` (never `false`), when the engine has
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`.
17132
+ POSITIVE evidence the call was never executed. The classes that carry it, in the order the engine added them: the loop closed the call without running it (a sibling settled by a halted batch, a call a turn interrupt
17133
+ reached before it started, a reconcile-closed call that never started — 7.126.0); the gate refused the call and never released it (a person's refusal, the host's SLA sweep, a policy / `PreToolUse` hook / plan-mode deny, a
17134
+ post-approval veto before the run — engine 7.52.0); server >= 7.138.0 (engine 7.59.0) the gate RELEASED the call and the loop itself then refused it before the body started — the arguments the gate cleared failed the loop's
17135
+ own re-validation or re-reading (a rewrite the tool's input check refuses, a form the tool would read as other bytes), or the run was aborted in that gap: such a frame reads `gate.disposition.kind` `allowed` + `isError` (with an
17136
+ `errorCode` when the refusal carries one) + this mark — render it as "not executed", not "failed to execute" — and, when the gate replaced the arguments, `rewrite` beside them; and an extension answered for the call at `tool.call`
17137
+ in place of its body (`answeredBy` names it and is always beside this mark). NOT carried: a call refused before any gate saw it (an unknown tool, arguments the model's own call got wrong — nothing says the loop got that far);
17138
+ a call interrupted mid-execution or closed by the reconciliation on the next process start (telling the model "it did not run" there could invite a replay of a write that already took effect). Read it together with the
17139
+ paired `tool_start.recovered`.
16852
17140
  wireName:
16853
17141
  type: string
16854
17142
  description: >
@@ -17090,6 +17378,8 @@ components:
17090
17378
  errorStatus: { type: integer, description: "server >= 7.54.0 (core 7.1.0): the HTTP status of the attempt that just failed, present ONLY when that status names the failure (absent on a transport non-answer, a mid-stream tear, a local circuit-open verdict and the `recovered` / `gave_up` frames). Absent = no status named the failure — not 0; a 2xx never appears." }
17091
17379
  elapsedMs: { type: number, description: "server >= 7.58.0 (core 7.3.1): ONLY on the `waiting_first_token` phase — how long the current segment has waited so far (at emit, emitting process's clock). Absent = unknown, not 0. A waiting frame never carries `retryInMs` / `retryAtMs` (it OBSERVES a wait, it does not ANNOUNCE one) — do not merge the two families into one countdown." }
17092
17380
  timeoutMs: { type: number, description: "server >= 7.58.0 (core 7.3.1): present with `elapsedMs` on the same phase — the bound of the segment being waited on (core 7.33.0+: the first-byte window before the response head, the first-token watchdog after it; each segment counts from 0)." }
17381
+ waitSegment: { type: string, description: "server >= 7.138.0 (core 7.59.0 `BrainStatus.waitSegment`, passed through verbatim, minted only when a non-empty string): on EVERY `waiting_first_token` frame — WHICH segment is being waited on: `response_headers` (from the `fetch()` call to the response headers: connecting, sending the request body, whatever the gateway does before it starts answering — the engine cannot tell these apart) or `first_token` (response headers to the first content delta; a thinking delta counts). ABSENT on every other phase, and on servers <= 7.137.x (read as 'unknown which segment', never as 'response headers'). Closed in core (two words), read as an OPEN set (keep a default arm). Render it with `elapsedMs` / `timeoutMs`." }
17382
+ sleptMs: { type: number, description: "server >= 7.138.0 (core 7.59.0 `BrainStatus.sleptMs`): ONLY on a retry-wait frame (`phase: reconnecting`, `errClass: stall`) for an attempt the engine ended because the HOST WAS SUSPENDED across the wait (the machine slept / the process was stopped) — how long, in MILLISECONDS: the sum of the gaps longer than five seconds between the engine's once-a-second wall-clock readings, from the start of that wait (response headers, first token, or the silence between deltas); the attempt ends at the first reading where it exceeds half of the wait's window and is re-sent on a fresh connection. ABSENT on every other frame (a stall a deadline cut carries none); absent = no suspension evidence, not 0." }
17093
17383
  eventId: { type: string }
17094
17384
  parentToolCallId: { type: string }
17095
17385
  sourceTaskId: { type: string }
@@ -17922,6 +18212,16 @@ components:
17922
18212
  sessionId, runId }`: `capability` is `image` today; `status` is `declared_off` or `unknown` (engine words, the server echoes them — read OPEN; for images 7.56.0 only emits `declared_off`). Once per session per (model, capability). It replaces the server's
17923
18213
  own submit-time image pre-check (ops-log line `images_omitted_no_vision_model` and counter `images_omitted_total`, both retired in 7.137.0: the engine mints the fact at the moment it really replaces the image);
17924
18214
  a reasoning knob the model declares off is not reported here (that is `effectiveReasoning.dropped`).
18215
+ server 7.138.0 adds two codes to the user whitelist (appendix D.3 44 -> 46; both audience `user` in core's register), described here because their `detail` is not self-evident:
18216
+ `context.image_removed` (core 7.59.0) — the provider said an image in this turn's request could not be processed (the failed turn's `errorKind` is `image_unprocessable`), so the engine took the images out of the NEWEST message still
18217
+ carrying any (each replaced by a one-line note), re-sent the turn without them, and every later request of the session reads the same removal; the session transcript keeps the original images. The way out is another image format (admission
18218
+ separately refuses images whose header is incomplete for png / jpeg / gif / webp, and does not send this code). `{ images, sessionId, runId }` — `images` = how many were taken out of that message; no body text. Once per run per refusal.
18219
+ `mcp.authorization_required` (core 7.59.0) — an MCP server the user must authorize before it serves them: the leg's dial failed `unauthorized`, or a request was refused that way and that refusal is its answer (a repeat-safe call refused with 401
18220
+ and sent once more on a renewed credential announces only if that send is refused too). The leg does not park on it. `{ server, reason, authorizeUrl?, principal?, sessionId, runId }` — `reason` is `rejected` (401) / `scope` (403
18221
+ `insufficient_scope`) / `none` (the authorization seat holds no authorization for this user), the engine's closed set, echoed by the server (read OPEN); `authorizeUrl` only ever comes from the deployment's authorization seat (this deployment
18222
+ has none, so it is always absent and the sentence points at connector settings); `principal` is the run's principal when it has one. Once per leg per server (a resume is a new leg and may announce again). The same fact on the status faces is
18223
+ `errorCode: "unauthorized"` + `authorization`. NOT on the user whitelist, though core 7.59.0's register holds them: `model.role_defaulted` (a role seat names a model word the catalog does not hold, so the role reads as unset and the run goes on)
18224
+ and `route.credential_rebound` (the HOST moved a per-model credential's binding, outside any run) are audience `operator` — they never reach this stream.
17925
18225
  Value change: `permission.rule_row_dropped`'s `detail.rows[].rule` is, since core 7.53.0, the rule's original text (the same reading as
17926
18226
  `allowed_tool_not_granted`'s `entries[].entry`: at most 1 024 code points, longer cut to 1 024 + a truncation mark, CONTROL CHARACTERS RIDE AS DATA —
17927
18227
  neutralize at render); before it was the engine-neutralized single-line form (at most 201 code points). Same keys.
@@ -18468,6 +18768,26 @@ components:
18468
18768
  kind: { type: string, enum: [extension] }
18469
18769
  name: { type: string, minLength: 1, description: 'The registration name (registrant text, UNTRUSTED-for-display).' }
18470
18770
 
18771
+ RewriteAuthor:
18772
+ description: >
18773
+ Who replaced a tool call's arguments (one entry of `tool_end.rewrite.by`; core `RewriteAuthor`, server >= 7.138.0): an extension registration (`{ kind: extension, name }` — the SAME shape as `ExtensionRequester`),
18774
+ the restriction chain (`{ kind: policy }`) or an approver who answered with changes (`{ kind: approver }`; who it was is `gate.settlement.who`). Closed in core (three forms) — read with a default arm; the server drops a
18775
+ whole `rewrite` whose `by` carries any other form.
18776
+ oneOf:
18777
+ - { $ref: '#/components/schemas/ExtensionRequester' }
18778
+ - { type: object, additionalProperties: false, required: [kind], properties: { kind: { const: policy } } }
18779
+ - { type: object, additionalProperties: false, required: [kind], properties: { kind: { const: approver } } }
18780
+ ToolInputRewrite:
18781
+ type: object
18782
+ additionalProperties: false
18783
+ required: [by, input]
18784
+ description: >
18785
+ `tool_end.rewrite` (core `ToolInputRewrite`, server >= 7.138.0): the arguments the gate let a call go with when they are not the ones it took. `by` — NON-EMPTY, one entry per replacement that changed the arguments,
18786
+ in the order they were made (a judge that changed them twice is named twice). `input` — what the gate let the call go with (frozen plain-data projection; a member that is not plain data reads as a `[not recorded: …]` marker).
18787
+ properties:
18788
+ by: { type: array, minItems: 1, items: { $ref: '#/components/schemas/RewriteAuthor' } }
18789
+ input: {}
18790
+
18471
18791
  ToolApprovalFrame:
18472
18792
  type: object
18473
18793
  description: >
@@ -20675,6 +20995,16 @@ components:
20675
20995
  server >= 7.135.0 — the idempotency anchor of this workflow completion: the SAME id rides every notification path of one completion (this frame / `task_notification` / fleet `bg_notification` / inbox replay) and
20676
20996
  is the dedup key ACROSS paths (the same value domain as `task_notification.completionId`). ABSENT when the engine gave none (an orphan the service terminated itself) — dedup on `runId` as before. The read faces
20677
20997
  (`GET /v1/workflows/{id}` etc.) deliberately never carry it. Older servers' re-delivered frames have no such key.
20998
+ diagnostics:
20999
+ type: string
21000
+ maxLength: 4000
21001
+ description: >-
21002
+ server >= 7.141.0 — the diagnostic teaching text the engine minted for the same completion (up to 5 lines of unfinished-agent
21003
+ summaries, the full-record read-handle sentence, the journal coordinate, the resume sentence); the live `task_notification`
21004
+ (`task_type: "workflow"`) frame carries the same text under the same key, but on this path host paths and URLs were already
21005
+ masked for a human reader, so the two faces are not byte-equal. Minted only when non-empty; redacted before it leaves; at most
21006
+ 4000 code units (cut at the bound). UNTRUSTED-for-display. ABSENT = no diagnostic text for this one (crash-recovery
21007
+ re-delivery, an orphan the service terminated itself, an older server, an entry an older replica queued) — not a failure.
20678
21008
 
20679
21009
  # ── 🔴 #185a (2026-08-08): the DURABLE leg's three APPROVAL arms ────────────────────────────────
20680
21010
  # Shape rule for all three: `allOf: [<frame schema>, {the narrowed discriminant}]`. The keys are NOT
@@ -21769,6 +22099,54 @@ components:
21769
22099
  description: >
21770
22100
  Which lanes are live — core's closed three (`tool` / `diagnostics` / `tool_and_diagnostics`), read as
21771
22101
  open. ABSENT = neither lane is live (not "unknown").
22102
+ AgentRosterStatus:
22103
+ type: string
22104
+ enum: [running, parked, completed, failed, killed]
22105
+ description: 'A background agent''s state (core `BackgroundAgentRecord["status"]`; the `status` filter of `GET /v1/agents/roster` takes exactly these five words). The ROW''s `status` is read as an open set.'
22106
+ AgentRosterRow:
22107
+ type: object
22108
+ additionalProperties: false
22109
+ required: [handle, name, status, spawnedAt, updatedAt]
22110
+ description: >
22111
+ One row of `GET /v1/agents/roster` (core `BackgroundAgentRowSummary` projected through a keep/strip whitelist — a new core key must pass the server's disposition table before it can reach the wire). `handle` is the background
22112
+ agent's id (the durable agent row's `a…` key — the SAME string as the fleet row's `id` and the `remaining[]` items of a 409 `conflict.session_children_alive`). `name` is ALWAYS present: engine 7.57.0+ gives every background agent
22113
+ a name, an unnamed one the engine-derived `agent-<12 hex>`, and a row written before the upgrade reads as that same derived name. `anonymous` (server >= 7.138.0, additive) is present — always `true` — exactly when `name` IS the name the
22114
+ engine derived for this `handle` (nobody named it); a row that was named lacks the key (absence is the meaning, no `false` is minted). Its value is the engine's own answer (`chosenAgentName`): a reader need not know the derivation
22115
+ and must not recompute it; a caller who happened to name the agent with the derived string reads as anonymous too (the engine cannot tell). NOT carried: `owner`, any session id (not an addressing face), `usage`.
22116
+ properties:
22117
+ handle: { type: string }
22118
+ name: { type: string }
22119
+ anonymous: { type: boolean, enum: [true] }
22120
+ agentType: { type: string }
22121
+ status: { type: string, description: 'running | parked | completed | failed | killed (core `BackgroundAgentRecord["status"]`; read as an open set).' }
22122
+ spawnedAt: { type: number, description: 'epoch ms' }
22123
+ updatedAt: { type: number, description: 'epoch ms' }
22124
+ settledAt: { type: number, description: 'epoch ms; absent until the agent settles.' }
22125
+ AgentRosterPage:
22126
+ type: object
22127
+ additionalProperties: false
22128
+ required: [agents, total]
22129
+ description: >
22130
+ The 200 body of `GET /v1/agents/roster`. `total` is the OWNER-scoped row count of the roster window (a row of another tenant is in neither the page nor this number — a count that differed would be an existence oracle);
22131
+ `truncated: true` says the tenant has more rows than the 500-row window, so `total` is the window, not the whole. `nextBefore` (present = another page exists) is the opaque cursor to send back as `before`.
22132
+ properties:
22133
+ agents: { type: array, items: { $ref: '#/components/schemas/AgentRosterRow' } }
22134
+ total: { type: integer, minimum: 0 }
22135
+ nextBefore: { type: string }
22136
+ truncated: { type: boolean, enum: [true] }
22137
+ McpAuthorization:
22138
+ type: object
22139
+ additionalProperties: false
22140
+ required: [reason]
22141
+ description: >
22142
+ server >= 7.138.0 (core 7.59.0 `McpAuthorization`) — an MCP server the principal must authorize first. Rides WITH `errorCode: "unauthorized"` on three faces: the `wiring_manifest.mcp[]` row, the reconnect receipt's `status`
22143
+ and the `GET /v1/sessions/{sessionId}/mcp` panel's `servers[]` (the panel row carries no `errorCode`, so presence there reads "this server is unauthorized"). ONLY the closed word `reason` leaves the server: the engine record's two
22144
+ addresses (`authorizeUrl` — only ever from the deployment's authorization seat, which this deployment does not have — and `resourceMetadataUrl`, which the remote self-reports in its challenge header and is untrusted) never go on the wire.
22145
+ A record whose word is outside the set, or that is not an object, is absent as a whole (the weakest claim, no minted word). The user-facing "go authorize" is the session notice `mcp.authorization_required`.
22146
+ properties:
22147
+ reason:
22148
+ type: string
22149
+ description: '`rejected` (the endpoint answered 401 and the authorization seat''s re-ask gave no credential that passes) | `scope` (403 with an `insufficient_scope` challenge) | `none` (the authorization seat answered "not authorized"). Core''s closed `MCP_AUTHORIZATION_REASONS`, read as an OPEN set (keep a default arm).'
21772
22150
  WiringManifestMcpEntry:
21773
22151
  # 8.9.0:从 `Event_wiring_manifest.mcp.items` 的内联形**提取**为具名 schema —— 同一份行形现在被
21774
22152
  # 两处引用(live 帧与 `WiringManifest` 的静态/两半形),内联会立刻变成两份会各自漂的镜像。
@@ -21821,6 +22199,9 @@ components:
21821
22199
  is the engine's STRONGER claim (it looked and the answer does not decide reach). Do not infer "was it
21822
22200
  dialed" from absence. Declared here as of sdk 11.2.0 — the key had been on the wire since server 7.91.2
21823
22201
  while this row schema stayed closed, so a strict consumer was rejecting a LEGITIMATE response.
22202
+ authorization:
22203
+ allOf: [{ $ref: '#/components/schemas/McpAuthorization' }]
22204
+ description: 'server >= 7.138.0 (core 7.59.0) — PRESENT-IFF `errorCode` is `unauthorized`: why the principal must authorize this server (only the closed word `reason`; the addresses never leave the server). Absent = not an authorization door, or an older server.'
21824
22205
 
21825
22206
  ServerWiringGates:
21826
22207
  type: object
@@ -22186,6 +22567,19 @@ components:
22186
22567
  description: 'Tool DEFINITIONS (so the model can emit toolCalls data) — the server NEVER executes them.'
22187
22568
  maxOutputTokens: { type: integer }
22188
22569
 
22570
+ SideQueryAccountRow:
22571
+ type: object
22572
+ additionalProperties: false
22573
+ required: [origin, tokens]
22574
+ description: >-
22575
+ server >= 7.138.0 (engine 7.59.0, core `AccountRow` with `origin: side_query`): this side query's line in the session's account, priced by the engine from the deployment's price table and passed through verbatim
22576
+ (`usage.cost` stays the provider's own figure). `origin` is always `side_query` here. `costMicroUsd` is whole micro-USD and ABSENT as soon as any spend was unpriced (unknown, not 0); `usageMissing: true` marks a figure that is
22577
+ a lower bound because the reply reported no usage (`tokens: 0` then). The session total is the engine's `foldAccount` (run lines + side_query lines), folded by whoever holds the lines — this server mints no session total.
22578
+ properties:
22579
+ origin: { const: side_query }
22580
+ tokens: { type: integer, minimum: 0 }
22581
+ costMicroUsd: { type: integer, minimum: 0 }
22582
+ usageMissing: { type: boolean, enum: [true] }
22189
22583
  SideQueryResult:
22190
22584
  type: object
22191
22585
  description: >
@@ -22235,8 +22629,11 @@ components:
22235
22629
  `http` / `stream_torn` / `refusal` / `length_empty`). ABSENT on success and on older servers.
22236
22630
  errorKind:
22237
22631
  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.'
22632
+ enum: [input_too_long, degenerate, length_empty, image_unprocessable]
22633
+ description: 'server >= 7.135.0 (failure only): the STRUCTURAL failure kind the reply carried, forwarded as is — `input_too_long` (the provider refused the request as over its window), `degenerate`, `length_empty`; server >= 7.138.0 (engine 7.59.0) also `image_unprocessable` (the provider could not process an image in the request). Absent when the reply carried none. Closed (the engine''s four words): adding a word is an output-type widening.'
22634
+ account:
22635
+ allOf: [{ $ref: '#/components/schemas/SideQueryAccountRow' }]
22636
+ description: 'server >= 7.138.0 (engine 7.59.0; always present on newer servers, absent on older ones): this side query''s line in the session''s account — see `SideQueryAccountRow`. This server mints no session total.'
22240
22637
  inputTooLongRuledOut:
22241
22638
  type: boolean
22242
22639
  enum: [true]