@sema-agent/sdk 33.0.0 → 35.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 (45) hide show
  1. package/README.md +112 -0
  2. package/dist/errors.d.ts +20 -1
  3. package/dist/errors.d.ts.map +1 -1
  4. package/dist/errors.js +17 -1
  5. package/dist/errors.js.map +1 -1
  6. package/dist/events.d.ts +61 -20
  7. package/dist/events.d.ts.map +1 -1
  8. package/dist/events.js.map +1 -1
  9. package/dist/index.d.ts +10 -3
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +4 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/normalize.d.ts +9 -3
  14. package/dist/normalize.d.ts.map +1 -1
  15. package/dist/normalize.js +2 -0
  16. package/dist/normalize.js.map +1 -1
  17. package/dist/resources/approvals.d.ts +7 -2
  18. package/dist/resources/approvals.d.ts.map +1 -1
  19. package/dist/resources/approvals.js.map +1 -1
  20. package/dist/resources/rules.d.ts +48 -48
  21. package/dist/resources/rules.d.ts.map +1 -1
  22. package/dist/resources/rules.js +8 -4
  23. package/dist/resources/rules.js.map +1 -1
  24. package/dist/resources/session-sync.d.ts +10 -3
  25. package/dist/resources/session-sync.d.ts.map +1 -1
  26. package/dist/resources/session-sync.js +10 -3
  27. package/dist/resources/session-sync.js.map +1 -1
  28. package/dist/resources/sessions.d.ts +2 -2
  29. package/dist/resources/sessions.d.ts.map +1 -1
  30. package/dist/resources/sessions.js +2 -2
  31. package/dist/resources/sessions.js.map +1 -1
  32. package/dist/resources/tool-approvals.d.ts +8 -5
  33. package/dist/resources/tool-approvals.d.ts.map +1 -1
  34. package/dist/resources/tool-approvals.js +7 -4
  35. package/dist/resources/tool-approvals.js.map +1 -1
  36. package/dist/transport.d.ts +4 -2
  37. package/dist/transport.d.ts.map +1 -1
  38. package/dist/transport.js +4 -3
  39. package/dist/transport.js.map +1 -1
  40. package/dist/types.d.ts +61 -10
  41. package/dist/types.d.ts.map +1 -1
  42. package/dist/types.js +5 -0
  43. package/dist/types.js.map +1 -1
  44. package/openapi.yaml +209 -99
  45. package/package.json +2 -2
package/openapi.yaml CHANGED
@@ -490,6 +490,11 @@ paths:
490
490
  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) —
491
491
  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
492
492
  absent. Async / live legs answer 2xx with the same code on the terminal run row / `done` frame's `terminal.code`.
493
+ Server >= 7.144.0, zero-work submissions only: `env.home_unconfirmed` — on the host lane (including `run-local`) the execution environment's home-directory claim
494
+ (`REMOTE_EXEC_HOME_DIR`, absent ⇒ the service process's home) does not match the `HOME` the child process gets, cannot be read, or is not an absolute path ⇒ the
495
+ environment is not minted: no command ran, no model call, nothing billed, the idempotency key is not taken. The request is well-formed, the deployment state conflicts
496
+ with it (drop the claim or set it to `HOME`'s value, or remove `HOME` from the session's `settings.env`); a verbatim retry does not change the verdict. `activeTaskId` is
497
+ absent. Async / live legs answer 2xx with the same code on the terminal run row / `done` frame's `terminal.code`. The only member of the server's `env.*` family today.
493
498
  K-24 (server >= 7.104.0 / S-724, zero-work submissions only): `rewind.store_unconfigured` — this
494
499
  deployment has NO file-history store but the request asks to restore files; the request is well-formed, the
495
500
  deployment shape conflicts with it (change the deployment, not the request; `capabilities.rewindFiles` is false
@@ -530,9 +535,10 @@ paths:
530
535
  no meta header; SQL backends: one `session_event.payload` row is not a readable entry). Nothing ran, nothing
531
536
  billed; `error` is the engine / store sentence (no on-disk path). DETERMINISTIC: a retry cannot change it (the SDK
532
537
  does not auto-retry this code); the repair is the operator's. Also `internal.error` (unclassified).
533
- server >= 7.137.0: `invalid_session` — the session's stored log reads but is structurally broken (a dangling parent, a self-parent, a cycle or
534
- a missing leaf); on the synchronous leg it replaces the earlier `200` + a failed body. Nothing ran. DETERMINISTIC like `corrupt_session`: a retry
535
- cannot change it (the SDK does not auto-retry this code) — switch to a new session or fork from an entry above the break.
538
+ server >= 7.144.0: the same `corrupt_session` also answers a stored log that reads but is structurally broken (a dangling parent, a self-parent, a cycle or
539
+ a missing leaf) when the replay dropped no record — switch to a new session or fork from an entry above the break. Servers 7.137.0–7.143.x answered that form
540
+ `invalid_session` (retired at 7.144.0; this SDK no longer exempts the retired code, so against those servers it is retried by status). A log whose replay DID drop
541
+ records and whose branch broke at the missing parent is no longer refused: the run continues from the break (200).
536
542
  content:
537
543
  application/json:
538
544
  schema: { $ref: '#/components/schemas/ErrorResponse' }
@@ -1952,9 +1958,11 @@ paths:
1952
1958
  total: { type: integer, description: 'present on the out-of-range `?message=` 404 — the message count available.' }
1953
1959
  '500':
1954
1960
  description: >-
1955
- server >= 7.137.0: `invalid_session` — the session's stored log reads but is structurally broken (a dangling parent, a self-parent, a cycle or a
1956
- missing leaf); this read answers it instead of `internal.error`. DETERMINISTIC: a retry cannot change it (the SDK does not auto-retry this code) —
1957
- switch to a new session or fork from an entry above the break. Also `internal.error` (unclassified).
1961
+ `corrupt_session` — the session's stored log cannot be read, or (server >= 7.144.0) reads but is structurally broken (a dangling parent, a self-parent,
1962
+ a cycle or a missing leaf). DETERMINISTIC: a retry cannot change it (the SDK does not auto-retry this code) — switch to a new session or fork from an entry
1963
+ above the break. Servers 7.137.0–7.143.x answered the structurally broken form `invalid_session` (retired at 7.144.0). Known difference (7.144.0): when the
1964
+ replay dropped records and the branch broke at the missing parent, a run continues from the break while this view still answers 500 `corrupt_session`.
1965
+ Also `internal.error` (unclassified).
1958
1966
  content:
1959
1967
  application/json:
1960
1968
  schema: { $ref: '#/components/schemas/ErrorResponse' }
@@ -2110,6 +2118,9 @@ paths:
2110
2118
  description: >-
2111
2119
  `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`.
2112
2120
  FINAL — pick a new `forkId` and `forkNonce`. (Someone else's session answers `404 not_found.session`, byte-identical to an unknown source.)
2121
+ `conflict.session_archive_stamped` (server >= 7.144.0, `DB_BACKEND=local` only): the source session's stored archive still carries an owner stamp written by an earlier server version (left in place
2122
+ by the one-time data-root migration), so it cannot be forked; nothing was written. The only way out: delete that session and push it again (reads, resumes and pulls work as before). Servers
2123
+ 7.141.0–7.143.x answered it with the bare `conflict` (no `relation`). A plain ConflictError (the `conflict.` prefix family).
2113
2124
  content:
2114
2125
  application/json:
2115
2126
  schema: { $ref: '#/components/schemas/ErrorResponse' }
@@ -2122,9 +2133,10 @@ paths:
2122
2133
  schema: { $ref: '#/components/schemas/ErrorResponse' }
2123
2134
  '500':
2124
2135
  description: >-
2125
- 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
2126
- (the SQL session stores raise it while copying a structurally broken stored log) answers 500 `invalid_session` (it was `internal.error` before 7.137.0), `corrupt_session` answers 500 `corrupt_session` as before.
2127
- DETERMINISTIC: a retry cannot change either (the SDK does not auto-retry these codes) — start a new session. Also `internal.error` (unclassified).
2136
+ 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: `corrupt_session` answers 500 `corrupt_session` —
2137
+ server >= 7.144.0 that includes a structurally broken stored log met while copying (the SQL session stores walk the log through the engine). Servers 7.137.0–7.143.x answered that form
2138
+ 500 `invalid_session` (retired at 7.144.0); before 7.137.0 it was `internal.error`. DETERMINISTIC: a retry cannot change it (the SDK does not auto-retry this code) — start a new session.
2139
+ Also `internal.error` (unclassified).
2128
2140
  content:
2129
2141
  application/json:
2130
2142
  schema: { $ref: '#/components/schemas/ErrorResponse' }
@@ -2300,9 +2312,9 @@ paths:
2300
2312
  (declared 2026-07-31) errorCode "internal.error" — `routes/sessions.ts`'s catch around the owner
2301
2313
  lookup / subscribe setup, sent only when it fires BEFORE the SSE `200` headers went out
2302
2314
  (`!res.headersSent`); once streaming has started a failure just ends the connection instead.
2303
- That catch maps a session error through the shared table first: a session error with a mapped code answers that code (`corrupt_session`; since server 7.137.0 the table also maps `invalid_session` for a structurally broken stored log —
2304
- DETERMINISTIC: a retry cannot change it; the SDK does not auto-retry either code); any other failure stays `internal.error`. The mapping is there but this response does not occur on the stores the server ships:
2305
- none of the three stores the server ships (local file, PostgreSQL, MySQL-protocol) raises `invalid_session` before the stream starts — their head read does not walk the log's parent chain — so only a store of your own can reach it.
2315
+ That catch maps a session error through the shared table first: a session error with a mapped code answers that code (`corrupt_session` — DETERMINISTIC: a retry cannot change it; the SDK does not
2316
+ auto-retry it); any other failure stays `internal.error`. A structurally broken stored log (server >= 7.144.0 `corrupt_session`; 7.137.0–7.143.x `invalid_session`, retired) does not reach this
2317
+ response: none of the three stores the server ships (local file, PostgreSQL, MySQL-protocol) walks the log's parent chain in its head read before the stream starts — only a store of your own can.
2306
2318
  content:
2307
2319
  application/json:
2308
2320
  schema: { $ref: '#/components/schemas/ErrorResponse' }
@@ -3022,10 +3034,10 @@ paths:
3022
3034
  '404': { $ref: '#/components/responses/NotFound' }
3023
3035
  '500':
3024
3036
  description: >-
3025
- Two codes. server >= 7.137.0: `invalid_session` — the session's stored log reads but is structurally broken (a dangling parent, a self-parent,
3026
- a cycle or a missing leaf); this read answers it instead of `internal.error`. DETERMINISTIC: a retry cannot change it (the SDK does not
3027
- auto-retry this code) — switch to a new session or fork from an entry above the break.
3028
- Otherwise errorCode "internal.error" — `routes/sessions.ts`'s catch around `face.status(sessionId)`: core
3037
+ Two codes. `corrupt_session` — the session's stored log cannot be read, or (server >= 7.144.0) reads but is structurally broken (a dangling parent,
3038
+ a self-parent, a cycle or a missing leaf; servers 7.137.0–7.143.x answered that form `invalid_session`, retired at 7.144.0). DETERMINISTIC: a retry cannot change it
3039
+ (the SDK does not auto-retry this code) — switch to a new session or fork from an entry above the break.
3040
+ Otherwise errorCode `internal.error` — `routes/sessions.ts`'s catch around `face.status(sessionId)`: core
3029
3041
  promises the face never throws, so reaching this arm is an assembly defect; the server fails LOUD
3030
3042
  (500) rather than answering a plausible all-keys-absent body. The SDK maps it to
3031
3043
  `InternalServerError`. (codex R1 of the 7.3.1 batch: the arm exists in the shipped 7.53.0 route and
@@ -3505,7 +3517,10 @@ paths:
3505
3517
  description: >
3506
3518
  409 `conflict` — a `fork`/`stale` PUSH without `resolution:"overwrite-dst"` (carries `relation`; the SDK
3507
3519
  surfaces SyncConflictError), OR an active run (`session_active`, `activeTaskId`) / an in-flight import
3508
- (`import_in_flight`) on the session (ConflictError).
3520
+ (`import_in_flight`) on the session (ConflictError). `conflict.session_archive_stamped` (server >= 7.145.0, `DB_BACKEND=local` only):
3521
+ the same two shapes (`fork` / `stale` without consent) onto a stored archive that still carries an earlier version's owner stamp — body
3522
+ `{ error, errorCode }` only (no `relation`), no staging, no lease, nothing written; consent cannot help, the only way out is to delete that
3523
+ session and push it again. A plain ConflictError. Servers 7.144.x answered these two shapes here with the `relation`-carrying `conflict`.
3509
3524
  content:
3510
3525
  application/json:
3511
3526
  schema: { $ref: '#/components/schemas/SyncConflict' }
@@ -3563,7 +3578,12 @@ paths:
3563
3578
  schema: { $ref: '#/components/schemas/ErrorResponse' }
3564
3579
  '404': { $ref: '#/components/responses/NotFound' }
3565
3580
  '409':
3566
- description: 409 `conflict` — a commit-time TOCTOU re-classify flipped to fork/stale (carries `relation`).
3581
+ description: >-
3582
+ 409 `conflict` — a commit-time TOCTOU re-classify flipped to fork/stale (carries `relation`; SyncConflictError), or the owner cell changed while the import
3583
+ streamed (no `relation`; restart the sync from Phase A). `conflict.session_archive_stamped` (server >= 7.144.0, `DB_BACKEND=local` only; every
3584
+ log-changing push shape, the payload-fork `fast_forward` included, answers the same code and sentence): the target's stored archive still carries an owner
3585
+ stamp written by an earlier server version — nothing written; the only way out is to delete that session and push it again (restarting the sync hits the
3586
+ same refusal). Servers 7.141.0–7.143.x answered it with the bare `conflict` (no `relation`). A plain ConflictError.
3567
3587
  content:
3568
3588
  application/json:
3569
3589
  schema: { $ref: '#/components/schemas/SyncConflict' }
@@ -6516,8 +6536,8 @@ paths:
6516
6536
  x-status: gated # server routes/rules.ts;PERMISSION_RULES_ENABLED + 规则店装配,缺一 ⇒ 501 capability.rule_store_required。SDK rules.ccImportPrepare() 消费。
6517
6537
  summary: Preview a CC-settings rule import and mint a one-shot redemption ticket.
6518
6538
  description: >
6519
- Read the ALLOW buckets of 1–3 user-editable CC settings layers the caller submits, and answer with
6520
- what the import WOULD do plus a ticket.
6539
+ Read the permission lists (allow / deny / ask) of 1–3 user-editable CC settings layers the caller submits, and
6540
+ answer with what the import WOULD do plus a ticket.
6521
6541
 
6522
6542
  🔴 NO PERMISSION RULE is persisted by this call — only POST /v1/rules/cc-import/redeem reaches the
6523
6543
  writer. But the call is NOT free of durable state and NOT idempotent: every successful prepare writes
@@ -6526,8 +6546,8 @@ paths:
6526
6546
  rejection tries to discard the record it just created, best-effort — a leftover orphan pending record
6527
6547
  affects no adjudication, but it is not a promise of zero residue either.)
6528
6548
 
6529
- Only the allow bucket is read. The deny/ask buckets are the TIGHTENING direction and have their own
6530
- channel; importing them through a loosening lane would be the wrong door.
6549
+ All three lists are read (server >= 7.67.0 / engine 7.9.0; earlier servers read the allow list only): every candidate and every
6550
+ receipt row carries its `behavior`.
6531
6551
 
6532
6552
  The ticket is principal-bound, expiring (10 min), single-use (atomically consumed) and payload-bound
6533
6553
  (it pins a digest of the candidate set at mint time). It is NOT a cacheable credential and must never
@@ -6592,6 +6612,15 @@ paths:
6592
6612
  the ticket is STILL USABLE — retry as-is after `retryAfterSec` (echoed in `Retry-After`). Folding
6593
6613
  that into the 404 would tell a caller their confirmation is lost when it is not; the two call for
6594
6614
  opposite handling.
6615
+
6616
+ 🔴 SETTLE RULE (server >= 7.145.0, one rule for both redeem doors — cc-import and local-import answer the SAME receipt from ONE mint point):
6617
+ when the redemption walk completes with the engine's COMPLETE member table, the redemption settles — `200` + the receipt
6618
+ `RuleImportReceipt` `{ members, rev }`, one row per member in the engine's walk order. A member the engine refused is a row with
6619
+ outcome `indeterminate` + reason `store_refused` + `detail` (the engine's sentence verbatim: its refusal carries free text only, so the
6620
+ server does not guess whether it is a verdict or a transient, and neither claims it landed nor guarantees it did not); the ticket is
6621
+ USED (the same ticket again ⇒ 404). Reconcile against `GET /v1/rules` by `key` (the identity triple of a listing row); to fill a gap,
6622
+ run a fresh import (idempotent — landed members read `no-op`). `refused` is a RESERVED outcome word, not minted by this server.
6623
+ <= 7.144.x answered such a member with 503 `state.rule_import_retry` until the ticket expired, with the old body `{ result: { members, rev } }` (retired, no alias).
6595
6624
  requestBody:
6596
6625
  required: true
6597
6626
  content:
@@ -6607,17 +6636,19 @@ paths:
6607
6636
  description: What the import ACTUALLY did (a different moment and contract from the preview).
6608
6637
  content:
6609
6638
  application/json:
6610
- schema: { $ref: '#/components/schemas/CcImportRedeemResult' }
6639
+ schema: { $ref: '#/components/schemas/RuleImportReceipt' }
6611
6640
  '400': { $ref: '#/components/responses/BadRequest' } # request.body_shape — body is not {ticket}
6612
6641
  '401': { $ref: '#/components/responses/Unauthorized' }
6613
6642
  '404': { $ref: '#/components/responses/NotFound' } # not_found.rule_ticket — the UNIFORM arm (forged / another principal's / expired / already used). Never branch on the cause.
6614
6643
  '429': { $ref: '#/components/responses/RateLimited' }
6615
6644
  '503':
6616
6645
  description: >
6617
- errorCode `state.rule_import_retry` — the import could not complete right now (a transient store
6618
- wobble), the claim was released and THE TICKET IS STILL USABLE. Body carries `retryAfterSec`
6619
- and the same value rides `Retry-After`. Retry the SAME ticket. This is the only arm on this
6620
- endpoint a caller may distinguish from the uniform 404, and the distinction is load-bearing.
6646
+ errorCode `state.rule_import_retry` — the redemption ended WITHOUT a complete member table (server >= 7.145.0: the engine refused the
6647
+ whole batch before walking it, the member loop threw midway, the confirmation lost to a concurrent writer, or the store threw before the
6648
+ walk), the claim was released and THE TICKET IS STILL USABLE. Body carries `retryAfterSec` and the same value rides `Retry-After`.
6649
+ Retry the SAME ticket: it walks again and hands back the complete table (members landed by the interrupted walk read `no-op`). A refused
6650
+ MEMBER is not this arm — that redemption settles with a 200 receipt row `indeterminate`. This is the only error arm on this endpoint a
6651
+ caller may distinguish from the uniform 404, and the distinction is load-bearing.
6621
6652
  headers:
6622
6653
  Retry-After:
6623
6654
  schema: { type: integer }
@@ -10004,7 +10035,7 @@ components:
10004
10035
  scenario: { type: string }
10005
10036
  jobId: { type: string }
10006
10037
  source: { type: string, description: 'Credential-derived system attribution (service-pinned).' }
10007
- objectivePreview: { type: string, maxLength: 120, description: 'Objective, secret-redacted then truncated (service-pinned; older rows absent).' }
10038
+ objectivePreview: { type: string, maxLength: 120, description: 'Objective, secret-redacted then truncated (service-pinned). ABSENT when the run row has no preview: older rows, and from server >= 7.145.0 any run on a leg that declares a prompt screen (`prompt.submit` / `classic.UserPromptSubmit`, wildcards included) until the engine delivers the objective verbatim — absent for good when the screen rewrote / dropped it or the leg returns results only (`verify` / `cascade`). The same column feeds the inbox `objective`, the assistant-task `name`, the session-list `objectivePreview` and the fleet row `name`: read absence / `null` as "no preview", never as an empty string.' }
10008
10039
  owner: { type: string, description: 'Run owner principal (service-pinned; operator view).' }
10009
10040
  startedAt: { type: string, format: date-time }
10010
10041
  endedAt: { type: string, format: date-time }
@@ -14082,6 +14113,7 @@ components:
14082
14113
  content: { type: string }
14083
14114
  sentAt: { type: number, description: 'epoch ms.' }
14084
14115
  heldAt: { type: number, description: 'epoch ms.' }
14116
+ deadline: { type: number, description: 'server >= 7.144.0: the message''s expiry (epoch ms) = the core card''s `deadlineAt`, present only while the expiry timer is armed (absent = no timer, or an older server; never compute one from `heldAt`).' }
14085
14117
  fromSession: { type: string }
14086
14118
  fromName: { type: string }
14087
14119
  fromScope: { type: string }
@@ -14455,6 +14487,36 @@ components:
14455
14487
  while the row was minted earlier, so a hot governance change can make an old row's attribution
14456
14488
  drift in either direction. It feeds no gate/decision path — display only.
14457
14489
 
14490
+ CheckpointRowVerdict:
14491
+ description: >
14492
+ server >= 7.144.0 (core 7.62.0 `CheckpointRowVerdict`, projected verbatim) — WHETHER THIS ENGINE CAN RESUME THIS PARKED ROW: the verdict of the engine's row judge
14493
+ (`judgeCheckpointRow`) on the row's stored bytes. The same type on the operator queue row (`PendingCheckpoint.rowVerdict`), the `/v1/approvals/stream` `pending` frame and the
14494
+ assistant inbox row (`InboxRow.rowVerdict`). ONE JUDGE, TWO FACES: the first-stage resume / decide refusal (409, body carries `reason`) comes from the same judge, so a row
14495
+ listed with a non-`ok` verdict is refused for the same reason when decided — present it as NOT APPROVABLE; the way out is cancelling the run or leaving the row to a
14496
+ replica / version that can resume it. `ok` carries only `kind`; `lacking` / `damaged` carry `code` (the engine's checkpoint error code), `reason` (which arm of a multi-arm code), `requires` (capabilities the row needs and this engine lacks) and `sentence` (the engine's human line —
14497
+ display only, never a match key); `code` / `reason` are open strings (owned by core). Match the two faces on `reason`, not on `code`: the refusal
14498
+ face translates `checkpoint.invalid_outcome` (e.g. `requirements_damaged`) to `approval_binding_mismatch` on a `policy_ask` gate and to `resume_outcome_invalid` on other gates, and that
14499
+ engine refusal carries no `detail.code` (so no `blockedBy`); `checkpoint.unsupported_version` passes through unchanged. The refusal body's `reason` is the verdict's `reason`. ABSENT IS NOT `ok`: the listing did not judge the row (it left
14500
+ pending or its bytes changed between two reads, or an older server). server >= 7.145.0: on SQL backends a row whose stored body cannot be read as a checkpoint
14501
+ carries the verdict too (the judge answers on the raw bytes — always `damaged`) and is listed on both the operator queue and the assistant inbox (7.144.x
14502
+ listed it without this key and refused the whole inbox). An `ok` does not guarantee the decide succeeds: the judge does not inspect `pendingAction`, so a
14503
+ row missing only that is judged `ok` and its decide still fails (a known engine gap).
14504
+ oneOf:
14505
+ - type: object
14506
+ additionalProperties: false
14507
+ required: [kind]
14508
+ properties:
14509
+ kind: { const: ok }
14510
+ - type: object
14511
+ additionalProperties: false
14512
+ required: [kind, code, sentence]
14513
+ properties:
14514
+ kind: { type: string, enum: [lacking, damaged] }
14515
+ code: { type: string }
14516
+ reason: { type: string }
14517
+ requires: { type: array, items: { type: string } }
14518
+ sentence: { type: string }
14519
+
14458
14520
  PendingCheckpoint:
14459
14521
  type: object
14460
14522
  description: >
@@ -14478,6 +14540,18 @@ components:
14478
14540
  properties:
14479
14541
  kind: { const: checkpoint, description: 'server >= 7.143.0: the row family (always `checkpoint` on this schema); absent on servers <= 7.142.x, which list this family only.' }
14480
14542
  checkpointId: { type: string, minLength: 1, maxLength: 128, description: 'server >= 7.133.0: the NON-SECRET stable identity of the pause this row parks on — the join key where the token cannot go; the SAME value as `PausedCause.checkpointId`. Carried on three durable read surfaces (GET /v1/approvals `pending[]` rows, the /v1/approvals/stream `pending` frame, GET /v1/assistant/inbox rows). A row whose value is unreadable or untrusted (non-string / empty / over 128 / contains the token / an old row / an older server) is STILL LISTED with the key ABSENT — read absence as "this row has no joinable identity", never as a required key.' }
14543
+ rowVerdict:
14544
+ allOf: [{ $ref: '#/components/schemas/CheckpointRowVerdict' }]
14545
+ description: 'server >= 7.144.0: the engine row judge''s verdict on this row (ABSENT IS NOT `ok`). A non-`ok` row is refused for the same reason when decided (409). SQL backends read each pending row''s stored body once on the first listing after boot (then memoized by body digest); server >= 7.145.0 a row whose body cannot be read as a checkpoint carries it too (always `damaged`; 7.144.x listed that row without it).'
14546
+ agent:
14547
+ allOf: [{ $ref: '#/components/schemas/SessionAgent' }]
14548
+ description: >-
14549
+ server >= 7.145.0: where this row's session sits in the delegation tree — the SAME read port, type and value as the top-level `agent` of
14550
+ `GET /v1/sessions/{sessionId}` (the row's identity is its session). A background delegated child's parked row has an empty `taskId` and its own
14551
+ `sessionId`; an ownership judge reads `parentSessionId` / `rootSessionId` to link it back to the delegating session. ABSENT means this server did not
14552
+ say, NOT "not a child": a host session's own row, a synchronously delegated child, a `subagent_type: "fork"` background child (an ordinary fork of the
14553
+ parent session, still unlinkable), a store keeping no delegation tuple (`DB_BACKEND=memory`), local-backend child transcripts copied into the host store by
14554
+ 7.140.x and earlier, a read that failed (only that row lacks the key), or an older server.
14481
14555
  sessionId: { type: string, description: 'The decide handle: POST /v1/approvals/:sessionId/decide.' }
14482
14556
  scope: { type: string, description: 'Principal; "_" = submitted without one.' }
14483
14557
  taskId: { type: ['string', 'null'], description: 'Suspended run holding the session claim (service-pinned) — join key to trace tool-call blocks + context link.' }
@@ -14689,6 +14763,9 @@ components:
14689
14763
  properties:
14690
14764
  sessionId: { type: string, description: 'The suspended task/session id.' }
14691
14765
  checkpointId: { type: string, minLength: 1, maxLength: 128, description: 'server >= 7.133.0: the NON-SECRET stable identity of the pause this row parks on — the join key where the token cannot go; the SAME value as `PausedCause.checkpointId`. Carried on three durable read surfaces (GET /v1/approvals `pending[]` rows, the /v1/approvals/stream `pending` frame, GET /v1/assistant/inbox rows). A row whose value is unreadable or untrusted (non-string / empty / over 128 / contains the token / an old row / an older server) is STILL LISTED with the key ABSENT — read absence as "this row has no joinable identity", never as a required key.' }
14766
+ rowVerdict:
14767
+ allOf: [{ $ref: '#/components/schemas/CheckpointRowVerdict' }]
14768
+ description: 'server >= 7.144.0: the same verdict as `PendingCheckpoint.rowVerdict` (ABSENT IS NOT `ok`; both backends). server >= 7.145.0 on SQL backends: a row whose stored body cannot be read for its summary is LISTED (previously the whole inbox answered 500 / 503) with its column facts (`sessionId` / `scope` / `createdAt` / `gateKind` / `deadline` / `checkpointId`) plus this key; summary-derived keys are absent and `input` is `null`, while `objective` is still filled from the run row preview independently of the summary. A row whose gate kind column cannot be read is not listed. The verdict is usually non-`ok` (`damaged` …); exception: a row missing only `pendingAction` is judged `ok` and its decide still fails (a known engine gap). On `DB_BACKEND=local` that shape still answers the whole listing with 503 `approvals.read_unavailable`.'
14692
14769
  scope: { type: string, description: 'Multi-tenant owner scope.' }
14693
14770
  createdAt: { type: number, description: 'Ask creation time (epoch ms).' }
14694
14771
  gateKind:
@@ -16102,7 +16179,7 @@ components:
16102
16179
  additionalProperties: true
16103
16180
  properties:
16104
16181
  error: { type: string }
16105
- errorCode: { type: string, enum: [conflict, session_active, import_in_flight] }
16182
+ errorCode: { type: string, enum: [conflict, session_active, import_in_flight, conflict.session_archive_stamped], description: '`conflict.session_archive_stamped` (server >= 7.144.0, `DB_BACKEND=local`): the stored archive still carries an earlier version''s owner stamp — no `relation`, delete the session and push it again.' }
16106
16183
  relation: { $ref: '#/components/schemas/SyncRelation' }
16107
16184
  activeTaskId: { type: string, description: Present on `session_active` — the task holding the session lock. }
16108
16185
 
@@ -16183,7 +16260,9 @@ components:
16183
16260
  the branch to the 400 (the fix is the caller's either way: re-encode the id).
16184
16261
  🔴 DETERMINISTIC failure codes (K-24): a few codes arrive on a status that normally means "retry may help" (500 /
16185
16262
  503) while the server contract says a verbatim retry NEVER changes the verdict. The SDK's retry arm exempts them
16186
- by code: `corrupt_session` (500, server >= 7.104.0 / S-612 — the session's saved log cannot be read),
16263
+ by code: `corrupt_session` (500, server >= 7.104.0 / S-612 — the session's saved log cannot be read; server >= 7.144.0 also a stored log that reads but is
16264
+ structurally broken — a dangling parent, a self-parent, a cycle or a missing leaf — on every open face: `GET /v1/sessions/{id}`, `…/memory-status`, the synchronous `POST /v1/tasks`
16265
+ leg and `POST /v1/sessions/{id}/fork`; switch to a new session or fork from an entry above the break),
16187
16266
  `config.tool_name_too_long` / `config.tool_contract_too_long` / `config.tool_roster_bound` (503, server >=
16188
16267
  7.104.0 / S-271 — a deployment-declared tool exceeds the roster bound), `config.tool_schema_bound` (503, server >=
16189
16268
  7.106.0 / core 7.35.0 #765 — a tool's `parameters` schema exceeds the roster row's key bound; "same family, same tier";
@@ -16193,9 +16272,8 @@ components:
16193
16272
  principal is dangling; only re-pointing the assignment, or adding the scenario back to the deployment, helps) and
16194
16273
  `approvals.read_corrupt` (500, server >= 7.134.0 on `GET /v1/approvals` — a queue row's stored body cannot be read; an operator has to repair or
16195
16274
  delete the row; server >= 7.135.0 the same judge answers `GET /v1/assistant/inbox` and `GET /v1/assistant/tasks` too) and `workflow.journal_incompatible`
16196
- (500, server >= 7.135.0 on `GET /v1/workflows/{id}/journal` — a journal row the engine's judge rejects; the body carries `ordinal`; repair the row from the retained copy, never by deleting it) and
16197
- `invalid_session` (500, server >= 7.137.0 — a session whose stored log is structurally broken: a dangling parent, a self-parent, a cycle or a missing leaf; `GET /v1/sessions/{id}` and `…/memory-status` answer it instead of
16198
- `internal.error`, and the synchronous `POST /v1/tasks` leg answers it instead of `200` + a failed body, and so does `POST /v1/sessions/{id}/fork`, whose route has no mapping of its own and lets a session error escape to the server's top-level catch (`GET /v1/sessions/{id}/events` maps a session error through the same table before the stream starts, but none of the three stores the server ships raises `invalid_session` there — the code is mapped, the response does not occur on them); a retry cannot change it — switch to a new session or fork from an entry above the break).
16275
+ (500, server >= 7.135.0 on `GET /v1/workflows/{id}/journal` — a journal row the engine's judge rejects; the body carries `ordinal`; repair the row from the retained copy, never by deleting it).
16276
+ `invalid_session` (500 on servers 7.137.0–7.143.x for the structurally broken form) is RETIRED at server 7.144.0 and no longer exempt: against those older servers the SDK retries it by status.
16199
16277
  Every other 5xx code keeps the status-based retry.
16200
16278
  🔴 server >= 7.135.0 read-failure and store-fault codes (all additive; branch on the code, never the sentence): `503 approvals.read_unavailable` on `GET /v1/approvals`, `/v1/assistant/inbox` and
16201
16279
  `/v1/assistant/tasks` (the queue cannot be read RIGHT NOW — transient, retried by status; until a read succeeds an answer does NOT mean nothing is pending; it moved from the SSE-only table into the status-bearing catalog, status `-` → 503) and, on
@@ -16295,6 +16373,12 @@ components:
16295
16373
  On 409 refusals of a resume (server >= 7.132.0) and on 422 `parked_resume.startup_failed` (server >= 7.134.0 — the parked background agent's pre-claim failure; absent when the engine gave none): the engine's `CheckpointErrorReason` arm (`detail.reason` passed through; see `blockedBy`). On 409 `conflict.checkpoint_ctx_unsealable` (server >= 7.134.0): why the request's credentials cannot be sealed into, or unsealed from, the stored resume context — a closed five-word set (SDK `CHECKPOINT_CTX_UNSEALABLE_REASONS`); which doors can answer which word is written once, in the SDK documentation of `CHECKPOINT_CTX_UNSEALABLE_REASONS`, not here: `no_key_store` (this server has no sealed-key store) / `key_not_held` (sealed with a key this server does not hold — another replica's, or a replaced sealed-key directory) / `unopenable` (the sealed value is damaged or belongs to another session) / `plaintext` (an older server stored it unsealed) / `unrecognized_seal` (a seal format this version does not know) — the way out depends on the door and the `reason`: `key_not_held` (a resume door) — have the operator restore the sealed-key directory that sealed it and restart that replica (it reads its keys only at startup), then resend the same request; `no_key_store` on the submit door — give the service a writable sealed-key directory (`<data root>/sealed-key/`, read at startup), or resubmit WITHOUT those credentials — resending the same submit body is refused again; `no_key_store` on a resume door — the same way out as `key_not_held`: restore the directory that sealed it and restart, then resend (a fresh empty directory does not help: it holds no such key, so the next read says `key_not_held`); `unopenable` / `plaintext` / `unrecognized_seal` — submit the work as a new task (cancel the still-suspended one first); never auto-retry, never match the sentence. A resume door's refusal decides nothing and starts no resume (the card stays pending; the known exception is a terminal run's steer race arm, which first opens a wake card and, when the second read fails for any of the five reasons, withdraws it and then answers 409 — if the withdrawal fails the server only logs it); a submit door's refusal lands before the task runs (nothing runs; a run row already opened for it is closed as `failed` and its idempotency key released, both best-effort — a failed step is only logged by the server and the answer is still the 409). On 400 `rules.inert_entry` (server >= 7.129.0): the engine's `ALLOW_ENTRY_INERT_REASONS` (`tool_name` / `wildcard_all` / `namespace_wildcard` / `content_unsupported` / `grammar` / `near_miss` / `earlier_grammar`). Out-of-vocabulary word ⇒ treat as unknown. (Other codes carry their own `reason` words.)
16296
16374
  server >= 7.137.0: the THREE 400 `request.field_invalid` refusals of `inheritEnv` (a value outside the word set / a non-string / `"all"` on a non-host lane or a deployment with no authorizer session) carry `field: "inheritEnv"` and `reason` — one of
16297
16375
  `unknown_word` / `not_a_string` / `lane_not_host` / `no_authorizer_session` (SDK `INHERIT_ENV_REFUSAL_REASONS`); sentence, code and status are unchanged.
16376
+ thrownName:
16377
+ type: string
16378
+ minLength: 1
16379
+ description: >-
16380
+ server >= 7.144.0 (core 7.62.0): on a resume / decide 409 whose engine reason is `requirements_damaged` — the name of what the engine's row judge saw thrown while reading the
16381
+ parked row (present iff the engine named it as a non-empty string; absent otherwise). Diagnostic only, never a match key; beside `reason`. SDK `ResumeRefusalExtra.thrownName`.
16298
16382
  acceptableForm:
16299
16383
  description: >-
16300
16384
  server >= 7.137.0 (engine 7.56.0), on 409 `resume.constraint_rejected` only: the edit re-judgement (the deployment's resume-edit policy) accepts only the REWRITTEN form — this key is that form's input, read like a card's `args`
@@ -16767,7 +16851,10 @@ components:
16767
16851
  bgAgentId: { type: string }
16768
16852
  Event_text:
16769
16853
  type: object
16770
- description: durable stream only — turn-aggregated answer text (carries the E18 resume-handle eventId).
16854
+ description: >-
16855
+ durable stream only — turn-aggregated answer text (carries the E18 resume-handle eventId). server >= 7.144.0: one row = one SEGMENT (the live text segment's redaction
16856
+ unit is the same one); `text` = each block's original text in order — a block's per-chunk frame bytes, or for a block that has ONLY a `text_end` (no per-chunk frames) its
16857
+ text, which is in the row too (<= 7.143.x concatenated per-chunk bytes only, so such a block was missing).
16771
16858
  allOf: [{ $ref: '#/components/schemas/EventIdentity' }]
16772
16859
  additionalProperties: false # 封闭 + identity 本地镜像:见 Event_reasoning 处的长注
16773
16860
  required: [type, text]
@@ -16793,7 +16880,9 @@ components:
16793
16880
  bgAgentId: { type: string }
16794
16881
  Event_text_delta:
16795
16882
  type: object
16796
- description: live stream only — per-token answer fragment.
16883
+ description: >-
16884
+ live stream only — per-token answer fragment. server >= 7.144.0: the text segment's redaction state spans the engine's text blocks (the segment = the durable `text`
16885
+ row's unit; the engine's `text_end` only delivers a block) — for a block with per-chunk frames, their concatenation = that block's `text_end.content`.
16797
16886
  allOf: [{ $ref: '#/components/schemas/EventIdentity' }]
16798
16887
  additionalProperties: false # 封闭 + identity 本地镜像:见 Event_reasoning 处的长注
16799
16888
  required: [type, delta]
@@ -16807,9 +16896,11 @@ components:
16807
16896
  Event_text_end:
16808
16897
  type: object
16809
16898
  description: >
16810
- LIVE stream only (server >= 7.66.0, core 5.62.0) — the END-OF-SEGMENT signal for one assistant text
16811
- segment. `content` is the segment's AUTHORITATIVE full text (same trust class as `text_delta`, same
16812
- zero content transformation). It retires the "no delta for N ms => the segment must be over" idle-flush
16899
+ LIVE stream only (server >= 7.66.0, core 5.62.0) — the end signal of one engine assistant text BLOCK.
16900
+ server >= 7.144.0: it DELIVERS that block and does not close the segment (the segment = the durable `text` row's unit and may span blocks): `content` = this block's text,
16901
+ judged after the same segment's earlier text and delivering only this block's slice (a credential whose anchor sits in an earlier block is masked here too; <= 7.143.x
16902
+ judged each block alone). A block with per-chunk frames: their concatenation = `content`; a block with only this frame: its text is only here (and in the durable row).
16903
+ `content` is the block's AUTHORITATIVE text (same trust class as `text_delta`, same zero content transformation). It retires the "no delta for N ms => the segment must be over" idle-flush
16813
16904
  heuristic: the boundary is now stated by the engine, not guessed by a timer.
16814
16905
  🔴 A TRUNCATED segment gets NO such frame (core deliberately withholds it) — "no text_end" does NOT
16815
16906
  mean "the segment is still going". 🔴 The durable leg does not append it (the batched `text` event
@@ -17946,6 +18037,14 @@ components:
17946
18037
  kind: { type: string }
17947
18038
  outcome: { type: string }
17948
18039
  label: { type: string }
18040
+ rewrittenBy:
18041
+ type: array
18042
+ items: { type: string }
18043
+ description: >-
18044
+ server >= 7.144.0 (core 7.62.0): this input's text was REWRITTEN before delivery by the leg's prompt screen (an extension's `prompt.submit`) — the extensions that
18045
+ changed it, in the order they did (registration names). The model saw the rewritten text (the caller's own words were not delivered). Rides the frame the screening
18046
+ entrance mints (an objective's `"applied"` frame, a parked steer's or a wake message's, a live steer's `"queued"` frame). ABSENT = the text went as it came (or an older
18047
+ server); the server projects only non-empty names and omits an empty list. Attribution only, never authority.
17949
18048
  eventId: { type: string }
17950
18049
  parentToolCallId: { type: string }
17951
18050
  sourceTaskId: { type: string }
@@ -18510,7 +18609,7 @@ components:
18510
18609
  activity: { type: string }
18511
18610
  summaryParams: { type: array, items: { type: string } }
18512
18611
  resultCards: { type: array, items: { type: string } }
18513
- approvalCard: { type: string, enum: [file-edit, file-write, notebook-edit, shell, fetch, plan, question, generic] }
18612
+ approvalCard: { type: string, enum: [file-edit, file-write, notebook-edit, shell, fetch, skill, workflow, plan, question, generic, computer-access, computer-control] }
18514
18613
  McpToolRuleFace:
18515
18614
  type: object
18516
18615
  additionalProperties: false
@@ -18639,21 +18738,21 @@ components:
18639
18738
  `detail.taskId`; absent when the leg has no run resource (a streaming leg on a deployment without a run store) or on an older
18640
18739
  server. NO `runId` (the model-call layer cannot see the engine's run identity): a resume leg and its original leg share the
18641
18740
  `taskId`. Once per leg per target; it says "this endpoint is unreachable", not "this run failed".
18642
- `session.records_skipped` (K-24; server >= 7.104.0 / S-612 form B; contract §17.4 / appendix D.3) — 🔴 SERVER-MINTED
18643
- (not in core's register; owner, audience `user` and mint all live in the server). The session's saved log was
18644
- OPENED and some records could not be read and were skipped (file session backend only — both SQL backends refuse a
18645
- bad row with `corrupt_session`); the session woke up and THIS TURN RUNS, but the model sees a shorter history.
18646
- `{ dropped, entriesKept, sessionId }`: `dropped` = records skipped by this replay, `entriesKept` = surviving entries
18647
- counted after the open succeeded (the meta header not counted); both are observed counts — do NO arithmetic (there
18648
- is no "total"); `entriesKept === 0` = header present, no entry left (empty context, the turn still runs). NO `runId`
18649
- (minted inside the session store's open; attribution = whichever run's stream / ledger it lands on). Deduplicated
18650
- ONCE PER OPEN: until the log is repaired every real open emits again; a turn served from the server's session cache
18651
- (`SESSION_CACHE_TTL_SEC`, default 300 s) does not reopen and emits nothing — an event, not a standing state. Only an
18652
- open "for this session itself" mints it (a list / export / head / ownership probe reading another session's bad log
18653
- does not). ⚠️ When a skipped record is an ancestor of the current leaf the turn then fails `invalid_session` in
18654
- prepare (core #1077) — the frame still arrives first. ⚠️ The non-streaming synchronous `POST /v1/tasks` registers no
18655
- notice delivery (every `engine_notice` code alike), so there it reaches the operator log only. A log that cannot be
18656
- read AT ALL (no meta header) emits no frame — that turn is refused with 500 `corrupt_session`.
18741
+ `session.records_skipped` (RETIRED at server 7.144.0, no alias; server-minted on 7.104.0–7.143.x with `{ dropped, entriesKept, sessionId }`) — the same fact is
18742
+ now the engine's `session.lineage_rerooted` (below). A consumer branching on the old code reads the new one: `recordsDropped` = the old `dropped`; `entriesOnPath`
18743
+ (the entries the run's context keeps) is NOT the old `entriesKept` (all surviving entries).
18744
+ `session.lineage_rerooted` (server >= 7.144.0 / core 7.62.0; audience `user`; D.3 stays at 48 codes — one code out, one in; file session backend only) — the session this run continues
18745
+ has a log whose replay dropped records it could not read, and this says what the run lost. Two forms, told apart by `detail.break`: `true` — the branch the run reads broke at a parent the
18746
+ log does not hold, and the run continues from the entry that names that parent instead of failing (the synchronous leg answers 200); `false` — the branch is whole (the log's last records
18747
+ were unreadable and its head fell back to the last one still readable, or the damage sat off the branch) and the run continues from `leaf`.
18748
+ `{ break, recordsDropped, recordsTotal, leaf, entriesOnPath, sessionId, runId }` and, when `break` is `true`, `{ missingParentId, rootedAt, entriesCut }` — the replay's count (records, not
18749
+ entries) and its total records (`recordsDropped` of them unreadable), the entry the run continues from (`null` = nothing of the log is readable; always a string when `break` is `true`), the branch's length, the parent not in the
18750
+ log, the entry the branch starts at, and how many entries the log holds that do not descend from `rootedAt`. Counts and entry ids only, never a record's words. Once per prepared leg for a
18751
+ whole branch, once per break for a broken one (and then the whole-branch form is not said); a turn served from the session cache announces too. A break the replay cannot account for (it
18752
+ dropped nothing: a dangling parent, a self-parent, a cycle or a missing leaf) is NOT re-rooted — that turn is refused `corrupt_session` (500 on the synchronous leg; the same code and the
18753
+ same client action as a log that cannot be read at all: do not retry — start a new session or fork from an entry above the break). Servers 7.137.0–7.143.x answered that form
18754
+ `invalid_session`; 7.144.0 retires it from every open face. ⚠️ Known difference: the run continues, while the session view (`GET /v1/sessions/{id}` / `…/memory-status`) still
18755
+ answers 500 `corrupt_session` for the same break.
18657
18756
  PERMISSION-MODE FIVE (K-32; server >= 7.106.0 / core 7.34.0 design/1111 + C-R172; contract appendix D.3 26 → 31 codes; owner
18658
18757
  core, words passed through verbatim): `classifier.unavailable` — the auto-mode classifier could not judge the call (error, or
18659
18758
  the per-rung `AUTO_MODE_CLASSIFIER_TIMEOUT_MS` budget ran out), `{ toolName, toolCallId, cause, disposition, sessionId?, runId? }`,
@@ -20794,8 +20893,11 @@ components:
20794
20893
 
20795
20894
  ToolApprovalCardWord:
20796
20895
  type: string
20797
- enum: [file-edit, file-write, notebook-edit, shell, fetch, plan, question, generic]
20896
+ enum: [file-edit, file-write, notebook-edit, shell, fetch, skill, workflow, plan, question, generic, computer-access, computer-control]
20798
20897
  description: >
20898
+ sdk 34.0.0: twelve words = core 7.62.0 / server 7.144.0 `TOOL_APPROVAL_CARDS` (`skill` / `workflow` were already in the engine's register at core 7.59.0 and were missing here;
20899
+ `computer-access` — the consent card of a tool that hands the model the user's screen, the call carries `apps`, the list asked for — and `computer-control` — that tool's
20900
+ other consent card, the call carries nothing the card needs — are new in core 7.62.0; what each grants is per connection).
20799
20901
  server >= 7.126.0 (core 7.49.0 `TOOL_APPROVAL_CARDS`, verbatim and in order; contract table B `approvalCard` row) — WHICH CARD an approval ask renders on: the one word the engine mints at the gate, the
20800
20902
  ONLY card-word source (it replaces the tool-name-derived `contentKind`). `question` = a question put to the user (the engine's reserved question tool — not a side-effecting tool; a consumer that read
20801
20903
  `contentKind === "content_ask"` reads `approvalCard === "question"`); `generic` = a card with no dedicated renderer. CLOSED set; new words join with a core minor, so a switch on it keeps a default arm.
@@ -21603,6 +21705,12 @@ components:
21603
21705
  sessionId: { type: string, description: '`resolved` frames (checkpoint family): which pending settled.' }
21604
21706
  toolCallId: { type: string, description: '`resolved` frames: the settled pending''s bound tool-call id (absent when the pending carried none).' }
21605
21707
  count: { type: integer, description: '`synced` frames: how many pendings the connect-time snapshot carried.' }
21708
+ rowVerdict:
21709
+ allOf: [{ $ref: '#/components/schemas/CheckpointRowVerdict' }]
21710
+ description: '`pending` frames only (server >= 7.144.0): the spread PendingCheckpoint row''s `rowVerdict` (ABSENT IS NOT `ok`).'
21711
+ agent:
21712
+ allOf: [{ $ref: '#/components/schemas/SessionAgent' }]
21713
+ description: '`pending` frames of the checkpoint family only (server >= 7.145.0): the spread PendingCheckpoint row''s `agent` (same read port; `resolved` frames do not carry it; absent = this server did not say, not "not a child").'
21606
21714
  checkpointId: { type: string, description: '`pending` frames only (server >= 7.133.0): the spread PendingCheckpoint row''s `checkpointId` (key absent when the row has no trusted value — read as "no joinable identity").' }
21607
21715
  consumerState: { type: string, enum: [absent], description: '`live_pending` frames only (server >= 7.133.0): the spread LivePendingRow''s true-only `consumerState` (no engine leg on this replica is waiting for the ask).' }
21608
21716
  errorCode: { type: string, description: '`error` frames: the machine code (`STREAM_MAX_DURATION` / `draining` / server >= 7.133.0 `approvals.read_unavailable` — the stream STAYS open, do NOT reconnect on it — / `approvals.read_corrupt` — a corrupt row was read, the server closes the stream after the frame).' }
@@ -23816,7 +23924,7 @@ components:
23816
23924
 
23817
23925
  ⚠️ ON THIS HTTP ROUTE `found` IS ALWAYS TRUE. Upstream only writes false when its injected file reader
23818
23926
  returns undefined or throws, and the server adapter hands back the request's own REQUIRED `content`
23819
- field — so it can never be absent. Empty text, `{}`, and a file with no allow bucket all still report
23927
+ field — so it can never be absent. Empty text, `{}`, and a file with no permission lists all still report
23820
23928
  `found: true` (they simply yield no candidates). Do NOT use `found` as "did this layer contribute
23821
23929
  rules" — read `candidates` for that. The field is kept because it is part of core's preview shape
23822
23930
  (it only discriminates for a host whose reader touches a real filesystem).
@@ -23832,7 +23940,7 @@ components:
23832
23940
  description: >
23833
23941
  One settings layer submitted to rulesCcImportPrepare. The CONTENT is submitted by the caller because a
23834
23942
  cloud deployment has no access to the user's filesystem — that is the deployment shape, not a bypass:
23835
- what is read is still only the allow bucket.
23943
+ the server reads exactly the permission lists of that submitted content.
23836
23944
 
23837
23945
  🔴 TWO ARMS BY `layer` (server >= 7.143.0 / engine 7.61.0, BREAKING, no alias): a `userSettings` layer is `{ layer, path, content }` and carries
23838
23946
  NO `root` (a body sending one ⇒ 400 `request.body_shape`; its `/`-rooted path rules stay in the settings file, reported as
@@ -23919,58 +24027,60 @@ components:
23919
24027
  never hand it to another user.
23920
24028
  expiresAtMs: { type: integer, description: 'Absolute server-clock expiry (the window is 10 minutes — one interaction, not a session).' }
23921
24029
 
23922
- CcImportRedeemedMember:
24030
+ RuleImportKey:
23923
24031
  type: object
23924
- description: >
23925
- One member of the redeem 200 (core `RedeemedBatchMember`, the 200-REACHABLE arm verbatim — core d.ts
23926
- permission-rule-consent.d.ts). The union's third arm `{status:"refused", reason}` is STRUCTURALLY
23927
- UNREACHABLE on this route's 200: any refused member makes the server treat the whole redeem as
23928
- indeterminate, release the claim and answer 503 `state.rule_import_retry` (server rules-consent.ts) —
23929
- so this schema honestly describes the two-value `status` only.
23930
24032
  additionalProperties: false
23931
- required: [candidateIndex, behavior, rule, scope, status, alreadyRedeemed, dot]
24033
+ description: >
24034
+ server >= 7.145.0 — a rule's identity in a rule-import redemption receipt: the SAME identity triple as a `GET /v1/rules` listing row
24035
+ (`behavior` + canonical `rule` text + the discriminated `scope` string `global` / `project:<root>`, NOT the preview's `RuleScope` object).
24036
+ Reconcile a receipt row against the listing by comparing these three fields; pass them verbatim to `DELETE /v1/rules`.
24037
+ required: [behavior, rule, scope]
23932
24038
  properties:
23933
- candidateIndex: { type: integer, description: 'Index into the prepare preview''s candidate set (candidate space).' }
23934
- behavior:
23935
- allOf: [{ $ref: '#/components/schemas/RuleBehavior' }]
23936
- description: 'server >= 7.67.0 / core 7.9.0 #625 — which of the three the landed row is (same value as the same-index candidate in the preview; one leg of the identity triple).'
23937
- rule: { type: string, description: 'Canonical rule text.' }
23938
- scope: { $ref: '#/components/schemas/RuleScope' }
23939
- status:
23940
- type: string
23941
- enum: [persisted, deduped]
23942
- description: '`persisted` = landed this redeem; `deduped` = an equal rule was already in the store (the consent took effect — not a failure).'
23943
- alreadyRedeemed: { type: boolean, description: 'true = this outcome was REPLAYED verbatim from the ticket row (lost-response retry; idempotency evidence — zero double-mint).' }
23944
- dot: { $ref: '#/components/schemas/RuleDot' }
24039
+ behavior: { $ref: '#/components/schemas/RuleBehavior' }
24040
+ rule: { type: string, minLength: 1 }
24041
+ scope: { type: string, minLength: 1 }
24042
+
24043
+ RuleImportMember:
24044
+ description: >
24045
+ server >= 7.145.0 — one row of the redemption receipt (server `ImportOutcomeMember`), two arms on `outcome`:
24046
+ `persisted` = written by this redemption; `no-op` = an equal rule was already in the store (the engine's `deduped`);
24047
+ `refused` = RESERVED (known refused, known not written) — NOT minted by this server version: the engine's member refusal carries free
24048
+ text only; the word appears once the engine gives the refusal arm a machine-readable verdict bit (that version adds its fields to this arm);
24049
+ `indeterminate` = the engine refused this member and the cause is free text only — it is NOT KNOWN whether it landed: exactly then the row
24050
+ carries `reason: store_refused` and `detail` (the engine's sentence verbatim). The four words are a closed set (the server's persisted
24051
+ receipt schema reads the same table).
24052
+ oneOf:
24053
+ - type: object
24054
+ additionalProperties: false
24055
+ required: [key, outcome]
24056
+ properties:
24057
+ key: { $ref: '#/components/schemas/RuleImportKey' }
24058
+ outcome: { type: string, enum: [persisted, no-op, refused] }
24059
+ - type: object
24060
+ additionalProperties: false
24061
+ required: [key, outcome, reason, detail]
24062
+ properties:
24063
+ key: { $ref: '#/components/schemas/RuleImportKey' }
24064
+ outcome: { const: indeterminate }
24065
+ reason: { const: store_refused }
24066
+ detail: { type: string }
23945
24067
 
23946
- CcImportResult:
24068
+ RuleImportReceipt:
23947
24069
  type: object
23948
- description: >
23949
- What the import ACTUALLY did (server >= 7.46.0, BREAKING #2 there / core 5.58.0 redeemRuleBatch
23950
- members passthrough) — a different moment and a different contract from the preview, because dedup,
23951
- concurrency and redemption-time validation can each move an entry between the two.
23952
-
23953
- 🔴 SHAPE CHANGE (A-075.13): the old three-bucket form `{persisted[], deduped[], skippedAtRedeem[],
23954
- rev}` left the wire in server 7.46.0 — a consumer reading `result.persisted.length` gets undefined.
23955
- This schema describes the real wire since then; the SDK type changed with it (a staleness fix, not a
23956
- behavior change).
23957
24070
  additionalProperties: false
24071
+ description: >
24072
+ server >= 7.145.0 — the 200 body of rulesCcImportRedeem: the rule-import REDEMPTION RECEIPT, the same receipt (one mint point) as
24073
+ `POST /v1/rules/local-import/redeem` (a door this SDK does not wrap). Replaces the <= 7.144.x cc-import body
24074
+ `{ result: { members: <engine RedeemedBatchMember rows: candidateIndex / behavior / rule / scope object / status / alreadyRedeemed / dot>, rev } }`,
24075
+ which left the wire (the SDK's `CcImportRedeemResult` / `CcImportResult` / `CcImportRedeemedMember` are deleted, no alias). See the
24076
+ endpoint description for the settle rule.
23958
24077
  required: [members, rev]
23959
24078
  properties:
23960
24079
  members:
23961
24080
  type: array
23962
- items: { $ref: '#/components/schemas/CcImportRedeemedMember' }
23963
- description: 'Per-candidate outcome (discriminate on `status`; refused never rides a 200 — see CcImportRedeemedMember).'
23964
- rev: { type: integer, description: 'The rule store''s monotonic revision after the batch.' }
23965
-
23966
- CcImportRedeemResult:
23967
- type: object
23968
- description: 'The 200 body of rulesCcImportRedeem.'
23969
- additionalProperties: false
23970
- required: [result]
23971
- properties:
23972
- result: { $ref: '#/components/schemas/CcImportResult' }
23973
-
24081
+ items: { $ref: '#/components/schemas/RuleImportMember' }
24082
+ description: 'One row per member, in the engine''s walk order.'
24083
+ rev: { type: integer, minimum: 0, description: 'The bucket''s OCC revision when the redemption finished (bucket-local; not comparable across principals).' }
23974
24084
  # ── design/203 §2 撤销面(server 7.12.0)—— 列举行 + 两口的 200 体 ────────────────────────────────
23975
24085
  # 行形逐字段照 server `src/rules-consent.ts` 的 `PersistedRuleWireRow`(它自己逐字段照 core 的
23976
24086
  # `PersistedAllowRule`,只把 `scope` 换成判别式串)。