@sema-agent/core 7.56.0 → 7.57.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 (173) hide show
  1. package/CHANGELOG.md +541 -0
  2. package/LICENSE +1 -1
  3. package/dist/agents/org-delivery-gate.js +3 -4
  4. package/dist/agents/peer-held-queue.d.ts +69 -49
  5. package/dist/agents/peer-held-queue.js +255 -106
  6. package/dist/agents/peer-session-drain.js +63 -43
  7. package/dist/agents/send-message-tool.js +3 -2
  8. package/dist/agents/subagent.js +8 -8
  9. package/dist/brain/anthropic.js +16 -8
  10. package/dist/brain/open-responses.js +10 -8
  11. package/dist/brain/openai.js +11 -9
  12. package/dist/brain/provider-dialect.d.ts +3 -2
  13. package/dist/brain/provider-dialect.js +2 -2
  14. package/dist/brain/request-params.d.ts +6 -0
  15. package/dist/brain/request-params.js +14 -1
  16. package/dist/brain/stream-engine.d.ts +9 -0
  17. package/dist/brain/stream-engine.js +24 -10
  18. package/dist/brain/stream-shared.d.ts +5 -4
  19. package/dist/brain/stream-shared.js +4 -4
  20. package/dist/core/allow-entry.d.ts +3 -10
  21. package/dist/core/allow-entry.js +17 -25
  22. package/dist/core/approval-object.d.ts +21 -5
  23. package/dist/core/approval-object.js +44 -17
  24. package/dist/core/ask-origin.d.ts +2 -2
  25. package/dist/core/auto-compaction.d.ts +71 -6
  26. package/dist/core/auto-compaction.js +42 -26
  27. package/dist/core/background-agent-store.d.ts +6 -2
  28. package/dist/core/background-agent-store.js +1 -1
  29. package/dist/core/checkpoint-requirements.d.ts +7 -1
  30. package/dist/core/checkpoint-requirements.js +2 -0
  31. package/dist/core/checkpoint-store.d.ts +17 -29
  32. package/dist/core/checkpoint-store.js +19 -11
  33. package/dist/core/cross-boundary-taint.js +4 -2
  34. package/dist/core/engine-notice.d.ts +3 -2
  35. package/dist/core/engine-notice.js +6 -0
  36. package/dist/core/file-history-store.d.ts +14 -8
  37. package/dist/core/file-history-store.js +14 -4
  38. package/dist/core/gate-lanes.js +2 -3
  39. package/dist/core/hooks.d.ts +2 -2
  40. package/dist/core/mailbox-store.d.ts +62 -1
  41. package/dist/core/mailbox-store.js +59 -0
  42. package/dist/core/mcp-name-judge.d.ts +46 -0
  43. package/dist/core/mcp-name-judge.js +61 -0
  44. package/dist/core/mcp-probe.d.ts +1 -1
  45. package/dist/core/mcp-probe.js +2 -5
  46. package/dist/core/mcp.js +10 -30
  47. package/dist/core/memory-engine/consolidation-driver.js +4 -3
  48. package/dist/core/memory-engine/distiller.js +26 -17
  49. package/dist/core/memory-engine/layout.js +5 -2
  50. package/dist/core/park-selfcheck.js +2 -0
  51. package/dist/core/permission-rule-consent.d.ts +5 -3
  52. package/dist/core/permission-rule-consent.js +20 -15
  53. package/dist/core/permission-rule-model.d.ts +43 -2
  54. package/dist/core/permission-rule-model.js +52 -8
  55. package/dist/core/permission-rule-org.js +1 -1
  56. package/dist/core/protocol-http-auth.d.ts +16 -2
  57. package/dist/core/protocol-http-auth.js +42 -11
  58. package/dist/core/protocol-naming.d.ts +20 -0
  59. package/dist/core/protocol-naming.js +20 -3
  60. package/dist/core/read-only-shell.d.ts +20 -5
  61. package/dist/core/read-only-shell.js +29 -14
  62. package/dist/core/remote-env.d.ts +37 -1
  63. package/dist/core/remote-env.js +11 -0
  64. package/dist/core/resume-startup-cause.d.ts +24 -2
  65. package/dist/core/resume-startup-cause.js +20 -1
  66. package/dist/core/roles.js +50 -7
  67. package/dist/core/runner/compact-session.d.ts +10 -0
  68. package/dist/core/runner/compact-session.js +202 -0
  69. package/dist/core/runner/compaction-call-options.d.ts +2 -2
  70. package/dist/core/runner/compaction-seams.d.ts +21 -1
  71. package/dist/core/runner/compaction-seams.js +11 -8
  72. package/dist/core/runner/contracts.d.ts +23 -16
  73. package/dist/core/runner/derived-route-fallback.d.ts +13 -0
  74. package/dist/core/runner/derived-route-fallback.js +6 -0
  75. package/dist/core/runner/env-capability-census.d.ts +3 -2
  76. package/dist/core/runner/env-capability-census.js +9 -3
  77. package/dist/core/runner/permission-rule-lanes.d.ts +7 -7
  78. package/dist/core/runner/permission-rule-lanes.js +17 -11
  79. package/dist/core/runner/prepare-acquire-reconcile.d.ts +3 -0
  80. package/dist/core/runner/prepare-acquire-reconcile.js +2 -1
  81. package/dist/core/runner/prepare-config-doors.d.ts +6 -0
  82. package/dist/core/runner/prepare-config-doors.js +4 -3
  83. package/dist/core/runner/prepare-hands-readface.d.ts +3 -1
  84. package/dist/core/runner/prepare-hands-readface.js +2 -0
  85. package/dist/core/runner/prepare-park-ask.d.ts +2 -0
  86. package/dist/core/runner/prepare-park-ask.js +2 -2
  87. package/dist/core/runner/prepare-policy-chain.js +2 -4
  88. package/dist/core/runner/prepare-task.d.ts +4 -1
  89. package/dist/core/runner/prepare-task.js +23 -27
  90. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +13 -0
  91. package/dist/core/runner/prepare-tool-disclosure-mount.js +13 -7
  92. package/dist/core/runner/rewind-files.d.ts +2 -5
  93. package/dist/core/runner/rewind-files.js +9 -51
  94. package/dist/core/runner/run-leg.js +10 -21
  95. package/dist/core/runner/run-notification-lane.d.ts +2 -0
  96. package/dist/core/runner/run-notification-lane.js +2 -2
  97. package/dist/core/runner/run-recovery-lanes.js +3 -4
  98. package/dist/core/runner/run-settle-and-teardown.js +5 -11
  99. package/dist/core/runner/run-terminal-adoption.js +3 -4
  100. package/dist/core/runner/run-turn-boundary.js +3 -5
  101. package/dist/core/runner/runtask.d.ts +8 -1
  102. package/dist/core/runner/runtask.js +28 -34
  103. package/dist/core/runner/send-message-continuation.js +1 -1
  104. package/dist/core/runner/session-verb-doors.d.ts +28 -0
  105. package/dist/core/runner/session-verb-doors.js +48 -0
  106. package/dist/core/runner/session-write-ledger.d.ts +30 -0
  107. package/dist/core/runner/session-write-ledger.js +101 -0
  108. package/dist/core/runner/stream-settle-backstop.js +11 -14
  109. package/dist/core/runner/sub-agent-deny-lists.d.ts +25 -3
  110. package/dist/core/runner/sub-agent-deny-lists.js +21 -10
  111. package/dist/core/runner/teardown-bounded.d.ts +1 -0
  112. package/dist/core/runner/teardown-bounded.js +1 -0
  113. package/dist/core/runner-deps.d.ts +2 -2
  114. package/dist/core/secret-env.d.ts +4 -0
  115. package/dist/core/secret-env.js +3 -0
  116. package/dist/core/session-policy-store.d.ts +7 -2
  117. package/dist/core/session-policy-store.js +1 -1
  118. package/dist/core/shell-wrapper-projection.d.ts +1 -1
  119. package/dist/core/store-contracts/background-agent-store-contract.js +1 -0
  120. package/dist/core/store-contracts/checkpoint-store-contract.js +2 -1
  121. package/dist/core/store-contracts/file-history-store-contract.js +9 -0
  122. package/dist/core/store-contracts/mailbox-store-contract.js +49 -1
  123. package/dist/core/task-registry-agent.d.ts +8 -4
  124. package/dist/core/task-registry-agent.js +14 -8
  125. package/dist/core/task-registry-shared.d.ts +35 -6
  126. package/dist/core/task-registry-shared.js +11 -0
  127. package/dist/core/task-registry.d.ts +1 -1
  128. package/dist/core/task-registry.js +1 -1
  129. package/dist/core/tool-catalog-entries.d.ts +6 -0
  130. package/dist/core/tool-catalog-entries.js +1 -0
  131. package/dist/core/tool-name-aliases.d.ts +32 -2
  132. package/dist/core/tool-name-aliases.js +23 -0
  133. package/dist/core/tool-name-readings.d.ts +4 -0
  134. package/dist/core/tool-name-readings.js +1 -0
  135. package/dist/core/tool-policy.d.ts +10 -6
  136. package/dist/core/tool-policy.js +4 -7
  137. package/dist/core/trace.d.ts +4 -1
  138. package/dist/core/trace.js +2 -1
  139. package/dist/core/untrusted-egress.d.ts +20 -0
  140. package/dist/core/untrusted-egress.js +77 -3
  141. package/dist/engine/harness/agent-harness.d.ts +7 -5
  142. package/dist/engine/harness/agent-harness.js +11 -2
  143. package/dist/engine/loop/agent-loop.d.ts +1 -4
  144. package/dist/engine/loop/agent-loop.js +26 -4
  145. package/dist/index.d.ts +12 -7
  146. package/dist/index.js +7 -4
  147. package/dist/internal/harness.d.ts +2 -1
  148. package/dist/internal/harness.js +1 -0
  149. package/dist/primitives/credential-ref.d.ts +89 -0
  150. package/dist/primitives/credential-ref.js +125 -0
  151. package/dist/primitives/index.d.ts +2 -0
  152. package/dist/primitives/index.js +1 -0
  153. package/dist/stores/file/checkpoint-store.d.ts +0 -4
  154. package/dist/stores/file/checkpoint-store.js +0 -1
  155. package/dist/stores/file/file-history-store.js +12 -4
  156. package/dist/stores/file/mailbox-store.d.ts +2 -1
  157. package/dist/stores/file/mailbox-store.js +26 -1
  158. package/dist/tools/fs/bash-readonly-classifier.d.ts +15 -19
  159. package/dist/tools/fs/bash-readonly-classifier.js +5 -10
  160. package/dist/tools/fs/fs-bash.js +10 -3
  161. package/dist/tools/fs/pattern-kill-guard.d.ts +3 -2
  162. package/dist/tools/fs/pattern-kill-guard.js +68 -36
  163. package/dist/tools/fs/shell-read-check.d.ts +10 -0
  164. package/dist/tools/fs/shell-read-check.js +7 -1
  165. package/dist/tools/fs/shell-read-identity.d.ts +12 -9
  166. package/dist/tools/fs/shell-read-identity.js +9 -4
  167. package/dist/tools/web.js +9 -7
  168. package/package.json +1 -1
  169. package/test/export-surface.snapshot.json +79 -3
  170. package/wire-changes/core-stores-sql@7.57.0.json +29 -0
  171. package/wire-changes/core@7.57.0.json +1487 -0
  172. package/wire-changes/mods-kernel@7.57.0.json +29 -0
  173. package/wire-changes/primitives@7.57.0.json +245 -0
package/LICENSE CHANGED
@@ -5,7 +5,7 @@ Parameters
5
5
  Licensor: clay (github.com/clayboby)
6
6
  Licensed Work: @sema-agent/core (sema-core) and the satellite packages
7
7
  published from this repository (currently
8
- @sema-agent/mods-kernel)
8
+ @sema-agent/mods-kernel, @sema-agent/primitives and @sema-agent/core-stores-sql)
9
9
  (formerly published as @sema-ai/core)
10
10
  The Licensed Work is (c) 2026 clay.
11
11
  Additional Use Grant: You may make production use of the Licensed Work for
@@ -7,9 +7,8 @@ export function principalInboxConsumerOf(deps) {
7
7
  const raw = deps.principalInboxConsumer;
8
8
  if (raw === undefined)
9
9
  return { kind: "none" };
10
- if (raw === "terminals") {
11
- throw consumerRefusal(`RunnerDeps.principalInboxConsumer "terminals" is not available yet: the shared held decision ledger is not yet available, so a letter a person refused in one terminal could be delivered by another. Declare { assistant: "<agent handle>" } or leave the seat absent.`, "terminals_unsupported");
12
- }
10
+ if (raw === "terminals")
11
+ return { kind: "terminals" };
13
12
  if (raw !== null && typeof raw === "object" && !Array.isArray(raw) && Object.getPrototypeOf(raw) === Object.prototype) {
14
13
  const keys = Reflect.ownKeys(raw);
15
14
  const handle = raw.assistant;
@@ -32,7 +31,7 @@ export function isOrgDeliveryRefusalCode(value) {
32
31
  export function mintCrossPrincipalRecord(input) {
33
32
  const { from, body, receiptId, sentAt, consumer } = input;
34
33
  if (consumer?.kind !== "terminals" && consumer?.kind !== "assistant") {
35
- throw consumerRefusal(`an organization delivery gate is minting a principal-inbox letter, but the deployment declares no principal-inbox consumer (RunnerDeps.principalInboxConsumer is absent): nobody would ever read it. Declare { assistant: "<agent handle>" }.`, "no_consumer");
34
+ throw consumerRefusal(`an organization delivery gate is minting a principal-inbox letter, but the deployment declares no principal-inbox consumer (RunnerDeps.principalInboxConsumer is absent): nobody would ever read it. Declare "terminals" or { assistant: "<agent handle>" }.`, "no_consumer");
36
35
  }
37
36
  if (typeof body.content !== "string")
38
37
  throw new TypeError("mintCrossPrincipalRecord: body.content must be a string");
@@ -1,10 +1,12 @@
1
- import type { MailboxPeerMeta } from "../core/mailbox-store.js";
1
+ import { type MailboxPeerMeta, type MailboxDecisionOutcome, type MailboxDecision } from "../core/mailbox-store.js";
2
2
  import type { CrossSessionHoldCause, CrossSessionInboundVerdict } from "./cross-session-judge.js";
3
3
  import { type PeerDeliveryReceiptState } from "./peer-notices.js";
4
4
  /** The `cause` vocabulary of a `peer.inbound_disposition{disposition:"held"}` notice: the parity
5
5
  * judge's causes plus the drain-stage gate's TRANSIENT `rate_limited` (a bucket-wait, not a review
6
6
  * hold — it never enters the held queue; the drain stops at that seq and re-judges next pass). */
7
7
  export type PeerInboundHoldCause = CrossSessionHoldCause | "rate_limited";
8
+ /** The decisions a card can stand for: held, approved, or handed over but not yet injected. */
9
+ export type PeerCardDecision = Extract<MailboxDecision, "held" | "approved" | "delivered">;
8
10
  export interface PeerHeldEntry {
9
11
  /** The recipient box seq of the held record (its identity for the review face). */
10
12
  readonly seq: number;
@@ -21,12 +23,16 @@ export interface PeerHeldEntry {
21
23
  readonly heldAt: number;
22
24
  /** The cause last announced for this entry (re-judgment may move it). */
23
25
  cause: CrossSessionHoldCause;
24
- /** Approved by the review face while no run of the session was live: delivered at the next flush
25
- * (a re-judgment that now refuses still wins — CC `l0e`'s approve arm re-checks policy). */
26
- released?: boolean;
26
+ /** The record's decision as this queue last read or wrote it: `held`; `approved` (deliverable,
27
+ * waiting for a lease-holding pass — a re-judgment that now refuses still wins); `delivered` (this
28
+ * queue took the hand-over move and the injection is still owed; a policy that now refuses ends it as `dropped`). */
29
+ decision: PeerCardDecision;
27
30
  }
28
- export type PeerHeldSettlement = "expired" | "delivered" | "refused" | "denied" | "dropped";
29
- export type PeerHeldSettleReason = "evicted" | "deadline" | "shutdown" | "rejudge" | "approved" | "denied" | "cancelled" | "inject_failed" | "superseded";
31
+ /** How an entry left this queue. `retired` — the CARD left this process but no decision was taken: the
32
+ * record stays held in its box for the next consumer (a queue-local event no receipt announced,
33
+ * or a record another consumer settled). Every other word is the record's own final fate. */
34
+ export type PeerHeldSettlement = "expired" | "delivered" | "refused" | "denied" | "dropped" | "retired";
35
+ export type PeerHeldSettleReason = "evicted" | "deadline" | "shutdown" | "rejudge" | "approved" | "denied" | "cancelled" | "inject_failed" | "superseded" | "decided_elsewhere";
30
36
  /** The clock/timer seam (tests inject a virtual one). Handles are opaque. */
31
37
  export interface PeerClock {
32
38
  now(): number;
@@ -36,81 +42,95 @@ export interface PeerClock {
36
42
  export declare const realPeerClock: PeerClock;
37
43
  /** The live seats a bound run gives the queue. `inject` is the ONLY member that is run-scoped (a run's
38
44
  * own injection lane); the others survive the run (the receipt route rides the mailbox, the judge
39
- * reads the deployment's settings getter) and are what a headless deadline settles through. */
45
+ * reads the deployment's settings getter, the decision seat is the store) and are what a headless
46
+ * deadline settles through. */
40
47
  export interface PeerHeldQueueSink {
41
48
  /** Re-judge an entry against the recipient's CURRENT settings and mode class (CC `M`). */
42
49
  judge: (entry: PeerHeldEntry) => CrossSessionInboundVerdict;
43
- /** Deliver a released entry into the live run's model context. Absent ⇒ no run is live. Throws ⇒
44
- * the lane refused the frame (settled `dropped`, receipt sent). Returns `"deferred"` ⇒ the run is
45
- * live but this pass's delivery budget is spent: the entry stays released and goes at the next
46
- * pass's flush (the same wait a run-less approval takes). */
50
+ /** Deliver a deliverable entry into the live run's model context. Absent ⇒ no run is live. Throws ⇒
51
+ * the lane refused the frame. Returns `"deferred"` ⇒ the run is live but this pass's delivery budget
52
+ * is spent: the entry stays deliverable and goes at the next pass's flush (unless the policy refuses it first). */
47
53
  inject?: (entry: PeerHeldEntry) => void | "deferred";
54
+ /** Would {@link inject} take this entry NOW (a live pass that holds this box's lease, with budget left)?
55
+ * Asked BEFORE the hand-over move (and before a refusal ends a handed-over card), so a process that cannot
56
+ * deliver never takes a move out of `delivered`. Absent ⇒
57
+ * the presence of `inject` decides. */
58
+ canInject?: (entry: PeerHeldEntry) => boolean;
48
59
  /** The receipt to the sender (the binding routes it into the sender's box). */
49
60
  receipt: (entry: PeerHeldEntry, state: PeerDeliveryReceiptState) => void;
61
+ /** Does a receipt about this entry reach a sender? A queue-local event (eviction, shutdown, a refused
62
+ * release) is a decision about the record exactly when it does — the sender is told it is final. */
63
+ tellsSender: (entry: PeerHeldEntry) => boolean;
64
+ /** THE decision seat: the store's compare-and-set of this entry's record (`MailboxStore.moveDecision`). */
65
+ decide: (entry: PeerHeldEntry, expect: MailboxDecision | undefined, next: MailboxDecision) => Promise<MailboxDecisionOutcome>;
50
66
  /** Announce an entry entering the queue (or its cause changing on re-judgment). */
51
67
  onHeld?: (entry: PeerHeldEntry, heldCount: number, cause: CrossSessionHoldCause, reannounce: boolean) => void;
52
68
  /** Announce an entry leaving the queue. */
53
69
  onSettled?: (entry: PeerHeldEntry, settlement: PeerHeldSettlement, reason: PeerHeldSettleReason, heldCount: number) => void;
70
+ /** A decision move the store could not take (it threw): the card stays as it was and is tried again later. */
71
+ onFault?: (entry: PeerHeldEntry, error: unknown) => void;
54
72
  }
55
73
  export interface PeerHeldQueueConfig {
56
74
  sink: PeerHeldQueueSink;
57
75
  /** The resolved `dialogExpiry`: ms before a REVIEW-cause hold expires; `null` = never. */
58
76
  dialogExpiryMs: number | null;
59
77
  }
60
- export type PeerHeldSettleOutcome = "gone" | "delivered" | "released_pending" | "dropped" | "dropped_by_policy" | "denied" | "expired";
78
+ /** The approval face's answer. `decided_elsewhere` — another consumer's move won the record first (the
79
+ * card now shows that state, or left the queue when it was final); `released_pending` — approved, and a
80
+ * lease-holding pass delivers it. */
81
+ export type PeerHeldSettleOutcome = "gone" | "delivered" | "released_pending" | "dropped" | "dropped_by_policy" | "denied" | "expired" | "decided_elsewhere";
82
+ /** What {@link PeerHeldQueue.hold} did with a record the judgment holds: `held` — this call held it
83
+ * (card + `held` receipt); `adopted` — it was already held (or deliverable) and this queue now shows it
84
+ * without a receipt; `uncarded` — held, but this queue is full and no card it carries can be settled to
85
+ * make room (none would tell its sender); a final word — another consumer settled it; `gone` —
86
+ * no such record any more; `fault` — the store refused the move (reported through `onFault`). */
87
+ export type PeerHoldOutcome = "held" | "adopted" | "uncarded" | "denied" | "expired" | "refused" | "dropped" | "gone" | "fault";
61
88
  export interface PeerHeldQueue {
62
89
  /** The registry key (scope + box). */
63
90
  readonly key: string;
64
91
  /** Bind (or re-bind) the live seats. Idempotent per run; a later bind replaces an earlier one. */
65
92
  configure(cfg: PeerHeldQueueConfig): void;
66
- /** The bound run ended: approvals now park as `released`; deadlines and receipts keep working. */
93
+ /** The bound run ended: approvals now wait as `approved`; deadlines and receipts keep working. */
67
94
  detachLeg(): void;
68
95
  /** `true` once {@link configure} ran at least once (the queue can route receipts). */
69
96
  configured(): boolean;
70
- /** Park a message (CC `v` hold arm): evict-oldest when full, arm the deadline for a review cause,
71
- * announce, receipt `held`. */
72
- hold(entry: Omit<PeerHeldEntry, "heldAt" | "released">): void;
73
- /** Re-judge every entry against current settings (CC `D`): released ⇒ delivered (or parked
74
- * `released` with no live run), refused ⇒ refused with a receipt, still held ⇒ re-announced only
75
- * when the cause moved. */
76
- rejudge(): {
97
+ /**
98
+ * Hold a record (CC `v` hold arm). `decision` is the record's decision in the snapshot the caller judged:
99
+ * absent ⇒ the move absent → `held` is taken (its winner sends the `held` receipt); `held` / `approved` ⇒
100
+ * the record is already held elsewhere and this queue only shows it (an approved card is not announced).
101
+ * At the cap, settles the oldest held card that tells its sender (it is then a decision); arms the
102
+ * deadline for a hold cause a person could answer.
103
+ */
104
+ hold(entry: Omit<PeerHeldEntry, "heldAt" | "decision">, decision?: PeerCardDecision): Promise<PeerHoldOutcome>;
105
+ /** Re-judge every entry against current settings (CC `D`): deliverable ⇒ handed over (or kept with no
106
+ * live run), refused ⇒ refused with a receipt, still held ⇒ re-announced only when the cause moved.
107
+ * Every move goes through the decision seat. */
108
+ rejudge(): Promise<{
77
109
  released: number;
78
110
  refused: number;
79
111
  held: number;
80
- };
112
+ }>;
81
113
  /**
82
- * #1036 — the box is this queue's durable seat, so an entry whose record is no longer IN the box was
83
- * settled by whoever held the lease meanwhile (a takeover acked it, delivered or refused). Called by a
84
- * drain right after it claims the lease, with the seqs the claimed snapshot holds (a claim marks EVERY
85
- * unacked record, so absence is absence): such entries leave the queue as `expired` / `superseded`,
86
- * with no receipt (the owner that settled them sent one) and no decision recorded (there is no record
87
- * left to decide about). Returns how many were retired.
114
+ * Bring the cards in line with the box a lease-holding drain just read, seq → the record's decision
115
+ * (every unacked record of the box is in it, so absence is absence): a card whose record is gone was
116
+ * settled by whoever held the lease meanwhile — it leaves as `retired` / `superseded`, with no receipt;
117
+ * a card whose record another consumer settled leaves as that final state / `decided_elsewhere`, with no
118
+ * receipt (the winner sent it); a card whose record another consumer approved now shows `approved`.
119
+ * Returns how many cards left.
88
120
  */
89
- reconcile(present: ReadonlySet<number>): number;
90
- /** The review face (CC `l0e`): approve re-judges then delivers (or parks `released` with no live
91
- * run), deny/cancel drop with the matching receipt. `"gone"` when nothing is held under that seq. */
92
- settle(seq: number, decision: "approve" | "deny" | "cancel"): PeerHeldSettleOutcome;
121
+ reconcile(snapshot: ReadonlyMap<number, MailboxDecision | undefined>): number;
122
+ /** The review face (CC `l0e`): approve re-judges then delivers (or answers `released_pending` with no
123
+ * live run), deny/cancel settle with the matching receipt. `"gone"` when nothing is held under that
124
+ * seq. The answer is the store's: a move another consumer won answers `decided_elsewhere`. */
125
+ settle(seq: number, decision: "approve" | "deny" | "cancel"): Promise<PeerHeldSettleOutcome>;
126
+ /** Is a card for this seq in the queue? */
127
+ has(seq: number): boolean;
93
128
  list(): readonly PeerHeldEntry[];
94
129
  size(): number;
95
- /** CC `HBe` — a graceful shutdown settles everything still held as `expired` with receipts. */
96
- shutdown(): void;
97
- /**
98
- * #1036 — the TERMINAL DECISIONS this queue has taken about records that are still parked in
99
- * the box, seq → the settlement word. Since a held record now stays in its durable box (the box is
100
- * this queue's durable seat), a decision taken BETWEEN runs — a human's deny, a deadline, an
101
- * eviction — has to survive the run whose ledger recorded it, or the session's next run re-judges
102
- * the record from scratch and can deliver a message a person already refused. A decision is kept
103
- * only until a drain that holds the lease acks past it ({@link PeerHeldQueue.forgetDecisions}); it
104
- * is process-level, like the queue itself, and a crash loses it exactly as it loses the queue.
105
- */
106
- decisions(): ReadonlyMap<number, PeerHeldSettlement>;
107
- /** #1036 — a lease-owning drain acked these seqs out of the box: their decisions are spent. */
108
- forgetDecisions(seqs: Iterable<number>): void;
130
+ /** CC `HBe` — a graceful shutdown settles everything still held as `expired` with receipts (where a
131
+ * receipt reaches a sender; elsewhere the cards just leave this process). */
132
+ shutdown(): Promise<void>;
109
133
  }
110
- /** #1036 — how many terminal decisions about still-parked records one box's queue remembers
111
- * (see {@link PeerHeldQueue.decisions}). Several times the queue's own cap: the queue bounds what is
112
- * LIVE, this bounds what has been decided and not yet observed as consumed. */
113
- export declare const PEER_HELD_DECISION_MEMORY: number;
114
134
  export declare function createPeerHeldQueue(key: string, opts?: {
115
135
  cap?: number;
116
136
  clock?: PeerClock;