@sema-agent/core 7.57.0 → 7.59.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 (399) hide show
  1. package/CHANGELOG.md +1161 -0
  2. package/README.md +6 -4
  3. package/dist/agents/cc-peer-directory.js +8 -8
  4. package/dist/agents/child-model-seat.d.ts +4 -2
  5. package/dist/agents/child-model-seat.js +5 -3
  6. package/dist/agents/peer-directory.d.ts +9 -0
  7. package/dist/agents/peer-directory.js +6 -2
  8. package/dist/agents/send-message-tool.js +21 -12
  9. package/dist/agents/subagent-steps.js +2 -4
  10. package/dist/agents/subagent.js +33 -34
  11. package/dist/brain/anthropic.js +161 -45
  12. package/dist/brain/errors.d.ts +9 -3
  13. package/dist/brain/errors.js +7 -1
  14. package/dist/brain/failover.js +2 -1
  15. package/dist/brain/open-responses.js +3 -3
  16. package/dist/brain/openai.js +103 -53
  17. package/dist/brain/provider-dialect.d.ts +11 -0
  18. package/dist/brain/provider-dialect.js +5 -2
  19. package/dist/brain/reasoning-request.js +5 -4
  20. package/dist/brain/reasoning.d.ts +19 -0
  21. package/dist/brain/reasoning.js +17 -2
  22. package/dist/brain/request-route.d.ts +4 -1
  23. package/dist/brain/request-route.js +4 -1
  24. package/dist/brain/route-adjudicator.d.ts +84 -18
  25. package/dist/brain/route-adjudicator.js +89 -22
  26. package/dist/brain/route-conformance.js +1 -1
  27. package/dist/brain/stream-engine.js +84 -49
  28. package/dist/brain/stream-shared.d.ts +30 -0
  29. package/dist/brain/stream-shared.js +34 -1
  30. package/dist/brain/timeout.d.ts +62 -5
  31. package/dist/brain/timeout.js +93 -6
  32. package/dist/core/a2a.d.ts +2 -1
  33. package/dist/core/a2a.js +23 -10
  34. package/dist/core/account-row.d.ts +61 -0
  35. package/dist/core/account-row.js +51 -0
  36. package/dist/core/advisor-verdict.d.ts +2 -1
  37. package/dist/core/advisor-verdict.js +1 -1
  38. package/dist/core/allow-entry.d.ts +20 -7
  39. package/dist/core/allow-entry.js +18 -9
  40. package/dist/core/approval-object.d.ts +29 -15
  41. package/dist/core/approval-object.js +47 -19
  42. package/dist/core/ask-origin.d.ts +21 -2
  43. package/dist/core/ask-origin.js +5 -1
  44. package/dist/core/auto-compaction.d.ts +4 -0
  45. package/dist/core/auto-compaction.js +2 -2
  46. package/dist/core/auto-mode-directive.d.ts +29 -5
  47. package/dist/core/auto-mode-directive.js +38 -8
  48. package/dist/core/background-agent-store.d.ts +16 -3
  49. package/dist/core/checkpoint-requirements.d.ts +19 -1
  50. package/dist/core/checkpoint-requirements.js +5 -1
  51. package/dist/core/checkpoint-store.d.ts +85 -23
  52. package/dist/core/checkpoint-store.js +31 -9
  53. package/dist/core/child-clamp-seats.d.ts +29 -0
  54. package/dist/core/child-clamp-seats.js +56 -1
  55. package/dist/core/compliance.d.ts +2 -2
  56. package/dist/core/compliance.js +1 -1
  57. package/dist/core/effective-path-target.d.ts +8 -2
  58. package/dist/core/effective-path-target.js +8 -3
  59. package/dist/core/engine-notice.d.ts +99 -9
  60. package/dist/core/engine-notice.js +19 -5
  61. package/dist/core/fs-write-gate-policy.d.ts +4 -2
  62. package/dist/core/fs-write-gate-policy.js +7 -3
  63. package/dist/core/gate-fold.js +7 -4
  64. package/dist/core/gate-lanes.js +19 -6
  65. package/dist/core/gate-outcome.d.ts +32 -3
  66. package/dist/core/gate-outcome.js +19 -1
  67. package/dist/core/git-worktree-env.d.ts +53 -11
  68. package/dist/core/git-worktree-env.js +96 -12
  69. package/dist/core/governance-codes.d.ts +9 -1
  70. package/dist/core/governance-codes.js +13 -0
  71. package/dist/core/hooks.d.ts +35 -4
  72. package/dist/core/hooks.js +17 -11
  73. package/dist/core/human-input-projection.d.ts +1 -0
  74. package/dist/core/human-input-projection.js +3 -0
  75. package/dist/core/image-admission.d.ts +6 -5
  76. package/dist/core/image-admission.js +18 -14
  77. package/dist/core/locked-config.d.ts +20 -3
  78. package/dist/core/locked-config.js +40 -3
  79. package/dist/core/mailbox-store.d.ts +45 -1
  80. package/dist/core/mailbox-store.js +53 -9
  81. package/dist/core/mcp-call-meta.d.ts +66 -0
  82. package/dist/core/mcp-call-meta.js +103 -0
  83. package/dist/core/mcp-connection-pool.d.ts +3 -1
  84. package/dist/core/mcp-connection-pool.js +3 -1
  85. package/dist/core/mcp-failure.d.ts +117 -15
  86. package/dist/core/mcp-failure.js +71 -3
  87. package/dist/core/mcp-probe.d.ts +4 -0
  88. package/dist/core/mcp-probe.js +1 -1
  89. package/dist/core/mcp-server-link.d.ts +27 -3
  90. package/dist/core/mcp-server-link.js +25 -1
  91. package/dist/core/mcp-server-spec.d.ts +46 -18
  92. package/dist/core/mcp-server-spec.js +1 -18
  93. package/dist/core/mcp.d.ts +16 -20
  94. package/dist/core/mcp.js +112 -55
  95. package/dist/core/memory-engine/consolidation-driver.d.ts +2 -4
  96. package/dist/core/memory-engine/consolidation-driver.js +3 -3
  97. package/dist/core/memory-engine/consolidation.d.ts +4 -0
  98. package/dist/core/memory-engine/consolidation.js +1 -0
  99. package/dist/core/memory-engine/delegation-settlement.js +5 -12
  100. package/dist/core/memory-engine/distiller.js +2 -2
  101. package/dist/core/memory-engine/dual-root.d.ts +50 -1
  102. package/dist/core/memory-engine/dual-root.js +44 -1
  103. package/dist/core/memory-engine/engine.d.ts +67 -14
  104. package/dist/core/memory-engine/engine.js +384 -212
  105. package/dist/core/memory-engine/export-bundle.d.ts +23 -0
  106. package/dist/core/memory-engine/export-bundle.js +23 -4
  107. package/dist/core/memory-engine/file-backend.d.ts +128 -55
  108. package/dist/core/memory-engine/file-backend.js +290 -117
  109. package/dist/core/memory-engine/index.d.ts +1 -1
  110. package/dist/core/memory-engine/layout.d.ts +59 -11
  111. package/dist/core/memory-engine/layout.js +190 -40
  112. package/dist/core/memory-engine/memory-backend-contract.d.ts +1 -1
  113. package/dist/core/memory-engine/memory-backend-contract.js +39 -2
  114. package/dist/core/memory-engine/scope-contract.d.ts +45 -4
  115. package/dist/core/memory-engine/scope-contract.js +80 -11
  116. package/dist/core/memory-engine/sync-client.d.ts +9 -1
  117. package/dist/core/memory-engine/sync-client.js +31 -8
  118. package/dist/core/memory-engine/sync.d.ts +5 -0
  119. package/dist/core/memory-engine/types.d.ts +6 -0
  120. package/dist/core/mode-policy.d.ts +8 -5
  121. package/dist/core/mode-policy.js +5 -4
  122. package/dist/core/mods/classic-events.d.ts +5 -1
  123. package/dist/core/mods/host.js +1 -1
  124. package/dist/core/mods/kernel/dispatch.d.ts +3 -0
  125. package/dist/core/mods/kernel/dispatch.js +12 -9
  126. package/dist/core/mods/kernel/events.d.ts +6 -1
  127. package/dist/core/mods/kernel/events.js +2 -2
  128. package/dist/core/mods/kernel/registration.d.ts +9 -1
  129. package/dist/core/mods/kernel/registration.js +3 -0
  130. package/dist/core/mods/kernel/site-rules.d.ts +3 -0
  131. package/dist/core/mods/kernel/site-rules.js +10 -0
  132. package/dist/core/mods/package.d.ts +23 -0
  133. package/dist/core/mods/package.js +118 -0
  134. package/dist/core/mods/stations.d.ts +33 -12
  135. package/dist/core/mods/stations.js +45 -11
  136. package/dist/core/mods/tool-call.d.ts +5 -1
  137. package/dist/core/mods/tool-call.js +13 -4
  138. package/dist/core/parent-spec-seat.d.ts +8 -3
  139. package/dist/core/parent-spec-seat.js +2 -0
  140. package/dist/core/park-selfcheck.js +6 -0
  141. package/dist/core/path-guard-rows.d.ts +20 -0
  142. package/dist/core/path-guard-rows.js +11 -0
  143. package/dist/core/peer-seat.d.ts +248 -0
  144. package/dist/core/peer-seat.js +439 -0
  145. package/dist/core/permission-rule-consent.js +10 -4
  146. package/dist/core/permission-rule-model.d.ts +16 -0
  147. package/dist/core/permission-rule-model.js +1 -1
  148. package/dist/core/present-plan-tool.d.ts +20 -3
  149. package/dist/core/present-plan-tool.js +48 -4
  150. package/dist/core/protocol-http-auth.d.ts +40 -29
  151. package/dist/core/protocol-http-auth.js +30 -32
  152. package/dist/core/redaction-marks.d.ts +16 -0
  153. package/dist/core/redaction-marks.js +16 -0
  154. package/dist/core/redaction-passes.js +8 -9
  155. package/dist/core/resume-startup-cause.js +1 -0
  156. package/dist/core/retention.d.ts +41 -15
  157. package/dist/core/retention.js +59 -12
  158. package/dist/core/rewrite-rejudge.d.ts +38 -0
  159. package/dist/core/rewrite-rejudge.js +42 -2
  160. package/dist/core/roles.d.ts +34 -2
  161. package/dist/core/roles.js +43 -4
  162. package/dist/core/run-origin.d.ts +40 -0
  163. package/dist/core/run-origin.js +37 -0
  164. package/dist/core/runner/advertised-writable-dirs.d.ts +57 -38
  165. package/dist/core/runner/advertised-writable-dirs.js +126 -0
  166. package/dist/core/runner/announce-once-ledger.d.ts +5 -4
  167. package/dist/core/runner/announce-once-ledger.js +4 -2
  168. package/dist/core/runner/call-hook-stations.js +2 -2
  169. package/dist/core/runner/compaction-restate.d.ts +15 -6
  170. package/dist/core/runner/compaction-restate.js +28 -2
  171. package/dist/core/runner/contracts.d.ts +33 -21
  172. package/dist/core/runner/credential-origin-seat.js +4 -3
  173. package/dist/core/runner/cwd-alignment-probe.d.ts +20 -0
  174. package/dist/core/runner/cwd-alignment-probe.js +21 -0
  175. package/dist/core/runner/decide-continuation.d.ts +2 -2
  176. package/dist/core/runner/gate-exit.d.ts +30 -8
  177. package/dist/core/runner/gate-exit.js +15 -8
  178. package/dist/core/runner/image-removed-seat.d.ts +12 -0
  179. package/dist/core/runner/image-removed-seat.js +19 -0
  180. package/dist/core/runner/inline-image.js +1 -1
  181. package/dist/core/runner/memory-consolidation-driver.js +3 -3
  182. package/dist/core/runner/park-commit.d.ts +1 -1
  183. package/dist/core/runner/park-commit.js +3 -0
  184. package/dist/core/runner/prepare-ask-lane.d.ts +1 -1
  185. package/dist/core/runner/prepare-ask-lane.js +2 -1
  186. package/dist/core/runner/prepare-boundary-parks.js +2 -2
  187. package/dist/core/runner/prepare-caps-and-workflow.d.ts +5 -5
  188. package/dist/core/runner/prepare-caps-and-workflow.js +3 -1
  189. package/dist/core/runner/prepare-config-doors.d.ts +8 -5
  190. package/dist/core/runner/prepare-config-doors.js +14 -10
  191. package/dist/core/runner/prepare-context-lane.js +2 -0
  192. package/dist/core/runner/prepare-delegation-surface.d.ts +8 -0
  193. package/dist/core/runner/prepare-delegation-surface.js +16 -18
  194. package/dist/core/runner/prepare-gate-stations.js +1 -1
  195. package/dist/core/runner/prepare-hands-readface.d.ts +11 -3
  196. package/dist/core/runner/prepare-hands-readface.js +9 -1
  197. package/dist/core/runner/prepare-inherited-gate.d.ts +1 -3
  198. package/dist/core/runner/prepare-inherited-gate.js +14 -27
  199. package/dist/core/runner/prepare-memory.d.ts +3 -0
  200. package/dist/core/runner/prepare-memory.js +26 -37
  201. package/dist/core/runner/prepare-park-ask.d.ts +1 -1
  202. package/dist/core/runner/prepare-park-ask.js +2 -1
  203. package/dist/core/runner/prepare-policy-chain.d.ts +7 -7
  204. package/dist/core/runner/prepare-policy-chain.js +18 -15
  205. package/dist/core/runner/prepare-project-context.d.ts +2 -2
  206. package/dist/core/runner/prepare-project-context.js +2 -2
  207. package/dist/core/runner/prepare-prompt-inputs.d.ts +1 -1
  208. package/dist/core/runner/prepare-prompt-inputs.js +8 -19
  209. package/dist/core/runner/prepare-protocol-tools.d.ts +4 -2
  210. package/dist/core/runner/prepare-protocol-tools.js +11 -3
  211. package/dist/core/runner/prepare-run-refs.d.ts +2 -3
  212. package/dist/core/runner/prepare-run-refs.js +4 -1
  213. package/dist/core/runner/prepare-suspend-saga.d.ts +2 -0
  214. package/dist/core/runner/prepare-suspend-saga.js +2 -1
  215. package/dist/core/runner/prepare-task.js +28 -13
  216. package/dist/core/runner/prepare-wiring-manifest.d.ts +2 -1
  217. package/dist/core/runner/prepare-wiring-manifest.js +4 -3
  218. package/dist/core/runner/prepare-workspace-restore.d.ts +3 -0
  219. package/dist/core/runner/prepare-workspace-restore.js +4 -4
  220. package/dist/core/runner/reply-pricing.d.ts +30 -0
  221. package/dist/core/runner/reply-pricing.js +19 -0
  222. package/dist/core/runner/resume-admission.js +5 -3
  223. package/dist/core/runner/resume-apply.js +6 -1
  224. package/dist/core/runner/resume-checkpoint-screen.js +2 -0
  225. package/dist/core/runner/resume-policy-outcome.js +5 -5
  226. package/dist/core/runner/role-seat-defaulted.d.ts +44 -0
  227. package/dist/core/runner/role-seat-defaulted.js +40 -0
  228. package/dist/core/runner/run-brain-sinks.js +2 -0
  229. package/dist/core/runner/run-harness-handlers.d.ts +3 -4
  230. package/dist/core/runner/run-harness-handlers.js +1 -8
  231. package/dist/core/runner/run-identity-wiring.d.ts +2 -5
  232. package/dist/core/runner/run-identity-wiring.js +6 -4
  233. package/dist/core/runner/run-leg.d.ts +2 -0
  234. package/dist/core/runner/run-leg.js +42 -29
  235. package/dist/core/runner/run-notification-lane.js +3 -0
  236. package/dist/core/runner/run-stop-and-final-verify.js +2 -2
  237. package/dist/core/runner/run-terminal-adoption.d.ts +2 -5
  238. package/dist/core/runner/run-terminal-adoption.js +9 -3
  239. package/dist/core/runner/run-turn-boundary.js +77 -70
  240. package/dist/core/runner/runtask.d.ts +1 -1
  241. package/dist/core/runner/runtask.js +2 -2
  242. package/dist/core/runner/side-call-account.d.ts +1 -1
  243. package/dist/core/runner/side-call-account.js +3 -18
  244. package/dist/core/runner/sub-agent-deny-lists.d.ts +24 -0
  245. package/dist/core/runner/sub-agent-deny-lists.js +10 -0
  246. package/dist/core/runner/terminal-account.js +3 -3
  247. package/dist/core/runner/tool-end-body.js +2 -1
  248. package/dist/core/runner/tool-occurrence.d.ts +5 -2
  249. package/dist/core/runner/tool-occurrence.js +4 -3
  250. package/dist/core/runner/turn-attachments.d.ts +26 -22
  251. package/dist/core/runner/turn-attachments.js +24 -26
  252. package/dist/core/runner/write-protection-station.d.ts +8 -2
  253. package/dist/core/runner/write-protection-station.js +2 -0
  254. package/dist/core/runner-deps.d.ts +3 -3
  255. package/dist/core/secret-env.d.ts +32 -2
  256. package/dist/core/secret-env.js +65 -3
  257. package/dist/core/sensitive-path-policy.js +9 -10
  258. package/dist/core/session-log-transfer.d.ts +24 -0
  259. package/dist/core/session-log-transfer.js +166 -0
  260. package/dist/core/session-policy-store.d.ts +3 -1
  261. package/dist/core/session-policy-store.js +13 -9
  262. package/dist/core/session-store.d.ts +86 -24
  263. package/dist/core/session-store.js +162 -24
  264. package/dist/core/session.d.ts +92 -1
  265. package/dist/core/shell-read-silence.js +1 -0
  266. package/dist/core/side-query.d.ts +11 -1
  267. package/dist/core/side-query.js +9 -0
  268. package/dist/core/skill-grant-binding.d.ts +31 -2
  269. package/dist/core/skill-grant-binding.js +31 -1
  270. package/dist/core/skill-grant.d.ts +8 -5
  271. package/dist/core/skill-grant.js +6 -6
  272. package/dist/core/steer-replay.d.ts +4 -2
  273. package/dist/core/steer-replay.js +2 -1
  274. package/dist/core/store-contracts/background-agent-store-contract.js +27 -0
  275. package/dist/core/store-contracts/checkpoint-store-contract.js +20 -2
  276. package/dist/core/store-contracts/mailbox-store-contract.js +31 -1
  277. package/dist/core/store-contracts/session-repo-contract.js +112 -5
  278. package/dist/core/store-contracts/session-store-contract.d.ts +4 -1
  279. package/dist/core/store-contracts/session-store-contract.js +236 -2
  280. package/dist/core/synthetic-read-verdict.js +2 -1
  281. package/dist/core/task-event.d.ts +92 -8
  282. package/dist/core/task-notification.js +16 -10
  283. package/dist/core/task-registry-agent.js +1 -0
  284. package/dist/core/task-registry-shared.d.ts +7 -1
  285. package/dist/core/task-spec.d.ts +49 -1
  286. package/dist/core/task-stream.d.ts +2 -1
  287. package/dist/core/terminal-cause.d.ts +11 -1
  288. package/dist/core/tool-catalog-entries.js +1 -0
  289. package/dist/core/tool-check-reading.d.ts +1 -0
  290. package/dist/core/tool-check-reading.js +3 -3
  291. package/dist/core/tool-policy.d.ts +16 -0
  292. package/dist/core/tool-result-store.d.ts +17 -10
  293. package/dist/core/tool-result-store.js +3 -1
  294. package/dist/core/tool-roster.d.ts +112 -5
  295. package/dist/core/tool-roster.js +42 -1
  296. package/dist/core/tool-spec.d.ts +3 -1
  297. package/dist/core/types.d.ts +3 -3
  298. package/dist/core/types.js +1 -1
  299. package/dist/core/untrusted-egress.d.ts +0 -2
  300. package/dist/core/untrusted-egress.js +10 -14
  301. package/dist/core/user-attachment.js +1 -1
  302. package/dist/core/wiring-manifest.d.ts +18 -6
  303. package/dist/core/wiring-manifest.js +4 -3
  304. package/dist/core/workspace-snapshot.d.ts +44 -0
  305. package/dist/core/workspace-snapshot.js +34 -0
  306. package/dist/core/write-protect.d.ts +43 -3
  307. package/dist/core/write-protect.js +43 -16
  308. package/dist/engine/compaction/compaction.js +29 -3
  309. package/dist/engine/execution-env/node-execution-env.d.ts +4 -3
  310. package/dist/engine/execution-env/node-execution-env.js +24 -23
  311. package/dist/engine/execution-env/symlink-chain.d.ts +7 -5
  312. package/dist/engine/harness/agent-harness.d.ts +30 -2
  313. package/dist/engine/harness/agent-harness.js +43 -12
  314. package/dist/engine/harness/messages.d.ts +3 -1
  315. package/dist/engine/harness/messages.js +3 -2
  316. package/dist/engine/harness/types.d.ts +56 -7
  317. package/dist/engine/harness/types.js +5 -1
  318. package/dist/engine/llm/rejected-images.d.ts +46 -0
  319. package/dist/engine/llm/rejected-images.js +54 -0
  320. package/dist/engine/llm/tool-turns.d.ts +2 -1
  321. package/dist/engine/llm/types.d.ts +30 -10
  322. package/dist/engine/llm/types.js +1 -1
  323. package/dist/engine/loop/agent-loop.d.ts +8 -0
  324. package/dist/engine/loop/agent-loop.js +52 -15
  325. package/dist/engine/loop/types.d.ts +3 -1
  326. package/dist/engine/session/import-validate.js +3 -0
  327. package/dist/engine/session/memory-repo.d.ts +17 -9
  328. package/dist/engine/session/memory-repo.js +44 -34
  329. package/dist/engine/session/path-to-root.d.ts +38 -0
  330. package/dist/engine/session/path-to-root.js +39 -0
  331. package/dist/engine/session/repo-utils.d.ts +22 -4
  332. package/dist/engine/session/repo-utils.js +49 -1
  333. package/dist/engine/session/storage-base.d.ts +10 -1
  334. package/dist/engine/session/storage-base.js +11 -22
  335. package/dist/index.d.ts +29 -16
  336. package/dist/index.js +21 -11
  337. package/dist/internal/harness-types.d.ts +2 -2
  338. package/dist/internal/harness.d.ts +3 -2
  339. package/dist/internal/harness.js +2 -2
  340. package/dist/internal/llm.d.ts +1 -0
  341. package/dist/orchestration/workflow-observe.d.ts +17 -1
  342. package/dist/orchestration/workflow-observe.js +20 -0
  343. package/dist/orchestration/workflow-types.d.ts +32 -7
  344. package/dist/orchestration/workflow.js +739 -489
  345. package/dist/shell/counting-pass.d.ts +50 -0
  346. package/dist/shell/counting-pass.js +502 -0
  347. package/dist/shell/lex.d.ts +4 -2
  348. package/dist/shell/lex.js +93 -34
  349. package/dist/shell/shell-words.d.ts +1 -1
  350. package/dist/shell/shell-words.js +7 -6
  351. package/dist/stores/file/index.d.ts +4 -1
  352. package/dist/stores/file/index.js +4 -1
  353. package/dist/stores/file/mailbox-store.js +6 -10
  354. package/dist/stores/file/session-store.d.ts +15 -8
  355. package/dist/stores/file/session-store.js +28 -13
  356. package/dist/tools/fs/fs-bash.d.ts +6 -0
  357. package/dist/tools/fs/fs-bash.js +6 -3
  358. package/dist/tools/fs/fs-write.d.ts +6 -3
  359. package/dist/tools/fs/fs-write.js +8 -7
  360. package/dist/tools/fs/index.d.ts +3 -0
  361. package/dist/tools/fs/index.js +7 -3
  362. package/dist/tools/fs/program-read-model.d.ts +13 -0
  363. package/dist/tools/fs/program-read-model.js +15 -0
  364. package/dist/tools/fs/program-read-model.rows.js +1 -1
  365. package/dist/tools/fs/read-deny.d.ts +13 -10
  366. package/dist/tools/fs/read-deny.js +25 -5
  367. package/dist/tools/fs/read-floor.d.ts +19 -0
  368. package/dist/tools/fs/read-floor.js +23 -0
  369. package/dist/tools/fs/safety.js +40 -8
  370. package/dist/tools/fs/search.js +6 -24
  371. package/dist/tools/fs/shell-read-check.d.ts +9 -2
  372. package/dist/tools/fs/shell-read-check.js +61 -16
  373. package/dist/tools/fs/shell-read-establish.js +2 -1
  374. package/dist/tools/fs/shell-read-identity.js +1 -1
  375. package/dist/tools/fs/shell-read-judge.d.ts +26 -9
  376. package/dist/tools/fs/shell-read-judge.js +10 -6
  377. package/dist/tools/fs/shell-read-plan.d.ts +6 -1
  378. package/dist/tools/fs/shell-read-plan.js +22 -15
  379. package/dist/tools/fs/shell-read-start.js +1 -0
  380. package/dist/tools/fs/shell-reentry-text.d.ts +15 -1
  381. package/dist/tools/fs/shell-reentry-text.js +25 -3
  382. package/dist/tools/monitor.d.ts +4 -0
  383. package/dist/tools/monitor.js +2 -0
  384. package/dist/tools/worktree.d.ts +42 -15
  385. package/dist/tools/worktree.js +60 -32
  386. package/package.json +5 -2
  387. package/test/export-surface.snapshot.json +149 -1
  388. package/wire-changes/core-stores-sql@7.58.0.json +29 -0
  389. package/wire-changes/core-stores-sql@7.59.0.json +29 -0
  390. package/wire-changes/core@7.58.0.json +2188 -0
  391. package/wire-changes/core@7.59.0.json +2459 -0
  392. package/wire-changes/mods-kernel@7.58.0.json +81 -0
  393. package/wire-changes/mods-kernel@7.59.0.json +29 -0
  394. package/wire-changes/primitives@7.58.0.json +29 -0
  395. package/wire-changes/primitives@7.59.0.json +29 -0
  396. package/dist/primitives/credential-ref.d.ts +0 -89
  397. package/dist/primitives/credential-ref.js +0 -125
  398. package/dist/primitives/index.d.ts +0 -2
  399. package/dist/primitives/index.js +0 -1
@@ -11,10 +11,22 @@ export const PLAN_MODE_SPARSE_DIRECTIVE = `Plan mode still active (see full inst
11
11
  export const PLAN_MODE_NO_EXIT_DIRECTIVE = "Plan mode is active. The user indicated that they do not want you to execute yet -- you MUST NOT make any edits, run any non-readonly tools (including changing configs or making commits), or otherwise make any changes to the system — every such call asks the user first, and is refused where nobody can answer. This supercedes any other instructions you have received. Instead, you should: research and analyze with read-only tools, and when you have formed a concrete plan, give it as your final answer and stop.";
12
12
  export const PLAN_MODE_NO_EXIT_SPARSE_DIRECTIVE = "Plan mode still active (see full instructions earlier in conversation). Read-only: no edits, commits, or config changes. When your plan is ready, give it as your final answer and stop.";
13
13
  export const PLAN_MODE_CHILD_DIRECTIVE = "Plan mode is active. The user indicated that they do not want you to execute yet -- you MUST NOT make any edits, run any non-readonly tools (including changing configs or making commits), or otherwise make any changes to the system — every such call asks the user first, and is refused where nobody can answer. This supercedes any other instructions you have received. Instead, you should: research and analyze with read-only tools, and answer the request comprehensively — your final answer, carrying the plan, goes back to the agent that delegated to you.";
14
+ export const PLAN_MODE_FILE_DIRECTIVE = {
15
+ head: "Plan mode is active. The user indicated that they do not want you to execute yet -- you MUST NOT make any edits (with the exception of the plan file mentioned below), run any non-readonly tools (including changing configs or making commits), or otherwise make any changes to the system — every such call asks the user first, and is refused where nobody can answer. This supercedes any other instructions you have received.\n\n## Plan File Info:\nYour plan file is ",
16
+ tail: `. If it does not exist yet, create your plan there using the Write tool; if it already exists, read it and make incremental edits using the Edit tool. You should build your plan incrementally by writing to or editing this file. NOTE that this is the only file you are allowed to edit - other than this you are only allowed to take READ-ONLY actions.\n\nWhen your plan is ready, call the ${PRESENT_PLAN_TOOL_NAME} tool: it reads the plan from that file and requests approval — never ask for approval via plain text.`,
17
+ };
18
+ export const PLAN_MODE_FILE_SPARSE_DIRECTIVE = {
19
+ head: "Plan mode still active (see full instructions earlier in conversation). Read-only except plan file (",
20
+ tail: `). When your plan is ready, call the ${PRESENT_PLAN_TOOL_NAME} tool — it reads the plan from that file. Never ask about plan approval via plain text.`,
21
+ };
14
22
  export const PLAN_MODE_EXIT_DIRECTIVE = "## Exited Plan Mode\n\nYou have exited plan mode. You can now make edits, run tools, and take actions.";
23
+ export function postureText(text, facts) {
24
+ return typeof text === "string" ? text : `${text.head}${facts.planFile ?? ""}${text.tail}`;
25
+ }
15
26
  const PLAN_CADENCE = { everyTurns: 5, fullEvery: 5, sparse: PLAN_MODE_SPARSE_DIRECTIVE };
16
27
  export const POSTURE_TABLE = Object.freeze([
17
28
  { family: "plan", owedBy: (f) => f.mode === "plan" && f.isChildLeg, frame: PLAN_MODE_CHILD_DIRECTIVE, exit: PLAN_MODE_EXIT_DIRECTIVE, cadence: { ...PLAN_CADENCE, sparse: PLAN_MODE_CHILD_DIRECTIVE } },
29
+ { family: "plan", owedBy: (f) => f.mode === "plan" && f.exitToolMounted && f.planFile !== undefined, frame: PLAN_MODE_FILE_DIRECTIVE, exit: PLAN_MODE_EXIT_DIRECTIVE, cadence: { ...PLAN_CADENCE, sparse: PLAN_MODE_FILE_SPARSE_DIRECTIVE } },
18
30
  { family: "plan", owedBy: (f) => f.mode === "plan" && f.exitToolMounted, frame: PLAN_MODE_DIRECTIVE, exit: PLAN_MODE_EXIT_DIRECTIVE, cadence: PLAN_CADENCE },
19
31
  { family: "plan", owedBy: (f) => f.mode === "plan", frame: PLAN_MODE_NO_EXIT_DIRECTIVE, exit: PLAN_MODE_EXIT_DIRECTIVE, cadence: { ...PLAN_CADENCE, sparse: PLAN_MODE_NO_EXIT_SPARSE_DIRECTIVE } },
20
32
  { family: "auto", owedBy: (f) => f.mode === "bypassPermissions" || (f.mode !== "dontAsk" && f.askEffective === "auto_allow"), frame: BYPASS_POSTURE_DIRECTIVE, exit: BYPASS_POSTURE_EXIT_DIRECTIVE },
@@ -28,15 +40,32 @@ const POSTURE_VOCABULARY = POSTURE_TABLE.flatMap((row) => [
28
40
  [row.exit, { row, exit: true }],
29
41
  ...(row.cadence !== undefined ? [[row.cadence.sparse, { row, exit: false }]] : []),
30
42
  ]);
43
+ function vocabularyLengthAt(rest, text) {
44
+ if (typeof text === "string")
45
+ return rest.startsWith(text) ? text.length : undefined;
46
+ if (!rest.startsWith(text.head))
47
+ return undefined;
48
+ const end = rest.indexOf(text.tail, text.head.length);
49
+ if (end <= text.head.length || rest.slice(text.head.length, end).includes("\n"))
50
+ return undefined;
51
+ return end + text.tail.length;
52
+ }
31
53
  function postureItemsOf(body) {
32
54
  const out = [];
33
55
  let rest = body;
34
56
  while (rest.length > 0) {
35
- const hit = POSTURE_VOCABULARY.find(([text]) => rest === text || rest.startsWith(`${text}\n\n`));
36
- if (hit === undefined)
57
+ let matched;
58
+ for (const [text, item] of POSTURE_VOCABULARY) {
59
+ const length = vocabularyLengthAt(rest, text);
60
+ if (length !== undefined && (length === rest.length || rest.startsWith("\n\n", length))) {
61
+ matched = { item: typeof text === "string" ? item : { ...item, file: rest.slice(text.head.length, length - text.tail.length) }, length };
62
+ break;
63
+ }
64
+ }
65
+ if (matched === undefined)
37
66
  return undefined;
38
- out.push(hit[1]);
39
- rest = rest === hit[0] ? "" : rest.slice(hit[0].length + 2);
67
+ out.push(matched.item);
68
+ rest = matched.length === rest.length ? "" : rest.slice(matched.length + 2);
40
69
  }
41
70
  return out.length > 0 ? out : undefined;
42
71
  }
@@ -54,7 +83,7 @@ export function postureStandingOf(messages, reminderMark) {
54
83
  if (item.exit)
55
84
  standing.delete(item.row.family);
56
85
  else
57
- standing.set(item.row.family, { row: item.row, statements: (standing.get(item.row.family)?.statements ?? 0) + 1, turnsSince: 0 });
86
+ standing.set(item.row.family, { row: item.row, statements: (standing.get(item.row.family)?.statements ?? 0) + 1, turnsSince: 0, ...(item.file !== undefined ? { file: item.file } : {}) });
58
87
  }
59
88
  }
60
89
  }
@@ -70,10 +99,11 @@ export function composePostureFrames(facts, standing) {
70
99
  if (owed === undefined)
71
100
  return frames;
72
101
  const s = standing.get(owed.family);
73
- if (s === undefined || s.row !== owed)
74
- frames.push(owed.frame);
102
+ const fileMoved = s !== undefined && typeof owed.frame !== "string" && s.file !== (facts.planFile ?? "");
103
+ if (s === undefined || s.row !== owed || fileMoved)
104
+ frames.push(postureText(owed.frame, facts));
75
105
  else if (owed.cadence !== undefined && s.turnsSince >= owed.cadence.everyTurns) {
76
- frames.push((s.statements + 1) % owed.cadence.fullEvery === 1 ? owed.frame : owed.cadence.sparse);
106
+ frames.push(postureText((s.statements + 1) % owed.cadence.fullEvery === 1 ? owed.frame : owed.cadence.sparse, facts));
77
107
  }
78
108
  return frames;
79
109
  }
@@ -144,6 +144,19 @@ export interface BackgroundAgentRecord {
144
144
  /** The explicit org WRITE grant that verdict carried; `null` = the org write face was read-only.
145
145
  * Same absent-reads-as-zero rule as {@link admittedOrgScopes} (absent ⇒ `null`). */
146
146
  admittedOrgWriteScope?: string | null;
147
+ /**
148
+ * The tighten-only floor the row's child was BORN under: the clamp table's projection of the spec the spawn built for it
149
+ * (`clampSeatsOf`, both carriers — the parent's clamps that rode it and the definition's own restrictions), the same shape
150
+ * as {@link import("./child-clamp-seats.js").ClampValues}. Written once, by the registration that creates the row
151
+ * (`{}` when nothing was clamped), and never rewritten: a revival builds its spec under the table's fold of THIS floor and
152
+ * the waking caller's own clamps, so whoever wakes the child can narrow it and nobody can widen it. Same reason as the
153
+ * org-admission pair above for why a policy fact rides a lookup-keys-only row: the tier-3 leg rebuilds the spec from the
154
+ * WAKER's mount, so without the row nothing of the spawning run's clamps reaches the revived cycle.
155
+ * ABSENT is not "no floor": a row that states none (written before rows carried it, or by a store that does not keep the
156
+ * member) is not revived — `readClampFloor` reads it as unreadable and both revival doors refuse
157
+ * (`revive.policy_floor_unreadable`). A store persists it verbatim: `{}` reads back as `{}`.
158
+ */
159
+ policyFloor?: import("./child-clamp-seats.js").ClampValues;
147
160
  /** Optimistic-concurrency revision. The writer always CASes with its OWN held rev (design/151
148
161
  * MED-8): a foreign row (stale leftover / another writer) has an unknown rev, so the CAS loses
149
162
  * instead of clobbering. Bumped by the store on every successful `update`. */
@@ -167,9 +180,9 @@ export interface BackgroundAgentRecord {
167
180
  *
168
181
  * Every member is optional on {@link BackgroundAgentRecord} (that is what makes them clearable);
169
182
  * identity, lifecycle, concurrency and GOVERNANCE fields are deliberately absent — a revival
170
- * inherits those. The org-admission freeze (`admittedOrgScopes` / `admittedOrgWriteScope`) is in
171
- * the governance group on purpose: clearing it would hand the next cycle a blank slate, which is
172
- * the widening the freeze exists to prevent.
183
+ * inherits those. The org-admission freeze (`admittedOrgScopes` / `admittedOrgWriteScope`) and the
184
+ * birth floor (`policyFloor`) are in the governance group on purpose: clearing either would hand the
185
+ * next cycle a blank slate, which is the widening each exists to prevent.
173
186
  */
174
187
  export declare const REVIVED_ROW_CLEARED_FIELDS: readonly ["settledAt", "stoppedBy", "completionId", "finalOutput", "finalOutputFull", "error", "errorCode", "errorRetryable", "errorKind", "errorRetryAfterMs", "resultIsPartial", "summary", "recentSteps", "editedFiles", "usage"];
175
188
  /** Erase {@link REVIVED_ROW_CLEARED_FIELDS} from a record a revival is about to write back. */
@@ -6,7 +6,7 @@ import { type StoreFidelity, type Checkpoint, type CheckpointFeature, type Check
6
6
  * had carried beside the one its word now names, and the members added after the table, each a capability a reader
7
7
  * must have. Downstream reads them for display only (`CheckpointError.detail.requires`).
8
8
  */
9
- 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"];
9
+ 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"];
10
10
  export type RequirementWord = (typeof REQUIREMENT_WORDS)[number];
11
11
  /** Runtime twin of {@link RequirementWord}. */
12
12
  export declare function isRequirementWord(word: unknown): word is RequirementWord;
@@ -221,6 +221,9 @@ export declare const CHECKPOINT_STATE_REQUIREMENTS: {
221
221
  readonly legScope: {
222
222
  readonly word: "leg_scope";
223
223
  };
224
+ readonly runOrigin: {
225
+ readonly word: "run_origin";
226
+ };
224
227
  readonly toolCeiling: {
225
228
  readonly word: "tool_ceiling";
226
229
  };
@@ -329,6 +332,9 @@ export declare const PENDING_ACTION_REQUIREMENTS: {
329
332
  readonly engineMounted: {
330
333
  readonly word: "mount_site";
331
334
  };
335
+ readonly declarationDigest: {
336
+ readonly word: "tool_declaration";
337
+ };
332
338
  readonly targets: {
333
339
  readonly word: "approval_targets";
334
340
  };
@@ -362,6 +368,9 @@ export declare const PENDING_ACTION_REQUIREMENTS: {
362
368
  readonly kind: {
363
369
  readonly word: "binding";
364
370
  };
371
+ readonly requestedByCallId: {
372
+ readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
373
+ };
365
374
  };
366
375
  readonly task_done: {
367
376
  readonly kind: {
@@ -591,6 +600,9 @@ export declare const CHECKPOINT_REQUIREMENTS: {
591
600
  readonly legScope: {
592
601
  readonly word: "leg_scope";
593
602
  };
603
+ readonly runOrigin: {
604
+ readonly word: "run_origin";
605
+ };
594
606
  readonly toolCeiling: {
595
607
  readonly word: "tool_ceiling";
596
608
  };
@@ -844,6 +856,9 @@ export declare const CHECKPOINT_REQUIREMENTS: {
844
856
  readonly engineMounted: {
845
857
  readonly word: "mount_site";
846
858
  };
859
+ readonly declarationDigest: {
860
+ readonly word: "tool_declaration";
861
+ };
847
862
  readonly targets: {
848
863
  readonly word: "approval_targets";
849
864
  };
@@ -877,6 +892,9 @@ export declare const CHECKPOINT_REQUIREMENTS: {
877
892
  readonly kind: {
878
893
  readonly word: "binding";
879
894
  };
895
+ readonly requestedByCallId: {
896
+ readonly ignorable: "shown, never decided (card, listing, transcript or reported count): every read of the name renders, carries transcript or counts";
897
+ };
880
898
  };
881
899
  readonly task_done: {
882
900
  readonly kind: {
@@ -36,6 +36,8 @@ export const REQUIREMENT_WORDS = Object.freeze([
36
36
  "cross_boundary",
37
37
  "mount_site",
38
38
  "skill_scopes",
39
+ "run_origin",
40
+ "tool_declaration",
39
41
  ]);
40
42
  export function isRequirementWord(word) {
41
43
  return typeof word === "string" && REQUIREMENT_WORDS.includes(word);
@@ -95,6 +97,7 @@ export const CHECKPOINT_STATE_REQUIREMENTS = {
95
97
  placementRootSessionId: DECISION_READ,
96
98
  externalContentTarget: DECISION_READ,
97
99
  legScope: { word: "leg_scope" },
100
+ runOrigin: { word: "run_origin" },
98
101
  toolCeiling: { word: "tool_ceiling" },
99
102
  toolListsJudged: { word: "tool_lists_judged" },
100
103
  ownToolLists: { word: "own_tool_lists" },
@@ -133,6 +136,7 @@ export const PENDING_ACTION_REQUIREMENTS = {
133
136
  hostTarget: DECISION_READ,
134
137
  names: { word: "call_names" },
135
138
  engineMounted: { word: "mount_site" },
139
+ declarationDigest: { word: "tool_declaration" },
136
140
  targets: { word: "approval_targets" },
137
141
  targetReads: { word: "approval_target_reads" },
138
142
  hasBidiControls: SHOWN,
@@ -141,7 +145,7 @@ export const PENDING_ACTION_REQUIREMENTS = {
141
145
  },
142
146
  resource_limit: { kind: DECISION_READ, reason: DECISION_READ },
143
147
  review: { kind: DECISION_READ },
144
- plan_review: { kind: { word: "binding" } },
148
+ plan_review: { kind: { word: "binding" }, requestedByCallId: SHOWN },
145
149
  task_done: { kind: DECISION_READ },
146
150
  };
147
151
  export const CHECKPOINT_GATE_REQUIREMENTS = {
@@ -13,6 +13,7 @@ import type { SessionPermissionRules } from "./session-policy-store.js";
13
13
  import type { NestedUsageAccum, PermissionMode, ShellGateDoctrine, TaskResult } from "./types.js";
14
14
  import type { ActiveWorktreeSession } from "../internal/harness-types.js";
15
15
  import type { ReopenReason } from "./resume-startup-cause.js";
16
+ import { type RetentionDeclaration } from "./retention.js";
16
17
  /**
17
18
  * design/45 — the **durable-checkpoint** primitive: cross-process / resumable `suspend`/`resume`.
18
19
  *
@@ -317,7 +318,7 @@ export declare const MAX_PENDING_STEER_ENTRIES: number;
317
318
  * loud rejection instead of having its new field silently dropped on the parked leg. Consumers (other
318
319
  * repos' backends) read it to assert they round-trip every field rather than hand-listing their own copy.
319
320
  */
320
- export declare const PENDING_STEER_FROZEN_FIELDS: readonly ["text", "trusted", "actor", "seq", "inputId", "priority"];
321
+ export declare const PENDING_STEER_FROZEN_FIELDS: readonly ["text", "trusted", "actor", "seq", "inputId", "priority", "runOrigin"];
321
322
  /**
322
323
  * design/171 §6.1 — WHO a piece of human input came from, as an attribution label. ONE definition:
323
324
  * the shape lives at its layering-legal home (`engine/llm/types.ts`, where `UserMessage.actor`
@@ -351,6 +352,9 @@ export interface PendingSteerEntry {
351
352
  inputId: string;
352
353
  /** Carried VERBATIM for the serving layer; it does NOT reorder the drain (drain is `seq` order). */
353
354
  priority?: SystemInjectionPriority;
355
+ /** What brought this input, when its host says so ({@link import("./run-origin.js").RunOrigin}): its `human_input` frame
356
+ * reports it, and the newest input a wake hands over states the woken leg's word with it. Attribution only; absent = the host said nothing. */
357
+ runOrigin?: import("./run-origin.js").RunOrigin;
354
358
  }
355
359
  /** design/171 §6.3 — the caller-supplied half of a {@link PendingSteerEntry}: everything except `seq`,
356
360
  * which only the store may mint. `inputId` is optional on the way in (minted when absent). */
@@ -360,6 +364,7 @@ export interface PendingSteerInput {
360
364
  actor?: ActorAssertion;
361
365
  inputId?: string;
362
366
  priority?: SystemInjectionPriority;
367
+ runOrigin?: import("./run-origin.js").RunOrigin;
363
368
  }
364
369
  /** True ONLY for a PLAIN data record (not null / array / class-instance / proxy-with-odd-prototype) — the only
365
370
  * shape we safely digest. Adversarial args (a proxy, a getter that throws) must never crash the mint, so this +
@@ -711,7 +716,8 @@ export type ResumeOutcome = {
711
716
  * trusted/untrusted delivery framing as {@link CheckpointState.pendingSteerQueue}). It rides the resume
712
717
  * continuation's steer tail as its OWN segment, appended AFTER any already-parked queue entry
713
718
  * (X5: both are delivered — the wake message never displaces a parked, undelivered supervisor steer;
714
- * each segment is framed under its own `trusted` semantics, never one merged trust domain). WITHOUT a
719
+ * each segment is framed under its own `trusted` semantics, never one merged trust domain). Under a held
720
+ * `inputId` it is judged by {@link judgeParkedSteerRepeat}: identical ⇒ that entry, once. WITHOUT a
715
721
  * `message`, the checkpoint must already carry a parked steer — a wake with nothing to
716
722
  * deliver is rejected (`wake.nothing_to_deliver`, anti spin-wake). Idempotency rides the existing
717
723
  * resolve CAS: a second wake of the same token loses the CAS (`checkpoint.already_resolved`). */
@@ -872,9 +878,9 @@ export type PendingAction = {
872
878
  * this action against, read off the leg's tool roster at the suspend station — `capabilityId`
873
879
  * (engine-minted over {source, peer, name, contractId}), `contractId`, `shapeDigest`,
874
880
  * `implementationRevision`. With the face below they are the TOOL member of the row's approval object
875
- * (`judgeApprovalObject`): an identity member that differs from the same-name row on the resuming leg, or is missing
876
- * while another is present, is a replacement wearing the name (`resume.tool_contract_mismatch`, a reopen); a face
877
- * that differs vetoes the call (`resume.target_moved`). All four ABSENT ⇒ a pre-identity row: the name alone is bound.
881
+ * (`judgeApprovalObject`): an identity member that differs from the same-name row on the resuming leg is a replacement
882
+ * wearing the name (`resume.tool_contract_mismatch`, a reopen); a face or declaration that differs vetoes the call
883
+ * (`resume.target_moved`). Any of them ABSENT (or the family, or the declaration digest) ⇒ the row binds no tool.
878
884
  */
879
885
  capabilityId?: string;
880
886
  contractId?: string;
@@ -885,7 +891,7 @@ export type PendingAction = {
885
891
  * display `family` + declared `pathTarget` — off the same roster row at the same mint. The pre-CAS resume-edit
886
892
  * recheck has no roster yet; it rebuilds the call face from these (`parkedCallFaceOf`) and judges the edit as
887
893
  * the live gate judged the original (merge-seam H1: without them a caller slot fell to the catalog's slot for
888
- * the NAME). Any member absent ⇒ pre-388 row ⇒ the recheck falls to the catalog, never a widened grant — including #635's resolution members, which a row written before them simply lacks (they then read as their documented defaults).
894
+ * the NAME). Read only on a whole tool member: an absent `pathTarget` (or resolution member) is then the declaration's own silence.
889
895
  */
890
896
  family?: import("./tool-face.js").ToolFamily;
891
897
  pathTarget?: import("./tool-face.js").ToolRosterPathTarget;
@@ -904,6 +910,8 @@ export type PendingAction = {
904
910
  * carries): what the identity members above cannot say (a host-mounted engine definition has the same ones). The pre-CAS
905
911
  * recheck rebuilds the face from the row (`parkedCallFaceOf`); absent ⇒ judged as an ordinary tool. Word `mount_site`. */
906
912
  engineMounted?: true;
913
+ /** The digest of the roster row's DECLARATION members (`toolDeclarationDigestOf`): a live row whose declaration differs vetoes the call (`resume.target_moved`). Word `tool_declaration`. */
914
+ declarationDigest?: string;
907
915
  /** The approval object's TARGETS (`approvalTargetsOf`): per reading of the path slot, where it resolved when the card
908
916
  * was asked; absent ⇒ not judged. A role resolving elsewhere at the execution vetoes the call (`resume.target_moved`). */
909
917
  targets?: import("./approval-object.js").ApprovalTargets;
@@ -959,9 +967,18 @@ export type PendingAction = {
959
967
  * reviews the PLAN, not a tool call — so this arm has no tool fields. Every consumer that reads the
960
968
  * `tool_approval` fields above MUST branch on `kind` FIRST: a `plan_review` checkpoint must never flow into
961
969
  * a `resource_limit`- or `tool_approval`-shaped continuation (a contract test pins this). The plan artifact
962
- * is a PROFILE concern (a REF — design/76 §9); core stores no plan here. */
970
+ * is a PROFILE concern (a REF — design/76 §9); core stores no plan here.
971
+ *
972
+ * `requestedByCallId` is the id of the tool call that ASKED for this pause (the `ExitPlanMode` call for the
973
+ * first-party plan tool): which transcript call carries the plan awaiting a decision, so a card can join the pause to
974
+ * the call that presented it instead of guessing by adjacency. It is PROVENANCE, not a binding — the pause
975
+ * still gates no call, `toolCallId` stays absent on this arm, and nothing on the resume path reads the id. Written
976
+ * once, at the park mint, from the engine-bound call id (a tool cannot name another call's id); the paused
977
+ * cause and the inbox summary echo it. ABSENT for a pause whose requester carried no call id (a revive context,
978
+ * a row a deployment minted itself, a row from an engine before this member). */
963
979
  | {
964
980
  kind: "plan_review";
981
+ requestedByCallId?: string;
965
982
  }
966
983
  /** design/144 §3 (X2) — the NON-GATE arm: nothing pends a decision. The shape of a deployment-minted
967
984
  * PARK checkpoint (approval-timeout park / pure suspend; paired with `gate.kind === "task_done"`, the
@@ -1367,6 +1384,12 @@ export interface CheckpointState {
1367
1384
  * that hands no live seat restores it, so the resume config cannot move the leg's next row. Not {@link Checkpoint.scope}
1368
1385
  * (where THIS row is filed — a resource slice's own declared scope). Absent ⇒ minted before the member: derived as before. */
1369
1386
  legScope?: string;
1387
+ /** The word of the LEG that parked this row ({@link import("./run-origin.js").RunOrigin}: the word of the input that opened
1388
+ * that leg, read once at its config doors), stamped at every mint and continued by a leg a decision resumes (a wake opens
1389
+ * its leg with the input it hands over instead): an approved, resumed leg is still that leg's work. Absent ⇒ the host said
1390
+ * nothing (or the row was minted before the member). Attribution only. A reader that lacks the word would resume the leg with
1391
+ * its origin silently lost. */
1392
+ runOrigin?: import("./run-origin.js").RunOrigin;
1370
1393
  /** The tool-selector layers this LEG was spawned under (`RunInternals.toolCeiling`), stamped at every mint: a resume that hands
1371
1394
  * no live ceiling restores it, so a resumed child can never use a tool its spawning run could not. Absent ⇒ the leg had no
1372
1395
  * ceiling (a root run) or the row was minted before the member. A reader that lacks the word would run the leg unbounded.
@@ -1951,6 +1974,13 @@ export interface CheckpointIndexFacts {
1951
1974
  /** Derive a row's {@link CheckpointIndexFacts}. Pure: reads no clock, writes nothing; the approval card is read
1952
1975
  * through {@link parkedApprovalCardOf} (the one card reading), the tool fields only off a `tool_approval` action. */
1953
1976
  export declare function checkpointIndexFacts(cp: Checkpoint): CheckpointIndexFacts;
1977
+ /**
1978
+ * The ONE reading of {@link PendingAction} `plan_review.requestedByCallId` — the id of the call that asked for a plan
1979
+ * pause. A non-empty string on a `plan_review` pending action; every other kind, an absent member and a damaged value
1980
+ * (a non-string, an empty string) read as `undefined`, so no consumer echoes a value the mint never wrote. The paused
1981
+ * cause and the inbox summary both read it here.
1982
+ */
1983
+ export declare function planReviewRequesterOf(pendingAction: PendingAction): string | undefined;
1954
1984
  /**
1955
1985
  * design/80 assistant-scheduler seam #1: a LIGHTWEIGHT projection of one PENDING
1956
1986
  * checkpoint, returned in bulk by {@link CheckpointStore.listByScope} so a supervisor scheduler can list a
@@ -2003,6 +2033,11 @@ export interface CheckpointSummary {
2003
2033
  * face) must not materialize the keys as `null` on the way out. Pinned in
2004
2034
  * `test/checkpoint-store.test.ts` ("tool-less park …"). */
2005
2035
  toolCallId?: string;
2036
+ /** The id of the tool call that asked for this plan pause ({@link PendingAction} `plan_review.requestedByCallId`) —
2037
+ * present ONLY on a `plan_review` row whose requester carried a call id; OMITTED on every other row (the
2038
+ * {@link toolCallId} absence-shape note applies). It names the call that PRESENTED the plan, not a call the pause
2039
+ * gates: `toolCallId` stays omitted on a plan_review row. */
2040
+ requestedByCallId?: string;
2006
2041
  /** The pending tool's name ({@link PendingAction} `tool_approval.toolName`) when this is an approval suspend.
2007
2042
  * OMITTED (not `null`) for a non-`tool_approval` pendingAction — see {@link toolCallId}'s absence-shape note. */
2008
2043
  toolName?: string;
@@ -2098,6 +2133,11 @@ export interface CheckpointSummary {
2098
2133
  * value is a member of the closed set ({@link import("./ask-origin.js").isAskOrigin}) — a bad value
2099
2134
  * reads as absent, never as a word. OMITTED when the row carries none (a pre-existing row). */
2100
2135
  origin?: import("./ask-origin.js").AskOrigin;
2136
+ /** What opened the leg that parked this row — the row's `state.runOrigin` (`"scheduled"`: the deployment's scheduler, not a
2137
+ * person submitting just now), for every gate kind, so an inbox shows it in the one listing call. Echoed only as a member of
2138
+ * {@link import("./run-origin.js").RUN_ORIGINS} (the resume's screen refuses any other value loudly; this projection never
2139
+ * invents one). OMITTED when the row carries none. ECHO-ONLY: attribution, never a gate input. */
2140
+ runOrigin?: import("./run-origin.js").RunOrigin;
2101
2141
  /**
2102
2142
  * PRESENCE ONLY — this pending `tool_approval` row's payload carries at least one DIRECTIONAL
2103
2143
  * format control (the {@link import("./tool-policy.js").AskRequest.hasBidiControls} character class;
@@ -2159,7 +2199,9 @@ export declare function summarizeCheckpoint(cp: Checkpoint, disclose?: (sentence
2159
2199
  * worker), `"env_factory_missing"` (retryable on a factory-wired worker),
2160
2200
  * `"governed_unwired"` (retryable on an org-wired worker), `"origin_missing"` (a pending approval row
2161
2201
  * minted before the ask's origin was persisted on the park — terminal for the row's bytes; the host
2162
- * decides the orphaned card itself, no worker version redeems it), `"ledger_event_unknown"` (a durable
2202
+ * decides the orphaned card itself, no worker version redeems it), `"tool_identity_missing"` (a pending approval row
2203
+ * whose tool member is not whole — parked before 7.58.0 recorded the declaration, or damaged: an allow is refused, a deny
2204
+ * settles it; a worker of the release that parked it still reads it), `"ledger_event_unknown"` (a durable
2163
2205
  * LEDGER carries an event kind this binary does not know, so the replay is refused rather than served
2164
2206
  * incomplete — the one arm that is not row-scoped: NO row in that data directory is readable here, so
2165
2207
  * the host rolls the binary forward instead of routing one token elsewhere), `"seat_retired"` (the row
@@ -2167,10 +2209,14 @@ export declare function summarizeCheckpoint(cp: Checkpoint, disclose?: (sentence
2167
2209
  * steer seat, which no worker version reads and the host decides itself, or a retired mode-seed member of
2168
2210
  * `inheritedGate`, which an engine at 7.38.x or earlier still reads once).
2169
2211
  * · `invalid_outcome` pre-CAS row-integrity arms: `"real_approval_damaged"`, `"real_approval_forged"`,
2170
- * `"read_face_damaged"`, `"read_face_forged"`, `"write_face_damaged"`, `"skill_grants_damaged"`, `"skill_scopes_damaged"`, `"constraint_chain_missing"`, `"hands_coordinates_damaged"`, `"requirements_damaged"` (all terminal for the row's
2212
+ * `"read_face_damaged"`, `"read_face_forged"`, `"write_face_damaged"`, `"skill_grants_damaged"`, `"skill_scopes_damaged"`, `"constraint_chain_missing"`, `"hands_coordinates_damaged"`, `"requirements_damaged"`, `"bound_input_hash_missing"` (all terminal for the row's
2171
2213
  * current bytes — no worker version redeems a damaged row).
2214
+ *
2215
+ * THE ONE RULE for `checkpoint.invalid_outcome` (registered in `docs/CLOSED-SETS.md`, which also says what a host reads from it): `detail.reason` is a
2216
+ * ROW-INTEGRITY word and only that, `detail.field` ({@link CheckpointErrorField}) names the cell of the decision to act on, a refusal carries at most
2217
+ * one of them, and a refusal with neither is never a damaged row.
2172
2218
  */
2173
- export type CheckpointErrorReason = "version_newer" | "env_factory_missing" | "governed_unwired" | "origin_missing" | "ledger_event_unknown" | "seat_retired" | "real_approval_damaged" | "real_approval_forged" | "read_face_damaged" | "read_face_forged"
2219
+ export type CheckpointErrorReason = "version_newer" | "env_factory_missing" | "governed_unwired" | "origin_missing" | "tool_identity_missing" | "ledger_event_unknown" | "seat_retired" | "real_approval_damaged" | "real_approval_forged" | "read_face_damaged" | "read_face_forged"
2174
2220
  /** `state.writeFace` is present but not a well-formed section. No `_forged` twin: the section is
2175
2221
  * legal-and-absent at every version, so there is no version to judge a fabrication against — and a
2176
2222
  * fabricated "open" still needs the LIVE resolution to say open too. */
@@ -2183,6 +2229,10 @@ export type CheckpointErrorReason = "version_newer" | "env_factory_missing" | "g
2183
2229
  * is present below v10, or does not equal the words the row's content carries (a segment dropped, or a word not
2184
2230
  * declared) — terminal for the row's bytes. */
2185
2231
  | "requirements_damaged"
2232
+ /** A pending tool approval whose row format is at or above the binding era carries no persisted `boundInputHash` — every mint at that
2233
+ * version writes one, so its absence is corruption or a caller-declared downgrade, and the decision-action input binding has nothing to
2234
+ * bind to. Terminal for the row's bytes (a pre-binding row, which never minted a hash, binds on `boundCallId` alone and is not this). */
2235
+ | "bound_input_hash_missing"
2186
2236
  /** On `resume.parent_constraint_mismatch`: a re-supplied chain entry whose path rules depend on the leg that installed it has
2187
2237
  * no installation record (a chain written before the record existed) / a record that does not cover the chain entry for
2188
2238
  * entry / a record member naming no absolute root. */
@@ -2216,12 +2266,12 @@ export type CheckpointErrorReason = "version_newer" | "env_factory_missing" | "g
2216
2266
  * a skill's `baseDir` by its own reader, `config.skill_base_dir_invalid`). A door not entered here (the leg's model, its rebuilt
2217
2267
  * roster, its answer face, the approval seat's value) still refuses after the claim, each for a stated reason (INTEGRATION-CORE, "A resume's two doors").
2218
2268
  */
2219
- export declare const CHECKPOINT_CONFIG_REFUSAL_CODES: readonly ["config.spec_retired_key", "config.output_style_invalid", "config.permission_mode_invalid", "config.shell_gate_value_retired", "config.approval_reach_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"];
2269
+ export declare const CHECKPOINT_CONFIG_REFUSAL_CODES: readonly ["config.spec_retired_key", "config.output_style_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"];
2220
2270
  export type CheckpointConfigRefusalCode = (typeof CHECKPOINT_CONFIG_REFUSAL_CODES)[number];
2221
2271
  export declare const isCheckpointConfigRefusalCode: (word: unknown) => word is CheckpointConfigRefusalCode;
2222
2272
  /** 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
2223
2273
  * `docs/CLOSED-SETS.md`: a consumer holding a table over it is tsc-red on a new word until it places the word. */
2224
- export type CheckpointErrorField = "boundCallId" | "boundInputHash" | "boundGrantDigest" | "answer" | "hostDecision" | "approver" | "feedback" | "taskConfig" | "deps" | "inheritedGate";
2274
+ export type CheckpointErrorField = "boundCallId" | "boundInputHash" | "boundGrantDigest" | "answer" | "hostDecision" | "approver" | "feedback" | "outcome" | "updatedInput" | "decision" | "reason" | "taskConfig" | "deps" | "inheritedGate";
2225
2275
  /** A typed checkpoint-store error so callers branch on `code` (mirrors `SessionError`). */
2226
2276
  export declare class CheckpointError extends Error {
2227
2277
  readonly code: "checkpoint.already_exists" | "checkpoint.already_resolved" | "checkpoint.not_found"
@@ -2404,7 +2454,10 @@ export declare class CheckpointError extends Error {
2404
2454
  * resolve, or try to supply the minted record), or — design/252 G-7 — `"approver"` (the attribution is not a
2405
2455
  * well-formed identifier: re-decide with a plain, bounded, control-character-free string, or omit
2406
2456
  * it), or `"feedback"` (the allow's `feedback` is not fit to deliver — it carries the engine's `<system-reminder>` tag, is not a string, rides a deny,
2407
- * or rides a decide a machine made: re-decide with the words changed or dropped; the binding did not change). On a `checkpoint.config_refused` `field` names which INPUT carries the refusal — `"taskConfig"`
2457
+ * or rides a decide a machine made: re-decide with the words changed or dropped; the binding did not change), or — an approval decide's own
2458
+ * payload — `"outcome"` (the resume's outcome is not an object naming its gate: send one), `"updatedInput"` (the person's edit is not plain JSON data the
2459
+ * engine can capture: re-decide with a plain edit, or without one), `"decision"` (the verdict word is neither `allow` nor `deny`) or `"reason"` (the deny's
2460
+ * words are not a plain string, or carry the engine's `<system-reminder>` tag: change or drop them; the binding did not change). On a `checkpoint.config_refused` `field` names which INPUT carries the refusal — `"taskConfig"`
2408
2461
  * (the re-supplied config: correct it and resume the same token), `"deps"` (the deployment's own seat — and the policies the
2409
2462
  * caller re-supplies as inherited constraints: correct them and resume the same token) or `"inheritedGate"` (the row's record: no config reaches it; expire the row). The throw
2410
2463
  * sites always knew which arm fired; this carries that fact instead of dropping it (ruled
@@ -2617,7 +2670,10 @@ export declare class CheckpointError extends Error {
2617
2670
  * resolve, or try to supply the minted record), or — design/252 G-7 — `"approver"` (the attribution is not a
2618
2671
  * well-formed identifier: re-decide with a plain, bounded, control-character-free string, or omit
2619
2672
  * it), or `"feedback"` (the allow's `feedback` is not fit to deliver — it carries the engine's `<system-reminder>` tag, is not a string, rides a deny,
2620
- * or rides a decide a machine made: re-decide with the words changed or dropped; the binding did not change). On a `checkpoint.config_refused` `field` names which INPUT carries the refusal — `"taskConfig"`
2673
+ * or rides a decide a machine made: re-decide with the words changed or dropped; the binding did not change), or — an approval decide's own
2674
+ * payload — `"outcome"` (the resume's outcome is not an object naming its gate: send one), `"updatedInput"` (the person's edit is not plain JSON data the
2675
+ * engine can capture: re-decide with a plain edit, or without one), `"decision"` (the verdict word is neither `allow` nor `deny`) or `"reason"` (the deny's
2676
+ * words are not a plain string, or carry the engine's `<system-reminder>` tag: change or drop them; the binding did not change). On a `checkpoint.config_refused` `field` names which INPUT carries the refusal — `"taskConfig"`
2621
2677
  * (the re-supplied config: correct it and resume the same token), `"deps"` (the deployment's own seat — and the policies the
2622
2678
  * caller re-supplies as inherited constraints: correct them and resume the same token) or `"inheritedGate"` (the row's record: no config reaches it; expire the row). The throw
2623
2679
  * sites always knew which arm fired; this carries that fact instead of dropping it (ruled
@@ -2750,13 +2806,12 @@ export declare function encodeAtFidelity(fidelity: StoreFidelity, value: unknown
2750
2806
  };
2751
2807
  export interface CheckpointStore {
2752
2808
  /**
2753
- * Managed-retention declaration (ruled 2026-08-05, retention.ts): `"managed"` promises the
2754
- * `ManagedRetentionCapability` contract — including the reap/unpin gap this interface documents on
2755
- * {@link reap} (a managed store's scheduled expiry DOES release the session pins). `"none"` (or
2756
- * ABSENT — read fail-closed as `"none"`) states the store cannot delete on schedule; a deployment
2757
- * with a LOCKED retention policy refuses to start over it. Declaration, never duck-typing.
2809
+ * Managed-retention declaration (retention.ts), stated by the party that runs the sweep: `"managed"` says this store's
2810
+ * rows are deleted on schedule by the deployment — an executor runs over them, closing the reap/unpin gap documented on
2811
+ * {@link reap} (its scheduled expiry DOES release the session pins). `"none"` (or ABSENT — read fail-closed as `"none"`)
2812
+ * says nothing deletes them on schedule; a deployment with a LOCKED retention policy refuses to start over it.
2758
2813
  */
2759
- readonly retention?: import("./retention.js").RetentionDeclaration;
2814
+ readonly retention?: RetentionDeclaration;
2760
2815
  /**
2761
2816
  * design/173 §2.3 — durability declaration (see {@link StoreDurability}): whether checkpoints
2762
2817
  * this store accepts survive a process restart. Same "declaration, never duck-typing" posture as
@@ -3124,6 +3179,12 @@ export declare const ACTOR_ASSERTION_FROZEN_FIELDS: readonly ["id", "hostAsserte
3124
3179
  * on its own surface and parks it again through `setPendingSteer` if it still applies.
3125
3180
  */
3126
3181
  export declare function readPendingSteerQueue(state: Pick<CheckpointState, "pendingSteerQueue">): PendingSteerEntry[];
3182
+ /**
3183
+ * The parked queue's ONE identity judgment (the append below and the wake entrance read it): the held entry
3184
+ * when `entry` repeats it identically (the replay), `undefined` for a new `inputId`, else
3185
+ * `steering.duplicate_input_id` naming the facets that differ — the key alone is no proof of a replay.
3186
+ */
3187
+ export declare function judgeParkedSteerRepeat(queue: readonly PendingSteerEntry[], entry: Omit<PendingSteerEntry, "seq">): PendingSteerEntry | undefined;
3127
3188
  /**
3128
3189
  * design/171 §5.3/§6.3 — THE append, shared by every backend so the bounds and the ordering are one
3129
3190
  * implementation rather than one per store.
@@ -3166,9 +3227,9 @@ export type CheckpointFaultMode =
3166
3227
  * {@link testInjectFault} simulates the crash-recovery races a real backend must survive.
3167
3228
  */
3168
3229
  export declare class InMemoryCheckpointStore implements CheckpointStore {
3169
- /** In-memory rows die with the process, but there is no scheduled tenant-scoped deletion contract
3170
- * here — honestly `"none"` (a locked retention policy must refuse this store). */
3171
- readonly retention: "none";
3230
+ /** Managed-retention declaration (retention.ts) — the `retention` option (default `"none"`, a third word refused), stated by
3231
+ * the party that runs the sweep. In-memory rows die with the process, which is not a schedule. */
3232
+ readonly retention: RetentionDeclaration;
3172
3233
  /** design/173 §2.3 — honest declaration: in-memory rows die with the process. */
3173
3234
  readonly durability: "process-local";
3174
3235
  /** Honest declaration on the fidelity axis: `put`/`get` are `structuredClone`, so a row keeps the
@@ -3197,6 +3258,7 @@ export declare class InMemoryCheckpointStore implements CheckpointStore {
3197
3258
  readonly owner: string | null;
3198
3259
  } | undefined>;
3199
3260
  holderIsCurrent?: HolderJudge;
3261
+ retention?: RetentionDeclaration;
3200
3262
  });
3201
3263
  put(token: CheckpointToken, cp: Checkpoint): Promise<void>;
3202
3264
  get(token: CheckpointToken): Promise<Checkpoint | null>;