@sema-agent/sdk 29.0.0 → 30.1.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 (42) hide show
  1. package/README.md +121 -2
  2. package/dist/client.d.ts +2 -2
  3. package/dist/client.js +2 -2
  4. package/dist/errors.d.ts +89 -10
  5. package/dist/errors.d.ts.map +1 -1
  6. package/dist/errors.js +43 -9
  7. package/dist/errors.js.map +1 -1
  8. package/dist/events.d.ts +14 -1
  9. package/dist/events.d.ts.map +1 -1
  10. package/dist/events.js.map +1 -1
  11. package/dist/index.d.ts +9 -3
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +1 -1
  14. package/dist/index.js.map +1 -1
  15. package/dist/resources/devices.d.ts +16 -21
  16. package/dist/resources/devices.d.ts.map +1 -1
  17. package/dist/resources/devices.js +2 -15
  18. package/dist/resources/devices.js.map +1 -1
  19. package/dist/resources/memory.d.ts +25 -10
  20. package/dist/resources/memory.d.ts.map +1 -1
  21. package/dist/resources/memory.js +26 -5
  22. package/dist/resources/memory.js.map +1 -1
  23. package/dist/resources/rules.d.ts +5 -13
  24. package/dist/resources/rules.d.ts.map +1 -1
  25. package/dist/resources/rules.js.map +1 -1
  26. package/dist/resources/session-sync.d.ts +9 -0
  27. package/dist/resources/session-sync.d.ts.map +1 -1
  28. package/dist/resources/session-sync.js +9 -0
  29. package/dist/resources/session-sync.js.map +1 -1
  30. package/dist/resources/sessions.d.ts +121 -18
  31. package/dist/resources/sessions.d.ts.map +1 -1
  32. package/dist/resources/sessions.js +78 -10
  33. package/dist/resources/sessions.js.map +1 -1
  34. package/dist/resources/side-query.d.ts +5 -1
  35. package/dist/resources/side-query.d.ts.map +1 -1
  36. package/dist/resources/side-query.js +5 -1
  37. package/dist/resources/side-query.js.map +1 -1
  38. package/dist/types.d.ts +113 -48
  39. package/dist/types.d.ts.map +1 -1
  40. package/dist/types.js.map +1 -1
  41. package/openapi.yaml +392 -110
  42. package/package.json +2 -2
package/openapi.yaml CHANGED
@@ -474,7 +474,11 @@ paths:
474
474
  '409':
475
475
  description: >-
476
476
  Conflict (ConflictError). 409 — session already has an active run (`conflict.session_active_run`, `activeTaskId`,
477
- `pendingGate`), OR an idempotency/session-CAS conflict. ⚠️ The SDK surfaces it as a TYPED ConflictError and does
477
+ `pendingGate`), OR an idempotency/session-CAS conflict. Server >= 7.140.0, zero-work submissions only: `config.read_deny_floor_unkept` — the
478
+ deployment sets `READ_DENY_FLOOR_REQUIRED=true` and this run's read-deny table has rows while its execution environment does not keep the byte floor (all
479
+ seven lanes today): refused at prepare, no command started, zero tokens. NOT a request error — the deployment state conflicts with it (use an execution
480
+ environment that keeps the floor, or the operator drops the knob; then the run proceeds and each run raises one operator notice with the same code, off the
481
+ user stream). Only reachable when the operator set the knob; a retry does not change the verdict. ⚠️ The SDK surfaces it as a TYPED ConflictError and does
478
482
  NOT silently resolve it to that run: `activeTaskId` may be the caller's own first attempt OR an unrelated
479
483
  concurrent run on the same session — 409 alone cannot tell (same text as the `Conflict` response component).
480
484
  K-24 (server >= 7.104.0 / S-724, zero-work submissions only): `rewind.store_unconfigured` — this
@@ -647,6 +651,8 @@ paths:
647
651
  description: >
648
652
  Async; runs in the background. Requires a TiDB run store (absent → 501). Auto `Idempotency-Key`.
649
653
  Poll `GET /v1/runs/:id` or stream `GET /v1/runs/:id/events`. A client disconnect does NOT stop the run.
654
+ 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).
650
656
  parameters:
651
657
  - $ref: '#/components/parameters/IdempotencyKey'
652
658
  requestBody:
@@ -1881,6 +1887,11 @@ paths:
1881
1887
  the row can write it, never wider; an operator / service token gets no extra reach; a stranger and "no such session" answer byte-identical
1882
1888
  `404 not_found.session`, no existence oracle) -> body (400) -> the store's one write door -> read back and answer with the list row.
1883
1889
  Only rows on the LIST face are writable: a placed (delegation-transcript) session is not in the list, so a PATCH on it answers 404.
1890
+ server >= 7.139.0 (contract section 20, "conditional write"): the body may carry `expectedRowTag` (the `rowTag` of the list row you read) — "write only if the row is still that one", judged and written under one row lock.
1891
+ Still that row ⇒ `200`, the row carrying the tag AFTER the write (the tag is a function of the writable bits' VALUES and of the session itself, NOT a write counter: it changes when a value actually changed; writing the value the row already holds — `pinned: false` on an unpinned row — returns the SAME tag); no longer ⇒ `409 conflict.session_row_changed`, NOT ONE BYTE written, body `currentRow` = the row as it stands now (the same projection as the 200 row, with the new `rowTag`) —
1892
+ decide again, then send ITS `rowTag`; never resend verbatim. EVERY miss is a 409 (no "the row already holds the value you want" exemption: `currentRow` already equal to what you wanted ⇒ treat it as synced). A session that is a
1893
+ read-only MIRROR here (execution placement `mirror`) ⇒ `409 conflict.session_mirror` with `forkPath` — with or without `expectedRowTag` (an unconditional PATCH on a mirror used to write). A session whose owner changed after the
1894
+ ownership gate read ⇒ `404 not_found.session`, nothing written. A client that auto-replays pending writes MUST send `expectedRowTag`.
1884
1895
  requestBody:
1885
1896
  required: true
1886
1897
  content:
@@ -1896,13 +1907,23 @@ paths:
1896
1907
  description: >-
1897
1908
  Malformed body, told apart by `errorCode` (branch on the code, never the sentence). `request.body_shape` — not a JSON object / empty body /
1898
1909
  a key outside the closed set `{ title, pinned }` / `title: ""` (the only spelling of "clear" is `null`). `request.field_invalid` — `title`
1899
- neither a string nor `null`, longer than 120 characters, or with leading / trailing whitespace; `pinned` not a boolean. Invalid JSON answers
1910
+ neither a string nor `null`, longer than 120 characters, or with leading / trailing whitespace; `pinned` not a boolean; (server >= 7.139.0) `expectedRowTag` not a 43-character `[A-Za-z0-9_-]` string.
1911
+ Server >= 7.139.0: `expectedRowTag` ALONE (no `title` / `pinned`) is `request.body_shape` too; a server <= 7.138.x answers `request.body_shape` for the key itself — fail-closed, do not drop it and resend. Invalid JSON answers
1900
1912
  like every other JSON-body route (`request.invalid_json`). The row is untouched on any 400.
1901
1913
  content:
1902
1914
  application/json:
1903
1915
  schema: { $ref: '#/components/schemas/ErrorResponse' }
1904
1916
  '401': { $ref: '#/components/responses/Unauthorized' }
1905
1917
  '404': { $ref: '#/components/responses/NotFound' }
1918
+ '409':
1919
+ description: >-
1920
+ server >= 7.139.0, told apart by `errorCode` (both `ConflictError`, `activeTaskId` absent): `conflict.session_row_changed` — the body carried `expectedRowTag` and the row is no longer that one; NOTHING was written;
1921
+ top-level `currentRow` = the list row as it stands now (same projection as the 200 row, with the new `rowTag`) — treat it as synced if its writable bits already equal what you wanted, else decide again and send ITS `rowTag`
1922
+ (never resend verbatim). `conflict.session_mirror` — this session is a read-only MIRROR of a session whose writer is elsewhere (execution placement `mirror`), it cannot be renamed or pinned here, with or without
1923
+ `expectedRowTag`; top-level `forkPath` (`/v1/sessions/{id}/fork`): fork it to continue here; nothing was written.
1924
+ content:
1925
+ application/json:
1926
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
1906
1927
  '501': { $ref: '#/components/responses/NotImplemented' }
1907
1928
  delete:
1908
1929
  tags: [sessions]
@@ -1977,21 +1998,38 @@ paths:
1977
1998
  regenerate-from-here). Owner-scoped (non-owner → 404; the fork is owned by the caller). 400 `request.id_invalid` on an id that is not
1978
1999
  a canonical uuid — ANY uuid version passes since server >= 7.125.0 (the ONE shape gate shared with sync / policy / delete; <= 7.124.x accepted only
1979
2000
  uuidv7 here, so a shell-preset v4 id was creatable and syncable but not forkable). 501 without a durable session store.
2001
+ server >= 7.139.0 (contract section 23.4): the OPTIONAL body `{ forkId, forkNonce }` makes the fork keyed and RETRYABLE (together or not at all) — first `200 { sessionId }` (= `forkId`), a same-key retry
2002
+ `200 { sessionId, replayed: true }`; `forkId` already another session of yours ⇒ `409 conflict.fork_id_taken` (final: pick new keys); someone else's session ⇒ `404 not_found.session`; two collisions with another writer
2003
+ on the same target ⇒ `503 state.fork_target_unsettled` (`permanence: "transient"`, retry the same keys). Reconcile with `GET /v1/sessions/{forkId}/execution-placement` (`absent` / `writer` ⇒ forked; `forking` ⇒ a
2004
+ `DB_BACKEND=local` copy did not finish, retry the same keys; 404 ⇒ not forked). A fork's new session is `absent` and first executes on the CURRENT lane. The route now PARSES the body (it ignored it up to 7.138.x).
2005
+ requestBody:
2006
+ required: false
2007
+ content:
2008
+ application/json:
2009
+ schema: { $ref: '#/components/schemas/SessionForkBody' }
1980
2010
  responses:
1981
2011
  '200':
1982
- description: The new branched session id.
2012
+ description: 'The new branched session id (`replayed: true` on a same-key retry of a keyed fork, server >= 7.139.0).'
1983
2013
  content:
1984
2014
  application/json:
1985
- schema:
1986
- type: object
1987
- # 封闭:铸造点 `routes/sessions.ts` 是单键字面量 `{ sessionId: newId }`。
1988
- additionalProperties: false
1989
- required: [sessionId]
1990
- properties:
1991
- sessionId: { type: string }
2015
+ schema: { $ref: '#/components/schemas/SessionForkResult' }
1992
2016
  '400': { $ref: '#/components/responses/BadRequest' }
1993
2017
  '401': { $ref: '#/components/responses/Unauthorized' }
1994
2018
  '404': { $ref: '#/components/responses/NotFound' }
2019
+ '409':
2020
+ description: >-
2021
+ `conflict.fork_id_taken` (server >= 7.139.0, keyed fork): `forkId` already names ANOTHER session of yours (a different fork, or a session this fork request did not create); nothing was forked; top-level `forkId`.
2022
+ FINAL — pick a new `forkId` and `forkNonce`. (Someone else's session answers `404 not_found.session`, byte-identical to an unknown source.)
2023
+ content:
2024
+ application/json:
2025
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
2026
+ '503':
2027
+ description: >-
2028
+ `state.fork_target_unsettled` (server >= 7.139.0, keyed fork): two attempts both collided with another writer on the same target id and neither could read the target back — the server does not guess; body
2029
+ `permanence: "transient"`. Retry the SAME `forkId` / `forkNonce` verbatim. (`ServiceStateError`; the SDK does not retry a fork for you.)
2030
+ content:
2031
+ application/json:
2032
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
1995
2033
  '500':
1996
2034
  description: >-
1997
2035
  server >= 7.137.0: `invalid_session` — this route has no error mapping of its own; a session error it raises reaches the server's top-level catch, which maps it through the shared table: an `invalid_session` error
@@ -2002,6 +2040,84 @@ paths:
2002
2040
  schema: { $ref: '#/components/schemas/ErrorResponse' }
2003
2041
  '501': { $ref: '#/components/responses/NotImplemented' }
2004
2042
 
2043
+ /v1/sessions/{sessionId}/execution-placement:
2044
+ parameters:
2045
+ - $ref: '#/components/parameters/PrincipalHeader'
2046
+ - in: path
2047
+ name: sessionId
2048
+ required: true
2049
+ schema: { type: string }
2050
+ get:
2051
+ tags: [sessions]
2052
+ operationId: sessionsExecutionPlacement
2053
+ x-status: live # server >= 7.139.0 (contract section 23.1); no capability bit (an older server answers route-level 404 `not_found.route`).
2054
+ summary: Read one root session's execution placement on this deployment (absent / writer / mirror / forking).
2055
+ description: >
2056
+ server >= 7.139.0 (contract section 23.1) — the execution placement of one ROOT session's current occupant on THIS deployment (see `ExecutionPlacement`). Its documented uses: the SOURCE of the rebind verb's `expectedRev`
2057
+ (`device.rev` on the `writer` arm — it replaces the retired `GET /v1/devices/sessions/{rootSessionId}`), "is this deployment the writer?" before a session-sync push (`writer` ⇒ do not push, pull or fork instead), and reconciling a keyed fork.
2058
+ Visibility = the session's owner OR an explicit operator (an operator reads any session); a stranger and an unknown session answer the SAME `404 not_found.session` (anti-enumeration); a delegated child's partition row is not a root
2059
+ session (404). A malformed percent-encoded id segment ⇒ `400 request.path_malformed`. A session store without the execution seat (the engine's in-memory default) ⇒ `501 capability.session_store_required` — such a deployment does
2060
+ not record placement, and answering `absent` would say "not placed yet" for "not recorded". Inside the no-credential write gate (this GET too): no service credential and `ALLOW_UNAUTHED_WRITES` off ⇒ `503 auth.service_token_required`.
2061
+ A read, not a lock: the placement can change right after (a concurrent first execution / import).
2062
+ responses:
2063
+ '200':
2064
+ description: The placement.
2065
+ content:
2066
+ application/json:
2067
+ schema: { $ref: '#/components/schemas/ExecutionPlacement' }
2068
+ '400': { $ref: '#/components/responses/BadRequest' }
2069
+ '401': { $ref: '#/components/responses/Unauthorized' }
2070
+ '404': { $ref: '#/components/responses/NotFound' }
2071
+ '501': { $ref: '#/components/responses/NotImplemented' }
2072
+ '503':
2073
+ description: '`auth.service_token_required` — the no-credential write gate (no service credential configured and `ALLOW_UNAUTHED_WRITES` off).'
2074
+ content:
2075
+ application/json:
2076
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
2077
+
2078
+ /v1/sessions/{sessionId}/children/retire:
2079
+ parameters:
2080
+ - $ref: '#/components/parameters/PrincipalHeader'
2081
+ - in: path
2082
+ name: sessionId
2083
+ required: true
2084
+ schema: { type: string }
2085
+ post:
2086
+ tags: [sessions]
2087
+ operationId: sessionsChildrenRetire
2088
+ x-status: live # server >= 7.139.0 (contract section 23.5); no capability bit (an older server answers route-level 404 `not_found.route`).
2089
+ summary: Retire every background child rooted at this session (no body).
2090
+ description: >
2091
+ server >= 7.139.0 (contract section 23.5) — the SAME coordinator as the retirement `DELETE /v1/sessions/{sessionId}` runs first: running children are stopped, parked ones have their card voided and are driven to a terminal
2092
+ state, then the roster is re-enumerated until none is live. Use it BEFORE a rebind or a session-sync push: `409 device.rebind_active_run` / `409 session_active` bodies of the shape `{ children, retirePath }` name this
2093
+ path as `retirePath`. `POST /v1/sessions/{sessionId}/background/stop` keeps its meaning (stops running background agents / workflows and reaps shells; parked children and their pending cards stay) — "stop everything" = the stop verb
2094
+ plus this one. Auth, rate limit and the no-credential write gate are the stop verb's (session owner OR explicit operator; a stranger and an unknown session answer the same `404 not_found.session`; no session-ownership face ⇒
2095
+ `501 capability.session_ownership_required`). It does NOT judge the root run: a live root run may spawn children again after the retirement — that shape is caught by the claim read inside the rebind / push write transaction.
2096
+ Children dispatched after the observation, and children registered under another principal than the session owner, are invisible to the observation and absent from the receipt.
2097
+ responses:
2098
+ '200':
2099
+ description: The children that were observed and are now retired (an empty array when there were none).
2100
+ content:
2101
+ application/json:
2102
+ schema: { $ref: '#/components/schemas/SessionChildrenRetireResult' }
2103
+ '401': { $ref: '#/components/responses/Unauthorized' }
2104
+ '404': { $ref: '#/components/responses/NotFound' }
2105
+ '409':
2106
+ description: >-
2107
+ `conflict.session_children_alive`: some children cannot be ended from THIS replica (running on another replica, or parked on approval with no durable approval store here); NOTHING was moved; top-level `remaining` = their
2108
+ ids (the same strings as `GET /v1/agents/roster`) — same code, same projection as the delete gate. Wait for them or stop them where they run, then retry verbatim. A retirement that cannot finish stopping answers the
2109
+ delete gate's failure shape (500; an idempotent retry converges).
2110
+ content:
2111
+ application/json:
2112
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
2113
+ '429': { $ref: '#/components/responses/RateLimited' }
2114
+ '501': { $ref: '#/components/responses/NotImplemented' }
2115
+ '503':
2116
+ description: '`auth.service_token_required` — the no-credential write gate (no service credential configured and `ALLOW_UNAUTHED_WRITES` off).'
2117
+ content:
2118
+ application/json:
2119
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
2120
+
2005
2121
  /v1/sessions/{sessionId}/head:
2006
2122
  parameters:
2007
2123
  - $ref: '#/components/parameters/PrincipalHeader'
@@ -2791,6 +2907,19 @@ paths:
2791
2907
  Cross-incarnation caveat (server-side, cannot be fixed at this layer): the capture record and the
2792
2908
  lineage ledger are keyed by the BARE sessionId and outlive the session, so a re-claimed id reads the
2793
2909
  PREVIOUS incarnation's counts/opt-out (metadata only, no content bytes).
2910
+
2911
+ 🔴 TWO STORES, ONE ANSWER (server >= 7.140.0; contract §9 head): a session can span two memory stores (file backend: the typed personal layers live
2912
+ in a second store under the personal mount). Without `scope` the server reads EVERY store of this deployment (at most two) and folds the answers key by
2913
+ key, never minting a stand-in value: `committedCount` / `foldedCount` are summed, and ABSENT if any store's ledger could not be read (not 0);
2914
+ `lastCaptureAt` is the maximum over the stores that answer it, absent when `committedCount` is absent (`foldedCount` absent on its own does not suppress it) or when no store answers it (no contribution anywhere); `captureOptedOut` is `true` as soon as ANY store holds a
2915
+ capture record (with `optOutSource: "record"`), `false` only when every store answers `false`, and otherwise (a store's record unreadable) absent with
2916
+ `optOutSource: "fault"`. One store ⇒ exactly that store's answer (single-store deployments answer byte-for-byte as 7.139.x). The optional query `scope=<layer key>`
2917
+ answers only the store that layer lives in. The fold is a TRANSITIONAL form (deleted when the engine serves a deployment-wide status); the cache is keyed
2918
+ by (session, store control plane). Without `scope` this verb never answers `request.memory_layer` form (3); an unreadable `scope` (or an unreadable
2919
+ deployment layer) ⇒ 400 `request.memory_layer` with a FIXED sentence for the session owner; `scope` present but not a non-empty string ⇒ 400
2920
+ `request.field_invalid`. 7.139.x and earlier read the deployment's store only (the personal half read as 0).
2921
+ parameters:
2922
+ - $ref: '#/components/parameters/MemoryLayerSeatQuery'
2794
2923
  responses:
2795
2924
  '200':
2796
2925
  description: >-
@@ -2837,15 +2966,25 @@ paths:
2837
2966
  there is no operator override arm), and the attestation's `select` echoes exactly that. The body is
2838
2967
  `SessionMemoryEraseRequest` handed through as sent: no `select` (a body carrying one is a loud 400
2839
2968
  `request.body_shape`, never silently ignored — while any OTHER unknown key IS silently ignored and not forwarded),
2840
- `allowUnevidenced` NEVER INJECTED (the degraded lane is a human authorization statement).
2969
+ `allowUnevidenced` NEVER INJECTED (the degraded lane is a human authorization statement). The one added key is the optional layer seat `scope`
2970
+ (server >= 7.140.0).
2841
2971
 
2842
2972
  🔴 `requestId` IS THIS ERASURE'S IDEMPOTENCY IDENTITY — the same two-lane law as the operator face (read
2843
2973
  `evidenceCapability`): `"journal"` ⇒ a resend with the SAME id reads back the anchor's pinned ids and never re-resolves
2844
2974
  (retry after a lost ack, or after the operator removed the link behind a 409 `memory.target_outside_store`, with the SAME
2845
2975
  id); `"none"` ⇒ same id = a NEW request (a second real delete). The only memory backend that mounts this face today (file:
2846
2976
  owns the engine control plane and the evidence face) takes the journal lane. Mint a NEW id per erase action per session:
2847
- reusing an id on ANOTHER session is a different selector, which core refuses (`memory.erasure_selector_mismatch`) — and
2848
- THIS face does not classify that refusal (see 500). 🔴 DO NOT put an automatic retry policy on this endpoint.
2977
+ reusing an id on ANOTHER session is a different selector, which core refuses (409 `memory.erasure_selector_mismatch`; since
2978
+ server 7.108.0 this face classifies it like the operator face does — <= 7.107.x answered 500 `internal.error`). 🔴 DO NOT put an
2979
+ automatic retry policy on this endpoint.
2980
+
2981
+ 🔴 ERASURE EXECUTES ONLY ON THE DEPLOYMENT'S STORE (server >= 7.140.0, a transitional guard — the engine has no deployment-wide erasure request identity yet).
2982
+ Without `scope`: the by-session erasure runs on the deployment's store, and if this session has contributions in the OTHER store (the personal mount) or that
2983
+ store's ledger cannot be read ⇒ 409 `memory.erasure_store_unjudged` — NOTHING erased (7.139.x answered 200 and erased the deployment-store half). With `scope`
2984
+ naming a layer that lives in the deployment's store (e.g. `local`) ⇒ it runs there, 200, the attestation covers the deployment's store only (the layer seat does
2985
+ not reach the engine or the attestation) and the other store's half is neither judged nor mentioned; `scope` naming a layer on the personal mount ⇒ 409
2986
+ `memory.erasure_store_unjudged`. The audience is the session owner, so every refusal on this face is a FIXED sentence (layer keys and paths never ride the wire;
2987
+ the engine's sentence goes to the operator log). 400 `request.memory_layer` here means the `scope` (or this deployment's configured layer) cannot be read.
2849
2988
 
2850
2989
  GATE ORDER (release bytes): 503 destructive-session-write guard → 401 → 501 (no owner audit face — BEFORE the 404: a
2851
2990
  deployment without one must not fake a 404) → 404 (unknown AND non-owner, SAME code SAME message) → 501 (compliance face
@@ -2869,7 +3008,9 @@ paths:
2869
3008
  path; the operator face takes explicit selectors). "request.request_id_required" — `requestId` missing / empty /
2870
3009
  non-string. "request.field_invalid" — `allowUnevidenced` present but not a boolean. "request.path_malformed" — the
2871
3010
  session id segment is not valid percent-encoding. "config.memory_erasure_request" — core's own selector verdict (the
2872
- route keeps the arm; today the server's own gates answer first, so it is not reached).
3011
+ route keeps the arm; today the server's own gates answer first, so it is not reached). Server >= 7.140.0: "request.memory_layer" — the
3012
+ `scope` (or this deployment's configured layer) cannot be read (a FIXED sentence for the session owner); "request.field_invalid" also
3013
+ covers a `scope` that is present but not a non-empty string.
2873
3014
  content:
2874
3015
  application/json:
2875
3016
  schema: { $ref: '#/components/schemas/ErrorResponse' }
@@ -2880,18 +3021,22 @@ paths:
2880
3021
  errorCode "memory.target_outside_store" — a directory in this deployment's memory store leads outside it (a link). FIXED
2881
3022
  text on this face (the host path is not echoed; core's sentence goes to the operator log `session_memory_erase_refused`).
2882
3023
  A refusal before the commit point changed nothing; one after it keeps the deletions already made plus a journal. Ask
2883
- the operator to remove the link, then resend with the SAME `requestId`.
3024
+ the operator to remove the link, then resend with the SAME `requestId`. Since server 7.108.0 the other classified refusals of the
3025
+ operator face arrive here too, each with its own code and a FIXED sentence: "memory.erasure_selector_mismatch" /
3026
+ "memory.erasure_evidence_unavailable" / "memory.erasure_census_incomplete"; "memory.scope_home_not_directory" (server >= 7.118.0, same
3027
+ reading as the link code). Server >= 7.140.0: "memory.erasure_store_unjudged" — the erasure lands on the memory store other than the
3028
+ deployment's (a `scope` naming a personal-mount layer, or no `scope` and this session has contributions there / that store's ledger cannot be
3029
+ read): NOTHING erased; a transitional guard, do NOT retry.
2884
3030
  content:
2885
3031
  application/json:
2886
3032
  schema: { $ref: '#/components/schemas/ErrorResponse' }
2887
3033
  '500':
2888
3034
  description: >
2889
- errorCode "internal.error" ("session memory erasure failed") — anything else the engine threw. ⚠️ UNLIKE the operator
2890
- face, this face does NOT forward core's coded refusals: 409 `memory.erasure_selector_mismatch` /
2891
- `memory.erasure_evidence_unavailable` / `memory.erasure_census_incomplete` and the two-meaninged 500
2892
- `internal.memory_control_plane_corrupt` all land HERE — including "deletions COMMITTED, only the residue enumeration
2893
- failed". Never read this 500 as "nothing was deleted": resend with the SAME `requestId` (the journal lane replays and
2894
- converges).
3035
+ errorCode "internal.error" ("session memory erasure failed") — anything the classified map does not cover. Since server 7.108.0 this face
3036
+ shares the operator face's classified map (codes and statuses identical, only the audience wording differs), so core's coded refusals arrive under their
3037
+ own codes. The two-meaninged 500 `internal.memory_control_plane_corrupt` is also classified here (a fixed sentence): either nothing changed, or the deletions
3038
+ were COMMITTED and only the residue enumeration failed — never read a 500 as "nothing was deleted": resend with the SAME `requestId` (the journal lane
3039
+ replays and converges).
2895
3040
  content:
2896
3041
  application/json:
2897
3042
  schema: { $ref: '#/components/schemas/ErrorResponse' }
@@ -5330,6 +5475,7 @@ paths:
5330
5475
  `org:*`/`userproj:*` keys are operator-only until the S3 registry; repo-backed `proj:*` keys never
5331
5476
  live in this DB (git is their authority — an owner asking gets an honestly empty set). 501 on a
5332
5477
  file memory backend (present ONLY with MEMORY_ENGINE_BACKEND=pg|tidb).
5478
+ Server >= 7.140.0: a `scope` the engine cannot read as a layer key ⇒ 400 `request.memory_layer` (it was a 200 / 500 before — on EVERY deployment, single-store included).
5333
5479
  parameters:
5334
5480
  - in: query
5335
5481
  name: scope
@@ -5375,6 +5521,7 @@ paths:
5375
5521
  zero-oracle: own user disk or explicit operator) → shape validation (422 typed
5376
5522
  `memory_sync_invalid_body`). A 500 after partial application is an HONEST signal: replaying with the
5377
5523
  same baseRevs is idempotent self-healing (identical revs no-op throughout) — never silently swallowed.
5524
+ Server >= 7.140.0: a `:scope` the engine cannot read as a layer key ⇒ 400 `request.memory_layer` (it was a 500 before).
5378
5525
  requestBody:
5379
5526
  required: true
5380
5527
  content:
@@ -5425,13 +5572,18 @@ paths:
5425
5572
  structure that drifts with core. This is DELIBERATELY THE OPPOSITE of the import report (an explicit
5426
5573
  whitelist there): the test is "is a new key silently reaching the wire dangerous?" — in a disposition
5427
5574
  list, yes; in a STATEMENT OF FACT, withholding a field is the dangerous half.
5575
+
5576
+ 🔴 LAYER SEAT (server >= 7.140.0; contract §9 head; the key is defined once, in `components.schemas.MemoryLayerSeat`): An entry id names no layer, so the optional query `scope=<layer key>` says which store answers.
5577
+ Where it is missing, on a two-store deployment, for a verb that names no layer ⇒ 400 `request.memory_layer`; single-store deployments answer exactly as 7.139.x; older servers ignore the key.
5578
+ parameters:
5579
+ - $ref: '#/components/parameters/MemoryLayerSeatQuery'
5428
5580
  responses:
5429
5581
  '200':
5430
5582
  description: The entry's assembled provenance account (core's, verbatim).
5431
5583
  content:
5432
5584
  application/json:
5433
5585
  schema: { $ref: '#/components/schemas/EntryProvenanceAccount' }
5434
- '400': { description: 'errorCode "request.id_invalid" — the entry id could not be decoded.' }
5586
+ '400': { description: 'errorCode "request.id_invalid" — the entry id could not be decoded. Server >= 7.140.0: "request.memory_layer" — the request cannot be placed on one memory store (two-store deployment and no `scope`, or the layer key cannot be read); "request.field_invalid" — `scope` present but not a non-empty string.' }
5435
5587
  '401': { $ref: '#/components/responses/Unauthorized' }
5436
5588
  '403': { description: 'errorCode "auth.operator_only" — provenance and erasure are operator-only deployment actions. With an EMPTY `OPERATOR_PRINCIPALS` the answer is instead 501 `capability.operator_principals_required` (server >= 7.116.0; any identity, ahead of authorization — branch on `errorCode`, not the status).' }
5437
5589
  '500':
@@ -5479,6 +5631,14 @@ paths:
5479
5631
  guards "files quietly vanished during harvest"; an explicitly authorized erasure vouches for itself by
5480
5632
  enumerating every id in the attestation). `residuals.propagation` is core's self-declared boundary:
5481
5633
  deletion is a THIS-STORE fact, remote-peer convergence is the sync deployment's half to prove.
5634
+
5635
+ 🔴 LAYER SEAT (server >= 7.140.0; contract §9 head; the key is defined once, in `components.schemas.MemoryLayerSeat`): This face has NO top-level `scope` key (the body goes to the engine as sent): `select.scope` names the layer; for `select.ids` / `select.sessionId` the layer seat is `expectedScopes` (the authorization set); `select.ids` without it on a two-store deployment ⇒ 400 `request.memory_layer`.
5636
+
5637
+ 🔴 ERASURE EXECUTES ONLY ON THE DEPLOYMENT'S STORE (server >= 7.140.0, a transitional guard): the erasure `requestId` idempotency judgment
5638
+ (replay convergence; the same id under another selector ⇒ 409 `memory.erasure_selector_mismatch`) lives on EACH store's own evidence chain, and the
5639
+ engine has no deployment-wide erasure request identity yet. An erasure that lands on the OTHER store (the named layer lives on the personal mount; or,
5640
+ by session, the session has contributions there or that store's ledger cannot be read) ⇒ 409 `memory.erasure_store_unjudged`: NOTHING was erased and
5641
+ nothing recorded; the request is legal, the way out is the engine's deployment-wide request identity (the guard is deleted when it lands).
5482
5642
  requestBody:
5483
5643
  required: true
5484
5644
  content:
@@ -5492,7 +5652,9 @@ paths:
5492
5652
  schema: { $ref: '#/components/schemas/MemoryErasureAttestation' }
5493
5653
  '400':
5494
5654
  description: >
5495
- Three codes, three different operator actions — deliberately not folded into one.
5655
+ Three codes, three different operator actions — deliberately not folded into one (server >= 7.140.0 adds "request.memory_layer" — the request
5656
+ cannot be placed on one memory store: `select.ids` without `expectedScopes` on a two-store deployment, layers spanning two stores, or an unreadable
5657
+ layer key — and, from 7.138.0, "config.memory_erasure_scope" — the request reaches outside its `expectedScopes`, nothing erased).
5496
5658
  "request.request_id_required": `requestId` missing / empty / non-string. It is THIS request's
5497
5659
  idempotency identity and the server never mints one for you, so a RETRY MUST CARRY THE SAME ID (a lost
5498
5660
  ack must not open a second real delete). "request.body_shape": the top-level JSON shape is wrong, or a
@@ -5506,8 +5668,10 @@ paths:
5506
5668
  '403': { description: 'errorCode "auth.operator_only" — provenance and erasure are operator-only deployment actions. With an EMPTY `OPERATOR_PRINCIPALS` the answer is instead 501 `capability.operator_principals_required` (server >= 7.116.0; any identity, ahead of authorization — branch on `errorCode`, not the status).' }
5507
5669
  '409':
5508
5670
  description: >
5509
- Three core-minted codes, passed through verbatim; branch on `errorCode` (the status cannot tell them
5510
- apart). "memory.erasure_evidence_unavailable": this backend has NO evidence face and the caller did not
5671
+ Core-minted codes passed through verbatim, plus one server-minted code; branch on `errorCode` (the status cannot tell them
5672
+ apart). Server >= 7.140.0: "memory.erasure_store_unjudged" (server-minted) — the erasure lands on the memory store other than the deployment's
5673
+ (the named layer lives on the personal mount, or the session has contributions there / that store's ledger cannot be read): NOTHING erased, nothing
5674
+ recorded; the request is legal; do NOT retry. "memory.erasure_evidence_unavailable": this backend has NO evidence face and the caller did not
5511
5675
  opt into the degraded lane — deliberately NOT 501, because the caller holds a real choice
5512
5676
  (`allowUnevidenced: true`) and a 501 would send someone off to change a deployment that is fine.
5513
5677
  "memory.erasure_selector_mismatch": this `requestId` was first executed under a DIFFERENT selector —
@@ -5574,6 +5738,8 @@ paths:
5574
5738
  Each row's `provenance` IS the `EntryProvenanceAccount` of item ③ (same discriminated form, same
5575
5739
  pass-through discipline). An entry that is also CHALLENGED is still listed here — the exclusion rides
5576
5740
  inside the provenance account, and a human must SEE it in order to adjudicate it.
5741
+
5742
+ 🔴 LAYER SEAT (server >= 7.140.0; contract §9 head; the key is defined once, in `components.schemas.MemoryLayerSeat`): This face names its layers in `scopes`, so it needs no `scope`: `scopes` spanning two stores ⇒ 400 `request.memory_layer` (one request, one store — split it per store).
5577
5743
  responses:
5578
5744
  '200':
5579
5745
  description: The audited scopes (normalized, echoed) and one row per marked entry.
@@ -5625,12 +5791,18 @@ paths:
5625
5791
  else's name. The deployment-side counterpart is a server log line (`memory_origin_cleared`) carrying the
5626
5792
  VERIFIED principal beside the CLAIMED requestId and the `clearanceId` to join on — DO NOT draw a compliance
5627
5793
  conclusion from the ledger alone.
5794
+
5795
+ 🔴 LAYER SEAT (server >= 7.140.0; contract §9 head; the key is defined once, in `components.schemas.MemoryLayerSeat`): The ledger is kept PER STORE (on that store's control plane), so on a two-store deployment `scope=<layer key>` says whose ledger to read; to audit both stores, ask twice.
5796
+ Where it is missing, on a two-store deployment, for a verb that names no layer ⇒ 400 `request.memory_layer`; single-store deployments answer exactly as 7.139.x; older servers ignore the key.
5797
+ parameters:
5798
+ - $ref: '#/components/parameters/MemoryLayerSeatQuery'
5628
5799
  responses:
5629
5800
  '200':
5630
5801
  description: The clearance ledger (whitelist projection, newest-first not guaranteed).
5631
5802
  content:
5632
5803
  application/json:
5633
5804
  schema: { $ref: '#/components/schemas/MemoryOriginClearancesResult' }
5805
+ '400': { description: 'Server >= 7.140.0: errorCode "request.memory_layer" (two-store deployment and no `scope`, or the layer key cannot be read) or "request.field_invalid" (`scope` present but not a non-empty string).' }
5634
5806
  '401': { $ref: '#/components/responses/Unauthorized' }
5635
5807
  '403': { description: 'errorCode "auth.operator_only" — origin marking and clearance are operator-only deployment actions. With an EMPTY `OPERATOR_PRINCIPALS` the answer is instead 501 `capability.operator_principals_required` (server >= 7.116.0; any identity, ahead of authorization — branch on `errorCode`, not the status).' }
5636
5808
  '500':
@@ -5676,6 +5848,9 @@ paths:
5676
5848
  the terminal EVENT carries yours. So operator B, who resent after a 409 `memory.origin_clear_pending` as
5677
5849
  instructed and got a 200, may have completed operator A's row. ⇒ AFTER A 200, READ
5678
5850
  `GET /v1/memory/origin/clearances` BACK and check `reason` / `requestId`; `clearanceId` is that row's key.
5851
+
5852
+ 🔴 LAYER SEAT (server >= 7.140.0; contract §9 head; the key is defined once, in `components.schemas.MemoryLayerSeat`): An entry id names no layer, so the optional body key `scope` says which store answers; it is not passed to the engine. On a two-store deployment send it (and read the clearances ledger with the same `scope`).
5853
+ Where it is missing, on a two-store deployment, for a verb that names no layer ⇒ 400 `request.memory_layer`; single-store deployments answer exactly as 7.139.x; older servers ignore the key.
5679
5854
  requestBody:
5680
5855
  required: true
5681
5856
  content:
@@ -5691,7 +5866,8 @@ paths:
5691
5866
  description: >
5692
5867
  "request.id_invalid" (the entry id could not be decoded) / "request.request_id_required" (`requestId`
5693
5868
  missing / empty / non-string — mint a stable id and resend; unlike the erase face, a retry here MAY
5694
- carry a new one) / "request.body_shape" (the top-level JSON shape is wrong).
5869
+ carry a new one) / "request.body_shape" (the top-level JSON shape is wrong). Server >= 7.140.0: "request.memory_layer" (two-store deployment and no
5870
+ body `scope`, or the layer key cannot be read) / "request.field_invalid" (`scope` present but not a non-empty string).
5695
5871
  content:
5696
5872
  application/json:
5697
5873
  schema: { $ref: '#/components/schemas/ErrorResponse' }
@@ -6763,23 +6939,20 @@ paths:
6763
6939
  get:
6764
6940
  tags: [devices]
6765
6941
  operationId: devicesSessionBinding
6766
- x-status: gated # server routes/devices.ts;同族 501 谓词。SDK devices.sessionBinding() 消费。
6767
- summary: Read one root session's device binding (all the material a shell's rebind UX needs).
6768
- description: >
6769
- `boundDevice.rev` is exactly the prior state the rebind verb's `expectedRev` must echo — READ THIS FIRST,
6770
- then rebind. Unbound / not yours ⇒ 404 `not_found.device`, SAME code SAME string (anti-enumeration: "no
6771
- visible binding" is one answer; it does not tell you whether the session exists).
6942
+ x-status: retired # server 7.139.0 (MIGRATION 7.139.0 item 15) deleted the route (global 404 `not_found.route`); sdk 30.0.0 deleted the verb `devices.sessionBinding()` (zero alias).
6943
+ summary: RETIRED (server 7.139.0) — read one root session's device binding; read GET /v1/sessions/{sessionId}/execution-placement instead.
6944
+ description: >
6945
+ RETIRED since server 7.139.0: this route no longer exists — the old path answers the global `404 not_found.route`. A device binding is now the device inside the `writer` placement of the root session row; read
6946
+ `GET /v1/sessions/{sessionId}/execution-placement`. Key mapping: the old body's `boundDevice.deviceId` / `boundDevice.rev` ⇒ the new `device.deviceId` / `device.rev` (`rev` is still what the rebind verb's `expectedRev` must echo);
6947
+ `boundAt` is gone; the old body's `rootSessionId` is the path id. "No binding" used to be `404 not_found.device` and is now a 200 (the role is not `writer`, or there is no `device` key); a stranger's and an unknown session answer the same
6948
+ `404 not_found.session` (it used to be `not_found.device`). The visibility gate changed too: the old read judged by device domain (a tenant claim and the same owner as the binding, else 403 / 404; operators exempt), the new one by session
6949
+ (the session-face owner predicate OR an explicit operator). Servers 7.88.0–7.138.x still serve this route; this spec keeps the entry as a tombstone (the SDK support floor is below 7.139.0) and the SDK carries no verb for it any more: against server >= 7.139.0 read `GET /v1/sessions/{sessionId}/execution-placement`; a deployment that still reads the binding on a server below 7.139.0 stays on sdk 29.x.
6772
6950
  responses:
6773
- '200':
6774
- description: The binding.
6951
+ '404':
6952
+ description: 'Server >= 7.139.0: the global `not_found.route` — the route is gone.'
6775
6953
  content:
6776
6954
  application/json:
6777
- schema: { $ref: '#/components/schemas/DeviceSessionBinding' }
6778
- '400': { $ref: '#/components/responses/BadRequest' } # request.path_malformed / request.id_invalid
6779
- '401': { $ref: '#/components/responses/Unauthorized' }
6780
- '403': { $ref: '#/components/responses/Forbidden' } # auth.forbidden
6781
- '404': { $ref: '#/components/responses/NotFound' } # not_found.device — unbound OR not yours, byte-identical
6782
- '501': { $ref: '#/components/responses/NotImplemented' } # capability.device_lane_required
6955
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
6783
6956
 
6784
6957
  /v1/devices/sessions/{rootSessionId}/rebind:
6785
6958
  parameters:
@@ -6791,15 +6964,16 @@ paths:
6791
6964
  x-status: gated # server routes/devices.ts;同族 501 谓词 + 无活跃 run 门需 run store(501 capability.run_store_required)。SDK devices.rebind() 消费。
6792
6965
  summary: Explicitly rebind a root session to another device (v1 has no implicit rebind).
6793
6966
  description: >
6794
- `expectedRev` IS REQUIRED and must be the rev read from `GET /v1/devices/sessions/{rootSessionId}`: an
6795
- explicit prior state, so two concurrent operators cannot silently stomp each other. Door order (frozen,
6967
+ `expectedRev` IS REQUIRED and must be the rev read from `GET /v1/sessions/{rootSessionId}/execution-placement` (`device.rev` on the `writer` arm; server >= 7.139.0 — before it, `boundDevice.rev` of the retired
6968
+ `GET /v1/devices/sessions/{rootSessionId}`): an explicit prior state, so two concurrent operators cannot silently stomp each other. Door order (frozen,
6796
6969
  five steps server-side):
6797
6970
  (1) owner door — a non-owner gets 404, SAME bytes;
6798
6971
  (2) target-device door — `toDeviceId` must exist, belong to THE BINDING'S domain (an operator may not
6799
6972
  rebind across tenants) and not be revoked; otherwise 404, SAME bytes;
6800
6973
  (3) NO-ACTIVE-RUN door, judged BEFORE the CAS, with the durable criterion = the run store's session claim
6801
6974
  (parked runs included) ⇒ 409 `device.rebind_active_run` carrying `activeTaskId`; no run store wired ⇒ 501
6802
- `capability.run_store_required` (a door with no criterion refuses);
6975
+ `capability.run_store_required` (a door with no criterion refuses). server >= 7.139.0: live BACKGROUND CHILDREN rooted at the session (running, or parked on approval) are refused at this door too, with the body
6976
+ `{ children, retirePath }` instead of `{ activeTaskId }` (branch on the key) — `POST <retirePath>` (`/v1/sessions/{id}/children/retire`) retires them, then retry;
6803
6977
  (4) prior-state CAS in one store transaction plus a `session_rebound` audit row ⇒ rev mismatch is 409
6804
6978
  `device.rebind_rev_conflict` carrying `currentRev`. 🔴 The SAME `toDeviceId` with a WRONG rev is still a
6805
6979
  409 — a wrong prior state is wrong;
@@ -6908,6 +7082,16 @@ components:
6908
7082
  Authenticated end-user identity (REQUIRED; principal-first, CORE-PRINCIPLES §3). Opaque to the service
6909
7083
  (memory scope + session owner key; its meaning is not interpreted, but the server refuses a value that is not a principal name: 400 `principal_not_a_name` (server >= 7.137.0 — empty / whitespace-only, control, line-separator or invisible format characters; a proxy that writes raw UTF-8 bytes into the header is read as latin1 and refused), 400 `principal_reserved` (a reserved sentinel) and 400 `principal_too_long` (over 190 characters)). The SDK normalizes; anonymous must
6910
7084
  be explicit (`anon:<id>`). On the multi-tenant doors this is set PER REQUEST.
7085
+ MemoryLayerSeatQuery:
7086
+ in: query
7087
+ name: scope
7088
+ required: false
7089
+ description: >
7090
+ Layer seat (server >= 7.140.0; contract §9 head) — the memory layer key (e.g. `user:alice`, `local`) whose store answers this request.
7091
+ Needed only on a TWO-STORE deployment for verbs that name no layer (an entry id, a store-level ledger); absent there ⇒ 400
7092
+ `request.memory_layer`. Present but not a non-empty string ⇒ 400 `request.field_invalid`. It only decides WHICH store answers.
7093
+ The key is defined once, in `components.schemas.MemoryLayerSeat`.
7094
+ schema: { $ref: '#/components/schemas/MemoryLayerSeat/properties/scope' }
6911
7095
  IdempotencyKey:
6912
7096
  in: header
6913
7097
  name: idempotency-key
@@ -7436,8 +7620,7 @@ components:
7436
7620
  type: string
7437
7621
  description: >
7438
7622
  CC Rewind parity (E18). Fork the conversation FROM this user-message SessionTreeEntry.id (non-destructive
7439
- branch via setLeafId). With `restoreFiles: true` ⇒ "both" (also restore the working tree — the retired spelling
7440
- `rewindFiles` still rides the wire but its restore sense is core's typed migration rejection naming `restoreFiles`). Alone ⇒
7623
+ branch via setLeafId). With `restoreFiles: true` ⇒ "both" (also restore the working tree). Alone ⇒
7441
7624
  "conversation". HONORED only where the deployment wired a resume-anchor store + the session head read `headOf` (<= 7.134.x: `getLeafId`) (capabilities.resumeAt);
7442
7625
  unknown anchor ⇒ 4xx, capability-off ⇒ 501. Cannot combine with a durable resume.
7443
7626
  resumeAtMode:
@@ -7453,15 +7636,6 @@ components:
7453
7636
  session), `rewind_snapshot.unresolvable` (with a file restore, `restoreFiles`: the target has no file-history boundary of its
7454
7637
  own — a "before" restore only trusts the target's OWN boundary and never crosses into an earlier turn).
7455
7638
  Only meaningful WITH `resumeAt` — sent alone it is a 400 (fail-loud, not a silent no-op).
7456
- rewindFiles:
7457
- type: boolean
7458
- description: >
7459
- RETIRED SPELLING (the whole-tree snapshot epoch; S-15 / design/381, server >= 7.52 — note corrected in sdk
7460
- 11.4.0, the same stale-note family as `rewindFilesTo`, board [8437] U3). Server `src/http/wire-types.ts`: still
7461
- accepted on the wire — its capture sense (true, no resumeAt) is a tolerated no-op with a deprecation disclosure;
7462
- its restore sense (true + resumeAt) is core's TYPED migration rejection naming `restoreFiles` (restore semantics
7463
- really changed: whole tree ⇒ tracked set; the server never remaps it silently). Send `restoreFiles` (probe
7464
- `capabilities.restoreFiles`); this key stays declared only for <= 7.51 servers.
7465
7639
  rewindFilesTo:
7466
7640
  type: string
7467
7641
  description: >
@@ -7487,9 +7661,10 @@ components:
7487
7661
  codex review R1-[medium]: `capabilities.restoreFiles` told clients to send this key while neither
7488
7662
  this schema nor the SDK type could express it). With `resumeAt`: restore the TRACKED SET (files
7489
7663
  this session edited) to that boundary on fork — S-15 narrowed restore whole-tree ⇒ tracked-set and
7490
- moved the request key off `rewindFiles` (the old `rewindFiles`+`resumeAt` spelling gets core's
7491
- typed migration rejection on ≥7.52). Probe `capabilities.restoreFiles` first: bit absent = older
7492
- server, send the old spelling; never send both spellings.
7664
+ moved the request key off the old spelling `rewindFiles`. 🔴 The old spelling `rewindFiles` is RETIRED outright
7665
+ (server 7.139.0, MIGRATION item 2; sdk 30.0.0 deleted the key, zero alias): a new submit that carries it is
7666
+ `400 request.body_shape` with `unknownKeys: ["rewindFiles"]` and creates no run (the durable-resume replay of an OLD stored body
7667
+ ignores it). Probe `capabilities.restoreFiles` first; send `restoreFiles` (+ `resumeAt`) or `rewindFilesTo`.
7493
7668
  acceptPartialRestore:
7494
7669
  type: boolean
7495
7670
  description: >-
@@ -7509,7 +7684,7 @@ components:
7509
7684
  word. ONE word, `disabled`: this run takes no first-touch backup of an edited file and mints no turn boundaries
7510
7685
  (delegates inherit it); absent = the deployment's setting (there is no `enabled` spelling). Any other value ⇒ 400
7511
7686
  `request.field_invalid` ("fileHistory must be the string 'disabled' when present …"), fresh and resume legs alike.
7512
- 🔴 Riding together with ANY restore key (`restoreFiles` / `rewindFilesTo` / the retired `rewindFiles`) ⇒ 400
7687
+ 🔴 Riding together with ANY restore key (`restoreFiles` / `rewindFilesTo`) ⇒ 400
7513
7688
  `request.field_conflict` AT ADMISSION ("fileHistory: 'disabled' cannot ride with a file restore …"), session and
7514
7689
  files untouched — drop it to restore. The leg's own verdict is `wiring_manifest.fileHistory`; whether to render a
7515
7690
  "don't capture this session" switch is `capabilities.fileHistoryCapture === "on-optional"` (the switch = send this
@@ -10000,7 +10175,7 @@ components:
10000
10175
  diagnostics, never as vocabulary). Empty array = honest "nothing usable here" (e.g. multi-tenant
10001
10176
  with no explicit allowlist); ABSENT = an older server (degrade to not teaching, not validating).
10002
10177
  resumeAt: { type: boolean, description: "E18 resume-at-message anchors are resolvable." }
10003
- rewindFiles: { type: boolean, description: "E19 working-tree snapshot/restore is wired." }
10178
+ rewindFiles: { type: boolean, description: "E19 file-history store present (the file-restore legs `restoreFiles` / `rewindFilesTo` can take effect). The bit's NAME is a historical spelling: the same-named REQUEST key `rewindFiles` is retired (server 7.139.0 ⇒ 400 `request.body_shape`), the bit itself is still minted." }
10004
10179
  rewindFilesTo:
10005
10180
  type: boolean
10006
10181
  description: >-
@@ -10018,10 +10193,9 @@ components:
10018
10193
  description: >-
10019
10194
  S-15 epoch discriminator (server ≥7.52, `Boolean(fileHistoryStore)`): this server understands the
10020
10195
  `restoreFiles` REQUEST KEY / tracked-set restore semantics (design/381 — restore narrowed
10021
- whole-tree ⇒ tracked set; the retired `rewindFiles`+`resumeAt` spelling gets core's typed
10022
- migration rejection there). New clients negotiate on THIS bit and send `restoreFiles` (+
10023
- `resumeAt`); absent ⇒ an older server, send the old spelling. `rewindFiles` keeps its name (same
10024
- affordance — "rewind can move files"); this bit is what tells the two epochs apart.
10196
+ whole-tree ⇒ tracked set). New clients negotiate on THIS bit and send `restoreFiles` (+
10197
+ `resumeAt`); absent ⇒ a server below the SDK's support floor. The capability bit `rewindFiles` keeps its
10198
+ name (same affordance — "rewind can move files"); the old REQUEST key of that name is retired (server 7.139.0).
10025
10199
  manualCompact: { type: boolean, description: "`POST /v1/runs/:id/compact` (needs a run store)." }
10026
10200
  configCatalog:
10027
10201
  type: boolean
@@ -11450,6 +11624,27 @@ components:
11450
11624
  events: { type: array, items: { $ref: '#/components/schemas/MemoryTransferEvidence' } }
11451
11625
  reason: { type: string }
11452
11626
 
11627
+ MemoryLayerSeat:
11628
+ type: object
11629
+ description: >
11630
+ The LAYER SEAT (server >= 7.140.0; contract §9 head) — the one definition of the optional key `scope` that the memory verbs naming no layer carry.
11631
+ One memory request lands on ONE store: the store the named layer lives in (file backend: the typed personal layers `user:` / `userproj:` / `org:` live in a
11632
+ SECOND store under the personal mount; the project layers and the un-typed layers, `local` included, live in the deployment's store). It rides the query string
11633
+ (`GET /v1/memory/entries/{entryId}/provenance`, `GET /v1/memory/origin/clearances`, `GET /v1/sessions/{sessionId}/memory-status`) or the body
11634
+ (`MemoryOriginClearRequest`, `SessionMemoryEraseRequest`); `POST /v1/memory/erase` has no such key (the layer comes from `select.scope` / `expectedScopes`).
11635
+ Needed only on a TWO-STORE deployment for verbs that name no layer; a single-store deployment answers byte-for-byte as 7.139.x. This schema is open: it only
11636
+ defines the key, and is embedded by property reference — it is not a request body of its own.
11637
+ additionalProperties: true
11638
+ properties:
11639
+ scope:
11640
+ type: string
11641
+ minLength: 1
11642
+ description: >
11643
+ The memory layer key (e.g. `user:alice`, `local`) whose store answers. Absent ⇒ no layer named: on a two-store deployment the verbs that name no layer
11644
+ answer 400 `request.memory_layer` (the session-id verbs fold or run on the deployment's store instead); present but not a non-empty string ⇒ 400
11645
+ `request.field_invalid` (sentence only); a layer key the engine cannot read ⇒ 400 `request.memory_layer`. It only decides WHICH store answers — it never
11646
+ reaches the engine.
11647
+
11453
11648
  MemoryErasureRequest:
11454
11649
  type: object
11455
11650
  description: >
@@ -11474,12 +11669,22 @@ components:
11474
11669
  allowUnevidenced:
11475
11670
  type: boolean
11476
11671
  description: "Opt-in to the evidence-capability-ABSENT degradation lane. Default = a loud refusal (409 `memory.erasure_evidence_unavailable`)."
11672
+ expectedScopes:
11673
+ type: array
11674
+ items: { type: string }
11675
+ description: >
11676
+ The authorization set of this erasure (server >= 7.138.0; the judge is core): when present, the selector's own scope and the bound scope of EVERY
11677
+ resolved id must lie in the set, else the whole request is refused 400 `config.memory_erasure_scope` (nothing erased or recorded; an id whose scope the
11678
+ store cannot attribute, or that never existed, counts as outside). The empty set authorizes no scope; absent = no narrowing. Server >= 7.140.0: it ALSO
11679
+ serves as the layer seat of `select.ids` / `select.sessionId` on a two-store deployment (a non-empty set decides which store answers; spanning two stores ⇒
11680
+ 400 `request.memory_layer`; a personal-mount store ⇒ 409 `memory.erasure_store_unjudged`; `select.ids` without it on a two-store deployment ⇒ 400
11681
+ `request.memory_layer`).
11477
11682
 
11478
11683
  SessionMemoryEraseRequest:
11479
11684
  type: object
11480
11685
  description: >
11481
11686
  Request body of POST /v1/sessions/{sessionId}/memory/erase (contract §12.5; release bytes server 7.107.0
11482
- `dist/http/routes/sessions.js:508-523`). Two NAMED keys. `select` is FORBIDDEN (the selector is minted by the path; a body
11687
+ `dist/http/routes/sessions.js:508-523`; the layer seat `scope` is server >= 7.140.0). Three NAMED keys. `select` is FORBIDDEN (the selector is minted by the path; a body
11483
11688
  carrying it is a loud 400 `request.body_shape`). Any OTHER unknown key is NOT refused — the route silently ignores it and
11484
11689
  forwards only `requestId` / `allowUnevidenced` (`:526`) — so this schema is open except for `select` (codex r1 F1: a closed
11485
11690
  schema would make a strict consumer reject a body the server accepts). `requestId` has the SAME meaning as
@@ -11493,6 +11698,11 @@ components:
11493
11698
  allowUnevidenced:
11494
11699
  type: boolean
11495
11700
  description: "Opt-in to the evidence-capability-ABSENT degradation lane — a human signature; never injected. Non-boolean ⇒ 400 `request.field_invalid`."
11701
+ scope:
11702
+ # the one definition of the layer seat key: `components.schemas.MemoryLayerSeat`. On THIS face (server >= 7.140.0): a layer living in the deployment's store
11703
+ # (e.g. `local`) ⇒ the erasure runs there (200; the attestation covers that store only, the seat reaches neither the engine nor the attestation); a layer on the
11704
+ # personal mount ⇒ 409 `memory.erasure_store_unjudged`; unreadable ⇒ 400 `request.memory_layer`.
11705
+ $ref: '#/components/schemas/MemoryLayerSeat/properties/scope'
11496
11706
 
11497
11707
  MemoryErasedBinding:
11498
11708
  description: "core `ErasedBinding` — one erased row's coordinates: the scope it was bound in, NEVER its file name (a model-chosen name can restate the content being erased; attestation v2)."
@@ -11782,6 +11992,10 @@ components:
11782
11992
  properties:
11783
11993
  requestId: { type: string, minLength: 1 }
11784
11994
  reason: { type: string }
11995
+ scope:
11996
+ # the one definition of the layer seat key: `components.schemas.MemoryLayerSeat`. On THIS face: required in practice on a TWO-STORE deployment
11997
+ # (absent ⇒ 400 `request.memory_layer`); not passed to the engine.
11998
+ $ref: '#/components/schemas/MemoryLayerSeat/properties/scope'
11785
11999
 
11786
12000
  MemoryOriginClearReceipt:
11787
12001
  type: object
@@ -14375,11 +14589,23 @@ components:
14375
14589
  >= 7.125.0 (a session's state, not a capability — NOT present-iff); a lister face with no session metadata (the in-memory run-store
14376
14590
  aggregate) always answers `false`. ABSENT = an older server (<= 7.124.x) — read as "not pinned". Not in `required` for that reason only.
14377
14591
  The list order is unchanged (recency by `lastActivityAt`); the client groups the pinned section. Renaming / pinning does not move `lastActivityAt`.
14592
+ rowTag:
14593
+ type: string
14594
+ pattern: '^[A-Za-z0-9_-]{43}$'
14595
+ description: >
14596
+ server >= 7.139.0 (contract section 20, "conditional write"): the ROW TAG — an opaque string (43 characters of `[A-Za-z0-9_-]`) to be echoed back verbatim as
14597
+ `PATCH /v1/sessions/{sessionId}` `expectedRowTag`: "write only if the row is still the one I read". It changes when one of the row's WRITABLE bits (today `title` / `pinned`)
14598
+ or the session ITSELF changes (deleted and re-created under the same id; a changed owner); a new run, the activity time and the preview do NOT change it; a value that was changed and
14599
+ 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
+ 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
+ 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.
14378
14602
 
14379
14603
  SessionPatchBody:
14380
14604
  type: object
14381
14605
  description: >
14382
- `PATCH /v1/sessions/{sessionId}` body (server >= 7.125.0, contract section 20) — a CLOSED set of two keys, at least one: any other key, an empty body or a
14606
+ `PATCH /v1/sessions/{sessionId}` body (server >= 7.125.0, contract section 20) — a CLOSED set: the two writable bits `title` / `pinned` (at least one) plus, from server >= 7.139.0, the optional PRECONDITION
14607
+ `expectedRowTag` (the `rowTag` of the list row you read: "write only if the row is still that one"; stale ⇒ `409 conflict.session_row_changed`, nothing written; a key that is not a 43-character `[A-Za-z0-9_-]`
14608
+ string ⇒ `400 request.field_invalid`; `expectedRowTag` ALONE — no writable bit — ⇒ `400 request.body_shape`; a server <= 7.138.x answers `400 request.body_shape` for the unknown key: fail-closed, do NOT drop the key and resend). Any other key, an empty body or a
14383
14609
  non-object is `400 request.body_shape`. `title`: a string renames (1..120 CHARACTERS counted as Unicode characters = the storage column width, no leading /
14384
14610
  trailing whitespace, stored verbatim — not rewritten, not redacted); `null` CLEARS it back to the automatic title (the next submit lets the auto-titler fill
14385
14611
  it again). `""` is NOT a clear — it is `400 request.body_shape`. A string of the wrong form / a non-string-non-null `title` / a non-boolean `pinned` is
@@ -14387,7 +14613,9 @@ components:
14387
14613
  usable-name normalization) is `400 request.field_invalid` too (`title must contain at least one visible character`; the session-sync 2c import's `title` reads the same rule). Such titles written before
14388
14614
  7.136.0 are not migrated.
14389
14615
  additionalProperties: false
14390
- minProperties: 1
14616
+ anyOf:
14617
+ - required: [title]
14618
+ - required: [pinned]
14391
14619
  properties:
14392
14620
  title:
14393
14621
  type: [string, 'null']
@@ -14396,6 +14624,84 @@ components:
14396
14624
  pattern: '^\S([\s\S]*\S)?$'
14397
14625
  description: 'A string = rename (1..120 characters, no leading / trailing whitespace); `null` = clear back to the automatic title; `""` is a 400 (the only spelling of "clear" is `null`).'
14398
14626
  pinned: { type: boolean, description: 'The pin (default `false` on a row that never set it).' }
14627
+ expectedRowTag:
14628
+ type: string
14629
+ pattern: '^[A-Za-z0-9_-]{43}$'
14630
+ description: 'server >= 7.139.0 — the PRECONDITION (not a writable bit): the `rowTag` of the list row you read. Still that row ⇒ the write happens (the 200 row carries the tag after the write — it changes only if a value actually changed; a write of the value already held returns the same tag); not any more ⇒ `409 conflict.session_row_changed` with `currentRow`, nothing written. Never resend verbatim after a 409.'
14631
+ SessionForkBody:
14632
+ type: object
14633
+ description: >
14634
+ `POST /v1/sessions/{sessionId}/fork` OPTIONAL body (server >= 7.139.0, contract section 23.4) — the keyed, retryable fork: `forkId` (the caller-minted canonical uuid that BECOMES the new session's id; not the source) and
14635
+ `forkNonce` (a non-empty string of at most 255 UTF-16 code units, i.e. JavaScript `String.length` — the server compares exactly that; a retry sends the SAME one). TOGETHER OR NEITHER: only one ⇒
14636
+ `400 request.field_conflict` (`detail.kind: "fork_target"`, `fields: ["forkId", "forkNonce"]`); neither (an empty object, or no body at all) = the previous form (the server mints the id). The server reads only these two keys
14637
+ and IGNORES any other key (the object is not key-closed). Note the route now PARSES the body (it ignored it up to 7.138.x): malformed JSON ⇒ `400 request.invalid_json`, over the 8 MiB cap ⇒ `413`, a JSON array or scalar ⇒ `400 request.field_invalid`.
14638
+ additionalProperties: true
14639
+ oneOf:
14640
+ - required: [forkId, forkNonce]
14641
+ - allOf:
14642
+ - not: { required: [forkId] }
14643
+ - not: { required: [forkNonce] }
14644
+ properties:
14645
+ forkId: { type: string, description: 'A canonical uuid (any version) naming the NEW session; not the source id (`400 request.field_invalid`), not a canonical uuid (`400 request.id_invalid`).' }
14646
+ forkNonce: { type: string, minLength: 1, maxLength: 255, description: 'The caller''s key for this fork request: non-empty, at most 255 UTF-16 code units (JavaScript `String.length`; JSON Schema `maxLength` counts code points, so it is only a necessary bound for text outside the BMP — the server refuses 256+ code units). A retry sends the same one. Not such a string ⇒ `400 request.field_invalid`.' }
14647
+ SessionForkResult:
14648
+ type: object
14649
+ description: >
14650
+ `POST /v1/sessions/{sessionId}/fork` 200 body: `sessionId` = the NEW branched session (= `forkId` on a keyed fork); `replayed: true` (server >= 7.139.0, keyed form only) = a retry by the same owner, same source and same
14651
+ nonce hit the earlier result. The key is ABSENT on a first fork and on every older server.
14652
+ additionalProperties: false
14653
+ required: [sessionId]
14654
+ properties:
14655
+ sessionId: { type: string }
14656
+ replayed: { type: boolean, enum: [true], description: 'Present only (and always `true`) on a same-key retry.' }
14657
+ SessionChildrenRetireResult:
14658
+ type: object
14659
+ description: >
14660
+ `POST /v1/sessions/{sessionId}/children/retire` 200 body (server >= 7.139.0, contract section 23.5): `children` = the background children the first observation found AND that are now all retired
14661
+ (an empty array when there were none); each item is the same string as the `GET /v1/agents/roster` row id.
14662
+ additionalProperties: false
14663
+ required: [children]
14664
+ properties:
14665
+ children: { type: array, items: { type: string } }
14666
+ ExecutionPlacementDevice:
14667
+ type: object
14668
+ description: >
14669
+ The device a `writer` placement on the device lane is bound to (`ExecutionPlacement`, server >= 7.139.0): `deviceId` + `rev` — `rev` is exactly what
14670
+ `POST /v1/devices/sessions/{rootSessionId}/rebind` `expectedRev` must echo. The device owner and the binding time do not ride the wire.
14671
+ additionalProperties: false
14672
+ required: [deviceId, rev]
14673
+ properties:
14674
+ deviceId: { type: string, minLength: 1 }
14675
+ rev: { type: integer, minimum: 0 }
14676
+ ExecutionPlacement:
14677
+ description: >
14678
+ `GET /v1/sessions/{sessionId}/execution-placement` 200 body (server >= 7.139.0, contract section 23.1) — the execution placement of one ROOT session's current occupant on THIS deployment, discriminated by `role`:
14679
+ `absent` (not yet executed here) · `writer` (this deployment is the writer; `lane` = the execution lane word, the `REMOTE_EXEC` value, `in-process` when unset; `device` only on the device lane once bound — `writer`
14680
+ without `device` there = a pre-upgrade session whose device is unknown) · `mirror` (a read-only copy imported from elsewhere; execution / rename / pin answer `409 conflict.session_mirror` with `forkPath`) ·
14681
+ `forking` (a keyed fork has not finished copying — `DB_BACKEND=local` crash middle state only). No `writer` ⇄ `mirror` and no `writer(L)` → `writer(L')` transition: to change, fork a new session. Closed set; the SDK reads it exhaustively.
14682
+ oneOf:
14683
+ - type: object
14684
+ additionalProperties: false
14685
+ required: [role]
14686
+ properties:
14687
+ role: { const: absent }
14688
+ - type: object
14689
+ additionalProperties: false
14690
+ required: [role, lane]
14691
+ properties:
14692
+ role: { const: writer }
14693
+ lane: { type: string, minLength: 1 }
14694
+ device: { $ref: '#/components/schemas/ExecutionPlacementDevice' }
14695
+ - type: object
14696
+ additionalProperties: false
14697
+ required: [role]
14698
+ properties:
14699
+ role: { const: mirror }
14700
+ - type: object
14701
+ additionalProperties: false
14702
+ required: [role]
14703
+ properties:
14704
+ role: { const: forking }
14399
14705
 
14400
14706
  SessionWindow:
14401
14707
  type: object
@@ -14852,6 +15158,11 @@ components:
14852
15158
  core's retain predicate (env declaration / task lane / row mark — any ⇒ kept) — present ONLY when true,
14853
15159
  never minted as false, and only ever on a shell row (`background_bash` / `monitor`; core `list()` row
14854
15160
  doc). Present = "keeps running" on the exit sheet; absent = an `includeRetained:false` stop WILL stop it.
15161
+ sessionId:
15162
+ type: string
15163
+ description: >-
15164
+ server >= 7.139.0 (MIGRATION 7.139.0 item 7): present-iff the background agent row is bound to a CHILD session — jump to that session with it (it still passes the session face's owner gate). ABSENT = none yet,
15165
+ or an older server. Only ever on a `background_agent` row.
14855
15166
  SessionBackgroundList:
14856
15167
  type: object
14857
15168
  description: '`GET /v1/sessions/{sessionId}/background` 200 body (contract §16). An idle session answers `{ rows: [] }`.'
@@ -15194,7 +15505,10 @@ components:
15194
15505
  budget): this code says nothing about the caller's quota. (`gone.` = 410, "the channel closed, switch
15195
15506
  channels"; `parking.` = 425, "intermediate state — you retry to learn the landing, not to re-submit".
15196
15507
  Both families, and both status codes, first reached the wire with server 7.3.0's in-stream approval
15197
- decision endpoint.) The SDK maps each family to a typed class, so a code this SDK has
15508
+ decision endpoint.) 🔴 server >= 7.139.0 also mints two 409 codes under a prefix that is NOT one of the fourteen:
15509
+ `execution_lane.not_served` / `execution_lane.tree_bound` (the session is placed on an execution lane this deployment no
15510
+ longer runs / another lane of this deployment; top-level `boundLane`) — they fall through to the STATUS tail (409 ⇒
15511
+ `ConflictError`), so branch on the code, never on a prefix family. The SDK maps each family to a typed class, so a code this SDK has
15198
15512
  never seen still degrades INFORMATIVELY (e.g. a future `capability.xyz_required` already lands on
15199
15513
  CapabilityUnavailableError). Family examples not named elsewhere in this document:
15200
15514
  `request.payload_too_large` (413 — a field or the whole body is over the server cap; shorten and
@@ -16619,8 +16933,8 @@ components:
16619
16933
  stays `readonly_out_of_root`).
16620
16934
  🔴 core >= 7.6.0 — the MCP family within this open set is now the CLOSED `McpFailureKind` word list
16621
16935
  (`connect_refused` / `connection_failed` / `connection_closed` / `unauthorized` / `http_status` / `not_mcp_response` /
16622
- `spawn_failed` / `timeout` / `protocol` / `invalid_config` / `credential_unavailable` / `unknown` — `credential_unavailable` from core 7.58.0 and
16623
- `unauthorized` from core 7.59.0, server >= 7.138.0); the retired
16936
+ `spawn_failed` / `timeout` / `protocol` / `invalid_config` / `credential_unavailable` / `host_refused` / `unknown` — `credential_unavailable` from core 7.58.0 and
16937
+ `unauthorized` from core 7.59.0, server >= 7.138.0; `host_refused` from core 7.60.0, server >= 7.139.0); the retired
16624
16938
  `MCP_FAILURE_CODES` spellings — including `network` and the `http_<status>` encoding — are gone,
16625
16939
  and an HTTP status now rides the structured `httpStatus` seat on `wiring_manifest.mcp[]` instead of
16626
16940
  being baked into the code. The set as a WHOLE stays open (a tool owns its own codes).
@@ -16769,6 +17083,7 @@ components:
16769
17083
  maxRetries: { type: number, description: "retry budget of the lane in force (refused-connect short lane = 2)" }
16770
17084
  retryInMs: { type: number, description: "same number as retryInSec at ms precision (countdown rendering)" }
16771
17085
  errClass: { type: string, description: "connect_refused | transport | stall | rate_limit | server | http | output_cap (core's seven words since core 7.14.0 — `stall` = this process's own stall watchdog cancelled the request) — retry-wait frames ONLY; never inferred from phase" }
17086
+ seat: { type: string, description: "server >= 7.139.0 (core 7.60.0 `BrainStatus.seat`, minted only when a non-empty string, passed through verbatim): WHOSE model call this frame is about, on EVERY phase — `classifier` = a call made for the auto-mode classifier lane (the classifier seat's model, or the main model standing in behind it): a side call beside the person's turn. ABSENT = the run's own turn (read as the main loop, never as unknown) and every older server. Open on read (a newer engine may name another seat)." }
16772
17087
  providerCondition: { type: string, description: "server >= 7.126.0 (core 7.49.0 #1454, passed through verbatim): what the provider said about the account / capacity — core's closed `PROVIDER_CONDITIONS`; a retry frame carries only the three retryable words `throttled | overloaded | unknown` (`quota_exhausted` / `stop_other` do not retry and ride the terminal `detail.providerCondition`). Presence law as `errorStatus`; read as an OPEN set (keep a default arm). ABSENT = not judged, read the same as `unknown` (back off, do not assert quota). Moves with `providerConditionSource`." }
16773
17088
  providerConditionSource: { type: string, description: "server >= 7.126.0 (core 7.49.0 #1454): the evidence the `providerCondition` verdict rests on — `unified_header | provider_code | status`; present exactly when `providerCondition` is; read as an OPEN set." }
16774
17089
  retryAtMs: { type: number, description: "server >= 7.52.0 (core 7.0.0): the WALL-CLOCK end of the wait = `Date.now() + retryInMs` at emit, on the emitting process's clock (not monotonic — never compare it with a local monotonic timer). `retryInMs` stays the authoritative RELATIVE amount; this is the producer's absolute note (a reader several hops away recomputing it would reset the countdown on every replay). Moves with `retryInMs`; absent ⇒ not minted." }
@@ -21475,7 +21790,8 @@ components:
21475
21790
  description: >
21476
21791
  core >= 7.6.0 — the `McpFailureKind` word (`connect_refused` / `connection_failed` /
21477
21792
  `connection_closed` / `unauthorized` / `http_status` / `not_mcp_response` / `spawn_failed` / `timeout` /
21478
- `protocol` / `invalid_config` / `credential_unavailable` / `unknown`; server >= 7.138.0: `unauthorized` = the principal must authorize this server
21793
+ `protocol` / `invalid_config` / `credential_unavailable` / `host_refused` / `unknown`; server >= 7.139.0 (core 7.60.0): `host_refused` = the host seat of a host-supplied transport did not hand the request to the remote (nothing was
21794
+ sent; no deployment of this server mounts one today, the word is the engine's); server >= 7.138.0: `unauthorized` = the principal must authorize this server
21479
21795
  first — the endpoint answered 401 (after the deployment's peer seat was asked once more) or a 403 with an `insufficient_scope` challenge, or the peer
21480
21796
  seat answered that the principal is not authorized here; earlier servers sent the first two as `http_status`; `credential_unavailable` = the
21481
21797
  deployment's peer seat did not furnish the request (it threw, did not answer in time, or answered something the engine cannot carry), so the
@@ -22695,8 +23011,12 @@ components:
22695
23011
  in place"; now every candidate carries its own `behavior` and that seat is GONE — an entry that did not
22696
23012
  become a candidate is in `skipped` with its reason. A consumer rendering `uncovered.denyAskBuckets` reads
22697
23013
  `candidates[].behavior` instead.
23014
+
23015
+ 🔴 server >= 7.139.0 (core 7.60.0; MIGRATION 7.139.0 item 6) — THE KEY `translated` IS GONE (read-side BREAKING): core deleted the always-empty compatibility array and the server forwards the preview verbatim. This schema
23016
+ describes only that generation (CLOSED: a 7.139.0 body has no `translated`; a body from a server <= 7.138.x still carries `translated: []` and does not match this closed schema — the SDK's own readers ignore it). A reader that
23017
+ rendered a "rewritten spellings" column reads nothing for it (the array was always empty).
22698
23018
  additionalProperties: false
22699
- required: [candidates, skipped, translated, layers, uncovered]
23019
+ required: [candidates, skipped, layers, uncovered]
22700
23020
  properties:
22701
23021
  candidates:
22702
23022
  type: array
@@ -22706,25 +23026,6 @@ components:
22706
23026
  type: array
22707
23027
  items: { $ref: '#/components/schemas/CcImportSkippedRule' }
22708
23028
  description: 'Entries that did not become candidates. `reason` is PROSE, not a code — see the schema.'
22709
- translated:
22710
- type: array
22711
- description: >
22712
- ALWAYS EMPTY in this version — a compatibility seat core keeps on the wire shape (core
22713
- `ImportPreview.translated`, verbatim). It once carried entries whose MATCH FORM was rewritten on the
22714
- way in (the other product's space-star suggestion form translated to this lane's colon-star). That
22715
- translation is retired: space-star is now a first-class match form of this lane's own grammar, so an
22716
- entry's match form imports as the file states it and nothing is ever pushed here. A reader rendering a
22717
- "rewritten spellings" column from this seat renders an empty column, correctly.
22718
- ⚠️ Declared here from SDK 8.8.0 on: core has always emitted the key, so a closed schema without it
22719
- judged every real 200 body a violation (a staleness fix, not a behavior change).
22720
- items:
22721
- type: object
22722
- additionalProperties: false
22723
- required: [from, to, scope]
22724
- properties:
22725
- from: { type: string }
22726
- to: { type: string }
22727
- scope: { $ref: '#/components/schemas/RuleScope' }
22728
23029
  layers:
22729
23030
  type: array
22730
23031
  items: { $ref: '#/components/schemas/CcImportLayerReport' }
@@ -23395,25 +23696,6 @@ components:
23395
23696
  type: array
23396
23697
  items: { $ref: '#/components/schemas/DeviceSummary' }
23397
23698
 
23398
- DeviceBinding:
23399
- type: object
23400
- description: 'One session↔device binding (server `boundDeviceOf`; frozen key set).'
23401
- additionalProperties: false
23402
- required: [deviceId, rev, boundAt]
23403
- properties:
23404
- deviceId: { type: string, minLength: 1 }
23405
- rev: { type: integer, minimum: 0, description: 'The prior-state version — this is exactly what the rebind verb''s `expectedRev` must echo (an explicit prior state, so two concurrent operators cannot silently stomp each other).' }
23406
- boundAt: { type: string, format: date-time, description: 'ISO-8601.' }
23407
-
23408
- DeviceSessionBinding:
23409
- type: object
23410
- description: 'The `GET /v1/devices/sessions/{rootSessionId}` 200 body (all the material a shell''s rebind UX needs).'
23411
- additionalProperties: false
23412
- required: [rootSessionId, boundDevice]
23413
- properties:
23414
- rootSessionId: { type: string, minLength: 1 }
23415
- boundDevice: { $ref: '#/components/schemas/DeviceBinding' }
23416
-
23417
23699
  DeviceRebindRequest:
23418
23700
  type: object
23419
23701
  description: 'The `POST /v1/devices/sessions/{rootSessionId}/rebind` body. NOTE: server 7.88.2 does NOT key-close this one body (unknown keys are dropped silently, unlike enroll/revoke which answer 400 request.body_shape); a server-side ticket tracks closing it. This SDK never sends extra keys.'
@@ -23425,7 +23707,7 @@ components:
23425
23707
  type: integer
23426
23708
  minimum: 0
23427
23709
  description: >
23428
- REQUIRED — the rev read from `GET /v1/devices/sessions/{rootSessionId}`. 🔴 The same `toDeviceId` with a
23710
+ REQUIRED — the rev read from `GET /v1/sessions/{rootSessionId}/execution-placement` (`device.rev` on the `writer` arm; server >= 7.139.0). 🔴 The same `toDeviceId` with a
23429
23711
  WRONG rev is STILL a 409 `device.rebind_rev_conflict`: a wrong prior state is wrong. Not a non-negative
23430
23712
  integer ⇒ 400 request.field_invalid.
23431
23713