@sema-agent/sdk 31.0.0 → 32.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +71 -0
  2. package/dist/errors.d.ts +42 -4
  3. package/dist/errors.d.ts.map +1 -1
  4. package/dist/errors.js +24 -3
  5. package/dist/errors.js.map +1 -1
  6. package/dist/events.d.ts +20 -15
  7. package/dist/events.d.ts.map +1 -1
  8. package/dist/events.js.map +1 -1
  9. package/dist/idempotency.d.ts +2 -1
  10. package/dist/idempotency.d.ts.map +1 -1
  11. package/dist/idempotency.js +2 -1
  12. package/dist/idempotency.js.map +1 -1
  13. package/dist/index.d.ts +7 -1
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +4 -0
  16. package/dist/index.js.map +1 -1
  17. package/dist/resources/approvals.d.ts +5 -0
  18. package/dist/resources/approvals.d.ts.map +1 -1
  19. package/dist/resources/approvals.js +5 -0
  20. package/dist/resources/approvals.js.map +1 -1
  21. package/dist/resources/attachments.d.ts +7 -1
  22. package/dist/resources/attachments.d.ts.map +1 -1
  23. package/dist/resources/attachments.js +7 -1
  24. package/dist/resources/attachments.js.map +1 -1
  25. package/dist/resources/fleet.d.ts +7 -5
  26. package/dist/resources/fleet.d.ts.map +1 -1
  27. package/dist/resources/fleet.js.map +1 -1
  28. package/dist/resources/memory.d.ts +9 -2
  29. package/dist/resources/memory.d.ts.map +1 -1
  30. package/dist/resources/memory.js +9 -2
  31. package/dist/resources/memory.js.map +1 -1
  32. package/dist/resources/runs.d.ts +5 -1
  33. package/dist/resources/runs.d.ts.map +1 -1
  34. package/dist/resources/runs.js +3 -1
  35. package/dist/resources/runs.js.map +1 -1
  36. package/dist/resources/sessions.d.ts +27 -2
  37. package/dist/resources/sessions.d.ts.map +1 -1
  38. package/dist/resources/sessions.js +31 -1
  39. package/dist/resources/sessions.js.map +1 -1
  40. package/dist/resources/tasks.d.ts +7 -6
  41. package/dist/resources/tasks.d.ts.map +1 -1
  42. package/dist/resources/tasks.js +7 -6
  43. package/dist/resources/tasks.js.map +1 -1
  44. package/dist/settings.d.ts +15 -4
  45. package/dist/settings.d.ts.map +1 -1
  46. package/dist/sse.d.ts +6 -4
  47. package/dist/sse.d.ts.map +1 -1
  48. package/dist/sse.js.map +1 -1
  49. package/dist/types.d.ts +178 -76
  50. package/dist/types.d.ts.map +1 -1
  51. package/dist/types.js.map +1 -1
  52. package/openapi.yaml +294 -85
  53. package/package.json +1 -1
package/openapi.yaml CHANGED
@@ -430,9 +430,11 @@ paths:
430
430
  as 200 with a failed body (`terminal.code`; billed; a same-key resend replays). Multi-tier callers must read both
431
431
  forms. On a park the 200 body is the result itself plus the three poll-receipt keys (`SyncSubmitResult`, S-173).
432
432
  🔴 IDEMPOTENT REPLAY (server >= 7.125.0, contract §0.7): a same-key resubmit that finds the run row the key already built (another process, another
433
- replica, a restart, or an original request that has since settled) does NOT run again and does NOT answer the first answer's engine-result shape —
434
- it answers `200` with that run's READ FACE (`GET /v1/runs/{taskId}`) plus `replay: true` (`RunReplayRecord`). Branch on `replay === true`; the outcome is
435
- in `result` (a nested `TaskResult`), and `wiringManifest` / `notice` are absent. A same-key duplicate that is still IN FLIGHT in the same process is merged
433
+ replica, a restart, or an original request that has since settled) does NOT run again. server >= 7.142.0 answers `200` with the FIRST ANSWER'S ENVELOPE plus
434
+ `replay: true` (`SyncSubmitOutcome`): the row holds an engine result ⇒ that result (a park adds the three receipt keys, as on a first answer); it holds none
435
+ (still running, or lost) ⇒ the three receipt keys `{taskId, sessionId, status}` (`SyncReceiptBody`; read the row at `GET /v1/runs/{taskId}`).
436
+ server 7.125.0–7.141.x answered the row's read face plus `replay: true` instead — that body has no `stats` and reads as the receipt arm.
437
+ `replay: true` says "this is a same-key replay", never which shape. A same-key duplicate that is still IN FLIGHT in the same process is merged
436
438
  instead and gets the first answer's bytes (no `replay` key). Only a submit that builds a row can be replayed this way (a run store AND a `sessionId`);
437
439
  otherwise a settled key re-runs. A key whose row the caller cannot read answers 409 `conflict.run_exists`.
438
440
  🔴 SAME KEY = SAME BODY (server >= 7.126.0, contract §0.7): resubmitting the same `Idempotency-Key` with a DIFFERENT request body is 409
@@ -447,17 +449,12 @@ paths:
447
449
  responses:
448
450
  '200':
449
451
  description: >-
450
- One of two shapes, told apart by the `replay` key. (1) The task result (`SyncSubmitResult`): the sealed + redacted engine result; on a park (`terminal.kind:"paused"`)
451
- it additionally carries the poll receipt `{taskId, sessionId, status}` with `status` ∈ {suspended, needs_review}
452
- (server >= 7.104.0 / S-173 — before that a park answered ONLY those three keys). Terminal bodies carry no `status`
453
- on >= 7.64; a server <= 7.63 answers the flat form instead (terminal word in `status`, no `terminal`) — see SyncSubmitResult.
454
- (2) server >= 7.125.0, same-key replay: the existing run's read face with `replay: true` (`RunReplayRecord`) — NOT an engine result.
452
+ `SyncSubmitOutcome` — one rule: is there an engine result in hand? `stats` present ⇒ the engine result (`SyncSubmitResult`; a park adds the poll receipt;
453
+ a server <= 7.63 answers the flat `LegacyPlaneTaskResult`); `stats` absent ⇒ the run receipt `{taskId, sessionId, status}` (`SyncReceiptBody`). A same-key
454
+ replay (server >= 7.125.0) carries `replay: true` on whichever arm it is.
455
455
  content:
456
456
  application/json:
457
- schema:
458
- oneOf:
459
- - $ref: '#/components/schemas/SyncSubmitResult'
460
- - $ref: '#/components/schemas/RunReplayRecord'
457
+ schema: { $ref: '#/components/schemas/SyncSubmitOutcome' }
461
458
  '400': { $ref: '#/components/responses/BadRequest' }
462
459
  '401': { $ref: '#/components/responses/Unauthorized' }
463
460
  '403': { $ref: '#/components/responses/Forbidden' } # (declared 2026-08-01) 带 `sessionId` 复用他人会话:归属不匹配 ⇒ 403(自公开快照起点即有,spec 此前漏登记)。server 3.15.0 起多一个触发条件:多租部署上 session store 无归属判别能力时,复用**任何** caller 自报的 sessionId 都 403(含本 worker 自己刚铸的 —— 无 register seam 时归属从未被记下)。core 2.11.0 起默认内存店自带该能力 ⇒ 该触发条件在默认部署上不再出现。 ⚠️ (declared 2026-08-05,server >=7.0.0)`memory.admission_denied` 也走本状态 —— 本状态的 producer 全清单与分支判据写在 `Forbidden` 组件的 description 里(**那段是被解析的**,本行注释只是指路,不复述以免两处漂移)。
@@ -3142,6 +3139,53 @@ paths:
3142
3139
  # three-conjunct predicate was disproven in the field ([2024]) when a warm-cache wrapper store forwarded the
3143
3140
  # other three and dropped the staging family, so caps said true while PUSH Phase A 501'd forever.
3144
3141
  # Owner-gated like fork/delete (§9): a PULL 404s a non-owner; a PUSH is own-or-FRESH.
3142
+ /v1/sessions/{sessionId}/memory/sync:
3143
+ parameters:
3144
+ - $ref: '#/components/parameters/PrincipalHeader'
3145
+ - in: path
3146
+ name: sessionId
3147
+ required: true
3148
+ schema: { type: string }
3149
+ post:
3150
+ tags: [sessions]
3151
+ operationId: sessionsSyncMemory
3152
+ x-status: gated # server 7.142.0 `routes/session-memory-sync.js`; capability bit `sessionMemorySync` (501 without the facilities). SDK sessions.syncMemory.
3153
+ summary: Push the memory layers this session reads to the engine it is going to (local shell, before a fork to the cloud).
3154
+ description: >
3155
+ server >= 7.142.0. On the local shape (file memory engine + `MEMORY_SYNC_URL` + a durable run ledger) a shell calls this BEFORE forking the session to another
3156
+ engine. The body is exactly `{ "target": <that engine's GET /v1/capabilities memorySyncServe.identity, verbatim> }`. Gate order: 501 (no sync leg
3157
+ `feature.memory_sync_disabled` / no durable run store `capability.run_store_required` / no session-ownership face `capability.session_ownership_required`) →
3158
+ principal → rate limit → 404 `not_found.session` (unknown and foreign alike) → 400 `request.body_shape` (not exactly `{target}`) → 400 `request.field_invalid`
3159
+ (`field: "target"`, `reason` one of the seven sync-identity flaws; the value is never echoed) → 409 `conflict.session_memory_unobserved` (no read set: the session has no
3160
+ settled run with a memory observation; `activeTaskId` when a run is in flight) → 200 with the engine's sync report (`SessionMemorySyncReport`): a whole-round `refused`
3161
+ (`config.memory_sync_target_mismatch` — the target is not the engine this machine's sync leg reaches; `session_active` — a run is in flight, or the session moved after
3162
+ its read set was taken) or one outcome per layer. The read set is the memory observation of the session's latest settled run; each project layer of it the sync leg
3163
+ covers JOINS THIS PROCESS'S BACKGROUND SYNC SET PERMANENTLY (until the process exits: one more cursor, a few more round trips per round).
3164
+ requestBody:
3165
+ required: true
3166
+ content:
3167
+ application/json:
3168
+ schema: { $ref: '#/components/schemas/SessionMemorySyncRequest' }
3169
+ responses:
3170
+ '200':
3171
+ description: The engine's sync report.
3172
+ content:
3173
+ application/json:
3174
+ schema: { $ref: '#/components/schemas/SessionMemorySyncReport' }
3175
+ '400':
3176
+ description: '`request.path_malformed` · `request.body_shape` (the body is not exactly `{target}`) · `request.field_invalid` (`field: "target"`, `reason` = a sync-identity flaw: not-http-url / userinfo / query / fragment / credential / too-long / not-canonical).'
3177
+ content:
3178
+ application/json:
3179
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
3180
+ '401': { $ref: '#/components/responses/Unauthorized' }
3181
+ '404': { description: 'errorCode "not_found.session" — unknown session AND another principal''s session, byte-identical (anti-enumeration).' }
3182
+ '409':
3183
+ description: '`conflict.session_memory_unobserved` — no read set yet (the session has no settled run with a memory observation); carries `activeTaskId` when a run is in flight.'
3184
+ content:
3185
+ application/json:
3186
+ schema: { $ref: '#/components/schemas/ErrorResponse' }
3187
+ '500': { description: 'errorCode "internal.error" — the engine refused to mint the report.' }
3188
+ '501': { description: '`feature.memory_sync_disabled` (no local sync leg) · `capability.run_store_required` · `capability.session_ownership_required` — capability bit `sessionMemorySync` is false.' }
3145
3189
  /v1/sessions/{sessionId}/sync/manifest:
3146
3190
  parameters:
3147
3191
  - $ref: '#/components/parameters/PrincipalHeader'
@@ -4979,13 +5023,17 @@ paths:
4979
5023
  boundary) -> 415 `attachment.mime_not_allowed` with the allowed set. Unreferenced uploads are
4980
5024
  reaped after a TTL (default 24h) — submit soon after uploading. 501 without an attachment store
4981
5025
  (local without backend / cloud backend without object storage configured).
5026
+ PROJECT BUNDLE (server >= 7.142.0): content-type `application/vnd.sema.project-bundle` (SDK `PROJECT_BUNDLE_MIME`) = a gzip POSIX tar whose top level is the
5027
+ work root — the seed of an isolated-lane session's workspace. It is read at upload: unreadable => 400 `attachment.bundle_invalid` with `reason` (seven-word closed set,
5028
+ SDK `PROJECT_BUNDLE_INVALID_REASONS`: not_archive / unsafe_path / entry_type / reserved_path / duplicate_path / expanded_too_large / too_many_entries) and `path`
5029
+ (present when readable and not an over-long path). A deployment with a mime allowlist must add this mime (else 415). An older server stores it as a plain attachment.
4982
5030
  responses:
4983
5031
  '201':
4984
5032
  description: Uploaded.
4985
5033
  content:
4986
5034
  application/json:
4987
5035
  schema: { $ref: '#/components/schemas/AttachmentInfo' }
4988
- '400': { description: 'missing/unsafe name, malformed mime' }
5036
+ '400': { description: 'missing/unsafe name, malformed mime (`request.query_invalid`); server >= 7.142.0 `attachment.bundle_invalid` (`reason`, `path?`) for an unreadable project bundle' }
4989
5037
  '401':
4990
5038
  description: >-
4991
5039
  (declared 2026-07-31) errorCode "auth.principal_required" — `routes/attachments.ts` requires a
@@ -7889,6 +7937,10 @@ components:
7889
7937
  objective gets an appended notice (names/mime/sizes only — content never enters the durable
7890
7938
  stream). Unknown/foreign id -> 400 on a fresh submit. Named `attachmentIds` because `attachments`
7891
7939
  is taken by the system-reminder attachment config key.
7940
+ server >= 7.142.0, three 409s on a fresh submit (body carries `id`, plus `lane` on the second): `attachment.bound_elsewhere` (an attachment, once bound,
7941
+ stays with that session — upload it again for this one), `attachment.bundle_lane_not_isolated` (a project bundle binds only into an isolated lane:
7942
+ e2b / k8s / local-docker), `attachment.bundle_seed_fixed` (a session takes one project bundle). One refused id => none of the body's attachments bind.
7943
+ A resume replay of a stored body skips the refused id instead (operator warn). On isolated lanes the attachments are placed by the restore point.
7892
7944
  scratchpadDir:
7893
7945
  type: string
7894
7946
  description: >-
@@ -8120,7 +8172,8 @@ components:
8120
8172
  bad index. Up to 1000 entries per bucket, both forms counted.
8121
8173
  🔴 ON THIS SUBMIT FACE THE KEY SET IS CLOSED (server >= 7.57.0 for the sub-tree): accepted top-level keys
8122
8174
  are `env` / `hooks` / `model` / `outputStyle` / `permissions` / `skillListingBudgetFraction` /
8123
- `skillListingMaxDescChars` / `ultracode` / `webSearch` (server >= 7.133.0 adds the three TIGHTEN-ONLY seats `complianceAdditionalDenies` / `readDenyPatterns` / `writeProtectedExtra`; server >= 7.134.0 adds `approvalFrameFamilies`), and accepted `permissions.*` keys are
8175
+ `skillListingMaxDescChars` / `ultracode` / `webSearch` (server >= 7.133.0 adds the three TIGHTEN-ONLY seats `complianceAdditionalDenies` / `readDenyPatterns` / `writeProtectedExtra`; server >= 7.134.0 adds `approvalFrameFamilies`;
8176
+ server >= 7.142.0 adds the two http-hook allowlists `allowedHttpHookUrls` / `httpHookAllowedEnvVars` — the SDK's `SemaSettings` named keys are that set, key for key), and accepted `permissions.*` keys are
8124
8177
  `allow` / `ask` / `defaultMode` / `deny` / `disableAutoMode` (server >= 7.133.0 adds `neverAuto`); anything else is 400 `request.body_shape`
8125
8178
  with the names in the refusal's `unknownKeys` / `unsupportedKeys` arrays (REFUSED, not dropped — a dropped
8126
8179
  key reads as "in effect" to the caller). The object stays OPEN here because the same `SemaSettings`
@@ -8143,6 +8196,12 @@ components:
8143
8196
  🔴 `settings.hooks[]` (server >= 7.133.0; probe `capabilities.taskSettings.pluginHooks` / `managedHookGroups` — an absent or false bit = the keys are STRIPPED SILENTLY): group key `source` (closed: `managedPolicy` / `user` / `project` / `local` / `flag` /
8144
8197
  `managedPlugin:<name>` / `plugin:<name>`; absent = unmanaged; managed groups run in an independent lane after the unmanaged rewrites), command-entry keys `plugin { name, root, dataDir?, options? }` and exec-form `args`; a malformed one =>
8145
8198
  400 `request.field_invalid` with `detail: { reason: "wire_key_invalid", key, path }`; the plugin context has one 8192-character budget.
8199
+ 🔴 HTTP-HOOK ALLOWLISTS (server >= 7.142.0; send them only when `capabilities.taskSettings.httpHookAllowlists` is `true` — an older server answers 400 `request.body_shape`):
8200
+ `allowedHttpHookUrls` (string array of URL patterns, grammar owned by the settings-schema package) — present => every `type: "http"` entry of `settings.hooks` asks the
8201
+ package's judge BEFORE dialing out; a URL that does not match, an empty list `[]` or a malformed list => the hook sends ZERO bytes (rule word url / empty / malformed),
8202
+ an unmanaged group records `hook_non_blocking_failure{reason:"url_not_allowed"}`, a managed group fails closed (PreToolUse folds to ask) and also emits
8203
+ `hook_managed_unrun{reason:"url_not_allowed"}`; `httpHookAllowedEnvVars` (string array) — the header can interpolate only the entry's `allowedEnvVars` INTERSECTED with this list.
8204
+ Absent => unrestricted. The submit face accepts the key names only and does not judge the values; the multi-tenant lane ignores `settings.hooks` wholesale (bit false).
8146
8205
  🔴 `skillListingBudgetFraction` (number in (0,1]) / `skillListingMaxDescChars` (positive integer),
8147
8206
  server >= 7.78.1: the SKILL-LISTING RENDER BUDGET, passed to the engine with ZERO processing
8148
8207
  (no clamping, no conversion, no folding) — ABSENT means the key is not written at all (the server does
@@ -9100,21 +9159,6 @@ components:
9100
9159
  toolCallId: { type: string }
9101
9160
  retryAfterMs: { type: integer }
9102
9161
 
9103
- RunReplayRecord:
9104
- description: >
9105
- server >= 7.125.0 (contract §0.7). The idempotent-REPLAY body of a submit whose `Idempotency-Key` had already built a run row: `RunRecord` (the
9106
- `GET /v1/runs/{taskId}` read face, same projection) plus `replay: true`. It answers `POST /v1/tasks` (200) and is the `done.result` of
9107
- `POST /v1/tasks/stream`. 🔴 IT IS NOT A `TaskResult`: a synchronous first answer carries the engine result at the top level (`terminal`, `stats`, `result` as a
9108
- string); a replay has only the row, so `result` is the NESTED `TaskResult` (or absent while the run has no result), there is no top-level `terminal` / `stats`, and
9109
- `wiringManifest` / `notice` are absent (the wiring receipt is a live capture that is not stored on the row). `taskId` is the row's id — on the stream leg, when the
9110
- replay is discovered only after the stream opened (another replica created the row first), the `x-task-id` header and `meta` frame carried an id this leg minted
9111
- and never created: the id in this body is the real one. Narrow on `replay === true` (the two shapes cannot both match). A same-key duplicate still IN FLIGHT in the same
9112
- process is merged instead and gets the first answer's bytes with no `replay` key.
9113
- allOf:
9114
- - $ref: '#/components/schemas/RunRecord'
9115
- - type: object
9116
- required: [replay]
9117
-
9118
9162
  SubmitRefusalDoneResult:
9119
9163
  type: object
9120
9164
  description: >
@@ -9313,39 +9357,76 @@ components:
9313
9357
  enum: [enforced, not-enforced, exhausted, unobserved]
9314
9358
  description: '`enforced` (a live lease with budget) · `not-enforced` (center said "no lease" and the negative cache is live — render unlimited) · `exhausted` (with `retryAfterSec`) · `unobserved` (no entry / expired / exhausted-not-renewed / evicted / no principal — server ruling F-1: nobody is judging quota right now, NOT "the last state").'
9315
9359
  retryAfterSec: { type: integer, minimum: 1, description: 'Only beside `exhausted`.' }
9316
- SyncParkReceipt:
9360
+ SyncRunReceipt:
9317
9361
  type: object
9318
9362
  description: >
9319
- K-24 (server >= 7.104.0 / S-173) — the three POLL-RECEIPT keys a synchronous `POST /v1/tasks` adds on a PARK (the
9320
- whole park body before 7.104.0, values byte-identical), key-for-key the server's `http/sync-submit-body.ts`
9321
- `SyncParkReceipt`. `status` is the word on the `GET /v1/runs/{taskId}` row — the server derives the two words from
9322
- its `RUN_STATUS_CLASS` table (the `parked` class).
9323
- additionalProperties: false
9363
+ The three RUN-RECEIPT keys (server `SyncRunReceipt`, `http/sync-submit-body.ts`; key-for-key) — the one definition of these keys: `SyncParkReceipt`
9364
+ narrows `status` to the park words, `SyncReceiptBody` is the receipt-only arm of `SyncSubmitOutcome`. The server mints exactly these three keys; the
9365
+ schema stays open because the receipt arm also receives the 7.125.0–7.141.x replay that was the read face (a superset, see `SyncReceiptBody`).
9324
9366
  required: [taskId, sessionId, status]
9325
9367
  properties:
9326
9368
  taskId: { type: string, description: 'The durable run id minted at submit — the `GET /v1/runs/{taskId}` poll key.' }
9327
9369
  sessionId: { type: string }
9370
+ status: { $ref: '#/components/schemas/RunStatus' }
9371
+ SyncParkReceipt:
9372
+ type: object
9373
+ description: >
9374
+ K-24 (server >= 7.104.0 / S-173) — the three POLL-RECEIPT keys a synchronous `POST /v1/tasks` adds on a PARK (the
9375
+ whole park body before 7.104.0, values byte-identical), key-for-key the server's `http/sync-submit-body.ts`
9376
+ `SyncParkReceipt` (= `SyncRunReceipt` with `status` narrowed). `status` is the word on the `GET /v1/runs/{taskId}` row — the server derives the two
9377
+ words from its `RUN_STATUS_CLASS` table (the `parked` class).
9378
+ allOf:
9379
+ - $ref: '#/components/schemas/SyncRunReceipt'
9380
+ properties:
9328
9381
  status: { type: string, enum: [suspended, needs_review] }
9329
9382
  SyncSubmitResult:
9330
9383
  description: >
9331
- K-24 — the synchronous `POST /v1/tasks` 200 body (server name `SyncSubmitBody`, one mint `buildSyncSubmitBody`).
9332
- ONE RULE (contract §5.0c): it is ALWAYS the result itself (the sealed + redacted engine result — `TaskResult`); when
9333
- the run is parked (`terminal.kind === "paused"`) it additionally carries the `SyncParkReceipt` keys, so `status`
9334
- appears ONLY on a park — terminal bodies carry none (since 7.64.0). A park here is byte-identical to the same park
9335
- on `/v1/tasks/stream`'s `done.result` except for the identity keys; the resume credential is never on it.
9336
- Read "is it parked" off `terminal.kind === "paused"`; the old reading `status ∈ {suspended, needs_review}` still
9337
- holds. ⚠️ THREE GENERATIONS behind one type (the SDK's support floor is 3.0.0): server <= 7.63 answers the FLAT form
9338
- (`LegacyPlaneTaskResult`: `status` is the terminal word — completed / failed / blocked or a park word — and there is
9339
- no `terminal`); 7.64–7.103 answers the current `terminal` form on terminal bodies but a park with ONLY the three receipt
9340
- keys (no `terminal`, no `stats`); >= 7.104 follows the rule above. Read `status` for "parked" first (all three carry
9341
- a park word on a park), then tell the generations apart by whether `terminal` is present.
9384
+ K-24 — the ENGINE-RESULT arm of the synchronous `POST /v1/tasks` 200 body (server name `SyncSubmitBody`, one mint `buildSyncSubmitBody`).
9385
+ It is the result itself (the sealed + redacted engine result — `TaskResult`); when the run is parked (`terminal.kind === "paused"`) it
9386
+ additionally carries the `SyncParkReceipt` keys, so `status` appears ONLY on a park, and only as a park word (server >= 7.104.0). A park here
9387
+ is byte-identical to the same park on `/v1/tasks/stream`'s `done.result` except for the identity keys; the resume credential is never on it.
9388
+ server >= 7.142.0: a same-key replay of a run whose row holds a result answers exactly this envelope plus `replay: true`.
9389
+ The other generations are the other arms of `SyncSubmitOutcome`: a server <= 7.63 answers the flat `LegacyPlaneTaskResult`; a 7.64–7.103 park
9390
+ answered only the three receipt keys (`SyncReceiptBody`).
9342
9391
  allOf:
9343
9392
  - $ref: '#/components/schemas/TaskResult'
9344
9393
  - type: object
9345
9394
  properties:
9346
9395
  status:
9347
- allOf: [{ $ref: '#/components/schemas/RunStatus' }]
9348
- description: 'Poll-receipt word on a park (>= 7.64: suspended / needs_review only), or the flat terminal word of a server <= 7.63 (LegacyPlaneTaskResult.status).'
9396
+ type: string
9397
+ enum: [suspended, needs_review]
9398
+ description: 'The poll-receipt word on a park (`SyncParkReceipt.status`); absent on a terminal body.'
9399
+ replay:
9400
+ const: true
9401
+ description: 'server >= 7.125.0 — present only on a same-key replay (never `false`). It says "replayed", not which shape.'
9402
+ SyncReceiptBody:
9403
+ type: object
9404
+ description: >
9405
+ The RUN-RECEIPT arm of `SyncSubmitOutcome` — no engine result in hand, so the body is the three receipt keys `{taskId, sessionId, status}`
9406
+ (server `SyncRunReceipt`): read the run at `GET /v1/runs/{taskId}`. Three producers: a 7.64.0–7.103.x park (the whole park body then);
9407
+ server >= 7.142.0, a same-key replay of a row that holds no result (still running, or lost: a stale row's `status` reads `failed`);
9408
+ and server 7.125.0–7.141.x, whose same-key replay was the row's read face plus `replay: true` — a superset of these three keys with no
9409
+ `stats`, hence `additionalProperties: true` here (read the three keys, then the row).
9410
+ additionalProperties: true
9411
+ not: { required: [stats] }
9412
+ allOf:
9413
+ - $ref: '#/components/schemas/SyncRunReceipt'
9414
+ properties:
9415
+ replay:
9416
+ const: true
9417
+ description: 'server >= 7.125.0 — present only on a same-key replay (never `false`).'
9418
+ SyncSubmitOutcome:
9419
+ description: >
9420
+ The synchronous `POST /v1/tasks` 200 body, and the shape of `/v1/tasks/stream`'s `done.result` on a run. ONE RULE (server >= 7.142.0): is there an
9421
+ engine result in hand? `stats` present ⇒ the engine result (`SyncSubmitResult`; on a server <= 7.63 the flat `LegacyPlaneTaskResult`, told apart by
9422
+ `terminal`); `stats` absent ⇒ the run receipt (`SyncReceiptBody`) — read the row at `GET /v1/runs/{taskId}`. A same-key replay is the
9423
+ first answer's envelope plus `replay: true` (server >= 7.142.0; a row whose stored result is the <= 7.63 flat form replays as that flat form
9424
+ plus `replay: true`); `replay` says "replayed", never which shape. server 7.125.0–7.141.x
9425
+ answered a replay with the row's read face instead: it has no `stats` and falls in the receipt arm, which is the right reading of it.
9426
+ oneOf:
9427
+ - $ref: '#/components/schemas/SyncSubmitResult'
9428
+ - $ref: '#/components/schemas/LegacyPlaneTaskResult'
9429
+ - $ref: '#/components/schemas/SyncReceiptBody'
9349
9430
  PermissionModeSwitchResult:
9350
9431
  type: object
9351
9432
  description: >-
@@ -9423,13 +9504,6 @@ components:
9423
9504
  taskId: { type: string }
9424
9505
  sessionId: { type: string }
9425
9506
  status: { $ref: '#/components/schemas/RunStatus' }
9426
- replay:
9427
- const: true
9428
- description: >
9429
- server >= 7.125.0 (additive; contract §0.7). Present ONLY on the IDEMPOTENT-REPLAY body of a submit — `POST /v1/tasks` 200, and the same body as
9430
- `done.result` on `POST /v1/tasks/stream` (see `RunReplayRecord`) — where it is always `true`: the submit's key had already built this run row, so the
9431
- answer is the row's read face plus this marker, NOT the first answer's engine result. ABSENT on `GET /v1/runs/{taskId}` and
9432
- `GET /v1/runs?idempotencyKey=` (those are the read face itself) and never `false`. Branch on `replay === true`; the outcome is in `result`.
9433
9507
  msSinceLastActivity:
9434
9508
  type: integer
9435
9509
  description: >
@@ -10747,6 +10821,7 @@ components:
10747
10821
  hooks: { type: boolean, description: 'Single-user deployments only (`requirePrincipal !== true`).' }
10748
10822
  pluginHooks: { type: boolean, description: 'server >= 7.133.0 — the request `settings.hooks[]` PLUGIN-CONTEXT keys (command entry `plugin { name, root, dataDir?, options? }` / exec-form `args`) are accepted; same predicate as `hooks` (single-user true, multi-tenant false). ABSENT or false = the keys are stripped silently — send only on sight of the bit.' }
10749
10823
  managedHookGroups: { type: boolean, description: 'server >= 7.133.0 — the request `settings.hooks[]` GROUP `source` key (managed lanes `managedPolicy` / `managedPlugin:<name>`) is accepted; same predicate as `hooks`. ABSENT or false = stripped silently (the managed-lane semantics do not apply, it is not a refusal).' }
10824
+ httpHookAllowlists: { type: boolean, description: 'server >= 7.142.0 — the request keys `settings.allowedHttpHookUrls` / `settings.httpHookAllowedEnvVars` (the settings-schema package''s two http-hook allowlists) are read and enforced at the dial-out point. The SAME predicate as `hooks` (true on the single-user lane; false where `settings.hooks` is ignored). ABSENT = server <= 7.141.x, which answers 400 `request.body_shape` for those keys — send only on sight of the bit.' }
10750
10825
  tightenOnlySeats: { type: boolean, description: 'server >= 7.133.0, constant true — the four tighten-only request seats `settings.readDenyPatterns` / `settings.writeProtectedExtra` / `settings.complianceAdditionalDenies` / `settings.permissions.neverAuto` are accepted (each seat = deployment table UNION request list, only ever growing; an empty array is the same as not sent). ABSENT = server <= 7.132.x, which answers 400 `request.body_shape` for those keys — send only on sight of the bit.' }
10751
10826
  approvalFrameFamilies: { type: boolean, description: 'server >= 7.134.0, constant true — the request key `settings.approvalFrameFamilies` (which approval opening-frame families this run''s client renders) is accepted. THIS is the trigger bit for that key, NOT the top-level `approvalFrameFamilies`: servers <= 7.133.x already carry the top-level bit yet answer 400 `request.body_shape` (`unknownKeys: ["settings.approvalFrameFamilies"]`) for the key. ABSENT = do not send it.' }
10752
10827
  settings:
@@ -10955,6 +11030,28 @@ components:
10955
11030
  memory-capture opt-out GRANT table admin (four routes under `/v1/admin/memory-optout`,
10956
11031
  operator-only) — capabilities.ts:307. FALSE ⇒ **501** `capability.memory_optout_grant_required`
10957
11032
  (change the deployment shape), as opposed to `memoryConsolidationDriver`'s 404 (turn the knob on).
11033
+ sessionMemorySync:
11034
+ type: boolean
11035
+ description: >
11036
+ server >= 7.142.0 — the session memory-sync trigger `POST /v1/sessions/{sessionId}/memory/sync` (SDK `sessions.syncMemory`) is served: it needs the
11037
+ local sync leg (file memory engine + `MEMORY_SYNC_URL`), a durable run store and the session-ownership face. FALSE => that route answers 501
11038
+ (`feature.memory_sync_disabled` / `capability.run_store_required` / `capability.session_ownership_required`, by what is missing). ABSENT = an older server (no route).
11039
+ memorySyncServe:
11040
+ description: >
11041
+ server >= 7.142.0 — the MEMORY-SYNC CENTER's identity bit: `{ identity }` iff this is a DB memory plane (`MEMORY_ENGINE_BACKEND=pg|mysql`) with the sync perform
11042
+ seat AND the operator declared `MEMORY_SYNC_SERVE_IDENTITY`; otherwise `false` (not a center, or no identity declared — then `POST /v1/memory/sync/{scope}` answers
11043
+ 501 `feature.memory_sync_serve_disabled`). A composite bit (the server's composite-member table `memorySyncServe: ["identity"]`); there is no `true`.
11044
+ `identity` = the canonical base address clients reach this center's sync face at (lower-case scheme and host, no default port, no trailing slash, no query /
11045
+ fragment / credential), verbatim: a local shell passes it as the `target` of `POST /v1/sessions/{sessionId}/memory/sync`; the center compares an inbound `peer`
11046
+ to it as a string. ABSENT = an older server.
11047
+ oneOf:
11048
+ - { const: false }
11049
+ - $ref: '#/components/schemas/MemorySyncServeCapability'
11050
+ memoryExport:
11051
+ type: boolean
11052
+ description: >
11053
+ server >= 7.142.0 — the export read face `GET /v1/memory/export` (SDK `memory.exportScope`) is served (a DB memory plane has it). FALSE => that route answers
11054
+ 501 `capability.memory_store_required` (which reads the capability fact from 7.142.0 on, no longer the backend word). ABSENT = an older server.
10958
11055
  permissionModeAuto:
10959
11056
  type: object
10960
11057
  additionalProperties: true
@@ -11659,14 +11756,7 @@ components:
11659
11756
  applied:
11660
11757
  type: array
11661
11758
  description: The center's own-round applied ops (backend `PatchReport.applied` verbatim; empty on an idempotent replay).
11662
- items:
11663
- type: object
11664
- required: [op, id]
11665
- additionalProperties: false
11666
- properties:
11667
- op: { type: string, enum: [add, update, delete] }
11668
- id: { type: string }
11669
- slug: { type: string }
11759
+ items: { $ref: '#/components/schemas/MemorySyncAppliedOp' }
11670
11760
  conflicts:
11671
11761
  type: array
11672
11762
  items:
@@ -11902,6 +11992,110 @@ components:
11902
11992
  400 `request.memory_layer`; a personal-mount store ⇒ 409 `memory.erasure_store_unjudged`; `select.ids` without it on a two-store deployment ⇒ 400
11903
11993
  `request.memory_layer`).
11904
11994
 
11995
+ SessionMemorySyncRequest:
11996
+ type: object
11997
+ description: 'server >= 7.142.0 — the body of `POST /v1/sessions/{sessionId}/memory/sync`: exactly one key.'
11998
+ additionalProperties: false
11999
+ required: [target]
12000
+ properties:
12001
+ target: { type: string, description: 'The sync identity of the engine the session goes to — that engine''s `GET /v1/capabilities` `memorySyncServe.identity`, verbatim.' }
12002
+ MemorySyncAppliedOp:
12003
+ type: object
12004
+ description: One applied op of a memory sync (the backend's `PatchReport.applied` item) — the one definition, used by `MemorySyncResponse.applied` and both halves of `MemorySyncLayerReport.applied`.
12005
+ additionalProperties: false
12006
+ required: [op, id]
12007
+ properties:
12008
+ op: { type: string, enum: [add, update, delete] }
12009
+ id: { type: string }
12010
+ slug: { type: string }
12011
+ MemorySyncConflict:
12012
+ type: object
12013
+ description: 'server >= 7.142.0 — one conflict of a session memory sync layer (`MemorySyncLayerReport.conflicts`): which half (`side`), the entry, why, and the two revisions when known.'
12014
+ additionalProperties: false
12015
+ required: [side, id, reason]
12016
+ properties:
12017
+ side: { type: string, enum: [server, local] }
12018
+ id: { type: string }
12019
+ reason: { type: string }
12020
+ baseRev: { type: string }
12021
+ currentRev: { type: string }
12022
+ MemorySyncServeCapability:
12023
+ type: object
12024
+ description: 'server >= 7.142.0 — the object arm of `Capabilities.memorySyncServe`: this center''s declared sync identity.'
12025
+ additionalProperties: false
12026
+ required: [identity]
12027
+ properties:
12028
+ identity: { type: string, description: 'The declared sync identity (`MEMORY_SYNC_SERVE_IDENTITY`, canonical form) — pass it verbatim as the `target` of `POST /v1/sessions/{sessionId}/memory/sync`.' }
12029
+ MemorySyncLayerReport:
12030
+ type: object
12031
+ description: >
12032
+ server >= 7.142.0 — ONE LAYER of a memory sync (the engine's `memorySyncReportOf`, passed through): one scope, one outcome, what all its calls landed. Branch on
12033
+ `outcome`: `synced` (the layer arrived — `applied` counts do not say so, the outcome does); `incomplete` (`why`: `conflicts` — the last call's conflicts listed in
12034
+ full — or `truncated`; `warnings` = the server answers the client refused); `refused` before any request (`code` `config.memory_sync_cursor_mismatch` with
12035
+ `detail {axis, found}` or `config.memory_sync_store`; `outs` = the two ways out the sentence names); `failed` (`error` = the message; one failed layer ends only itself).
12036
+ additionalProperties: false
12037
+ required: [scope, applied, outcome]
12038
+ properties:
12039
+ scope: { type: string }
12040
+ applied:
12041
+ type: object
12042
+ additionalProperties: false
12043
+ required: [server, local]
12044
+ properties:
12045
+ server: { type: array, items: { $ref: '#/components/schemas/MemorySyncAppliedOp' } }
12046
+ local: { type: array, items: { $ref: '#/components/schemas/MemorySyncAppliedOp' } }
12047
+ outcome: { type: string, enum: [synced, incomplete, refused, failed] }
12048
+ why: { type: string, enum: [conflicts, truncated] }
12049
+ conflicts: { type: array, items: { $ref: '#/components/schemas/MemorySyncConflict' } }
12050
+ warnings: { type: array, items: { type: string } }
12051
+ code: { type: string, enum: [config.memory_sync_cursor_mismatch, config.memory_sync_store] }
12052
+ detail:
12053
+ type: object
12054
+ additionalProperties: false
12055
+ required: [axis, found]
12056
+ properties:
12057
+ axis: { type: string, enum: [scope, peer, store] }
12058
+ found: { type: string, enum: [absent, other] }
12059
+ outs: { type: array, minItems: 2, maxItems: 2, items: { type: string } }
12060
+ message: { type: string }
12061
+ error: { type: string }
12062
+ # each arm names the ONLY keys it carries (core `memorySyncReportOf` writes exactly these per outcome) — a key of another outcome is a violation
12063
+ oneOf:
12064
+ - properties: { outcome: { const: synced } }
12065
+ propertyNames: { enum: [scope, applied, outcome] }
12066
+ - properties: { outcome: { const: incomplete } }
12067
+ required: [why, conflicts]
12068
+ propertyNames: { enum: [scope, applied, outcome, why, conflicts, warnings] }
12069
+ - properties: { outcome: { const: refused } }
12070
+ required: [code, outs, message]
12071
+ propertyNames: { enum: [scope, applied, outcome, code, detail, outs, message] }
12072
+ - properties: { outcome: { const: failed } }
12073
+ required: [error]
12074
+ propertyNames: { enum: [scope, applied, outcome, error] }
12075
+ SessionMemorySyncReport:
12076
+ type: object
12077
+ description: >
12078
+ server >= 7.142.0 — the 200 body of `POST /v1/sessions/{sessionId}/memory/sync` (the engine's `MemorySyncRoundReport`, passed through). Two round arms, told
12079
+ apart by `refused` being present: `layers` (one outcome per layer; a scope of the read set with no layer was not synced) or `refused` (the whole round, zero
12080
+ requests: `config.memory_sync_target_mismatch` / `session_active`). Common keys: `target` (as given), `sourceRevision` (the session revision the sync ran
12081
+ against — the leaf of the session head; align a fork on it) and `scopes` (the session's read set, in its order).
12082
+ additionalProperties: false
12083
+ required: [target, sourceRevision, scopes]
12084
+ properties:
12085
+ target: { type: string }
12086
+ sourceRevision: { type: string }
12087
+ scopes: { type: array, items: { type: string } }
12088
+ layers: { type: array, items: { $ref: '#/components/schemas/MemorySyncLayerReport' } }
12089
+ refused:
12090
+ type: object
12091
+ additionalProperties: false
12092
+ required: [code, message]
12093
+ properties:
12094
+ code: { type: string, enum: [config.memory_sync_target_mismatch, session_active] }
12095
+ message: { type: string }
12096
+ oneOf:
12097
+ - required: [layers]
12098
+ - required: [refused]
11905
12099
  SessionMemoryEraseRequest:
11906
12100
  type: object
11907
12101
  description: >
@@ -14827,7 +15021,21 @@ components:
14827
15021
  changed back is unchanged (no value-judging round trip). The `PATCH` 200 row and the `currentRow` of a `409 conflict.session_row_changed` are the SAME projection and carry it too.
14828
15022
  PRESENT-IFF the row can be written conditionally (all three durable session backends); a lister face with no session metadata (the in-memory run-store aggregate) does not carry it.
14829
15023
  ABSENT = an older server (<= 7.138.x) or such a face — read as "no tag, unconditional write only". Never parse it, compare its order or use it across sessions. Not an ETag, no capability bit.
15024
+ unreadable: { $ref: '#/components/schemas/SessionUnreadable' }
14830
15025
 
15026
+ SessionUnreadable:
15027
+ type: object
15028
+ additionalProperties: false
15029
+ required: [errorCode]
15030
+ description: >
15031
+ server >= 7.142.0 (additive; contract section 17.2 corrected) — THIS SESSION'S ARCHIVE CANNOT BE READ. Present-iff the leaf of the session head
15032
+ cannot be read; the key set is closed (the server's self-minted `sessionsListRowUnreadableKey`). Only on the file backend (`DB_BACKEND=local`):
15033
+ a broken / truncated session head => `corrupt_session`; an I/O-level failure (permissions, disk) => `internal.error` — the code the read faces answer
15034
+ for that session (`GET /v1/sessions/{sessionId}` and `.../head` answer 500 with it). Before 7.142.0 such sessions vanished from the list. The rest of
15035
+ the row reads like a good row, with `objectivePreview: null` (a `?q=` search does not hit it). Branch on presence (grey out / say unreadable / offer delete
15036
+ only); `DELETE /v1/sessions/{sessionId}` deletes it for its owner as usual. SQL backends never carry it.
15037
+ properties:
15038
+ errorCode: { type: string, description: '`corrupt_session` or `internal.error` — the code the read faces answer for this session. Branch on the code.' }
14831
15039
  SessionPatchBody:
14832
15040
  type: object
14833
15041
  description: >
@@ -18313,6 +18521,13 @@ components:
18313
18521
  description: 'Machine-readable facts (per code). Redacted + bounded server-side; open set of keys.'
18314
18522
  sessionId: { type: string, description: 'Owning session — this frame only ever appears on that session stream.' }
18315
18523
  ts: { type: integer, format: int64, description: 'SERVER observation time (ms epoch), NOT the engine mint time.' }
18524
+ eventId:
18525
+ type: string
18526
+ description: >-
18527
+ server >= 7.142.0 — the identity of THIS delivery (a uuidv7 the server mints when it delivers the notice), the same identity seat as
18528
+ `EventIdentity.eventId` on content events; the live frame also carries an SSE `id:` line with this value. Use it to DEDUP (a reconnect or a
18529
+ switch from the live leg to `GET /v1/runs/{taskId}/events` can bring the same notice again). It is NOT a durable cursor (the events lane reads
18530
+ `Last-Event-ID` as a row `seq`; a uuidv7 does not read as a number, so that lane replays from 0). ABSENT on older servers and on ledger rows written before it.
18316
18531
  Event_workspace_changed:
18317
18532
  type: object
18318
18533
  description: >
@@ -20534,35 +20749,28 @@ components:
20534
20749
  description: >
20535
20750
  The stream's terminal frame. `result` is a DISCRIMINATED UNION of real shapes (契约调和车1 E,
20536
20751
  2026-08-02) — do NOT assume the full TaskResult:
20537
- · `TaskResult` — the normal terminal (output string at `.result`, stats at `.stats`), service Drift 4;
20752
+ · `SyncSubmitOutcome` — a run's outcome, the same three arms as the synchronous `POST /v1/tasks` 200 body: the engine result (`SyncSubmitResult`,
20753
+ service Drift 4), the flat `LegacyPlaneTaskResult` an older generation left in the durable ledger (a REPLAYED frame on an upgraded deployment
20754
+ can be that shape), or the run receipt `SyncReceiptBody`. A same-key replay (server >= 7.125.0, contract §0.7) is, on server >= 7.142.0, the FIRST
20755
+ ANSWER'S ENVELOPE plus `replay: true` (the engine result when the row holds one, else the receipt); server 7.125.0–7.141.x sent the row's read face
20756
+ plus `replay: true`, which has no `stats` and reads as the receipt arm. The frame carries `replay: true` as well;
20538
20757
  · `ActiveRunConflictDoneResult` — the SSE lane's REJECTION terminal: when the session already has an
20539
20758
  active run, the submit's 409 is encoded as this done frame (`src/http/routes/tasks.ts`), and it
20540
20759
  carries NO `taskId` / `sessionId` / `stats`;
20541
- · `RunReplayRecord` (server >= 7.125.0, contract §0.7) — the IDEMPOTENT-REPLAY terminal of `POST /v1/tasks/stream`: the submit's key had already built a run row, so
20542
- `result` is that row's read face plus `replay: true` — NOT an engine result (no top-level `terminal` / `stats`; the outcome is the nested `result`). The frame carries
20543
- `replay: true` as well. (A same-key duplicate still in flight in the same process is merged instead: the frame has `replay: true` but `result` is the first answer's
20544
- `TaskResult` verbatim — so the FRAME's `replay` does not tell the shapes apart; `result.replay` does.)
20545
20760
  · `SubmitRefusalDoneResult` — a submit refused after the stream was already open, as `{status:"failed", errorCode, errorMessage}` (server >= 7.125.0: `conflict.run_exists` when
20546
20761
  the replay is discovered at row-creation time and the caller cannot read that row; also the device-placement refusal). Not an engine result; carries no `taskId` / `stats`.
20547
- Narrow in TWO steps: `stats` present (an engine result) vs absent (the conflict envelope) — or match
20548
- `errorCode === "conflict.session_active_run"` — and then, among the engine results, `"terminal" in result`
20549
- (the current cause form) vs absent (`LegacyPlaneTaskResult`, the flat bytes an older generation left in
20550
- the durable ledger; a REPLAYED frame on an upgraded deployment can be that shape).
20551
- 🔴 server >= 7.64.0 — the two arms are now told apart by their KEYS, not by a shared word: the normal
20552
- terminal carries `terminal` (the tagged cause) and NO `status`; the conflict shape carries the flat
20553
- `status: "failed"` + `errorCode` because it is the SERVICE's own rejection envelope, not an engine
20554
- result, and it did not change. `status` therefore appears on exactly one arm — but keep narrowing on
20555
- `stats` / `errorCode`, which are the discriminants the service pins.
20762
+ Narrow on KEYS: `stats` present ⇒ an engine result (then `terminal` present ⇒ the current cause form, absent ⇒ `LegacyPlaneTaskResult`);
20763
+ else `activeTaskId` present ⇒ the session-occupied refusal; else `taskId` present ⇒ the run receipt; else the refusal triple.
20764
+ 🔴 server >= 7.64.0 — the normal terminal carries `terminal` (the tagged cause) and `status` only as a park word; the refusal shapes carry the flat
20765
+ `status: "failed"` + `errorCode` because they are the SERVICE's own rejection envelopes, not engine results. Branch on `errorCode`, never on the sentence.
20556
20766
  additionalProperties: false # 封闭:帧本身只有 {type,result,replay?};`result` 内部按臂各自裁定(TaskResult 开集,冲突形封闭)
20557
20767
  required: [type, result]
20558
20768
  properties:
20559
20769
  type: { const: done }
20560
20770
  result:
20561
20771
  oneOf:
20562
- - $ref: '#/components/schemas/TaskResult'
20772
+ - $ref: '#/components/schemas/SyncSubmitOutcome'
20563
20773
  - $ref: '#/components/schemas/ActiveRunConflictDoneResult'
20564
- - $ref: '#/components/schemas/LegacyPlaneTaskResult'
20565
- - $ref: '#/components/schemas/RunReplayRecord'
20566
20774
  - $ref: '#/components/schemas/SubmitRefusalDoneResult'
20567
20775
  replay:
20568
20776
  type: boolean
@@ -20571,8 +20779,8 @@ components:
20571
20779
  marks the IDEMPOTENT-REPLAY leg: this terminal was NOT produced by a live run of your submit. Either
20572
20780
  your call was deduplicated into a concurrent identical submit still in flight in the same process (then `result` is the original
20573
20781
  run's terminal, verbatim, and you received no live events at all), or — server >= 7.125.0 — the `Idempotency-Key` had already built a run
20574
- row and `result` is that row's read face plus `replay: true` (`RunReplayRecord`; NOT an engine result). The frame's flag does not
20575
- tell the two apart; `result.replay === true` does. ABSENT on every live leg (never `false`) — a UI can use it to say "replayed"
20782
+ row and `result` is the first answer's envelope plus `replay: true` (server >= 7.142.0; 7.125.0–7.141.x sent the row's read face). Read
20783
+ `result` by its keys (`stats` ⇒ engine result, else the receipt); neither flag names the shape. ABSENT on every live leg (never `false`) — a UI can use it to say "replayed"
20576
20784
  instead of implying the work just ran twice.
20577
20785
 
20578
20786
  ActiveRunConflictDoneResult:
@@ -21350,7 +21558,7 @@ components:
21350
21558
  reason:
21351
21559
  # 🔴 NO `enum` — same open-on-read ruling as kind 1 (SDK type is `... | (string & {})`).
21352
21560
  type: string
21353
- description: 'Machine-branchable failure shape. CLOSED server-side, OPEN ON READ — KNOWN WORDS TODAY: exit_nonzero | timeout | spawn_failed | bad_json | matcher_over_budget (server >= 7.133.0: the group matcher / the entry `if` name part did not finish evaluating within its 1000 ms budget on this name — NOT a broken hook script but an unevaluable selection condition; the server treats it as selected, the entry still runs; ONE frame per group, `if` one per entry, no exitCode / stderr).'
21561
+ description: 'Machine-branchable failure shape. CLOSED server-side, OPEN ON READ — KNOWN WORDS TODAY: exit_nonzero | timeout | spawn_failed | bad_json | matcher_over_budget (server >= 7.133.0: the group matcher / the entry `if` name part did not finish evaluating within its 1000 ms budget on this name — NOT a broken hook script but an unevaluable selection condition; the server treats it as selected, the entry still runs; ONE frame per group, `if` one per entry, no exitCode / stderr) | url_not_allowed (server >= 7.142.0: NOT a broken endpoint — the http entry was withheld by the request''s `settings.allowedHttpHookUrls` and sent zero bytes; `detail` names `settings.hooks.<event>`, the list and the judge''s rule word url / empty / malformed).'
21354
21562
  hookName: { type: string, description: 'Hook identity (statusMessage, else command/URL/prompt; redacted + bounded, http entries stripped of query/fragment). Always sent.' }
21355
21563
  entryType: { type: string, description: 'command | http | prompt | agent — without it, hookName''s nature is a guess. Closed server-side, open on read. Always sent.' }
21356
21564
  exitCode: { type: integer, description: 'Absent for timeout/spawn_failed (no exit code exists — the server never mints a legit-looking 0).' }
@@ -21374,8 +21582,9 @@ components:
21374
21582
  # NO `enum` — same open-on-read ruling as kinds 1 and 2.
21375
21583
  type: string
21376
21584
  description: >-
21377
- Why it did not complete. CLOSED on the server (thirteen words), OPEN ON READ — KNOWN WORDS TODAY: matcher_invalid | llm_carrier_unavailable | llm_cap | powershell_unsupported | if_unevaluable | budget_exhausted |
21378
- spawn_failed | timeout | exit_nonzero | bad_json | decision_out_of_set | evidence_unavailable | rewrite_unsettled. `input_truncated` / `matcher_over_budget` are NOT in this kind (they belong to kind 4).
21585
+ Why it did not complete. CLOSED on the server (fourteen words), OPEN ON READ — KNOWN WORDS TODAY: matcher_invalid | llm_carrier_unavailable | llm_cap | powershell_unsupported | if_unevaluable | budget_exhausted |
21586
+ spawn_failed | timeout | exit_nonzero | bad_json | decision_out_of_set | evidence_unavailable | rewrite_unsettled | url_not_allowed (server >= 7.142.0: a managed http entry withheld by
21587
+ `settings.allowedHttpHookUrls` — fail-closed). `input_truncated` / `matcher_over_budget` are NOT in this kind (they belong to kind 4).
21379
21588
  source: { type: string, description: 'The group''s source word (`managedPolicy` or `managedPlugin:<name>`; the name is trace only, never a criterion).' }
21380
21589
  hookName: { type: string, description: 'Hook identity (same rule as kind 2); redacted + bounded.' }
21381
21590
  entryType: { type: string, description: 'command | http | prompt | agent — closed server-side, open on read.' }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/sdk",
3
- "version": "31.0.0",
3
+ "version": "32.0.0",
4
4
  "description": "Typed, zero-runtime-dependency SDK for the Sema agent fleet usage plane. The shared substrate for all doors (CC/Codex MCP façade + web). Server-side only — tokens never enter the browser.",
5
5
  "type": "module",
6
6
  "license": "BUSL-1.1",