@sema-agent/core 7.67.3 → 7.68.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 (496) hide show
  1. package/CHANGELOG.md +1516 -0
  2. package/README.md +18 -9
  3. package/README.zh-CN.md +16 -8
  4. package/dist/agents/agent-definition.d.ts +1 -1
  5. package/dist/agents/agent-definition.js +4 -1
  6. package/dist/agents/cascade.d.ts +2 -2
  7. package/dist/agents/cascade.js +3 -1
  8. package/dist/agents/cumulative-stats.d.ts +2 -1
  9. package/dist/agents/cumulative-stats.js +4 -1
  10. package/dist/agents/list-agents-tool.d.ts +30 -0
  11. package/dist/agents/list-agents-tool.js +45 -3
  12. package/dist/agents/peer-admission.d.ts +2 -2
  13. package/dist/agents/peer-session-drain.d.ts +2 -0
  14. package/dist/agents/peer-session-drain.js +1 -0
  15. package/dist/agents/repair-loop.js +3 -1
  16. package/dist/agents/retain-ledger.d.ts +61 -8
  17. package/dist/agents/retain-ledger.js +25 -3
  18. package/dist/agents/roster-store.d.ts +4 -2
  19. package/dist/agents/send-message-tool.d.ts +1 -1
  20. package/dist/agents/send-message-tool.js +20 -15
  21. package/dist/agents/subagent-steps.js +2 -10
  22. package/dist/agents/subagent.d.ts +3 -0
  23. package/dist/agents/subagent.js +106 -76
  24. package/dist/agents/tool-filter.d.ts +20 -11
  25. package/dist/agents/tool-filter.js +8 -4
  26. package/dist/agents/verify.d.ts +3 -1
  27. package/dist/agents/verify.js +2 -0
  28. package/dist/brain/anthropic.js +4 -4
  29. package/dist/brain/open-responses.js +3 -1
  30. package/dist/brain/openai.js +3 -1
  31. package/dist/brain/reasoning-request.d.ts +73 -19
  32. package/dist/brain/reasoning-request.js +164 -72
  33. package/dist/brain/reasoning-stamp.d.ts +26 -0
  34. package/dist/brain/reasoning-stamp.js +10 -0
  35. package/dist/brain/reasoning.d.ts +95 -162
  36. package/dist/brain/reasoning.js +31 -86
  37. package/dist/brain/route-adjudicator.d.ts +9 -7
  38. package/dist/brain/route-adjudicator.js +12 -10
  39. package/dist/brain/status-sink.d.ts +19 -64
  40. package/dist/brain/status-sink.js +5 -21
  41. package/dist/brain/stream-engine.d.ts +11 -2
  42. package/dist/brain/stream-engine.js +10 -0
  43. package/dist/core/a2a.d.ts +17 -5
  44. package/dist/core/a2a.js +11 -3
  45. package/dist/core/allow-entry.d.ts +35 -15
  46. package/dist/core/allow-entry.js +47 -60
  47. package/dist/core/ask-headline.d.ts +68 -0
  48. package/dist/core/ask-headline.js +23 -0
  49. package/dist/core/ask-origin.d.ts +36 -8
  50. package/dist/core/ask-origin.js +17 -10
  51. package/dist/core/ask-question.d.ts +34 -7
  52. package/dist/core/ask-question.js +10 -1
  53. package/dist/core/ask-unresolvable-notice.d.ts +7 -0
  54. package/dist/core/ask-unresolvable-notice.js +9 -3
  55. package/dist/core/auto-strip.d.ts +53 -0
  56. package/dist/core/auto-strip.js +76 -0
  57. package/dist/core/background-agent-store.d.ts +45 -5
  58. package/dist/core/background-agent-store.js +69 -15
  59. package/dist/core/background-shell.d.ts +2 -2
  60. package/dist/core/caller-text.js +2 -2
  61. package/dist/core/canonical-json.d.ts +13 -0
  62. package/dist/core/canonical-json.js +7 -0
  63. package/dist/core/checkpoint-features.d.ts +66 -20
  64. package/dist/core/checkpoint-features.js +12 -1
  65. package/dist/core/checkpoint-generation.d.ts +1 -1
  66. package/dist/core/checkpoint-queries.d.ts +1 -1
  67. package/dist/core/checkpoint-queries.js +4 -1
  68. package/dist/core/checkpoint-requirements.d.ts +25 -1
  69. package/dist/core/checkpoint-requirements.js +5 -1
  70. package/dist/core/checkpoint-row-verdict.d.ts +1 -0
  71. package/dist/core/checkpoint-row-verdict.js +4 -0
  72. package/dist/core/checkpoint-store.d.ts +66 -38
  73. package/dist/core/checkpoint-store.js +15 -6
  74. package/dist/core/child-clamp-seats.d.ts +6 -0
  75. package/dist/core/child-clamp-seats.js +1 -0
  76. package/dist/core/config-refusal-codes.d.ts +1 -1
  77. package/dist/core/config-refusal-codes.js +1 -0
  78. package/dist/core/delegation-frames.d.ts +9 -12
  79. package/dist/core/delegation-frames.js +9 -8
  80. package/dist/core/engine-capabilities.d.ts +21 -8
  81. package/dist/core/engine-capabilities.js +1 -1
  82. package/dist/core/engine-notice.d.ts +147 -34
  83. package/dist/core/engine-notice.js +27 -16
  84. package/dist/core/engine-storage-backend.d.ts +2 -1
  85. package/dist/core/env-budget.js +3 -3
  86. package/dist/core/env-knob-announce.d.ts +10 -10
  87. package/dist/core/env-knob-announce.js +3 -6
  88. package/dist/core/file-history-store.d.ts +29 -4
  89. package/dist/core/file-history-store.js +13 -0
  90. package/dist/core/frame-settlement.d.ts +2 -1
  91. package/dist/core/gate-fold.js +1 -1
  92. package/dist/core/gate-lanes.js +56 -49
  93. package/dist/core/governance-codes.d.ts +39 -3
  94. package/dist/core/governance-codes.js +61 -3
  95. package/dist/core/hooks.d.ts +29 -11
  96. package/dist/core/hooks.js +5 -2
  97. package/dist/core/human-input-projection.js +3 -3
  98. package/dist/core/input-author.d.ts +17 -3
  99. package/dist/core/input-author.js +15 -3
  100. package/dist/core/leg-identity.d.ts +10 -28
  101. package/dist/core/leg-identity.js +1 -21
  102. package/dist/core/lsp.d.ts +18 -13
  103. package/dist/core/lsp.js +30 -22
  104. package/dist/core/mailbox-store.d.ts +1 -1
  105. package/dist/core/mailbox-store.js +4 -4
  106. package/dist/core/mcp-connection-pool.d.ts +93 -4
  107. package/dist/core/mcp-connection-pool.js +104 -1
  108. package/dist/core/mcp-failure.d.ts +38 -12
  109. package/dist/core/mcp-failure.js +9 -13
  110. package/dist/core/mcp-probe.d.ts +4 -3
  111. package/dist/core/mcp-server-link.d.ts +4 -2
  112. package/dist/core/mcp-server-link.js +4 -5
  113. package/dist/core/mcp-server-spec.d.ts +3 -3
  114. package/dist/core/mcp-server-unavailable-notice.d.ts +22 -8
  115. package/dist/core/mcp-server-unavailable-notice.js +18 -4
  116. package/dist/core/mcp.d.ts +40 -6
  117. package/dist/core/mcp.js +39 -13
  118. package/dist/core/memory-engine/content-origin.js +2 -2
  119. package/dist/core/memory-engine/control-objects.d.ts +2 -4
  120. package/dist/core/memory-engine/control-objects.js +2 -10
  121. package/dist/core/memory-engine/delegation-settlement.js +6 -1
  122. package/dist/core/memory-engine/dual-root.js +3 -0
  123. package/dist/core/memory-engine/engine.d.ts +6 -4
  124. package/dist/core/memory-engine/engine.js +32 -29
  125. package/dist/core/memory-engine/file-backend.d.ts +20 -5
  126. package/dist/core/memory-engine/file-backend.js +21 -31
  127. package/dist/core/memory-engine/frontmatter.d.ts +2 -0
  128. package/dist/core/memory-engine/frontmatter.js +4 -0
  129. package/dist/core/memory-engine/layout.d.ts +114 -20
  130. package/dist/core/memory-engine/layout.js +340 -22
  131. package/dist/core/memory-engine/memory-deployment.d.ts +7 -5
  132. package/dist/core/memory-engine/mount-failed-notice.d.ts +19 -7
  133. package/dist/core/memory-engine/mount-failed-notice.js +43 -10
  134. package/dist/core/memory-engine/sync-client.js +4 -5
  135. package/dist/core/model-fallbacks.d.ts +5 -1
  136. package/dist/core/model-fallbacks.js +3 -3
  137. package/dist/core/model-receipt.d.ts +2 -1
  138. package/dist/core/model-receipt.js +12 -1
  139. package/dist/core/mods/kernel/dispatch.d.ts +2 -2
  140. package/dist/core/mods/kernel/dispatch.js +14 -6
  141. package/dist/core/mods/kernel/events.d.ts +8 -5
  142. package/dist/core/mods/kernel/events.js +2 -2
  143. package/dist/core/mods/kernel/index.d.ts +1 -1
  144. package/dist/core/mods/kernel/registration.d.ts +9 -0
  145. package/dist/core/mods/package.js +1 -1
  146. package/dist/core/mods/session-append.d.ts +4 -2
  147. package/dist/core/mods/session-append.js +3 -0
  148. package/dist/core/mods/stations.d.ts +7 -11
  149. package/dist/core/mods/stations.js +4 -7
  150. package/dist/core/mods/tool-call.d.ts +10 -8
  151. package/dist/core/mods/tool-call.js +15 -18
  152. package/dist/core/mounted-mcp.d.ts +0 -4
  153. package/dist/core/mounted-mcp.js +1 -1
  154. package/dist/core/park-noun.d.ts +24 -0
  155. package/dist/core/park-noun.js +21 -0
  156. package/dist/core/park-resumability.d.ts +60 -0
  157. package/dist/core/park-resumability.js +30 -0
  158. package/dist/core/permission-rule-provider.d.ts +24 -2
  159. package/dist/core/permission-rule-provider.js +11 -8
  160. package/dist/core/permission-rule-store.d.ts +8 -1
  161. package/dist/core/permission-rule-store.js +2 -3
  162. package/dist/core/permission-rules.d.ts +2 -1
  163. package/dist/core/permission-rules.js +8 -4
  164. package/dist/core/persisted-rule-arms.d.ts +3 -0
  165. package/dist/core/persisted-rule-arms.js +2 -1
  166. package/dist/core/present-plan-tool.d.ts +47 -3
  167. package/dist/core/present-plan-tool.js +62 -4
  168. package/dist/core/principal-name.d.ts +1 -1
  169. package/dist/core/principal-name.js +5 -5
  170. package/dist/core/process-identity.js +10 -5
  171. package/dist/core/protocol-http-auth.d.ts +20 -14
  172. package/dist/core/protocol-http-auth.js +70 -50
  173. package/dist/core/read-only-shell.js +9 -5
  174. package/dist/core/redaction-marks.d.ts +4 -26
  175. package/dist/core/redaction-marks.js +9 -21
  176. package/dist/core/remote-env.d.ts +43 -16
  177. package/dist/core/remote-env.js +1 -1
  178. package/dist/core/request-copy-projection.d.ts +1 -1
  179. package/dist/core/request-copy-projection.js +40 -50
  180. package/dist/core/resume-config-judge.js +1 -1
  181. package/dist/core/resume-startup-cause.d.ts +35 -18
  182. package/dist/core/resume-startup-cause.js +13 -10
  183. package/dist/core/retention.d.ts +167 -25
  184. package/dist/core/retention.js +100 -20
  185. package/dist/core/roles.d.ts +6 -0
  186. package/dist/core/roles.js +11 -5
  187. package/dist/core/rule-lane-reads.d.ts +3 -0
  188. package/dist/core/rule-lane-reads.js +5 -1
  189. package/dist/core/rule-store-fault.d.ts +70 -0
  190. package/dist/core/rule-store-fault.js +102 -0
  191. package/dist/core/runner/advertised-writable-dirs.js +16 -31
  192. package/dist/core/runner/announce-once-ledger.d.ts +19 -2
  193. package/dist/core/runner/announce-once-ledger.js +24 -2
  194. package/dist/core/runner/assemble-result.d.ts +6 -0
  195. package/dist/core/runner/assemble-result.js +1 -1
  196. package/dist/core/runner/auto-strip-notice.d.ts +36 -0
  197. package/dist/core/runner/auto-strip-notice.js +59 -0
  198. package/dist/core/runner/branch-window.d.ts +3 -0
  199. package/dist/core/runner/branch-window.js +37 -0
  200. package/dist/core/runner/caller-roster.d.ts +8 -3
  201. package/dist/core/runner/capability-withheld-seat.js +3 -9
  202. package/dist/core/runner/clock-and-limits.d.ts +22 -1
  203. package/dist/core/runner/clock-and-limits.js +30 -0
  204. package/dist/core/runner/contracts.d.ts +58 -35
  205. package/dist/core/runner/credential-refusal-seat.d.ts +2 -0
  206. package/dist/core/runner/credential-refusal-seat.js +47 -0
  207. package/dist/core/runner/cross-boundary-lane.js +6 -4
  208. package/dist/core/runner/decide-continuation.js +1 -1
  209. package/dist/core/runner/file-history-restore.d.ts +53 -2
  210. package/dist/core/runner/file-history-restore.js +29 -10
  211. package/dist/core/runner/forward-sink.d.ts +14 -1
  212. package/dist/core/runner/forward-sink.js +14 -12
  213. package/dist/core/runner/gate-exit.d.ts +8 -7
  214. package/dist/core/runner/gate-exit.js +13 -13
  215. package/dist/core/runner/git-status-frame.js +2 -4
  216. package/dist/core/runner/initial-run-state.js +1 -1
  217. package/dist/core/runner/main-call-account.d.ts +3 -1
  218. package/dist/core/runner/main-call-account.js +5 -3
  219. package/dist/core/runner/mcp-redial.d.ts +2 -5
  220. package/dist/core/runner/mcp-redial.js +2 -2
  221. package/dist/core/runner/nested-memory-content.d.ts +7 -1
  222. package/dist/core/runner/nested-memory-content.js +73 -13
  223. package/dist/core/runner/nested-memory-lane.d.ts +44 -19
  224. package/dist/core/runner/nested-memory-lane.js +152 -76
  225. package/dist/core/runner/park-commit.js +3 -1
  226. package/dist/core/runner/permission-rule-lanes.d.ts +8 -2
  227. package/dist/core/runner/permission-rule-lanes.js +29 -3
  228. package/dist/core/runner/person-path-rows.d.ts +3 -11
  229. package/dist/core/runner/person-path-rows.js +21 -24
  230. package/dist/core/runner/prepare-acquire-reconcile.js +3 -1
  231. package/dist/core/runner/prepare-artifact.d.ts +1 -1
  232. package/dist/core/runner/prepare-artifact.js +20 -14
  233. package/dist/core/runner/prepare-ask-lane.d.ts +9 -6
  234. package/dist/core/runner/prepare-ask-lane.js +6 -5
  235. package/dist/core/runner/prepare-boundary-parks.d.ts +7 -1
  236. package/dist/core/runner/prepare-boundary-parks.js +27 -24
  237. package/dist/core/runner/prepare-caps-and-workflow.d.ts +5 -2
  238. package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
  239. package/dist/core/runner/prepare-config-doors.d.ts +9 -24
  240. package/dist/core/runner/prepare-config-doors.js +58 -41
  241. package/dist/core/runner/prepare-context-lane.d.ts +2 -2
  242. package/dist/core/runner/prepare-context-lane.js +3 -5
  243. package/dist/core/runner/prepare-defer-classify.d.ts +1 -1
  244. package/dist/core/runner/prepare-defer-classify.js +1 -1
  245. package/dist/core/runner/prepare-delegation-surface.d.ts +2 -2
  246. package/dist/core/runner/prepare-delegation-surface.js +3 -2
  247. package/dist/core/runner/prepare-file-history.d.ts +62 -26
  248. package/dist/core/runner/prepare-file-history.js +117 -46
  249. package/dist/core/runner/prepare-gate-stations.d.ts +4 -0
  250. package/dist/core/runner/prepare-gate-stations.js +6 -5
  251. package/dist/core/runner/prepare-hands-readface.d.ts +9 -4
  252. package/dist/core/runner/prepare-hands-readface.js +8 -4
  253. package/dist/core/runner/prepare-inherited-gate.d.ts +11 -4
  254. package/dist/core/runner/prepare-inherited-gate.js +6 -6
  255. package/dist/core/runner/prepare-listings.d.ts +1 -1
  256. package/dist/core/runner/prepare-listings.js +1 -1
  257. package/dist/core/runner/prepare-memory.js +2 -2
  258. package/dist/core/runner/prepare-offload-wrappers.d.ts +1 -1
  259. package/dist/core/runner/prepare-offload-wrappers.js +1 -1
  260. package/dist/core/runner/prepare-park-ask.d.ts +10 -3
  261. package/dist/core/runner/prepare-park-ask.js +7 -9
  262. package/dist/core/runner/prepare-policy-chain.d.ts +18 -9
  263. package/dist/core/runner/prepare-policy-chain.js +18 -13
  264. package/dist/core/runner/prepare-project-context.d.ts +1 -1
  265. package/dist/core/runner/prepare-project-context.js +5 -3
  266. package/dist/core/runner/prepare-prompt-assembly.js +2 -1
  267. package/dist/core/runner/prepare-prompt-inputs.d.ts +2 -2
  268. package/dist/core/runner/prepare-prompt-inputs.js +1 -1
  269. package/dist/core/runner/prepare-protocol-tools.d.ts +4 -5
  270. package/dist/core/runner/prepare-protocol-tools.js +7 -7
  271. package/dist/core/runner/prepare-question-face.d.ts +4 -2
  272. package/dist/core/runner/prepare-run-refs.d.ts +7 -2
  273. package/dist/core/runner/prepare-run-refs.js +8 -7
  274. package/dist/core/runner/prepare-safety-scan.d.ts +4 -3
  275. package/dist/core/runner/prepare-suspend-saga.d.ts +3 -7
  276. package/dist/core/runner/prepare-suspend-saga.js +4 -3
  277. package/dist/core/runner/prepare-task.js +66 -53
  278. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +3 -2
  279. package/dist/core/runner/prepare-tool-disclosure-mount.js +2 -1
  280. package/dist/core/runner/prepare-turn-wiring.d.ts +3 -1
  281. package/dist/core/runner/prepare-turn-wiring.js +1 -1
  282. package/dist/core/runner/prepare-wiring-manifest.d.ts +9 -4
  283. package/dist/core/runner/prepare-wiring-manifest.js +14 -6
  284. package/dist/core/runner/prepare-workspace-restore.d.ts +4 -4
  285. package/dist/core/runner/prepare-workspace-restore.js +15 -6
  286. package/dist/core/runner/remote-env-retry.d.ts +3 -3
  287. package/dist/core/runner/restore-seat.d.ts +41 -0
  288. package/dist/core/runner/restore-seat.js +38 -0
  289. package/dist/core/runner/resume-admission.js +1 -1
  290. package/dist/core/runner/resume-apply.js +4 -3
  291. package/dist/core/runner/resume-checkpoint-screen.js +2 -1
  292. package/dist/core/runner/resume-internals-and-config.js +2 -1
  293. package/dist/core/runner/resume-preflight.js +2 -1
  294. package/dist/core/runner/rewind-files.js +22 -6
  295. package/dist/core/runner/rule-store-unreadable-notice.d.ts +8 -0
  296. package/dist/core/runner/rule-store-unreadable-notice.js +11 -0
  297. package/dist/core/runner/run-brain-sinks.d.ts +3 -6
  298. package/dist/core/runner/run-brain-sinks.js +6 -6
  299. package/dist/core/runner/run-compaction-machinery.d.ts +2 -2
  300. package/dist/core/runner/run-git-lane.d.ts +2 -0
  301. package/dist/core/runner/run-git-lane.js +2 -1
  302. package/dist/core/runner/run-harness-handlers.js +5 -4
  303. package/dist/core/runner/run-identity-wiring.js +20 -12
  304. package/dist/core/runner/run-leg.js +31 -72
  305. package/dist/core/runner/run-notification-lane.d.ts +3 -0
  306. package/dist/core/runner/run-notification-lane.js +2 -4
  307. package/dist/core/runner/run-reasoning-seat.d.ts +5 -6
  308. package/dist/core/runner/run-reasoning-seat.js +13 -18
  309. package/dist/core/runner/run-settle-and-teardown.js +13 -9
  310. package/dist/core/runner/run-terminal-adoption.js +4 -8
  311. package/dist/core/runner/run-turn-boundary.js +6 -3
  312. package/dist/core/runner/runtask.d.ts +9 -4
  313. package/dist/core/runner/runtask.js +29 -22
  314. package/dist/core/runner/session-rule-policy.d.ts +11 -1
  315. package/dist/core/runner/shell-env-withheld.js +2 -7
  316. package/dist/core/runner/side-call-account.d.ts +5 -6
  317. package/dist/core/runner/side-call-account.js +2 -2
  318. package/dist/core/runner/stream-lifecycle-verbs.d.ts +3 -0
  319. package/dist/core/runner/stream-lifecycle-verbs.js +5 -3
  320. package/dist/core/runner/stream-settle-backstop.js +4 -6
  321. package/dist/core/runner/stream-steer-verb.d.ts +1 -1
  322. package/dist/core/runner/stream-steer-verb.js +4 -4
  323. package/dist/core/runner/sub-agent-deny-lists.d.ts +8 -3
  324. package/dist/core/runner/sub-agent-deny-lists.js +7 -4
  325. package/dist/core/runner/teardown-bounded.d.ts +7 -0
  326. package/dist/core/runner/teardown-bounded.js +7 -0
  327. package/dist/core/runner/terminal-account.js +41 -13
  328. package/dist/core/runner/terminal-projection.d.ts +1 -5
  329. package/dist/core/runner/tool-end-body.d.ts +9 -3
  330. package/dist/core/runner/tool-end-body.js +6 -3
  331. package/dist/core/runner/tool-output-projection.d.ts +13 -4
  332. package/dist/core/runner/tool-output-projection.js +10 -14
  333. package/dist/core/runner/turn-attachments.d.ts +3 -2
  334. package/dist/core/runner/turn-attachments.js +12 -5
  335. package/dist/core/runner-deps.d.ts +6 -6
  336. package/dist/core/runtime-caps.d.ts +2 -1
  337. package/dist/core/secret-env.d.ts +20 -3
  338. package/dist/core/secret-env.js +13 -15
  339. package/dist/core/session-checkout.d.ts +115 -15
  340. package/dist/core/session-checkout.js +435 -136
  341. package/dist/core/session-policy-store.js +21 -3
  342. package/dist/core/session-reconcile.js +1 -0
  343. package/dist/core/session-store.js +2 -0
  344. package/dist/core/session.d.ts +11 -1
  345. package/dist/core/shell-run-candidates.d.ts +1 -0
  346. package/dist/core/shell-run-candidates.js +1 -1
  347. package/dist/core/shutdown-debug.d.ts +6 -5
  348. package/dist/core/shutdown-debug.js +5 -1
  349. package/dist/core/skill-grant.js +4 -1
  350. package/dist/core/skills-directory.js +5 -3
  351. package/dist/core/spec-contract.d.ts +1 -1
  352. package/dist/core/store-contracts/checkpoint-store-contract.js +2 -7
  353. package/dist/core/store-contracts/file-history-store-contract.js +26 -2
  354. package/dist/core/store-contracts/session-deletion-cascade-contract.js +130 -14
  355. package/dist/core/store-contracts/task-list-store-contract.d.ts +2 -1
  356. package/dist/core/store-contracts/task-list-store-contract.js +28 -1
  357. package/dist/core/task-event.d.ts +48 -27
  358. package/dist/core/task-notification.d.ts +15 -9
  359. package/dist/core/task-notification.js +12 -0
  360. package/dist/core/task-registry-agent.d.ts +24 -22
  361. package/dist/core/task-registry-agent.js +65 -46
  362. package/dist/core/task-registry-shared.d.ts +17 -5
  363. package/dist/core/task-registry.d.ts +17 -6
  364. package/dist/core/task-registry.js +6 -1
  365. package/dist/core/task-result.d.ts +71 -25
  366. package/dist/core/task-spec-members.d.ts +0 -1
  367. package/dist/core/task-spec-members.js +1 -1
  368. package/dist/core/task-spec.d.ts +60 -52
  369. package/dist/core/task-stream.d.ts +45 -12
  370. package/dist/core/terminal-cause.d.ts +45 -8
  371. package/dist/core/terminal-cause.js +5 -0
  372. package/dist/core/tool-card-bound.d.ts +32 -0
  373. package/dist/core/tool-card-bound.js +33 -0
  374. package/dist/core/tool-catalog-entries.d.ts +9 -0
  375. package/dist/core/tool-catalog-entries.js +48 -0
  376. package/dist/core/tool-errors.d.ts +4 -3
  377. package/dist/core/tool-face.d.ts +3 -3
  378. package/dist/core/tool-mount-facts.d.ts +3 -2
  379. package/dist/core/tool-mount-facts.js +1 -1
  380. package/dist/core/tool-mount-static.js +7 -5
  381. package/dist/core/tool-policy.d.ts +21 -19
  382. package/dist/core/tool-policy.js +5 -6
  383. package/dist/core/tool-registry.d.ts +3 -1
  384. package/dist/core/tool-registry.js +15 -1
  385. package/dist/core/tool-result-store.d.ts +9 -3
  386. package/dist/core/tool-result-store.js +14 -1
  387. package/dist/core/tool-roster.d.ts +6 -0
  388. package/dist/core/tool-roster.js +18 -0
  389. package/dist/core/tool-spec.d.ts +17 -8
  390. package/dist/core/trace.d.ts +35 -31
  391. package/dist/core/types.d.ts +2 -2
  392. package/dist/core/untrusted-egress.d.ts +10 -9
  393. package/dist/core/untrusted-egress.js +9 -9
  394. package/dist/core/untrusted-text.d.ts +0 -18
  395. package/dist/core/untrusted-text.js +7 -3
  396. package/dist/core/user-attachment.d.ts +9 -6
  397. package/dist/core/user-attachment.js +12 -10
  398. package/dist/core/user-row-origin.d.ts +44 -25
  399. package/dist/core/user-row-origin.js +30 -20
  400. package/dist/core/wiring-manifest.d.ts +26 -7
  401. package/dist/core/wiring-manifest.js +14 -11
  402. package/dist/core/workspace-snapshot.d.ts +3 -1
  403. package/dist/core/workspace-snapshot.js +1 -0
  404. package/dist/engine/execution-env/node-execution-env.d.ts +23 -16
  405. package/dist/engine/execution-env/node-execution-env.js +127 -67
  406. package/dist/engine/harness/agent-harness.d.ts +4 -5
  407. package/dist/engine/harness/agent-harness.js +2 -7
  408. package/dist/engine/harness/types.d.ts +51 -19
  409. package/dist/engine/harness/types.js +28 -1
  410. package/dist/engine/llm/types.d.ts +26 -14
  411. package/dist/engine/llm/types.js +2 -2
  412. package/dist/engine/loop/agent-loop.d.ts +2 -2
  413. package/dist/engine/loop/agent-loop.js +51 -275
  414. package/dist/engine/loop/types.d.ts +0 -18
  415. package/dist/engine/session/import-validate.d.ts +3 -0
  416. package/dist/engine/session/import-validate.js +34 -2
  417. package/dist/engine/session/repo-utils.d.ts +42 -4
  418. package/dist/engine/session/repo-utils.js +33 -5
  419. package/dist/engine/session/session.d.ts +41 -14
  420. package/dist/engine/session/session.js +96 -25
  421. package/dist/index.d.ts +21 -16
  422. package/dist/index.js +16 -10
  423. package/dist/orchestration/run-spec.d.ts +1 -1
  424. package/dist/orchestration/run-workflow-tool.d.ts +12 -9
  425. package/dist/orchestration/run-workflow-tool.js +15 -19
  426. package/dist/orchestration/workflow-governance.js +13 -21
  427. package/dist/orchestration/workflow-observe.d.ts +4 -3
  428. package/dist/orchestration/workflow-primitives.d.ts +1 -1
  429. package/dist/orchestration/workflow-record-artifact.d.ts +14 -0
  430. package/dist/orchestration/workflow-record-artifact.js +32 -0
  431. package/dist/orchestration/workflow-script-store.d.ts +9 -0
  432. package/dist/orchestration/workflow-script-store.js +20 -1
  433. package/dist/orchestration/workflow-types.d.ts +33 -3
  434. package/dist/orchestration/workflow.d.ts +24 -14
  435. package/dist/orchestration/workflow.js +52 -23
  436. package/dist/prompt-assembly/artifact.js +4 -8
  437. package/dist/prompt-assembly/catalog/engine.d.ts +263 -0
  438. package/dist/prompt-assembly/catalog/engine.js +30 -0
  439. package/dist/prompt-assembly/catalog/index.d.ts +1 -1
  440. package/dist/prompt-assembly/catalog/index.js +2 -2
  441. package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.d.ts +1 -1
  442. package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.js +29 -0
  443. package/dist/prompt-assembly/epoch.js +6 -8
  444. package/dist/prompt-assembly/turn-snapshot.js +8 -9
  445. package/dist/stores/file/background-agent-store.js +5 -6
  446. package/dist/stores/file/checkpoint-store.d.ts +0 -4
  447. package/dist/stores/file/checkpoint-store.js +7 -3
  448. package/dist/stores/file/file-history-store.d.ts +8 -0
  449. package/dist/stores/file/file-history-store.js +72 -0
  450. package/dist/stores/file/fs-atomic.js +17 -12
  451. package/dist/stores/file/index.js +11 -5
  452. package/dist/stores/file/mailbox-store.js +13 -4
  453. package/dist/stores/file/permission-rule-store.js +14 -13
  454. package/dist/stores/file/shared-ledger.d.ts +4 -0
  455. package/dist/stores/file/shared-ledger.js +4 -0
  456. package/dist/stores/file/task-list-store.js +12 -3
  457. package/dist/stores/file/workflow-run-store.js +1 -0
  458. package/dist/tools/fs/bash-program-position.d.ts +4 -2
  459. package/dist/tools/fs/bash-program-position.js +1 -1
  460. package/dist/tools/fs/bash-readonly-classifier.js +1 -1
  461. package/dist/tools/fs/bound-open.d.ts +97 -0
  462. package/dist/tools/fs/bound-open.js +103 -0
  463. package/dist/tools/fs/containment-face.d.ts +2 -2
  464. package/dist/tools/fs/fs-pdf.d.ts +7 -1
  465. package/dist/tools/fs/fs-pdf.js +31 -23
  466. package/dist/tools/fs/fs-read.d.ts +24 -17
  467. package/dist/tools/fs/fs-read.js +84 -53
  468. package/dist/tools/fs/fs-shared.d.ts +14 -12
  469. package/dist/tools/fs/fs-shared.js +5 -4
  470. package/dist/tools/fs/fs-write.d.ts +2 -2
  471. package/dist/tools/fs/fs-write.js +20 -12
  472. package/dist/tools/fs/index.d.ts +4 -4
  473. package/dist/tools/fs/index.js +2 -2
  474. package/dist/tools/fs/notebook.d.ts +1 -1
  475. package/dist/tools/fs/pdf.d.ts +12 -3
  476. package/dist/tools/fs/pdf.js +22 -9
  477. package/dist/tools/fs/read-deny-home.d.ts +3 -2
  478. package/dist/tools/fs/read-deny-home.js +8 -11
  479. package/dist/tools/fs/safety.d.ts +3 -2
  480. package/dist/tools/fs/shell-read-check.js +10 -9
  481. package/dist/tools/monitor.d.ts +6 -5
  482. package/dist/tools/task-list.d.ts +16 -6
  483. package/dist/tools/task-list.js +4 -0
  484. package/dist/tools/web.d.ts +9 -1
  485. package/dist/tools/web.js +8 -3
  486. package/dist/tools/worktree.d.ts +7 -5
  487. package/dist/tools/worktree.js +4 -3
  488. package/package.json +4 -3
  489. package/test/export-surface.snapshot.json +93 -7
  490. package/wire-changes/core-stores-sql@7.68.0.json +39 -0
  491. package/wire-changes/core@7.68.0.json +4257 -0
  492. package/wire-changes/mods-kernel@7.68.0.json +129 -0
  493. package/wire-changes/primitives@7.68.0.json +253 -0
  494. package/wire-changes/wiki-gate@7.68.0.json +39 -0
  495. package/dist/core/runner/credential-origin-seat.d.ts +0 -2
  496. package/dist/core/runner/credential-origin-seat.js +0 -20
@@ -75,10 +75,11 @@ export type UserAttachment = {
75
75
  * - `files` — the file names each level is read for, relative and `/`-separated (`CLAUDE.md`, `.claude/CLAUDE.md`, …).
76
76
  * - `rulesDir` — a directory each level is listed under (recursively, `.md` files): a rule whose frontmatter names
77
77
  * `paths:` is loaded when the accessed path matches one (relative to that level), a rule without is loaded with its
78
- * level. At the task root itself only the matching rules load.
78
+ * level, the task root's included.
79
79
  * - `alternate` — a second family: `when: "absent"` reads it only where the task root holds no member of `files`
80
80
  * (judged once per leg), `"also"` reads it beside `files`.
81
- * - `includes` — follow a file's `@path` includes (within the task root, to a depth of {@link NESTED_MEMORY_LANE}'s limit).
81
+ * - `includes` — follow a file's `@path` includes (within the root it is read under, to a depth of {@link NESTED_MEMORY_LANE}'s limit).
82
+ * - `additionalDirectories` — `true` also reads each {@link TaskSpec.additionalDirectories} entry as a further root: its own level on every leg as the task root's is (after it), for `files` and `rulesDir` — no level below it, no `alternate`, and a rule with `paths:` there only for an accessed path below the task root. Omitted / `false` ⇒ not read (the reference's default; its opt-in `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD`).
82
83
  * - `hostRules` — rule texts the deployment holds outside the workspace (a user's or an organization's rules, a rule of a
83
84
  * directory above the task root): each is delivered when an accessed path, relative to the task root, matches one of
84
85
  * its `paths`. `name` is the label the frame shows.
@@ -95,6 +96,7 @@ export interface InstructionFamilyDeclaration {
95
96
  readonly when: "absent" | "also";
96
97
  };
97
98
  readonly includes?: boolean;
99
+ readonly additionalDirectories?: boolean;
98
100
  readonly hostRules?: ReadonlyArray<{
99
101
  readonly level: "user" | "managed" | "project";
100
102
  readonly name: string;
@@ -113,6 +115,15 @@ export type ShellGateDoctrine = "always";
113
115
  * parked for this session's occupant while it sat idle (the durable box's included). */
114
116
  export declare const TASK_WAKE_SOURCES: readonly ["parked_notifications"];
115
117
  export type TaskWakeSource = (typeof TASK_WAKE_SOURCES)[number];
118
+ /** A task's durable-park opt-in ({@link TaskSpec.durableApproval}'s object state). */
119
+ export interface DurableApprovalOptIn {
120
+ /** Multi-tenant isolation key, forced into the checkpoint + `resolve`/`reap` WHERE. Required. */
121
+ scope: string;
122
+ /** Optional awaiting-human TTL (ms). Past it a reaper CAS-expires the checkpoint (≈ deny). Absent, or a finite number >= 0 — any other
123
+ * value (NaN, Infinity, a negative, a string) is refused at the task door (`config.invalid_argument`, `detail.field` `durableApproval.ttlMs`),
124
+ * the judge `resourceSuspend`'s numbers are judged by. */
125
+ ttlMs?: number;
126
+ }
116
127
  export interface TaskSpec {
117
128
  taskId?: string;
118
129
  /** The instruction / latest user message for this turn. */
@@ -288,20 +299,23 @@ export interface TaskSpec {
288
299
  * leg runs in the session's tree as if it had sent it — or send the SAME declaration; `null` is a leg that wants NO tree (it
289
300
  * runs at the task root the host gave it, reports no checkout, and leaves the record as it is). A declaration that differs is
290
301
  * refused.
291
- * - `isolation: "worktree"`: the session works in its OWN managed tree of the task root's repository, minted on the first
292
- * leg at `<repository root>/.sema/worktrees/<name>` on branch `sema/<name>` (`name` absent ⇒ derived from the session id;
293
- * `baseRef`: `"fresh"` default, or `"head"`). Every leg's task root is the task root's place in that tree; the base
294
- * checkout is outside the leg's write roots. The tree outlives every leg and env; `releaseSessionCheckout` removes it.
295
- * - `sources`: the commit the session's code starts from, per root (`{ root, remote, sha, ref? }`): checked on the first
296
- * leg (the checkout at that root must be at `sha`; with isolation the task root's tree is minted at it).
297
- * Refusals, each before the leg starts: a malformed declaration ⇒ `config.session_workspace_invalid` (also: a writable
298
- * `additionalDirectories` entry that reaches into the isolated base checkout, a remote carrying a credential); a declaration
299
- * that differs from the first leg's, or appears on a session that already ran without one ⇒
300
- * `config.session_workspace_changed`; the tree cannot be made ⇒ `workspace.isolation_unavailable` (the reason named,
301
- * `probeWorktreeCapability` judges the same); a checkout not at the declared commit ⇒ `workspace.source_mismatch`; the
302
- * record cannot be read ⇒ `workspace.checkout_unavailable`; the tree is gone ⇒ `workspace.checkout_missing` (a leg that
303
- * wants the tree is never run in the base checkout instead). A fork does not inherit the checkout. Every leg's
304
- * `workspace_changed` frame carries it (`session`), except a `null` leg's.
302
+ * - `isolation: "worktree"`: the session works in its OWN managed trees, one per repository a listed root is in (`roots`,
303
+ * absent ⇒ the task root), minted together on the first leg — all or none — at `<repository root>/.sema/worktrees/<name>`
304
+ * on branch `sema/<name>` (`name` absent ⇒ derived from the session id; `baseRef`: `"fresh"` default, or `"head"`). Every
305
+ * declared root of an isolated repository (the task root, an `additionalDirectories` / `additionalReadDirectories` entry,
306
+ * listed or not) stands at its place in that tree on every leg, a delegated child's included; the base checkouts are
307
+ * outside the leg's write roots. The trees outlive every leg and env; `releaseSessionCheckout` removes them.
308
+ * - `sources`: the commit the session's code starts from, per repository (`{ root, remote, sha, ref? }`): checked on the
309
+ * first leg (the checkout at that root must be at `sha`; an isolated repository's tree is minted at it).
310
+ * Refusals, each before the leg starts: a malformed declaration ⇒ `config.session_workspace_invalid` (also: a writable root
311
+ * in no tree that holds an isolated base checkout, a listed directory that is no `additionalDirectories` entry, a `baseRef`
312
+ * that starts no tree, a remote carrying a credential); a declaration that differs from the first leg's, appears on a
313
+ * session that already began without one (its log holds a turn or a compaction), or a listed root no longer in an isolated repository ⇒
314
+ * `config.session_workspace_changed`; a tree cannot be made ⇒ `workspace.isolation_unavailable` (the root and the reason
315
+ * named, `probeWorktreeCapability` judges the same); a checkout not at the declared commit ⇒ `workspace.source_mismatch`; the
316
+ * record cannot be read ⇒ `workspace.checkout_unavailable`; a tree is gone ⇒ `workspace.checkout_missing` (never run in a
317
+ * base checkout instead). A fork does not inherit the checkout. Every leg's `workspace_changed` frame carries it
318
+ * (`session`), except a `null` leg's, and says where each additional root stands (`directories`).
305
319
  */
306
320
  workspace?: WorkspaceDeclaration | null;
307
321
  /**
@@ -359,6 +373,8 @@ export interface TaskSpec {
359
373
  * message that ends mid-tool-call (a SETTLED turn boundary — else the replay would orphan-close a done call).
360
374
  * Non-destructive: recorded as a branch `leaf` entry, so prior leaves stay in the tree (re-resume any time).
361
375
  * Mutually exclusive with a durable `runner.resume(...)` (the Runner rejects both at once).
376
+ * On a store that loads only a bounded window of the log, it must hold the whole branch the new leaf continues (its path read reaches a root, or the latest
377
+ * compaction on it keeps from an entry on it), either {@link resumeAtMode}; else `resume_at.outside_window`, nothing written by the attempt that refuses (never a run from the window's floor on); `"at"` a user message keeps its attachment frames, found among the entries the handle loaded — one that does not hold the message refuses the same code (never a run without them).
362
378
  */
363
379
  resumeAt?: string;
364
380
  /**
@@ -541,7 +557,8 @@ export interface TaskSpec {
541
557
  * through the hands, under the Read tool's own admission — the root's own level on every leg (the session's instructions,
542
558
  * frames of origin `project_instructions`, the leg's first request first), and when the model reads or writes a file below the
543
559
  * root, the family of each directory between the root and that file and the rules whose paths match it (frames of origin
544
- * `nested_memory`, on the next request). A delivered file edited since is sent whole again; removed or emptied, it is withdrawn
560
+ * `nested_memory`, on the next request); with its `additionalDirectories: true`, each additional working directory's own level as
561
+ * the root's is. A delivered file edited since is sent whole again; removed or emptied, it is withdrawn
545
562
  * once. Absent, or under {@link projectMemory} `"disabled"` (screened, then silent) ⇒ nothing is stat'ed or read. Children inherit
546
563
  * it (the parent spec seat): omitted ⇒ the parent's; `projectMemory: "disabled"` silences it; the child's own declaration stands.
547
564
  */
@@ -582,7 +599,7 @@ export interface TaskSpec {
582
599
  * conversation" = {@link resumeAt} alone). Legal ONLY when {@link resumeAt} is ABSENT — handing
583
600
  * BOTH anchors is refused loud (`rewind.conflicting_targets`): two file targets is a
584
601
  * contradiction, and silently preferring one is the silent-swallow family this seam refuses; a
585
- * target with no history boundary fails loud (`rewind_snapshot.unresolvable`). Requires
602
+ * target with no history boundary, or that is not an entry of this session's own log, fails loud (`rewind_snapshot.unresolvable`). Requires
586
603
  * `RunnerDeps.fileHistoryStore`. The session leaf is untouched — the next turn continues the
587
604
  * CURRENT conversation, only the files moved.
588
605
  *
@@ -630,8 +647,8 @@ export interface TaskSpec {
630
647
  * deferred-search lane). Deferral is reached through ToolSearch, so a list that leaves it out defers nothing.
631
648
  *
632
649
  * A tool a leg relies on (a delegated child's ReportBlocked, a teammate's SendMessage, a goal iteration's DeclareDone, an
633
- * observer's report tool — the catalog's protocol column) is not an allowlist's to name; a denylist that reaches one on such a
634
- * leg is refused at prepare.
650
+ * observer's report tool, a run's structured-output tool — the catalog's protocol column) is not an allowlist's to name, nor
651
+ * {@link excludeAllTools}'s to take out; a denylist that reaches one on such a leg is refused at prepare.
635
652
  */
636
653
  allowTools?: string[];
637
654
  /**
@@ -647,11 +664,11 @@ export interface TaskSpec {
647
664
  */
648
665
  excludeTools?: string[];
649
666
  /**
650
- * design/388 §2.2 ⑥ — unmount the WHOLE tool face: the leg mounts nothing (no hands, no
651
- * scaffolds, no MCP or skill tools; the effect roster reads `entries: []` and the model request
652
- * carries `tools: []`). The utility-task shape a shell used to express with a hand-kept exclusion
653
- * list. Not spelled `excludeTools: ["*"]` on purpose — `"*"` is a legal caller tool name (only `__`
654
- * is reserved). `excludeTools` beside it is redundant, not an error.
667
+ * design/388 §2.2 ⑥ — unmount the WHOLE tool face: the leg's own allowlist names nothing (whatever {@link allowTools} says), so
668
+ * it mounts no hands, scaffolds, caller, MCP, A2A or skill tool and keeps only the tools its kind relies on, as `allowTools: []`
669
+ * keeps them: a run with an {@link outputSchema} delivers `structuredOutput`, a goal iteration keeps DeclareDone, and a leg that
670
+ * relies on none reads `entries: []` and sends no tools; `runWithVerification`'s verifier carries it. Not `excludeTools: ["*"]`
671
+ * (a legal caller name). `excludeTools` beside it is redundant, not an error; one reaching a relied-on tool is refused as without it.
655
672
  */
656
673
  excludeAllTools?: true;
657
674
  /**
@@ -829,17 +846,21 @@ export interface TaskSpec {
829
846
  * in-stream — same turn, no checkpoint, the gate recorded in `humanReview.gates` — and this option acts
830
847
  * as the no-approver fallback. The durable park keeps priority only when: (a) there is no function seat
831
848
  * (absent, or a blanket `"allow"`/`"deny"` string mode — a policy setting is not a reachable human);
832
- * (b) a control-plane `forceDurableGate` entitlement is in force (on a delegated leg only where its parent forwarded an opt-in — elsewhere the leg parks no ask and refuses every one, `config.durable_gate_unavailable`); (c) the live face already answered
849
+ * (b) a control-plane `forceDurableGate` entitlement is in force (on a delegated leg only where its lane holds its parks — elsewhere the leg parks no ask and refuses every one, `config.durable_gate_unavailable`); (c) the live face already answered
833
850
  * `"unavailable"` for this ask; or (d) the call is marked inherited-unavailable by an ancestor.
834
- */
835
- durableApproval?: {
836
- /** Multi-tenant isolation key, forced into the checkpoint + `resolve`/`reap` WHERE. Required. */
837
- scope: string;
838
- /** Optional awaiting-human TTL (ms). Past it a reaper CAS-expires the checkpoint (≈ deny). Absent, or a finite number >= 0 — any other
839
- * value (NaN, Infinity, a negative, a string) is refused at the task door (`config.invalid_argument`, `detail.field` `durableApproval.ttlMs`),
840
- * the judge `resourceSuspend`'s numbers are judged by. */
841
- ttlMs?: number;
842
- };
851
+ *
852
+ * **`false` — the host cannot resume this run's decision parks.** Three states, one question ("this leg's decision parks"): an
853
+ * object opts in, absence says nothing (a `forceDurableGate` entitlement may still synthesize an opt-in), and `false` declares that
854
+ * nobody can resume a parked approval of this run. Then no decision park is minted (a permission ask, a question, a plan review): a
855
+ * live approver answers in-stream, else the ask is refused with its way out — under a `forceDurableGate` entitlement it is refused
856
+ * `config.durable_gate_unavailable` / `leg_not_resumable`, never answered live; the plan-mode tool pair mounts only as on a store-less leg (ExitPlanMode only under `interactiveTools: true`); resource
857
+ * parks (budget / turns / a scheduler's yield / a usage window / an env lifetime) are untouched. It travels to every child the run
858
+ * spawns (a tighten-only seat), and a resource row the leg parks records it: a resume whose config states no `durableApproval`
859
+ * keeps it, and only a config that states an opt-in object lifts it. Declare it where no road leads back to a parked approval
860
+ * (a one-shot call with no approval channel; a lane whose resume runs elsewhere); a run with a live approver, or a background lane
861
+ * that can park, has no need of it (`INTEGRATION-CORE.md`, "Declaring durableApproval: false").
862
+ */
863
+ durableApproval?: DurableApprovalOptIn | false;
843
864
  /**
844
865
  * design/74: opt into resource-slice suspend. When a resource limit (maxTurns / budget / walltime) is hit
845
866
  * AND the task is eligible (a `checkpointStore` + a remote, suspendable `executionEnvFactory` env), suspend
@@ -990,6 +1011,7 @@ export interface TaskSpec {
990
1011
  *
991
1012
  * Delegated children inherit it: the sync / background / fork spawn lanes copy the `"disabled"` word
992
1013
  * into every child spec (same discipline as `principal`), so a store-less run's whole tree stays store-less.
1014
+ * The engine is the word's second setter: every fork child runs with it whatever its parent resolved (nothing resumes a fork), and so does every leg the fork spawns.
993
1015
  *
994
1016
  * The off switch is the WORD `"disabled"`, never `null`: a string is not nullish, so the ordinary
995
1017
  * `spec ?? deps` coalesce is the whole resolution rule and no reader has to remember a special
@@ -1437,21 +1459,6 @@ export interface TaskSpec {
1437
1459
  * background processes.
1438
1460
  */
1439
1461
  retainBackgroundProcesses?: boolean;
1440
- /**
1441
- * design/120 P2: opt in to in-stream tool execution — safe tool calls start while the model is
1442
- * still streaming its response instead of waiting for the full reply. Default OFF. Forwarded to
1443
- * the harness, which additionally withholds it whenever a `tool_call` gate handler is registered
1444
- * (policy / approval / egress runs — a gate could durably suspend, which is impossible
1445
- * mid-stream), so setting this on a gated task is safe and simply has no effect. A run whose only
1446
- * gate concern is resource-suspend does NOT register that handler (it stops at clean turn
1447
- * boundaries), so in-stream execution stays available there.
1448
- *
1449
- * Known limitation (documented): with this ON, a tool's side effect can complete BEFORE the
1450
- * assistant message persists; a hard process crash in that window leaves no transcript trace of
1451
- * the call (wake reconcile cannot see an orphan that was never written). Prefer OFF for
1452
- * deployments where crash-exactly-once accounting of tool effects matters more than latency.
1453
- */
1454
- streamingToolExecution?: boolean;
1455
1462
  /**
1456
1463
  * **Structured output** (1.41): constrain the task's FINAL result to this JSON schema (a typebox
1457
1464
  * object schema). Injects a built-in `StructuredOutput` tool whose parameters ARE this schema; the model
@@ -1738,8 +1745,9 @@ export interface TaskSpec {
1738
1745
  * the default was off — a probe pinning "no background_tasks frame without opt-in" reds. */
1739
1746
  backgroundTasks?: boolean;
1740
1747
  toolsDelta?: true;
1741
- /** The notice that a declared MCP server did not connect for this message: its tools are unavailable for now, and it is
1742
- * tried again when the next message arrives. Rides the leg's first request (a fresh leg's first user message, a resumed leg's continuation),
1748
+ /** The notice that a declared MCP server did not connect: its tools are unavailable for this session when the session remembers
1749
+ * the failure (it waited out the startup bound; not dialed again unless its declaration changes or the host has it reconnected),
1750
+ * for now otherwise (the next message tries again). Rides the leg's first request (a fresh leg's first user message, a resumed leg's continuation),
1743
1751
  * once per session per server and error. DEFAULT ON — boolean: `false` is the opt-out, a non-boolean is refused at the
1744
1752
  * task's door (`config.invalid_argument`). BREAKING: the notice used to ride {@link toolsDelta}, and only a turn boundary. */
1745
1753
  mcpUnavailable?: boolean;
@@ -198,19 +198,31 @@ export interface TaskStream extends AsyncIterable<TaskEvent> {
198
198
  * Request a manual context **compaction** (design/99 MF-18 — the shell `/compact` button). Forces a
199
199
  * compaction at the NEXT safe turn boundary regardless of the auto-threshold (the only safe point — never
200
200
  * mid-turn, which would rewrite the session under an in-flight request); a `compacted` event with
201
- * `trigger:"manual"` is emitted when it actually compacts. Resolves once the request has been PROCESSED at
202
- * a boundary, or when the task ends first (whichever comes first — it never hangs). **Throws**
203
- * (`steering.not_running`) if the task hasn't started or has already finished. Idempotent-ish: concurrent
204
- * calls coalesce onto the next boundary (all waiters get the same outcome).
201
+ * `trigger:"manual"` is emitted when it actually compacts.
202
+ *
203
+ * **Taken or refused** — read {@link inputWindow} (the same judge, with zero ticks; before or after the call):
204
+ * - `"over"` (no turn boundary of this run will come: the loop has ended, or the run has settled) — the request is
205
+ * **refused**: the promise is already rejected when `compact()` returns, `steering.not_running` ("the task has
206
+ * already finished"), and no `compaction_outcome` frame is emitted (a refused request has no outcome).
207
+ * - `"open"` / `"before"` — the request is **taken**; the promise is its outcome, settled by the boundary that
208
+ * serves it (one of the six {@link CompactOutcome} words) or `"mooted"` when the run ends before a boundary served
209
+ * it. Taken is the admission, not a promise of service: a run that ends before another boundary comes answers a taken
210
+ * request `"mooted"`. One more answer exists for a request taken before the run has published its handle: it is
211
+ * rejected `steering.not_running` ("the task is not running") when the run's preparation threw, and when the handle
212
+ * is still unpublished 30 s after the call (the readiness bound) — a preparation that is only slow, and goes on to
213
+ * start, is refused at the bound all the same (`steer()` meets the same bound, counted from when its own turn in
214
+ * the steer queue begins).
215
+ * Idempotent-ish: concurrent calls coalesce onto the next boundary (all waiters get the same outcome).
205
216
  *
206
217
  * ⚠️ BREAKING (MF-18: "processed" without "compacted"): resolves with a {@link CompactOutcome}
207
218
  * instead of `void` — "processed" alone told a consumer nothing when the attempt failed or was mooted
208
219
  * (the 202-then-silence fingerprint). Every outcome also has a stream/trace counterpart:
209
220
  * `"compacted"` → the `compacted` event; `"failed"` → `compaction.failed` trace (+ `onError(phase:
210
221
  * "compaction")` when an attempt was burned); `"blocked"` → `compaction.blocked` trace; `"noop"` →
211
- * `compaction.noop` trace; `"disabled"` → `compaction.disabled` trace; `"mooted"` →
222
+ * `compaction.noop` trace; `"disabled"` → `compaction.disabled` trace; `"mooted"` (taken, never served) →
212
223
  * `compaction.mooted` trace — or the task simply settled before any boundary processed the request
213
- * (the run-end backstop resolves "mooted" without a frame; the task's terminal events are the signal).
224
+ * (the `compaction_outcome{mooted}` frame while the stream can still carry it; past its close the
225
+ * run-end backstop resolves "mooted" without a frame and the task's terminal events are the signal).
214
226
  *
215
227
  * design/145 §4 (additive): `opts.instructions` — the CC `/compact <instructions>` parity face.
216
228
  * Injected into the summarization prompt in the standard shape (`\n\nAdditional Instructions:`),
@@ -235,12 +247,30 @@ export interface TaskStream extends AsyncIterable<TaskEvent> {
235
247
  * soft-deadline abort; the trace counterpart is `compaction.mooted` with `reason:"cancelled"`).
236
248
  * Coalescing caveat: coalesced callers share ONE pass, so one caller's cancel aborts the shared
237
249
  * pass — every waiter of that pass then resolves `"mooted"`.
238
- * An already-aborted signal resolves `"mooted"` immediately without arming a request.
250
+ * An already-aborted signal resolves `"mooted"` immediately without arming a request (on an `"over"` stream the
251
+ * refusal comes first).
239
252
  */
240
253
  compact(opts?: {
241
254
  instructions?: string;
242
255
  signal?: AbortSignal;
243
256
  }): Promise<CompactOutcome>;
257
+ /**
258
+ * Where this run's loop stands for an input, read now — the stream's one input judge, the reading {@link compact}
259
+ * takes or refuses a request by, and the facts {@link steer} waits on. Synchronous: a host answers a manual
260
+ * compaction request from it with zero ticks, before or after calling `compact()`.
261
+ * - `"before"` — the loop is not taking input but has not ended: the run is starting (a `compact()` is taken and
262
+ * waits for the run's first boundary; while the run has published no handle that wait is bounded — 30 s from the
263
+ * call — and a run whose handle is still unpublished then refuses it, whether or not it starts afterwards), or,
264
+ * for an instant, the loop's last prompt has settled and its end is not yet recorded (a `compact()` taken there
265
+ * finds no boundary and ends `"mooted"`).
266
+ * - `"open"` — the loop takes input: a `compact()` is taken.
267
+ * - `"over"` — the loop has ended or the run has settled: no turn boundary of this run will come; `compact()` and
268
+ * `steer()` refuse (`steering.not_running`). A manual compaction from here on is the idle session's
269
+ * (`Runner.compactSession`, once this stream has settled).
270
+ * Changes only forward (`before` → `open` → `over`, or `before` → `over`), except that `open` reads `before` again in
271
+ * the instant between the loop's last prompt settling and its end.
272
+ */
273
+ inputWindow(): import("./input-author.js").InputWindow;
244
274
  /**
245
275
  * design/116 detach(CC mid-flight ctrl+b)— move a RUNNING tool call to the background.
246
276
  * Today only a detach-capable Bash honors it (the env adopts the child as a background shell; the tool
@@ -312,8 +342,10 @@ export interface TaskStream extends AsyncIterable<TaskEvent> {
312
342
  * **RE-DIAL one MCP server** on the running task, the action `RefreshMcpTools` deliberately
313
343
  * is not (its contract is "never dials or re-dials"). Core holds no MCP connection across task
314
344
  * legs, so once a server's transport closes this leg is stuck with it: every one of its tools fails
315
- * fast and a refresh can only keep reporting `not_connected`. This is the verb a host hangs a
316
- * "Reconnect" control on. ONE NAMED SERVER, required — the reference's control-channel request carries
345
+ * fast and a refresh can only keep reporting `not_connected`; and a server whose connection attempt
346
+ * failed is remembered by the session's pool, so the session's later legs do not dial it either.
347
+ * This is the verb a host hangs a "Reconnect" control on while a run is live (it drops that memory
348
+ * and dials now); between messages it is `Runner.forgetMcpFailure` (the next message dials). ONE NAMED SERVER, required — the reference's control-channel request carries
317
349
  * a required `serverName` and has no all-servers form, and an all-servers form would CLOSE HEALTHY
318
350
  * connections to re-dial them (the stdio server owning a device or a port — the case this verb
319
351
  * exists for — is the one that cannot be re-dialed while its predecessor still holds the device).
@@ -321,8 +353,8 @@ export interface TaskStream extends AsyncIterable<TaskEvent> {
321
353
  * ⚠️ **A FAILED RE-DIAL LEAVES THE SERVER DOWN.** The old connection is closed BEFORE the new one is
322
354
  * dialed (no other order works for a device-owning server), so a dial that fails has spent a
323
355
  * working connection: the server stays disconnected, with its tools WITHDRAWN from the roster,
324
- * until another re-dial or the next leg's materialize — and calls in flight on the replaced
325
- * connection fail with it. Both are inherent to re-dialing; CC behaves the same way.
356
+ * until another re-dial — the failed attempt is the session's memory, so the next leg does not dial
357
+ * it either — and calls in flight on the replaced connection fail with it. Both are inherent to re-dialing; CC behaves the same way.
326
358
  *
327
359
  * Resolves {@link import("./mcp.js").McpReconnectResult} — `outcome` is one of three words, so a
328
360
  * consumer mapping it onto a three-state control answer needs no table: `reconnected` (the only
@@ -331,7 +363,8 @@ export interface TaskStream extends AsyncIterable<TaskEvent> {
331
363
  * Throws, never silently no-ops: `mcp.reconnect_unavailable` when this run declared NO MCP servers
332
364
  * (a host maps that to "unsupported", not "refused"), `steering.invalid_content` on a missing or
333
365
  * non-string name, and the steer-family `steering.not_running` once the task has finished.
334
- * LEG-LOCAL: the result rides no checkpoint, and a durable resume takes a fresh first listing.
366
+ * The result rides no checkpoint; what the session's pool remembers of the dial lives in this process only, so a durable resume in
367
+ * the same Runner reads that memory and one in another process takes a fresh first listing.
335
368
  */
336
369
  reconnectMcpServer(server: string): Promise<import("./mcp.js").McpReconnectResult>;
337
370
  /**
@@ -12,6 +12,17 @@ import type { AssertAllKeysHandled } from "./ask-origin.js";
12
12
  import type { ProviderCondition, ProviderConditionSource } from "../brain/provider-dialect.js";
13
13
  import type { RequestRoute } from "../brain/request-route.js";
14
14
  import type { ModelOutputInvalidCause, OutputLimit } from "../internal/llm.js";
15
+ /**
16
+ * What became of the checkpoint row of a RESUMED leg that ended before its approved action started — the store's own outcome of
17
+ * the claim's reversal, stated by the exit that compensated it. A CLOSED SET with one home, registered in `docs/CLOSED-SETS.md`:
18
+ * · `"reopened"` — pending again: the same token resumes it (also when the reopen threw and the row read afterwards shows it landed);
19
+ * · `"declined"` — the store refused to reopen it (the row is no longer the resolved row the leg claimed): read the row;
20
+ * · `"unknown"` — the reopen threw and the row does not show it landed: its state is unprovable from here.
21
+ * Every carrier reads this one type: a failed result's `terminal.unstartedRow`, a resume's rejection before its leg started
22
+ * (`CheckpointError.detail.unstartedRow`), and the engine's own outcome record (`UnstartedRow`, whose sentence is derived from the word).
23
+ * A consumer holding a table over it is tsc-red on a new word until it places the word.
24
+ */
25
+ export type UnstartedRowOutcome = "reopened" | "declined" | "unknown";
15
26
  /**
16
27
  * WHY a run ended — ONE tagged cause, and the ONLY terminal record a {@link TaskResult} carries. The run
17
28
  * loop's terminal arbitration used to decide a `status` word plus seven optional plane fields one by one
@@ -62,7 +73,8 @@ export type TerminalCause = {
62
73
  * Two codes name the EXTERNAL stop causes — neither is a `limits.` code, because neither is an
63
74
  * allowance the task chose, and a caller that retries on `limits.*` should NOT treat these the same:
64
75
  * - `"env.lifetime_expired"` — the execution environment's platform lifetime ran out and the run
65
- * could not be suspended durably. Retrying needs a NEW environment, not a smaller budget.
76
+ * could not be suspended durably — or, answered by the environment when the leg established it, before
77
+ * the run started. Retrying needs a NEW environment, not a smaller budget.
66
78
  * - `"usage.window_exhausted"` — a deployment usage-governance window is full (see
67
79
  * `RunnerDeps.usageWindows`). Reported at task ENTRY (nothing ran) or after a suspend was
68
80
  * impossible; the wait hint rides the thrown error's `retryAfterMs` (delivered through
@@ -107,14 +119,11 @@ export type TerminalCause = {
107
119
  */
108
120
  nestedPause?: PausedCause;
109
121
  /**
110
- * What a RESUMED leg that ended before its approved action started did to its checkpoint row — the store's own
111
- * outcome, stated by the exit that compensated it: `reopened` (pending again: the same token resumes it — also when the
112
- * reopen threw and the row read afterwards shows it landed), `declined` (the store refused to reopen it — read the row),
113
- * `unknown` (the reopen threw and the row does not show it landed: its state is unprovable).
122
+ * What a RESUMED leg that ended before its approved action started did to its checkpoint row ({@link UnstartedRowOutcome}).
114
123
  * Beside `code`, never folded into it: the code still names what ended the leg. PRESENCE: only on such a leg; a
115
124
  * fresh run, a leg that started its approved action and a delivered negative decision carry none.
116
125
  */
117
- unstartedRow?: "reopened" | "declined" | "unknown";
126
+ unstartedRow?: UnstartedRowOutcome;
118
127
  } | {
119
128
  kind: "blocked";
120
129
  /**
@@ -143,6 +152,14 @@ export type TerminalCause = {
143
152
  * gate). Its kind's {@link import("./pause-registry.js").PAUSE_REGISTRY} row is what
144
153
  * {@link import("./runner/terminal-projection.js").terminalProjection} reads the status word from
145
154
  * (`"suspended"` for an approval / a resource slice / a platform pause, `"needs_review"` for a review).
155
+ *
156
+ * An approval gate's `reason` is the engine's account of the pause kind, not the question put to a person. The card's
157
+ * question, its askers' own words, the origin word and the class pair are the row's `PendingAction.tool_approval` members
158
+ * (`cardMessage`, `askReasons`, `origin`, `askClass` / `classes` — the values the live card carried): a surface rendering
159
+ * the parked card reads that row by {@link token} (`CheckpointStore.get`), and the row's `checkpointId` is
160
+ * {@link checkpointId}. The gate carries none of those members; what it does carry about the ask is its triage
161
+ * descriptor (`riskDescriptor`: severity, axes, the action's summary, a probe's account when a probe tightened the call)
162
+ * and, on a real-approval ask, the bit the resume reads (`realApproval`, with the ask's origin word).
146
163
  */
147
164
  gate: import("./checkpoint-store.js").CheckpointGate;
148
165
  /**
@@ -166,6 +183,16 @@ export type TerminalCause = {
166
183
  * `plan_review.requestedByCallId` — one write, at the park mint.
167
184
  */
168
185
  requestedByCallId?: string;
186
+ /**
187
+ * The digest of the plan SHOWN to the person at this plan_review pause: `sha256:` + the lowercase hex SHA-256 of the
188
+ * UTF-8 bytes of the `plan` string on the `exit-plan-mode` card the requesting call's `tool_end` carried
189
+ * (`structured.plan`), unnormalized and untruncated — so a reader digests the plan string it holds, before any
190
+ * display normalization, and compares. It says what was shown, not who asked and not which gate. PRESENT only on a
191
+ * `plan_review` pause whose requesting call's frame carried a plan card; ABSENT otherwise (a card left off the frame
192
+ * for size included), which means "nothing to compare", never "an empty plan". Echo of the committed row's
193
+ * {@link import("./checkpoint-store.js").PendingAction} `plan_review.planContentHash` — one write, at the park mint.
194
+ */
195
+ planContentHash?: string;
169
196
  /**
170
197
  * HOW the paused task's remote workspace will come back, present whenever the pause captured a
171
198
  * remote workspace. The two modes bill and behave very differently:
@@ -253,8 +280,12 @@ export type TerminalFailureDetail = {
253
280
  /**
254
281
  * The thrown error's own `detail`, as its throw site stated it — a snapshot of its JSON-plain members (strings,
255
282
  * finite numbers, booleans, null, and arrays / plain objects of those, bounded; a member of any other kind is left
256
- * out; bytes — an `ArrayBuffer` view, an index-keyed object — are never a record). A member under a credential
257
- * name (the env-credential judge's names: `password`, `apiKey`, `token` …) stands as the redaction mark (`REDACTION_MARK`), unread; every
283
+ * out; bytes — an `ArrayBuffer` view, an index-keyed object — are never a record). An ARRAY is one fact: when a bound
284
+ * (64 entries per container, 4096 characters per string, depth 4, 256 values and 16384 characters in all) leaves out any
285
+ * element of it, or a member of an element record, the array is absent whole — never a shorter list or a cut row — and
286
+ * what it had spent of the bounds goes back, so the members after it are judged as if it were not there (a record's
287
+ * own members that do not fit are left out one by one, as before). A member under a credential
288
+ * name (the env-credential judge's names: `password`, `apiKey`, `token` …) stands as the bare redaction mark (`REDACTION_MARKS.bare`), unread; every
258
289
  * other string leaf passes the secret-tier redaction (credential shapes masked; a path is kept — it rides this
259
290
  * structured seat, never `message`); a member whose key is not JSON-safe (visible ASCII 1–128, nothing the
260
291
  * redaction would mask) is left out. Read off the same link of the error's `cause` chain whose `code` became
@@ -330,3 +361,9 @@ export declare function isTerminalCauseKind(kind: unknown): kind is TerminalCaus
330
361
  export type PausedCause = Extract<TerminalCause, {
331
362
  kind: "paused";
332
363
  }>;
364
+ /**
365
+ * The run's own cancellation as a thrown value — its ONE mint (the leg's entry before the first turn, and the restore
366
+ * seat around its establishment call). It carries no `code` by design: a cancelled run's terminal is
367
+ * `{ kind: "failed", message: "run aborted" }`, whatever step it was cancelled at.
368
+ */
369
+ export declare function runAbortedError(): Error;
@@ -14,3 +14,8 @@ Object.freeze(TERMINAL_CAUSE_IS_REPLAYABLE);
14
14
  export function isTerminalCauseKind(kind) {
15
15
  return typeof kind === "string" && Object.hasOwn(TERMINAL_CAUSE_IS_REPLAYABLE, kind);
16
16
  }
17
+ export function runAbortedError() {
18
+ const e = new Error("run aborted");
19
+ e.name = "AbortError";
20
+ return e;
21
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The bounds of what a `tool_end` frame carries. The end projection (`runner/tool-output-projection.ts`) reads them, and so
3
+ * does a tool that must know, before it asks a person to look at its card, whether that card reaches the person at all
4
+ * (the plan-exit tool: a plan its card cannot carry is refused before any approval is requested). One bound, one measure:
5
+ * nothing else spells either.
6
+ */
7
+ /** Size cap (characters) for the TEXT of a `tool_end.output` body on the live event stream, so a GB-scale result can't
8
+ * bloat SSE/checkpoint replay. Media blocks are not measured against it. The full result still lives in context /
9
+ * `ToolResultStore`. */
10
+ export declare const MAX_TOOL_END_OUTPUT_CHARS = 16384;
11
+ /** A card rides `tool_end.structured` while its JSON is at most this many characters: 4x the text cap, because card facts
12
+ * legitimately carry `originalFile` (the diff base). A larger card is left off `structured` whole; its skeleton rides instead. */
13
+ export declare const MAX_TOOL_CARD_CHARS: number;
14
+ /** A card's size as the frame measures it: the length of its JSON. A card with no JSON (a cycle, a BigInt, a throwing
15
+ * getter) measures `Infinity` — it never rides. */
16
+ export declare function toolCardChars(details: object): number;
17
+ /** Where a card goes on its `tool_end`: whole on `structured`, or — over the bound — its skeleton on `structuredSkeleton`. */
18
+ export type CardOnFrame = {
19
+ structured: object;
20
+ } | {
21
+ structuredSkeleton: {
22
+ type: string;
23
+ } & Record<string, unknown>;
24
+ };
25
+ /**
26
+ * The one rule for a card and the bound. A card the frame can carry rides whole. One it cannot rides as its SKELETON: `type`
27
+ * plus the `members` its kind names, copied as written (a dotted name reaches into a nested object; a member the card does
28
+ * not carry stays absent; nothing is computed). A skeleton the frame cannot carry either rides as nothing — never cut: a
29
+ * shortened path would name another file. The rule knows no kind; the caller hands in the kind's members. A card whose
30
+ * members cannot be read (a throwing getter) has no skeleton either.
31
+ */
32
+ export declare function cardOnFrame(card: object, type: string, members: readonly string[]): CardOnFrame | undefined;
@@ -0,0 +1,33 @@
1
+ export const MAX_TOOL_END_OUTPUT_CHARS = 16384;
2
+ export const MAX_TOOL_CARD_CHARS = MAX_TOOL_END_OUTPUT_CHARS * 4;
3
+ export function toolCardChars(details) {
4
+ try {
5
+ return (JSON.stringify(details) ?? "").length;
6
+ }
7
+ catch {
8
+ return Number.POSITIVE_INFINITY;
9
+ }
10
+ }
11
+ export function cardOnFrame(card, type, members) {
12
+ if (toolCardChars(card) <= MAX_TOOL_CARD_CHARS)
13
+ return { structured: card };
14
+ const skeleton = { type };
15
+ try {
16
+ for (const name of members) {
17
+ const path = name.split(".");
18
+ let value = card;
19
+ for (const key of path)
20
+ value = value !== null && typeof value === "object" && Object.hasOwn(value, key) ? value[key] : undefined;
21
+ if (value === undefined)
22
+ continue;
23
+ let into = skeleton;
24
+ for (const key of path.slice(0, -1))
25
+ into = (into[key] ??= {});
26
+ into[path.at(-1)] = value;
27
+ }
28
+ }
29
+ catch {
30
+ return undefined;
31
+ }
32
+ return toolCardChars(skeleton) <= MAX_TOOL_CARD_CHARS ? { structuredSkeleton: skeleton } : undefined;
33
+ }
@@ -49,6 +49,15 @@ export declare const TOOL_CATALOG_ENTRIES: readonly ToolCatalogEntry[];
49
49
  * cards and the fs boundary refusals (minted by the shared safety module on behalf of every fs tool).
50
50
  */
51
51
  export declare const ENGINE_CARDS: Readonly<Record<string, string>>;
52
+ /**
53
+ * Each engine card's SKELETON — what rides `tool_end.structuredSkeleton` when the card itself is over the frame's card
54
+ * bound: `type` plus the members named here, copied as the mint wrote them (a dotted name reaches into a nested object;
55
+ * a member the card does not carry is simply absent). Only members whose size does not grow with content are named —
56
+ * paths, ids, closed words, counts, digests — so a kind whose every other member is content has an empty row. One row per
57
+ * card the engine mints, no row without one: the catalog refuses itself below otherwise. A caller-declared card has no
58
+ * row; its skeleton is `{ type }`.
59
+ */
60
+ export declare const CARD_SKELETONS: Readonly<Record<string, readonly string[]>>;
52
61
  /** The declared face of one definition, by definition id — what a definition module spreads into its spec. */
53
62
  export declare function toolFace(id: string): ToolFaceDeclaration;
54
63
  /** Is `contract` a contract object the catalog minted for an engine definition ({@link toolFace}) — the one record of "the engine
@@ -184,6 +184,54 @@ export const ENGINE_CARDS = Object.freeze({
184
184
  read_unestablished: "src/tools/fs/shell-read-check.ts",
185
185
  bash_self_kill_refused: "src/tools/fs/pattern-kill-guard.ts",
186
186
  });
187
+ export const CARD_SKELETONS = Object.freeze({
188
+ create: ["filePath", "contentSha256"],
189
+ update: ["filePath", "contentSha256"],
190
+ edit: ["filePath", "replaceAll", "contentSha256"],
191
+ "notebook-edit": ["notebookPath", "cellId", "editMode", "cellType", "newCellId", "contentSha256"],
192
+ text: ["file.filePath", "file.numLines", "file.startLine", "file.totalLines", "file.truncatedByTokenCap"],
193
+ notebook: ["file.filePath"],
194
+ image: ["file.type", "file.originalSize", "file.dimensions"],
195
+ document: ["file.type", "file.originalSize", "file.pageCount", "file.timedOut", "fallback.level"],
196
+ grep: ["mode", "numFiles", "totalFiles", "numMatches", "numLines", "totalLines", "appliedLimit", "appliedOffset", "partial", "fallback"],
197
+ glob: ["numFiles", "truncated", "durationMs", "totalMatches", "countIsComplete"],
198
+ "repo-map": ["sourceFiles", "renderedFiles", "nonSourceFiles", "truncated"],
199
+ bash: ["exitCode", "interrupted", "timedOut", "timeoutSec", "requestedTimeoutSec", "cappedToMaxTimeoutSec", "livenessNoOutput", "noOutputSec", "aborted", "isImage", "output_file", "detached", "task_id", "sandboxUnavailable", "refusedBy", "refused", "transportLost", "envSuspended", "authFailed", "targetUnavailable", "registerFailed", "killFailed"],
200
+ bash_invalid_timeout: ["code"],
201
+ bash_self_kill_refused: ["code", "finding", "pid", "relation"],
202
+ readonly_out_of_root: ["code"],
203
+ read_unestablished: ["code"],
204
+ path_not_in_root: ["code", "target"],
205
+ read_path_denied: ["code", "target", "pattern"],
206
+ artifact: ["action", "plane", "code", "invalidArguments", "url", "path", "bytes", "mediaType", "ref.url", "ref.slug", "ref.version"],
207
+ worktree: ["action", "worktreeDir", "base", "kept", "metadataPruned"],
208
+ "task-stop": ["task_type", "task_id", "status", "retrieval_status", "error", "code", "stoppedBy", "completionId"],
209
+ "monitor-start": ["taskId", "persistent", "envBudgetSec", "effectiveTimeoutMs", "timeoutIgnored", "sessionScoped", "timeoutMs", "requestedTimeoutMs", "wasClamped", "sandboxUnavailable", "refusedBy"],
210
+ "send-message": ["status", "to", "address", "seq", "task_id", "marker", "doorbell", "verdict", "subscription"],
211
+ "agent-transcript": ["id", "agentState"],
212
+ "list-agents": ["directoryFault"],
213
+ "read-inbox": ["error", "delivered", "pending", "urgent", "notTaken"],
214
+ "workflow-run": ["status", "workflowRunId", "task_id"],
215
+ "report-findings": ["count", "level"],
216
+ "tool-search": ["total_deferred_tools"],
217
+ advisor: ["outcome", "model", "servedModel", "stopReason", "code", "errorKind", "hold", "inputTooLongRuledOut", "usage"],
218
+ "ask-question": ["questionId", "continuationSource", "runContinues", "reason", "code"],
219
+ "exit-plan-mode": ["isAgent", "filePath"],
220
+ "enter-plan-mode": ["message"],
221
+ "cron-create": ["id", "recurring", "durable", "replaced", "nextFireAt"],
222
+ "cron-delete": ["id"],
223
+ "cron-list": [],
224
+ "schedule-wakeup": ["stopped", "scheduledFor", "clampedDelaySeconds", "wasClamped", "noop", "cancelledWakeups"],
225
+ "web-fetch": ["url", "code", "bytes", "durationMs", "truncated", "partial", "timedOut", "aborted"],
226
+ "web-search": ["durationSeconds", "searchCount", "retryable"],
227
+ todo: [],
228
+ task: ["task.id", "task.status", "task.owner", "deleted"],
229
+ "task-list": [],
230
+ agent: ["status", "isAsync", "task_id", "settle_id", "subagent_type", "taskId", "sessionId", "code", "retryAfterMs", "resolvedModel", "worktreePath"],
231
+ fork: [],
232
+ mcp: [],
233
+ a2a: ["state", "kind", "taskId", "contextId", "code", "delivered"],
234
+ });
187
235
  const byId = new Map();
188
236
  for (const e of TOOL_CATALOG_ENTRIES) {
189
237
  if (byId.has(e.id))
@@ -93,9 +93,10 @@ export declare function formatToolError(error: unknown): string;
93
93
  * terminal codes, not foreign ones); (c) pre-existing precedent (`config.compliance_required`,
94
94
  * NOT part of this diff) already folds a transient/retryable governance code into `config`.
95
95
  * The whole `env.` namespace is `config` BY PREFIX: a terminal code there is a refusal or a
96
- * limit of the execution environment — `env.lifetime_expired`, or the code a deployment's
97
- * `executionEnvFactory` throws when it refuses to mint (the engine carries a factory's code
98
- * to the terminal verbatim; the module registers none of them, so a code a later deployment
96
+ * limit of the execution environment — `env.lifetime_expired`, the code a deployment's
97
+ * `executionEnvFactory` throws when it refuses to mint, or the code an adapter answers at the
98
+ * leg's restore seat when it refuses to establish (the engine carries both to the terminal
99
+ * verbatim; the module registers none of them, so a code a later deployment
99
100
  * mints still reads `config`) — and what a caller does about every one of them is the same:
100
101
  * change the environment or the configuration, then retry. The other `env.`-spelled strings
101
102
  * of the codebase (a prompt-assembly block id, mod-kernel event names) are never a terminal