@sema-agent/core 7.62.0 → 7.63.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 (193) hide show
  1. package/CHANGELOG.md +528 -0
  2. package/dist/agents/subagent-transcript-placement.d.ts +23 -0
  3. package/dist/agents/subagent-transcript-placement.js +14 -0
  4. package/dist/agents/subagent.js +82 -51
  5. package/dist/brain/route-adjudicator.js +9 -4
  6. package/dist/core/approval-object.js +1 -1
  7. package/dist/core/arg-summary.js +1 -1
  8. package/dist/core/ask-question.d.ts +2 -2
  9. package/dist/core/canonical-json.d.ts +23 -13
  10. package/dist/core/canonical-json.js +4 -4
  11. package/dist/core/checkpoint-queries.d.ts +47 -4
  12. package/dist/core/checkpoint-queries.js +36 -16
  13. package/dist/core/checkpoint-requirements.d.ts +3 -3
  14. package/dist/core/checkpoint-requirements.js +2 -1
  15. package/dist/core/checkpoint-row-verdict.d.ts +15 -4
  16. package/dist/core/checkpoint-row-verdict.js +22 -2
  17. package/dist/core/checkpoint-store.d.ts +23 -10
  18. package/dist/core/checkpoint-store.js +45 -4
  19. package/dist/core/compliance.d.ts +6 -2
  20. package/dist/core/compliance.js +3 -3
  21. package/dist/core/engine-attestation.d.ts +1 -1
  22. package/dist/core/engine-notice.d.ts +19 -4
  23. package/dist/core/git-worktree-env.d.ts +62 -3
  24. package/dist/core/git-worktree-env.js +91 -30
  25. package/dist/core/governance-codes.d.ts +7 -3
  26. package/dist/core/governance-codes.js +13 -3
  27. package/dist/core/memory-engine/consolidation-driver.d.ts +32 -17
  28. package/dist/core/memory-engine/consolidation-driver.js +99 -98
  29. package/dist/core/memory-engine/consolidation.d.ts +73 -10
  30. package/dist/core/memory-engine/consolidation.js +167 -11
  31. package/dist/core/memory-engine/data-plane.d.ts +8 -4
  32. package/dist/core/memory-engine/data-plane.js +11 -6
  33. package/dist/core/memory-engine/delegation-settlement.d.ts +37 -35
  34. package/dist/core/memory-engine/delegation-settlement.js +53 -59
  35. package/dist/core/memory-engine/dual-root.d.ts +12 -6
  36. package/dist/core/memory-engine/dual-root.js +9 -5
  37. package/dist/core/memory-engine/engine.d.ts +98 -35
  38. package/dist/core/memory-engine/engine.js +477 -380
  39. package/dist/core/memory-engine/entry-scan.d.ts +8 -0
  40. package/dist/core/memory-engine/entry-scan.js +3 -0
  41. package/dist/core/memory-engine/file-backend.d.ts +29 -3
  42. package/dist/core/memory-engine/file-backend.js +66 -35
  43. package/dist/core/memory-engine/index.d.ts +7 -7
  44. package/dist/core/memory-engine/index.js +6 -6
  45. package/dist/core/memory-engine/landing-admission.d.ts +5 -3
  46. package/dist/core/memory-engine/landing-admission.js +3 -3
  47. package/dist/core/memory-engine/layout.d.ts +121 -45
  48. package/dist/core/memory-engine/layout.js +252 -102
  49. package/dist/core/memory-engine/memory-backend-contract.d.ts +19 -1
  50. package/dist/core/memory-engine/memory-backend-contract.js +320 -0
  51. package/dist/core/memory-engine/memory-deployment.d.ts +31 -8
  52. package/dist/core/memory-engine/memory-deployment.js +26 -12
  53. package/dist/core/memory-engine/scope-contract.d.ts +52 -11
  54. package/dist/core/memory-engine/scope-contract.js +68 -19
  55. package/dist/core/memory-engine/session-write-home.d.ts +3 -1
  56. package/dist/core/memory-engine/session-write-home.js +1 -1
  57. package/dist/core/memory-engine/sync-client.d.ts +3 -1
  58. package/dist/core/memory-engine/sync-client.js +7 -0
  59. package/dist/core/memory-engine/sync-report.d.ts +3 -2
  60. package/dist/core/memory-engine/sync-report.js +6 -2
  61. package/dist/core/memory-engine/tools.d.ts +2 -2
  62. package/dist/core/memory-engine/tools.js +10 -10
  63. package/dist/core/memory-engine/types.d.ts +118 -19
  64. package/dist/core/memory-engine/types.js +1 -0
  65. package/dist/core/memory.js +15 -6
  66. package/dist/core/mods/stations.d.ts +20 -1
  67. package/dist/core/mods/stations.js +21 -2
  68. package/dist/core/park-selfcheck.js +2 -2
  69. package/dist/core/pause-registry.d.ts +2 -0
  70. package/dist/core/pause-registry.js +3 -0
  71. package/dist/core/permission-rule-consent.d.ts +10 -3
  72. package/dist/core/permission-rule-consent.js +37 -24
  73. package/dist/core/permission-rule-store.d.ts +35 -1
  74. package/dist/core/permission-rule-store.js +27 -8
  75. package/dist/core/read-only-shell.js +3 -2
  76. package/dist/core/redaction-marks.d.ts +8 -0
  77. package/dist/core/redaction-marks.js +6 -0
  78. package/dist/core/remote-env.d.ts +12 -1
  79. package/dist/core/remote-env.js +3 -0
  80. package/dist/core/runner/child-tree.d.ts +29 -3
  81. package/dist/core/runner/child-tree.js +39 -16
  82. package/dist/core/runner/contracts.d.ts +18 -9
  83. package/dist/core/runner/gate-exit.js +2 -2
  84. package/dist/core/runner/inherited-ask-grants.js +1 -1
  85. package/dist/core/runner/memory-consolidation-driver.d.ts +6 -3
  86. package/dist/core/runner/memory-consolidation-driver.js +4 -4
  87. package/dist/core/runner/memory-consolidation-write-judge.d.ts +2 -1
  88. package/dist/core/runner/memory-consolidation-write-judge.js +3 -2
  89. package/dist/core/runner/person-path-rows.d.ts +8 -3
  90. package/dist/core/runner/person-path-rows.js +5 -1
  91. package/dist/core/runner/placement-fence.d.ts +12 -0
  92. package/dist/core/runner/placement-fence.js +20 -6
  93. package/dist/core/runner/prepare-ask-lane.js +2 -2
  94. package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -1
  95. package/dist/core/runner/prepare-caps-and-workflow.js +5 -2
  96. package/dist/core/runner/prepare-execution-env.js +17 -6
  97. package/dist/core/runner/prepare-hands-readface.d.ts +2 -1
  98. package/dist/core/runner/prepare-hands-readface.js +4 -3
  99. package/dist/core/runner/prepare-inherited-gate.d.ts +10 -8
  100. package/dist/core/runner/prepare-inherited-gate.js +8 -4
  101. package/dist/core/runner/prepare-memory-engine-session.d.ts +2 -4
  102. package/dist/core/runner/prepare-memory-engine-session.js +4 -4
  103. package/dist/core/runner/prepare-memory.d.ts +3 -2
  104. package/dist/core/runner/prepare-memory.js +28 -20
  105. package/dist/core/runner/prepare-park-ask.js +4 -3
  106. package/dist/core/runner/prepare-task.js +15 -12
  107. package/dist/core/runner/prepare-workspace-restore.js +3 -6
  108. package/dist/core/runner/run-leg.js +1 -1
  109. package/dist/core/runner/run-settle-and-teardown.js +3 -2
  110. package/dist/core/runner/terminal-account.js +1 -1
  111. package/dist/core/runner-deps.d.ts +6 -2
  112. package/dist/core/secret-env.d.ts +1 -1
  113. package/dist/core/secret-env.js +4 -4
  114. package/dist/core/session-checkout.d.ts +108 -0
  115. package/dist/core/session-checkout.js +485 -0
  116. package/dist/core/session-store.d.ts +12 -4
  117. package/dist/core/session-store.js +23 -3
  118. package/dist/core/session.d.ts +16 -2
  119. package/dist/core/session.js +3 -0
  120. package/dist/core/store-contracts/checkpoint-store-contract.d.ts +0 -12
  121. package/dist/core/store-contracts/checkpoint-store-contract.js +6 -7
  122. package/dist/core/store-contracts/session-store-contract.js +39 -0
  123. package/dist/core/task-event.d.ts +21 -0
  124. package/dist/core/task-notification.d.ts +9 -1
  125. package/dist/core/task-notification.js +6 -0
  126. package/dist/core/task-registry-agent.d.ts +14 -2
  127. package/dist/core/task-registry-agent.js +45 -19
  128. package/dist/core/task-registry-shared.d.ts +26 -11
  129. package/dist/core/task-registry.d.ts +15 -9
  130. package/dist/core/task-registry.js +9 -10
  131. package/dist/core/task-spec-members.js +1 -1
  132. package/dist/core/task-spec.d.ts +20 -0
  133. package/dist/core/tool-policy.d.ts +14 -12
  134. package/dist/core/tool-policy.js +11 -10
  135. package/dist/core/tool-spec.d.ts +38 -19
  136. package/dist/core/types.d.ts +1 -1
  137. package/dist/core/untrusted-egress.d.ts +15 -4
  138. package/dist/core/untrusted-egress.js +23 -22
  139. package/dist/core/workspace-snapshot.d.ts +3 -1
  140. package/dist/core/workspace-snapshot.js +1 -0
  141. package/dist/engine/harness/types.d.ts +66 -1
  142. package/dist/engine/harness/types.js +108 -0
  143. package/dist/engine/session/import-validate.js +6 -1
  144. package/dist/engine/session/session.d.ts +24 -1
  145. package/dist/engine/session/session.js +45 -1
  146. package/dist/index.d.ts +7 -4
  147. package/dist/index.js +7 -4
  148. package/dist/internal/harness-types.d.ts +1 -1
  149. package/dist/orchestration/run-workflow-tool.d.ts +4 -1
  150. package/dist/orchestration/run-workflow-tool.js +1 -0
  151. package/dist/orchestration/workflow.d.ts +3 -0
  152. package/dist/orchestration/workflow.js +3 -1
  153. package/dist/stores/file/session-store.js +2 -1
  154. package/dist/tools/fs/bash-program-position.js +3 -3
  155. package/dist/tools/fs/program-read-model.d.ts +34 -10
  156. package/dist/tools/fs/program-read-model.js +37 -7
  157. package/dist/tools/fs/program-read-model.rows.js +13 -2
  158. package/dist/tools/fs/read-deny.d.ts +13 -1
  159. package/dist/tools/fs/read-deny.js +10 -2
  160. package/dist/tools/fs/removal-targets.js +3 -3
  161. package/dist/tools/fs/safety.d.ts +2 -0
  162. package/dist/tools/fs/safety.js +1 -1
  163. package/dist/tools/fs/shell-read-argv.d.ts +8 -1
  164. package/dist/tools/fs/shell-read-argv.js +34 -29
  165. package/dist/tools/fs/shell-read-bindings.d.ts +2 -0
  166. package/dist/tools/fs/shell-read-bindings.js +5 -1
  167. package/dist/tools/fs/shell-read-brace.d.ts +18 -0
  168. package/dist/tools/fs/shell-read-brace.js +79 -0
  169. package/dist/tools/fs/shell-read-check.js +10 -8
  170. package/dist/tools/fs/shell-read-establish.js +23 -16
  171. package/dist/tools/fs/shell-read-judge.d.ts +11 -0
  172. package/dist/tools/fs/shell-read-judge.js +3 -3
  173. package/dist/tools/fs/shell-read-plan.d.ts +10 -0
  174. package/dist/tools/fs/shell-read-plan.js +189 -93
  175. package/dist/tools/fs/shell-read-start.d.ts +19 -9
  176. package/dist/tools/fs/shell-read-start.js +20 -12
  177. package/dist/tools/fs/shell-read-word.d.ts +10 -0
  178. package/dist/tools/fs/shell-read-word.js +9 -5
  179. package/dist/tools/fs/shell-read-workdir.d.ts +26 -7
  180. package/dist/tools/fs/shell-read-workdir.js +73 -12
  181. package/dist/tools/fs/shell-read-write-targets.js +13 -8
  182. package/dist/tools/worktree.d.ts +3 -2
  183. package/dist/tools/worktree.js +7 -35
  184. package/package.json +3 -2
  185. package/test/export-surface.snapshot.json +73 -11
  186. package/wire-changes/core-stores-sql@7.63.0.json +30 -0
  187. package/wire-changes/core@7.63.0.json +3523 -0
  188. package/wire-changes/mods-kernel@7.63.0.json +30 -0
  189. package/wire-changes/primitives@7.63.0.json +445 -0
  190. package/dist/core/credential-vocabulary.d.ts +0 -176
  191. package/dist/core/credential-vocabulary.js +0 -190
  192. package/dist/core/redaction-passes.d.ts +0 -82
  193. package/dist/core/redaction-passes.js +0 -377
@@ -159,13 +159,56 @@ export declare function deleteSessionRowsAtStart(rows: Iterable<readonly [string
159
159
  * {@link selectOverduePage} read this one rule.
160
160
  */
161
161
  export declare function checkpointDeadlinePassed(deadline: number | null | undefined, cutoff: number): boolean;
162
+ /** A row's members as the listing faces read them: each read once and widened to `unknown`, since the stored shape is what is judged
163
+ * (a row came back from storage; its type says what was written, not what is there). */
164
+ interface RowMembers {
165
+ /** The key the store files the row under — the authoritative token (the row's own `token` member is judged against it). */
166
+ readonly key: string;
167
+ readonly token: unknown;
168
+ readonly sessionId: unknown;
169
+ readonly scope: unknown;
170
+ readonly status: unknown;
171
+ readonly gate: unknown;
172
+ readonly pendingAction: unknown;
173
+ readonly createdAt: unknown;
174
+ readonly deadline: unknown;
175
+ readonly state: unknown;
176
+ readonly checkpointId: unknown;
177
+ }
178
+ /** The members {@link ROW_MEMBER_SHAPES} reads — no other (none a store's own transitions rewrite). */
179
+ type ShapeMembers = Pick<RowMembers, "gate" | "pendingAction" | "state" | "createdAt" | "deadline">;
180
+ /**
181
+ * THE ROW'S MEMBER SHAPES — the reading every reader of a stored row makes of the members it reaches into, written once: the row
182
+ * judge (`judgeCheckpointRow`, the resume's first rung), the listing projection (`summarizeCheckpoint`) and the listing faces read
183
+ * this table and no shape test of their own, so over these members no face answers `ok` for a row another cannot read. The gate a
184
+ * record of a registered gate kind; the pending action a record of a registered pending kind, a tool approval carrying a tool call
185
+ * id; the state a record; `createdAt` a finite number; `deadline` absent or a finite number. Each entry names the member by its
186
+ * shape, never its value; `undefined` = it reads.
187
+ */
188
+ declare const ROW_MEMBER_SHAPES: readonly [readonly ["gate", (m: ShapeMembers) => string | undefined], readonly ["pendingAction", (m: ShapeMembers) => string | undefined], readonly ["state", (m: ShapeMembers) => string | undefined], readonly ["createdAt", (m: ShapeMembers) => string | undefined], readonly ["deadline", (m: ShapeMembers) => string | undefined]];
189
+ /** A member {@link ROW_MEMBER_SHAPES} names. */
190
+ export type RowMemberName = (typeof ROW_MEMBER_SHAPES)[number][0];
191
+ /** The first member of a row that does not read as {@link ROW_MEMBER_SHAPES} says, and the table's words for it. */
192
+ export interface RowMemberProblem {
193
+ readonly member: RowMemberName;
194
+ readonly problem: string;
195
+ }
196
+ /**
197
+ * Where a row's members fail {@link ROW_MEMBER_SHAPES} — the one reading the row judge, the summary projection and the listing faces
198
+ * make of them: the first member that does not read and the table's words for it; `undefined` = every member reads. Reads the five
199
+ * members the table names, each once. May throw (a member that throws when read); the caller is total.
200
+ */
201
+ export declare function rowMemberProblem(cp: Checkpoint): RowMemberProblem | undefined;
162
202
  /**
163
203
  * The overdue page over a store's rows (`[key, row]` pairs — the key is the authoritative token): pending ∧
164
204
  * {@link checkpointDeadlinePassed} ∧ `facetOf(gate) === facet`, after the cursor, ordered (deadline key, token) ascending, filled up
165
- * to `limit` with the rows whose summary `project` mints. A candidate whose shape the face cannot read, or whose summary cannot be
166
- * projected, is left out and disclosed (`disclose` gets one sentence per such row, on every call) and the page fills on from the
167
- * next candidate; only the rows of the page are projected. `next` is present when a candidate remains after the page's last row
168
- * (a page after it can come back shorter, even empty, when every remaining candidate is damaged).
205
+ * to `limit` with the rows whose summary `project` mints. A candidate the face cannot place ({@link placementDamage}: no string
206
+ * session id, a token other than its key, no readable scope, status or gate kind — the facet reads them) is left out and disclosed
207
+ * (`disclose` gets one sentence per such row, on every call) and the page fills on from the next candidate. Every other row is
208
+ * answered, a damaged one in the summary's unreadable form (`project` is total, as `summarizeCheckpoint` is — the listing of a
209
+ * scope answers that row the same way); only the rows of the page are projected. A `project` of a caller's own that throws
210
+ * leaves its row out, disclosed. `next` is present when a candidate remains after the page's last row (a page after it can come
211
+ * back shorter, even empty, when every remaining candidate is unplaced).
169
212
  */
170
213
  export declare function selectOverduePage(rows: Iterable<readonly [string, Checkpoint]>, query: CheckpointOverdueQueryReading, project: (cp: Checkpoint) => CheckpointSummary, disclose?: (sentence: string) => void): CheckpointPage<CheckpointSummary, CheckpointOverdueCursor>;
171
214
  /**
@@ -1,5 +1,5 @@
1
1
  import { types } from "node:util";
2
- import { facetOf, isGateKind } from "./pause-registry.js";
2
+ import { facetOf, isGateKind, isPendingKind } from "./pause-registry.js";
3
3
  import { receiptRefusal, receiveOwnProperties } from "./own-property-receipt.js";
4
4
  import { principalNameOf } from "./principal-name.js";
5
5
  export const CHECKPOINT_LIST_LIMITS = Object.freeze({
@@ -134,30 +134,50 @@ function orderKey(value) {
134
134
  function membersOf(key, cp) {
135
135
  return { key, token: cp.token, sessionId: cp.sessionId, scope: cp.scope, status: cp.status, gate: cp.gate, pendingAction: cp.pendingAction, createdAt: cp.createdAt, deadline: cp.deadline, state: cp.state, checkpointId: cp.checkpointId };
136
136
  }
137
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
137
138
  function memberOf(value, key) {
138
- return typeof value === "object" && value !== null && key in value ? value[key] : undefined;
139
+ return isRecord(value) && key in value ? value[key] : undefined;
139
140
  }
140
141
  const isStatusWord = (v) => STATUSES.some((s) => s === v);
141
142
  const isFiniteNumber = (v) => typeof v === "number" && Number.isFinite(v);
142
- function listingDamage(m) {
143
+ const gateShape = (m) => (isGateKind(memberOf(m.gate, "kind")) ? undefined : "its gate is not an object of a registered gate kind");
144
+ const ROW_MEMBER_SHAPES = Object.freeze([
145
+ ["gate", gateShape],
146
+ [
147
+ "pendingAction",
148
+ (m) => {
149
+ const kind = memberOf(m.pendingAction, "kind");
150
+ if (!isPendingKind(kind))
151
+ return "its pending action is not an object of a registered pending kind";
152
+ return kind === "tool_approval" && typeof memberOf(m.pendingAction, "toolCallId") !== "string" ? "its tool approval carries no tool call id" : undefined;
153
+ },
154
+ ],
155
+ ["state", (m) => (isRecord(m.state) ? undefined : "its state is not an object")],
156
+ ["createdAt", (m) => (isFiniteNumber(m.createdAt) ? undefined : "its createdAt is not a finite number")],
157
+ ["deadline", (m) => (m.deadline === undefined || isFiniteNumber(m.deadline) ? undefined : "its deadline is not a finite number")],
158
+ ]);
159
+ function shapeProblemOf(m) {
160
+ for (const [member, shape] of ROW_MEMBER_SHAPES) {
161
+ const problem = shape(m);
162
+ if (problem !== undefined)
163
+ return { member, problem };
164
+ }
165
+ return undefined;
166
+ }
167
+ function placementDamage(m) {
143
168
  if (m.token !== m.key)
144
169
  return "its token member is not the key the store files it under";
145
170
  if (typeof m.scope !== "string")
146
171
  return "its scope is not a string";
147
172
  if (!isStatusWord(m.status))
148
173
  return "its status is not one of pending / resolved / expired";
149
- if (!isGateKind(memberOf(m.gate, "kind")))
150
- return "its gate is not an object of a registered gate kind";
151
- const actionKind = memberOf(m.pendingAction, "kind");
152
- if (typeof actionKind !== "string")
153
- return "its pending action is not an object with a kind";
154
- if (actionKind === "tool_approval" && typeof memberOf(m.pendingAction, "toolCallId") !== "string")
155
- return "its tool approval carries no tool call id";
156
- if (!isFiniteNumber(m.createdAt))
157
- return "its createdAt is not a finite number";
158
- if (typeof m.state !== "object" || m.state === null)
159
- return "its state is not an object";
160
- return undefined;
174
+ return gateShape(m);
175
+ }
176
+ function listingDamage(m) {
177
+ return placementDamage(m) ?? shapeProblemOf(m)?.problem;
178
+ }
179
+ export function rowMemberProblem(cp) {
180
+ return shapeProblemOf({ gate: cp.gate, pendingAction: cp.pendingAction, state: cp.state, createdAt: cp.createdAt, deadline: cp.deadline });
161
181
  }
162
182
  function thrownName(e) {
163
183
  return e instanceof Error ? e.constructor.name : typeof e;
@@ -181,7 +201,7 @@ export function selectOverduePage(rows, query, project, disclose) {
181
201
  const m = membersOf(token, cp);
182
202
  if (m.status !== "pending" || !checkpointDeadlinePassed(m.deadline, query.cutoff))
183
203
  continue;
184
- const damage = typeof m.sessionId !== "string" ? "its sessionId is not a string" : listingDamage(m);
204
+ const damage = typeof m.sessionId !== "string" ? "its sessionId is not a string" : placementDamage(m);
185
205
  if (damage !== undefined) {
186
206
  disclose?.(`${rowName(m)}: ${damage} — the overdue listing cannot read it, so it leaves it out`);
187
207
  continue;
@@ -7,7 +7,7 @@ import type { StoreFidelity, Checkpoint, CheckpointGate, PendingAction } from ".
7
7
  * had carried beside the one its word now names, and the members added after the table, each a capability a reader
8
8
  * must have. Downstream reads them for display only (`CheckpointError.detail.requires`).
9
9
  */
10
- export declare const REQUIREMENT_WORDS: readonly ["resource", "binding", "token", "orgAdmission", "f012", "realApproval", "face", "requirements_digest", "org_admission_inherited", "org_write_grant", "org_governed", "delegation_provenance", "skill_grants", "skill_card_binding", "hands_coordinates", "hands_home", "path_rule_anchors", "path_rule_installations", "permission_mode", "plan_mode_restore", "persisted_rule_mandate", "deployment_authored", "call_names", "write_face", "denial_limit_fallback", "leg_scope", "tool_ceiling", "tool_lists_judged", "own_tool_lists", "approval_targets", "approval_target_reads", "cross_boundary", "mount_site", "skill_scopes", "run_origin", "tool_declaration", "composition_leg", "row_task_id", "held_rows", "source_session"];
10
+ export declare const REQUIREMENT_WORDS: readonly ["resource", "binding", "token", "orgAdmission", "f012", "realApproval", "face", "requirements_digest", "org_admission_inherited", "org_write_grant", "org_governed", "delegation_provenance", "skill_grants", "skill_card_binding", "hands_coordinates", "hands_home", "path_rule_anchors", "path_rule_installations", "permission_mode", "plan_mode_restore", "persisted_rule_mandate", "deployment_authored", "call_names", "write_face", "denial_limit_fallback", "leg_scope", "tool_ceiling", "tool_lists_judged", "own_tool_lists", "approval_targets", "approval_target_reads", "cross_boundary", "mount_site", "skill_scopes", "run_origin", "tool_declaration", "composition_leg", "row_task_id", "held_rows", "source_session", "tool_binding"];
11
11
  export type RequirementWord = (typeof REQUIREMENT_WORDS)[number];
12
12
  /** Runtime twin of {@link RequirementWord}. */
13
13
  export declare function isRequirementWord(word: unknown): word is RequirementWord;
@@ -304,7 +304,7 @@ export declare const PENDING_ACTION_REQUIREMENTS: {
304
304
  readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
305
305
  };
306
306
  readonly boundInputHash: {
307
- readonly digest: "decision-read";
307
+ readonly word: "tool_binding";
308
308
  };
309
309
  readonly boundGrantDigest: {
310
310
  readonly word: "skill_card_binding";
@@ -840,7 +840,7 @@ export declare const CHECKPOINT_REQUIREMENTS: {
840
840
  readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
841
841
  };
842
842
  readonly boundInputHash: {
843
- readonly digest: "decision-read";
843
+ readonly word: "tool_binding";
844
844
  };
845
845
  readonly boundGrantDigest: {
846
846
  readonly word: "skill_card_binding";
@@ -43,6 +43,7 @@ export const REQUIREMENT_WORDS = Object.freeze([
43
43
  "row_task_id",
44
44
  "held_rows",
45
45
  "source_session",
46
+ "tool_binding",
46
47
  ]);
47
48
  export function isRequirementWord(word) {
48
49
  return typeof word === "string" && REQUIREMENT_WORDS.includes(word);
@@ -131,7 +132,7 @@ export const PENDING_ACTION_REQUIREMENTS = {
131
132
  askClass: DECISION_READ,
132
133
  classes: DECISION_READ,
133
134
  askReasons: SHOWN,
134
- boundInputHash: DECISION_READ,
135
+ boundInputHash: { word: "tool_binding" },
135
136
  boundGrantDigest: { word: "skill_card_binding" },
136
137
  boundGrants: SHOWN,
137
138
  boundGrantAbsence: SHOWN,
@@ -18,15 +18,18 @@
18
18
  * are still told at the resume.
19
19
  *
20
20
  * ORDER (one law: the specific before the general): a newer row is refused as newer before any segment of it is read (the
21
- * version ceiling, then a reader word this worker lacks); then the seats and the axis a release retired (each names what
21
+ * version ceiling, then a reader word this worker lacks); then a row whose members do not read as every reader reads them — its
22
+ * pause, its state, its stamps (a row with no segment for the arms below to read is damaged, whatever its version; the one table
23
+ * of those shapes is the listing faces' too); then the seats and the axis a release retired (each names what
22
24
  * to do about it); then the reader-requirement list and the row digest — "its content does not read the way it was
23
25
  * written", told only when nothing more specific is; then the recorded mode words, the sections by their shapes, the
24
26
  * frozen chain's tool names, the recorded run origin, and the parent-constraint record's own integrity. The first refusal
25
27
  * is the verdict.
26
28
  *
27
- * TOTAL: a row the judge cannot read (a member that throws when read, a container that is not one) is `damaged`
28
- * (`requirements_damaged`); the resume error's `detail.thrownName` names what was thrown, so an engine defect and a
29
- * damaged row are told apart.
29
+ * TOTAL: a row the judge cannot read (a member that throws when read) is `damaged` (`requirements_damaged`); the resume
30
+ * error's `detail.thrownName` names what was thrown, so an engine defect and a damaged row are told apart. A row whose member does
31
+ * not read as the member-shape table says (`rowMemberProblem`, checkpoint-queries.ts: the gate, the pending action, the state,
32
+ * `createdAt`, `deadline`) is the same word with nothing thrown: its refusal names the member in the table's words.
30
33
  *
31
34
  * The row-seat readers the judge asks and other readers share live here too — the retired seats' refusals and the recorded
32
35
  * mode seed (prepare reads the seed; the parked-steer queue's read asks the retired steer seat's refusal).
@@ -58,6 +61,12 @@ export declare const ROW_REFUSAL_SENTENCES: Readonly<{
58
61
  readonly "config.run_origin_invalid": "This engine cannot resume this checkpoint: the run origin it records is not a word this engine knows. The checkpoint stays pending; finish it on a worker of the release that parked it, or expire it.";
59
62
  readonly "config.tool_face_control": "This engine cannot resume this checkpoint: its frozen inherited constraint chain records a tool name in a spelling this engine does not replay. The checkpoint stays pending; finish it on a worker of the release that parked it, or expire it and run the work again.";
60
63
  }>;
64
+ /**
65
+ * The verdict of a row nothing could read — one the judge threw on, or one the listing projection could not project: `damaged` /
66
+ * `requirements_damaged` under the fixed sentence. The total judge answers it, and the projection answers it for a row the judge
67
+ * called `ok` but a summary cannot be made of, so a listing never presents a row it cannot read as an approvable card.
68
+ */
69
+ export declare const UNREADABLE_ROW_VERDICT: CheckpointRowVerdict;
61
70
  /**
62
71
  * The ONE refusal of the RETIRED pre-queue single steer seat (`state.pendingSteer`, written before the queue existed): the
63
72
  * seat has no `inputId`, `seq` or actor, so folding it in would mint a synthetic identity nothing else can name. The refusal is
@@ -87,6 +96,8 @@ export declare function recordedModeSeed(gate: Pick<NonNullable<CheckpointState[
87
96
  prePlanMode?: PermissionMode;
88
97
  shellGate?: ShellGateDoctrine;
89
98
  };
99
+ /** What a total judge carries when the row could not be judged: the name of what was thrown, bounded (never its message — a message can quote a stored value). */
100
+ export declare function boundedThrownName(e: unknown): string;
90
101
  /**
91
102
  * The row's verdict for THIS engine: `ok`, `lacking` (a newer engine can resume it: `checkpoint.unsupported_version` /
92
103
  * `version_newer`, `requires` the reader words it lacks when its requirement list named them), or `damaged` (this engine
@@ -10,6 +10,8 @@ import { asResumeConfigRefusal } from "./mode-policy.js";
10
10
  import { screenRecordedRunOrigin } from "./run-origin.js";
11
11
  import { refusePersistedToolNames } from "./runner/sub-agent-deny-lists.js";
12
12
  import { thrownName } from "./thrown-value.js";
13
+ import { memberPresent } from "./own-property-receipt.js";
14
+ import { rowMemberProblem } from "./checkpoint-queries.js";
13
15
  export const ROW_REFUSAL_SENTENCES = Object.freeze({
14
16
  "checkpoint.unsupported_version|version_newer": "This engine cannot resume this checkpoint: it was parked by a newer engine release, whose row this release cannot read. The checkpoint stays pending; resume it on a worker at or above the release that parked it.",
15
17
  "checkpoint.unsupported_version|seat_retired": "This engine cannot resume this checkpoint: it carries a seat an earlier engine release wrote and this release retired. The checkpoint stays pending and nothing was consumed; finish it on a worker of a release that still reads that seat, or expire it.",
@@ -33,6 +35,12 @@ const LISTED_REQUIREMENT_WORD = /^[a-z][a-z_]{0,39}$/;
33
35
  const MAX_LISTED_REQUIREMENT_WORDS = 8;
34
36
  const MAX_THROWN_NAME_CHARS = 64;
35
37
  const OK = Object.freeze({ kind: "ok" });
38
+ export const UNREADABLE_ROW_VERDICT = Object.freeze({
39
+ kind: "damaged",
40
+ code: "checkpoint.invalid_outcome",
41
+ reason: "requirements_damaged",
42
+ sentence: ROW_REFUSAL_SENTENCES["checkpoint.invalid_outcome|requirements_damaged"],
43
+ });
36
44
  export function retiredSteerSeatRefusal(state) {
37
45
  if (state.pendingSteer === undefined)
38
46
  return undefined;
@@ -82,6 +90,13 @@ function recordedWordRefusal(screen) {
82
90
  throw e;
83
91
  }
84
92
  }
93
+ function bindingPredatesTool(cp) {
94
+ const pending = cp.pendingAction;
95
+ if (typeof pending !== "object" || pending === null || Reflect.get(pending, "kind") !== "tool_approval" || !memberPresent(pending, "boundInputHash"))
96
+ return false;
97
+ const declared = Reflect.get(cp, "requires");
98
+ return !(Array.isArray(declared) && declared.includes("tool_binding"));
99
+ }
85
100
  function rowRefusalOf(cp) {
86
101
  const { realApproval: realApprovalRow, face: faceRow, f012: f012Row } = CHECKPOINT_FEATURES;
87
102
  if (checkpointVersionOf(cp) > MAX_SUPPORTED_CHECKPOINT_VERSION) {
@@ -90,6 +105,9 @@ function rowRefusalOf(cp) {
90
105
  const requirements = judgeCheckpointRequirements(cp);
91
106
  if (requirements.kind === "lacking")
92
107
  return new CheckpointError("checkpoint.unsupported_version", `checkpoint requires reader capabilities this worker lacks (${requirements.words.join(", ")}) — resume it on a worker at or above the version that parked it`, { reason: "version_newer", requires: requirements.words });
108
+ const shape = rowMemberProblem(cp);
109
+ if (shape !== undefined)
110
+ return new CheckpointError("checkpoint.invalid_outcome", `this checkpoint's \`${shape.member}\` does not read as every reader of a row reads it (${shape.problem}) — a damaged row`, { reason: "requirements_damaged" });
93
111
  const retiredSeed = retiredModeSeedRefusal(cp.state);
94
112
  if (retiredSeed !== undefined)
95
113
  return retiredSeed;
@@ -102,6 +120,8 @@ function rowRefusalOf(cp) {
102
120
  "resuming here would run the leg with that ceiling unenforced. Rejected pre-CAS (the checkpoint stays pending): finish it on a worker of the " +
103
121
  "previous release, or start a fresh task bounded by resourceSuspend.totalTokens / totalBudgetUsd.");
104
122
  }
123
+ if (bindingPredatesTool(cp))
124
+ return new CheckpointError("checkpoint.invalid_outcome", "the pending approval's bound hash predates tool binding: an earlier engine release digested the call's arguments alone, and this release binds the tool's name with them, so no decision is matched to this row here — ask again", { reason: "requirements_damaged" });
105
125
  if (requirements.kind === "damaged")
106
126
  return new CheckpointError("checkpoint.invalid_outcome", `this checkpoint's reader-requirement list does not match the row (${requirements.why})`, { reason: "requirements_damaged" });
107
127
  const modeWords = recordedWordRefusal(() => void recordedModeSeed(cp.state.inheritedGate));
@@ -200,7 +220,7 @@ function readRow(cp) {
200
220
  refusal.message = `${sentence} Diagnostic: ${refusal.message}`;
201
221
  return { verdict, refusal };
202
222
  }
203
- function boundedThrownName(e) {
223
+ export function boundedThrownName(e) {
204
224
  const name = thrownName(e);
205
225
  return name === undefined || name === "" ? typeof e : name.slice(0, MAX_THROWN_NAME_CHARS);
206
226
  }
@@ -212,7 +232,7 @@ function readRowTotal(cp) {
212
232
  const name = boundedThrownName(e);
213
233
  const sentence = ROW_REFUSAL_SENTENCES["checkpoint.invalid_outcome|requirements_damaged"];
214
234
  return {
215
- verdict: Object.freeze({ kind: "damaged", code: "checkpoint.invalid_outcome", reason: "requirements_damaged", sentence }),
235
+ verdict: UNREADABLE_ROW_VERDICT,
216
236
  refusal: new CheckpointError("checkpoint.invalid_outcome", `${sentence} Diagnostic: the row could not be read (${name} thrown while judging it)`, { reason: "requirements_damaged", thrownName: name }),
217
237
  };
218
238
  }
@@ -553,10 +553,10 @@ export type ResumeOutcome = {
553
553
  */
554
554
  boundCallId: string;
555
555
  /**
556
- * design/80 D-1 §2 (slice 1a.2): the **server-minted opaque** hash of the pending tool call's input
556
+ * design/80 D-1 §2 (slice 1a.2): the **server-minted opaque** hash of the pending tool call — its tool and the input
557
557
  * that the human actually saw/approved (`PendingAction.tool_approval.boundInputHash`, computed by the
558
- * engine at suspend-mint via {@link import("./canonical-json.js").boundInputHashOf} over the post-hook
559
- * `args`). The caller echoes it VERBATIM — it is opaque; the SDK/service NEVER re-canonicalize args
558
+ * engine at suspend-mint via {@link import("./canonical-json.js").exactBoundInputHashOf} over the call's `toolName` and
559
+ * post-hook `args`). The caller echoes it VERBATIM — it is opaque; the SDK/service NEVER re-canonicalize args
560
560
  * (a second runtime's serialization could diverge → false mismatch → fail-closed a
561
561
  * legitimate approval). The resume verifies it by **string equality** against the checkpoint's
562
562
  * persisted value (`checkpoint.invalid_outcome`, fail-closed, pre-CAS) — closing the TOCTOU "same call
@@ -844,9 +844,9 @@ export type PendingAction = {
844
844
  * list of well-formed entries; a row parked before it reads ABSENT. Display metadata — no gate, CAS or resume path reads it. */
845
845
  askReasons?: readonly import("./ask-origin.js").AskReason[];
846
846
  /**
847
- * design/80 D-1 §2 (slice 1a.2): the server-minted **opaque** boundInputHash of {@link args} — a
848
- * SHA-256 (hex) via {@link import("./canonical-json.js").boundInputHashOf}, computed ONCE here at
849
- * suspend-mint and persisted on the row. The operator sees it (surfaced on the pending record) and
847
+ * design/80 D-1 §2 (slice 1a.2): the server-minted **opaque** boundInputHash of {@link toolName} with {@link args} — a SHA-256 (hex)
848
+ * via {@link import("./canonical-json.js").exactBoundInputHashOf}, computed ONCE here at suspend-mint and persisted on the row, which says
849
+ * so with its `tool_binding` requirement word (a row that does not is refused `requirements_damaged`). The operator sees it (surfaced on the pending record) and
850
850
  * echoes it back as {@link ResumeOutcome} `boundInputHash`; the resume verifies opaque string equality
851
851
  * against THIS value (never re-serializing the args — see the field's doc). Absent only on a legacy
852
852
  * pre-1a.2 checkpoint (deserialized without it), in which case the resume skips the hash check.
@@ -1903,7 +1903,12 @@ export interface CheckpointSummary {
1903
1903
  /** ALWAYS present — the row's own answer to whether anything in it keeps THIS engine from resuming it
1904
1904
  * ({@link CheckpointRowVerdict}; `judgeCheckpointRow`): the verdict the resume throws at its first rung, so a row this engine
1905
1905
  * refuses is not listed as an approvable card. `ok` is not "the resume will run": a deployment fact, a resume input or the
1906
- * decision can still refuse it at the resume. Engine text and closed words only — no row content. */
1906
+ * decision can still refuse it at the resume. Engine text and closed words only — no row content.
1907
+ *
1908
+ * **A ROW THE PROJECTION CANNOT READ** (a record the row lacks or holds as something else, a member that throws when read) is
1909
+ * still ONE row of the listing, never a failed page: its `rowVerdict` is never `ok` (the judge's verdict, else `damaged` /
1910
+ * `requirements_damaged`), it carries `token`, `sessionId` and `scope`, and — each only when it reads — `gateKind`, `createdAt`
1911
+ * and `deadline`; it carries no other member. A consumer renders such a row by its `rowVerdict`. */
1907
1912
  rowVerdict: CheckpointRowVerdict;
1908
1913
  /** Non-secret stable identity ({@link Checkpoint.checkpointId}) — absent on legacy rows. */
1909
1914
  checkpointId?: string;
@@ -1911,8 +1916,9 @@ export interface CheckpointSummary {
1911
1916
  sessionId: string;
1912
1917
  /** The multi-tenant scope this checkpoint lives in ({@link Checkpoint.scope}) — always equal to the query's. */
1913
1918
  scope: string;
1914
- /** The gate's discriminant ({@link CheckpointGate}.kind): which kind of pause this is. */
1915
- gateKind: CheckpointGate["kind"];
1919
+ /** The gate's discriminant ({@link CheckpointGate}.kind): which kind of pause this is. Present on every row the projection reads;
1920
+ * OMITTED only on a row whose gate does not read (see {@link rowVerdict}), whose verdict is then not `ok`. */
1921
+ gateKind?: CheckpointGate["kind"];
1916
1922
  /** The deterministic risk tier (1..5) when the gate carries a {@link RiskDescriptor} (the `human` /
1917
1923
  * `irreversible_ask` approval escalations), derived via {@link riskSeverity} from the descriptor's axes —
1918
1924
  * the SAME value as `gate.riskDescriptor.severity`, recomputed from the single source helper rather than
@@ -1925,7 +1931,8 @@ export interface CheckpointSummary {
1925
1931
  * present whenever the checkpoint carries a {@link Checkpoint.resourceLedger} (every resource_limit suspend,
1926
1932
  * and every approval suspend on the D-E-core budget-read path); `undefined` when no ledger is attached. */
1927
1933
  spentMicroUsd?: number;
1928
- /** The awaiting-human SLA / abandonment deadline ({@link Checkpoint.deadline}, epoch ms) when present. */
1934
+ /** The awaiting-human SLA / abandonment deadline ({@link Checkpoint.deadline}, epoch ms) when it is present and a finite number
1935
+ * (a stored value that is not one — a `NaN` a JSON round trip left, a value of another type — is left off, not echoed). */
1929
1936
  deadline?: number;
1930
1937
  /** design S1d (source-tag): the issuing worker's session id ({@link Checkpoint.sourceSessionId}) — projected so
1931
1938
  * a supervisor inbox attributes each pending checkpoint to its worker in ONE `listByScope` call (no N+1
@@ -2106,6 +2113,10 @@ export interface CheckpointSummary {
2106
2113
  * calls it again. A store hands it its own seat. `verdict` is a store's memo of this row's `judgeCheckpointRow` under this
2107
2114
  * engine (an in-tree store keeps it by the stored row object, so a replaced row is judged again; an external store by the stored
2108
2115
  * blob's sha256 plus the engine build, `CONTRACT_KIT_ENGINE_VERSION`); absent, the row is judged now. The resume never reads it.
2116
+ *
2117
+ * TOTAL, as the judge is: a row this projection cannot read (a record it lacks or holds as something else, a member that throws
2118
+ * when read) is answered, never thrown — as the row's identity alone ({@link CheckpointSummary.rowVerdict}'s unreadable form), with
2119
+ * a verdict that is not `ok` and one sentence to `disclose`. One damaged row never fails the page that lists it.
2109
2120
  */
2110
2121
  export declare function summarizeCheckpoint(cp: Checkpoint, disclose?: (sentence: string) => void, verdict?: CheckpointRowVerdict): CheckpointSummary;
2111
2122
  /**
@@ -2465,6 +2476,8 @@ export interface CheckpointStore {
2465
2476
  * the once-only resolve. The PENDING predicate is byte-for-byte the {@link resolve} CAS's (`scope === scope &&
2466
2477
  * status === 'pending'`), so the list reflects exactly the rows that are still resumable. Order is unspecified
2467
2478
  * (the inbox sorts by `severity`/`deadline` itself). An empty scope returns `[]`. Required: every store answers it.
2479
+ * A row whose summary cannot be read is one row of the answer in its unreadable form ({@link CheckpointSummary.rowVerdict}),
2480
+ * never a failed page: the rows beside it are listed as they would be without it.
2468
2481
  */
2469
2482
  listByScope(scope: string): Promise<CheckpointSummary[]>;
2470
2483
  /**
@@ -2,7 +2,7 @@ import { randomBytes, randomUUID } from "node:crypto";
2
2
  import { uuidv7 } from "../internal/harness.js";
3
3
  import { PROBE_REASON_MAX, inlineUntrusted, sanitizeUntrustedText } from "./untrusted-text.js";
4
4
  import { CheckpointError, checkpointVersionOf, isPlainRecord, normalizeProbeCause, safeDataValue } from "./checkpoint-features.js";
5
- import { judgeCheckpointRow, retiredSteerSeatRefusal } from "./checkpoint-row-verdict.js";
5
+ import { boundedThrownName, judgeCheckpointRow, retiredSteerSeatRefusal, UNREADABLE_ROW_VERDICT } from "./checkpoint-row-verdict.js";
6
6
  import { carriesBidiControls } from "./tool-policy.js";
7
7
  import { agentIdOf, legTaskIdOf } from "./leg-identity.js";
8
8
  import { isAutoModeFallbackCause, readDenialLimitFallback } from "./auto-mode.js";
@@ -12,8 +12,8 @@ import { describeRejectedValue } from "./tool-search-setting.js";
12
12
  import { readBoundBinding } from "./skill-grant-binding.js";
13
13
  import { checkpointExecutionRecorded, executionRecordDisposition, ExecutionOutcomeConflictError, } from "./checkpoint-execution-record.js";
14
14
  import { checkpointHolderMatches, checkpointOccMatches, checkpointRevOf } from "./checkpoint-generation.js";
15
- import { parkedApprovalCardOf } from "./pause-registry.js";
16
- import { checkpointDeadlinePassed, deleteSessionRowsAtStart, readCheckpointOverdueQuery, readCheckpointSessionQuery, selectOverduePage, selectSessionPage } from "./checkpoint-queries.js";
15
+ import { isGateKind, parkedApprovalCardOf } from "./pause-registry.js";
16
+ import { checkpointDeadlinePassed, deleteSessionRowsAtStart, readCheckpointOverdueQuery, readCheckpointSessionQuery, rowMemberProblem, selectOverduePage, selectSessionPage } from "./checkpoint-queries.js";
17
17
  import { renderUntrustedCommandText, stripFormatCharacters } from "./permission-rule-model.js";
18
18
  import { egressText } from "./untrusted-egress.js";
19
19
  import { steerReplayRefusal } from "./steer-replay.js";
@@ -213,6 +213,47 @@ export function planReviewRequesterOf(pendingAction) {
213
213
  }
214
214
  export function summarizeCheckpoint(cp, disclose, verdict) {
215
215
  const rowVerdict = verdict ?? judgeCheckpointRow(cp);
216
+ let why;
217
+ try {
218
+ const problem = rowMemberProblem(cp);
219
+ if (problem === undefined)
220
+ return projectCheckpoint(cp, rowVerdict, disclose);
221
+ why = problem.problem;
222
+ }
223
+ catch (e) {
224
+ why = boundedThrownName(e);
225
+ }
226
+ return unreadableSummary(cp, rowVerdict, disclose, why);
227
+ }
228
+ const isFiniteMember = (v) => typeof v === "number" && Number.isFinite(v);
229
+ function unreadableSummary(cp, judged, disclose, why) {
230
+ const read = (member) => {
231
+ try {
232
+ return member();
233
+ }
234
+ catch {
235
+ return undefined;
236
+ }
237
+ };
238
+ const token = read(() => cp.token);
239
+ const sessionId = read(() => cp.sessionId);
240
+ const scope = read(() => cp.scope);
241
+ const gateKind = read(() => cp.gate.kind);
242
+ const createdAt = read(() => cp.createdAt);
243
+ const deadline = read(() => cp.deadline);
244
+ const checkpointId = read(() => cp.checkpointId);
245
+ disclose?.(`checkpoint ${typeof checkpointId === "string" ? JSON.stringify(checkpointId) : "null"} of session ${typeof sessionId === "string" ? JSON.stringify(sessionId) : "(unreadable)"}: its summary could not be projected (${why}) — it is listed as unreadable, with the members that could be read`);
246
+ return {
247
+ token: (typeof token === "string" ? token : ""),
248
+ rowVerdict: judged.kind === "ok" ? UNREADABLE_ROW_VERDICT : judged,
249
+ sessionId: typeof sessionId === "string" ? sessionId : "",
250
+ scope: typeof scope === "string" ? scope : "",
251
+ ...(isGateKind(gateKind) ? { gateKind } : {}),
252
+ ...(isFiniteMember(createdAt) ? { createdAt } : {}),
253
+ ...(isFiniteMember(deadline) ? { deadline } : {}),
254
+ };
255
+ }
256
+ function projectCheckpoint(cp, rowVerdict, disclose) {
216
257
  const facts = checkpointIndexFacts(cp);
217
258
  const rowName = `checkpoint ${JSON.stringify(cp.checkpointId ?? null)} of session ${JSON.stringify(cp.sessionId)}`;
218
259
  const descriptor = facts.riskDescriptor;
@@ -261,7 +302,7 @@ export function summarizeCheckpoint(cp, disclose, verdict) {
261
302
  gateKind: facts.gateKind,
262
303
  ...(severity !== undefined ? { severity } : {}),
263
304
  ...(cp.resourceLedger !== undefined ? { spentMicroUsd: cp.resourceLedger.spentMicroUsd } : {}),
264
- ...(facts.deadline !== null ? { deadline: facts.deadline } : {}),
305
+ ...(isFiniteMember(facts.deadline) ? { deadline: facts.deadline } : {}),
265
306
  createdAt: facts.createdAt,
266
307
  ...(cp.sourceSessionId !== undefined ? { sourceSessionId: cp.sourceSessionId } : {}),
267
308
  ...(agentId !== undefined ? { agentId } : {}),
@@ -2,10 +2,13 @@
2
2
  export type ComplianceProfile = "hipaa" | "zdr";
3
3
  /** Closed capability set the ENGINE can veto end-to-end (see the module header for the entry-point
4
4
  * map — a capability is admitted here only with its full interception story). */
5
- export type ComplianceCapability = "mcp_servers" | "workflows" | "web_fetch" | "org_memory_mount" | "a2a_peers";
5
+ export type ComplianceCapability = "mcp_servers" | "workflows" | "web_fetch" | "org_memory_mount" | "a2a_peers" | "memory_consolidation";
6
6
  /** Every member of {@link ComplianceCapability} — the fail-closed "deny everything managed" set used
7
7
  * when the posture resolver itself fails. `satisfies` keeps it in lockstep with the union. */
8
- export declare const COMPLIANCE_CAPABILITIES: readonly ["mcp_servers", "workflows", "web_fetch", "org_memory_mount", "a2a_peers"];
8
+ export declare const COMPLIANCE_CAPABILITIES: readonly ["mcp_servers", "workflows", "web_fetch", "org_memory_mount", "a2a_peers", "memory_consolidation"];
9
+ /** The deployment's posture seat: the posture that applies to `principal` (`undefined` = no principal — the deployment's
10
+ * own posture). The shape of `RunnerDeps.compliancePostureResolver` and of a consolidation run's `compliance.postureOf`. */
11
+ export type CompliancePostureSeat = (principal: string | undefined) => CompliancePosture | undefined | Promise<CompliancePosture | undefined>;
9
12
  /**
10
13
  * A principal's resolved compliance posture, supplied by the trusted deployment resolver. The
11
14
  * effective deny set is `BUILTIN_COMPLIANCE_DENIES[profile] ∪ additionalDenies` — supply can only
@@ -21,6 +24,7 @@ export interface CompliancePosture {
21
24
  * capabilities this engine manages: hipaa denies `allow_web_fetch` ⇒ `web_fetch`. (CC's
22
25
  * `allow_memory_sync` row maps onto the org-memory plane and joins this table together with the
23
26
  * memory-admission seam; CC has no MCP/workflow rows — those stay reachable via `additionalDenies`.)
27
+ * Both floors carry `memory_consolidation`: a consolidation run archives the model's input and output verbatim.
24
28
  */
25
29
  export declare const BUILTIN_COMPLIANCE_DENIES: Record<ComplianceProfile, readonly ComplianceCapability[]>;
26
30
  /**
@@ -1,8 +1,8 @@
1
1
  import { describeRejectedValue } from "./tool-search-setting.js";
2
- export const COMPLIANCE_CAPABILITIES = Object.freeze(["mcp_servers", "workflows", "web_fetch", "org_memory_mount", "a2a_peers"]);
2
+ export const COMPLIANCE_CAPABILITIES = Object.freeze(["mcp_servers", "workflows", "web_fetch", "org_memory_mount", "a2a_peers", "memory_consolidation"]);
3
3
  export const BUILTIN_COMPLIANCE_DENIES = {
4
- hipaa: ["web_fetch", "org_memory_mount"],
5
- zdr: ["org_memory_mount"],
4
+ hipaa: ["web_fetch", "org_memory_mount", "memory_consolidation"],
5
+ zdr: ["org_memory_mount", "memory_consolidation"],
6
6
  };
7
7
  const PROFILES = ["hipaa", "zdr"];
8
8
  function codedError(code, message) {
@@ -30,7 +30,7 @@ export interface EngineAttestation {
30
30
  readonly origin?: AskOrigin;
31
31
  /** The settled ask's class set (`ASK_CLASSES` order), when the minting station held one. */
32
32
  readonly classes?: readonly AskClass[];
33
- /** `exactBoundInputHashOf` of the arguments the settlement licenses (an approver's edit, the snapshot shown, or the asked
33
+ /** `exactBoundInputHashOf` of the call's tool with the arguments the settlement licenses (an approver's edit, the snapshot shown, or the asked
34
34
  * args); absent when they have none (outside the bindable domain) — such a record licenses no bytes. */
35
35
  readonly inputDigest?: string;
36
36
  /** The FORM of a classifier round that did not rule (a classifier deny's cause). */
@@ -861,6 +861,21 @@ export interface EngineNotice {
861
861
  * three families AND `"memory.harvest_quarantined"` when they derive from the same harvest
862
862
  * report — that sharing is the contract (one report, several distinct facts): dedup on
863
863
  * `(code, detail.reportId)`; a repeat with the same pair is a replay, a new pair is a new fact.
864
+ * - `"memory.harvest_refused"` (#2424) — the boundary harvest was refused wholesale by an incident
865
+ * (the deletion fuse, a vanished write root, a control plane that could not be read or written):
866
+ * what the session did to memory — what it said it remembered or forgot — did not take effect.
867
+ * Minted by the runner at the harvest seat, one notice per refused harvest report;
868
+ * `detail: { kind, committed, reportId?, sessionId? }` (`kind` = `HarvestReport.incident.kind`,
869
+ * `committed` = the report's applied patch count, 0 unless a dual-root merge carries the other
870
+ * plane's). The wording is engine-owned per kind: the control-plane kind does not relay its error
871
+ * text (it can name any scope's rows — the host's to read, in `onError` and the report).
872
+ * - `"memory.harvest_conflict"` (#2424) — the harvest committed, but the store did not take some of
873
+ * the session's changes: a per-id CAS miss (another writer committed a newer version first — the
874
+ * only case worded as concurrency) or the store's own refusal of the patch; those entries keep
875
+ * their stored version (a conflicted deletion leaves the entry in place). One notice per harvest
876
+ * with at least one conflict; `detail: { count, conflicts: [{ op, id, concurrent }], reportId?,
877
+ * sessionId? }` (first 20 rows; `concurrent` true ⇔ the CAS arm). Shares `detail.reportId` with
878
+ * the harvest's other notices — dedup on `(code, detail.reportId)`.
864
879
  * - `"memory.delegation_static_mark_waived"` (design/324, #324 ruling ①) — the deployment set
865
880
  * {@link RunnerDeps.memoryDelegationEvidence} to `"attested-only"` and a delegation call whose
866
881
  * STATIC tool-face verdict would have marked this session's memory polluted (attestation
@@ -1052,6 +1067,9 @@ export interface EngineNotice {
1052
1067
  * is the one sentence naming the caller-side change that would have let the call run, as the tool text carries it (for arguments
1053
1068
  * no approval can be bound to, the binding's own sentence: the remedy's approver half would not let them run). Audience `"user"`: the refused
1054
1069
  * work is the session user's own; the operator hears it through the sink like every code.
1070
+ * - `"delegation.resume_lane_missing"` (#3334) — a parked agent resumed by a lane-less drive in a process holding no park of it:
1071
+ * its completion takes the mount's sink, settling no waiting submission elsewhere; the resume proceeds. Once per drive, at
1072
+ * the consume, to the process default seat. `detail: { taskId, rootSessionId? }`. Audience `"operator"`.
1055
1073
  *
1056
1074
  * - `"memory.consolidation_recommended"` (design/339 §2.2/§6.2) — the engine-minted per-scope
1057
1075
  * session count crossed the consolidation thresholds (time gate open ∧ enough distinct
@@ -1079,7 +1097,7 @@ export interface EngineNotice {
1079
1097
  * throw rendered twice keeps one id, two refusals sharing a code/scope/message get two. Omitted
1080
1098
  * (never fabricated) when the caller composes the line with no error in hand.
1081
1099
  *
1082
- * The five SERVER-minted rows ({@link NOTICE_MINTER} `"server"`) — catalogued so their audience and detail shape
1100
+ * The four SERVER-minted rows ({@link NOTICE_MINTER} `"server"`) — catalogued so their audience and detail shape
1083
1101
  * are read here like every other row; this engine never mints them. A server forwards them through the same sink.
1084
1102
  * - `"permission.entry_mode_clamped"` — the permission mode the caller requested was clamped by the deployment's
1085
1103
  * entry floor BEFORE the run reached this engine (the server's own clamp, through this package's
@@ -1092,9 +1110,6 @@ export interface EngineNotice {
1092
1110
  * session's previous run injected (a file added, removed or renamed). Audience `"user"`; `detail: { previous,
1093
1111
  * current, sessionId }` — `previous` / `current` are chain-member relative paths, `null` = that run had none.
1094
1112
  * No `runId`. Once per run.
1095
- * - `"session.records_skipped"` — the session's store skipped records it could not read when it opened the
1096
- * session; the run continues on the history that remains. Audience `"user"`; `detail: { dropped, entriesKept,
1097
- * sessionId }` — two observed counts, not to be combined. No `runId`. Once per open that skipped.
1098
1113
  * - `"memory.layer_locked_legacy"` — a memory layer an older engine left without its owner-write bit was found at
1099
1114
  * boot; deletes in it will fail until the operator restores the bit. Audience `"operator"`; `detail: { layers,
1100
1115
  * remedy }` — layer directory names and the one command. No session. Once per boot.