@sema-agent/core 7.63.0 → 7.64.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 (204) hide show
  1. package/CHANGELOG.md +408 -0
  2. package/dist/agents/cc-peer-directory.js +1 -0
  3. package/dist/agents/cc-peer-wire.d.ts +4 -0
  4. package/dist/agents/cc-peer-wire.js +1 -0
  5. package/dist/agents/cc-uds-peer-channel.js +5 -0
  6. package/dist/agents/cross-session-judge.d.ts +3 -1
  7. package/dist/agents/cross-session-judge.js +4 -1
  8. package/dist/agents/peer-directory.d.ts +8 -0
  9. package/dist/agents/peer-directory.js +4 -0
  10. package/dist/agents/peer-held-queue.d.ts +9 -3
  11. package/dist/agents/peer-held-queue.js +12 -9
  12. package/dist/agents/peer-idle.d.ts +20 -1
  13. package/dist/agents/peer-idle.js +23 -12
  14. package/dist/agents/peer-notice-route.d.ts +16 -5
  15. package/dist/agents/peer-notice-route.js +11 -9
  16. package/dist/agents/peer-notices.d.ts +25 -8
  17. package/dist/agents/peer-notices.js +6 -1
  18. package/dist/agents/peer-session-drain.d.ts +32 -6
  19. package/dist/agents/peer-session-drain.js +100 -26
  20. package/dist/agents/send-message-tool.d.ts +7 -0
  21. package/dist/agents/send-message-tool.js +18 -6
  22. package/dist/agents/subagent.js +20 -3
  23. package/dist/core/allow-entry.d.ts +4 -0
  24. package/dist/core/ask-origin.d.ts +1 -1
  25. package/dist/core/ask-origin.js +2 -2
  26. package/dist/core/ask-unresolvable-notice.d.ts +13 -4
  27. package/dist/core/ask-unresolvable-notice.js +10 -3
  28. package/dist/core/auto-compaction.d.ts +7 -5
  29. package/dist/core/background-agent-store.d.ts +7 -0
  30. package/dist/core/background-agent-store.js +3 -0
  31. package/dist/core/checkpoint-queries.d.ts +9 -6
  32. package/dist/core/checkpoint-queries.js +8 -3
  33. package/dist/core/checkpoint-store.d.ts +5 -1
  34. package/dist/core/context-settings.d.ts +40 -9
  35. package/dist/core/context-settings.js +32 -10
  36. package/dist/core/engine-attestation.d.ts +26 -6
  37. package/dist/core/engine-attestation.js +5 -1
  38. package/dist/core/engine-notice.d.ts +24 -1
  39. package/dist/core/extension-requester.d.ts +9 -0
  40. package/dist/core/extension-requester.js +7 -0
  41. package/dist/core/file-history-store.d.ts +28 -0
  42. package/dist/core/file-history-store.js +48 -5
  43. package/dist/core/fs-write-gate-policy.js +1 -1
  44. package/dist/core/gate-fold.js +2 -0
  45. package/dist/core/gate-lanes.js +2 -0
  46. package/dist/core/gate-outcome.d.ts +39 -2
  47. package/dist/core/gate-outcome.js +20 -1
  48. package/dist/core/governance-codes.d.ts +3 -1
  49. package/dist/core/governance-codes.js +4 -0
  50. package/dist/core/leg-identity.d.ts +19 -1
  51. package/dist/core/leg-identity.js +12 -0
  52. package/dist/core/mailbox-store.d.ts +39 -4
  53. package/dist/core/mailbox-store.js +14 -2
  54. package/dist/core/memory-engine/consolidation.d.ts +3 -2
  55. package/dist/core/memory-engine/consolidation.js +16 -0
  56. package/dist/core/memory-engine/control-objects.d.ts +25 -0
  57. package/dist/core/memory-engine/control-objects.js +151 -0
  58. package/dist/core/memory-engine/control-plane-adoption.d.ts +48 -0
  59. package/dist/core/memory-engine/control-plane-adoption.js +159 -0
  60. package/dist/core/memory-engine/delegation-settlement.d.ts +21 -5
  61. package/dist/core/memory-engine/delegation-settlement.js +217 -26
  62. package/dist/core/memory-engine/dual-root.js +2 -2
  63. package/dist/core/memory-engine/engine.d.ts +38 -23
  64. package/dist/core/memory-engine/engine.js +14 -14
  65. package/dist/core/memory-engine/file-backend.d.ts +41 -65
  66. package/dist/core/memory-engine/file-backend.js +59 -166
  67. package/dist/core/memory-engine/index.d.ts +3 -2
  68. package/dist/core/memory-engine/index.js +2 -1
  69. package/dist/core/memory-engine/layout.d.ts +6 -1
  70. package/dist/core/memory-engine/layout.js +12 -7
  71. package/dist/core/memory-engine/memory-backend-contract.d.ts +10 -3
  72. package/dist/core/memory-engine/memory-backend-contract.js +158 -2
  73. package/dist/core/memory-engine/memory-deployment.d.ts +11 -3
  74. package/dist/core/memory-engine/memory-deployment.js +31 -6
  75. package/dist/core/memory-engine/origin-clearance.d.ts +12 -3
  76. package/dist/core/memory-engine/origin-clearance.js +68 -9
  77. package/dist/core/memory-engine/session-write-home.d.ts +34 -1
  78. package/dist/core/memory-engine/session-write-home.js +37 -10
  79. package/dist/core/memory-engine/types.d.ts +44 -7
  80. package/dist/core/memory-engine/types.js +2 -1
  81. package/dist/core/mode-policy.js +3 -3
  82. package/dist/core/mods/agent-stations.d.ts +18 -0
  83. package/dist/core/mods/agent-stations.js +8 -6
  84. package/dist/core/mods/extension-call.d.ts +4 -0
  85. package/dist/core/mods/extension-call.js +8 -0
  86. package/dist/core/mods/tool-call.js +3 -4
  87. package/dist/core/parent-spec-seat.d.ts +2 -2
  88. package/dist/core/peer-channel.d.ts +5 -0
  89. package/dist/core/permission-rule-consent.d.ts +21 -10
  90. package/dist/core/permission-rule-consent.js +50 -23
  91. package/dist/core/permission-rule-store.d.ts +41 -16
  92. package/dist/core/permission-rule-store.js +2 -0
  93. package/dist/core/refusal-echo.d.ts +20 -0
  94. package/dist/core/refusal-echo.js +33 -0
  95. package/dist/core/retention.d.ts +180 -10
  96. package/dist/core/retention.js +45 -0
  97. package/dist/core/retired-keys.d.ts +5 -0
  98. package/dist/core/retired-keys.js +3 -0
  99. package/dist/core/rule-offer-read.d.ts +0 -4
  100. package/dist/core/rule-offer-read.js +2 -18
  101. package/dist/core/runner/classifier-ladder.d.ts +7 -1
  102. package/dist/core/runner/classifier-ladder.js +4 -2
  103. package/dist/core/runner/compact-session.js +10 -7
  104. package/dist/core/runner/compaction-call-options.d.ts +7 -7
  105. package/dist/core/runner/compaction-call-options.js +3 -2
  106. package/dist/core/runner/contracts.d.ts +21 -2
  107. package/dist/core/runner/delegation-owner.d.ts +10 -3
  108. package/dist/core/runner/delegation-owner.js +4 -1
  109. package/dist/core/runner/gate-exit.d.ts +6 -0
  110. package/dist/core/runner/gate-exit.js +11 -2
  111. package/dist/core/runner/memory-consolidation-driver.d.ts +4 -2
  112. package/dist/core/runner/memory-consolidation-driver.js +8 -5
  113. package/dist/core/runner/prepare-ask-lane.js +3 -3
  114. package/dist/core/runner/prepare-caps-and-workflow.d.ts +3 -1
  115. package/dist/core/runner/prepare-caps-and-workflow.js +2 -2
  116. package/dist/core/runner/prepare-config-doors.js +4 -0
  117. package/dist/core/runner/prepare-delegation-surface.d.ts +3 -0
  118. package/dist/core/runner/prepare-delegation-surface.js +2 -2
  119. package/dist/core/runner/prepare-gate-stations.d.ts +5 -0
  120. package/dist/core/runner/prepare-gate-stations.js +5 -5
  121. package/dist/core/runner/prepare-hands-readface.js +1 -1
  122. package/dist/core/runner/prepare-inherited-gate.d.ts +3 -1
  123. package/dist/core/runner/prepare-inherited-gate.js +4 -2
  124. package/dist/core/runner/prepare-memory.d.ts +4 -0
  125. package/dist/core/runner/prepare-memory.js +14 -20
  126. package/dist/core/runner/prepare-policy-chain.js +7 -7
  127. package/dist/core/runner/prepare-prompt-inputs.js +1 -1
  128. package/dist/core/runner/prepare-task.js +15 -10
  129. package/dist/core/runner/prepare-wiring-manifest.d.ts +3 -1
  130. package/dist/core/runner/prepare-wiring-manifest.js +3 -2
  131. package/dist/core/runner/resume-admission.d.ts +2 -2
  132. package/dist/core/runner/resume-admission.js +2 -23
  133. package/dist/core/runner/role-resolution-table.d.ts +98 -0
  134. package/dist/core/runner/role-resolution-table.js +62 -0
  135. package/dist/core/runner/run-compaction-machinery.js +2 -2
  136. package/dist/core/runner/run-identity-wiring.js +12 -9
  137. package/dist/core/runner/run-leg.js +8 -4
  138. package/dist/core/runner/run-notification-lane.js +22 -22
  139. package/dist/core/runner/run-recovery-lanes.js +3 -3
  140. package/dist/core/runner/run-terminal-adoption.js +1 -1
  141. package/dist/core/runner/run-turn-boundary.js +14 -15
  142. package/dist/core/runner/runtask.js +1 -1
  143. package/dist/core/runner/tool-occurrence.d.ts +4 -2
  144. package/dist/core/runner/tool-occurrence.js +2 -2
  145. package/dist/core/runner-deps.d.ts +1 -1
  146. package/dist/core/session-checkout.d.ts +63 -3
  147. package/dist/core/session-checkout.js +152 -58
  148. package/dist/core/shell-read-silence.js +8 -0
  149. package/dist/core/store-contracts/peer-directory-contract.js +8 -1
  150. package/dist/core/task-event.d.ts +9 -5
  151. package/dist/core/task-notification.d.ts +110 -31
  152. package/dist/core/task-notification.js +180 -100
  153. package/dist/core/task-registry-agent.d.ts +11 -0
  154. package/dist/core/task-registry-agent.js +11 -3
  155. package/dist/core/task-registry-shared.d.ts +7 -0
  156. package/dist/core/task-registry.d.ts +18 -0
  157. package/dist/core/task-registry.js +27 -8
  158. package/dist/core/task-spec.d.ts +7 -2
  159. package/dist/core/tool-errors.d.ts +14 -6
  160. package/dist/core/tool-errors.js +1 -1
  161. package/dist/core/tool-policy.d.ts +18 -1
  162. package/dist/core/tool-policy.js +16 -7
  163. package/dist/core/tool-result-store.d.ts +20 -0
  164. package/dist/core/tool-spec.d.ts +4 -0
  165. package/dist/core/trace.d.ts +3 -2
  166. package/dist/core/workflow-journal-store.d.ts +11 -0
  167. package/dist/core/workflow-journal-store.js +7 -0
  168. package/dist/core/workflow-run-store.d.ts +9 -0
  169. package/dist/core/workflow-run-store.js +6 -0
  170. package/dist/engine/compaction/compaction.d.ts +2 -1
  171. package/dist/engine/harness/types.d.ts +1 -0
  172. package/dist/engine/session/session.d.ts +7 -1
  173. package/dist/engine/session/session.js +5 -2
  174. package/dist/index.d.ts +7 -5
  175. package/dist/index.js +7 -5
  176. package/dist/orchestration/run-workflow-tool.d.ts +4 -0
  177. package/dist/orchestration/run-workflow-tool.js +7 -0
  178. package/dist/orchestration/workflow-types.d.ts +2 -1
  179. package/dist/orchestration/workflow.d.ts +3 -0
  180. package/dist/orchestration/workflow.js +2 -1
  181. package/dist/stores/file/checkpoint-store.d.ts +6 -0
  182. package/dist/stores/file/checkpoint-store.js +4 -1
  183. package/dist/stores/file/file-history-store.d.ts +13 -0
  184. package/dist/stores/file/file-history-store.js +75 -13
  185. package/dist/stores/file/index.d.ts +11 -1
  186. package/dist/stores/file/index.js +7 -11
  187. package/dist/stores/file/permission-rule-store.d.ts +23 -0
  188. package/dist/stores/file/permission-rule-store.js +75 -7
  189. package/dist/stores/file/tool-result-store.d.ts +14 -0
  190. package/dist/stores/file/tool-result-store.js +39 -2
  191. package/dist/stores/file/workflow-journal-store.d.ts +4 -0
  192. package/dist/stores/file/workflow-journal-store.js +17 -0
  193. package/dist/stores/file/workflow-run-store.d.ts +3 -0
  194. package/dist/stores/file/workflow-run-store.js +15 -0
  195. package/dist/tools/fs/read-deny.d.ts +15 -2
  196. package/dist/tools/fs/read-deny.js +10 -2
  197. package/dist/tools/fs/shell-read-check.d.ts +8 -2
  198. package/dist/tools/fs/shell-read-check.js +7 -7
  199. package/package.json +2 -2
  200. package/test/export-surface.snapshot.json +63 -1
  201. package/wire-changes/core-stores-sql@7.64.0.json +30 -0
  202. package/wire-changes/core@7.64.0.json +2653 -0
  203. package/wire-changes/mods-kernel@7.64.0.json +30 -0
  204. package/wire-changes/primitives@7.64.0.json +30 -0
@@ -6,6 +6,7 @@ import { canAccessAgentRecord, } from "./background-agent-store.js";
6
6
  import { delimitUntrusted } from "./untrusted-text.js";
7
7
  import { createSafeNotifier } from "./safe-notify.js";
8
8
  import { stripCwdSentinel } from "../tools/fs/fs-shared.js";
9
+ import { readExtensionRequester } from "./extension-requester.js";
9
10
  import { persistTaskArtifact, taskArtifactOriginOf } from "./tool-result-store.js";
10
11
  import { registerMonitorLane, pollMonitorLane, stopMonitorLane } from "./task-registry-monitor.js";
11
12
  import { registerWorkflowLane, pollWorkflowLane, stopWorkflowLane } from "./task-registry-workflow.js";
@@ -20,6 +21,17 @@ export { canAccessWorkflowRun, clipTaskOutput, MONITOR_BATCH_WINDOW_MS, MONITOR_
20
21
  function shellRowRetained(h) {
21
22
  return retainsBackgroundProcesses({ marked: h.retained === true, env: envDeclaresRetain(h.env) });
22
23
  }
24
+ function hardFaceVisitOf(handle, includeRetained, access) {
25
+ if (handle.type !== "background_bash" && handle.type !== "monitor")
26
+ return undefined;
27
+ if (access !== undefined && !canAccess(handle, access))
28
+ return undefined;
29
+ if (handle.status === "completed")
30
+ return undefined;
31
+ const retained = shellRowRetained(handle);
32
+ const skipped = retained && !includeRetained && handle.status !== "killed";
33
+ return { handle, retained, skipped, reaps: !skipped && handle.status === "running" };
34
+ }
23
35
  const BLOCK_DEFAULT_TIMEOUT_MS = 30_000;
24
36
  const BLOCK_MAX_TIMEOUT_MS = 600_000;
25
37
  function blockDeadline(timeoutMs, now) {
@@ -607,16 +619,13 @@ export class TaskRegistry {
607
619
  const sessionAccess = opts.sessionId !== undefined ? { owner: opts.sessionId, sessionId: opts.sessionId, scope: opts.scope } : undefined;
608
620
  const receipts = [];
609
621
  const settledOwners = new Set();
610
- for (const handle of this.handles.values()) {
611
- if (handle.type !== "background_bash" && handle.type !== "monitor")
612
- continue;
613
- if (sessionAccess !== undefined && !canAccess(handle, sessionAccess))
614
- continue;
615
- if (handle.status === "completed")
622
+ for (const row of this.handles.values()) {
623
+ const visit = hardFaceVisitOf(row, opts.includeRetained, sessionAccess);
624
+ if (visit === undefined)
616
625
  continue;
617
- const retained = shellRowRetained(handle);
626
+ const { handle, retained } = visit;
618
627
  const base = { taskId: handle.id, type: handle.type, ...(handle.owner !== undefined ? { owner: handle.owner } : {}), ...(retained ? { retained: true } : {}) };
619
- if (retained && !opts.includeRetained && handle.status !== "killed") {
628
+ if (visit.skipped) {
620
629
  receipts.push({ ...base, outcome: "retained_skipped" });
621
630
  continue;
622
631
  }
@@ -665,6 +674,14 @@ export class TaskRegistry {
665
674
  this.pokeBgQuiescence(owner);
666
675
  return receipts;
667
676
  }
677
+ countRunningBackgroundShells(opts) {
678
+ let n = 0;
679
+ for (const row of this.handles.values()) {
680
+ if (hardFaceVisitOf(row, opts.includeRetained)?.reaps === true)
681
+ n++;
682
+ }
683
+ return n;
684
+ }
668
685
  onSessionReap(hook) {
669
686
  this.sessionReapHooks.add(hook);
670
687
  return () => void this.sessionReapHooks.delete(hook);
@@ -1045,11 +1062,13 @@ The durable record is still marked running (last update ${new Date(row.updatedAt
1045
1062
  if (!canAccess(h, access))
1046
1063
  continue;
1047
1064
  const childSession = childSessionAnchorOf(h);
1065
+ const requestedBy = h.type === "background_agent" ? readExtensionRequester(h.requestedBy) : undefined;
1048
1066
  out.push({
1049
1067
  task_id: h.id,
1050
1068
  type: h.type,
1051
1069
  status: h.status,
1052
1070
  sessionScoped: h.sessionScoped === true,
1071
+ ...(requestedBy !== undefined ? { requestedBy } : {}),
1053
1072
  ...((h.type === "background_bash" || h.type === "monitor") && shellRowRetained(h) ? { retained: true } : {}),
1054
1073
  ...(h.description !== undefined ? { description: h.description } : {}),
1055
1074
  ...(h.toolUseId !== undefined ? { toolUseId: h.toolUseId } : {}),
@@ -1348,7 +1348,7 @@ export interface TaskSpec {
1348
1348
  * Override auto-compaction thresholds for this task's session. Compaction (LLM summary, persisted
1349
1349
  * to the session) runs in two places sharing these settings: at every within-task turn boundary
1350
1350
  * (design/64 §25 (A) — the long-single-task case) and once at task end (the between-task case).
1351
- * Defaults: enabled, reserveTokens 16384, keepRecentTokens 0 (design/169-C; 20000 was the
1351
+ * Defaults: both seats on (`autoCompact` / `manualCompact` below), reserveTokens 16384, keepRecentTokens 0 (design/169-C; 20000 was the
1352
1352
  * pre-169 default). A zero budget is NOT "no verbatim tail": the cut-point search has a
1353
1353
  * structural floor under the budget, so the default already leaves the last exchange verbatim
1354
1354
  * after the summary (a trailing tool-result batch keeps its emitting assistant with it) — the
@@ -1386,7 +1386,12 @@ export interface TaskSpec {
1386
1386
  * no-op when the task has no execution env (no hands, nothing to re-read).
1387
1387
  */
1388
1388
  compaction?: {
1389
- enabled?: boolean;
1389
+ /** The passes the engine starts by itself (the lanes: {@link compactionEnabled}); `false` switches them off. Absent ⇒
1390
+ * `RunnerDeps.contextSettings[word].autoCompact`, else on. A non-boolean refuses the run (`config.invalid_argument`). */
1391
+ autoCompact?: boolean;
1392
+ /** The passes a caller asks for; `false` answers each `"disabled"`, no summary call. Absent ⇒ the deployment's
1393
+ * `manualCompact`, else on. The retired `enabled` (both at once) is refused by name (`config.spec_retired_key`). */
1394
+ manualCompact?: boolean;
1390
1395
  withinTask?: boolean;
1391
1396
  reserveTokens?: number;
1392
1397
  keepRecentTokens?: number;
@@ -92,9 +92,17 @@ export declare function formatToolError(error: unknown): string;
92
92
  * `unknown` would UNDO the very audit finding this folder exists to fix (these ARE real
93
93
  * terminal codes, not foreign ones); (c) pre-existing precedent (`config.compliance_required`,
94
94
  * NOT part of this diff) already folds a transient/retryable governance code into `config`.
95
- * `memory.admission_required`/`_denied`/`env.lifetime_expired` are EXACT codes, not broad
96
- * `memory.`/`env.` prefixes — falsification review (A-005.3 follow-up) caught an
97
- * earlier draft folding EVERY `memory.*`/`env.*` code here, which misclassified the
95
+ * The whole `env.` namespace is `config` BY PREFIX: a terminal code there is a refusal or a
96
+ * limit of the execution environment — `env.lifetime_expired`, or the code a deployment's
97
+ * `executionEnvFactory` throws when it refuses to mint (the engine carries a factory's code
98
+ * to the terminal verbatim; the module registers none of them, so a code a later deployment
99
+ * mints still reads `config`) — and what a caller does about every one of them is the same:
100
+ * change the environment or the configuration, then retry. The other `env.`-spelled strings
101
+ * of the codebase (a prompt-assembly block id, mod-kernel event names) are never a terminal
102
+ * code, and this folder's domain is the terminal code alone.
103
+ * `memory.admission_required`/`_denied` are EXACT codes, not a broad `memory.` prefix —
104
+ * falsification review (A-005.3 follow-up) caught an
105
+ * earlier draft folding EVERY `memory.*` code here, which misclassified the
98
106
  * memory-engine's non-governance incident codes (`memory.secret_detected` et al.,
99
107
  * explicitly listed as NON-governance in `NON_GOVERNANCE_MEMORY_CODES` — a content-safety
100
108
  * tool-call refusal, not a task-spec rejection) as configuration failures. `usage.*` STAYS
@@ -119,9 +127,9 @@ export type WorkerErrorClass = "budget" | "limit" | "output" | "suspend" | "revi
119
127
  *
120
128
  * SCOPE: this folds a TERMINAL `TaskResult.errorCode` only — i.e. every OUR dotted prefix that the runner can
121
129
  * assemble into a failed task outcome (`limits.`/`output.`/`suspend.`/`review.`/`unexpected.`/
122
- * `oracle.`/`resume.`/`config.`/`usage.`) as a broad PREFIX, plus `memory.admission_required` /
123
- * `memory.admission_denied` / `env.lifetime_expired` / the two `model.*_exhausted` loop terminals as EXACT codes (their
124
- * sibling `memory.*`/`env.*`/`model.*` strings are NOT all terminal-errorCode-shaped — see {@link EXACT_CODE_CLASS}'s
130
+ * `oracle.`/`resume.`/`config.`/`usage.`/`env.`) as a broad PREFIX, plus `memory.admission_required` /
131
+ * `memory.admission_denied` / the two `model.*_exhausted` loop terminals as EXACT codes (their
132
+ * sibling `memory.*`/`model.*` strings are NOT all terminal-errorCode-shaped — see {@link EXACT_CODE_CLASS}'s
125
133
  * comment), plus the flat 1.36 codes.
126
134
  * The `limits.` namespace splits into the `budget` and `limit` classes by exact code — see
127
135
  * {@link EXACT_CODE_CLASS}. Operation-level dotted codes that are surfaced to a *caller* and never become a
@@ -88,7 +88,6 @@ const EXACT_CODE_CLASS = new Map([
88
88
  ["memory.admission_required", "config"],
89
89
  ["memory.admission_denied", "config"],
90
90
  ["memory.capture_optout_denied", "config"],
91
- ["env.lifetime_expired", "config"],
92
91
  ["model.malformed_tool_use_exhausted", "output"],
93
92
  ["model.truncated_output_exhausted", "output"],
94
93
  ]);
@@ -102,6 +101,7 @@ const DOTTED_PREFIX_CLASS = [
102
101
  ["resume.", "resume"],
103
102
  ["config.", "config"],
104
103
  ["usage.", "config"],
104
+ ["env.", "config"],
105
105
  ];
106
106
  export function errorClassOf(errorCode) {
107
107
  if (!errorCode)
@@ -2027,13 +2027,17 @@ export type ResolverArmResult = (Extract<ResolvedAsk, {
2027
2027
  }> & {
2028
2028
  settlement?: Settlement;
2029
2029
  bindingRefusal?: undefined;
2030
+ quotesQuestion?: undefined;
2030
2031
  })
2031
- /** `bindingRefusal`: the arm refused arguments no approval can be bound to — the record carries the sentence. */
2032
+ /** `bindingRefusal`: the arm refused arguments no approval can be bound to — the record carries the sentence. `quotesQuestion`:
2033
+ * the arm's sentence quotes the ask's question (`req.message`) whole, so the resolution may carry the literals that question
2034
+ * quotes ({@link quotingQuestion}; read by {@link resolveAskFor} alone, never on the resolution). */
2032
2035
  | (Extract<ResolvedAsk, {
2033
2036
  action: "deny";
2034
2037
  }> & {
2035
2038
  settlement: Settlement;
2036
2039
  bindingRefusal?: string;
2040
+ quotesQuestion?: true;
2037
2041
  });
2038
2042
  /**
2039
2043
  * The DIRECTIONAL format controls, as a closed set (see {@link AskRequest.hasBidiControls}):
@@ -2111,3 +2115,16 @@ onLateSettlement?: (late: {
2111
2115
  kind: "error";
2112
2116
  error: unknown;
2113
2117
  }) => void): Promise<ResolvedAsk>;
2118
+ /**
2119
+ * {@link resolveAsk} at an engine mint station, which also hands over the decision it ASKED (`asked`): when the arm that ran
2120
+ * quotes the question ({@link quotingQuestion}) and the question the request puts to the approver IS the sentence the engine
2121
+ * composed for `asked` ({@link engineSentenceOf}, byte for byte — a card that appended to it, or a layer that rewrote it, puts
2122
+ * another sentence there), the refusal's record carries the literals that sentence quotes. The list's only source is the record
2123
+ * of the station that composed the question; the request carries none. Not re-exported from `src/index.ts`.
2124
+ */
2125
+ export declare function resolveAskFor(req: AskRequest, onAsk: OnAsk | undefined, signal: AbortSignal | undefined, onLateSettlement: ((late: {
2126
+ kind: "approve";
2127
+ } | {
2128
+ kind: "error";
2129
+ error: unknown;
2130
+ }) => void) | undefined, asked: object | undefined): Promise<ResolvedAsk>;
@@ -4,7 +4,7 @@ import { argsReadFrom, carryArgsReadFrom, withArgsReading } from "./effective-pa
4
4
  import { editRewrittenSentence, readRejudge, rewriteChasedSentence } from "./rewrite-rejudge.js";
5
5
  import { brandPolicyAskClass } from "./ask-class.js";
6
6
  import { decisionAskClassesOf, headlessDenialMessage, joinAskReasons } from "./ask-origin.js";
7
- import { attest, attestationOf, isEngineAttestation, mergeAttestation, mintAttestation, withAttestation } from "./engine-attestation.js";
7
+ import { attest, attestationOf, engineSentenceOf, isEngineAttestation, mergeAttestation, mintAttestation, withAttestation } from "./engine-attestation.js";
8
8
  import { ownReadRootCandidate, readRootGrantSeat } from "./read-root-grant-screen.js";
9
9
  import { DECIDED_VIA, decidersNote, isDecidedVia, policyDeciderOf, settledByDecider } from "./gate-outcome.js";
10
10
  import { unjudgedAllowRefused } from "./real-approval.js";
@@ -1057,6 +1057,7 @@ export function policyRefusalMessage(toolName, askMessage, note, decidedVia) {
1057
1057
  `was blocked and why you needed it, then continue with the parts of the task that do not require approval.`;
1058
1058
  return note === undefined ? body : `${body}\nPolicy note:\n${delimitUntrusted("policy note", note, REVIEWER_NOTE_MAX_BODY)}`;
1059
1059
  }
1060
+ const quotingQuestion = Object.freeze({ quotesQuestion: true });
1060
1061
  export const BIDI_CONTROL_CHARS = "\\u061C\\u200E\\u200F\\u202A-\\u202E\\u2066-\\u2069";
1061
1062
  const BIDI_CONTROL_RE = new RegExp(`[${BIDI_CONTROL_CHARS}]`, "u");
1062
1063
  const BIDI_SCAN_MAX_NODES = 5_000;
@@ -1131,12 +1132,17 @@ export function carriesBidiControls(value, limits) {
1131
1132
  }
1132
1133
  }
1133
1134
  export async function resolveAsk(req, onAsk, signal, onLateSettlement) {
1135
+ return resolveAskFor(req, onAsk, signal, onLateSettlement, undefined);
1136
+ }
1137
+ export async function resolveAskFor(req, onAsk, signal, onLateSettlement, asked) {
1134
1138
  const askedDigest = exactBoundInputHashOf(req.toolName, req.args);
1135
- const { settlement, bindingRefusal, ...r } = await resolveAskArms(req, onAsk, signal, onLateSettlement);
1139
+ const question = asked !== undefined ? engineSentenceOf(asked, req) : undefined;
1140
+ const { settlement, bindingRefusal, quotesQuestion, ...r } = await resolveAskArms(req, onAsk, signal, onLateSettlement);
1136
1141
  if (settlement === undefined)
1137
1142
  return r;
1143
+ const echoed = quotesQuestion === true && question?.echoed !== undefined && req.message === question.text && r.message !== undefined ? question.echoed : undefined;
1138
1144
  const licensedDigest = r.action === "allow" && r.updatedInput !== undefined ? exactBoundInputHashOf(req.toolName, r.updatedInput) : r.presentedInput !== undefined ? exactBoundInputHashOf(req.toolName, r.presentedInput) : askedDigest;
1139
- return attest(r, req, { settlement, ...(req.origin !== undefined ? { origin: req.origin } : {}), ...(req.classes !== undefined ? { classes: req.classes } : {}), ...(licensedDigest !== undefined ? { inputDigest: licensedDigest } : {}), ...(bindingRefusal !== undefined ? { bindingRefusal } : {}) });
1145
+ return attest(r, req, { settlement, ...(req.origin !== undefined ? { origin: req.origin } : {}), ...(req.classes !== undefined ? { classes: req.classes } : {}), ...(licensedDigest !== undefined ? { inputDigest: licensedDigest } : {}), ...(bindingRefusal !== undefined ? { bindingRefusal } : {}), ...(echoed !== undefined ? { sentence: { text: r.message, echoed } } : {}) });
1140
1146
  }
1141
1147
  function raceAskWaitAgainstSignal(wait, signal) {
1142
1148
  const settledWait = wait.then((value) => ({ tag: "value", value }), (error) => ({ tag: "threw", error }));
@@ -1267,7 +1273,7 @@ function readApproverOutcomeObject(ok, toolName, editLane) {
1267
1273
  async function resolveAskArms(req, onAsk, signal, onLateSettlement) {
1268
1274
  if (onAsk === "allow") {
1269
1275
  if (req.requiresRealApproval === true)
1270
- return unjudgedAllowRefused(req, "blanket");
1276
+ return { ...unjudgedAllowRefused(req, "blanket"), ...quotingQuestion };
1271
1277
  return { action: "allow", decisionReason: "mode" };
1272
1278
  }
1273
1279
  if (onAsk === undefined || onAsk === "deny") {
@@ -1277,7 +1283,7 @@ async function resolveAskArms(req, onAsk, signal, onLateSettlement) {
1277
1283
  message: bound.ok ? headlessDenialMessage(req.toolName, req.message) : bound.refusal,
1278
1284
  decisionReason: "mode",
1279
1285
  settlement: settledByNobody("no_approver"),
1280
- ...(bound.ok ? {} : { bindingRefusal: bound.refusal }),
1286
+ ...(bound.ok ? quotingQuestion : { bindingRefusal: bound.refusal }),
1281
1287
  };
1282
1288
  }
1283
1289
  if (signal?.aborted) {
@@ -1310,6 +1316,7 @@ async function resolveAskArms(req, onAsk, signal, onLateSettlement) {
1310
1316
  `elapsed with no answer; auto-denied: ${req.message}`,
1311
1317
  decisionReason: "mode",
1312
1318
  settlement: { kind: "denial_limit_window_expired", who: { party: "engine", window: "denial_limit" }, when: Date.now() },
1319
+ ...quotingQuestion,
1313
1320
  };
1314
1321
  }
1315
1322
  if (raced.tag === "aborted") {
@@ -1339,6 +1346,7 @@ async function resolveAskArms(req, onAsk, signal, onLateSettlement) {
1339
1346
  decisionReason: "mode",
1340
1347
  settlement: settledByNobody("approver_unavailable"),
1341
1348
  approverUnavailable: true,
1349
+ ...quotingQuestion,
1342
1350
  };
1343
1351
  }
1344
1352
  if (typeof ok === "object" && ok !== null) {
@@ -1346,7 +1354,7 @@ async function resolveAskArms(req, onAsk, signal, onLateSettlement) {
1346
1354
  if (reading.kind === "refused")
1347
1355
  return { action: "deny", message: reading.message, decisionReason: "mode", settlement: reading.settlement, ...(reading.binding === true ? { bindingRefusal: reading.message } : {}) };
1348
1356
  if (reading.kind === "allow" && reading.settlement.who.party === "policy" && req.requiresRealApproval === true) {
1349
- return { ...unjudgedAllowRefused(req, "policy"), ...readRootGrantSeat(reading.grant, offered, false) };
1357
+ return { ...unjudgedAllowRefused(req, "policy"), ...quotingQuestion, ...readRootGrantSeat(reading.grant, offered, false) };
1350
1358
  }
1351
1359
  const grantSeat = readRootGrantSeat(reading.grant, offered, reading.kind === "allow");
1352
1360
  if (reading.kind === "deny") {
@@ -1359,6 +1367,7 @@ async function resolveAskArms(req, onAsk, signal, onLateSettlement) {
1359
1367
  : humanRefusalMessage(req, reading.note),
1360
1368
  decisionReason: "mode",
1361
1369
  settlement: reading.settlement,
1370
+ ...quotingQuestion,
1362
1371
  ...grantSeat,
1363
1372
  };
1364
1373
  }
@@ -1377,5 +1386,5 @@ async function resolveAskArms(req, onAsk, signal, onLateSettlement) {
1377
1386
  settlement: settledByNobody("approver_contract"),
1378
1387
  };
1379
1388
  }
1380
- return { action: "deny", message: humanRefusalMessage(req), decisionReason: "mode", settlement: settledByDecider("person", "refused", undefined) };
1389
+ return { action: "deny", message: humanRefusalMessage(req), decisionReason: "mode", settlement: settledByDecider("person", "refused", undefined), ...quotingQuestion };
1381
1390
  }
@@ -141,6 +141,26 @@ export interface ToolResultStore {
141
141
  reap?(now: number, opts?: {
142
142
  maxAgeMs?: number;
143
143
  }): Promise<number> | number;
144
+ /**
145
+ * Delete the entries stored with NO owner record that were stored before `cutoffMs` (epoch ms) — the orphan-tool-results domain's
146
+ * leg ({@link import("./retention.js").RETENTION_CASCADE}). No session can claim such an entry (written without provenance, or a
147
+ * winning write interrupted between its content and its owner record), so no session deletion ever reaches it; the cutoff is the
148
+ * one bound it has. Answers how many entries it removed.
149
+ *
150
+ * Rules every implementation follows:
151
+ * - **an owned entry is never this verb's**, however old — its session's deletion is its way out;
152
+ * - **an owner record that is present but unreadable is not "no owner"**: that entry is kept, because a guess would destroy
153
+ * another session's output (the same posture {@link deleteBySession} counts as `unattributable`);
154
+ * - **the bound is the call's**: a `cutoffMs` that is not a finite number is refused (`config.retention_policy_invalid`)
155
+ * before any entry is touched; no policy object is read;
156
+ * - whether a transcript still points at an unowned entry is the caller's to judge (it holds the transcripts); this verb
157
+ * judges the store's own two facts, the owner record and the write time;
158
+ * - **idempotent**, and an entry that disappears between enumeration and removal is honest absence.
159
+ *
160
+ * Optional: absent ⇒ unowned entries leave only through {@link reap}'s age bound, which does not consult ownership. A store
161
+ * that records no write time cannot age an entry and does not implement it (the in-memory store keeps none).
162
+ */
163
+ deleteUnattributable?(cutoffMs: number): Promise<number> | number;
144
164
  /**
145
165
  * The READ half of the same ownership coordinate {@link deleteBySession} erases by: every entry this store recorded as belonging to
146
166
  * `sessionId`, as the ref and the owner recorded at its winning write. Without it the offloaded results a session's transcript
@@ -709,6 +709,10 @@ export interface ToolExecuteContext {
709
709
  * fixed point `ctx.rootSessionId ?? ctx.sessionId` at every spawn). Absent for a top-level run
710
710
  * (its OWN sessionId is the root). */
711
711
  rootSessionId?: string;
712
+ /** The occupant (`SessionMetadata.incarnation`) of the session the fixed point above names (`rootSessionId ?? sessionId`)
713
+ * as this tree holds it — Runner-filled, trusted. A spawn hands it down beside the root anchor
714
+ * (`RunInternals.rootSessionIncarnation`); absent = unknown (a row minted before occupants, a revival's tree). */
715
+ rootSessionIncarnation?: string;
712
716
  /** The run's delegation tree owner seat (`RunInternals.delegationOwner`, Runner-filled): a delegation tool reads the tree's owner
713
717
  * through it for the rows it creates for a child (a placed transcript, a fork, a park's durable row) and threads it into a spawned
714
718
  * child's internals by reference — never into a revival's. */
@@ -762,8 +762,9 @@ export type TraceEvent = {
762
762
  taskId: string;
763
763
  ts: number;
764
764
  } | {
765
- /** MF-18 修① — a manual /compact was processed while compaction is DISABLED by the
766
- * task spec (`compaction.enabled:false`): the request can never be honored this run. */
765
+ /** MF-18 修① — a manual /compact was processed while requested compaction is switched OFF
766
+ * (the `manualCompact` seat is `false`, the task's or the deployment's): the request is answered
767
+ * without a pass; the `autoCompact` seat does not reach it. */
767
768
  kind: "compaction.disabled";
768
769
  version: 1;
769
770
  taskId: string;
@@ -137,6 +137,16 @@ export interface WorkflowJournalStore {
137
137
  * returns its API route (cloud form). `undefined`/absent ⇒ the completion notification's diagnostics
138
138
  * line names no journal (the record behind its ref still carries every agent's row). Engine-facing string, never parsed. */
139
139
  locator?(runId: string, scope: string): string | undefined;
140
+ /**
141
+ * Erase `runId`'s journal IF its recorded scope === `scope` (the {@link load} wall: a cross-scope call erases nothing) — the
142
+ * session-tree cascade's leg for a terminal run its session started ({@link import("./retention.js").RETENTION_CASCADE}).
143
+ * `true` = this call removed it; `false` = there was none under that scope. Idempotent; a store fault throws (a deletion
144
+ * face that cannot delete is loud). A later `load` of the id answers empty; the cascade deletes the run's record with it, and a
145
+ * resume from a run whose record is gone is refused before the load (`workflow.park_truth_unreadable`, `record_missing`). A resume
146
+ * claim naming the id holds ids only and is not this verb's (the claim's own release and sweep govern it). OPTIONAL: absent ⇒ this store's journals outlive their runs,
147
+ * and the deployment owns that gap.
148
+ */
149
+ deleteRun?(runId: string, scope: string): Promise<boolean>;
140
150
  /**
141
151
  * ADMISSION for a resume, so two concurrent
142
152
  * `resumeFromRunId` legs off ONE source run cannot fork its execution.
@@ -308,6 +318,7 @@ export declare class InMemoryWorkflowJournalStore implements WorkflowJournalStor
308
318
  /** Release ONLY a claim `newRunId` still holds (a missing/foreign/already-taken-over claim is a
309
319
  * no-op, never an error — matches the file store's contract). */
310
320
  releaseResumeClaim(input: ResumeClaimArgs): Promise<void>;
321
+ deleteRun(runId: string, scope: string): Promise<boolean>;
311
322
  load(runId: string, scope: string): Promise<WorkflowJournalEntry[]>;
312
323
  append(runId: string, scope: string, entry: WorkflowJournalEntry): Promise<void>;
313
324
  }
@@ -144,6 +144,13 @@ export class InMemoryWorkflowJournalStore {
144
144
  if (existing !== undefined && existing.holder === input.newRunId)
145
145
  table.delete(input.sourceRunId);
146
146
  }
147
+ async deleteRun(runId, scope) {
148
+ const rec = this.runs.get(runId);
149
+ if (!rec || rec.scope !== scope)
150
+ return false;
151
+ this.runs.delete(runId);
152
+ return true;
153
+ }
147
154
  async load(runId, scope) {
148
155
  const rec = this.runs.get(runId);
149
156
  if (!rec || rec.scope !== scope)
@@ -197,6 +197,14 @@ export interface WorkflowRunStore {
197
197
  maxAgeMs?: number;
198
198
  keep?: number;
199
199
  }): Promise<number>;
200
+ /**
201
+ * Delete the TERMINAL runs in `scope` whose `originatingSessionId` is `sessionId` (strict equality, the
202
+ * {@link listByScope} `session` filter's) — the session-tree cascade's leg ({@link import("./retention.js").RETENTION_CASCADE}).
203
+ * A running run is never deleted (it is a live reference: the cascade does not delete its session's tree). Answers the ids it
204
+ * deleted; idempotent (a repeat answers `[]`); a store fault throws. OPTIONAL: absent ⇒ this store's runs outlive the session
205
+ * that started them, and the deployment owns that gap.
206
+ */
207
+ deleteBySession?(sessionId: string, scope: string): Promise<string[]>;
200
208
  }
201
209
  /**
202
210
  * REF-A5 — THE optimistic-concurrency guard for {@link WorkflowRunStore.update}, shared by every backend:
@@ -236,6 +244,7 @@ export declare class InMemoryWorkflowRunStore implements WorkflowRunStore {
236
244
  maxAgeMs?: number;
237
245
  keep?: number;
238
246
  }): Promise<number>;
247
+ deleteBySession(sessionId: string, scope: string): Promise<string[]>;
239
248
  /** Test/inspection helper: number of stored runs. */
240
249
  get size(): number;
241
250
  }
@@ -97,6 +97,12 @@ export class InMemoryWorkflowRunStore {
97
97
  this.runs.delete(id);
98
98
  return doomed.size;
99
99
  }
100
+ async deleteBySession(sessionId, scope) {
101
+ const doomed = [...this.runs.values()].filter((r) => r.scope === scope && r.originatingSessionId === sessionId && isTerminalWorkflowStatus(r.status)).map((r) => r.id);
102
+ for (const id of doomed)
103
+ this.runs.delete(id);
104
+ return doomed;
105
+ }
100
106
  get size() {
101
107
  return this.runs.size;
102
108
  }
@@ -90,7 +90,8 @@ export interface CompactionResult<T = unknown> {
90
90
  }
91
91
  /** Compaction thresholds and retention settings. */
92
92
  export interface CompactionSettings {
93
- /** Enable automatic compaction decisions. */
93
+ /** This pass's own gate (`false` ⇒ the pass is disabled). A run resolves it for each pass from the seat of that pass —
94
+ * `TaskSpec.compaction.autoCompact` for the passes the engine starts, `manualCompact` for a requested one. */
94
95
  enabled: boolean;
95
96
  /** Tokens reserved below the context window for the TRIGGER threshold (threshold = window −
96
97
  * reserve). Historically this single knob ALSO seeded the summary legs' output budget
@@ -1621,6 +1621,7 @@ export interface CompactResult {
1621
1621
  }
1622
1622
  /** Settings that control automatic context compaction. */
1623
1623
  export interface CompactionSettings {
1624
+ /** This pass's own gate (`false` ⇒ the pass is disabled); a run resolves it per pass from the seat of that pass. */
1624
1625
  enabled: boolean;
1625
1626
  reserveTokens: number;
1626
1627
  keepRecentTokens: number;
@@ -164,9 +164,15 @@ export declare class StoredSession<TMetadata extends SessionMetadata = SessionMe
164
164
  */
165
165
  export declare function gitFrameContextVisible(branch: SessionTreeEntry[], entryId: string): boolean;
166
166
  /** What reading a session's checkout answered: none minted by this session, the one it minted (with `released` when it was
167
- * released), or a log the reader cannot vouch for — NOT "none" (a checkout that cannot be read is one the session cannot use). */
167
+ * released), or a log the reader cannot vouch for — NOT "none" (a checkout that cannot be read is one the session cannot use).
168
+ * `none` carries `window` when the storage was loaded from a bounded window (F3, `SessionStorage.getFloorId`): no record in the
169
+ * window, and one below `floor` is not ruled out. A consumer that would REMOVE something on "none" reads that as unreadable (the
170
+ * orphan doors do); a leg's open and the release read it as none. */
168
171
  export type SessionCheckoutRead = {
169
172
  readonly kind: "none";
173
+ readonly window?: {
174
+ readonly floor: string;
175
+ };
170
176
  } | {
171
177
  readonly kind: "record";
172
178
  readonly record: SessionCheckoutRecord;
@@ -398,8 +398,11 @@ export function gitFrameContextVisible(branch, entryId) {
398
398
  }
399
399
  export async function readSessionCheckout(session, sessionId) {
400
400
  let entries;
401
+ let floor;
401
402
  try {
402
- entries = await session.getStorage().findEntries("session_checkout");
403
+ const storage = session.getStorage();
404
+ entries = await storage.findEntries("session_checkout");
405
+ floor = storage.getFloorId?.() ?? null;
403
406
  }
404
407
  catch (err) {
405
408
  return { kind: "unreadable", detail: `the session log could not be read (${thrownText(err)})` };
@@ -424,7 +427,7 @@ export async function readSessionCheckout(session, sessionId) {
424
427
  allocation = shaped;
425
428
  }
426
429
  if (allocation === undefined)
427
- return releases.length === 0 ? { kind: "none" } : { kind: "unreadable", detail: "the session holds a checkout release with no allocation" };
430
+ return releases.length === 0 ? { kind: "none", ...(floor !== null ? { window: { floor } } : {}) } : { kind: "unreadable", detail: "the session holds a checkout release with no allocation" };
428
431
  if (releases.some((r) => r.allocationId !== allocation.allocationId))
429
432
  return { kind: "unreadable", detail: "a checkout release names another allocation" };
430
433
  return { kind: "record", record: releases.length > 0 ? { ...allocation, released: true } : allocation };
package/dist/index.d.ts CHANGED
@@ -90,7 +90,7 @@ export { createSessionRulePolicy } from "./core/runner/session-rule-policy.js";
90
90
  export { LOCKED_KEY_REGISTRY, resolveLockedKeys, type LockedKey, type LockedConfig } from "./core/locked-config.js";
91
91
  export { BUILTIN_COMPLIANCE_DENIES, COMPLIANCE_CAPABILITIES, WEB_FETCH_TOOL_NAME, complianceCallDenial, resolveComplianceDenies, type ComplianceCapability, type CompliancePosture, type ComplianceProfile, } from "./core/compliance.js";
92
92
  export { admitMemoryScopes, foldAdmissionFreeze, type DeploymentMemoryScopeRequest, type OwnOrgAdmissionVerdict, type MemoryAdmissionInput, type MemoryAdmissionOutcome, type MemoryAdmissionVerdict, type MemoryScopeAdmission, type MemoryScopeAdmissionInput, type MemoryScopeOrigin, type MemoryScopeRequest, } from "./core/memory-admission.js";
93
- export { assertRetentionCapability, readRetentionDeclaration, RETENTION_CASCADE_DOMAINS, RETENTION_CASCADE_EXEMPT, type ManagedRetentionCapability, type RetentionDeclaration, type RetentionDeclaring, type RetentionPolicy, type RetentionReceipt, } from "./core/retention.js";
93
+ export { assertRetentionCapability, readRetentionDeclaration, RETENTION_CASCADE, RETENTION_CASCADE_DOMAINS, RETENTION_CASCADE_EXEMPT, RETENTION_SESSION_TREE_STEPS, type ManagedRetentionCapability, type RetentionCascadeDomain, type RetentionCascadeLeg, type RetentionCascadeRow, type RetentionCascadeStores, type RetentionDeclaration, type RetentionDeclaring, type RetentionPolicy, type RetentionReceipt, } from "./core/retention.js";
94
94
  export { GOVERNANCE_CODES, governanceRetryClass, TOOL_DECLARATION_CODES, type GovernanceCode, type GovernanceRetryClass, type ToolDeclarationCode } from "./core/governance-codes.js";
95
95
  export { NOTICE_AUDIENCE, noticeAudienceOf, ENGINE_NOTICE_CODES, NOTICE_MINTER, type EngineNoticeCode, type NoticeAudience, type NoticeMinter } from "./core/governance-codes.js";
96
96
  export { TtlSessionStore, type TtlSessionStoreOptions, type EvictPolicy } from "./core/session-store.js";
@@ -121,7 +121,7 @@ export { withRetry } from "./core/with-retry.js";
121
121
  export type { RetryPolicy, RetryResult } from "./core/with-retry.js";
122
122
  export type { RemoteExecutionEnv, WorkspaceHandle, SnapshotId, SessionToken, SandboxTier, OutputChunk, ExecStreamOptions, RemoteConnectConfig, VmLifecycleOptions, SecretRef, RemoteExecutionErrorCode, ExecutionEnvFactory, ExecutionEnvFactoryContext, PlacementTarget, } from "./core/remote-env.js";
123
123
  export { addWorktree, pruneWorktrees, WORKTREE_PARENT, type AddWorktreeOptions } from "./core/git-worktree-env.js";
124
- export { probeWorktreeCapability, releaseSessionCheckout, WORKTREE_INCAPABLE_REASONS, type ReleasedTree, type WorkspaceDeclaration, type WorkspaceSourceDeclaration, type WorktreeCapability, type WorktreeIncapableReason, } from "./core/session-checkout.js";
124
+ export { listOrphanSessionTrees, probeWorktreeCapability, releaseOrphanSessionTree, releaseSessionCheckout, WORKTREE_INCAPABLE_REASONS, type OrphanSessionTree, type ReleasedTree, type WorkspaceDeclaration, type WorkspaceSourceDeclaration, type WorktreeCapability, type WorktreeIncapableReason, } from "./core/session-checkout.js";
125
125
  export { runExecGate } from "./core/exec-gate.js";
126
126
  export type { ExecStep, ExecStepResult, ExecGateResult, ExecGateOptions } from "./core/exec-gate.js";
127
127
  export { sanitizeUntrustedText, delimitUntrusted, inlineUntrusted, isMintableProbeReason } from "./core/untrusted-text.js";
@@ -239,12 +239,13 @@ export type { PermissionSeatInputs, PermissionSeatReading } from "./core/mode-po
239
239
  export type { SkillGateSeats, SkillGrantHit, SkillGrantLane, SkillGrantOrigin, SkillGrantRecord } from "./core/skill-grant.js";
240
240
  export { SKILL_GRANT_ORIGINS } from "./core/skill-grant.js";
241
241
  export type { BoundSkillGrants } from "./core/skill-grant-binding.js";
242
- export { ALLOW_ENTRY_INERT_REASONS, readRuleEntry, compileAllowList, renderListEntry, type RuleEntryReading, type AllowEntryInertReason, type AllowEntryInertDetail, type CompiledAllowEntry, type AllowEntryGateSeats, type AllowEntryLane, type AllowEntryHit, type AllowListEntry } from "./core/allow-entry.js";
242
+ export { ALLOW_ENTRY_INERT_REASONS, readRuleEntry, compileAllowList, renderListEntry, screenAllowedToolsValue, type RuleEntryReading, type AllowEntryInertReason, type AllowEntryInertDetail, type CompiledAllowEntry, type AllowEntryGateSeats, type AllowEntryLane, type AllowEntryHit, type AllowListEntry } from "./core/allow-entry.js";
243
243
  export { ALLOW_RULE_MEMBERS, type AllowRuleMember, type AllowRuleShadow } from "./core/allow-rule-shadow.js";
244
244
  export { mintNamespacePrefix } from "./core/protocol-naming.js";
245
245
  export { readDenyClassifierRules, renderClassifierDenyRules, type DerivedDenyRule } from "./core/auto-mode-prompt.js";
246
246
  export { AUTO_MODE_DENY_SOURCES, isAutoModeDenySource, type AutoModeDenySource } from "./core/runtime-caps.js";
247
247
  export { SETTLEMENT_KINDS, type SettlementKind, isSettlementKind, type Settlement, SETTLEMENT_PARTIES, type SettlementParty, isSettlementParty, HOST_DECIDERS, type HostDecider, type HostDecisionFacts, isHostDecider, DECIDED_VIA, type DecidedVia, SETTLEMENT_IS_REFUSAL, DENIED_BY_VALUES, type DeniedBy, isDeniedBy, DENIED_BY_MAY_VETO, CLASSIFIER_DENY_CAUSES, type ClassifierDenyCause, isClassifierDenyCause, DENIED_BY_MAY_CARRY_CAUSE, type GateDisposition, type GateOutcome, type ModeRelease, type ModeRefusal, screenGateOutcome, RETIRED_MEMBERS, isRetiredMember } from "./core/gate-outcome.js";
248
+ export { REFUSAL_ECHO_KINDS, type RefusalEchoKind, isRefusalEchoKind, type RefusalEcho } from "./core/refusal-echo.js";
248
249
  export { ENGINE_BUILTIN_TOOL_NAMES, isEngineBuiltinToolName } from "./core/tool-catalog-entries.js";
249
250
  export { policyCannotAnswer, type HeldQuestion } from "./core/real-approval.js";
250
251
  export { type AskCarry } from "./core/hooks.js";
@@ -277,7 +278,7 @@ export { createPermissionRulePolicy, validatePermissionRules, parsePermissionRul
277
278
  * allowed and widening is not.
278
279
  */
279
280
  export { RULE_BEHAVIORS, RULE_BEHAVIOR_PRECEDENCE, RULE_BEHAVIORS_BY_PRECEDENCE, isRuleBehavior, readRowBehavior, adjudicatePersistedRules, adjudicatePersistedPathRules, adjudicatePersistedToolRules, ruleReachesProgramRun, programRunReachOf, PROGRAM_RUN_REACHES, type ProgramRunReachOutcome, pathRuleReachOf, ruleBasesNeeded, PATH_RULE_BASES, PATH_RULE_BASE_LABEL, ruleToolGrammarOf, COMMAND_RULE_TOOL, READ_RULE_TOOL, type PathRuleBase, type PathRuleBases, type RuleBehavior, type PersistedRuleVerdict, parseRuleText, formatRuleText, ruleAdmitsCommand, findAdmittingRule, suggestRulesForCommand, scopeCoversCwd, pathWithinRoot, isRuleLive, renderUntrustedCommandText, stripFormatCharacters, UNCOVERED_SEGMENT_REASON_BASELINE, RULE_OFFERS_ABSENCE_BASELINE, type UncoveredSegmentDetail, PERSISTED_RULE_MATCHES, RULE_OFFER_KINDS, RULE_OFFER_BATCH_MEMBER_KINDS, UNCOVERED_SEGMENT_REASONS, EDITED_RULE_BREADTH_WARNING_CODES, RULE_ADD_ORIGINS, type EditedRuleBreadthWarning, directoryRuleAdmits, BARE_INTERPRETER_NAMES, MAX_RULE_TEXT_CHARS, type PersistedRule, type RuleTombstone, type RuleScope, type RuleDot, type RuleAdd, type RuleAddOrigin, type RuleOffer, type RuleOfferBatchMember, type SegmentRuleSuggestion, type SegmentCoverage, type RuleReject, type RuleRejectCode, type ParsedRule, type PersistedRuleTool, type PersistedRuleMatch, } from "./core/permission-rule-model.js";
280
- export { removePersistedRule, addPersistedRule, applyTombstones, sameScope, sameRuleIdentity, isValidConsentScope, isValidDurableScope, InMemoryDurableRulePartition, EMPTY_DURABLE_RULE_PARTITION, type DurableRulePartition, type DurableRulePartitionProvider, type RuleWriteOutcome, type StoredRules, type RemoveResult, type AddResult, type PutResult, joinRuleStates, applySyncJoin, type RuleSyncJoinBase, screenRuleSyncState, collectBelowFrontier, ruleSyncVector, joinFrontiers, dotAtOrBelowFrontier, type RuleSyncState, type RuleSyncFrontier, type RuleSyncDrop, type RuleSyncLandingReport, type QuarantinedRuleAdd, PERMISSION_RULE_WRITER, writerOf, foldDelta, addDotsOf, assertDeleteDeltaCarriesNoAdd, assertRedemptionNotQuarantined, assertWriteDeltaScopeDurable, PERMISSION_RULES_LATER_GRAMMAR_CODE, type PermissionRuleWriter, type WritableDurableRulePartition, type RuleWriteDelta, type RuleAddDelta, type RuleTightenAddDelta, type RuleDeleteDelta, type RuleSyncJoinDelta, type RawRuleSyncState, type RedemptionAuthorization, } from "./core/permission-rule-store.js";
281
+ export { removePersistedRule, addPersistedRule, applyTombstones, sameScope, sameRuleIdentity, isValidConsentScope, isValidDurableScope, InMemoryDurableRulePartition, EMPTY_DURABLE_RULE_PARTITION, type DurableRulePartition, type DurableRulePartitionProvider, type RuleWriteOutcome, type StoredRules, type RemoveResult, type AddResult, type PutResult, joinRuleStates, applySyncJoin, type RuleSyncJoinBase, screenRuleSyncState, collectBelowFrontier, ruleSyncVector, joinFrontiers, dotAtOrBelowFrontier, type RuleSyncState, type RuleSyncFrontier, type RuleSyncDrop, type RuleSyncLandingReport, type QuarantinedRuleAdd, PERMISSION_RULE_WRITER, writerOf, foldDelta, addDotsOf, assertDeleteDeltaCarriesNoAdd, assertRedemptionNotQuarantined, assertWriteDeltaScopeDurable, PERMISSION_RULES_LATER_GRAMMAR_CODE, PERMISSION_RULES_DAMAGED_BUCKET_CODE, PERMISSION_RULES_UNREADABLE_BUCKET_CODE, type PermissionRuleWriter, type WritableDurableRulePartition, type RuleWriteDelta, type RuleAddDelta, type RuleTightenAddDelta, type RuleDeleteDelta, type RuleSyncJoinDelta, type RawRuleSyncState, type RedemptionAuthorization, } from "./core/permission-rule-store.js";
281
282
  export { readRuleOwner, sameRuleOwner, type RuleOwner, RULE_OWNER_KINDS, } from "./core/rule-owner.js";
282
283
  export { principalNameOf } from "./core/principal-name.js";
283
284
  export { syncPermissionRules, parseRuleSyncResponse, PERMISSION_RULE_SYNC_PATH, LOCAL_OWNER_UNSYNCABLE_CODE, type PermissionRuleSyncTransport, type PermissionRuleSyncResult, type RuleSyncRequestBody, type RuleSyncResponseBody, } from "./core/permission-rule-sync.js";
@@ -305,7 +306,7 @@ export { SESSION_SEND_ORIGIN_KINDS, type SessionSendOrigin } from "./core/mods/s
305
306
  export { loadModPackage, type ModPackageHost, type ModPackageRegistration } from "./core/mods/package.js";
306
307
  export { CREDENTIAL_REF_KINDS, CREDENTIAL_REF_TRUST, CREDENTIAL_REF_TEXT_MAX, CREDENTIAL_REF_MAP_MAX, CREDENTIAL_REF_PROBLEM_REASONS, readCredentialRef, type CredentialRef, type CredentialRefKind, type CredentialRefRequestAdmission, type CredentialRefProblem, type CredentialRefProblemReason, type CredentialRefReading, } from "@sema-agent/primitives";
307
308
  export { InMemoryMemoryStore, composeMemoryBlock, composeLayeredMemoryBlock, normalizeMemorySpec, type NormalizedMemorySpec, type MemorySpecInput, supportsConsolidation, supportsPeriodicConsolidation, firstSentence, expandLexicalTerms, lexicalSearchMatch, type Embedder, classifyPromotable, enforcePromotableWriteGate, guardedMemoryStore, MemoryGateError, MemoryProjectionError, detectSecret, enforceSecretWriteGate, enforceStructuredNoteSecretGate, type UtilityGate, type MemoryVectorMode, type ScoredMemory, type MemoryNoteHeader, type MemoryNoteRecord, type MemoryNoteType, type StructuredNoteInput, MEMORY_PROJECT_KEY_ABSENT_REASONS, type MemoryProjectKeyAbsentReason, type MemoryProjectKey, } from "./core/memory.js";
308
- export { MemoryEngine, FileMemoryEngineBackend, readMemoryLedgerForm, memoryBackendContract, assertMemoryBackendSearchEquivalence, type MemoryBackendContractHooks, memoryGovernanceStoreContract, type MemoryGovernanceStoreContractHooks, buildMemoryInstruction, writableRootOf, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_ORIGIN_CAUSES, committedOriginOf, originEquals, consolidationExposedFrontmatter, ambiguousOriginRepresentation, type OriginClearanceRow, type OriginClearanceEvent, type OriginClearanceShadow, committedDistilledOf, distilledEquals, type MemoryEntryDistilled, type MemoryEntryDistilledInput, CONSOLIDATION_DEFAULTS, ConsolidationRefusedError, MEMORY_SEARCH_SUPERSEDED_TAG, consolidationTypeEligible, deriveSupersededSet, memorySupersededNote, supersessionFuseCeiling, DELETION_FUSE_FLOOR, fileGovernanceStore, memoryGovernanceDurability, type MemoryGovernanceDurability, deriveShadowedSet, memoryConsolidationRecommendedNotice, memoryConsolidationCommittedNotice, memoryConsolidationConflictNotice, memoryConsolidationIncompleteNotice, memoryConsolidationRefusedNotice, memoryConsolidationWithheldNotice, type ConsolidationGateRead, type ConsolidationGateRow, type ConsolidationIntent, type ConsolidationIntentCredentialRow, type ConsolidationLeaseSeat, type ConsolidationProductProposal, type ConsolidationProposal, type ConsolidationWriteGate, type MemoryConsolidationOptions, type ConsolidationCommitReceipt, type ConsolidationReconcileReport, type ConsolidationResolveReceipt, type ConsolidationPlanSummary, type ConsolidationPlanFoldEvidence, type SessionMemoryStatus, DISTILLER_DEFAULT_MAX_INPUTS_PER_PRODUCT, LLM_DISTILLER_CONTRACT, LLM_DISTILLER_CONTRACT_DL2, LLM_DISTILLER_CONTRACT_DL3, LLM_DISTILLER_CONTRACTS, MEMORY_DISTILLER_CONTRACT_V1, contractGroupingDiff, driveConsolidationToFixpoint, isAliasModelId, llmPlanDistiller, mintExposurePartitionedPlan, mintLlmConsolidationPlan, MEMORY_DISTILLER_PURITY_CONTRACT_V1, detectCleanArmVerbatimLeak, type CleanArmLeakFinding, type CleanArmLeakVerdict, type MemoryDistillerPurityContract, openAiCompatChatSeat, parseJsonAnswer, planParseRepairs, sanitizeLlmGroups, scheduleUnderFuse, type ConsolidationDistillFn, type ConsolidationDriveCycleRow, type ConsolidationDriveEngine, type ConsolidationDriveResult, type ConsolidationFoldState, type DistillerCandidate, type DistillerChatAnswer, type DistillerChatFn, type DistillerChatRequest, type FuseSchedule, type LlmConsolidationPlan, type LlmConsolidationPlanArm, type LlmConsolidationPlanProduct, type LlmDistillerContract, type MintLlmConsolidationPlanResult, type PlanParseRepairs, type SanitizedLlmGroups, CONSOLIDATION_RUN_STOP_REASONS, CONSOLIDATION_WRITE_REFUSED_CODE, runMemoryConsolidationDriver, type ConsolidationDriverEngine, type ConsolidationDriverRunRow, type ConsolidationRunReceipt, type ConsolidationRunStopReason, type ConsolidationWriteJudge, type ConsolidationWriteTarget, type RunMemoryConsolidationOptions, isInstructionEntry, type MemoryEntryOrigin, type MemoryOriginCause, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_RECALL_DISCIPLINE, MEMORY_PREFERENCE_DISCIPLINE, MEMORY_READONLY_NOTICE, MEMORY_CAPTURE_OPTOUT_NOTICE, memoryCaptureOptedOutNotice, memoryCaptureOptOutUnpersistedNotice, SESSION_CAPTURE_OPTOUT_DIR, markSessionCaptureOptOut, readSessionCaptureOptOut, listSessionCaptureOptOut, fileSessionCaptureRecordStore, type SessionCaptureOptOutRecord, type SessionCaptureOptOutMarkOutcome, type SessionCaptureRecordStore, readV2HeaderHints, type V2HeaderHints, LINEAGE_FILE, CHALLENGES_FILE, CHALLENGED_HISTORY_FILE, CHALLENGE_LEDGER_MAX_EVENTS, rebuildStrictControlPlaneLedger, type ControlPlaneRebuildReceipt, type StrictControlPlaneLedger, type ChallengeAssignment, type ChallengeEvent, type ChallengedHistoryRow, type LineagePendingTxn, type LineagePromotion, MEMORY_INDEX_FILENAME, MEMORY_INDEX_MAX_LINES, MEMORY_INDEX_MAX_BYTES, MEMORY_SEARCH_TOOL_NAME, MEMORY_GET_TOOL_NAME, MEMORY_INDEX_TOOL_NAME, MEMORY_ENGINE_TOOL_NAMES, type MemorySearchDetails, type MemorySearchHit, type CleanMemorySearchHit, type ExposedMemorySearchHit, MEMORY_EXPOSURE_BANNER, MEMORY_EXPOSURE_HANDLE_TAG, memoryExposureIndexRow, type MemoryGetDetails, type MemoryIndexDetails, type MemoryIndexRow, type CleanMemoryIndexRow, type ExposedMemoryIndexRow, STUB_ARCHIVED_LINE, DEFAULT_MAX_MEMORY_FILES, DEFAULT_MAX_ENTRY_DEPTH, DEFAULT_HARVEST_DEADLINE_MS, DEFAULT_HARVEST_FILE_BUDGET, MASS_DELETION_FUSE_RATIO, scanMemoryWrite, scanMemoryFileName, scanRemediation, MEMORY_FILENAME_SEGMENT_RE, renderAnnouncements, enqueueMemoryAnnouncement, drainMemoryAnnouncements, peekMemoryAnnouncements, bumpScanFuse, scanFuseCount, clearScanFuse, ANNOUNCEMENTS_FILE, MEMORY_ANNOUNCEMENTS_MAX, SCAN_FUSE_FILE, SCAN_FUSE_THRESHOLD, type MemoryAnnouncement, type ScanFinding, type MemoryEngineOptions, type MemoryInjection, type EntryProvenanceAccount, type TransferEvidence, type CommittedBinding, type CommittedEntrySnapshot, type CommittedScopeSnapshots, type EntryCustodyReport, erasureSelectHash, type EraseMemoryEntriesInput, type ErasureCarrierAnswer, type ErasureCarrierClass, type ErasureCountAnswer, type ErasureSelect, type ErasedBinding, type MemoryErasureAttestation, computeMemoryBundleHash, type MemoryExportBundle, type MemoryImportReport, type MemoryExportSnapshot, type MemoryBundleImportPlan, type BundleChallengeRow, type BundleLineageRow, type BundlePollutedSession, type MemoryBackend, type MemoryGovernanceStore, MEMORY_GOVERNANCE_DOC_NAMES, type MemoryGovernanceDocName, type MemoryGovernanceDocs, type ConsolidationTx, type MemoryEntry, type MemoryEntryFrontmatter, type MemoryEntryHeader, type MemoryScopeEnumeration, type ScoredMemoryEntry, type NotePatch, type PatchReport, type MaterializedFile, type MemorySessionHandle, type HarvestReport, type HarvestRejection, type HarvestRejectionCode, type ParsedEntryFile, type ScannedEntryFile, SCOPE_SEGMENT_MAX_ENCODED, PROJECT_MARKER_PATH, encodeScopeSegment, decodeScopeSegment, parseScopeKey, formatUserScope, formatUserLocalScope, formatOrgScope, formatProjScope, formatUserProjScope, isPersonalScope, isReplicableScope, isOrgScopeKey, assertScopeContractPlacement, formatProjectMarker, parseProjectMarker, resolveProjectId, PROJECT_ID_REGEX, type ParsedScopeKey, migrateScope, type MigrateScopeReport, materializeEntriesToFiles, harvestFilesToPatches, projectionsToWriteBack, screenInboundEntries, REMOTE_HARVEST_PER_FILE_BYTES, REMOTE_MASS_DELETION_FUSE_RATIO, type RemoteMemoryFile, type RemoteMemoryBaseline, type RemoteMaterialization, type RemoteHarvestResult, type InboundEntryFinding, deriveProjectMemoryDir, deriveProjectControlDir, recordProjectIdHint, lookupProjectIdHint, PROJECT_ID_HINTS_FILE, reconcileMemoryEntries, nextSyncBaseline, mergeRecallHits, type MemorySyncCursor, type MemorySyncConflict, type MemorySyncPlan, type RecallSource, syncMemoryScope, memorySyncStoreOf, carriesCredential, type MemorySyncTransport, type MemorySyncRequestBody, type MemorySyncResponseBody, type MemorySyncClientConflict, type SyncMemoryScopeOptions, type MemorySyncClientResult, memorySyncReportOf, memoryTravelGapOf, type MemorySyncLayerReport, type MemorySyncRoundReport, } from "./core/memory-engine/index.js";
309
+ export { MemoryEngine, FileMemoryEngineBackend, readMemoryLedgerForm, memoryBackendContract, assertMemoryBackendSearchEquivalence, type MemoryBackendContractHooks, memoryGovernanceStoreContract, type MemoryGovernanceStoreContractHooks, buildMemoryInstruction, writableRootOf, truncateIndex, scanEntryFiles, deriveRepoKey, deriveRepoMemoryDir, deriveControlPlaneDir, deriveRepoControlPlaneDir, resolveMemoryEngineRoot, scopeDirName, ControlPlaneCorruptError, parseEntryFile, serializeEntryFile, computeEntryRev, entryFromFile, MEMORY_ORIGIN_CAUSES, committedOriginOf, originEquals, consolidationExposedFrontmatter, ambiguousOriginRepresentation, type OriginClearanceRow, type OriginClearanceEvent, type OriginClearanceShadow, committedDistilledOf, distilledEquals, type MemoryEntryDistilled, type MemoryEntryDistilledInput, CONSOLIDATION_DEFAULTS, ConsolidationRefusedError, MEMORY_SEARCH_SUPERSEDED_TAG, consolidationTypeEligible, deriveSupersededSet, memorySupersededNote, supersessionFuseCeiling, DELETION_FUSE_FLOOR, fileGovernanceStore, memoryGovernanceDurability, type MemoryGovernanceDurability, deriveShadowedSet, memoryConsolidationRecommendedNotice, memoryConsolidationCommittedNotice, memoryConsolidationConflictNotice, memoryConsolidationIncompleteNotice, memoryConsolidationRefusedNotice, memoryConsolidationWithheldNotice, type ConsolidationGateRead, type ConsolidationGateRow, type ConsolidationIntent, type ConsolidationIntentCredentialRow, type ConsolidationLeaseSeat, type ConsolidationProductProposal, type ConsolidationProposal, type ConsolidationWriteGate, type MemoryConsolidationOptions, type ConsolidationCommitReceipt, type ConsolidationReconcileReport, type ConsolidationResolveReceipt, type ConsolidationPlanSummary, type ConsolidationPlanFoldEvidence, type SessionMemoryStatus, DISTILLER_DEFAULT_MAX_INPUTS_PER_PRODUCT, LLM_DISTILLER_CONTRACT, LLM_DISTILLER_CONTRACT_DL2, LLM_DISTILLER_CONTRACT_DL3, LLM_DISTILLER_CONTRACTS, MEMORY_DISTILLER_CONTRACT_V1, contractGroupingDiff, driveConsolidationToFixpoint, isAliasModelId, llmPlanDistiller, mintExposurePartitionedPlan, mintLlmConsolidationPlan, MEMORY_DISTILLER_PURITY_CONTRACT_V1, detectCleanArmVerbatimLeak, type CleanArmLeakFinding, type CleanArmLeakVerdict, type MemoryDistillerPurityContract, openAiCompatChatSeat, parseJsonAnswer, planParseRepairs, sanitizeLlmGroups, scheduleUnderFuse, type ConsolidationDistillFn, type ConsolidationDriveCycleRow, type ConsolidationDriveEngine, type ConsolidationDriveResult, type ConsolidationFoldState, type DistillerCandidate, type DistillerChatAnswer, type DistillerChatFn, type DistillerChatRequest, type FuseSchedule, type LlmConsolidationPlan, type LlmConsolidationPlanArm, type LlmConsolidationPlanProduct, type LlmDistillerContract, type MintLlmConsolidationPlanResult, type PlanParseRepairs, type SanitizedLlmGroups, CONSOLIDATION_RUN_STOP_REASONS, CONSOLIDATION_WRITE_REFUSED_CODE, runMemoryConsolidationDriver, type ConsolidationDriverEngine, type ConsolidationDriverRunRow, type ConsolidationRunReceipt, type ConsolidationRunStopReason, type ConsolidationWriteJudge, type ConsolidationWriteTarget, type RunMemoryConsolidationOptions, isInstructionEntry, type MemoryEntryOrigin, type MemoryOriginCause, MEMORY_INSTRUCTION_TEMPLATE, MEMORY_RECALL_DISCIPLINE, MEMORY_PREFERENCE_DISCIPLINE, MEMORY_READONLY_NOTICE, MEMORY_CAPTURE_OPTOUT_NOTICE, memoryCaptureOptedOutNotice, memoryCaptureOptOutUnpersistedNotice, SESSION_CAPTURE_OPTOUT_DIR, markSessionCaptureOptOut, readSessionCaptureOptOut, listSessionCaptureOptOut, fileSessionCaptureRecordStore, type SessionCaptureOptOutRecord, type SessionCaptureOptOutMarkOutcome, type SessionCaptureRecordStore, readV2HeaderHints, type V2HeaderHints, LINEAGE_FILE, CHALLENGES_FILE, CHALLENGED_HISTORY_FILE, CHALLENGE_LEDGER_MAX_EVENTS, rebuildStrictControlPlaneLedger, type ControlPlaneRebuildReceipt, type StrictControlPlaneLedger, type ChallengeAssignment, type ChallengeEvent, type ChallengedHistoryRow, type LineagePendingTxn, type LineagePromotion, MEMORY_INDEX_FILENAME, MEMORY_INDEX_MAX_LINES, MEMORY_INDEX_MAX_BYTES, MEMORY_SEARCH_TOOL_NAME, MEMORY_GET_TOOL_NAME, MEMORY_INDEX_TOOL_NAME, MEMORY_ENGINE_TOOL_NAMES, type MemorySearchDetails, type MemorySearchHit, type CleanMemorySearchHit, type ExposedMemorySearchHit, MEMORY_EXPOSURE_BANNER, MEMORY_EXPOSURE_HANDLE_TAG, memoryExposureIndexRow, type MemoryGetDetails, type MemoryIndexDetails, type MemoryIndexRow, type CleanMemoryIndexRow, type ExposedMemoryIndexRow, STUB_ARCHIVED_LINE, DEFAULT_MAX_MEMORY_FILES, DEFAULT_MAX_ENTRY_DEPTH, DEFAULT_HARVEST_DEADLINE_MS, DEFAULT_HARVEST_FILE_BUDGET, MASS_DELETION_FUSE_RATIO, scanMemoryWrite, scanMemoryFileName, scanRemediation, MEMORY_FILENAME_SEGMENT_RE, renderAnnouncements, enqueueMemoryAnnouncement, drainMemoryAnnouncements, peekMemoryAnnouncements, bumpScanFuse, scanFuseCount, clearScanFuse, ANNOUNCEMENTS_FILE, MEMORY_ANNOUNCEMENTS_MAX, SCAN_FUSE_FILE, SCAN_FUSE_THRESHOLD, type MemoryAnnouncement, type ScanFinding, type MemoryEngineOptions, type MemoryInjection, type EntryProvenanceAccount, type TransferEvidence, type CommittedBinding, type CommittedEntrySnapshot, type CommittedScopeSnapshots, type EntryCustodyReport, erasureSelectHash, type EraseMemoryEntriesInput, type ErasureCarrierAnswer, type ErasureCarrierClass, type ErasureCountAnswer, type ErasureSelect, type ErasedBinding, type MemoryErasureAttestation, computeMemoryBundleHash, type MemoryExportBundle, type MemoryImportReport, type MemoryExportSnapshot, type MemoryBundleImportPlan, type BundleChallengeRow, type BundleLineageRow, type BundlePollutedSession, type MemoryBackend, type MemoryGovernanceStore, MEMORY_GOVERNANCE_DOC_NAMES, type MemoryGovernanceDocName, MEMORY_CONTROL_OBJECT_KINDS, type MemoryControlObjectKind, adoptReplicaControlPlane, replicaControlPlaneStrays, type ControlPlaneAdoptionReport, type ReplicaControlPlaneStrays, type MemoryGovernanceDocs, type ConsolidationTx, type MemoryEntry, type MemoryEntryFrontmatter, type MemoryEntryHeader, type MemoryScopeEnumeration, type ScoredMemoryEntry, type NotePatch, type PatchReport, type MaterializedFile, type MemorySessionHandle, type HarvestReport, type HarvestRejection, type HarvestRejectionCode, type ParsedEntryFile, type ScannedEntryFile, SCOPE_SEGMENT_MAX_ENCODED, PROJECT_MARKER_PATH, encodeScopeSegment, decodeScopeSegment, parseScopeKey, formatUserScope, formatUserLocalScope, formatOrgScope, formatProjScope, formatUserProjScope, isPersonalScope, isReplicableScope, isOrgScopeKey, assertScopeContractPlacement, formatProjectMarker, parseProjectMarker, resolveProjectId, PROJECT_ID_REGEX, type ParsedScopeKey, migrateScope, type MigrateScopeReport, materializeEntriesToFiles, harvestFilesToPatches, projectionsToWriteBack, screenInboundEntries, REMOTE_HARVEST_PER_FILE_BYTES, REMOTE_MASS_DELETION_FUSE_RATIO, type RemoteMemoryFile, type RemoteMemoryBaseline, type RemoteMaterialization, type RemoteHarvestResult, type InboundEntryFinding, deriveProjectMemoryDir, deriveProjectControlDir, recordProjectIdHint, lookupProjectIdHint, PROJECT_ID_HINTS_FILE, reconcileMemoryEntries, nextSyncBaseline, mergeRecallHits, type MemorySyncCursor, type MemorySyncConflict, type MemorySyncPlan, type RecallSource, syncMemoryScope, memorySyncStoreOf, carriesCredential, type MemorySyncTransport, type MemorySyncRequestBody, type MemorySyncResponseBody, type MemorySyncClientConflict, type SyncMemoryScopeOptions, type MemorySyncClientResult, memorySyncReportOf, memoryTravelGapOf, type MemorySyncLayerReport, type MemorySyncRoundReport, } from "./core/memory-engine/index.js";
309
310
  export { createConsolidationWriteJudge, deliverWriteRefusal, type ConsolidationWriteJudgeInput } from "./core/runner/memory-consolidation-write-judge.js";
310
311
  export { STORE_FORM_REFUSAL_CODES, TARGET_OUTSIDE_STORE, SCOPE_HOME_NOT_DIRECTORY, SCOPE_HOME_FORMS, type StoreFormRefusalCode, type StoreFormRefusalDetail, type StoreFormRefusal, type ScopeHomeForm } from "./core/memory-engine/layout.js";
311
312
  export { resolveMemoryScopeStore, type MemoryScopeStore, type MemoryScopeStoreInput } from "./core/memory-engine/dual-root.js";
@@ -321,6 +322,7 @@ export { termSet, jaccardDistance, cosineDistance } from "./core/memory-vector.j
321
322
  export { encodeSurfacedKey, buildManifestText, validateSelectedIds, composeSelectiveBody, formatMemoryAge, resolveLinkedIds, RECALL_CAVEAT, DEFAULT_MAX_SELECTED, DEFAULT_MAX_LINKED, type MemorySelector, type MemorySelectRequest, type SelectiveRecallOptions, type SelectiveRecallResult, type LayeredRecallOptions, type LayeredRecallResult, } from "./core/memory-recall.js";
322
323
  export { resolveMemoryConsolidationDriver, autoRunOnRecommendationEffective, // the ONE arming reading (`memory.auto_consolidation.arming_has_one_resolver`) — the seat's absence is not "off"
323
324
  type MemoryConsolidationDriverDeps, } from "./core/runner/memory-consolidation-driver.js";
325
+ export { ROLE_RESOLUTION_TABLE, modelFaceResolvable, type ModelFace, type ModelFaceOptions, type ModelFaceTask, type ModelFaceVerdict, type RoleResolutionAbsence, type RoleResolutionRow, type RoleResolutionWhen, } from "./core/runner/role-resolution-table.js";
324
326
  export { teardownLegBudget } from "./core/runner/teardown-bounded.js";
325
327
  export { DEFAULT_COMPACTION_INSTRUCTIONS } from "./core/auto-compaction.js";
326
328
  export { DEFAULT_SYSTEM_PROMPT, CODE_AGENT_PROMPT, SUBAGENT_PROMPT, MEMORY_SAFETY, MEMORY_HYGIENE, OUTPUT_EFFICIENCY, CYBER_RISK, HARNESS_SECTION_ANCHOR, URL_SAFETY, SUMMARIZE_TOOL_RESULTS, EXECUTION_ENVIRONMENT, EXECUTION_ENVIRONMENT_OPEN_READS, executionEnvironmentBlockFor, buildEnvironmentContext, buildGitSnapshot, buildScratchpadSection, GIT_STATUS_MAX_CHARS, formatLocalDate, type EnvironmentFacts, type PromptBlock, } from "./prompts/default.js";