@sema-agent/sdk 30.0.0 → 30.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/openapi.yaml CHANGED
@@ -474,7 +474,11 @@ paths:
474
474
  '409':
475
475
  description: >-
476
476
  Conflict (ConflictError). 409 — session already has an active run (`conflict.session_active_run`, `activeTaskId`,
477
- `pendingGate`), OR an idempotency/session-CAS conflict. ⚠️ The SDK surfaces it as a TYPED ConflictError and does
477
+ `pendingGate`), OR an idempotency/session-CAS conflict. Server >= 7.140.0, zero-work submissions only: `config.read_deny_floor_unkept` — the
478
+ deployment sets `READ_DENY_FLOOR_REQUIRED=true` and this run's read-deny table has rows while its execution environment does not keep the byte floor (all
479
+ seven lanes today): refused at prepare, no command started, zero tokens. NOT a request error — the deployment state conflicts with it (use an execution
480
+ environment that keeps the floor, or the operator drops the knob; then the run proceeds and each run raises one operator notice with the same code, off the
481
+ user stream). Only reachable when the operator set the knob; a retry does not change the verdict. ⚠️ The SDK surfaces it as a TYPED ConflictError and does
478
482
  NOT silently resolve it to that run: `activeTaskId` may be the caller's own first attempt OR an unrelated
479
483
  concurrent run on the same session — 409 alone cannot tell (same text as the `Conflict` response component).
480
484
  K-24 (server >= 7.104.0 / S-724, zero-work submissions only): `rewind.store_unconfigured` — this
@@ -647,6 +651,8 @@ paths:
647
651
  description: >
648
652
  Async; runs in the background. Requires a TiDB run store (absent → 501). Auto `Idempotency-Key`.
649
653
  Poll `GET /v1/runs/:id` or stream `GET /v1/runs/:id/events`. A client disconnect does NOT stop the run.
654
+ Prepare-time refusals do not answer an HTTP error here: the 202 receipt is followed by a run that ends `failed` with the code (e.g. server >= 7.140.0
655
+ `config.read_deny_floor_unkept` when the deployment sets `READ_DENY_FLOOR_REQUIRED=true`; the synchronous `POST /v1/tasks` answers 409 for the same state).
650
656
  parameters:
651
657
  - $ref: '#/components/parameters/IdempotencyKey'
652
658
  requestBody:
@@ -2901,6 +2907,19 @@ paths:
2901
2907
  Cross-incarnation caveat (server-side, cannot be fixed at this layer): the capture record and the
2902
2908
  lineage ledger are keyed by the BARE sessionId and outlive the session, so a re-claimed id reads the
2903
2909
  PREVIOUS incarnation's counts/opt-out (metadata only, no content bytes).
2910
+
2911
+ 🔴 TWO STORES, ONE ANSWER (server >= 7.140.0; contract §9 head): a session can span two memory stores (file backend: the typed personal layers live
2912
+ in a second store under the personal mount). Without `scope` the server reads EVERY store of this deployment (at most two) and folds the answers key by
2913
+ key, never minting a stand-in value: `committedCount` / `foldedCount` are summed, and ABSENT if any store's ledger could not be read (not 0);
2914
+ `lastCaptureAt` is the maximum over the stores that answer it, absent when `committedCount` is absent (`foldedCount` absent on its own does not suppress it) or when no store answers it (no contribution anywhere); `captureOptedOut` is `true` as soon as ANY store holds a
2915
+ capture record (with `optOutSource: "record"`), `false` only when every store answers `false`, and otherwise (a store's record unreadable) absent with
2916
+ `optOutSource: "fault"`. One store ⇒ exactly that store's answer (single-store deployments answer byte-for-byte as 7.139.x). The optional query `scope=<layer key>`
2917
+ answers only the store that layer lives in. The fold is a TRANSITIONAL form (deleted when the engine serves a deployment-wide status); the cache is keyed
2918
+ by (session, store control plane). Without `scope` this verb never answers `request.memory_layer` form (3); an unreadable `scope` (or an unreadable
2919
+ deployment layer) ⇒ 400 `request.memory_layer` with a FIXED sentence for the session owner; `scope` present but not a non-empty string ⇒ 400
2920
+ `request.field_invalid`. 7.139.x and earlier read the deployment's store only (the personal half read as 0).
2921
+ parameters:
2922
+ - $ref: '#/components/parameters/MemoryLayerSeatQuery'
2904
2923
  responses:
2905
2924
  '200':
2906
2925
  description: >-
@@ -2947,15 +2966,25 @@ paths:
2947
2966
  there is no operator override arm), and the attestation's `select` echoes exactly that. The body is
2948
2967
  `SessionMemoryEraseRequest` handed through as sent: no `select` (a body carrying one is a loud 400
2949
2968
  `request.body_shape`, never silently ignored — while any OTHER unknown key IS silently ignored and not forwarded),
2950
- `allowUnevidenced` NEVER INJECTED (the degraded lane is a human authorization statement).
2969
+ `allowUnevidenced` NEVER INJECTED (the degraded lane is a human authorization statement). The one added key is the optional layer seat `scope`
2970
+ (server >= 7.140.0).
2951
2971
 
2952
2972
  🔴 `requestId` IS THIS ERASURE'S IDEMPOTENCY IDENTITY — the same two-lane law as the operator face (read
2953
2973
  `evidenceCapability`): `"journal"` ⇒ a resend with the SAME id reads back the anchor's pinned ids and never re-resolves
2954
2974
  (retry after a lost ack, or after the operator removed the link behind a 409 `memory.target_outside_store`, with the SAME
2955
2975
  id); `"none"` ⇒ same id = a NEW request (a second real delete). The only memory backend that mounts this face today (file:
2956
2976
  owns the engine control plane and the evidence face) takes the journal lane. Mint a NEW id per erase action per session:
2957
- reusing an id on ANOTHER session is a different selector, which core refuses (`memory.erasure_selector_mismatch`) — and
2958
- THIS face does not classify that refusal (see 500). 🔴 DO NOT put an automatic retry policy on this endpoint.
2977
+ reusing an id on ANOTHER session is a different selector, which core refuses (409 `memory.erasure_selector_mismatch`; since
2978
+ server 7.108.0 this face classifies it like the operator face does — <= 7.107.x answered 500 `internal.error`). 🔴 DO NOT put an
2979
+ automatic retry policy on this endpoint.
2980
+
2981
+ 🔴 ERASURE EXECUTES ONLY ON THE DEPLOYMENT'S STORE (server >= 7.140.0, a transitional guard — the engine has no deployment-wide erasure request identity yet).
2982
+ Without `scope`: the by-session erasure runs on the deployment's store, and if this session has contributions in the OTHER store (the personal mount) or that
2983
+ store's ledger cannot be read ⇒ 409 `memory.erasure_store_unjudged` — NOTHING erased (7.139.x answered 200 and erased the deployment-store half). With `scope`
2984
+ naming a layer that lives in the deployment's store (e.g. `local`) ⇒ it runs there, 200, the attestation covers the deployment's store only (the layer seat does
2985
+ not reach the engine or the attestation) and the other store's half is neither judged nor mentioned; `scope` naming a layer on the personal mount ⇒ 409
2986
+ `memory.erasure_store_unjudged`. The audience is the session owner, so every refusal on this face is a FIXED sentence (layer keys and paths never ride the wire;
2987
+ the engine's sentence goes to the operator log). 400 `request.memory_layer` here means the `scope` (or this deployment's configured layer) cannot be read.
2959
2988
 
2960
2989
  GATE ORDER (release bytes): 503 destructive-session-write guard → 401 → 501 (no owner audit face — BEFORE the 404: a
2961
2990
  deployment without one must not fake a 404) → 404 (unknown AND non-owner, SAME code SAME message) → 501 (compliance face
@@ -2979,7 +3008,9 @@ paths:
2979
3008
  path; the operator face takes explicit selectors). "request.request_id_required" — `requestId` missing / empty /
2980
3009
  non-string. "request.field_invalid" — `allowUnevidenced` present but not a boolean. "request.path_malformed" — the
2981
3010
  session id segment is not valid percent-encoding. "config.memory_erasure_request" — core's own selector verdict (the
2982
- route keeps the arm; today the server's own gates answer first, so it is not reached).
3011
+ route keeps the arm; today the server's own gates answer first, so it is not reached). Server >= 7.140.0: "request.memory_layer" — the
3012
+ `scope` (or this deployment's configured layer) cannot be read (a FIXED sentence for the session owner); "request.field_invalid" also
3013
+ covers a `scope` that is present but not a non-empty string.
2983
3014
  content:
2984
3015
  application/json:
2985
3016
  schema: { $ref: '#/components/schemas/ErrorResponse' }
@@ -2990,18 +3021,22 @@ paths:
2990
3021
  errorCode "memory.target_outside_store" — a directory in this deployment's memory store leads outside it (a link). FIXED
2991
3022
  text on this face (the host path is not echoed; core's sentence goes to the operator log `session_memory_erase_refused`).
2992
3023
  A refusal before the commit point changed nothing; one after it keeps the deletions already made plus a journal. Ask
2993
- the operator to remove the link, then resend with the SAME `requestId`.
3024
+ the operator to remove the link, then resend with the SAME `requestId`. Since server 7.108.0 the other classified refusals of the
3025
+ operator face arrive here too, each with its own code and a FIXED sentence: "memory.erasure_selector_mismatch" /
3026
+ "memory.erasure_evidence_unavailable" / "memory.erasure_census_incomplete"; "memory.scope_home_not_directory" (server >= 7.118.0, same
3027
+ reading as the link code). Server >= 7.140.0: "memory.erasure_store_unjudged" — the erasure lands on the memory store other than the
3028
+ deployment's (a `scope` naming a personal-mount layer, or no `scope` and this session has contributions there / that store's ledger cannot be
3029
+ read): NOTHING erased; a transitional guard, do NOT retry.
2994
3030
  content:
2995
3031
  application/json:
2996
3032
  schema: { $ref: '#/components/schemas/ErrorResponse' }
2997
3033
  '500':
2998
3034
  description: >
2999
- errorCode "internal.error" ("session memory erasure failed") — anything else the engine threw. ⚠️ UNLIKE the operator
3000
- face, this face does NOT forward core's coded refusals: 409 `memory.erasure_selector_mismatch` /
3001
- `memory.erasure_evidence_unavailable` / `memory.erasure_census_incomplete` and the two-meaninged 500
3002
- `internal.memory_control_plane_corrupt` all land HERE — including "deletions COMMITTED, only the residue enumeration
3003
- failed". Never read this 500 as "nothing was deleted": resend with the SAME `requestId` (the journal lane replays and
3004
- converges).
3035
+ errorCode "internal.error" ("session memory erasure failed") — anything the classified map does not cover. Since server 7.108.0 this face
3036
+ shares the operator face's classified map (codes and statuses identical, only the audience wording differs), so core's coded refusals arrive under their
3037
+ own codes. The two-meaninged 500 `internal.memory_control_plane_corrupt` is also classified here (a fixed sentence): either nothing changed, or the deletions
3038
+ were COMMITTED and only the residue enumeration failed — never read a 500 as "nothing was deleted": resend with the SAME `requestId` (the journal lane
3039
+ replays and converges).
3005
3040
  content:
3006
3041
  application/json:
3007
3042
  schema: { $ref: '#/components/schemas/ErrorResponse' }
@@ -5440,6 +5475,7 @@ paths:
5440
5475
  `org:*`/`userproj:*` keys are operator-only until the S3 registry; repo-backed `proj:*` keys never
5441
5476
  live in this DB (git is their authority — an owner asking gets an honestly empty set). 501 on a
5442
5477
  file memory backend (present ONLY with MEMORY_ENGINE_BACKEND=pg|tidb).
5478
+ Server >= 7.140.0: a `scope` the engine cannot read as a layer key ⇒ 400 `request.memory_layer` (it was a 200 / 500 before — on EVERY deployment, single-store included).
5443
5479
  parameters:
5444
5480
  - in: query
5445
5481
  name: scope
@@ -5485,6 +5521,7 @@ paths:
5485
5521
  zero-oracle: own user disk or explicit operator) → shape validation (422 typed
5486
5522
  `memory_sync_invalid_body`). A 500 after partial application is an HONEST signal: replaying with the
5487
5523
  same baseRevs is idempotent self-healing (identical revs no-op throughout) — never silently swallowed.
5524
+ Server >= 7.140.0: a `:scope` the engine cannot read as a layer key ⇒ 400 `request.memory_layer` (it was a 500 before).
5488
5525
  requestBody:
5489
5526
  required: true
5490
5527
  content:
@@ -5535,13 +5572,18 @@ paths:
5535
5572
  structure that drifts with core. This is DELIBERATELY THE OPPOSITE of the import report (an explicit
5536
5573
  whitelist there): the test is "is a new key silently reaching the wire dangerous?" — in a disposition
5537
5574
  list, yes; in a STATEMENT OF FACT, withholding a field is the dangerous half.
5575
+
5576
+ 🔴 LAYER SEAT (server >= 7.140.0; contract §9 head; the key is defined once, in `components.schemas.MemoryLayerSeat`): An entry id names no layer, so the optional query `scope=<layer key>` says which store answers.
5577
+ Where it is missing, on a two-store deployment, for a verb that names no layer ⇒ 400 `request.memory_layer`; single-store deployments answer exactly as 7.139.x; older servers ignore the key.
5578
+ parameters:
5579
+ - $ref: '#/components/parameters/MemoryLayerSeatQuery'
5538
5580
  responses:
5539
5581
  '200':
5540
5582
  description: The entry's assembled provenance account (core's, verbatim).
5541
5583
  content:
5542
5584
  application/json:
5543
5585
  schema: { $ref: '#/components/schemas/EntryProvenanceAccount' }
5544
- '400': { description: 'errorCode "request.id_invalid" — the entry id could not be decoded.' }
5586
+ '400': { description: 'errorCode "request.id_invalid" — the entry id could not be decoded. Server >= 7.140.0: "request.memory_layer" — the request cannot be placed on one memory store (two-store deployment and no `scope`, or the layer key cannot be read); "request.field_invalid" — `scope` present but not a non-empty string.' }
5545
5587
  '401': { $ref: '#/components/responses/Unauthorized' }
5546
5588
  '403': { description: 'errorCode "auth.operator_only" — provenance and erasure are operator-only deployment actions. With an EMPTY `OPERATOR_PRINCIPALS` the answer is instead 501 `capability.operator_principals_required` (server >= 7.116.0; any identity, ahead of authorization — branch on `errorCode`, not the status).' }
5547
5589
  '500':
@@ -5589,6 +5631,14 @@ paths:
5589
5631
  guards "files quietly vanished during harvest"; an explicitly authorized erasure vouches for itself by
5590
5632
  enumerating every id in the attestation). `residuals.propagation` is core's self-declared boundary:
5591
5633
  deletion is a THIS-STORE fact, remote-peer convergence is the sync deployment's half to prove.
5634
+
5635
+ 🔴 LAYER SEAT (server >= 7.140.0; contract §9 head; the key is defined once, in `components.schemas.MemoryLayerSeat`): This face has NO top-level `scope` key (the body goes to the engine as sent): `select.scope` names the layer; for `select.ids` / `select.sessionId` the layer seat is `expectedScopes` (the authorization set); `select.ids` without it on a two-store deployment ⇒ 400 `request.memory_layer`.
5636
+
5637
+ 🔴 ERASURE EXECUTES ONLY ON THE DEPLOYMENT'S STORE (server >= 7.140.0, a transitional guard): the erasure `requestId` idempotency judgment
5638
+ (replay convergence; the same id under another selector ⇒ 409 `memory.erasure_selector_mismatch`) lives on EACH store's own evidence chain, and the
5639
+ engine has no deployment-wide erasure request identity yet. An erasure that lands on the OTHER store (the named layer lives on the personal mount; or,
5640
+ by session, the session has contributions there or that store's ledger cannot be read) ⇒ 409 `memory.erasure_store_unjudged`: NOTHING was erased and
5641
+ nothing recorded; the request is legal, the way out is the engine's deployment-wide request identity (the guard is deleted when it lands).
5592
5642
  requestBody:
5593
5643
  required: true
5594
5644
  content:
@@ -5602,7 +5652,9 @@ paths:
5602
5652
  schema: { $ref: '#/components/schemas/MemoryErasureAttestation' }
5603
5653
  '400':
5604
5654
  description: >
5605
- Three codes, three different operator actions — deliberately not folded into one.
5655
+ Three codes, three different operator actions — deliberately not folded into one (server >= 7.140.0 adds "request.memory_layer" — the request
5656
+ cannot be placed on one memory store: `select.ids` without `expectedScopes` on a two-store deployment, layers spanning two stores, or an unreadable
5657
+ layer key — and, from 7.138.0, "config.memory_erasure_scope" — the request reaches outside its `expectedScopes`, nothing erased).
5606
5658
  "request.request_id_required": `requestId` missing / empty / non-string. It is THIS request's
5607
5659
  idempotency identity and the server never mints one for you, so a RETRY MUST CARRY THE SAME ID (a lost
5608
5660
  ack must not open a second real delete). "request.body_shape": the top-level JSON shape is wrong, or a
@@ -5616,8 +5668,10 @@ paths:
5616
5668
  '403': { description: 'errorCode "auth.operator_only" — provenance and erasure are operator-only deployment actions. With an EMPTY `OPERATOR_PRINCIPALS` the answer is instead 501 `capability.operator_principals_required` (server >= 7.116.0; any identity, ahead of authorization — branch on `errorCode`, not the status).' }
5617
5669
  '409':
5618
5670
  description: >
5619
- Three core-minted codes, passed through verbatim; branch on `errorCode` (the status cannot tell them
5620
- apart). "memory.erasure_evidence_unavailable": this backend has NO evidence face and the caller did not
5671
+ Core-minted codes passed through verbatim, plus one server-minted code; branch on `errorCode` (the status cannot tell them
5672
+ apart). Server >= 7.140.0: "memory.erasure_store_unjudged" (server-minted) — the erasure lands on the memory store other than the deployment's
5673
+ (the named layer lives on the personal mount, or the session has contributions there / that store's ledger cannot be read): NOTHING erased, nothing
5674
+ recorded; the request is legal; do NOT retry. "memory.erasure_evidence_unavailable": this backend has NO evidence face and the caller did not
5621
5675
  opt into the degraded lane — deliberately NOT 501, because the caller holds a real choice
5622
5676
  (`allowUnevidenced: true`) and a 501 would send someone off to change a deployment that is fine.
5623
5677
  "memory.erasure_selector_mismatch": this `requestId` was first executed under a DIFFERENT selector —
@@ -5684,6 +5738,8 @@ paths:
5684
5738
  Each row's `provenance` IS the `EntryProvenanceAccount` of item ③ (same discriminated form, same
5685
5739
  pass-through discipline). An entry that is also CHALLENGED is still listed here — the exclusion rides
5686
5740
  inside the provenance account, and a human must SEE it in order to adjudicate it.
5741
+
5742
+ 🔴 LAYER SEAT (server >= 7.140.0; contract §9 head; the key is defined once, in `components.schemas.MemoryLayerSeat`): This face names its layers in `scopes`, so it needs no `scope`: `scopes` spanning two stores ⇒ 400 `request.memory_layer` (one request, one store — split it per store).
5687
5743
  responses:
5688
5744
  '200':
5689
5745
  description: The audited scopes (normalized, echoed) and one row per marked entry.
@@ -5735,12 +5791,18 @@ paths:
5735
5791
  else's name. The deployment-side counterpart is a server log line (`memory_origin_cleared`) carrying the
5736
5792
  VERIFIED principal beside the CLAIMED requestId and the `clearanceId` to join on — DO NOT draw a compliance
5737
5793
  conclusion from the ledger alone.
5794
+
5795
+ 🔴 LAYER SEAT (server >= 7.140.0; contract §9 head; the key is defined once, in `components.schemas.MemoryLayerSeat`): The ledger is kept PER STORE (on that store's control plane), so on a two-store deployment `scope=<layer key>` says whose ledger to read; to audit both stores, ask twice.
5796
+ Where it is missing, on a two-store deployment, for a verb that names no layer ⇒ 400 `request.memory_layer`; single-store deployments answer exactly as 7.139.x; older servers ignore the key.
5797
+ parameters:
5798
+ - $ref: '#/components/parameters/MemoryLayerSeatQuery'
5738
5799
  responses:
5739
5800
  '200':
5740
5801
  description: The clearance ledger (whitelist projection, newest-first not guaranteed).
5741
5802
  content:
5742
5803
  application/json:
5743
5804
  schema: { $ref: '#/components/schemas/MemoryOriginClearancesResult' }
5805
+ '400': { description: 'Server >= 7.140.0: errorCode "request.memory_layer" (two-store deployment and no `scope`, or the layer key cannot be read) or "request.field_invalid" (`scope` present but not a non-empty string).' }
5744
5806
  '401': { $ref: '#/components/responses/Unauthorized' }
5745
5807
  '403': { description: 'errorCode "auth.operator_only" — origin marking and clearance are operator-only deployment actions. With an EMPTY `OPERATOR_PRINCIPALS` the answer is instead 501 `capability.operator_principals_required` (server >= 7.116.0; any identity, ahead of authorization — branch on `errorCode`, not the status).' }
5746
5808
  '500':
@@ -5786,6 +5848,9 @@ paths:
5786
5848
  the terminal EVENT carries yours. So operator B, who resent after a 409 `memory.origin_clear_pending` as
5787
5849
  instructed and got a 200, may have completed operator A's row. ⇒ AFTER A 200, READ
5788
5850
  `GET /v1/memory/origin/clearances` BACK and check `reason` / `requestId`; `clearanceId` is that row's key.
5851
+
5852
+ 🔴 LAYER SEAT (server >= 7.140.0; contract §9 head; the key is defined once, in `components.schemas.MemoryLayerSeat`): An entry id names no layer, so the optional body key `scope` says which store answers; it is not passed to the engine. On a two-store deployment send it (and read the clearances ledger with the same `scope`).
5853
+ Where it is missing, on a two-store deployment, for a verb that names no layer ⇒ 400 `request.memory_layer`; single-store deployments answer exactly as 7.139.x; older servers ignore the key.
5789
5854
  requestBody:
5790
5855
  required: true
5791
5856
  content:
@@ -5801,7 +5866,8 @@ paths:
5801
5866
  description: >
5802
5867
  "request.id_invalid" (the entry id could not be decoded) / "request.request_id_required" (`requestId`
5803
5868
  missing / empty / non-string — mint a stable id and resend; unlike the erase face, a retry here MAY
5804
- carry a new one) / "request.body_shape" (the top-level JSON shape is wrong).
5869
+ carry a new one) / "request.body_shape" (the top-level JSON shape is wrong). Server >= 7.140.0: "request.memory_layer" (two-store deployment and no
5870
+ body `scope`, or the layer key cannot be read) / "request.field_invalid" (`scope` present but not a non-empty string).
5805
5871
  content:
5806
5872
  application/json:
5807
5873
  schema: { $ref: '#/components/schemas/ErrorResponse' }
@@ -7016,6 +7082,16 @@ components:
7016
7082
  Authenticated end-user identity (REQUIRED; principal-first, CORE-PRINCIPLES §3). Opaque to the service
7017
7083
  (memory scope + session owner key; its meaning is not interpreted, but the server refuses a value that is not a principal name: 400 `principal_not_a_name` (server >= 7.137.0 — empty / whitespace-only, control, line-separator or invisible format characters; a proxy that writes raw UTF-8 bytes into the header is read as latin1 and refused), 400 `principal_reserved` (a reserved sentinel) and 400 `principal_too_long` (over 190 characters)). The SDK normalizes; anonymous must
7018
7084
  be explicit (`anon:<id>`). On the multi-tenant doors this is set PER REQUEST.
7085
+ MemoryLayerSeatQuery:
7086
+ in: query
7087
+ name: scope
7088
+ required: false
7089
+ description: >
7090
+ Layer seat (server >= 7.140.0; contract §9 head) — the memory layer key (e.g. `user:alice`, `local`) whose store answers this request.
7091
+ Needed only on a TWO-STORE deployment for verbs that name no layer (an entry id, a store-level ledger); absent there ⇒ 400
7092
+ `request.memory_layer`. Present but not a non-empty string ⇒ 400 `request.field_invalid`. It only decides WHICH store answers.
7093
+ The key is defined once, in `components.schemas.MemoryLayerSeat`.
7094
+ schema: { $ref: '#/components/schemas/MemoryLayerSeat/properties/scope' }
7019
7095
  IdempotencyKey:
7020
7096
  in: header
7021
7097
  name: idempotency-key
@@ -11548,6 +11624,27 @@ components:
11548
11624
  events: { type: array, items: { $ref: '#/components/schemas/MemoryTransferEvidence' } }
11549
11625
  reason: { type: string }
11550
11626
 
11627
+ MemoryLayerSeat:
11628
+ type: object
11629
+ description: >
11630
+ The LAYER SEAT (server >= 7.140.0; contract §9 head) — the one definition of the optional key `scope` that the memory verbs naming no layer carry.
11631
+ One memory request lands on ONE store: the store the named layer lives in (file backend: the typed personal layers `user:` / `userproj:` / `org:` live in a
11632
+ SECOND store under the personal mount; the project layers and the un-typed layers, `local` included, live in the deployment's store). It rides the query string
11633
+ (`GET /v1/memory/entries/{entryId}/provenance`, `GET /v1/memory/origin/clearances`, `GET /v1/sessions/{sessionId}/memory-status`) or the body
11634
+ (`MemoryOriginClearRequest`, `SessionMemoryEraseRequest`); `POST /v1/memory/erase` has no such key (the layer comes from `select.scope` / `expectedScopes`).
11635
+ Needed only on a TWO-STORE deployment for verbs that name no layer; a single-store deployment answers byte-for-byte as 7.139.x. This schema is open: it only
11636
+ defines the key, and is embedded by property reference — it is not a request body of its own.
11637
+ additionalProperties: true
11638
+ properties:
11639
+ scope:
11640
+ type: string
11641
+ minLength: 1
11642
+ description: >
11643
+ The memory layer key (e.g. `user:alice`, `local`) whose store answers. Absent ⇒ no layer named: on a two-store deployment the verbs that name no layer
11644
+ answer 400 `request.memory_layer` (the session-id verbs fold or run on the deployment's store instead); present but not a non-empty string ⇒ 400
11645
+ `request.field_invalid` (sentence only); a layer key the engine cannot read ⇒ 400 `request.memory_layer`. It only decides WHICH store answers — it never
11646
+ reaches the engine.
11647
+
11551
11648
  MemoryErasureRequest:
11552
11649
  type: object
11553
11650
  description: >
@@ -11572,12 +11669,22 @@ components:
11572
11669
  allowUnevidenced:
11573
11670
  type: boolean
11574
11671
  description: "Opt-in to the evidence-capability-ABSENT degradation lane. Default = a loud refusal (409 `memory.erasure_evidence_unavailable`)."
11672
+ expectedScopes:
11673
+ type: array
11674
+ items: { type: string }
11675
+ description: >
11676
+ The authorization set of this erasure (server >= 7.138.0; the judge is core): when present, the selector's own scope and the bound scope of EVERY
11677
+ resolved id must lie in the set, else the whole request is refused 400 `config.memory_erasure_scope` (nothing erased or recorded; an id whose scope the
11678
+ store cannot attribute, or that never existed, counts as outside). The empty set authorizes no scope; absent = no narrowing. Server >= 7.140.0: it ALSO
11679
+ serves as the layer seat of `select.ids` / `select.sessionId` on a two-store deployment (a non-empty set decides which store answers; spanning two stores ⇒
11680
+ 400 `request.memory_layer`; a personal-mount store ⇒ 409 `memory.erasure_store_unjudged`; `select.ids` without it on a two-store deployment ⇒ 400
11681
+ `request.memory_layer`).
11575
11682
 
11576
11683
  SessionMemoryEraseRequest:
11577
11684
  type: object
11578
11685
  description: >
11579
11686
  Request body of POST /v1/sessions/{sessionId}/memory/erase (contract §12.5; release bytes server 7.107.0
11580
- `dist/http/routes/sessions.js:508-523`). Two NAMED keys. `select` is FORBIDDEN (the selector is minted by the path; a body
11687
+ `dist/http/routes/sessions.js:508-523`; the layer seat `scope` is server >= 7.140.0). Three NAMED keys. `select` is FORBIDDEN (the selector is minted by the path; a body
11581
11688
  carrying it is a loud 400 `request.body_shape`). Any OTHER unknown key is NOT refused — the route silently ignores it and
11582
11689
  forwards only `requestId` / `allowUnevidenced` (`:526`) — so this schema is open except for `select` (codex r1 F1: a closed
11583
11690
  schema would make a strict consumer reject a body the server accepts). `requestId` has the SAME meaning as
@@ -11591,6 +11698,11 @@ components:
11591
11698
  allowUnevidenced:
11592
11699
  type: boolean
11593
11700
  description: "Opt-in to the evidence-capability-ABSENT degradation lane — a human signature; never injected. Non-boolean ⇒ 400 `request.field_invalid`."
11701
+ scope:
11702
+ # the one definition of the layer seat key: `components.schemas.MemoryLayerSeat`. On THIS face (server >= 7.140.0): a layer living in the deployment's store
11703
+ # (e.g. `local`) ⇒ the erasure runs there (200; the attestation covers that store only, the seat reaches neither the engine nor the attestation); a layer on the
11704
+ # personal mount ⇒ 409 `memory.erasure_store_unjudged`; unreadable ⇒ 400 `request.memory_layer`.
11705
+ $ref: '#/components/schemas/MemoryLayerSeat/properties/scope'
11594
11706
 
11595
11707
  MemoryErasedBinding:
11596
11708
  description: "core `ErasedBinding` — one erased row's coordinates: the scope it was bound in, NEVER its file name (a model-chosen name can restate the content being erased; attestation v2)."
@@ -11880,6 +11992,10 @@ components:
11880
11992
  properties:
11881
11993
  requestId: { type: string, minLength: 1 }
11882
11994
  reason: { type: string }
11995
+ scope:
11996
+ # the one definition of the layer seat key: `components.schemas.MemoryLayerSeat`. On THIS face: required in practice on a TWO-STORE deployment
11997
+ # (absent ⇒ 400 `request.memory_layer`); not passed to the engine.
11998
+ $ref: '#/components/schemas/MemoryLayerSeat/properties/scope'
11883
11999
 
11884
12000
  MemoryOriginClearReceipt:
11885
12001
  type: object
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/sdk",
3
- "version": "30.0.0",
3
+ "version": "30.1.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",
@@ -55,6 +55,6 @@
55
55
  "prepublishOnly": "rm -f tsconfig.tsbuildinfo && npm run build && npm run typecheck --workspaces=false --prefix ../.. && npm test --workspaces=false --prefix ../.. && npm run prepack"
56
56
  },
57
57
  "devDependencies": {
58
- "@sema-agent/settings-schema": "^15.1.0"
58
+ "@sema-agent/settings-schema": "^15.2.0"
59
59
  }
60
60
  }