@sema-agent/core 7.69.0 → 7.69.1

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 (309) hide show
  1. package/CHANGELOG.md +583 -0
  2. package/dist/agents/repair-loop.js +6 -14
  3. package/dist/agents/subagent.js +2 -1
  4. package/dist/agents/verify.d.ts +1 -1
  5. package/dist/agents/verify.js +7 -1
  6. package/dist/brain/reasoning-request.d.ts +7 -0
  7. package/dist/brain/reasoning-request.js +6 -0
  8. package/dist/core/agent-config-dir.d.ts +39 -3
  9. package/dist/core/agent-config-dir.js +67 -11
  10. package/dist/core/allow-entry.d.ts +5 -5
  11. package/dist/core/allow-entry.js +12 -6
  12. package/dist/core/ask-headline.d.ts +2 -2
  13. package/dist/core/ask-origin.d.ts +31 -31
  14. package/dist/core/ask-origin.js +20 -13
  15. package/dist/core/attachment-source.d.ts +1 -1
  16. package/dist/core/attachment-source.js +1 -0
  17. package/dist/core/auto-compaction.d.ts +44 -62
  18. package/dist/core/auto-compaction.js +44 -103
  19. package/dist/core/cache-break-detector.d.ts +23 -11
  20. package/dist/core/cache-break-detector.js +11 -5
  21. package/dist/core/checkpoint-features.d.ts +1 -1
  22. package/dist/core/checkpoint-features.js +1 -1
  23. package/dist/core/checkpoint-requirements.d.ts +19 -1
  24. package/dist/core/checkpoint-requirements.js +6 -0
  25. package/dist/core/checkpoint-row-verdict.js +3 -0
  26. package/dist/core/checkpoint-store.d.ts +13 -2
  27. package/dist/core/child-clamp-seats.d.ts +30 -3
  28. package/dist/core/child-clamp-seats.js +24 -0
  29. package/dist/core/compaction-retired-members.d.ts +12 -0
  30. package/dist/core/compaction-retired-members.js +22 -0
  31. package/dist/core/config-refusal-codes.d.ts +1 -1
  32. package/dist/core/config-refusal-codes.js +2 -0
  33. package/dist/core/context-edit.d.ts +32 -17
  34. package/dist/core/context-edit.js +28 -0
  35. package/dist/core/cron.d.ts +68 -0
  36. package/dist/core/cron.js +259 -0
  37. package/dist/core/engine-attestation.d.ts +16 -0
  38. package/dist/core/engine-attestation.js +2 -0
  39. package/dist/core/engine-capabilities.d.ts +14 -1
  40. package/dist/core/engine-capabilities.js +1 -1
  41. package/dist/core/engine-notice.d.ts +18 -7
  42. package/dist/core/engine-version.js +1 -1
  43. package/dist/core/gate-outcome.d.ts +29 -2
  44. package/dist/core/gate-outcome.js +6 -0
  45. package/dist/core/git-read-only.d.ts +10 -0
  46. package/dist/core/git-read-only.js +1 -0
  47. package/dist/core/git-worktree-env.js +9 -8
  48. package/dist/core/governance-codes.d.ts +9 -2
  49. package/dist/core/governance-codes.js +9 -0
  50. package/dist/core/locked-config.js +7 -3
  51. package/dist/core/lsp.d.ts +3 -0
  52. package/dist/core/lsp.js +3 -2
  53. package/dist/core/memory-engine/engine.d.ts +48 -12
  54. package/dist/core/memory-engine/engine.js +108 -46
  55. package/dist/core/memory-engine/file-backend.d.ts +2 -1
  56. package/dist/core/memory-engine/index-copies.d.ts +47 -0
  57. package/dist/core/memory-engine/index-copies.js +88 -0
  58. package/dist/core/memory-engine/layout.d.ts +20 -3
  59. package/dist/core/memory-engine/layout.js +39 -3
  60. package/dist/core/memory-engine/origin-clearance.d.ts +9 -7
  61. package/dist/core/memory-engine/origin-clearance.js +2 -4
  62. package/dist/core/memory-engine/types.d.ts +16 -3
  63. package/dist/core/mode-policy.d.ts +7 -1
  64. package/dist/core/mode-policy.js +9 -0
  65. package/dist/core/mods/session-compact.js +3 -3
  66. package/dist/core/mods/stations.d.ts +2 -0
  67. package/dist/core/mods/stations.js +2 -1
  68. package/dist/core/path-guard-rows.d.ts +8 -3
  69. package/dist/core/path-guard-rows.js +18 -5
  70. package/dist/core/peer-seat.d.ts +3 -0
  71. package/dist/core/peer-seat.js +3 -0
  72. package/dist/core/permission-rule-model.js +3 -2
  73. package/dist/core/process-identity.d.ts +11 -3
  74. package/dist/core/process-identity.js +26 -16
  75. package/dist/core/runner/assemble-result.d.ts +5 -0
  76. package/dist/core/runner/assemble-result.js +1 -1
  77. package/dist/core/runner/cleared-results-record.d.ts +33 -0
  78. package/dist/core/runner/cleared-results-record.js +56 -0
  79. package/dist/core/runner/compact-session.js +14 -9
  80. package/dist/core/runner/compaction-knobs.d.ts +1 -1
  81. package/dist/core/runner/continuation-gate.js +2 -1
  82. package/dist/core/runner/continues-from.d.ts +1 -1
  83. package/dist/core/runner/continues-from.js +1 -1
  84. package/dist/core/runner/contracts.d.ts +83 -31
  85. package/dist/core/runner/conversation-segment.d.ts +19 -12
  86. package/dist/core/runner/conversation-segment.js +27 -7
  87. package/dist/core/runner/derived-route-fallback.d.ts +2 -12
  88. package/dist/core/runner/derived-route-fallback.js +0 -6
  89. package/dist/core/runner/gate-exit.d.ts +2 -1
  90. package/dist/core/runner/gate-exit.js +4 -2
  91. package/dist/core/runner/git-status-frame.d.ts +2 -2
  92. package/dist/core/runner/git-status-frame.js +2 -1
  93. package/dist/core/runner/initial-run-state.js +1 -1
  94. package/dist/core/runner/leg-caller-places.d.ts +39 -0
  95. package/dist/core/runner/leg-caller-places.js +23 -0
  96. package/dist/core/runner/leg-frame.d.ts +8 -2
  97. package/dist/core/runner/leg-receipt.d.ts +29 -2
  98. package/dist/core/runner/leg-receipt.js +37 -6
  99. package/dist/core/runner/media-removed-seat.d.ts +10 -6
  100. package/dist/core/runner/media-removed-seat.js +6 -3
  101. package/dist/core/runner/messages-omitted-seat.d.ts +2 -1
  102. package/dist/core/runner/messages-omitted-seat.js +15 -5
  103. package/dist/core/runner/person-path-rows.d.ts +25 -7
  104. package/dist/core/runner/person-path-rows.js +16 -2
  105. package/dist/core/runner/prefix-ledger.d.ts +120 -0
  106. package/dist/core/runner/prefix-ledger.js +176 -0
  107. package/dist/core/runner/prepare-advisor.d.ts +2 -0
  108. package/dist/core/runner/prepare-advisor.js +2 -1
  109. package/dist/core/runner/prepare-artifact.d.ts +3 -0
  110. package/dist/core/runner/prepare-artifact.js +2 -2
  111. package/dist/core/runner/prepare-caps-and-workflow.d.ts +2 -0
  112. package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
  113. package/dist/core/runner/prepare-config-doors.d.ts +9 -8
  114. package/dist/core/runner/prepare-config-doors.js +15 -12
  115. package/dist/core/runner/prepare-context-lane.d.ts +25 -6
  116. package/dist/core/runner/prepare-context-lane.js +82 -27
  117. package/dist/core/runner/prepare-gate-stations.d.ts +1 -2
  118. package/dist/core/runner/prepare-gate-stations.js +2 -4
  119. package/dist/core/runner/prepare-hands-readface.d.ts +18 -5
  120. package/dist/core/runner/prepare-hands-readface.js +41 -22
  121. package/dist/core/runner/prepare-inherited-gate.d.ts +5 -0
  122. package/dist/core/runner/prepare-inherited-gate.js +2 -0
  123. package/dist/core/runner/prepare-memory.d.ts +10 -2
  124. package/dist/core/runner/prepare-memory.js +51 -5
  125. package/dist/core/runner/prepare-policy-chain.d.ts +3 -0
  126. package/dist/core/runner/prepare-policy-chain.js +13 -2
  127. package/dist/core/runner/prepare-prompt-assembly.d.ts +12 -4
  128. package/dist/core/runner/prepare-prompt-assembly.js +10 -4
  129. package/dist/core/runner/prepare-prompt-inputs.d.ts +3 -7
  130. package/dist/core/runner/prepare-prompt-inputs.js +6 -7
  131. package/dist/core/runner/prepare-safety-scan.js +7 -0
  132. package/dist/core/runner/prepare-suspend-saga.d.ts +4 -0
  133. package/dist/core/runner/prepare-suspend-saga.js +3 -2
  134. package/dist/core/runner/prepare-task.js +59 -53
  135. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +5 -11
  136. package/dist/core/runner/prepare-tool-disclosure-mount.js +7 -8
  137. package/dist/core/runner/prepare-turn-wiring.d.ts +16 -25
  138. package/dist/core/runner/prepare-turn-wiring.js +8 -18
  139. package/dist/core/runner/prepare-wiring-manifest.d.ts +1 -0
  140. package/dist/core/runner/prepare-wiring-manifest.js +3 -2
  141. package/dist/core/runner/prompt-suggestions.d.ts +3 -1
  142. package/dist/core/runner/prompt-suggestions.js +1 -1
  143. package/dist/core/runner/read-block-judge.d.ts +47 -0
  144. package/dist/core/runner/read-block-judge.js +33 -0
  145. package/dist/core/runner/role-resolution-table.d.ts +15 -10
  146. package/dist/core/runner/role-resolution-table.js +4 -5
  147. package/dist/core/runner/rule-store-unreadable-notice.d.ts +7 -4
  148. package/dist/core/runner/rule-store-unreadable-notice.js +4 -3
  149. package/dist/core/runner/run-compaction-machinery.d.ts +0 -10
  150. package/dist/core/runner/run-compaction-machinery.js +3 -39
  151. package/dist/core/runner/run-harness-handlers.js +4 -17
  152. package/dist/core/runner/run-identity-wiring.js +4 -1
  153. package/dist/core/runner/run-leg.js +11 -1
  154. package/dist/core/runner/run-recovery-lanes.d.ts +0 -4
  155. package/dist/core/runner/run-recovery-lanes.js +34 -18
  156. package/dist/core/runner/run-settle-and-teardown.d.ts +1 -3
  157. package/dist/core/runner/run-settle-and-teardown.js +14 -22
  158. package/dist/core/runner/run-telemetry-and-budget-seats.js +0 -1
  159. package/dist/core/runner/run-terminal-adoption.d.ts +11 -30
  160. package/dist/core/runner/run-terminal-adoption.js +5 -88
  161. package/dist/core/runner/run-tool-mount-facts.js +1 -5
  162. package/dist/core/runner/run-turn-boundary.js +56 -26
  163. package/dist/core/runner/runtask.js +7 -7
  164. package/dist/core/runner/session-hash-salt.d.ts +18 -0
  165. package/dist/core/runner/session-hash-salt.js +36 -0
  166. package/dist/core/runner/shell-env-withheld.d.ts +8 -5
  167. package/dist/core/runner/shell-env-withheld.js +3 -3
  168. package/dist/core/runner/side-call-account.d.ts +9 -1
  169. package/dist/core/runner/side-call-account.js +15 -4
  170. package/dist/core/runner/skill-mention.d.ts +12 -0
  171. package/dist/core/runner/skill-mention.js +50 -0
  172. package/dist/core/runner/stream-settle-backstop.js +1 -0
  173. package/dist/core/runner/synthetic-tools.js +2 -2
  174. package/dist/core/runner/tool-table-view.d.ts +5 -9
  175. package/dist/core/runner/tool-table-view.js +23 -21
  176. package/dist/core/runner/write-protection-station.d.ts +5 -2
  177. package/dist/core/runner/write-protection-station.js +1 -1
  178. package/dist/core/runner-deps.d.ts +25 -27
  179. package/dist/core/scheduler.d.ts +13 -3
  180. package/dist/core/scheduler.js +0 -12
  181. package/dist/core/secret-env.d.ts +47 -11
  182. package/dist/core/secret-env.js +65 -4
  183. package/dist/core/sensitive-path-policy.js +4 -0
  184. package/dist/core/session-checkout.js +10 -9
  185. package/dist/core/shell-read-silence.d.ts +2 -1
  186. package/dist/core/shell-run-candidates.d.ts +1 -1
  187. package/dist/core/shell-run-candidates.js +11 -3
  188. package/dist/core/task-event.d.ts +32 -10
  189. package/dist/core/task-intake.d.ts +5 -3
  190. package/dist/core/task-intake.js +6 -2
  191. package/dist/core/task-result.d.ts +39 -0
  192. package/dist/core/task-spec-members.d.ts +3 -0
  193. package/dist/core/task-spec-members.js +2 -2
  194. package/dist/core/task-spec.d.ts +37 -20
  195. package/dist/core/tool-policy.d.ts +30 -18
  196. package/dist/core/tool-policy.js +44 -32
  197. package/dist/core/tool-roster.d.ts +21 -7
  198. package/dist/core/tool-roster.js +34 -6
  199. package/dist/core/tool-spec-members.js +1 -1
  200. package/dist/core/tool-spec.d.ts +27 -0
  201. package/dist/core/tools.js +1 -0
  202. package/dist/core/trace.d.ts +42 -19
  203. package/dist/core/unc-spelling.d.ts +31 -0
  204. package/dist/core/unc-spelling.js +51 -0
  205. package/dist/core/wiring-manifest.d.ts +30 -3
  206. package/dist/core/wiring-manifest.js +10 -0
  207. package/dist/core/workflow-run-store-contract.js +22 -0
  208. package/dist/core/workflow-run-store.d.ts +17 -13
  209. package/dist/core/workflow-run-store.js +1 -1
  210. package/dist/core/write-protect.d.ts +4 -0
  211. package/dist/core/write-protect.js +17 -15
  212. package/dist/engine/compaction/compaction.d.ts +48 -98
  213. package/dist/engine/compaction/compaction.js +136 -216
  214. package/dist/engine/compaction/utils.d.ts +2 -11
  215. package/dist/engine/compaction/utils.js +4 -13
  216. package/dist/engine/execution-env/node-execution-env.js +17 -6
  217. package/dist/engine/harness/agent-harness.d.ts +19 -5
  218. package/dist/engine/harness/agent-harness.js +18 -7
  219. package/dist/engine/harness/types.d.ts +5 -7
  220. package/dist/engine/loop/agent-loop.d.ts +14 -1
  221. package/dist/engine/loop/agent-loop.js +31 -11
  222. package/dist/engine/loop/types.d.ts +8 -2
  223. package/dist/index.d.ts +9 -6
  224. package/dist/index.js +8 -6
  225. package/dist/internal/harness-types.d.ts +1 -1
  226. package/dist/internal/harness.d.ts +1 -1
  227. package/dist/internal/harness.js +1 -1
  228. package/dist/orchestration/run-spec.js +7 -2
  229. package/dist/orchestration/run-workflow-tool.js +5 -3
  230. package/dist/orchestration/workflow-park-adoption.d.ts +66 -8
  231. package/dist/orchestration/workflow-park-adoption.js +195 -45
  232. package/dist/orchestration/workflow-types.d.ts +20 -0
  233. package/dist/orchestration/workflow-types.js +1 -0
  234. package/dist/orchestration/workflow.d.ts +3 -2
  235. package/dist/orchestration/workflow.js +10 -4
  236. package/dist/prompt-assembly/catalog/core-behavior.js +6 -0
  237. package/dist/prompt-assembly/catalog/events.d.ts +8 -0
  238. package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.js +6 -0
  239. package/dist/prompt-assembly/catalog/locales/zh-Hans/mechanism.js +1 -0
  240. package/dist/prompt-assembly/catalog/mechanism.d.ts +8 -0
  241. package/dist/prompt-assembly/catalog/mechanism.js +1 -0
  242. package/dist/prompt-assembly/catalog/schema.d.ts +1 -1
  243. package/dist/prompt-assembly/catalog/schema.js +1 -0
  244. package/dist/prompt-assembly/catalog/sections.js +8 -0
  245. package/dist/prompt-assembly/event-registry.js +1 -0
  246. package/dist/prompt-assembly/select.js +1 -0
  247. package/dist/prompt-assembly/turn-snapshot.d.ts +14 -27
  248. package/dist/prompt-assembly/turn-snapshot.js +6 -18
  249. package/dist/prompt-assembly/types.d.ts +3 -0
  250. package/dist/prompts/default.d.ts +9 -0
  251. package/dist/prompts/default.js +4 -0
  252. package/dist/shell/lex.d.ts +75 -11
  253. package/dist/shell/lex.js +340 -76
  254. package/dist/tools/fs/bash-program-position.js +2 -6
  255. package/dist/tools/fs/bash-readonly-classifier.d.ts +18 -3
  256. package/dist/tools/fs/bash-readonly-classifier.js +19 -9
  257. package/dist/tools/fs/containment-face.d.ts +12 -3
  258. package/dist/tools/fs/containment-face.js +16 -7
  259. package/dist/tools/fs/file-read-check.d.ts +26 -1
  260. package/dist/tools/fs/file-read-check.js +20 -2
  261. package/dist/tools/fs/fs-bash.js +4 -4
  262. package/dist/tools/fs/fs-read.d.ts +3 -0
  263. package/dist/tools/fs/fs-read.js +2 -2
  264. package/dist/tools/fs/fs-search-tools.d.ts +2 -2
  265. package/dist/tools/fs/fs-search-tools.js +4 -4
  266. package/dist/tools/fs/index.js +5 -3
  267. package/dist/tools/fs/pdf.js +12 -4
  268. package/dist/tools/fs/read-deny-home.d.ts +13 -2
  269. package/dist/tools/fs/read-deny-home.js +26 -22
  270. package/dist/tools/fs/read-deny.js +15 -6
  271. package/dist/tools/fs/removal-targets.d.ts +33 -17
  272. package/dist/tools/fs/removal-targets.js +160 -61
  273. package/dist/tools/fs/repo-map.d.ts +1 -1
  274. package/dist/tools/fs/repo-map.js +2 -2
  275. package/dist/tools/fs/safety.d.ts +28 -5
  276. package/dist/tools/fs/safety.js +72 -8
  277. package/dist/tools/fs/shell-read-bindings.d.ts +8 -2
  278. package/dist/tools/fs/shell-read-bindings.js +25 -6
  279. package/dist/tools/fs/shell-read-check.d.ts +3 -0
  280. package/dist/tools/fs/shell-read-check.js +22 -4
  281. package/dist/tools/fs/shell-read-establish.js +73 -43
  282. package/dist/tools/fs/shell-read-judge.d.ts +32 -14
  283. package/dist/tools/fs/shell-read-judge.js +13 -5
  284. package/dist/tools/fs/shell-read-object-path.d.ts +5 -1
  285. package/dist/tools/fs/shell-read-object-path.js +17 -4
  286. package/dist/tools/fs/shell-read-plan.d.ts +8 -2
  287. package/dist/tools/fs/shell-read-plan.js +36 -22
  288. package/dist/tools/fs/shell-read-sourced.js +12 -4
  289. package/dist/tools/fs/shell-read-start.d.ts +4 -2
  290. package/dist/tools/fs/shell-read-start.js +3 -3
  291. package/dist/tools/fs/shell-read-workdir.d.ts +14 -6
  292. package/dist/tools/fs/shell-read-workdir.js +35 -17
  293. package/dist/tools/scheduler-tools.d.ts +7 -17
  294. package/dist/tools/scheduler-tools.js +9 -85
  295. package/dist/tools/worktree.js +5 -4
  296. package/package.json +3 -2
  297. package/test/export-surface.snapshot.json +47 -1
  298. package/wire-changes/core-stores-sql@7.68.6.json +39 -0
  299. package/wire-changes/core-stores-sql@7.69.1.json +39 -0
  300. package/wire-changes/core@7.68.6.json +125 -0
  301. package/wire-changes/core@7.69.1.json +2561 -0
  302. package/wire-changes/mods-kernel@7.68.6.json +39 -0
  303. package/wire-changes/mods-kernel@7.69.1.json +39 -0
  304. package/wire-changes/primitives@7.68.6.json +39 -0
  305. package/wire-changes/primitives@7.69.1.json +39 -0
  306. package/wire-changes/wiki-gate@7.68.6.json +39 -0
  307. package/wire-changes/wiki-gate@7.69.1.json +39 -0
  308. package/dist/core/runner/prompt-hash-salt.d.ts +0 -1
  309. package/dist/core/runner/prompt-hash-salt.js +0 -2
@@ -1,35 +1,45 @@
1
1
  /**
2
2
  * The closed set of reasons a request's prefix may lawfully change (design/1393 §5.3). Five open a new
3
- * epoch of the head; the sixth rewrites history without touching the head.
4
- * - `leg_start_inputs` — a leg-start input of the head moved since the session's anchor (environment facts, memory
5
- * tail, MCP instructions, the stable body, the tool table).
3
+ * epoch of the head; the last two rewrite history without touching the head.
4
+ * - `leg_start_inputs` — a leg-start input of the head moved since the session's anchor (environment facts, the memory
5
+ * band — its configuration, or its store content where the segment's frozen copy is not served: another process, a
6
+ * withholding or an erasure since —, MCP instructions, the stable body, the tool table).
6
7
  * - `tool_table` — the mounted tool table moved inside the leg (a deferred activation, a roster refresh, the
7
8
  * per-request view).
8
9
  * - `compaction` — a landed compaction: the history is replaced, and a center-prompt adoption moves the system.
9
10
  * - `request_policy` — the request's controls moved (thinking level, output cap, retention word).
10
11
  * - `model_namespace` — the serving model moved (a lane hop, a degrade switch): a different cache namespace.
11
- * - `history_rewrite` — a request-time reducer rewrote earlier messages (a cleared tool result, a guard trim).
12
+ * - `history_rewrite` — a request-time reducer the engine needs to fit the request rewrote earlier messages (a guard
13
+ * trim, the media trim, the git frame's degrade, a copy pointer, a provider-refused view, a trimmed request's bring-back).
14
+ * - `tool_result_clear` — old tool results were replaced by cleared markers. It has its own word because clearing is
15
+ * the one reduction a deployment turns on itself (`microCompact`) and can turn off; the reducers above are what the
16
+ * engine must do to fit, and share one word.
12
17
  *
13
18
  * @contract prompt_cache.declaration.one_word — every in-leg change to a request's prefix is declared exactly
14
19
  * once, by the seat that makes it, before the request that carries it goes out, with one word of this set; the
15
- * detector reads the declarations only to say whether a change it located was expected, and never infers a
16
- * reason from the change itself — a located change with no declaration is reported as undeclared.
20
+ * session's prefix ledger reads the declarations only to say whether a change it located was declared, and never infers a
21
+ * reason from the change itself — a located change with no declaration is reported as undeclared (`declared: false`).
17
22
  */
18
- export declare const PREFIX_CHANGE_CAUSES: readonly ["leg_start_inputs", "tool_table", "compaction", "request_policy", "model_namespace", "history_rewrite"];
23
+ export declare const PREFIX_CHANGE_CAUSES: readonly ["leg_start_inputs", "tool_table", "compaction", "request_policy", "model_namespace", "history_rewrite", "tool_result_clear"];
19
24
  export type PrefixChangeCause = (typeof PREFIX_CHANGE_CAUSES)[number];
20
25
  /** One declaration of a prefix change, made by the seat that changes the request. */
21
26
  export interface PrefixChangeDeclaration {
22
27
  cause: PrefixChangeCause;
23
- /** `history_rewrite` only: the first message position the rewrite changed, when the reducer knows it. */
28
+ /** A history rewrite's first changed message, as the declaring caller knew it. The engine never sets it since 7.69.1:
29
+ * where a request changed is the prefix ledger's byte measurement (`prefix_changed.message`); only this deprecated
30
+ * detector reads it, from a host's own declarations. Removed in 7.70.0 with the detector. */
24
31
  firstChangedIndex?: number;
25
- /** `history_rewrite` only: the rewrite is a bounded deletion (clearing old tool results) — a drop it explains
26
- * is not reported at all (the provider re-bills the cleared span once, by design). */
32
+ /** @deprecated Ignored since 7.69.1 (a bounded deletion's re-read is reported like any other rewrite); removed in 7.70.0. */
27
33
  bounded?: true;
28
34
  }
29
35
  /** Where a located change sits in the request — `CacheBreakFinding["cause"]`; the order is the request's own
30
- * (namespace, tools, system, controls, history), the residual last. */
36
+ * (namespace, tools, system, controls, history), the residual last.
37
+ * @deprecated The engine mints no finding since 7.69.1 (see the module header); removed in 7.70.0. */
31
38
  export declare const CACHE_BREAK_CAUSES: readonly ["model-switch", "tool-schema", "tool-set", "system-prefix", "request-policy", "history-rewrite", "server-or-ttl"];
39
+ /** @deprecated The engine mints no finding since 7.69.1; removed in 7.70.0. */
32
40
  export type CacheBreakCause = (typeof CACHE_BREAK_CAUSES)[number];
41
+ /** @deprecated The engine no longer mints this for prefix changes since 7.69.1 (they are the `prefix_changed` task event);
42
+ * removed in 7.70.0. */
33
43
  export interface CacheBreakFinding {
34
44
  turn: number;
35
45
  cacheReadBefore: number;
@@ -61,6 +71,8 @@ export declare function toolsToFingerprintInputs(tools: ReadonlyArray<{
61
71
  description: string;
62
72
  parameters: unknown;
63
73
  }>): ToolFingerprintInput[];
74
+ /** @deprecated The engine no longer runs this detector since 7.69.1 (a prefix change is the `prefix_changed` task event,
75
+ * judged from the request bytes); removed in 7.70.0. */
64
76
  export declare class CacheBreakDetector {
65
77
  private prev;
66
78
  /** The declarations made since the last observation; consumed by the next one (an observation that is skipped
@@ -6,6 +6,7 @@ export const PREFIX_CHANGE_CAUSES = Object.freeze([
6
6
  "request_policy",
7
7
  "model_namespace",
8
8
  "history_rewrite",
9
+ "tool_result_clear",
9
10
  ]);
10
11
  export const CACHE_BREAK_CAUSES = Object.freeze([
11
12
  "model-switch",
@@ -117,13 +118,18 @@ export class CacheBreakDetector {
117
118
  if (words.has("request_policy")) {
118
119
  return finding({ cause: "request-policy", detail: "the request's controls changed (thinking level / output cap / retention / speed)" }, true, " — declared (request_policy)");
119
120
  }
120
- const rewrites = declared.filter((d) => d.cause === "history_rewrite" || d.cause === "compaction");
121
+ const rewrites = declared.filter((d) => d.cause === "history_rewrite" || d.cause === "tool_result_clear" || d.cause === "compaction");
121
122
  if (rewrites.length > 0) {
122
- if (rewrites.every((d) => d.bounded === true))
123
- return undefined;
124
123
  const indices = rewrites.flatMap((d) => (d.firstChangedIndex !== undefined ? [d.firstChangedIndex] : []));
125
- const word = rewrites.some((d) => d.cause === "compaction") ? "compaction" : "history_rewrite";
126
- return finding({ cause: "history-rewrite", detail: "earlier messages were rewritten", ...(indices.length === rewrites.length ? { firstChangedIndex: Math.min(...indices) } : {}) }, true, ` — declared (${word})`);
124
+ const first = indices.length === rewrites.length ? Math.min(...indices) : undefined;
125
+ const word = rewrites.some((d) => d.cause === "compaction") ? "compaction" : (rewrites.find((d) => d.cause !== "compaction").cause);
126
+ return finding({
127
+ cause: "history-rewrite",
128
+ detail: first !== undefined
129
+ ? `earlier messages were rewritten: the provider re-reads the request from message ${first} on`
130
+ : "earlier messages were rewritten: the provider re-reads the request from the first rewritten message on",
131
+ ...(first !== undefined ? { firstChangedIndex: first } : {}),
132
+ }, true, ` — declared (${word})`);
127
133
  }
128
134
  const gapMs = snap.at - prev.at;
129
135
  const checked = "nothing this detector fingerprints (system prefix, tool set + order, model) changed, no rewrite was declared,";
@@ -264,7 +264,7 @@ export type CheckpointErrorReason = "version_newer" | "env_factory_missing" | "g
264
264
  *
265
265
  * A SUBSET of {@link CONFIG_REFUSAL_CODES}, the family's whole refusal vocabulary: the words a resume's screen can produce, held to that set at compile time.
266
266
  */
267
- export declare const CHECKPOINT_CONFIG_REFUSAL_CODES: readonly ["config.spec_retired_key", "config.output_style_invalid", "config.language_invalid", "config.permission_mode_invalid", "config.shell_gate_value_retired", "config.approval_reach_invalid", "config.run_origin_invalid", "config.user_invoked_skill_unknown", "config.skill_deny_unreadable", "config.user_attachment_invalid", "config.tool_face_control", "config.deps_retired_key", "config.peer_presence_invalid", "config.tool_model_gate_invalid", "config.microcompact_invalid", "config.prompt_selector_invalid", "resume_at.conflicts_resume", "resume_at.mode_without_target", "config.read_face_invalid", "config.write_face_invalid", "config.invalid_argument", "config.tool_face_invalid", "config.memory_delegation_evidence", "config.memory_provenance", "config.memory_capture_policy", "config.cross_boundary_posture", "config.advisor_tool_invalid", "config.advisor_model_invalid", "config.auto_consolidation", "config.unknown_role", "config.tool_materialize_invalid", "config.memory_persistence_invalid", "config.tool_materialize_unreachable", "config.locked_registry", "config.locked_key", "config.mcp_content_class", "config.skill_listing_budget_invalid", "config.limit_unknown_key", "config.limit_invalid", "config.attachment_invalid", "config.usage_window_invalid", "config.brain_call_guardrail_invalid", "config.retention_policy", "config.retention_capability", "config.invalid_checkpoint_store", "config.skill_base_dir_invalid", "config.host_floor_invalid", "config.credential_in_declaration", "config.credential_ref_invalid", "config.peer_seat_missing", "config.interaction_posture", "config.agents.no_delegation_tool", "config.spec_member_unreadable", "config.spec_unknown_key"];
267
+ export declare const CHECKPOINT_CONFIG_REFUSAL_CODES: readonly ["config.spec_retired_key", "config.output_style_invalid", "config.language_invalid", "config.permission_mode_invalid", "config.shell_gate_value_retired", "config.approval_reach_invalid", "config.run_origin_invalid", "config.user_invoked_skill_unknown", "config.skill_deny_unreadable", "config.user_attachment_invalid", "config.tool_face_control", "config.deps_retired_key", "config.peer_presence_invalid", "config.tool_model_gate_invalid", "config.microcompact_invalid", "config.prompt_selector_invalid", "resume_at.conflicts_resume", "resume_at.mode_without_target", "config.read_face_invalid", "config.write_face_invalid", "config.invalid_argument", "config.tool_face_invalid", "config.memory_delegation_evidence", "config.memory_provenance", "config.memory_capture_policy", "config.cross_boundary_posture", "config.advisor_tool_invalid", "config.advisor_model_invalid", "config.auto_consolidation", "config.unknown_role", "config.tool_materialize_invalid", "config.memory_persistence_invalid", "config.tool_materialize_unreachable", "config.locked_registry", "config.locked_key", "config.mcp_content_class", "config.skill_listing_budget_invalid", "config.limit_unknown_key", "config.limit_invalid", "config.attachment_invalid", "config.usage_window_invalid", "config.brain_call_guardrail_invalid", "config.retention_policy", "config.retention_capability", "config.invalid_checkpoint_store", "config.skill_base_dir_invalid", "config.host_floor_invalid", "config.credential_in_declaration", "config.credential_ref_invalid", "config.peer_seat_missing", "config.interaction_posture", "config.agents.no_delegation_tool", "config.spec_member_unreadable", "config.spec_unknown_key", "config.agent_config_dir_invalid", "config.agent_home_dir_invalid"];
268
268
  export type CheckpointConfigRefusalCode = (typeof CHECKPOINT_CONFIG_REFUSAL_CODES)[number];
269
269
  export declare const isCheckpointConfigRefusalCode: (word: unknown) => word is CheckpointConfigRefusalCode;
270
270
  /** The words of a {@link CheckpointError}'s optional `detail.field` (what each means: the `detail` member's doc). A CLOSED SET with one home, registered in
@@ -84,7 +84,7 @@ export const MAX_SUPPORTED_CHECKPOINT_VERSION = CHECKPOINT_FEATURES.requirements
84
84
  export function checkpointVersionOf(cp) {
85
85
  return cp.version ?? 0;
86
86
  }
87
- export const CHECKPOINT_CONFIG_REFUSAL_CODES = Object.freeze(["config.spec_retired_key", "config.output_style_invalid", "config.language_invalid", "config.permission_mode_invalid", "config.shell_gate_value_retired", "config.approval_reach_invalid", "config.run_origin_invalid", "config.user_invoked_skill_unknown", "config.skill_deny_unreadable", "config.user_attachment_invalid", "config.tool_face_control", "config.deps_retired_key", "config.peer_presence_invalid", "config.tool_model_gate_invalid", "config.microcompact_invalid", "config.prompt_selector_invalid", "resume_at.conflicts_resume", "resume_at.mode_without_target", "config.read_face_invalid", "config.write_face_invalid", "config.invalid_argument", "config.tool_face_invalid", "config.memory_delegation_evidence", "config.memory_provenance", "config.memory_capture_policy", "config.cross_boundary_posture", "config.advisor_tool_invalid", "config.advisor_model_invalid", "config.auto_consolidation", "config.unknown_role", "config.tool_materialize_invalid", "config.memory_persistence_invalid", "config.tool_materialize_unreachable", "config.locked_registry", "config.locked_key", "config.mcp_content_class", "config.skill_listing_budget_invalid", "config.limit_unknown_key", "config.limit_invalid", "config.attachment_invalid", "config.usage_window_invalid", "config.brain_call_guardrail_invalid", "config.retention_policy", "config.retention_capability", "config.invalid_checkpoint_store", "config.skill_base_dir_invalid", "config.host_floor_invalid", "config.credential_in_declaration", "config.credential_ref_invalid", "config.peer_seat_missing", "config.interaction_posture", "config.agents.no_delegation_tool", "config.spec_member_unreadable", "config.spec_unknown_key"]);
87
+ export const CHECKPOINT_CONFIG_REFUSAL_CODES = Object.freeze(["config.spec_retired_key", "config.output_style_invalid", "config.language_invalid", "config.permission_mode_invalid", "config.shell_gate_value_retired", "config.approval_reach_invalid", "config.run_origin_invalid", "config.user_invoked_skill_unknown", "config.skill_deny_unreadable", "config.user_attachment_invalid", "config.tool_face_control", "config.deps_retired_key", "config.peer_presence_invalid", "config.tool_model_gate_invalid", "config.microcompact_invalid", "config.prompt_selector_invalid", "resume_at.conflicts_resume", "resume_at.mode_without_target", "config.read_face_invalid", "config.write_face_invalid", "config.invalid_argument", "config.tool_face_invalid", "config.memory_delegation_evidence", "config.memory_provenance", "config.memory_capture_policy", "config.cross_boundary_posture", "config.advisor_tool_invalid", "config.advisor_model_invalid", "config.auto_consolidation", "config.unknown_role", "config.tool_materialize_invalid", "config.memory_persistence_invalid", "config.tool_materialize_unreachable", "config.locked_registry", "config.locked_key", "config.mcp_content_class", "config.skill_listing_budget_invalid", "config.limit_unknown_key", "config.limit_invalid", "config.attachment_invalid", "config.usage_window_invalid", "config.brain_call_guardrail_invalid", "config.retention_policy", "config.retention_capability", "config.invalid_checkpoint_store", "config.skill_base_dir_invalid", "config.host_floor_invalid", "config.credential_in_declaration", "config.credential_ref_invalid", "config.peer_seat_missing", "config.interaction_posture", "config.agents.no_delegation_tool", "config.spec_member_unreadable", "config.spec_unknown_key", "config.agent_config_dir_invalid", "config.agent_home_dir_invalid"]);
88
88
  export const isCheckpointConfigRefusalCode = (word) => CHECKPOINT_CONFIG_REFUSAL_CODES.some((w) => w === word);
89
89
  export class CheckpointError extends Error {
90
90
  code;
@@ -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", "tool_binding", "raw_name_identity", "isolation_scope", "from_subagent", "command_sandbox"];
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", "raw_name_identity", "isolation_scope", "from_subagent", "command_sandbox", "agent_config_dirs", "agent_home_dirs", "read_block"];
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;
@@ -144,6 +144,9 @@ export declare const CHECKPOINT_STATE_REQUIREMENTS: {
144
144
  readonly writeFace: {
145
145
  readonly word: "write_face";
146
146
  };
147
+ readonly readBlock: {
148
+ readonly word: "read_block";
149
+ };
147
150
  readonly skillGrants: {
148
151
  readonly word: "skill_grants";
149
152
  };
@@ -277,6 +280,12 @@ export declare const CHECKPOINT_STATE_REQUIREMENTS: {
277
280
  readonly commandSandbox: {
278
281
  readonly word: "command_sandbox";
279
282
  };
283
+ readonly agentConfigDirs: {
284
+ readonly word: "agent_config_dirs";
285
+ };
286
+ readonly agentHomeDirs: {
287
+ readonly word: "agent_home_dirs";
288
+ };
280
289
  };
281
290
  export declare const PENDING_ACTION_REQUIREMENTS: {
282
291
  readonly tool_approval: {
@@ -585,6 +594,9 @@ export declare const CHECKPOINT_REQUIREMENTS: {
585
594
  readonly writeFace: {
586
595
  readonly word: "write_face";
587
596
  };
597
+ readonly readBlock: {
598
+ readonly word: "read_block";
599
+ };
588
600
  readonly skillGrants: {
589
601
  readonly word: "skill_grants";
590
602
  };
@@ -718,6 +730,12 @@ export declare const CHECKPOINT_REQUIREMENTS: {
718
730
  readonly commandSandbox: {
719
731
  readonly word: "command_sandbox";
720
732
  };
733
+ readonly agentConfigDirs: {
734
+ readonly word: "agent_config_dirs";
735
+ };
736
+ readonly agentHomeDirs: {
737
+ readonly word: "agent_home_dirs";
738
+ };
721
739
  };
722
740
  };
723
741
  readonly resourceLedger: {
@@ -49,6 +49,9 @@ export const REQUIREMENT_WORDS = Object.freeze([
49
49
  "isolation_scope",
50
50
  "from_subagent",
51
51
  "command_sandbox",
52
+ "agent_config_dirs",
53
+ "agent_home_dirs",
54
+ "read_block",
52
55
  ]);
53
56
  export function isRequirementWord(word) {
54
57
  return typeof word === "string" && REQUIREMENT_WORDS.includes(word);
@@ -89,6 +92,7 @@ export const CHECKPOINT_STATE_REQUIREMENTS = {
89
92
  readFileState: DECISION_READ,
90
93
  readFace: { word: "face" },
91
94
  writeFace: { word: "write_face" },
95
+ readBlock: { word: "read_block" },
92
96
  skillGrants: { word: "skill_grants" },
93
97
  skillScopes: { word: "skill_scopes" },
94
98
  reminderMark: DECISION_READ,
@@ -119,6 +123,8 @@ export const CHECKPOINT_STATE_REQUIREMENTS = {
119
123
  ownToolLists: { word: "own_tool_lists" },
120
124
  crossBoundaryRecorded: { word: "cross_boundary" },
121
125
  commandSandbox: { word: "command_sandbox" },
126
+ agentConfigDirs: { word: "agent_config_dirs" },
127
+ agentHomeDirs: { word: "agent_home_dirs" },
122
128
  };
123
129
  export const PENDING_ACTION_REQUIREMENTS = {
124
130
  tool_approval: {
@@ -199,6 +199,9 @@ function rowRefusalOf(cp) {
199
199
  return new CheckpointError("checkpoint.invalid_outcome", `this checkpoint carries a write-face section (state.writeFace) that is not well-formed — refusing to resume a damaged write-face row (corruption guard), the checkpoint stays pending`, { reason: "write_face_damaged" });
200
200
  }
201
201
  }
202
+ const readBlockRaw = cp.state.readBlock;
203
+ if (readBlockRaw !== undefined && readBlockRaw !== true)
204
+ return new CheckpointError("checkpoint.invalid_outcome", "this checkpoint's `state.readBlock` does not read as every reader of a row reads it (present, it is not `true`) — a damaged row", { reason: "requirements_damaged" });
202
205
  if (readFrozenSkillGrants(cp.state.skillGrants) === undefined)
203
206
  return new CheckpointError("checkpoint.invalid_outcome", "this checkpoint carries a skill-grant section (state.skillGrants) that does not read as grant rows under this engine — a damaged section, or a row an earlier release wrote whose entry this release reads as nothing (an entry with a surrounding space, say) — refusing to resume without the grant rows and refusals it carries; the checkpoint stays pending: finish it on a worker of the release that parked it, or expire it", { reason: "skill_grants_damaged" });
204
207
  if (readFrozenSkillScopes(cp.state.skillScopes) === undefined)
@@ -1053,8 +1053,8 @@ export type PendingAction = {
1053
1053
  * non-serializable runtime objects (`harness`/`session`/`abortController`…) it holds (round-2 BUG#1).
1054
1054
  *
1055
1055
  * Round-trip fidelity of every field is covered by tests; runtime objects are **forbidden** here.
1056
- * `cacheFingerprint` (design/31) is deliberately **excluded** — it is observation-only, so resume just
1057
- * suppresses cache-break detection on the first turn rather than persisting it as correctness state.
1056
+ * The session's prefix ledger is deliberately **excluded** — observation-only: a resumed leg's first request
1057
+ * reads `no-baseline` (the leg start's anchor comparison speaks for it), never correctness state.
1058
1058
  */
1059
1059
  export interface CheckpointState {
1060
1060
  /** design/36: deferred-tool activation set — else resume re-discloses / diverges from history. */
@@ -1109,6 +1109,13 @@ export interface CheckpointState {
1109
1109
  writeFace?: {
1110
1110
  face: "open" | "roots";
1111
1111
  };
1112
+ /**
1113
+ * The leg refused reads outside its declared directories (`TaskSpec.blockReadsOutsideRoots`, the leg's resolved value):
1114
+ * written ONLY when it did — `true` or absent. Its reader requirement (`read_block`) makes a worker that cannot honor it
1115
+ * refuse the row rather than resume the leg reading wider; the resume reads it as the declaration (the row's ∨ the spec's
1116
+ * — a resume never lifts it). Any other value damages the row.
1117
+ */
1118
+ readBlock?: true;
1112
1119
  /** The grant rows the run grew ({@link import("./skill-grant.js").frozenSkillGrants}); absent = none, damaged = refused pre-CAS. */
1113
1120
  skillGrants?: import("./skill-grant.js").SkillGrantRecord[];
1114
1121
  /** The skills active on the leg whose hooks were open (`SkillSpec.mods`; {@link import("./mods/spec-seats.js").SkillScopes}`.frozen`):
@@ -1503,6 +1510,10 @@ export interface CheckpointState {
1503
1510
  * looser than the leg it continues. Absent ⇒ the leg ran under none. A reader that lacks the word would resume the leg's
1504
1511
  * commands without the sandbox it parked under. */
1505
1512
  commandSandbox?: import("./command-sandbox.js").TaskSandboxSettings;
1513
+ /** The configuration roots a task layer of the parked leg declared (not the deployment's own): a resume places the rows there again. */
1514
+ agentConfigDirs?: string[];
1515
+ /** The caller homes a task layer of the parked leg declared: a resume places the home-anchored rows there again. */
1516
+ agentHomeDirs?: string[];
1506
1517
  }
1507
1518
  /**
1508
1519
  * {@link CheckpointState} with **every** field made required-PRESENT, while each value keeps its original
@@ -18,6 +18,7 @@
18
18
  * changes nothing about its children, and nothing a child can author lifts a clamp its parent ran under.
19
19
  */
20
20
  import { readDenyEntryProblem, type ReadDenyEntry } from "../tools/fs/read-deny.js";
21
+ import { declaredDirIdentity } from "./agent-config-dir.js";
21
22
  import { complianceCapabilityProblem, type ComplianceCapability } from "./compliance.js";
22
23
  import type { TaskSpec } from "./types.js";
23
24
  import { writeProtectedEntryIdentity, writeProtectedEntryProblem } from "./write-protect.js";
@@ -50,7 +51,8 @@ export interface ScriptListLaw<E> {
50
51
  * by `identity`; `[]` erases nothing), and the run's effective list is that union taken with the deployment's own list
51
52
  * (`deploymentLayer`, the `RunnerDeps` member it arrives through) — so the task layer can add entries and never remove
52
53
  * one. `entry` is the seat's own entry law (its compiler's, never a copy); the task layer's lists meet it at the one
53
- * door ({@link assertAddOnlySeats}), and an entry it refuses never folds into another. `script` bounds a governed
54
+ * door ({@link assertAddOnlySeats}), and an entry it refuses never folds into another. `door` (optional) is a seat's own
55
+ * task-layer check for a list whose refusals carry a code of their own, run at that door first. `script` bounds a governed
54
56
  * workflow script's untrusted list for the seat before `entry` judges it.
55
57
  * `script` also says whether a governed workflow SCRIPT may declare the seat for its child, under the row's law: a
56
58
  * restricting row with `script: true` only as its restricting value (`false` = inherited only); an add-only row through its
@@ -89,6 +91,12 @@ export declare const CLAMP_SET: Readonly<{
89
91
  readonly script: true;
90
92
  readonly carrier: "clamp";
91
93
  }>;
94
+ blockReadsOutsideRoots: Readonly<{
95
+ readonly law: "restricting";
96
+ readonly value: true;
97
+ readonly script: true;
98
+ readonly carrier: "clamp";
99
+ }>;
92
100
  durableApproval: Readonly<{
93
101
  readonly law: "restricting";
94
102
  readonly value: false;
@@ -119,6 +127,24 @@ export declare const CLAMP_SET: Readonly<{
119
127
  readonly deploymentLayer: "compliancePostureResolver";
120
128
  readonly carrier: "clamp";
121
129
  }>;
130
+ agentConfigDirs: Readonly<{
131
+ readonly law: "addOnly";
132
+ readonly identity: typeof declaredDirIdentity;
133
+ readonly entry: (entry: unknown, owner: string) => string | undefined;
134
+ readonly door: (value: unknown, owner: string) => void;
135
+ readonly script: ScriptListLaw<string>;
136
+ readonly deploymentLayer: "agentConfigDir";
137
+ readonly carrier: "clamp";
138
+ }>;
139
+ agentHomeDirs: Readonly<{
140
+ readonly law: "addOnly";
141
+ readonly identity: typeof declaredDirIdentity;
142
+ readonly entry: (entry: unknown, owner: string) => string | undefined;
143
+ readonly door: (value: unknown, owner: string) => void;
144
+ readonly script: ScriptListLaw<string>;
145
+ readonly deploymentLayer: "executionEnv";
146
+ readonly carrier: "clamp";
147
+ }>;
122
148
  oneShot: Readonly<{
123
149
  readonly law: "restricting";
124
150
  readonly value: true;
@@ -220,8 +246,9 @@ export declare function unionAddOnly<S extends AddOnlySeat>(seat: S, ...lists: R
220
246
  /**
221
247
  * THE task layer's door for the add-only rows: every add-only seat a spec carries is a list of entries its row's entry
222
248
  * law accepts, or the prepare refuses — one code (`config.invalid_argument`, the table's own refusal), one sentence for a
223
- * value that is not a list, and the seat's own entry law (labelled `TaskSpec.<seat>`) for a bad entry. Runs before any
224
- * list is folded or compiled, so a task-layer value is judged as the caller wrote it. Absent ⇒ nothing to judge.
249
+ * value that is not a list, and the seat's own entry law (labelled `TaskSpec.<seat>`) for a bad entry. A row with a `door`
250
+ * of its own (a seat whose refusals carry a code of their own) is judged by that door first. Runs before any list is folded
251
+ * or compiled, so a task-layer value is judged as the caller wrote it. Absent ⇒ nothing to judge.
225
252
  */
226
253
  export declare function assertAddOnlySeats(spec: object): void;
227
254
  /** The name a refusal gives a seat's clamped cell: the seat, or (field row) `seat.member`. */
@@ -1,4 +1,5 @@
1
1
  import { readDenyEntryProblem } from "../tools/fs/read-deny.js";
2
+ import { declaredDirDoor, declaredDirEntryLaw, declaredDirIdentity } from "./agent-config-dir.js";
2
3
  import { COMPLIANCE_CAPABILITIES, complianceCapabilityProblem } from "./compliance.js";
3
4
  import { callerKey } from "./caller-text.js";
4
5
  import { strayMembersOf } from "./own-property-receipt.js";
@@ -54,6 +55,12 @@ function writeProtectedScriptEntry(el, at) {
54
55
  assertScriptEntryLength(name, at, "write-protected name", why);
55
56
  return { name, kind };
56
57
  }
58
+ function declaredDirScriptEntry(el, at) {
59
+ if (typeof el !== "string" || el.length === 0)
60
+ throw new Error(`${at} must be a non-empty absolute directory path`);
61
+ assertScriptEntryLength(el, at, "declared directory", "every directory places deny rows for the child's whole run");
62
+ return el;
63
+ }
57
64
  function complianceScriptEntry(el, at) {
58
65
  if (typeof el !== "string")
59
66
  throw new Error(`${at} must be a capability word (${COMPLIANCE_CAPABILITIES.join(", ")})`);
@@ -71,6 +78,18 @@ const WRITE_PROTECTED_SCRIPT_LAW = Object.freeze({
71
78
  why: "Every row is judged against every write the child names, for the child's whole run; the deployment's own table is in force beside these.",
72
79
  entry: writeProtectedScriptEntry,
73
80
  });
81
+ const AGENT_CONFIG_DIR_SCRIPT_LAW = Object.freeze({
82
+ atMost: 4,
83
+ shape: "configuration roots (absolute paths of existing directories)",
84
+ why: "Every root places the configuration directory's read deny and write-protection rows for the child's whole run; the deployment's root and the run's own are in force on top of these.",
85
+ entry: declaredDirScriptEntry,
86
+ });
87
+ const AGENT_HOME_DIR_SCRIPT_LAW = Object.freeze({
88
+ atMost: 4,
89
+ shape: "home directories (absolute paths of existing directories)",
90
+ why: "Every home places the home-anchored read deny rows for the child's whole run; the engine's own homes and the run's own are in force on top of these.",
91
+ entry: declaredDirScriptEntry,
92
+ });
74
93
  const COMPLIANCE_SCRIPT_LAW = Object.freeze({
75
94
  atMost: MAX_SCRIPT_LIST_ENTRIES,
76
95
  shape: `capability words (${COMPLIANCE_CAPABILITIES.join(", ")})`,
@@ -83,10 +102,13 @@ export const CLAMP_SET = Object.freeze({
83
102
  approvalReach: Object.freeze({ law: "restricting", value: "none", script: true, carrier: "clamp" }),
84
103
  readFace: Object.freeze({ law: "restricting", value: "roots", script: true, carrier: "clamp" }),
85
104
  writeFace: Object.freeze({ law: "restricting", value: "roots", script: true, carrier: "clamp" }),
105
+ blockReadsOutsideRoots: Object.freeze({ law: "restricting", value: true, script: true, carrier: "clamp" }),
86
106
  durableApproval: Object.freeze({ law: "restricting", value: false, script: false, carrier: "clamp" }),
87
107
  readDenyPatterns: Object.freeze({ law: "addOnly", identity: readDenyIdentity, entry: readDenyEntryProblem, script: READ_DENY_SCRIPT_LAW, deploymentLayer: "readDenyPatterns", carrier: "clamp" }),
88
108
  writeProtectedAdditions: Object.freeze({ law: "addOnly", identity: writeProtectedEntryIdentity, entry: writeProtectedEntryProblem, script: WRITE_PROTECTED_SCRIPT_LAW, deploymentLayer: "writeProtectedPaths", carrier: "clamp" }),
89
109
  complianceAdditionalDenies: Object.freeze({ law: "addOnly", identity: complianceIdentity, entry: complianceCapabilityProblem, script: COMPLIANCE_SCRIPT_LAW, deploymentLayer: "compliancePostureResolver", carrier: "clamp" }),
110
+ agentConfigDirs: Object.freeze({ law: "addOnly", identity: declaredDirIdentity, entry: declaredDirEntryLaw("config"), door: declaredDirDoor("config"), script: AGENT_CONFIG_DIR_SCRIPT_LAW, deploymentLayer: "agentConfigDir", carrier: "clamp" }),
111
+ agentHomeDirs: Object.freeze({ law: "addOnly", identity: declaredDirIdentity, entry: declaredDirEntryLaw("home"), door: declaredDirDoor("home"), script: AGENT_HOME_DIR_SCRIPT_LAW, deploymentLayer: "executionEnv", carrier: "clamp" }),
90
112
  oneShot: Object.freeze({ law: "restricting", value: true, script: true, carrier: "specSeat" }),
91
113
  memoryPersistenceCapable: Object.freeze({ law: "restricting", value: false, script: true, carrier: "specSeat" }),
92
114
  classifyAllShell: Object.freeze({ law: "restricting", value: true, script: true, carrier: "specSeat" }),
@@ -154,6 +176,8 @@ export function assertAddOnlySeats(spec) {
154
176
  if (value === undefined)
155
177
  continue;
156
178
  const owner = `TaskSpec.${seat}`;
179
+ if ("door" in row)
180
+ row.door(value, owner);
157
181
  if (!Array.isArray(value))
158
182
  throw clampRecordError(notAListSentence(owner, value));
159
183
  const entries = value;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The host-facing compaction members this engine RECEIVES and no longer READS. The summary always runs on the main model and
3
+ * reuses the main lane's request, so a separate summary model, the window-safety tolerance that sized its input, and the two
4
+ * window-safety seats of `maybeCompact` have nothing left to govern. Each is accepted for one more minor (a patch release
5
+ * carries no change a caller must code against), announced once per process, and refused by name from 7.70.0.
6
+ */
7
+ import { type EngineNotice } from "./engine-notice.js";
8
+ /** The closed set of members announced here — one spelling per member, the one the notice's `detail.member` carries. */
9
+ export declare const IGNORED_COMPACTION_MEMBERS: readonly ["TaskSpec.compactionModel", "TaskSpec.compaction.clampTolerance", "compactSession.compactionModel", "compactSession.compaction.clampTolerance", "maybeCompact.compactionModel", "maybeCompact.fallbackBudget", "maybeCompact.onWindowSafety"];
10
+ export type IgnoredCompactionMember = (typeof IGNORED_COMPACTION_MEMBERS)[number];
11
+ /** Tell, once per process per member, that a host handed a member this engine ignores. Absent sink ⇒ the process's default seat. */
12
+ export declare function announceIgnoredCompactionMember(member: IgnoredCompactionMember, onNotice: ((notice: EngineNotice) => void) | undefined): void;
@@ -0,0 +1,22 @@
1
+ import { deliverEngineNotice } from "./engine-notice.js";
2
+ export const IGNORED_COMPACTION_MEMBERS = Object.freeze([
3
+ "TaskSpec.compactionModel",
4
+ "TaskSpec.compaction.clampTolerance",
5
+ "compactSession.compactionModel",
6
+ "compactSession.compaction.clampTolerance",
7
+ "maybeCompact.compactionModel",
8
+ "maybeCompact.fallbackBudget",
9
+ "maybeCompact.onWindowSafety",
10
+ ]);
11
+ const told = new Set();
12
+ export function announceIgnoredCompactionMember(member, onNotice) {
13
+ if (told.has(member))
14
+ return;
15
+ told.add(member);
16
+ deliverEngineNotice(onNotice, {
17
+ code: "config.compaction_member_ignored",
18
+ message: `${member} is deprecated and ignored: the compaction summary always runs on the task's main model and reuses the main ` +
19
+ `request (same system prompt, tools and messages, one instruction appended). It is refused by name from 7.70.0 — remove it.`,
20
+ detail: { member },
21
+ });
22
+ }
@@ -18,7 +18,7 @@
18
18
  * A CLOSED SET with one home, registered in `docs/CLOSED-SETS.md`; `gate:closed-sets` holds the whole family to it: every family literal under
19
19
  * `src/` is a member, a notice word in a notice's `code`, or a ledgered non-word, and every member is still spelled somewhere.
20
20
  */
21
- export declare const CONFIG_REFUSAL_CODES: readonly ["config.a2a_peer_name_collision", "config.advisor_model_invalid", "config.advisor_tool_invalid", "config.agent.duplicate", "config.agent.invalid", "config.agent.reserved_name", "config.agent.unknown_model", "config.agent.unknown_tool", "config.agent_config_dir_invalid", "config.agents.no_delegation_tool", "config.approval_reach_invalid", "config.attachment_invalid", "config.auto_consolidation", "config.auto_mode_classifier_fallback_invalid", "config.auto_mode_denial_limit_invalid", "config.auto_mode_rate_limit_break_invalid", "config.auto_mode_timeout_invalid", "config.brain_call_guardrail_invalid", "config.cascade_invalid", "config.circuit_breaker_invalid", "config.command_sandbox_unavailable", "config.compliance_denied", "config.compliance_posture", "config.compliance_required", "config.context_settings_unknown_word", "config.credential_in_declaration", "config.credential_ref_invalid", "config.cross_boundary_posture", "config.cwd_conflicts_restore", "config.cwd_not_honored", "config.cwd_outside_root", "config.cwd_unsupported", "config.defer_mode_invalid", "config.delegation_entry_caps", "config.deps_retired_key", "config.egress_requires_write_effect", "config.empty_objective", "config.env_lifetime_invalid", "config.execution_env_home_dir_invalid", "config.extra_body_output_cap", "config.extra_tool_names", "config.host_floor_invalid", "config.host_floor_refused", "config.image_invalid", "config.interaction_posture", "config.interaction_wiring", "config.invalid_argument", "config.invalid_checkpoint_store", "config.invalid_file_history_capture", "config.invalid_file_history_store", "config.invalid_governance_baseline", "config.invalid_on_track_failure", "config.invalid_output_schema", "config.invalid_permission_rules", "config.invalid_task_registry", "config.invalid_tool_name_set", "config.language_invalid", "config.legacy_tool_name", "config.limit_invalid", "config.limit_unknown_key", "config.locked_key", "config.locked_registry", "config.mcp_content_class", "config.mcp_dialable_failed", "config.mcp_fingerprint_invalid", "config.mcp_host_seat_missing", "config.mcp_host_seat_undeclared", "config.mcp_pool_foreign_connection", "config.mcp_probe_option", "config.mcp_server_name_collision", "config.mcp_startup_timeout_invalid", "config.memory_capture_policy", "config.memory_capture_spelling", "config.memory_capture_unsupported", "config.memory_challenge_request", "config.memory_consolidation", "config.memory_consolidation_driver", "config.memory_consolidation_lease_required", "config.memory_consolidation_provenance_off", "config.memory_consolidation_replica_local", "config.memory_consolidation_write_gate", "config.memory_delegation_evidence", "config.memory_dir_not_backend_root", "config.memory_distiller_purity_contract", "config.memory_dual_root_overlap", "config.memory_erasure_request", "config.memory_erasure_scope", "config.memory_export_request", "config.memory_hold_timeout", "config.memory_import_request", "config.memory_persistence_invalid", "config.memory_project_identity", "config.memory_project_key_spelling", "config.memory_project_marker", "config.memory_project_marker_nested", "config.memory_provenance", "config.memory_reanchor", "config.memory_rebuild_reason", "config.memory_scope_key", "config.memory_scope_placement", "config.memory_scope_spelling", "config.memory_sync_cursor_mismatch", "config.memory_sync_store", "config.memory_sync_target_mismatch", "config.memory_write_scope_mismatch", "config.microcompact_invalid", "config.missing_scope", "config.model_fallback_invalid", "config.mods_invalid", "config.nothing_to_wake", "config.output_style_invalid", "config.parent_spec_seat_missing", "config.peer_answer_invalid", "config.peer_presence_invalid", "config.peer_seat_missing", "config.permission_mode_invalid", "config.placement_not_honored", "config.placement_root_invalid", "config.plan_file_invalid", "config.principal_inbox_consumer_invalid", "config.project_id_invalid", "config.project_identity_mismatch", "config.prompt_selector_invalid", "config.prompt_trait_unknown", "config.protocol_endpoint_unbound", "config.protocol_header_collision", "config.protocol_plaintext_credentials", "config.read_deny_floor_unkept", "config.read_face_invalid", "config.read_face_org_task_escalation", "config.read_face_readonly_conflict", "config.read_face_seat", "config.registry_scope_mismatch", "config.reserved_tool_name", "config.retention_capability", "config.retention_policy", "config.retention_policy_invalid", "config.run_origin_invalid", "config.safe_vars_reserved_name", "config.sandbox_admission_unavailable", "config.sandbox_settings_invalid", "config.session_box_floor_mismatch", "config.session_rules_unreadable", "config.session_workspace_changed", "config.session_workspace_invalid", "config.shell_gate_value_retired", "config.skill_base_dir_invalid", "config.skill_deny_unreadable", "config.skill_listing_budget_invalid", "config.spec_member_unreadable", "config.spec_retired_key", "config.spec_unknown_key", "config.stale_tool_result_offload_invalid", "config.stall_timeout_invalid", "config.stall_timeout_retired", "config.store_durability_invalid", "config.store_fidelity_invalid", "config.tool_contract_too_long", "config.tool_face_control", "config.tool_face_invalid", "config.tool_materialize_invalid", "config.tool_materialize_unreachable", "config.tool_model_gate_env_invalid", "config.tool_model_gate_invalid", "config.tool_mount_denied", "config.tool_name_invalid", "config.tool_name_too_long", "config.tool_roster_bound", "config.tool_roster_mount_tag", "config.tool_roster_origin", "config.tool_schema_bound", "config.tool_search_invalid", "config.toolpolicy.unmatched_names", "config.unknown_role", "config.usage_window_invalid", "config.usage_window_unpriced", "config.user_attachment_invalid", "config.user_invoked_skill_unknown", "config.verify_internals_invalid", "config.web_max_bytes_invalid", "config.web_search_max_results_invalid", "config.web_summary_max_content_invalid", "config.web_timeout_invalid", "config.write_exempt_dir_covers_root", "config.write_face_invalid", "config.write_face_org_task_escalation", "config.write_face_readonly_conflict", "resume_at.before_root_unsupported", "resume_at.before_target_not_user", "resume_at.conflicts_resume", "resume_at.invalid_mode", "resume_at.mode_without_target", "resume_at.no_session", "resume_at.not_a_message", "resume_at.not_found", "resume_at.outside_window"];
21
+ export declare const CONFIG_REFUSAL_CODES: readonly ["config.a2a_peer_name_collision", "config.advisor_model_invalid", "config.advisor_tool_invalid", "config.agent.duplicate", "config.agent.invalid", "config.agent.reserved_name", "config.agent.unknown_model", "config.agent.unknown_tool", "config.agent_config_dir_invalid", "config.agent_home_dir_invalid", "config.agents.no_delegation_tool", "config.approval_reach_invalid", "config.attachment_invalid", "config.auto_consolidation", "config.auto_mode_classifier_fallback_invalid", "config.auto_mode_denial_limit_invalid", "config.auto_mode_rate_limit_break_invalid", "config.auto_mode_timeout_invalid", "config.brain_call_guardrail_invalid", "config.cascade_invalid", "config.circuit_breaker_invalid", "config.command_sandbox_unavailable", "config.compliance_denied", "config.compliance_posture", "config.compliance_required", "config.context_settings_unknown_word", "config.credential_in_declaration", "config.credential_ref_invalid", "config.cross_boundary_posture", "config.cwd_conflicts_restore", "config.cwd_not_honored", "config.cwd_outside_root", "config.cwd_unsupported", "config.defer_mode_invalid", "config.delegation_entry_caps", "config.deps_retired_key", "config.egress_requires_write_effect", "config.empty_objective", "config.env_lifetime_invalid", "config.execution_env_home_dir_invalid", "config.extra_body_output_cap", "config.extra_tool_names", "config.host_floor_invalid", "config.host_floor_refused", "config.image_invalid", "config.interaction_posture", "config.interaction_wiring", "config.invalid_argument", "config.invalid_checkpoint_store", "config.invalid_file_history_capture", "config.invalid_file_history_store", "config.invalid_governance_baseline", "config.invalid_on_track_failure", "config.invalid_output_schema", "config.invalid_permission_rules", "config.invalid_task_registry", "config.invalid_tool_name_set", "config.language_invalid", "config.legacy_tool_name", "config.limit_invalid", "config.limit_unknown_key", "config.locked_key", "config.locked_registry", "config.mcp_content_class", "config.mcp_dialable_failed", "config.mcp_fingerprint_invalid", "config.mcp_host_seat_missing", "config.mcp_host_seat_undeclared", "config.mcp_pool_foreign_connection", "config.mcp_probe_option", "config.mcp_server_name_collision", "config.mcp_startup_timeout_invalid", "config.memory_capture_policy", "config.memory_capture_spelling", "config.memory_capture_unsupported", "config.memory_challenge_request", "config.memory_consolidation", "config.memory_consolidation_driver", "config.memory_consolidation_lease_required", "config.memory_consolidation_provenance_off", "config.memory_consolidation_replica_local", "config.memory_consolidation_write_gate", "config.memory_delegation_evidence", "config.memory_dir_not_backend_root", "config.memory_distiller_purity_contract", "config.memory_dual_root_overlap", "config.memory_erasure_request", "config.memory_erasure_scope", "config.memory_export_request", "config.memory_hold_timeout", "config.memory_import_request", "config.memory_persistence_invalid", "config.memory_project_identity", "config.memory_project_key_spelling", "config.memory_project_marker", "config.memory_project_marker_nested", "config.memory_provenance", "config.memory_reanchor", "config.memory_rebuild_reason", "config.memory_scope_key", "config.memory_scope_placement", "config.memory_scope_spelling", "config.memory_sync_cursor_mismatch", "config.memory_sync_store", "config.memory_sync_target_mismatch", "config.memory_write_scope_mismatch", "config.microcompact_invalid", "config.missing_scope", "config.model_fallback_invalid", "config.mods_invalid", "config.nothing_to_wake", "config.output_style_invalid", "config.parent_spec_seat_missing", "config.peer_answer_invalid", "config.peer_presence_invalid", "config.peer_seat_missing", "config.permission_mode_invalid", "config.placement_not_honored", "config.placement_root_invalid", "config.plan_file_invalid", "config.principal_inbox_consumer_invalid", "config.project_id_invalid", "config.project_identity_mismatch", "config.prompt_selector_invalid", "config.prompt_trait_unknown", "config.protocol_endpoint_unbound", "config.protocol_header_collision", "config.protocol_plaintext_credentials", "config.read_deny_floor_unkept", "config.read_face_invalid", "config.read_face_org_task_escalation", "config.read_face_read_block_conflict", "config.read_face_readonly_conflict", "config.read_face_seat", "config.registry_scope_mismatch", "config.reserved_tool_name", "config.retention_capability", "config.retention_policy", "config.retention_policy_invalid", "config.run_origin_invalid", "config.safe_vars_reserved_name", "config.sandbox_admission_unavailable", "config.sandbox_settings_invalid", "config.session_box_floor_mismatch", "config.session_rules_unreadable", "config.session_workspace_changed", "config.session_workspace_invalid", "config.shell_gate_value_retired", "config.skill_base_dir_invalid", "config.skill_deny_unreadable", "config.skill_listing_budget_invalid", "config.spec_member_unreadable", "config.spec_retired_key", "config.spec_unknown_key", "config.stale_tool_result_offload_invalid", "config.stall_timeout_invalid", "config.stall_timeout_retired", "config.store_durability_invalid", "config.store_fidelity_invalid", "config.tool_contract_too_long", "config.tool_face_control", "config.tool_face_invalid", "config.tool_materialize_invalid", "config.tool_materialize_unreachable", "config.tool_model_gate_env_invalid", "config.tool_model_gate_invalid", "config.tool_mount_denied", "config.tool_name_invalid", "config.tool_name_too_long", "config.tool_roster_bound", "config.tool_roster_mount_tag", "config.tool_roster_origin", "config.tool_schema_bound", "config.tool_search_invalid", "config.toolpolicy.unmatched_names", "config.unknown_role", "config.usage_window_invalid", "config.usage_window_unpriced", "config.user_attachment_invalid", "config.user_invoked_skill_unknown", "config.verify_internals_invalid", "config.web_max_bytes_invalid", "config.web_search_max_results_invalid", "config.web_summary_max_content_invalid", "config.web_timeout_invalid", "config.write_exempt_dir_covers_root", "config.write_face_invalid", "config.write_face_org_task_escalation", "config.write_face_readonly_conflict", "resume_at.before_root_unsupported", "resume_at.before_target_not_user", "resume_at.conflicts_resume", "resume_at.invalid_mode", "resume_at.mode_without_target", "resume_at.no_session", "resume_at.not_a_message", "resume_at.not_found", "resume_at.outside_window"];
22
22
  export type ConfigRefusalCode = (typeof CONFIG_REFUSAL_CODES)[number];
23
23
  /**
24
24
  * The CLASS of every `resume_at.*` word the ENGINE throws, declared beside the words — so a client that must decide "is the request still
@@ -8,6 +8,7 @@ export const CONFIG_REFUSAL_CODES = Object.freeze([
8
8
  "config.agent.unknown_model",
9
9
  "config.agent.unknown_tool",
10
10
  "config.agent_config_dir_invalid",
11
+ "config.agent_home_dir_invalid",
11
12
  "config.agents.no_delegation_tool",
12
13
  "config.approval_reach_invalid",
13
14
  "config.attachment_invalid",
@@ -129,6 +130,7 @@ export const CONFIG_REFUSAL_CODES = Object.freeze([
129
130
  "config.read_deny_floor_unkept",
130
131
  "config.read_face_invalid",
131
132
  "config.read_face_org_task_escalation",
133
+ "config.read_face_read_block_conflict",
132
134
  "config.read_face_readonly_conflict",
133
135
  "config.read_face_seat",
134
136
  "config.registry_scope_mismatch",
@@ -37,13 +37,13 @@ export declare const EDIT_FRACTION = 0.7;
37
37
  export declare const CONTEXT_OUTPUT_RESERVE_TOKENS = 20000;
38
38
  export declare const COMPACTION_TRIGGER_BUFFER_TOKENS = 13000;
39
39
  /**
40
- * The clearStale/compaction frontier for a window — SINGLE SOURCE for two coupled points
41
- * (design/64 §26.4 fix 2): the budget at which the request-layer stale-result clearing engages
42
- * ({@link editBudget}) AND the ceiling the compaction threshold is clamped to
43
- * (`sanitizeCompactionSettings`). Deriving both from one function keeps `compaction ≡ clearStale`
44
- * an invariant: a threshold above the clearing frontier would put every request between the two
45
- * points on a moving clearing frontier that breaks the prefix cache (~frontier re-prefilled PER
46
- * REQUEST — the "death band"). `max()` keeps the frontier monotonic in the window; exact
40
+ * The trigger geometry for a window — SINGLE SOURCE for the ceiling the compaction threshold is
41
+ * clamped to (`sanitizeCompactionSettings`) and, on a deployment that opted into frontier clearing
42
+ * (`machine: "cc"`), the budget at which that clearing engages ({@link editBudget}). With clearing
43
+ * opted in, one function keeps `compaction ≡ clearStale` an invariant (design/64 §26.4 fix 2): a
44
+ * threshold above the clearing frontier would put every request between the two points on a moving
45
+ * clearing frontier that breaks the prefix cache (~frontier re-prefilled PER REQUEST — the "death
46
+ * band"). `max()` keeps the frontier monotonic in the window; exact
47
47
  * crossover (integer domain, pinned by test): the fractional floor strictly wins through
48
48
  * W = 109996, the two legs are EQUAL for W = 109997…110000 (floor(0.7W) meets W − 33000 there),
49
49
  * and the fixed deduction strictly wins from W = 110001 up.
@@ -52,12 +52,12 @@ export declare function contextEditFrontier(window: number): number;
52
52
  /**
53
53
  * The `RunnerDeps.microCompact.machine` vocabulary — ONE clearing machine, switchable:
54
54
  *
55
- * - `"cc"` (default): the reference's machine — keep 5, a ≥20000-token minimum-savings gate
56
- * (below it the pass is a byte-identical no-op), ONE deep clear of everything beyond the keep
57
- * window, the window base counts already-cleared/offloaded occurrences (they hold their keep
58
- * slots), and CC's plain marker bytes.
59
- * - `"off"`: no proactive frontier clearing; the machine gets its one shot at the blocking point
60
- * of the guard chain instead (trace trigger `"blocking"`).
55
+ * - `"off"` (default): no proactive frontier clearing; the machine gets its one shot at the blocking
56
+ * point of the guard chain instead (trace trigger `"blocking"`).
57
+ * - `"cc"` (opt-in): the reference's machine run at the frontier as well — keep 5, a ≥20000-token
58
+ * minimum-savings gate (below it the pass is a byte-identical no-op), ONE deep clear of everything
59
+ * beyond the keep window, the window base counts already-cleared/offloaded occurrences (they hold
60
+ * their keep slots), and CC's plain marker bytes.
61
61
  *
62
62
  * WHOLE-MACHINE CROSS-CHECK against the reference corpus (design/374 slice 4 — the "the knob number
63
63
  * was copied, the machine was not" disease is checked by naming the machine's parts, not the one
@@ -80,10 +80,9 @@ export declare function contextEditFrontier(window: number): number;
80
80
  * (cli250.js:58375 `context_hint`; the `tengu_time_based_microcompact` event name is historical, its `trigger`
81
81
  * is the constant `"context_hint"`). Under BYOM there is no such server, so the ask half is
82
82
  * unportable and the refusal half is aligned on wire truth (the MC-R arm classifies the
83
- * provider's own context-overflow refusal) — registered divergence D-3. sema additionally
84
- * keeps a PROACTIVE frontier trigger CC's client does not have, anchored to Anthropic's
85
- * platform context-management policy rather than to CC-CLI — registered divergence D-1, and
86
- * re-stated at {@link clearStaleToolResults}'s ANCHOR paragraph.
83
+ * provider's own context-overflow refusal) — registered divergence D-3. The PROACTIVE frontier
84
+ * trigger CC's client does not have is the `"cc"` opt-in only; the default carries none, as
85
+ * CC's client carries none.
87
86
  *
88
87
  * A closed set (`docs/CLOSED-SETS.md`): the knob door quotes it, so a word outside it is refused by
89
88
  * name rather than folded to the default.
@@ -288,6 +287,22 @@ export interface ClearedProjectionLedger {
288
287
  entries: Map<string, ClearedOccurrence>;
289
288
  }
290
289
  export declare function createClearedProjectionLedger(): ClearedProjectionLedger;
290
+ /** One ledger entry as the session keeps it: the occurrence's coordinates spelled apart (the call id, the message
291
+ * timestamp as the key spells it, the ordinal inside that pair — never the NUL-joined key, which a text column can
292
+ * refuse), the group size, the content fingerprint and the marker bytes. */
293
+ export interface ClearedOccurrenceRecord {
294
+ readonly toolCallId: string;
295
+ readonly at: string;
296
+ readonly ordinal: number;
297
+ readonly groupCount: number;
298
+ readonly fp: OccurrenceFingerprint;
299
+ readonly marker: string;
300
+ }
301
+ /** The ledger as records, in key order (equal ledgers spell equal records). */
302
+ export declare function clearedLedgerRecords(ledger: ClearedProjectionLedger): ClearedOccurrenceRecord[];
303
+ /** A ledger rebuilt from the session's records; undefined when any record does not read as one this module wrote (a marker
304
+ * that is not a cleared marker is never painted). */
305
+ export declare function clearedLedgerFromRecords(records: unknown): ClearedProjectionLedger | undefined;
291
306
  /** One minted occurrence coordinate: the opaque ledger key, the group size at mint, the
292
307
  * INDEXED-view fingerprint, and (when the index can hand it back) the indexed-view occurrence
293
308
  * MESSAGE itself — the durable-composition seat (RB-212 durable half): a ledger-bound clear