@sema-agent/core 7.59.0 → 7.61.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 (643) hide show
  1. package/CHANGELOG.md +1169 -0
  2. package/README.md +2 -2
  3. package/dist/agents/agent-definition.d.ts +7 -0
  4. package/dist/agents/agent-definition.js +12 -0
  5. package/dist/agents/agent-transcript-tool.d.ts +4 -3
  6. package/dist/agents/agent-transcript-tool.js +4 -2
  7. package/dist/agents/cascade.d.ts +61 -10
  8. package/dist/agents/cascade.js +60 -20
  9. package/dist/agents/child-model-seat.js +6 -3
  10. package/dist/agents/composition-allowance.d.ts +53 -0
  11. package/dist/agents/composition-allowance.js +49 -0
  12. package/dist/agents/composition-placement.d.ts +29 -0
  13. package/dist/agents/composition-placement.js +24 -0
  14. package/dist/agents/cumulative-stats.d.ts +4 -0
  15. package/dist/agents/cumulative-stats.js +3 -1
  16. package/dist/agents/inherited-tool-pool.d.ts +28 -1
  17. package/dist/agents/inherited-tool-pool.js +22 -0
  18. package/dist/agents/list-agents-tool.d.ts +1 -1
  19. package/dist/agents/peer-notice-route.d.ts +1 -1
  20. package/dist/agents/peer-notice-route.js +4 -3
  21. package/dist/agents/peer-notices.d.ts +4 -4
  22. package/dist/agents/peer-notices.js +8 -4
  23. package/dist/agents/peer-session-drain.d.ts +8 -1
  24. package/dist/agents/peer-session-drain.js +36 -7
  25. package/dist/agents/repair-loop.js +16 -6
  26. package/dist/agents/retain-ledger.d.ts +11 -1
  27. package/dist/agents/retain-ledger.js +16 -3
  28. package/dist/agents/roster-store.d.ts +2 -2
  29. package/dist/agents/roster-store.js +8 -3
  30. package/dist/agents/send-message-tool.d.ts +14 -27
  31. package/dist/agents/send-message-tool.js +47 -54
  32. package/dist/agents/subagent-completion-gate.d.ts +35 -0
  33. package/dist/agents/subagent-completion-gate.js +62 -0
  34. package/dist/agents/subagent-steps.d.ts +7 -6
  35. package/dist/agents/subagent.d.ts +52 -28
  36. package/dist/agents/subagent.js +276 -246
  37. package/dist/agents/suspend-guard.d.ts +9 -0
  38. package/dist/agents/suspend-guard.js +4 -0
  39. package/dist/agents/tool-filter.d.ts +1 -3
  40. package/dist/agents/tool-filter.js +4 -12
  41. package/dist/agents/verify.d.ts +41 -14
  42. package/dist/agents/verify.js +37 -27
  43. package/dist/bench/metrics.d.ts +3 -5
  44. package/dist/bench/metrics.js +0 -1
  45. package/dist/brain/anthropic.js +1 -0
  46. package/dist/brain/degrading.js +3 -1
  47. package/dist/brain/errors.d.ts +7 -1
  48. package/dist/brain/errors.js +6 -0
  49. package/dist/brain/failover.js +2 -1
  50. package/dist/brain/open-responses.js +1 -0
  51. package/dist/brain/openai.js +1 -0
  52. package/dist/brain/provider-dialect.d.ts +10 -0
  53. package/dist/brain/provider-dialect.js +13 -2
  54. package/dist/brain/route-adjudicator.js +3 -1
  55. package/dist/brain/status-sink.d.ts +7 -1
  56. package/dist/brain/status-sink.js +6 -0
  57. package/dist/brain/stream-engine.d.ts +3 -0
  58. package/dist/brain/stream-engine.js +4 -0
  59. package/dist/brain/timeout.d.ts +3 -1
  60. package/dist/brain/timeout.js +18 -5
  61. package/dist/core/a2a.d.ts +15 -5
  62. package/dist/core/a2a.js +34 -19
  63. package/dist/core/agent-definition.d.ts +20 -0
  64. package/dist/core/agent-state.d.ts +1 -1
  65. package/dist/core/allow-entry.d.ts +61 -23
  66. package/dist/core/allow-entry.js +134 -39
  67. package/dist/core/artifact-host.d.ts +0 -2
  68. package/dist/core/artifact-host.js +0 -1
  69. package/dist/core/ask-origin.d.ts +79 -0
  70. package/dist/core/ask-origin.js +76 -0
  71. package/dist/core/ask-question.d.ts +19 -13
  72. package/dist/core/ask-question.js +8 -2
  73. package/dist/core/auto-compaction.d.ts +2 -0
  74. package/dist/core/auto-compaction.js +2 -1
  75. package/dist/core/auto-mode-defaults.d.ts +8 -0
  76. package/dist/core/auto-mode-defaults.js +1 -0
  77. package/dist/core/auto-mode-rebuild.d.ts +2 -1
  78. package/dist/core/auto-mode.d.ts +39 -4
  79. package/dist/core/auto-mode.js +66 -17
  80. package/dist/core/background-agent-store.d.ts +17 -6
  81. package/dist/core/background-agent-store.js +15 -13
  82. package/dist/core/background-shell.d.ts +12 -1
  83. package/dist/core/background-shell.js +12 -0
  84. package/dist/core/checkpoint-requirements.d.ts +24 -3
  85. package/dist/core/checkpoint-requirements.js +9 -1
  86. package/dist/core/checkpoint-store.d.ts +86 -32
  87. package/dist/core/checkpoint-store.js +10 -5
  88. package/dist/core/child-clamp-seats.d.ts +3 -2
  89. package/dist/core/child-clamp-seats.js +4 -3
  90. package/dist/core/closest-name.d.ts +13 -0
  91. package/dist/core/closest-name.js +35 -0
  92. package/dist/core/compliance.d.ts +1 -1
  93. package/dist/core/context-settings.js +3 -5
  94. package/dist/core/credential-echo.d.ts +52 -0
  95. package/dist/core/credential-echo.js +65 -0
  96. package/dist/core/credential-vocabulary.d.ts +13 -3
  97. package/dist/core/credential-vocabulary.js +12 -4
  98. package/dist/core/cross-boundary-taint.d.ts +5 -6
  99. package/dist/core/decision-receipt.d.ts +14 -1
  100. package/dist/core/decision-receipt.js +6 -3
  101. package/dist/core/delegation-frames.d.ts +13 -9
  102. package/dist/core/effective-path-target.js +2 -3
  103. package/dist/core/engine-attestation.d.ts +11 -1
  104. package/dist/core/engine-attestation.js +2 -0
  105. package/dist/core/engine-notice.d.ts +106 -32
  106. package/dist/core/file-history-retention.d.ts +8 -0
  107. package/dist/core/file-history-retention.js +14 -11
  108. package/dist/core/file-history-store.d.ts +31 -1
  109. package/dist/core/file-history-store.js +31 -2
  110. package/dist/core/frame-settlement.d.ts +15 -0
  111. package/dist/core/frame-settlement.js +10 -1
  112. package/dist/core/fs-write-gate-policy.d.ts +3 -3
  113. package/dist/core/fs-write-gate-policy.js +8 -7
  114. package/dist/core/gate-fold.js +9 -6
  115. package/dist/core/gate-lanes.js +46 -12
  116. package/dist/core/gate-outcome.d.ts +40 -1
  117. package/dist/core/gate-outcome.js +10 -0
  118. package/dist/core/git-worktree-env.d.ts +7 -3
  119. package/dist/core/git-worktree-env.js +16 -13
  120. package/dist/core/governance-codes.d.ts +19 -3
  121. package/dist/core/governance-codes.js +27 -3
  122. package/dist/core/hands-band-screen.js +0 -1
  123. package/dist/core/hands-band.d.ts +0 -3
  124. package/dist/core/hooks.d.ts +51 -60
  125. package/dist/core/hooks.js +131 -78
  126. package/dist/core/host-floor.js +3 -5
  127. package/dist/core/image-admission.d.ts +145 -52
  128. package/dist/core/image-admission.js +202 -47
  129. package/dist/core/image-downsample.d.ts +36 -69
  130. package/dist/core/image-downsample.js +111 -73
  131. package/dist/core/input-author.d.ts +36 -0
  132. package/dist/core/input-author.js +39 -0
  133. package/dist/core/integer-option.d.ts +21 -0
  134. package/dist/core/integer-option.js +13 -0
  135. package/dist/core/leg-identity.d.ts +62 -0
  136. package/dist/core/leg-identity.js +18 -0
  137. package/dist/core/locked-config.d.ts +55 -3
  138. package/dist/core/locked-config.js +84 -51
  139. package/dist/core/lsp.d.ts +5 -3
  140. package/dist/core/lsp.js +3 -2
  141. package/dist/core/mailbox-store.d.ts +85 -10
  142. package/dist/core/mailbox-store.js +31 -10
  143. package/dist/core/mcp-call-meta.d.ts +2 -2
  144. package/dist/core/mcp-call-meta.js +9 -10
  145. package/dist/core/mcp-connection-pool.d.ts +6 -20
  146. package/dist/core/mcp-connection-pool.js +10 -28
  147. package/dist/core/mcp-failure.d.ts +83 -16
  148. package/dist/core/mcp-failure.js +67 -30
  149. package/dist/core/mcp-host-seat.d.ts +131 -0
  150. package/dist/core/mcp-host-seat.js +305 -0
  151. package/dist/core/mcp-probe.d.ts +7 -2
  152. package/dist/core/mcp-probe.js +9 -4
  153. package/dist/core/mcp-server-link.d.ts +18 -6
  154. package/dist/core/mcp-server-link.js +19 -4
  155. package/dist/core/mcp-server-spec.d.ts +39 -9
  156. package/dist/core/mcp-server-spec.js +55 -21
  157. package/dist/core/mcp-session-end.d.ts +1 -2
  158. package/dist/core/mcp-session-end.js +1 -1
  159. package/dist/core/mcp.d.ts +23 -55
  160. package/dist/core/mcp.js +172 -156
  161. package/dist/core/media-byte-cap.d.ts +21 -46
  162. package/dist/core/media-byte-cap.js +55 -55
  163. package/dist/core/member-group.d.ts +7 -0
  164. package/dist/core/member-group.js +35 -0
  165. package/dist/core/memory-admission.d.ts +23 -6
  166. package/dist/core/memory-admission.js +19 -9
  167. package/dist/core/memory-engine/consolidation.d.ts +1 -1
  168. package/dist/core/memory-engine/consolidation.js +7 -1
  169. package/dist/core/memory-engine/content-origin.d.ts +13 -0
  170. package/dist/core/memory-engine/content-origin.js +21 -3
  171. package/dist/core/memory-engine/dual-root.d.ts +31 -0
  172. package/dist/core/memory-engine/dual-root.js +59 -11
  173. package/dist/core/memory-engine/engine.js +27 -24
  174. package/dist/core/memory-engine/file-backend.d.ts +13 -0
  175. package/dist/core/memory-engine/file-backend.js +35 -15
  176. package/dist/core/memory-engine/index.d.ts +2 -1
  177. package/dist/core/memory-engine/index.js +2 -1
  178. package/dist/core/memory-engine/layout.d.ts +3 -0
  179. package/dist/core/memory-engine/layout.js +13 -3
  180. package/dist/core/memory-engine/memory-deployment.d.ts +110 -0
  181. package/dist/core/memory-engine/memory-deployment.js +182 -0
  182. package/dist/core/memory-engine/scope-contract.d.ts +13 -3
  183. package/dist/core/memory-engine/scope-contract.js +2 -2
  184. package/dist/core/memory-engine/sync-client.d.ts +68 -13
  185. package/dist/core/memory-engine/sync-client.js +147 -18
  186. package/dist/core/memory-engine/sync-report.d.ts +106 -0
  187. package/dist/core/memory-engine/sync-report.js +119 -0
  188. package/dist/core/memory-engine/sync.d.ts +13 -3
  189. package/dist/core/mode-policy.d.ts +15 -7
  190. package/dist/core/mode-policy.js +18 -6
  191. package/dist/core/model-receipt.d.ts +39 -0
  192. package/dist/core/model-receipt.js +139 -0
  193. package/dist/core/mods/agent-stations.d.ts +100 -0
  194. package/dist/core/mods/agent-stations.js +154 -0
  195. package/dist/core/mods/dollar.d.ts +62 -0
  196. package/dist/core/mods/extension-call.d.ts +15 -1
  197. package/dist/core/mods/extension-call.js +7 -2
  198. package/dist/core/mods/kernel/dispatch.d.ts +9 -4
  199. package/dist/core/mods/kernel/dispatch.js +8 -8
  200. package/dist/core/mods/kernel/events.d.ts +13 -4
  201. package/dist/core/mods/kernel/events.js +14 -10
  202. package/dist/core/mods/kernel/receive.d.ts +5 -0
  203. package/dist/core/mods/kernel/receive.js +10 -0
  204. package/dist/core/mods/kernel/registration.d.ts +3 -0
  205. package/dist/core/mods/kernel/registration.js +5 -0
  206. package/dist/core/mods/kernel/site-rules.d.ts +6 -3
  207. package/dist/core/mods/kernel/site-rules.js +10 -2
  208. package/dist/core/mods/lifecycle-stations.d.ts +41 -0
  209. package/dist/core/mods/lifecycle-stations.js +35 -0
  210. package/dist/core/mods/session-append.d.ts +115 -0
  211. package/dist/core/mods/session-append.js +311 -0
  212. package/dist/core/mods/session-compact.d.ts +48 -0
  213. package/dist/core/mods/session-compact.js +194 -0
  214. package/dist/core/mods/session-receive.d.ts +93 -0
  215. package/dist/core/mods/session-receive.js +141 -0
  216. package/dist/core/mods/session-send.d.ts +72 -0
  217. package/dist/core/mods/session-send.js +88 -0
  218. package/dist/core/mods/stations.d.ts +89 -75
  219. package/dist/core/mods/stations.js +57 -53
  220. package/dist/core/mods/tool-call.d.ts +12 -4
  221. package/dist/core/mods/tool-call.js +32 -16
  222. package/dist/core/mounted-mcp.d.ts +5 -0
  223. package/dist/core/mounted-mcp.js +2 -2
  224. package/dist/core/namespaced-rule-name.d.ts +7 -1
  225. package/dist/core/namespaced-rule-name.js +13 -2
  226. package/dist/core/oracle-isolation.js +1 -1
  227. package/dist/core/output-style.js +3 -4
  228. package/dist/core/own-property-receipt.d.ts +62 -0
  229. package/dist/core/own-property-receipt.js +43 -0
  230. package/dist/core/park-selfcheck.js +12 -10
  231. package/dist/core/path-identity.d.ts +11 -0
  232. package/dist/core/path-identity.js +4 -0
  233. package/dist/core/path-rule-binding.d.ts +3 -1
  234. package/dist/core/path-rule-binding.js +3 -1
  235. package/dist/core/peer-seat.d.ts +66 -11
  236. package/dist/core/peer-seat.js +199 -42
  237. package/dist/core/permission-rule-consent.d.ts +21 -26
  238. package/dist/core/permission-rule-consent.js +22 -3
  239. package/dist/core/permission-rule-model.d.ts +38 -13
  240. package/dist/core/permission-rule-model.js +54 -16
  241. package/dist/core/permission-rule-org.d.ts +1 -1
  242. package/dist/core/permission-rule-provider.js +4 -1
  243. package/dist/core/permission-rules.d.ts +4 -0
  244. package/dist/core/permission-rules.js +11 -16
  245. package/dist/core/protocol-http-auth.d.ts +14 -2
  246. package/dist/core/protocol-http-auth.js +16 -7
  247. package/dist/core/read-face-seats.d.ts +7 -5
  248. package/dist/core/read-face-seats.js +4 -1
  249. package/dist/core/redaction-marks.d.ts +4 -3
  250. package/dist/core/redaction-marks.js +2 -2
  251. package/dist/core/remote-env.d.ts +218 -122
  252. package/dist/core/remote-env.js +133 -14
  253. package/dist/core/retention-policy.d.ts +24 -23
  254. package/dist/core/retention-policy.js +36 -2
  255. package/dist/core/retention.d.ts +4 -1
  256. package/dist/core/retention.js +37 -12
  257. package/dist/core/retired-keys.d.ts +8 -3
  258. package/dist/core/retired-keys.js +4 -1
  259. package/dist/core/rewrite-rejudge.d.ts +12 -5
  260. package/dist/core/rewrite-rejudge.js +9 -5
  261. package/dist/core/roles.d.ts +37 -3
  262. package/dist/core/roles.js +126 -78
  263. package/dist/core/row-admission.d.ts +10 -0
  264. package/dist/core/row-admission.js +5 -0
  265. package/dist/core/rule-owner.d.ts +3 -0
  266. package/dist/core/runner/advisor-instructions.d.ts +2 -1
  267. package/dist/core/runner/advisor-instructions.js +2 -1
  268. package/dist/core/runner/announce-once-ledger.d.ts +4 -4
  269. package/dist/core/runner/assemble-result.d.ts +13 -8
  270. package/dist/core/runner/assemble-result.js +12 -8
  271. package/dist/core/runner/call-hook-stations.d.ts +17 -10
  272. package/dist/core/runner/call-hook-stations.js +21 -10
  273. package/dist/core/runner/caller-roster.d.ts +12 -9
  274. package/dist/core/runner/caller-roster.js +5 -2
  275. package/dist/core/runner/checkpoint-scope.d.ts +16 -1
  276. package/dist/core/runner/checkpoint-scope.js +21 -0
  277. package/dist/core/runner/child-tree.d.ts +7 -8
  278. package/dist/core/runner/child-tree.js +6 -6
  279. package/dist/core/runner/classifier-ladder.d.ts +10 -2
  280. package/dist/core/runner/classifier-ladder.js +39 -8
  281. package/dist/core/runner/compact-session.js +14 -2
  282. package/dist/core/runner/compaction-call-options.d.ts +1 -1
  283. package/dist/core/runner/compaction-restate.d.ts +2 -2
  284. package/dist/core/runner/compaction-restate.js +4 -3
  285. package/dist/core/runner/construction-doors.d.ts +2 -2
  286. package/dist/core/runner/construction-doors.js +7 -2
  287. package/dist/core/runner/contracts.d.ts +158 -65
  288. package/dist/core/runner/cross-boundary-lane.d.ts +4 -6
  289. package/dist/core/runner/cross-boundary-lane.js +11 -2
  290. package/dist/core/runner/decide-continuation.d.ts +4 -2
  291. package/dist/core/runner/decide-continuation.js +7 -4
  292. package/dist/core/runner/denial-limit-arms.d.ts +15 -21
  293. package/dist/core/runner/denial-limit-arms.js +17 -10
  294. package/dist/core/runner/env-capability-census.d.ts +15 -20
  295. package/dist/core/runner/env-capability-census.js +25 -34
  296. package/dist/core/runner/expire-settle.d.ts +44 -0
  297. package/dist/core/runner/expire-settle.js +55 -0
  298. package/dist/core/runner/file-history-request.d.ts +2 -2
  299. package/dist/core/runner/file-history-request.js +0 -8
  300. package/dist/core/runner/gate-exit.d.ts +75 -7
  301. package/dist/core/runner/gate-exit.js +20 -1
  302. package/dist/core/runner/git-status-frame.d.ts +5 -2
  303. package/dist/core/runner/git-status-frame.js +4 -4
  304. package/dist/core/runner/halt-attribution.d.ts +2 -1
  305. package/dist/core/runner/halt-attribution.js +2 -1
  306. package/dist/core/runner/image.d.ts +7 -2
  307. package/dist/core/runner/image.js +14 -8
  308. package/dist/core/runner/inline-image.d.ts +10 -8
  309. package/dist/core/runner/inline-image.js +11 -9
  310. package/dist/core/runner/local-claims.d.ts +17 -0
  311. package/dist/core/runner/local-claims.js +18 -0
  312. package/dist/core/runner/media-removed-seat.d.ts +46 -0
  313. package/dist/core/runner/media-removed-seat.js +88 -0
  314. package/dist/core/runner/memory-consolidation-driver.js +4 -4
  315. package/dist/core/runner/park-commit.d.ts +2 -2
  316. package/dist/core/runner/permission-rule-lanes.d.ts +5 -1
  317. package/dist/core/runner/permission-rule-lanes.js +29 -10
  318. package/dist/core/runner/person-path-rows.js +1 -1
  319. package/dist/core/runner/placement-fence.d.ts +26 -0
  320. package/dist/core/runner/placement-fence.js +38 -0
  321. package/dist/core/runner/prepare-ask-lane.d.ts +6 -12
  322. package/dist/core/runner/prepare-ask-lane.js +4 -4
  323. package/dist/core/runner/prepare-boundary-parks.d.ts +6 -3
  324. package/dist/core/runner/prepare-boundary-parks.js +4 -4
  325. package/dist/core/runner/prepare-caps-and-workflow.d.ts +6 -0
  326. package/dist/core/runner/prepare-caps-and-workflow.js +5 -3
  327. package/dist/core/runner/prepare-config-doors.d.ts +6 -1
  328. package/dist/core/runner/prepare-config-doors.js +30 -26
  329. package/dist/core/runner/prepare-context-lane.d.ts +6 -2
  330. package/dist/core/runner/prepare-context-lane.js +13 -13
  331. package/dist/core/runner/prepare-delegation-surface.d.ts +13 -11
  332. package/dist/core/runner/prepare-delegation-surface.js +7 -8
  333. package/dist/core/runner/prepare-execution-env.d.ts +5 -2
  334. package/dist/core/runner/prepare-execution-env.js +7 -4
  335. package/dist/core/runner/prepare-file-history.d.ts +10 -12
  336. package/dist/core/runner/prepare-file-history.js +3 -12
  337. package/dist/core/runner/prepare-gate-stations.d.ts +23 -17
  338. package/dist/core/runner/prepare-gate-stations.js +10 -7
  339. package/dist/core/runner/prepare-hands-readface.d.ts +8 -6
  340. package/dist/core/runner/prepare-hands-readface.js +19 -11
  341. package/dist/core/runner/prepare-inherited-gate.d.ts +11 -4
  342. package/dist/core/runner/prepare-inherited-gate.js +12 -5
  343. package/dist/core/runner/prepare-lsp.d.ts +3 -0
  344. package/dist/core/runner/prepare-lsp.js +2 -2
  345. package/dist/core/runner/prepare-memory-engine-session.js +1 -1
  346. package/dist/core/runner/prepare-memory.d.ts +2 -2
  347. package/dist/core/runner/prepare-memory.js +2 -2
  348. package/dist/core/runner/prepare-park-ask.d.ts +8 -7
  349. package/dist/core/runner/prepare-park-ask.js +6 -12
  350. package/dist/core/runner/prepare-policy-chain.d.ts +15 -25
  351. package/dist/core/runner/prepare-policy-chain.js +131 -128
  352. package/dist/core/runner/prepare-project-context.d.ts +2 -2
  353. package/dist/core/runner/prepare-project-context.js +8 -5
  354. package/dist/core/runner/prepare-prompt-inputs.d.ts +4 -0
  355. package/dist/core/runner/prepare-prompt-inputs.js +4 -2
  356. package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
  357. package/dist/core/runner/prepare-protocol-tools.js +9 -2
  358. package/dist/core/runner/prepare-question-face.d.ts +6 -4
  359. package/dist/core/runner/prepare-question-face.js +2 -2
  360. package/dist/core/runner/prepare-run-refs.d.ts +3 -0
  361. package/dist/core/runner/prepare-run-refs.js +2 -2
  362. package/dist/core/runner/prepare-suspend-saga.d.ts +11 -9
  363. package/dist/core/runner/prepare-suspend-saga.js +21 -13
  364. package/dist/core/runner/prepare-task.d.ts +1 -1
  365. package/dist/core/runner/prepare-task.js +84 -42
  366. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +6 -0
  367. package/dist/core/runner/prepare-tool-disclosure-mount.js +3 -1
  368. package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
  369. package/dist/core/runner/prepare-turn-wiring.js +7 -2
  370. package/dist/core/runner/prepare-wiring-manifest.d.ts +7 -3
  371. package/dist/core/runner/prepare-wiring-manifest.js +34 -19
  372. package/dist/core/runner/prepare-workspace-restore.d.ts +5 -0
  373. package/dist/core/runner/prepare-workspace-restore.js +12 -8
  374. package/dist/core/runner/read-root-grant.d.ts +1 -1
  375. package/dist/core/runner/read-root-grant.js +2 -1
  376. package/dist/core/runner/resume-admission.d.ts +5 -3
  377. package/dist/core/runner/resume-admission.js +17 -3
  378. package/dist/core/runner/resume-apply.js +3 -1
  379. package/dist/core/runner/resume-checkpoint-screen.js +4 -4
  380. package/dist/core/runner/resume-claim.d.ts +8 -3
  381. package/dist/core/runner/resume-claim.js +28 -12
  382. package/dist/core/runner/resume-internals-and-config.d.ts +2 -2
  383. package/dist/core/runner/resume-internals-and-config.js +10 -1
  384. package/dist/core/runner/resume-preflight.d.ts +3 -2
  385. package/dist/core/runner/resume-preflight.js +13 -26
  386. package/dist/core/runner/retired-runner-deps.js +6 -1
  387. package/dist/core/runner/run-attachment-seats.js +3 -3
  388. package/dist/core/runner/run-brain-sinks.js +1 -0
  389. package/dist/core/runner/run-git-lane.d.ts +3 -1
  390. package/dist/core/runner/run-git-lane.js +3 -2
  391. package/dist/core/runner/run-harness-handlers.d.ts +3 -1
  392. package/dist/core/runner/run-harness-handlers.js +5 -3
  393. package/dist/core/runner/run-identity-wiring.d.ts +2 -2
  394. package/dist/core/runner/run-identity-wiring.js +15 -6
  395. package/dist/core/runner/run-leg.d.ts +3 -3
  396. package/dist/core/runner/run-leg.js +65 -56
  397. package/dist/core/runner/run-notification-lane.d.ts +3 -1
  398. package/dist/core/runner/run-notification-lane.js +36 -12
  399. package/dist/core/runner/run-recovery-lanes.js +3 -2
  400. package/dist/core/runner/run-settle-and-teardown.js +14 -8
  401. package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
  402. package/dist/core/runner/run-stop-and-final-verify.js +12 -4
  403. package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +1 -1
  404. package/dist/core/runner/run-terminal-adoption.d.ts +1 -1
  405. package/dist/core/runner/run-terminal-adoption.js +26 -17
  406. package/dist/core/runner/run-turn-boundary.js +37 -19
  407. package/dist/core/runner/runtask.d.ts +25 -7
  408. package/dist/core/runner/runtask.js +46 -22
  409. package/dist/core/runner/session-rule-policy.d.ts +1 -1
  410. package/dist/core/runner/session-rule-policy.js +6 -1
  411. package/dist/core/runner/shell-env-withheld.d.ts +1 -1
  412. package/dist/core/runner/skills-seat.js +2 -2
  413. package/dist/core/runner/stream-halt-verbs.d.ts +1 -14
  414. package/dist/core/runner/stream-halt-verbs.js +4 -3
  415. package/dist/core/runner/stream-reap.d.ts +7 -6
  416. package/dist/core/runner/stream-reap.js +13 -16
  417. package/dist/core/runner/stream-settle-backstop.d.ts +3 -2
  418. package/dist/core/runner/stream-settle-backstop.js +5 -3
  419. package/dist/core/runner/stream-steer-verb.d.ts +5 -2
  420. package/dist/core/runner/stream-steer-verb.js +8 -7
  421. package/dist/core/runner/sub-agent-deny-lists.js +10 -7
  422. package/dist/core/runner/synthetic-tools.js +2 -2
  423. package/dist/core/runner/terminal-account.d.ts +11 -1
  424. package/dist/core/runner/terminal-account.js +20 -0
  425. package/dist/core/runner/terminal-projection.d.ts +8 -2
  426. package/dist/core/runner/terminal-projection.js +2 -2
  427. package/dist/core/runner/tool-disclosure.d.ts +3 -0
  428. package/dist/core/runner/tool-disclosure.js +5 -4
  429. package/dist/core/runner/tool-end-body.d.ts +3 -3
  430. package/dist/core/runner/tool-end-body.js +1 -1
  431. package/dist/core/runner/tool-face-overlay.d.ts +1 -1
  432. package/dist/core/runner/tool-face-overlay.js +26 -19
  433. package/dist/core/runner/tool-output-projection.d.ts +3 -3
  434. package/dist/core/runner/tool-output-projection.js +7 -6
  435. package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
  436. package/dist/core/runner/tool-result-media-seat.js +17 -1
  437. package/dist/core/runner/tool-table-view.d.ts +56 -0
  438. package/dist/core/runner/tool-table-view.js +51 -0
  439. package/dist/core/runner/turn-attachments.d.ts +6 -7
  440. package/dist/core/runner/turn-attachments.js +4 -17
  441. package/dist/core/runner/void-verifier-pause.d.ts +33 -0
  442. package/dist/core/runner/void-verifier-pause.js +41 -0
  443. package/dist/core/runner-deps.d.ts +55 -43
  444. package/dist/core/secret-env.d.ts +14 -13
  445. package/dist/core/secret-env.js +8 -9
  446. package/dist/core/session-log-transfer.js +9 -10
  447. package/dist/core/session-policy-store.d.ts +10 -3
  448. package/dist/core/session-policy-store.js +21 -3
  449. package/dist/core/session-reconcile.d.ts +3 -2
  450. package/dist/core/session-reconcile.js +7 -4
  451. package/dist/core/session-store.d.ts +5 -2
  452. package/dist/core/session-store.js +53 -16
  453. package/dist/core/session.d.ts +2 -1
  454. package/dist/core/shell-confinement.d.ts +37 -0
  455. package/dist/core/shell-confinement.js +56 -0
  456. package/dist/core/skill-grant.d.ts +9 -0
  457. package/dist/core/skill-grant.js +18 -0
  458. package/dist/core/store-contracts/checkpoint-store-contract.d.ts +2 -2
  459. package/dist/core/store-contracts/checkpoint-store-contract.js +15 -2
  460. package/dist/core/store-contracts/file-history-store-contract.d.ts +5 -2
  461. package/dist/core/store-contracts/file-history-store-contract.js +25 -1
  462. package/dist/core/store-contracts/mailbox-store-contract.d.ts +12 -5
  463. package/dist/core/store-contracts/mailbox-store-contract.js +156 -9
  464. package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
  465. package/dist/core/store-contracts/tool-result-store-contract.js +67 -0
  466. package/dist/core/stub-env.d.ts +5 -5
  467. package/dist/core/stub-env.js +11 -1
  468. package/dist/core/swappable-deps.d.ts +17 -43
  469. package/dist/core/swappable-deps.js +15 -5
  470. package/dist/core/synthetic-read-verdict.d.ts +1 -1
  471. package/dist/core/task-event.d.ts +35 -10
  472. package/dist/core/task-limits.d.ts +5 -0
  473. package/dist/core/task-notification.d.ts +172 -12
  474. package/dist/core/task-notification.js +209 -12
  475. package/dist/core/task-registry-agent.d.ts +23 -55
  476. package/dist/core/task-registry-agent.js +41 -56
  477. package/dist/core/task-registry-monitor.d.ts +8 -1
  478. package/dist/core/task-registry-monitor.js +43 -61
  479. package/dist/core/task-registry-shared.d.ts +52 -114
  480. package/dist/core/task-registry-shared.js +24 -48
  481. package/dist/core/task-registry-workflow.js +5 -22
  482. package/dist/core/task-registry.d.ts +64 -90
  483. package/dist/core/task-registry.js +73 -119
  484. package/dist/core/task-result.d.ts +27 -19
  485. package/dist/core/task-spec-members.d.ts +39 -0
  486. package/dist/core/task-spec-members.js +92 -0
  487. package/dist/core/task-spec.d.ts +13 -16
  488. package/dist/core/task-stream.d.ts +1 -1
  489. package/dist/core/task-tool-shape.d.ts +7 -57
  490. package/dist/core/task-tool-shape.js +7 -66
  491. package/dist/core/terminal-cause.d.ts +30 -0
  492. package/dist/core/terminal-cause.js +1 -0
  493. package/dist/core/tool-catalog-entries.js +3 -6
  494. package/dist/core/tool-check-reading.js +16 -10
  495. package/dist/core/tool-conformance.js +1 -2
  496. package/dist/core/tool-errors.d.ts +6 -3
  497. package/dist/core/tool-errors.js +2 -0
  498. package/dist/core/tool-face-reader.d.ts +7 -6
  499. package/dist/core/tool-face-reader.js +6 -4
  500. package/dist/core/tool-face.d.ts +2 -3
  501. package/dist/core/tool-name-aliases.d.ts +23 -28
  502. package/dist/core/tool-name-aliases.js +63 -7
  503. package/dist/core/tool-name-readings.d.ts +14 -3
  504. package/dist/core/tool-name-readings.js +2 -0
  505. package/dist/core/tool-policy.d.ts +113 -22
  506. package/dist/core/tool-policy.js +85 -15
  507. package/dist/core/tool-registry.d.ts +5 -5
  508. package/dist/core/tool-registry.js +2 -2
  509. package/dist/core/tool-result-store.d.ts +111 -5
  510. package/dist/core/tool-result-store.js +52 -12
  511. package/dist/core/tool-spec.d.ts +39 -10
  512. package/dist/core/trace.d.ts +18 -2
  513. package/dist/core/types.d.ts +3 -3
  514. package/dist/core/types.js +1 -1
  515. package/dist/core/untrusted-text.js +1 -1
  516. package/dist/core/user-attachment.d.ts +10 -5
  517. package/dist/core/user-attachment.js +40 -27
  518. package/dist/core/workflow-journal-store.d.ts +1 -1
  519. package/dist/core/workflow-run-store.d.ts +2 -0
  520. package/dist/core/workflow-run-store.js +6 -5
  521. package/dist/core/workflow-settled-run.d.ts +5 -0
  522. package/dist/core/workflow-settled-run.js +7 -0
  523. package/dist/engine/execution-env/node-execution-env.d.ts +37 -7
  524. package/dist/engine/execution-env/node-execution-env.js +224 -21
  525. package/dist/engine/harness/agent-harness.d.ts +66 -19
  526. package/dist/engine/harness/agent-harness.js +98 -27
  527. package/dist/engine/harness/messages.d.ts +4 -3
  528. package/dist/engine/harness/messages.js +2 -2
  529. package/dist/engine/harness/types.d.ts +151 -34
  530. package/dist/engine/llm/media-removed.d.ts +14 -0
  531. package/dist/engine/llm/media-removed.js +9 -0
  532. package/dist/engine/llm/rejected-images.d.ts +35 -25
  533. package/dist/engine/llm/rejected-images.js +59 -10
  534. package/dist/engine/llm/types.d.ts +24 -3
  535. package/dist/engine/llm/types.js +7 -3
  536. package/dist/engine/loop/agent-loop.d.ts +18 -13
  537. package/dist/engine/loop/agent-loop.js +173 -32
  538. package/dist/engine/loop/types.d.ts +21 -5
  539. package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
  540. package/dist/engine/lsp/node-lsp-manager.js +32 -13
  541. package/dist/engine/session/import-validate.js +7 -0
  542. package/dist/fixtures/index.d.ts +7 -5
  543. package/dist/fixtures/index.js +5 -3
  544. package/dist/index.d.ts +41 -23
  545. package/dist/index.js +29 -16
  546. package/dist/internal/harness-types.d.ts +3 -1
  547. package/dist/internal/llm.d.ts +2 -1
  548. package/dist/internal/llm.js +1 -0
  549. package/dist/orchestration/goal.d.ts +6 -2
  550. package/dist/orchestration/goal.js +6 -3
  551. package/dist/orchestration/run-workflow-tool.d.ts +20 -20
  552. package/dist/orchestration/run-workflow-tool.js +63 -56
  553. package/dist/orchestration/workflow-governance.d.ts +1 -1
  554. package/dist/orchestration/workflow-governance.js +2 -1
  555. package/dist/orchestration/workflow-types.d.ts +2 -2
  556. package/dist/orchestration/workflow.d.ts +8 -0
  557. package/dist/orchestration/workflow.js +33 -9
  558. package/dist/prompts/default.d.ts +1 -10
  559. package/dist/prompts/default.js +0 -2
  560. package/dist/stores/file/background-agent-store.d.ts +1 -1
  561. package/dist/stores/file/background-agent-store.js +19 -14
  562. package/dist/stores/file/checkpoint-store.d.ts +127 -2
  563. package/dist/stores/file/checkpoint-store.js +24 -16
  564. package/dist/stores/file/file-history-store.d.ts +1 -1
  565. package/dist/stores/file/file-history-store.js +4 -1
  566. package/dist/stores/file/index.d.ts +9 -6
  567. package/dist/stores/file/index.js +33 -9
  568. package/dist/stores/file/ledger-tuning.d.ts +23 -0
  569. package/dist/stores/file/ledger-tuning.js +21 -0
  570. package/dist/stores/file/mailbox-store.d.ts +1 -1
  571. package/dist/stores/file/mailbox-store.js +43 -21
  572. package/dist/stores/file/memory-store.d.ts +1 -1
  573. package/dist/stores/file/memory-store.js +4 -1
  574. package/dist/stores/file/permission-rule-adopt.js +24 -21
  575. package/dist/stores/file/permission-rule-store.js +6 -3
  576. package/dist/stores/file/session-policy-store.d.ts +1 -1
  577. package/dist/stores/file/session-policy-store.js +4 -1
  578. package/dist/stores/file/session-store.d.ts +17 -4
  579. package/dist/stores/file/session-store.js +22 -19
  580. package/dist/stores/file/shared-ledger.d.ts +26 -0
  581. package/dist/stores/file/shared-ledger.js +38 -9
  582. package/dist/stores/file/tool-result-store.d.ts +31 -2
  583. package/dist/stores/file/tool-result-store.js +129 -7
  584. package/dist/stores/file/usage-window-store.d.ts +1 -1
  585. package/dist/stores/file/usage-window-store.js +4 -1
  586. package/dist/stores/file/workflow-journal-store.d.ts +1 -13
  587. package/dist/stores/file/workflow-journal-store.js +4 -18
  588. package/dist/stores/file/workflow-run-store.d.ts +1 -1
  589. package/dist/stores/file/workflow-run-store.js +15 -10
  590. package/dist/tools/fs/containment-face.d.ts +5 -0
  591. package/dist/tools/fs/dead-cwd.d.ts +5 -5
  592. package/dist/tools/fs/dead-cwd.js +4 -11
  593. package/dist/tools/fs/encoding.d.ts +13 -4
  594. package/dist/tools/fs/encoding.js +17 -2
  595. package/dist/tools/fs/fs-bash-background-text.d.ts +13 -0
  596. package/dist/tools/fs/fs-bash-background-text.js +7 -0
  597. package/dist/tools/fs/fs-bash.d.ts +11 -22
  598. package/dist/tools/fs/fs-bash.js +58 -154
  599. package/dist/tools/fs/fs-pdf.d.ts +2 -2
  600. package/dist/tools/fs/fs-pdf.js +34 -27
  601. package/dist/tools/fs/fs-read.d.ts +5 -4
  602. package/dist/tools/fs/fs-read.js +35 -18
  603. package/dist/tools/fs/fs-search-tools.js +4 -1
  604. package/dist/tools/fs/fs-shared.d.ts +39 -16
  605. package/dist/tools/fs/fs-shared.js +25 -6
  606. package/dist/tools/fs/fs-write.js +5 -5
  607. package/dist/tools/fs/index.d.ts +15 -9
  608. package/dist/tools/fs/index.js +12 -18
  609. package/dist/tools/fs/pdf.d.ts +4 -4
  610. package/dist/tools/fs/pdf.js +6 -6
  611. package/dist/tools/fs/read-deny-home.js +8 -1
  612. package/dist/tools/fs/read-deny.d.ts +26 -2
  613. package/dist/tools/fs/read-deny.js +9 -2
  614. package/dist/tools/fs/read-floor.d.ts +57 -6
  615. package/dist/tools/fs/read-floor.js +241 -2
  616. package/dist/tools/fs/removal-targets.d.ts +9 -4
  617. package/dist/tools/fs/removal-targets.js +17 -9
  618. package/dist/tools/fs/search.d.ts +6 -5
  619. package/dist/tools/fs/search.js +10 -10
  620. package/dist/tools/fs/shell-read-establish.js +3 -1
  621. package/dist/tools/fs/shell-read-identity.d.ts +3 -1
  622. package/dist/tools/fs/shell-read-identity.js +4 -2
  623. package/dist/tools/fs/shell-read-judge.d.ts +7 -1
  624. package/dist/tools/fs/shell-read-judge.js +1 -1
  625. package/dist/tools/monitor.d.ts +12 -10
  626. package/dist/tools/monitor.js +22 -13
  627. package/dist/tools/scheduler-tools.js +42 -4
  628. package/dist/tools/web.d.ts +0 -10
  629. package/dist/tools/web.js +1 -4
  630. package/dist/tools/worktree.d.ts +5 -1
  631. package/dist/tools/worktree.js +20 -17
  632. package/package.json +8 -3
  633. package/test/export-surface.snapshot.json +166 -30
  634. package/wire-changes/core-stores-sql@7.60.0.json +30 -0
  635. package/wire-changes/core-stores-sql@7.61.0.json +480 -0
  636. package/wire-changes/core@7.60.0.json +3274 -0
  637. package/wire-changes/core@7.61.0.json +4405 -0
  638. package/wire-changes/mods-kernel@7.60.0.json +62 -0
  639. package/wire-changes/mods-kernel@7.61.0.json +65 -0
  640. package/wire-changes/primitives@7.60.0.json +30 -0
  641. package/wire-changes/primitives@7.61.0.json +30 -0
  642. package/dist/core/runner/image-removed-seat.d.ts +0 -12
  643. package/dist/core/runner/image-removed-seat.js +0 -19
@@ -219,14 +219,11 @@ export interface TaskSpec {
219
219
  * is a property of the submission, not of the channel it arrived on — a persistent connection can still
220
220
  * mix interactive and one-shot submissions, which a connection-level flag could not express.
221
221
  *
222
- * Currently consumed by the `RunWorkflow` tool's guidance text only (RB-215 candidate ①):
223
- * a workflow started from a one-shot submission is told to actively block-wait via
224
- * `TaskOutput({ block: true })` before ending its turn, instead of the default "end your turn, you will
225
- * be notified" guidance — the latter is actively wrong here (BGB drilldown case 2, `../sema-test/bench-bg/
226
- * intel/drilldown-C101-B401-20260727.md`: a model that followed that exact guidance lost background
227
- * results because the one-shot process had nothing left alive to receive the notification). Default
228
- * `false`/absent = today's behavior (unchanged for interactive sessions). A deployment MAY thread it
229
- * into other one-shot-sensitive decisions of its own.
222
+ * What the engine does with it: the run's ending waits for the loop-type background tasks it launched (agents,
223
+ * continued agents, workflows) — their terminal frames are owed to the run's lane and arrive as later turns,
224
+ * bounded by the walltime and a 600 s ceiling — and does not wait for process-type ones (a background command,
225
+ * a Monitor watch), whose receipts carry one sentence saying so. Default `false`/absent = interactive (unchanged).
226
+ * A deployment MAY thread it into other one-shot-sensitive decisions of its own.
230
227
  *
231
228
  * INHERITED down the delegation tree (only the `true` value, off the trusted
232
229
  * {@link ToolExecuteContext.oneShot} seat): the property being described — "the process this
@@ -441,11 +438,8 @@ export interface TaskSpec {
441
438
  *
442
439
  * There is NO capture request anymore: first-touch tracking is ON whenever a `RunnerDeps.fileHistoryStore`
443
440
  * is wired, `RunnerDeps.fileHistoryCapture` is not `"off"`, and no {@link fileHistory} off switch is set (per-edited-file backups are near-zero cost — no tree walk,
444
- * no size gate), which is what retired the old `rewindFiles` capture request. The retired
445
- * `rewindFiles` spelling is handled at prepare: its capture sense (true, no `resumeAt`) is a
446
- * tolerated no-op with a deprecation disclosure (the intent is structurally satisfied); its restore
447
- * sense (true, with `resumeAt`) is a typed retirement rejection naming THIS field — the restore
448
- * semantics genuinely changed (whole-tree ⇒ tracked set), so that migration must be explicit.
441
+ * no size gate). The retired `rewindFiles` key is refused by name at prepare (`config.spec_retired_key`) in
442
+ * both of its old senses; the restore sense is THIS field.
449
443
  */
450
444
  restoreFiles?: boolean;
451
445
  /**
@@ -820,7 +814,7 @@ export interface TaskSpec {
820
814
  * their own fake self-check; prompt discipline alone (1.242) had a low landing rate. Opt-in
821
815
  * because the evidence is from UNATTENDED long-task legs; consumers default it OFF and expose an
822
816
  * explicit opt-in (ruled 2026-08-04). Interactive deployments choose per scenario. Read-only /
823
- * Q&A runs never trigger it. Telemetry: `stats.mechanisms.finalVerifyInjected`.
817
+ * Q&A runs never trigger it. Telemetry: `stats.mechanisms.finalVerifyInjections`.
824
818
  */
825
819
  finalVerification?: boolean;
826
820
  /**
@@ -1133,8 +1127,11 @@ export interface TaskSpec {
1133
1127
  * reads as nothing (`*`, `mcp__*` / `mcp__*__*`, a write-path or domain pattern) grants nothing and is announced at the start of the
1134
1128
  * run (`permission.allowed_tool_not_granted`); a list holding `*` grants nothing at all. A value that is not a list of
1135
1129
  * strings refuses the run before it starts (`config.invalid_permission_rules`, with its issues).
1130
+ *
1131
+ * A member may carry its rule SET's anchors, `{ rule, pathBases }` ({@link AllowListEntry} — the seat and the reading of a deny /
1132
+ * ask set's `pathBases`: a user layer's `/x` allow reaches `<config>/x`); one that is not exactly that refuses the run.
1136
1133
  */
1137
- allowedTools?: readonly string[];
1134
+ allowedTools?: readonly import("./allow-entry.js").AllowListEntry[];
1138
1135
  /**
1139
1136
  * Fraction of the model's context window the `<skills>` listing may spend. Absent ⇒ `0.01` (1%).
1140
1137
  * Domain `(0, 1]`; anything else — including `0`, a string, `NaN` — REFUSES at the door with
@@ -1166,7 +1163,7 @@ export interface TaskSpec {
1166
1163
  * design/129 — lifetime scope for BACKGROUND children (Agent/Fork `run_in_background`). Default `"task"`:
1167
1164
  * the parent runTask's terminal reaps them (design/115 — no orphans burning tokens; turn-end killed
1168
1165
  * frame). `"session"`: children OUTLIVE the turn (CC Backgrounded semantics) — registered under the
1169
- * SESSION owner (cross-turn TaskOutput poll works), skipped by the parent-teardown reap, force-capped by
1166
+ * SESSION owner (a later turn's TaskStop and the host poll reach it), skipped by the parent-teardown reap, force-capped by
1170
1167
  * a default child timeout when none is given, and finally reapable via
1171
1168
  * `TaskRegistry.reapSessionBackground(sessionId, scope)` (call it from your session release/sweep).
1172
1169
  * CALLER-trusted (systemPrompt tier): never a model-facing parameter, never on the governed workflow
@@ -270,7 +270,7 @@ export interface TaskStream extends AsyncIterable<TaskEvent> {
270
270
  * `memory.capture_optout_unavailable` (this run mounted no memory session — nothing to opt out
271
271
  * of), `memory.capture_optout_sweep_failed` (the record STANDS but the §2.3 boundary sweep could
272
272
  * not contain named residue paths — a repeat call is the retry lane),
273
- * `config.memory_capture_unsupported` (remote/per-run deployment shape with no
273
+ * `config.memory_capture_unsupported` (an execution env whose paths are not the host's, with no
274
274
  * {@link RunnerDeps.memoryCaptureRecordStore} — the record would not survive to a resume
275
275
  * replica), `steering.invalid_content` (a non-string `options.reason`), plus the steer-family
276
276
  * `steering.not_running` once the task has finished. Resolves `{ outcome }`: `"created"` = this
@@ -1,15 +1,9 @@
1
1
  import { Type } from "typebox";
2
- export declare const TASK_OUTPUT_TOOL_NAME = "TaskOutput";
3
2
  export declare const TASK_STOP_TOOL_NAME = "TaskStop";
4
- export declare const TASK_OUTPUT_CONTRACT: {
5
- readonly contractId: "core.task_output@1";
6
- readonly implementationRevision: "1";
7
- };
8
3
  export declare const TASK_STOP_CONTRACT: {
9
4
  readonly contractId: "core.task_stop@1";
10
5
  readonly implementationRevision: "1";
11
6
  };
12
- export declare const TASK_OUTPUT_MISSING_ID_MESSAGE = "Error (TaskOutput): Missing required parameter: task_id";
13
7
  export declare const TASK_STOP_MISSING_ID_MESSAGE = "Missing required parameter: task_id";
14
8
  export declare const TASK_STOP_PARAMS: Type.TObject<{
15
9
  task_id: Type.TOptional<Type.TString>;
@@ -17,58 +11,14 @@ export declare const TASK_STOP_PARAMS: Type.TObject<{
17
11
  }>;
18
12
  /**
19
13
  * Trims and skips blank/whitespace-only candidates, returning the first non-blank string among `values`.
20
- * RB-479-A①: callers pass ONLY the tool's declared id parameters (TaskOutput: task_id; TaskStop:
21
- * task_id, shell_id) — an id smuggled under any other key falls to the loud missing-parameter refusal.
22
- * The trim/skip-blank behavior stays (a whitespace-only id reports the same missing-parameter text as an
23
- * absent one, instead of falling through to a not-found lookup on the literal " ").
14
+ * RB-479-A①: callers pass ONLY the tool's declared id parameters (TaskStop: task_id, shell_id) — an id smuggled under
15
+ * any other key falls to the loud missing-parameter refusal. The trim/skip-blank behavior stays (a whitespace-only id
16
+ * reports the same missing-parameter text as an absent one, instead of falling through to a not-found lookup on the
17
+ * literal " ").
24
18
  */
25
19
  export declare function resolveTaskIdArg(...values: unknown[]): string | undefined;
26
20
  /**
27
- * design/157 B17 (S2) — the declaration face is a FUNCTION OF CAPABILITY (fable 终判 D3/D4/D6): what the
28
- * tool advertises to the model must match what the mount can actually do. A flag is true only when the
29
- * deployment really delivers that behavior; every composed sentence below is gated on the flag it
30
- * describes, so no mount ever advertises a file path that is never written, a notification that never
31
- * fires, a wait that never blocks, or name addressing that never resolves.
32
- */
33
- export interface TaskToolCapabilities {
34
- /** The unified registry face: workflow-task support + own-scope fencing (registry mounts only). */
35
- lanes: boolean;
36
- /** Bash(run_in_background)'s launch receipt carries the output file path (registry mounts only). */
37
- outputFile: boolean;
38
- /** A terminal <task-notification> fires when the task completes — true only when the deployment
39
- * actually wired `taskNotification` (B17 方案查出的既有假广告: the registry mount used to advertise
40
- * this unconditionally; prepare-task now passes the real wiring state). */
41
- notification: boolean;
42
- /** TaskOutput block/timeout wait semantics (registry pollTask; the env-direct poll is instantaneous). */
43
- blockWait: boolean;
44
- /** TaskStop accepts a background agent's spawn NAME as task_id (registry name resolution only). */
45
- nameAddressing: boolean;
46
- }
47
- /** Full-capability profile = the registry-backed mount with notifications wired. */
48
- export declare const REGISTRY_TASK_TOOL_CAPS: TaskToolCapabilities;
49
- /** The env-direct thin-shell profile: cursor polling over a background shell, nothing else. */
50
- export declare const ENV_DIRECT_TASK_TOOL_CAPS: TaskToolCapabilities;
51
- /**
52
- * TaskOutput description, composed per capability. With every flag true this reproduces the registry's
53
- * pre-S2 literal byte-for-byte — the first two sentences are the A5 deprecated form
54
- * (209-verbatim except the task-type names, mapped to sema's lanes; divergence-logged; the anchor
55
- * commentary lives at the registry factory). With `notification` false the <task-notification> half is
56
- * honestly omitted and the cursor-polling guidance (the env side's long-standing wording) is composed in
57
- * instead — completion must then be detected by status, and SAYING so is the capability-honest guidance.
58
- */
59
- export declare function composeTaskOutputDescription(caps: TaskToolCapabilities): string;
60
- /**
61
- * TaskStop description, composed per capability. All-true reproduces the registry literal (
62
- * the named-agent bullet is the reference's; its teammate bullet stays honestly omitted — sema's team face is
63
- * in-process, not registry-addressable); `nameAddressing:false` drops exactly that bullet (the env shell
64
- * has no agent-name resolution), which reproduces the env-direct literal.
65
- */
66
- export declare function composeTaskStopDescription(caps: TaskToolCapabilities): string;
67
- /**
68
- * TaskOutput params, composed per capability (fable 终判 D3 — an advertised parameter the execute body
69
- * ignores is a lie): block/timeout enter the schema only where the poll can actually wait
70
- * (design/116 W3 — CC TaskOutput block/timeout; sema block default documented as true, CC-parity).
71
- * Canonical surface stays design/115 review S-3: task_id + sema-delta filter — and (RB-479-A①) the
72
- * declared surface is also the RESOLVED surface; no undeclared id key is read.
21
+ * TaskStop's description. The named-agent bullet is the reference's; its teammate bullet stays honestly omitted —
22
+ * sema's team face is in-process, not registry-addressable.
73
23
  */
74
- export declare function composeTaskOutputParams(caps: Pick<TaskToolCapabilities, "blockWait" | "lanes">): ReturnType<typeof Type.Object>;
24
+ export declare const TASK_STOP_DESCRIPTION: string;
@@ -1,9 +1,6 @@
1
1
  import { Type } from "typebox";
2
- export const TASK_OUTPUT_TOOL_NAME = "TaskOutput";
3
2
  export const TASK_STOP_TOOL_NAME = "TaskStop";
4
- export const TASK_OUTPUT_CONTRACT = { contractId: "core.task_output@1", implementationRevision: "1" };
5
3
  export const TASK_STOP_CONTRACT = { contractId: "core.task_stop@1", implementationRevision: "1" };
6
- export const TASK_OUTPUT_MISSING_ID_MESSAGE = "Error (TaskOutput): Missing required parameter: task_id";
7
4
  export const TASK_STOP_MISSING_ID_MESSAGE = "Missing required parameter: task_id";
8
5
  export const TASK_STOP_PARAMS = Type.Object({
9
6
  task_id: Type.Optional(Type.String({ description: "The ID of the background task to stop" })),
@@ -16,66 +13,10 @@ export function resolveTaskIdArg(...values) {
16
13
  }
17
14
  return undefined;
18
15
  }
19
- export const REGISTRY_TASK_TOOL_CAPS = {
20
- lanes: true,
21
- outputFile: true,
22
- notification: true,
23
- blockWait: true,
24
- nameAddressing: true,
25
- };
26
- export const ENV_DIRECT_TASK_TOOL_CAPS = {
27
- lanes: false,
28
- outputFile: false,
29
- notification: false,
30
- blockWait: false,
31
- nameAddressing: false,
32
- };
33
- export function composeTaskOutputDescription(caps) {
34
- const parts = [];
35
- if (caps.outputFile) {
36
- parts.push("[Deprecated] — for background Bash tasks, prefer Read on the output file path; for agent tasks, use the Agent tool result directly. " +
37
- "DEPRECATED: Background tasks return their output file path in the tool result" +
38
- (caps.notification ? ", and you receive a <task-notification> with the same path when the task completes. " : ". "));
39
- }
40
- parts.push("Retrieve output or status for a background task by task_id. ");
41
- parts.push(caps.lanes
42
- ?
43
- "Supports background Bash tasks and workflow tasks returned by Workflow. Returns only the caller's own task scope; unknown and out-of-scope ids are " +
44
- "reported the same way. "
45
- : "Reads a background shell started with Bash(run_in_background): returns the run status (running / exited(code) / killed / failed) plus NEW stdout/stderr since your last call. ");
46
- if (!caps.notification) {
47
- parts.push('When using a background command as a wait condition, call this repeatedly until status is no longer "running" — completion ' +
48
- "is signalled by status/exitCode, not by any automatic notification; after you see a terminal status, one more " +
49
- "poll captures any final output. ");
50
- }
51
- if (!caps.lanes)
52
- parts.push("Optional `filter` is a regex keeping only matching lines.");
53
- return parts.join("").trimEnd();
54
- }
55
- export function composeTaskStopDescription(caps) {
56
- return [
57
- "- Stops a running background task by its ID",
58
- "- Takes a task_id parameter identifying the task to stop",
59
- ...(caps.nameAddressing ? ["- To stop a background agent spawned with a name, pass that name as task_id"] : []),
60
- "- Returns a success or failure status",
61
- "- Use this tool when you need to terminate a long-running task",
62
- ].join("\n");
63
- }
64
- export function composeTaskOutputParams(caps) {
65
- return Type.Object({
66
- task_id: Type.Optional(Type.String({
67
- description: caps.lanes
68
- ? "The task_id returned by Bash(run_in_background) or Workflow."
69
- : "The task_id returned by Bash(run_in_background).",
70
- })),
71
- ...(caps.blockWait
72
- ? {
73
- block: Type.Optional(Type.Boolean({
74
- description: "Whether to wait for completion (default true — the call waits until the task finishes or `timeout`, saving re-poll turns). Pass false for an instantaneous snapshot.",
75
- })),
76
- timeout: Type.Optional(Type.Number({ description: "Optional timeout in milliseconds when block is true (default 30000, max 600000)." })),
77
- }
78
- : {}),
79
- filter: Type.Optional(Type.String({ description: "Optional regex filter for background Bash output (sema extension)." })),
80
- });
81
- }
16
+ export const TASK_STOP_DESCRIPTION = [
17
+ "- Stops a running background task by its ID",
18
+ "- Takes a task_id parameter identifying the task to stop",
19
+ "- To stop a background agent spawned with a name, pass that name as task_id",
20
+ "- Returns a success or failure status",
21
+ "- Use this tool when you need to terminate a long-running task",
22
+ ].join("\n");
@@ -73,6 +73,12 @@ export type TerminalCause = {
73
73
  * - `"config.usage_window_unpriced"` — a `UsageWindow.maxCostUsd` over a run with no cost figure
74
74
  * (no `RunnerDeps.pricing` entry and no `Model.cost`).
75
75
  * - `"usage_window.store_cost_unanswered"` — the wired ledger does not carry the money arm.
76
+ * Two codes name a model whose output the loop could not use after its bounded retries — the run did not
77
+ * finish its work, though its last turn reads like an ordinary one:
78
+ * - `"model.malformed_tool_use_exhausted"` — every tool call of the model's turns kept arriving unparseable
79
+ * and the retry budget is spent (nothing ran for them).
80
+ * - `"model.truncated_output_exhausted"` — the model's answer kept ending on the output cap and the
81
+ * continue budget is spent (`result` holds the text it reached).
76
82
  * A NESTED orchestrator that met a durable pause it cannot drive stamps `"unexpected.suspended"` /
77
83
  * `"unexpected.needs_review"` and carries the pause on {@link nestedPause}.
78
84
  */
@@ -100,6 +106,14 @@ export type TerminalCause = {
100
106
  * (`nestedPause.token` → `runner.resume`). Absent on every failure the engine itself assembles.
101
107
  */
102
108
  nestedPause?: PausedCause;
109
+ /**
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),
112
+ * `declined` (the store refused to reopen it — read the row), `unknown` (the reopen threw: its state is unprovable).
113
+ * Beside `code`, never folded into it: the code still names what ended the leg. PRESENCE: only on such a leg; a
114
+ * fresh run, a leg that started its approved action and a delivered negative decision carry none.
115
+ */
116
+ unstartedRow?: "reopened" | "declined" | "unknown";
103
117
  } | {
104
118
  kind: "blocked";
105
119
  /**
@@ -214,6 +228,18 @@ export type TerminalFailureDetail = {
214
228
  * states none leaves it absent.
215
229
  */
216
230
  route?: RequestRoute;
231
+ /**
232
+ * Which part of the request the refusal named, when the engine classified it off the provider's envelope at the brain
233
+ * boundary — the terminal message's own `errorKind`, carried when it is one of {@link REFUSED_REQUEST_PARTS}:
234
+ * `input_too_long` (the input alone exceeds the context limit), `image_unprocessable` (an image could not be
235
+ * processed), `tool_schema_refused` (one tool's input schema; {@link tool} names it). Absent when the refusal named
236
+ * no part this engine classifies — the account says nothing about it, and nothing is read from the provider's words.
237
+ */
238
+ errorKind?: RefusedRequestPart;
239
+ /** With `errorKind: "tool_schema_refused"`: the tool whose input schema the provider refused (the message's
240
+ * `refusedTool`). A tool the engine could not send without its schema (not an MCP / A2A tool, or the transcript's bound
241
+ * of 8 reached) ends the run here; one it could is re-sent and never names a terminal. */
242
+ tool?: string;
217
243
  } | {
218
244
  kind: "coded";
219
245
  /**
@@ -237,6 +263,10 @@ export type TerminalFailureDetail = {
237
263
  * cap) — what the brain's sentence words as its cap clause. */
238
264
  outputLimit?: OutputLimit;
239
265
  };
266
+ /** The parts of a request a provider's refusal can name that the brain boundary classifies — the closed set of
267
+ * `provider_rejected.errorKind` ({@link TerminalFailureDetail}). New members join with a minor. */
268
+ export declare const REFUSED_REQUEST_PARTS: readonly ["input_too_long", "image_unprocessable", "tool_schema_refused"];
269
+ export type RefusedRequestPart = (typeof REFUSED_REQUEST_PARTS)[number];
240
270
  /** A JSON-plain value as a `coded` account carries it. */
241
271
  export type CodedFailureDetailValue = string | number | boolean | null | readonly CodedFailureDetailValue[] | {
242
272
  readonly [key: string]: CodedFailureDetailValue;
@@ -1,3 +1,4 @@
1
+ export const REFUSED_REQUEST_PARTS = Object.freeze(["input_too_long", "image_unprocessable", "tool_schema_refused"]);
1
2
  export const PROMPT_BLOCK_CAUSES = Object.freeze(["block", "crashed", "timeout", "cancelled"]);
2
3
  const PROMPT_BLOCK_CAUSE_SET = new Set(PROMPT_BLOCK_CAUSES);
3
4
  export function isPromptBlockCause(v) {
@@ -1,4 +1,4 @@
1
- import { TASK_OUTPUT_CONTRACT, TASK_STOP_CONTRACT } from "./task-tool-shape.js";
1
+ import { TASK_STOP_CONTRACT } from "./task-tool-shape.js";
2
2
  export const FULL_SHELL_CONTRACT_ID = "core.bash@1";
3
3
  export const READONLY_SHELL_CONTRACT_ID = "core.bash_readonly@1";
4
4
  export const TASK_CREATE_TOOL_NAME = "TaskCreate";
@@ -120,10 +120,7 @@ export const TOOL_CATALOG_ENTRIES = [
120
120
  },
121
121
  { id: "enter-worktree", name: "EnterWorktree", source: "builtin", definedIn: "src/tools/worktree.ts", mountedBy: ["hands"], cards: ["worktree"], face: { family: "other", boundaryLegs: ["env"], effect: "write", contract: c("core.enter_worktree@1"), ruleFace: { params: ["name", "path", "baseRef"] } } },
122
122
  { id: "exit-worktree", name: "ExitWorktree", source: "builtin", definedIn: "src/tools/worktree.ts", mountedBy: ["hands"], cards: ["worktree"], face: { family: "other", boundaryLegs: ["env"], effect: "write", contract: c("core.exit_worktree@1"), ruleFace: { params: ["keep", "discardChanges", "action", "discard_changes"] } } },
123
- { id: "task-output-hands", name: "TaskOutput", source: "builtin", definedIn: "src/tools/fs/fs-bash.ts", mountedBy: ["hands"], cards: [], face: { family: "delegate", boundaryLegs: ["env"], effect: "read", contract: TASK_OUTPUT_CONTRACT, ruleFace: { params: ["task_id", "filter"] } } },
124
- { id: "task-stop-hands", name: "TaskStop", source: "builtin", definedIn: "src/tools/fs/fs-bash.ts", mountedBy: ["hands"], cards: [], face: { family: "delegate", boundaryLegs: ["env"], effect: "write", contract: TASK_STOP_CONTRACT, ruleFace: { params: ["task_id", "shell_id"] } } },
125
- { id: "task-output", name: "TaskOutput", source: "builtin", definedIn: "src/core/task-registry.ts", mountedBy: ["delegation"], cards: ["task-output"], face: { family: "delegate", boundaryLegs: "per_call", effect: "read", contract: TASK_OUTPUT_CONTRACT, ruleFace: { params: ["task_id", "block", "timeout", "filter"] } } },
126
- { id: "task-stop", name: "TaskStop", source: "builtin", definedIn: "src/core/task-registry.ts", mountedBy: ["delegation"], cards: ["task-stop"], face: { family: "delegate", boundaryLegs: "per_call", effect: "write", contract: TASK_STOP_CONTRACT, ruleFace: { params: ["task_id", "shell_id"] } } },
123
+ { id: "task-stop", name: "TaskStop", source: "builtin", definedIn: "src/core/task-registry.ts", mountedBy: ["hands", "delegation"], cards: ["task-stop"], face: { family: "delegate", boundaryLegs: "per_call", effect: "write", contract: TASK_STOP_CONTRACT, ruleFace: { params: ["task_id", "shell_id"] } } },
127
124
  { id: "monitor", name: "Monitor", source: "builtin", definedIn: "src/tools/monitor.ts", mountedBy: ["backgroundTasks"], cards: ["monitor-start", "readonly_out_of_root", "read_unestablished"], face: { family: "other", boundaryLegs: ["env"], effect: "write", contract: c("core.monitor@1"), ruleFace: shellRuleFace(["command", "description", "timeout_ms", "persistent"]), offloadThresholdChars: 10_000 } },
128
125
  { id: "send-message", name: "SendMessage", protocol: ["teammate"], source: "builtin", definedIn: "src/agents/send-message-tool.ts", mountedBy: ["delegation", "hostInternals", "peerLane"], cards: ["send-message"], face: { family: "protocol", boundaryLegs: ["outside_write"], effect: "write", contract: c("core.send_message@1"), ruleFace: { params: ["to", "message", "summary", "notify_when_idle", "urgent"] } } },
129
126
  { id: "agent-transcript", name: "AgentTranscript", source: "builtin", definedIn: "src/agents/agent-transcript-tool.ts", mountedBy: ["delegation"], cards: ["agent-transcript"], face: { family: "delegate", boundaryLegs: [], effect: "read", contract: c("core.agent_transcript@1"), ruleFace: { params: ["id", "lastN"] } } },
@@ -134,7 +131,7 @@ export const TOOL_CATALOG_ENTRIES = [
134
131
  { id: "report-findings", name: "ReportFindings", source: "builtin", definedIn: "src/core/runner/synthetic-tools.ts", mountedBy: ["always"], cards: ["report-findings"], face: { family: "scaffold", boundaryLegs: [], effect: "read", contract: c("core.report_findings@1"), ruleFace: { params: ["level"] } } },
135
132
  { id: "structured-output", name: OUTPUT_TOOL_NAME, protocol: ["structured"], source: "synthetic", definedIn: "src/core/runner/synthetic-tools.ts", mountedBy: ["optional"], cards: [], face: { family: "scaffold", boundaryLegs: [], effect: "read", contract: c("core.structured_output@1") } },
136
133
  { id: "skill", name: "Skill", source: "builtin", definedIn: "src/core/runner/synthetic-tools.ts", mountedBy: ["optional"], cards: [], face: { family: "scaffold", boundaryLegs: [], effect: "read", contract: c("core.skill@1"), renderHints: { approvalCard: "skill" }, ruleFace: { params: ["skill", "args"] } } },
137
- { id: "read-tool-result", name: "ReadToolResult", source: "builtin", definedIn: "src/core/tool-result-store.ts", mountedBy: ["optional"], cards: [], face: { family: "scaffold", boundaryLegs: [], effect: "read", contract: c("core.read_tool_result@1"), budgetExempt: true, ruleFace: { params: ["ref", "offset", "limit"] } } },
134
+ { id: "read-tool-result", name: "ReadToolResult", source: "builtin", definedIn: "src/core/tool-result-store.ts", mountedBy: ["optional"], cards: [], face: { family: "scaffold", boundaryLegs: "per_call", effect: "read", contract: c("core.read_tool_result@1"), budgetExempt: true, ruleFace: { params: ["ref", "offset", "limit"] } } },
138
135
  { id: "tool-search", name: "ToolSearch", source: "builtin", definedIn: "src/core/runner/tool-disclosure.ts", mountedBy: ["optional"], cards: ["tool-search"], face: { family: "scaffold", boundaryLegs: [], effect: "read", contract: c("core.tool_search@1"), ruleFace: { params: ["query", "max_results"] } } },
139
136
  { id: "advisor", name: "advisor", source: "builtin", definedIn: "src/core/runner/advisor-tool.ts", mountedBy: ["optional"], cards: ["advisor"], face: { family: "scaffold", boundaryLegs: [], effect: "read", contentOrigin: "local", contract: c("core.advisor@1"), offload: false, budgetExempt: true, ruleFace: { params: [] } } },
140
137
  { id: "ask-user-question", name: "AskUserQuestion", source: "builtin", definedIn: "src/core/ask-question.ts", mountedBy: ["optional"], cards: ["ask-question"], face: { family: "other", boundaryLegs: [], effect: "read", contract: c("core.ask_user_question@1"), renderHints: { approvalCard: "question" }, ruleFace: { params: [] } } },
@@ -1,6 +1,6 @@
1
- import { refusalOf } from "./tool-policy.js";
1
+ import { extensionNamed, extensionQuestionText, extensionSpeaker, refusalOf } from "./tool-policy.js";
2
+ import { hookAskReasonOf, joinAskReasons } from "./ask-origin.js";
2
3
  import { allowRuleShadowOf, withAllowRuleShadow } from "./allow-entry.js";
3
- import { inlineUntrusted } from "./untrusted-text.js";
4
4
  import { failedHandlerClause } from "./mods/stations.js";
5
5
  const STANDS = Object.freeze({ kind: "stands" });
6
6
  function readToolCheck(heard, standing, call, mayClear) {
@@ -17,9 +17,11 @@ function readToolCheck(heard, standing, call, mayClear) {
17
17
  if (heard.decision === "deny")
18
18
  return refused(`tool "${toolName}" denied by ${who}${why}`, heard.by);
19
19
  if (heard.decision === "ask") {
20
- return standing.action === "ask"
21
- ? { kind: "asked", ask: { ...standing, decisionReason: "hook", ...(heard.reason !== undefined ? { message: heard.reason } : {}) }, minted: false }
22
- : { kind: "asked", ask: { ...questionOf(heard, toolName), ...rewritten }, minted: true };
20
+ if (standing.action === "ask") {
21
+ const askReasons = joinAskReasons(standing.askReasons, [entryOf(heard)]);
22
+ return { kind: "asked", ask: { ...standing, decisionReason: "hook", ...(heard.reason !== undefined ? { message: heard.reason } : {}), ...(askReasons !== undefined ? { askReasons } : {}) }, minted: false };
23
+ }
24
+ return { kind: "asked", ask: { ...questionOf(heard, toolName), ...rewritten }, minted: true };
23
25
  }
24
26
  if (standing.action === "allow")
25
27
  return STANDS;
@@ -29,15 +31,18 @@ function readToolCheck(heard, standing, call, mayClear) {
29
31
  return { kind: "shadowed", shadows: [allowRuleShadowOf("hook", entries)] };
30
32
  }
31
33
  export function extensionAllowOf(speakers, rewrite) {
32
- const who = speakers.length > 0 ? speakers.map((s) => `extension "${inlineUntrusted(s, 80)}"`).join(", ") : "an extension";
34
+ const who = speakers.length > 0 ? speakers.map(extensionNamed).join(", ") : "an extension";
33
35
  return { action: "allow", message: `${who} allowed this call`, decisionReason: "hook", ...(rewrite !== undefined ? { updatedInput: rewrite } : {}) };
34
36
  }
35
37
  function speakerOf(heard) {
36
- return { who: heard.by !== undefined ? `extension "${inlineUntrusted(heard.by, 80)}"` : "an extension", why: heard.reason !== undefined ? `: ${inlineUntrusted(heard.reason, 500)}` : "" };
38
+ return extensionSpeaker(heard.by, heard.reason);
39
+ }
40
+ function entryOf(heard) {
41
+ return hookAskReasonOf(heard.by, "asked", heard.reason);
37
42
  }
38
43
  function questionOf(heard, toolName) {
39
- const { who, why } = speakerOf(heard);
40
- return { action: "ask", message: `tool "${toolName}" needs approval (asked by ${who}${why})`, decisionReason: "hook" };
44
+ const entry = entryOf(heard);
45
+ return { action: "ask", message: extensionQuestionText(toolName, entry), decisionReason: "hook", askReasons: Object.freeze([entry]) };
41
46
  }
42
47
  export async function readToolChecks(chains, standing, call, project) {
43
48
  let raised = false;
@@ -61,7 +66,8 @@ export async function readToolChecks(chains, standing, call, project) {
61
66
  return { kind: "approved", allow: { ...settled, updatedInput: settled.updatedInput }, ...(moved?.kind === "asked" ? { outstanding: moved.ask } : {}) };
62
67
  continue;
63
68
  }
64
- const ask = current.action === "ask" ? current : settled;
69
+ const joined = current.action === "ask" ? joinAskReasons(current.askReasons, settled.askReasons) : undefined;
70
+ const ask = current.action === "ask" ? (joined !== undefined ? { ...current, askReasons: joined } : current) : settled;
65
71
  moved = { kind: "asked", ask, minted: current.action !== "ask" || (moved?.kind === "asked" && moved.minted), marked: true };
66
72
  current = ask;
67
73
  continue;
@@ -20,8 +20,7 @@ export const TOOL_CONFORMANCE_VECTORS = [
20
20
  { name: "Edit", why: "the read-only band mounts the read half only" },
21
21
  { name: "Write", why: "the read-only band mounts the read half only" },
22
22
  { name: "NotebookEdit", why: "the read-only band mounts the read half only" },
23
- { name: "TaskOutput", why: "the background-shell pair mounts on the full shell only" },
24
- { name: "TaskStop", why: "the background-shell pair mounts on the full shell only" },
23
+ { name: "TaskStop", why: "the background-command stop mounts on the full shell only" },
25
24
  { name: "EnterWorktree", why: "the worktree pair needs the tracked cwd the full shell owns" },
26
25
  { name: "ExitWorktree", why: "the worktree pair needs the tracked cwd the full shell owns" },
27
26
  { name: "LSP", why: "needs a wired LSP manager" },
@@ -51,7 +51,9 @@ export declare function formatToolError(error: unknown): string;
51
51
  *
52
52
  * - `budget` — the cost/token budget gate fired (`limits.max_tokens_exceeded` / `limits.max_cost_exceeded`).
53
53
  * - `limit` — a hard run limit fired (`limits.max_turns_exceeded` / `limits.max_walltime_exceeded`).
54
- * - `output` — the structured/answer output was rejected (`output.invalid` / `output.degenerate`).
54
+ * - `output` — the structured/answer output was rejected (`output.invalid` / `output.degenerate`), or the
55
+ * model's output could not be used after the loop's bounded retries (`model.malformed_tool_use_exhausted`
56
+ * / `model.truncated_output_exhausted`).
55
57
  * - `suspend` — the suspend-loop cap fired (`suspend.loop`); a TERMINAL failure, distinct from a
56
58
  * resumable `suspended` status (which carries no errorCode).
57
59
  * - `review` — a review-pause terminal (`review.pending`).
@@ -118,8 +120,9 @@ export type WorkerErrorClass = "budget" | "limit" | "output" | "suspend" | "revi
118
120
  * SCOPE: this folds a TERMINAL `TaskResult.errorCode` only — i.e. every OUR dotted prefix that the runner can
119
121
  * assemble into a failed task outcome (`limits.`/`output.`/`suspend.`/`review.`/`unexpected.`/
120
122
  * `oracle.`/`resume.`/`config.`/`usage.`) as a broad PREFIX, plus `memory.admission_required` /
121
- * `memory.admission_denied` / `env.lifetime_expired` as EXACT codes (their sibling `memory.*`/`env.*` strings
122
- * are NOT all terminal-errorCode-shaped — see {@link EXACT_CODE_CLASS}'s comment), plus the flat 1.36 codes.
123
+ * `memory.admission_denied` / `env.lifetime_expired` / the two `model.*_exhausted` loop terminals as EXACT codes (their
124
+ * sibling `memory.*`/`env.*`/`model.*` strings are NOT all terminal-errorCode-shaped — see {@link EXACT_CODE_CLASS}'s
125
+ * comment), plus the flat 1.36 codes.
123
126
  * The `limits.` namespace splits into the `budget` and `limit` classes by exact code — see
124
127
  * {@link EXACT_CODE_CLASS}. Operation-level dotted codes that are surfaced to a *caller* and never become a
125
128
  * task outcome are deliberately OUT of scope: `steering.*` (`steering.not_running`/`steering.invalid_content`/
@@ -89,6 +89,8 @@ const EXACT_CODE_CLASS = new Map([
89
89
  ["memory.admission_denied", "config"],
90
90
  ["memory.capture_optout_denied", "config"],
91
91
  ["env.lifetime_expired", "config"],
92
+ ["model.malformed_tool_use_exhausted", "output"],
93
+ ["model.truncated_output_exhausted", "output"],
92
94
  ]);
93
95
  const DOTTED_PREFIX_CLASS = [
94
96
  ["limits.", "limit"],
@@ -9,15 +9,16 @@
9
9
  * the prepare path, and the public surface is tiered by where a symbol is declared (`readToolAxes` is `advanced` for the same reason).
10
10
  */
11
11
  import { type McpServerSpec } from "./mcp-server-spec.js";
12
+ /** Every member name a face declaration has, at any depth — the words a `toolFaces` refusal's member path spells (derived from the tables above). */
13
+ export declare const TOOL_FACE_WORDS: ReadonlySet<string>;
12
14
  /**
13
15
  * {@link readToolFaces}'s answer. `ok: true` hands back a copy of the faces that the reader itself built, plain data and none of the caller's own
14
16
  * objects; `faces` is absent when nothing is declared (no key at all, or an empty record). `ok: false` carries one sentence (its detail cut at
15
- * 240 characters) naming the tool and the member that did not fit. What it may quote of the declaration is its structure and nothing of its content:
16
- * a tool or member name (quoted, a tool name cut at 80 characters), the word a closed table refuses, a key or a list entry over its bound (its
17
- * first 40 characters), a key a pattern parameter names, a count and its bound. It never quotes display text (`userFacingName`, `activity`) or
18
- * the entries of a list that fits. These are the mount's judge's own sentences, the ones it announces at the listing, so the reader and the mount
19
- * tell one operator one thing; `readToolAxes` refuses in the same sentence shape and names no word because an axis word is never a name the
20
- * operator needs echoed to find the fault.
17
+ * 240 characters) pointing at the tool and the member that did not fit. It says the face's own member names, the closed words a member takes,
18
+ * kinds, counts and bounds; it never says the declaration's content — a tool name, an unknown member's name, a word a closed table refuses, a
19
+ * parameter name, a list entry, display text: each is shown in the one caller's-text shape (`callerText`: the redaction mark and its length).
20
+ * These are the mount's judge's own sentences, the ones it announces at the listing, so the reader and the mount tell one operator one thing;
21
+ * `readToolAxes` refuses in the same sentence shape.
21
22
  */
22
23
  export type ToolFacesRead = {
23
24
  ok: true;
@@ -1,5 +1,6 @@
1
- import { dataKind, perToolEmptyName, perToolEntryRefusal, quotedName, receivePerToolDeclaration } from "./mcp-server-spec.js";
1
+ import { callerText, dataKind, perToolEmptyName, perToolEntryRefusal, receivePerToolDeclaration } from "./mcp-server-spec.js";
2
2
  import { isPlainRecord } from "./mods/kernel/receive.js";
3
+ import { strayMembersOf } from "./own-property-receipt.js";
3
4
  import { faceProblem } from "./runner/tool-face-overlay.js";
4
5
  import { inlineUntrusted } from "./untrusted-text.js";
5
6
  const TOOL_FACE_MEMBERS = { family: true, pathTarget: true, hostTarget: true, renderHints: true, ruleFace: true };
@@ -9,6 +10,7 @@ const HOST_TARGET_KINDS = { param: "string" };
9
10
  const HOST_TARGET_REQUIRED = ["param"];
10
11
  const RENDER_HINT_KINDS = { userFacingName: "string", activity: "string", summaryParams: "list", resultCards: "list", approvalCard: "string" };
11
12
  const RULE_FACE_KINDS = { primaryParams: "list", params: "list", nameValues: "list" };
13
+ export const TOOL_FACE_WORDS = new Set([TOOL_FACE_MEMBERS, PATH_TARGET_KINDS, HOST_TARGET_KINDS, RENDER_HINT_KINDS, RULE_FACE_KINDS].flatMap((table) => Object.keys(table)));
12
14
  function kindProblem(label, value, kind) {
13
15
  if (value === undefined)
14
16
  return undefined;
@@ -19,8 +21,8 @@ function kindProblem(label, value, kind) {
19
21
  function membersOf(raw, label, names) {
20
22
  if (!isPlainRecord(raw))
21
23
  return `${label} is ${dataKind(raw)}, not an object`;
22
- const unknown = Object.keys(raw).find((member) => !names.includes(member));
23
- return unknown === undefined ? raw : `${label} has the unknown member ${quotedName(unknown)} (the members are ${names.join(", ")})`;
24
+ const stray = strayMembersOf(raw, { subject: label, unit: "member", moment: "when the face is read" }, names);
25
+ return stray === undefined ? raw : `${label} has an unknown member ${callerText(String(stray.names[0]))} (the members are ${names.join(", ")})`;
24
26
  }
25
27
  function ownMember(record, name) {
26
28
  return Object.hasOwn(record, name) ? record[name] : undefined;
@@ -74,7 +76,7 @@ function readOneToolFace(raw) {
74
76
  export function readToolFaces(declared) {
75
77
  if (declared === undefined)
76
78
  return { ok: true };
77
- const received = receivePerToolDeclaration(declared, "toolFaces", "tool");
79
+ const received = receivePerToolDeclaration(declared, "toolFaces", "tool", TOOL_FACE_WORDS);
78
80
  if (!received.ok)
79
81
  return { ok: false, problem: received.problem };
80
82
  const entries = [];
@@ -16,13 +16,12 @@ export declare const TOOL_FAMILIES: readonly ["shell", "file-read", "file-write"
16
16
  export type ToolFamily = (typeof TOOL_FAMILIES)[number];
17
17
  /**
18
18
  * The closed set of MOUNT-CONDITION tags a static catalog entry is listed under. The static half of the
19
- * catalog carries an ARRAY (a tool can be mounted by more than one condition — TaskOutput rides both the
20
- * hand band and the delegation surface); the effect roster records the ONE tag that actually fired.
19
+ * catalog carries an ARRAY (a tool can be mounted by more than one condition); the effect roster records the ONE tag that actually fired.
21
20
  *
22
21
  * - `hands` — the hand band (an execution env is wired: `deps.executionEnv` / `executionEnvFactory`);
23
22
  * - `backgroundTasks` — the background-task surface (`Monitor`);
24
23
  * - `workflow` — the workflow tool surface (`Workflow`);
25
- * - `delegation` — the union of the background-task and workflow surfaces (TaskOutput/TaskStop/
24
+ * - `delegation` — the union of the background-task and workflow surfaces (TaskStop/
26
25
  * AgentTranscript, SendMessage's first condition);
27
26
  * - `hostInternals` — a host-internal seat is present (`RunInternals.parentNotify`);
28
27
  * - `peerLane` — the peer-session lane is mounted;
@@ -1,33 +1,5 @@
1
1
  import { type ProtocolNamespace } from "./protocol-table.js";
2
2
  import type { RuleBehavior } from "./permission-rule-model.js";
3
- /**
4
- * RB-476-A stage 2 (ruling 2026-08-02, RB-476 "no compatibility surface survives", replay
5
- * resolution included) — the durable-name machinery this module used to hold is RETIRED:
6
- *
7
- * - `OLD_TO_NEW` (the Q6/design-108/design-115 persisted-name normalization) and the MCP `mcp__`
8
- * prefix arm are gone: a persisted checkpoint/orphan/policy entry carrying a pre-rename name no
9
- * longer resolves to the live roster. Old durable state misses LOUDLY (`resume.tool_unavailable`
10
- * on a resumed checkpoint, a roster miss on replay) — by ruling, old sessions are sacrificed
11
- * rather than carried.
12
- * - `canonicalToolName` is gone with it: with the mapping cleared it was the identity function, and
13
- * keeping an identity shim invites the next mapping to grow back silently.
14
- * - `TOMBSTONED_TOOLS` (a second table of per-name re-education prose) is gone. A CALL to a retired name is
15
- * told what the one table here says about it ({@link judgeToolNameMiss}): the miss is `expected-absent`
16
- * with the successor, where any other unknown name stays the generic roster miss.
17
- *
18
- * What REMAINS is validation data: {@link RETIRED_TOOL_NAMES} maps every name the engine ever
19
- * retired to a one-line guidance string, and {@link judgeRuleToolName} is the ONE judgment of it a rule's
20
- * tool name gets ({@link toolNameFaultOf} adds the near-miss step: the one reading). They exist because deleting the mapping flips stale POLICY entries from "silently
21
- * matched" to "silently matches nothing" — and for a deny/requireApproval entry that direction WIDENS
22
- * the surface. `validatePermissionRules` (permission-rules.ts) does NOT classify retired names itself:
23
- * which names a deployment mounts its OWN tool under is a roster fact, and the judgment takes the roster.
24
- * A deployment that mounts its OWN tool under one of these names is unaffected: the name is then in the
25
- * roster and the judgment answers `current`.
26
- *
27
- * GRAMMAR of a guidance string, read by {@link judgeRuleToolName} and held by a pin: it opens with
28
- * `renamed "<name>"` (a 1:1 successor — the judgment's `currentName`), `folded into "<name>"` (merged into a
29
- * wider tool: writing it would deny more than the entry did, so it is no current name), or `removed — `.
30
- */
31
3
  export declare const RETIRED_TOOL_NAMES: ReadonlyMap<string, string>;
32
4
  /** The four answers {@link judgeRuleToolName} gives — a closed set. */
33
5
  export declare const RULE_TOOL_NAME_VERDICTS: readonly ["current", "retired", "unprefixed_namespace", "unmintable_segment"];
@@ -65,6 +37,7 @@ export type RuleToolNameVerdict = {
65
37
  readonly kind: "unmintable_segment";
66
38
  readonly guidance: string;
67
39
  readonly currentName?: string;
40
+ readonly ambiguous?: true;
68
41
  };
69
42
  /**
70
43
  * A name in ANY protocol namespace split into its owning namespace, its peer segment and its optional tool segment —
@@ -80,6 +53,27 @@ export declare function splitNamespacedName(name: string): {
80
53
  readonly peer: string;
81
54
  readonly tool?: string;
82
55
  } | undefined;
56
+ /** One way a rule name can be read as a protocol name: the peer's MINTED segment and, when the reading names a tool, its segment. */
57
+ export interface PeerReading {
58
+ readonly ns: ProtocolNamespace;
59
+ readonly peer: string;
60
+ readonly tool?: string;
61
+ }
62
+ /**
63
+ * Every way an MCP rule name can denote a peer, when it can be read more than one way — the readings the reference's lookup takes
64
+ * of a name whose server segment may itself carry the separator: a cut at EACH `__` of the body (server = what precedes the cut,
65
+ * tool = what follows) and the whole body as a server (`mcp__a__b` is tool `b` of server `a`, and server `a__b`). The reference
66
+ * spells a server `a__b` as is; the mint folds a run of `_` and drops a trailing one ({@link mintNamespacePrefix}), so a server
67
+ * segment is read through the mint — the peer a reading names is the one the mint would spell it as. `[]` for a name with no
68
+ * second reading: no separator in the body (the one reading is {@link splitNamespacedName}'s), a glob, an empty segment on either
69
+ * side of a cut, or a namespace the reference has no spelling for (only MCP's server names reach a rule from another product).
70
+ * The first reading is the first separator's — the one `splitNamespacedName` gives. The readings run one way only: from the
71
+ * reference's spelling to the minted peers. The fold is lossy (`a__b` and `a_b` mint one prefix) and only a peer segment is folded —
72
+ * the separator between a peer and its tool never is — so a name already in the minted spelling (`mcp__a_b__t`) is the name the
73
+ * engine mounts and is read as that, never as the unfolded spellings that fold to it (server `a`'s tool `b__t` is another tool);
74
+ * a name no mint produces (`b3126_echo`) reads as no tool, and the policy-name audit announces it.
75
+ */
76
+ export declare function peerReadingsOf(name: string): readonly PeerReading[];
83
77
  /**
84
78
  * Does a list of this behavior read a `*` in a tool name as a glob over the WHOLE name — anywhere in it, the lone `*` (every tool)
85
79
  * included? A list that RESTRICTS (`deny`, `ask`) does: it reaches every tool any of whose names the glob matches (the reference's
@@ -117,6 +111,7 @@ export type ToolNameFault = {
117
111
  readonly verdict: Exclude<RuleToolNameVerdict["kind"], "current">;
118
112
  readonly guidance?: string;
119
113
  readonly currentName?: string;
114
+ readonly ambiguous?: true;
120
115
  } | {
121
116
  readonly reason: "near_miss";
122
117
  readonly currentName: string;