@sema-agent/core 7.58.0 → 7.60.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 (519) hide show
  1. package/CHANGELOG.md +1340 -0
  2. package/README.md +6 -4
  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 +2 -1
  6. package/dist/agents/agent-transcript-tool.js +3 -1
  7. package/dist/agents/cc-peer-directory.js +8 -8
  8. package/dist/agents/child-model-seat.d.ts +4 -2
  9. package/dist/agents/child-model-seat.js +9 -4
  10. package/dist/agents/cumulative-stats.js +0 -1
  11. package/dist/agents/inherited-tool-pool.d.ts +26 -1
  12. package/dist/agents/inherited-tool-pool.js +22 -0
  13. package/dist/agents/peer-directory.d.ts +9 -0
  14. package/dist/agents/peer-directory.js +6 -2
  15. package/dist/agents/retain-ledger.d.ts +11 -1
  16. package/dist/agents/retain-ledger.js +13 -2
  17. package/dist/agents/roster-store.d.ts +1 -1
  18. package/dist/agents/roster-store.js +3 -1
  19. package/dist/agents/send-message-tool.d.ts +8 -19
  20. package/dist/agents/send-message-tool.js +32 -50
  21. package/dist/agents/subagent.d.ts +51 -17
  22. package/dist/agents/subagent.js +150 -112
  23. package/dist/agents/tool-filter.d.ts +1 -3
  24. package/dist/agents/tool-filter.js +4 -12
  25. package/dist/bench/metrics.d.ts +3 -5
  26. package/dist/bench/metrics.js +0 -1
  27. package/dist/brain/anthropic.js +161 -45
  28. package/dist/brain/degrading.js +3 -1
  29. package/dist/brain/errors.d.ts +9 -3
  30. package/dist/brain/errors.js +7 -1
  31. package/dist/brain/failover.js +2 -1
  32. package/dist/brain/open-responses.js +3 -3
  33. package/dist/brain/openai.js +103 -53
  34. package/dist/brain/provider-dialect.d.ts +11 -0
  35. package/dist/brain/provider-dialect.js +5 -2
  36. package/dist/brain/reasoning-request.js +5 -4
  37. package/dist/brain/reasoning.d.ts +19 -0
  38. package/dist/brain/reasoning.js +17 -2
  39. package/dist/brain/request-route.d.ts +4 -1
  40. package/dist/brain/request-route.js +4 -1
  41. package/dist/brain/route-adjudicator.d.ts +84 -18
  42. package/dist/brain/route-adjudicator.js +90 -22
  43. package/dist/brain/route-conformance.js +1 -1
  44. package/dist/brain/status-sink.d.ts +7 -1
  45. package/dist/brain/status-sink.js +6 -0
  46. package/dist/brain/stream-engine.js +84 -49
  47. package/dist/brain/stream-shared.d.ts +30 -0
  48. package/dist/brain/stream-shared.js +34 -1
  49. package/dist/brain/timeout.d.ts +65 -6
  50. package/dist/brain/timeout.js +111 -11
  51. package/dist/core/a2a.d.ts +15 -5
  52. package/dist/core/a2a.js +34 -19
  53. package/dist/core/account-row.d.ts +61 -0
  54. package/dist/core/account-row.js +51 -0
  55. package/dist/core/advisor-verdict.d.ts +2 -1
  56. package/dist/core/advisor-verdict.js +1 -1
  57. package/dist/core/agent-definition.d.ts +20 -0
  58. package/dist/core/allow-entry.d.ts +20 -6
  59. package/dist/core/allow-entry.js +17 -7
  60. package/dist/core/approval-object.d.ts +29 -15
  61. package/dist/core/approval-object.js +47 -19
  62. package/dist/core/artifact-host.d.ts +0 -2
  63. package/dist/core/artifact-host.js +0 -1
  64. package/dist/core/auto-compaction.js +1 -1
  65. package/dist/core/auto-mode-defaults.d.ts +8 -0
  66. package/dist/core/auto-mode-defaults.js +1 -0
  67. package/dist/core/auto-mode-rebuild.d.ts +2 -1
  68. package/dist/core/auto-mode.d.ts +39 -4
  69. package/dist/core/auto-mode.js +63 -12
  70. package/dist/core/background-agent-store.d.ts +26 -4
  71. package/dist/core/background-agent-store.js +3 -2
  72. package/dist/core/background-shell.d.ts +12 -1
  73. package/dist/core/background-shell.js +12 -0
  74. package/dist/core/checkpoint-requirements.d.ts +13 -1
  75. package/dist/core/checkpoint-requirements.js +3 -1
  76. package/dist/core/checkpoint-store.d.ts +66 -25
  77. package/dist/core/checkpoint-store.js +22 -9
  78. package/dist/core/child-clamp-seats.d.ts +29 -0
  79. package/dist/core/child-clamp-seats.js +56 -1
  80. package/dist/core/compliance.d.ts +3 -3
  81. package/dist/core/compliance.js +1 -1
  82. package/dist/core/credential-echo.d.ts +52 -0
  83. package/dist/core/credential-echo.js +65 -0
  84. package/dist/core/credential-vocabulary.d.ts +13 -3
  85. package/dist/core/credential-vocabulary.js +12 -4
  86. package/dist/core/cross-boundary-taint.d.ts +4 -5
  87. package/dist/core/effective-path-target.d.ts +8 -2
  88. package/dist/core/effective-path-target.js +8 -3
  89. package/dist/core/engine-notice.d.ts +156 -23
  90. package/dist/core/engine-notice.js +19 -5
  91. package/dist/core/frame-settlement.d.ts +5 -0
  92. package/dist/core/frame-settlement.js +4 -0
  93. package/dist/core/gate-fold.js +8 -6
  94. package/dist/core/gate-lanes.js +47 -12
  95. package/dist/core/gate-outcome.d.ts +32 -3
  96. package/dist/core/gate-outcome.js +19 -1
  97. package/dist/core/governance-codes.d.ts +17 -1
  98. package/dist/core/governance-codes.js +25 -0
  99. package/dist/core/hands-band-screen.js +0 -1
  100. package/dist/core/hands-band.d.ts +0 -3
  101. package/dist/core/hooks.d.ts +70 -59
  102. package/dist/core/hooks.js +125 -80
  103. package/dist/core/image-admission.d.ts +106 -52
  104. package/dist/core/image-admission.js +184 -56
  105. package/dist/core/image-downsample.d.ts +36 -69
  106. package/dist/core/image-downsample.js +111 -73
  107. package/dist/core/integer-option.d.ts +21 -0
  108. package/dist/core/integer-option.js +13 -0
  109. package/dist/core/locked-config.d.ts +59 -5
  110. package/dist/core/locked-config.js +82 -50
  111. package/dist/core/mailbox-store.d.ts +45 -1
  112. package/dist/core/mailbox-store.js +53 -9
  113. package/dist/core/mcp-call-meta.d.ts +2 -2
  114. package/dist/core/mcp-call-meta.js +9 -10
  115. package/dist/core/mcp-failure.d.ts +122 -20
  116. package/dist/core/mcp-failure.js +73 -5
  117. package/dist/core/mcp-host-seat.d.ts +92 -0
  118. package/dist/core/mcp-host-seat.js +131 -0
  119. package/dist/core/mcp-probe.d.ts +7 -2
  120. package/dist/core/mcp-probe.js +7 -2
  121. package/dist/core/mcp-server-link.d.ts +22 -1
  122. package/dist/core/mcp-server-link.js +25 -1
  123. package/dist/core/mcp-server-spec.d.ts +38 -9
  124. package/dist/core/mcp-server-spec.js +55 -21
  125. package/dist/core/mcp.d.ts +27 -12
  126. package/dist/core/mcp.js +105 -76
  127. package/dist/core/memory-admission.d.ts +23 -6
  128. package/dist/core/memory-admission.js +19 -9
  129. package/dist/core/memory-engine/consolidation-driver.d.ts +2 -4
  130. package/dist/core/memory-engine/consolidation-driver.js +3 -3
  131. package/dist/core/memory-engine/consolidation.d.ts +4 -0
  132. package/dist/core/memory-engine/consolidation.js +1 -0
  133. package/dist/core/memory-engine/content-origin.d.ts +13 -0
  134. package/dist/core/memory-engine/content-origin.js +21 -3
  135. package/dist/core/memory-engine/delegation-settlement.js +5 -12
  136. package/dist/core/memory-engine/distiller.js +2 -2
  137. package/dist/core/memory-engine/dual-root.d.ts +50 -1
  138. package/dist/core/memory-engine/dual-root.js +44 -1
  139. package/dist/core/memory-engine/engine.d.ts +67 -14
  140. package/dist/core/memory-engine/engine.js +384 -212
  141. package/dist/core/memory-engine/export-bundle.d.ts +23 -0
  142. package/dist/core/memory-engine/export-bundle.js +23 -4
  143. package/dist/core/memory-engine/file-backend.d.ts +128 -55
  144. package/dist/core/memory-engine/file-backend.js +290 -117
  145. package/dist/core/memory-engine/index.d.ts +3 -2
  146. package/dist/core/memory-engine/index.js +2 -1
  147. package/dist/core/memory-engine/layout.d.ts +59 -11
  148. package/dist/core/memory-engine/layout.js +190 -40
  149. package/dist/core/memory-engine/memory-backend-contract.d.ts +1 -1
  150. package/dist/core/memory-engine/memory-backend-contract.js +39 -2
  151. package/dist/core/memory-engine/scope-contract.d.ts +13 -3
  152. package/dist/core/memory-engine/scope-contract.js +2 -2
  153. package/dist/core/memory-engine/sync-client.d.ts +51 -9
  154. package/dist/core/memory-engine/sync-client.js +107 -13
  155. package/dist/core/memory-engine/sync-report.d.ts +103 -0
  156. package/dist/core/memory-engine/sync-report.js +119 -0
  157. package/dist/core/memory-engine/sync.d.ts +8 -1
  158. package/dist/core/memory-engine/types.d.ts +6 -0
  159. package/dist/core/mode-policy.d.ts +9 -1
  160. package/dist/core/mode-policy.js +11 -1
  161. package/dist/core/model-receipt.d.ts +39 -0
  162. package/dist/core/model-receipt.js +139 -0
  163. package/dist/core/mods/agent-stations.d.ts +65 -0
  164. package/dist/core/mods/agent-stations.js +105 -0
  165. package/dist/core/mods/classic-events.d.ts +5 -1
  166. package/dist/core/mods/kernel/dispatch.d.ts +5 -1
  167. package/dist/core/mods/kernel/dispatch.js +6 -5
  168. package/dist/core/mods/kernel/events.d.ts +11 -4
  169. package/dist/core/mods/kernel/events.js +11 -7
  170. package/dist/core/mods/kernel/receive.d.ts +5 -0
  171. package/dist/core/mods/kernel/receive.js +10 -0
  172. package/dist/core/mods/kernel/registration.d.ts +4 -0
  173. package/dist/core/mods/kernel/registration.js +3 -0
  174. package/dist/core/mods/lifecycle-stations.d.ts +41 -0
  175. package/dist/core/mods/lifecycle-stations.js +35 -0
  176. package/dist/core/mods/stations.d.ts +73 -60
  177. package/dist/core/mods/stations.js +64 -40
  178. package/dist/core/mods/tool-call.d.ts +10 -4
  179. package/dist/core/mods/tool-call.js +28 -12
  180. package/dist/core/mounted-mcp.d.ts +5 -0
  181. package/dist/core/mounted-mcp.js +2 -2
  182. package/dist/core/namespaced-rule-name.d.ts +7 -1
  183. package/dist/core/namespaced-rule-name.js +13 -2
  184. package/dist/core/oracle-isolation.js +1 -1
  185. package/dist/core/own-property-receipt.d.ts +3 -0
  186. package/dist/core/own-property-receipt.js +3 -0
  187. package/dist/core/parent-spec-seat.d.ts +8 -3
  188. package/dist/core/parent-spec-seat.js +2 -0
  189. package/dist/core/park-selfcheck.js +14 -8
  190. package/dist/core/peer-seat.d.ts +133 -16
  191. package/dist/core/peer-seat.js +319 -42
  192. package/dist/core/permission-rule-consent.d.ts +0 -21
  193. package/dist/core/permission-rule-consent.js +11 -6
  194. package/dist/core/permission-rule-model.d.ts +20 -2
  195. package/dist/core/permission-rule-model.js +8 -7
  196. package/dist/core/present-plan-tool.d.ts +11 -3
  197. package/dist/core/present-plan-tool.js +2 -2
  198. package/dist/core/protocol-http-auth.d.ts +14 -2
  199. package/dist/core/protocol-http-auth.js +16 -7
  200. package/dist/core/read-face-seats.d.ts +7 -5
  201. package/dist/core/read-face-seats.js +4 -1
  202. package/dist/core/redaction-marks.d.ts +4 -3
  203. package/dist/core/redaction-marks.js +2 -2
  204. package/dist/core/remote-env.d.ts +146 -98
  205. package/dist/core/remote-env.js +113 -14
  206. package/dist/core/resume-startup-cause.js +1 -0
  207. package/dist/core/retention.js +37 -12
  208. package/dist/core/retired-keys.d.ts +6 -1
  209. package/dist/core/retired-keys.js +4 -1
  210. package/dist/core/rewrite-rejudge.d.ts +13 -5
  211. package/dist/core/rewrite-rejudge.js +9 -5
  212. package/dist/core/roles.d.ts +69 -3
  213. package/dist/core/roles.js +167 -80
  214. package/dist/core/rule-owner.d.ts +3 -0
  215. package/dist/core/runner/announce-once-ledger.d.ts +5 -4
  216. package/dist/core/runner/announce-once-ledger.js +4 -2
  217. package/dist/core/runner/assemble-result.d.ts +0 -5
  218. package/dist/core/runner/assemble-result.js +0 -1
  219. package/dist/core/runner/call-hook-stations.d.ts +17 -10
  220. package/dist/core/runner/call-hook-stations.js +23 -12
  221. package/dist/core/runner/child-tree.d.ts +7 -8
  222. package/dist/core/runner/child-tree.js +6 -6
  223. package/dist/core/runner/classifier-ladder.d.ts +10 -2
  224. package/dist/core/runner/classifier-ladder.js +39 -8
  225. package/dist/core/runner/construction-doors.js +5 -0
  226. package/dist/core/runner/contracts.d.ts +82 -57
  227. package/dist/core/runner/credential-origin-seat.js +4 -3
  228. package/dist/core/runner/cross-boundary-lane.d.ts +3 -5
  229. package/dist/core/runner/cross-boundary-lane.js +11 -2
  230. package/dist/core/runner/cwd-alignment-probe.d.ts +20 -0
  231. package/dist/core/runner/cwd-alignment-probe.js +21 -0
  232. package/dist/core/runner/decide-continuation.d.ts +2 -2
  233. package/dist/core/runner/env-capability-census.d.ts +15 -20
  234. package/dist/core/runner/env-capability-census.js +25 -34
  235. package/dist/core/runner/file-history-request.d.ts +2 -2
  236. package/dist/core/runner/file-history-request.js +0 -8
  237. package/dist/core/runner/gate-exit.d.ts +87 -11
  238. package/dist/core/runner/gate-exit.js +30 -8
  239. package/dist/core/runner/git-status-frame.d.ts +5 -2
  240. package/dist/core/runner/git-status-frame.js +3 -4
  241. package/dist/core/runner/image-removed-seat.d.ts +12 -0
  242. package/dist/core/runner/image-removed-seat.js +19 -0
  243. package/dist/core/runner/image.d.ts +7 -2
  244. package/dist/core/runner/image.js +14 -8
  245. package/dist/core/runner/inline-image.d.ts +10 -8
  246. package/dist/core/runner/inline-image.js +11 -9
  247. package/dist/core/runner/memory-consolidation-driver.js +5 -5
  248. package/dist/core/runner/park-commit.d.ts +1 -1
  249. package/dist/core/runner/park-commit.js +3 -0
  250. package/dist/core/runner/permission-rule-lanes.js +1 -1
  251. package/dist/core/runner/prepare-ask-lane.d.ts +1 -1
  252. package/dist/core/runner/prepare-ask-lane.js +2 -1
  253. package/dist/core/runner/prepare-boundary-parks.d.ts +2 -2
  254. package/dist/core/runner/prepare-boundary-parks.js +5 -5
  255. package/dist/core/runner/prepare-caps-and-workflow.d.ts +7 -5
  256. package/dist/core/runner/prepare-caps-and-workflow.js +6 -3
  257. package/dist/core/runner/prepare-config-doors.d.ts +6 -1
  258. package/dist/core/runner/prepare-config-doors.js +16 -9
  259. package/dist/core/runner/prepare-context-lane.js +2 -0
  260. package/dist/core/runner/prepare-delegation-surface.d.ts +9 -3
  261. package/dist/core/runner/prepare-delegation-surface.js +5 -4
  262. package/dist/core/runner/prepare-file-history.d.ts +10 -12
  263. package/dist/core/runner/prepare-file-history.js +3 -12
  264. package/dist/core/runner/prepare-gate-stations.d.ts +4 -3
  265. package/dist/core/runner/prepare-gate-stations.js +4 -3
  266. package/dist/core/runner/prepare-hands-readface.d.ts +7 -1
  267. package/dist/core/runner/prepare-hands-readface.js +19 -6
  268. package/dist/core/runner/prepare-inherited-gate.d.ts +6 -7
  269. package/dist/core/runner/prepare-inherited-gate.js +22 -31
  270. package/dist/core/runner/prepare-memory-engine-session.js +1 -1
  271. package/dist/core/runner/prepare-memory.d.ts +2 -2
  272. package/dist/core/runner/prepare-memory.js +12 -19
  273. package/dist/core/runner/prepare-park-ask.d.ts +4 -6
  274. package/dist/core/runner/prepare-park-ask.js +5 -9
  275. package/dist/core/runner/prepare-policy-chain.d.ts +8 -7
  276. package/dist/core/runner/prepare-policy-chain.js +136 -121
  277. package/dist/core/runner/prepare-project-context.d.ts +2 -2
  278. package/dist/core/runner/prepare-project-context.js +10 -7
  279. package/dist/core/runner/prepare-prompt-inputs.d.ts +5 -2
  280. package/dist/core/runner/prepare-prompt-inputs.js +10 -20
  281. package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
  282. package/dist/core/runner/prepare-protocol-tools.js +17 -2
  283. package/dist/core/runner/prepare-run-refs.d.ts +2 -3
  284. package/dist/core/runner/prepare-run-refs.js +4 -1
  285. package/dist/core/runner/prepare-suspend-saga.d.ts +0 -2
  286. package/dist/core/runner/prepare-suspend-saga.js +5 -7
  287. package/dist/core/runner/prepare-task.js +44 -28
  288. package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
  289. package/dist/core/runner/prepare-turn-wiring.js +7 -2
  290. package/dist/core/runner/prepare-wiring-manifest.d.ts +5 -4
  291. package/dist/core/runner/prepare-wiring-manifest.js +34 -19
  292. package/dist/core/runner/prepare-workspace-restore.js +3 -3
  293. package/dist/core/runner/reply-pricing.d.ts +30 -0
  294. package/dist/core/runner/reply-pricing.js +19 -0
  295. package/dist/core/runner/resume-admission.js +4 -2
  296. package/dist/core/runner/resume-apply.js +6 -1
  297. package/dist/core/runner/resume-checkpoint-screen.js +4 -4
  298. package/dist/core/runner/resume-policy-outcome.js +5 -5
  299. package/dist/core/runner/retired-runner-deps.js +4 -1
  300. package/dist/core/runner/role-seat-defaulted.d.ts +44 -0
  301. package/dist/core/runner/role-seat-defaulted.js +40 -0
  302. package/dist/core/runner/run-attachment-seats.js +3 -3
  303. package/dist/core/runner/run-brain-sinks.js +3 -0
  304. package/dist/core/runner/run-git-lane.d.ts +3 -1
  305. package/dist/core/runner/run-git-lane.js +1 -1
  306. package/dist/core/runner/run-harness-handlers.d.ts +3 -1
  307. package/dist/core/runner/run-harness-handlers.js +3 -1
  308. package/dist/core/runner/run-identity-wiring.d.ts +2 -5
  309. package/dist/core/runner/run-identity-wiring.js +6 -5
  310. package/dist/core/runner/run-leg.d.ts +2 -0
  311. package/dist/core/runner/run-leg.js +63 -56
  312. package/dist/core/runner/run-notification-lane.d.ts +3 -1
  313. package/dist/core/runner/run-notification-lane.js +16 -10
  314. package/dist/core/runner/run-settle-and-teardown.js +5 -1
  315. package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
  316. package/dist/core/runner/run-stop-and-final-verify.js +14 -6
  317. package/dist/core/runner/run-terminal-adoption.d.ts +2 -5
  318. package/dist/core/runner/run-terminal-adoption.js +9 -3
  319. package/dist/core/runner/run-turn-boundary.js +89 -77
  320. package/dist/core/runner/runtask.d.ts +8 -5
  321. package/dist/core/runner/runtask.js +21 -13
  322. package/dist/core/runner/side-call-account.d.ts +1 -1
  323. package/dist/core/runner/side-call-account.js +3 -18
  324. package/dist/core/runner/skills-seat.js +2 -2
  325. package/dist/core/runner/sub-agent-deny-lists.d.ts +24 -0
  326. package/dist/core/runner/sub-agent-deny-lists.js +20 -7
  327. package/dist/core/runner/synthetic-tools.js +2 -2
  328. package/dist/core/runner/tool-disclosure.js +0 -2
  329. package/dist/core/runner/tool-end-body.js +2 -2
  330. package/dist/core/runner/tool-face-overlay.d.ts +1 -1
  331. package/dist/core/runner/tool-face-overlay.js +26 -19
  332. package/dist/core/runner/tool-occurrence.d.ts +1 -1
  333. package/dist/core/runner/tool-occurrence.js +2 -2
  334. package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
  335. package/dist/core/runner/tool-result-media-seat.js +17 -1
  336. package/dist/core/runner/turn-attachments.d.ts +29 -27
  337. package/dist/core/runner/turn-attachments.js +27 -42
  338. package/dist/core/runner-deps.d.ts +32 -19
  339. package/dist/core/secret-env.d.ts +35 -4
  340. package/dist/core/secret-env.js +65 -3
  341. package/dist/core/sensitive-path-policy.js +3 -3
  342. package/dist/core/session-policy-store.d.ts +12 -3
  343. package/dist/core/session-policy-store.js +29 -10
  344. package/dist/core/session-store.d.ts +5 -7
  345. package/dist/core/session-store.js +50 -11
  346. package/dist/core/side-query.d.ts +11 -1
  347. package/dist/core/side-query.js +9 -0
  348. package/dist/core/skill-grant-binding.d.ts +31 -2
  349. package/dist/core/skill-grant-binding.js +31 -1
  350. package/dist/core/skill-grant.d.ts +17 -5
  351. package/dist/core/skill-grant.js +24 -6
  352. package/dist/core/store-contracts/background-agent-store-contract.js +27 -0
  353. package/dist/core/store-contracts/checkpoint-store-contract.js +3 -2
  354. package/dist/core/store-contracts/mailbox-store-contract.js +31 -1
  355. package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
  356. package/dist/core/store-contracts/tool-result-store-contract.js +37 -0
  357. package/dist/core/stub-env.d.ts +5 -5
  358. package/dist/core/stub-env.js +11 -1
  359. package/dist/core/swappable-deps.d.ts +17 -43
  360. package/dist/core/swappable-deps.js +15 -5
  361. package/dist/core/synthetic-read-verdict.d.ts +1 -1
  362. package/dist/core/synthetic-read-verdict.js +2 -1
  363. package/dist/core/task-event.d.ts +50 -10
  364. package/dist/core/task-notification.d.ts +88 -5
  365. package/dist/core/task-notification.js +146 -17
  366. package/dist/core/task-registry-agent.d.ts +18 -12
  367. package/dist/core/task-registry-agent.js +19 -6
  368. package/dist/core/task-registry-monitor.d.ts +7 -0
  369. package/dist/core/task-registry-monitor.js +28 -1
  370. package/dist/core/task-registry-shared.d.ts +43 -3
  371. package/dist/core/task-registry-shared.js +21 -7
  372. package/dist/core/task-registry-workflow.js +1 -1
  373. package/dist/core/task-registry.d.ts +50 -35
  374. package/dist/core/task-registry.js +64 -23
  375. package/dist/core/task-result.d.ts +3 -12
  376. package/dist/core/task-spec.d.ts +15 -7
  377. package/dist/core/task-stream.d.ts +1 -1
  378. package/dist/core/terminal-cause.d.ts +10 -0
  379. package/dist/core/tool-catalog-entries.js +1 -1
  380. package/dist/core/tool-check-reading.d.ts +1 -0
  381. package/dist/core/tool-check-reading.js +3 -3
  382. package/dist/core/tool-face-reader.d.ts +7 -6
  383. package/dist/core/tool-face-reader.js +4 -3
  384. package/dist/core/tool-name-aliases.d.ts +19 -0
  385. package/dist/core/tool-name-aliases.js +54 -2
  386. package/dist/core/tool-policy.d.ts +21 -4
  387. package/dist/core/tool-policy.js +1 -1
  388. package/dist/core/tool-registry.d.ts +5 -5
  389. package/dist/core/tool-registry.js +2 -2
  390. package/dist/core/tool-result-store.d.ts +88 -5
  391. package/dist/core/tool-result-store.js +51 -12
  392. package/dist/core/tool-roster.d.ts +112 -5
  393. package/dist/core/tool-roster.js +42 -1
  394. package/dist/core/tool-spec.d.ts +23 -5
  395. package/dist/core/trace.d.ts +0 -1
  396. package/dist/core/types.d.ts +5 -5
  397. package/dist/core/types.js +2 -2
  398. package/dist/core/untrusted-text.js +1 -1
  399. package/dist/core/user-attachment.d.ts +10 -5
  400. package/dist/core/user-attachment.js +15 -7
  401. package/dist/core/wiring-manifest.d.ts +6 -3
  402. package/dist/engine/compaction/compaction.js +29 -3
  403. package/dist/engine/execution-env/node-execution-env.d.ts +11 -5
  404. package/dist/engine/execution-env/node-execution-env.js +21 -13
  405. package/dist/engine/harness/agent-harness.d.ts +26 -3
  406. package/dist/engine/harness/agent-harness.js +49 -16
  407. package/dist/engine/harness/messages.d.ts +3 -1
  408. package/dist/engine/harness/messages.js +3 -2
  409. package/dist/engine/harness/types.d.ts +119 -28
  410. package/dist/engine/llm/rejected-images.d.ts +46 -0
  411. package/dist/engine/llm/rejected-images.js +54 -0
  412. package/dist/engine/llm/tool-turns.d.ts +2 -1
  413. package/dist/engine/llm/types.d.ts +18 -7
  414. package/dist/engine/loop/agent-loop.d.ts +20 -12
  415. package/dist/engine/loop/agent-loop.js +205 -36
  416. package/dist/engine/loop/types.d.ts +12 -3
  417. package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
  418. package/dist/engine/lsp/node-lsp-manager.js +32 -13
  419. package/dist/engine/session/path-to-root.d.ts +38 -0
  420. package/dist/engine/session/path-to-root.js +39 -0
  421. package/dist/engine/session/storage-base.js +4 -21
  422. package/dist/index.d.ts +35 -21
  423. package/dist/index.js +26 -17
  424. package/dist/internal/harness-types.d.ts +1 -1
  425. package/dist/internal/harness.d.ts +1 -0
  426. package/dist/internal/llm.d.ts +1 -0
  427. package/dist/orchestration/run-workflow-tool.d.ts +9 -3
  428. package/dist/orchestration/run-workflow-tool.js +59 -29
  429. package/dist/orchestration/workflow-governance.d.ts +1 -1
  430. package/dist/orchestration/workflow-governance.js +2 -1
  431. package/dist/orchestration/workflow-observe.d.ts +17 -1
  432. package/dist/orchestration/workflow-observe.js +20 -0
  433. package/dist/orchestration/workflow-types.d.ts +32 -7
  434. package/dist/orchestration/workflow.d.ts +4 -0
  435. package/dist/orchestration/workflow.js +762 -491
  436. package/dist/prompts/default.d.ts +1 -10
  437. package/dist/prompts/default.js +0 -2
  438. package/dist/shell/counting-pass.d.ts +50 -0
  439. package/dist/shell/counting-pass.js +502 -0
  440. package/dist/shell/lex.d.ts +4 -2
  441. package/dist/shell/lex.js +93 -34
  442. package/dist/shell/shell-words.d.ts +1 -1
  443. package/dist/shell/shell-words.js +7 -6
  444. package/dist/stores/file/background-agent-store.d.ts +1 -1
  445. package/dist/stores/file/background-agent-store.js +3 -1
  446. package/dist/stores/file/checkpoint-store.d.ts +127 -2
  447. package/dist/stores/file/checkpoint-store.js +19 -14
  448. package/dist/stores/file/file-history-store.d.ts +1 -1
  449. package/dist/stores/file/file-history-store.js +3 -1
  450. package/dist/stores/file/index.d.ts +4 -3
  451. package/dist/stores/file/index.js +17 -8
  452. package/dist/stores/file/mailbox-store.d.ts +1 -1
  453. package/dist/stores/file/mailbox-store.js +9 -11
  454. package/dist/stores/file/memory-store.d.ts +1 -1
  455. package/dist/stores/file/memory-store.js +3 -1
  456. package/dist/stores/file/session-policy-store.d.ts +1 -1
  457. package/dist/stores/file/session-policy-store.js +3 -1
  458. package/dist/stores/file/session-store.d.ts +1 -1
  459. package/dist/stores/file/session-store.js +3 -1
  460. package/dist/stores/file/shared-ledger.d.ts +26 -0
  461. package/dist/stores/file/shared-ledger.js +38 -9
  462. package/dist/stores/file/tool-result-store.d.ts +20 -2
  463. package/dist/stores/file/tool-result-store.js +74 -6
  464. package/dist/stores/file/usage-window-store.d.ts +1 -1
  465. package/dist/stores/file/usage-window-store.js +3 -1
  466. package/dist/stores/file/workflow-journal-store.d.ts +1 -11
  467. package/dist/stores/file/workflow-journal-store.js +3 -2
  468. package/dist/tools/fs/containment-face.d.ts +5 -0
  469. package/dist/tools/fs/encoding.d.ts +13 -4
  470. package/dist/tools/fs/encoding.js +17 -2
  471. package/dist/tools/fs/fs-bash-background-text.d.ts +7 -0
  472. package/dist/tools/fs/fs-bash-background-text.js +1 -0
  473. package/dist/tools/fs/fs-bash.d.ts +14 -4
  474. package/dist/tools/fs/fs-bash.js +29 -35
  475. package/dist/tools/fs/fs-pdf.d.ts +2 -2
  476. package/dist/tools/fs/fs-pdf.js +26 -21
  477. package/dist/tools/fs/fs-read.d.ts +5 -4
  478. package/dist/tools/fs/fs-read.js +35 -18
  479. package/dist/tools/fs/fs-search-tools.js +4 -1
  480. package/dist/tools/fs/fs-shared.d.ts +11 -13
  481. package/dist/tools/fs/fs-shared.js +11 -7
  482. package/dist/tools/fs/fs-write.js +5 -5
  483. package/dist/tools/fs/index.d.ts +14 -8
  484. package/dist/tools/fs/index.js +13 -5
  485. package/dist/tools/fs/program-read-model.d.ts +13 -0
  486. package/dist/tools/fs/program-read-model.js +15 -0
  487. package/dist/tools/fs/program-read-model.rows.js +1 -1
  488. package/dist/tools/fs/read-deny.d.ts +13 -10
  489. package/dist/tools/fs/read-deny.js +25 -5
  490. package/dist/tools/fs/read-floor.d.ts +62 -0
  491. package/dist/tools/fs/read-floor.js +58 -0
  492. package/dist/tools/fs/removal-targets.d.ts +9 -4
  493. package/dist/tools/fs/removal-targets.js +17 -9
  494. package/dist/tools/fs/search.d.ts +3 -3
  495. package/dist/tools/fs/search.js +4 -4
  496. package/dist/tools/fs/shell-read-check.d.ts +1 -1
  497. package/dist/tools/fs/shell-read-check.js +2 -1
  498. package/dist/tools/fs/shell-read-judge.d.ts +16 -8
  499. package/dist/tools/fs/shell-read-judge.js +10 -6
  500. package/dist/tools/fs/shell-read-plan.d.ts +6 -1
  501. package/dist/tools/fs/shell-read-plan.js +22 -15
  502. package/dist/tools/fs/shell-read-start.js +1 -0
  503. package/dist/tools/fs/shell-reentry-text.d.ts +15 -1
  504. package/dist/tools/fs/shell-reentry-text.js +25 -3
  505. package/dist/tools/monitor.d.ts +9 -4
  506. package/dist/tools/monitor.js +17 -8
  507. package/dist/tools/scheduler-tools.js +42 -4
  508. package/dist/tools/web.d.ts +0 -10
  509. package/dist/tools/web.js +1 -4
  510. package/package.json +5 -2
  511. package/test/export-surface.snapshot.json +161 -21
  512. package/wire-changes/core-stores-sql@7.59.0.json +29 -0
  513. package/wire-changes/core-stores-sql@7.60.0.json +30 -0
  514. package/wire-changes/core@7.59.0.json +2459 -0
  515. package/wire-changes/core@7.60.0.json +3274 -0
  516. package/wire-changes/mods-kernel@7.59.0.json +29 -0
  517. package/wire-changes/mods-kernel@7.60.0.json +62 -0
  518. package/wire-changes/primitives@7.59.0.json +29 -0
  519. package/wire-changes/primitives@7.60.0.json +30 -0
@@ -1,6 +1,7 @@
1
1
  import type { ImageContent } from "../../internal/llm.js";
2
2
  import { type HostFloor } from "../host-floor.js";
3
3
  import type { ImageInput } from "../types.js";
4
+ import { type ImageDownsampler } from "../image-downsample.js";
4
5
  /**
5
6
  * The guard of a remote image URL: https only, then the one egress hop judge with the private-network floor (`hopRefusal`,
6
7
  * host-floor.ts) — the deployment's host floor (`RunnerDeps.hostFloor`, `floor`) must admit the host, and a private host is
@@ -8,5 +9,9 @@ import type { ImageInput } from "../types.js";
8
9
  * `169.254.169.254` or a private box. The host is read literally (no DNS resolution). Throws on a refused URL.
9
10
  */
10
11
  export declare function defaultImageUrlGuard(raw: string, floor?: HostFloor): void;
11
- /** Resolve an {@link ImageInput} (inline base64 or a URL to fetch) into a vendored `ImageContent` block. */
12
- export declare function toImageContent(img: ImageInput, floor: HostFloor | undefined): Promise<ImageContent>;
12
+ /** Resolve an {@link ImageInput} (inline base64 or a URL to fetch) into a vendored `ImageContent` block: both arms pass
13
+ * the one byte admission with the run's processor (inline-image.ts) — a fetched body after the URL's own guard and cap. */
14
+ export declare function toImageContent(img: ImageInput, floor: HostFloor | undefined, processor: ImageDownsampler | "none"): Promise<ImageContent>;
15
+ /** The task's images (`TaskSpec.images`), each through {@link toImageContent} with the run's one processor (`seat` =
16
+ * `RunnerDeps.imageProcessor`); the first one sent unprocessed over the soft target is told to `unprocessed`. */
17
+ export declare function toImageContents(images: readonly ImageInput[], floor: HostFloor | undefined, seat: ImageDownsampler | false | undefined, unprocessed: (bytes: number) => void): Promise<ImageContent[]>;
@@ -1,9 +1,7 @@
1
1
  import { hopRefusal } from "../host-floor.js";
2
- import { ADMITTED_IMAGE_MIME_TYPES, imageMagicMatches } from "../image-admission.js";
2
+ import { firstUnprocessedOverTarget, IMAGE_ADMISSION, sniffImageMime } from "../image-admission.js";
3
+ import { resolveImageProcessor } from "../image-downsample.js";
3
4
  import { admitInlineImage } from "./inline-image.js";
4
- function sniffImageMime(bytes) {
5
- return ADMITTED_IMAGE_MIME_TYPES.find((mime) => imageMagicMatches(bytes, mime));
6
- }
7
5
  export function defaultImageUrlGuard(raw, floor) {
8
6
  let u;
9
7
  try {
@@ -20,7 +18,7 @@ export function defaultImageUrlGuard(raw, floor) {
20
18
  throw new Error(`image url not fetched — ${refused}`);
21
19
  }
22
20
  const IMAGE_FETCH_TIMEOUT_MS = 30_000;
23
- const IMAGE_MAX_BYTES = 20 * 1024 * 1024;
21
+ const IMAGE_MAX_BYTES = IMAGE_ADMISSION.hard.urlBytes;
24
22
  async function readImageBodyCapped(res) {
25
23
  const reader = res.body?.getReader();
26
24
  if (!reader) {
@@ -67,12 +65,20 @@ async function fetchImageCapped(url) {
67
65
  }
68
66
  return { buf, mimeType: sniffed };
69
67
  }
70
- export async function toImageContent(img, floor) {
68
+ export async function toImageContent(img, floor, processor) {
71
69
  if ("url" in img) {
72
70
  const url = img.url;
73
71
  defaultImageUrlGuard(url, floor);
74
72
  const { buf, mimeType } = await fetchImageCapped(url);
75
- return { type: "image", data: buf.toString("base64"), mimeType };
73
+ return admitInlineImage({ data: buf.toString("base64"), mimeType }, processor, "the image fetched from its url");
76
74
  }
77
- return admitInlineImage(img);
75
+ return admitInlineImage(img, processor);
76
+ }
77
+ export async function toImageContents(images, floor, seat, unprocessed) {
78
+ const processor = await resolveImageProcessor(seat);
79
+ const blocks = await Promise.all(images.map((img) => toImageContent(img, floor, processor)));
80
+ const over = firstUnprocessedOverTarget(blocks, processor);
81
+ if (over !== undefined)
82
+ unprocessed(over);
83
+ return blocks;
78
84
  }
@@ -1,14 +1,16 @@
1
1
  /**
2
- * The `TaskSpec.images` INLINE arm's admission: the same byte admission a file the Read tool serves passes
3
- * (image-admission.ts) — a claimed type the API accepts, within the raw cap, that type's signature, under
4
- * the provider's base64 limit. Without it a mis-declared image rode straight to the provider and 400'd the whole
5
- * request. Like the Read lane it checks the SIGNATURE, not decodability: a file cut short after its signature
6
- * passes (KL-1311a-c). No downsampling here: this arm only refuses what would not survive the wire, and a
7
- * valid image reaches the model unchanged. The block is built from the bytes that were checked.
2
+ * The `TaskSpec.images` arms' admission: the same byte admission a file the Read tool serves passes
3
+ * (image-admission.ts), with the run's processor — a claimed type the API accepts, within the raw cap, that type's
4
+ * signature, then the processor (or, with none, a header-stated size within the reject edge), under the provider's
5
+ * base64 limit. Without it a mis-declared image rode straight to the provider and 400'd the whole request. Like the
6
+ * Read lane it checks the SIGNATURE, not decodability: a file cut short after its signature passes when no processor
7
+ * reads it (KL-1311a-c). The block is built from the bytes that were checked (or the processor made from them).
8
8
  */
9
9
  import type { ImageContent } from "../../internal/llm.js";
10
10
  import type { ImageInput } from "../types.js";
11
- /** Admit one inline entry (`{ data, mimeType }`) or throw `config.image_invalid`. */
11
+ import type { ImageDownsampler } from "../image-downsample.js";
12
+ /** Admit one entry's bytes (`{ data, mimeType }` — inline, or a URL arm's fetched body, `subject` naming which) or throw
13
+ * `config.image_invalid`. */
12
14
  export declare function admitInlineImage(img: Extract<ImageInput, {
13
15
  data: string;
14
- }>): Promise<ImageContent>;
16
+ }>, processor: ImageDownsampler | "none", subject?: string): Promise<ImageContent>;
@@ -1,26 +1,28 @@
1
- import { admitImageBytes, ADMITTED_IMAGE_MIME_TYPES } from "../image-admission.js";
2
- import { MCP_IMAGE_MAX_BASE64 } from "../image-downsample.js";
1
+ import { admitImageBytes, ADMITTED_IMAGE_MIME_TYPES, IMAGE_ADMISSION, unprocessedSizeClause } from "../image-admission.js";
3
2
  function inlineImageRefusal(detail) {
4
3
  const e = new Error(`TaskSpec.images: ${detail}`);
5
4
  e.code = "config.image_invalid";
6
5
  return e;
7
6
  }
8
- export async function admitInlineImage(img) {
7
+ export async function admitInlineImage(img, processor, subject = "an inline image") {
9
8
  const data = img.data;
10
9
  const mimeType = img.mimeType;
11
10
  if (typeof data !== "string" || typeof mimeType !== "string")
12
- throw inlineImageRefusal("an inline image needs a base64 string `data` and a string `mimeType`.");
13
- const admitted = await admitImageBytes(Buffer.from(data, "base64"), mimeType, undefined);
11
+ throw inlineImageRefusal(`${subject} needs a base64 string \`data\` and a string \`mimeType\`.`);
12
+ const admitted = await admitImageBytes(Buffer.from(data, "base64"), mimeType, processor);
14
13
  if (admitted.ok)
15
14
  return admitted.block;
16
15
  switch (admitted.reason) {
17
16
  case "mime_unsupported":
18
- throw inlineImageRefusal(`an inline image declares mimeType ${JSON.stringify(mimeType.slice(0, 80))}, which the model API does not accept (accepted: ${ADMITTED_IMAGE_MIME_TYPES.join(", ")}).`);
17
+ throw inlineImageRefusal(`${subject} declares mimeType ${JSON.stringify(mimeType.slice(0, 80))}, which the model API does not accept (accepted: ${ADMITTED_IMAGE_MIME_TYPES.join(", ")}).`);
19
18
  case "magic_mismatch":
20
- throw inlineImageRefusal(`an inline image's bytes do not begin with a ${mimeType} signature (empty, mis-declared, or not base64) — refused rather than sent.`);
19
+ throw inlineImageRefusal(`${subject}'s bytes do not open with a valid ${mimeType} header (empty, truncated, mis-declared, not base64, or a variant such as an Apple-optimized PNG that model APIs cannot read) — refused rather than sent.`);
21
20
  case "raw_too_large":
22
- throw inlineImageRefusal(`an inline image is ${admitted.rawBytes} bytes, over the ${admitted.cap}-byte cap.`);
21
+ throw inlineImageRefusal(`${subject} is ${admitted.rawBytes} bytes, over the ${admitted.cap}-byte cap.`);
22
+ case "dimensions_unreadable":
23
+ case "dimensions_too_large":
24
+ throw inlineImageRefusal(`${subject} is refused rather than sent: ${unprocessedSizeClause(admitted)}.`);
23
25
  case "base64_too_large":
24
- throw inlineImageRefusal(`an inline image's base64 is ${admitted.base64.length} chars, over the ${MCP_IMAGE_MAX_BASE64}-char / 5MB API image limit — shrink it before sending.`);
26
+ throw inlineImageRefusal(`${subject}'s base64 is ${admitted.base64.length} chars, over the ${IMAGE_ADMISSION.hard.imageBase64Chars}-char / 5MB API image limit — shrink it before sending.`);
25
27
  }
26
28
  }
@@ -1,5 +1,5 @@
1
1
  import { brainToRuntime } from "../runtime.js";
2
- import { expandTiers, roleModelIfSet } from "../roles.js";
2
+ import { catalogOfDeps, roleModelIfSet, unheldChainRefusal } from "../roles.js";
3
3
  import { isAliasModelId, openAiCompatChatSeat } from "../memory-engine/distiller.js";
4
4
  import { runMemoryConsolidationDriver } from "../memory-engine/consolidation-driver.js";
5
5
  import { recommendationUnconsumed } from "../memory-engine/consolidation.js";
@@ -26,10 +26,10 @@ export function resolveMemoryConsolidationDriver(deps) {
26
26
  model = seat.chat.model;
27
27
  }
28
28
  else {
29
- const models = expandTiers(deps.models, deps.tiers);
29
+ const models = catalogOfDeps(deps);
30
30
  const resolved = roleModelIfSet("consolidate", {}, { models, roles: deps.roles }) ?? roleModelIfSet("summarize", {}, { models, roles: deps.roles });
31
31
  if (resolved === undefined) {
32
- throw seatRefusal('memory consolidation has no model seat: configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize (a tier-expanded catalog\'s "flash" binding also satisfies the summarize hop). The chain deliberately does NOT fall back to the default main model — a whole-library distillation must not silently ride the most expensive seat.');
32
+ throw unheldChainRefusal(["consolidate", "summarize"], models, deps.roles) ?? seatRefusal('memory consolidation has no model seat: configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize (a tier-expanded catalog\'s "flash" binding also satisfies the summarize hop). The chain deliberately does NOT fall back to the default main model — a whole-library distillation must not silently ride the most expensive seat.');
33
33
  }
34
34
  if (isAliasModelId(resolved.id)) {
35
35
  throw seatRefusal(`the resolved consolidation model id ${JSON.stringify(resolved.id)} is an alias spelling — an alias can be re-pointed upstream and would move the run with no trace in the archive; bind an explicit id.`);
@@ -65,7 +65,7 @@ export function resolveMemoryConsolidationDriver(deps) {
65
65
  export function consolidationSeatResolvable(deps) {
66
66
  if (deps.memoryConsolidationDriver?.chat !== undefined)
67
67
  return true;
68
- const models = expandTiers(deps.models, deps.tiers);
68
+ const models = catalogOfDeps(deps);
69
69
  return (roleModelIfSet("consolidate", {}, { models, roles: deps.roles }) ?? roleModelIfSet("summarize", {}, { models, roles: deps.roles })) !== undefined;
70
70
  }
71
71
  export function autoRunConsolidationFromRecommendation(args) {
@@ -116,6 +116,6 @@ export function assertAutoConsolidationWirable(deps) {
116
116
  throw autoRunRefusal("RunnerDeps.autoRunOnRecommendation is true but RunnerDeps.memoryConsolidation is absent — the recommendation that would trigger a run is never minted (consolidation is OFF) and the engine's verbs refuse coded, so the trigger can never fire. An armed-but-unrunnable trigger is refused, never folded to off: wire memoryConsolidation, or leave autoRunOnRecommendation unset.");
117
117
  }
118
118
  if (!consolidationSeatResolvable(deps)) {
119
- throw autoRunRefusal("RunnerDeps.autoRunOnRecommendation is true but no consolidation model seat resolves — configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize. Arming auto-run with no model to run it is refused, never folded to off (a whole-library distillation must not silently ride the default main model).");
119
+ throw unheldChainRefusal(["consolidate", "summarize"], catalogOfDeps(deps), deps.roles) ?? autoRunRefusal("RunnerDeps.autoRunOnRecommendation is true but no consolidation model seat resolves — configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize. Arming auto-run with no model to run it is refused, never folded to off (a whole-library distillation must not silently ride the default main model).");
120
120
  }
121
121
  }
@@ -6,7 +6,7 @@
6
6
  * numbers, and the driver keeps reaching down for the marker its harness stamps. Pure: no engine state; the only clock
7
7
  * is the caller's.
8
8
  */
9
- import type { CheckpointGate, CheckpointToken, PendingAction } from "../checkpoint-store.js";
9
+ import { type CheckpointGate, type CheckpointToken, type PendingAction } from "../checkpoint-store.js";
10
10
  import type { WorkspaceHandle } from "../remote-env.js";
11
11
  import type { Prepared } from "./contracts.js";
12
12
  /** Default resource-checkpoint retention (30 days, the spec's
@@ -1,3 +1,4 @@
1
+ import { planReviewRequesterOf } from "../checkpoint-store.js";
1
2
  export const DEFAULT_RESOURCE_TTL_MS = 30 * 24 * 60 * 60 * 1000;
2
3
  export const USAGE_WINDOW_REAP_MARGIN_MS = 60 * 60 * 1000;
3
4
  export const DEFAULT_UNATTENDED_APPROVAL_TTL_MS = 30 * 24 * 60 * 60 * 1000;
@@ -16,12 +17,14 @@ export function parkContaminationMarker(refs) {
16
17
  return { code: "gate.parked", ...(gatedCallId !== undefined ? { gatedCallId } : {}) };
17
18
  }
18
19
  export function publishCommittedSuspend(refs, token, gate, scope, remoteHandle, checkpointId, pendingAction) {
20
+ const requestedByCallId = pendingAction !== undefined ? planReviewRequesterOf(pendingAction) : undefined;
19
21
  const pause = {
20
22
  cause: {
21
23
  kind: "paused",
22
24
  gate,
23
25
  token,
24
26
  ...(checkpointId !== undefined ? { checkpointId } : {}),
27
+ ...(requestedByCallId !== undefined ? { requestedByCallId } : {}),
25
28
  ...(remoteHandle !== undefined ? { restoreMode: remoteHandle.restoreMode === "park_only" ? "park_only" : "snapshot" } : {}),
26
29
  },
27
30
  scope,
@@ -123,7 +123,7 @@ export function createPermissionRuleLanes(cfg) {
123
123
  if (!judged.some(([, g]) => g === "path") && faceRowsSpeakFor(callPathFaceOf(req)))
124
124
  judged.push([req.toolName, "path"]);
125
125
  const view = await reader.pin(req.toolCallId, req.args);
126
- const ownRow = (r) => judged.some(([n]) => n === r.tool) || wholeToolRuleReaches(r.tool, req);
126
+ const ownRow = (r) => judged.some(([n]) => n === r.tool) || wholeToolRuleReaches(r.tool, req, r.behavior);
127
127
  if (judged.length === 0 && !view.rules.some(ownRow))
128
128
  return view.unreadable !== undefined ? { unreadable: true } : undefined;
129
129
  try {
@@ -7,7 +7,7 @@ import { type OnAsk, type ToolCallRequest, type ToolPolicy } from "../tool-polic
7
7
  import type { RunnerDeps, TaskSpec } from "../types.js";
8
8
  import type { CwdRef } from "../../tools/fs/fs-shared.js";
9
9
  import type { AskLane, Prepared } from "./contracts.js";
10
- import type { GrantBindingOf } from "../skill-grant-binding.js";
10
+ import { type GrantBindingOf } from "../skill-grant-binding.js";
11
11
  import { consumeInheritedAskGrant } from "./inherited-ask-grants.js";
12
12
  import { type GrantReadRoot } from "./read-root-grant.js";
13
13
  import type { createRuleOffersOf } from "./permission-rule-lanes.js";
@@ -8,6 +8,7 @@ import { failedJudgmentDeny, policyCheckAbortedDeny } from "./policy-throw.js";
8
8
  import { askMandateMember } from "../ask-origin.js";
9
9
  import { approvalCardMemberOf, survivorsByName } from "../tool-roster.js";
10
10
  import { toolNameIndex } from "../../internal/llm.js";
11
+ import { requestGrantBinding } from "../skill-grant-binding.js";
11
12
  import { gateAskCarry, lateAskSettlementObserver } from "./denial-limit-arms.js";
12
13
  import { consumeInheritedAskGrant } from "./inherited-ask-grants.js";
13
14
  import { requesterOf } from "../mods/extension-call.js";
@@ -61,7 +62,7 @@ export function prepareAskLane(input) {
61
62
  const adjudicate = effectivePolicy
62
63
  ? async (req, callSignal) => {
63
64
  const signal = composedCallSignal(callSignal);
64
- const stampedReq = () => ({ ...req, budget: budgetSnapshot, ...(handsCwdRef !== undefined ? { cwd: handsCwdRef.current } : {}), ...(handsRoot !== undefined ? { root: handsRoot } : {}), ...advertisedWritableRootsSeat(advertisedWritableDirs), ...exemptRootsSeat(exemptRoots) });
65
+ const stampedReq = () => ({ ...req, budget: budgetSnapshot, ...(handsCwdRef !== undefined ? { cwd: handsCwdRef.current } : {}), ...(handsRoot !== undefined ? { root: handsRoot } : {}), ...advertisedWritableRootsSeat(advertisedWritableDirs), ...exemptRootsSeat(exemptRoots), ...requestGrantBinding(grantBindingOf, req, req.args) });
65
66
  const judged = (async () => {
66
67
  const withReading = stampCallTarget?.(stampedReq(), signal);
67
68
  return withReading === undefined ? effectivePolicy.check(stampedReq(), signal) : effectivePolicy.check(await withReading, signal);
@@ -84,8 +84,8 @@ export interface PrepareBoundaryParksInput {
84
84
  resourceSuspendEligible: boolean;
85
85
  /** borrowed-readonly — the wiring-manifest phase's durable-infra predicate: exposes `suspendForPlatformLimit`. */
86
86
  durableSuspendInfraReady: boolean;
87
- /** borrowed-readonly — the restore-incomplete adapter's missing members, or undefined (the review lane refuses loudly). */
88
- incompleteSuspendAdapter: readonly ("resumeVM" | "postResumeInit")[] | undefined;
87
+ /** borrowed-readonly — why the per-task remote env is in neither suspend target, or undefined (the review lane refuses loudly). */
88
+ suspendTargetGap: string | undefined;
89
89
  }
90
90
  export interface PrepareBoundaryParksResult {
91
91
  /** owned — the task-axis resource lane (`Prepared.suspendForResource`), or undefined (no opt-in / no infra / inactive). */
@@ -4,7 +4,7 @@ import { defaultTaskRegistry } from "../task-registry.js";
4
4
  import { DEFAULT_RESOURCE_TTL_MS, publishCommittedSuspend, sanitizedTtlMs, USAGE_WINDOW_REAP_MARGIN_MS } from "./park-commit.js";
5
5
  import { remoteEnvFailureNote } from "./remote-env-retry.js";
6
6
  export function prepareBoundaryParks(input) {
7
- const { saga, spec, checkpointStore, checkpointScope, abortController, harness, session, sessions, sessionId, deps, priorLedger, maxSlices, maxSuspends, resourceTotal, priorSuspendCount, suspendChainBase, humanReviewRef, liveSpendRef, now, pausedRef, remoteEnvFailures, resourceSuspendEligible, durableSuspendInfraReady, incompleteSuspendAdapter } = input;
7
+ const { saga, spec, checkpointStore, checkpointScope, abortController, harness, session, sessions, sessionId, deps, priorLedger, maxSlices, maxSuspends, resourceTotal, priorSuspendCount, suspendChainBase, humanReviewRef, liveSpendRef, now, pausedRef, remoteEnvFailures, resourceSuspendEligible, durableSuspendInfraReady, suspendTargetGap } = input;
8
8
  if (saga === undefined)
9
9
  return { suspendForResource: undefined, suspendForPlatformLimit: undefined, suspendForReview: undefined };
10
10
  const { inFlightSpendMicroUsd, serializeCheckpointState, commitSuspendSaga, suspendLoopCapHit, suspendableEnv, parkOnlyRemoteEnv, parkOnlyHandle } = saga;
@@ -78,14 +78,14 @@ export function prepareBoundaryParks(input) {
78
78
  const suspendForResource = resourceSuspendEligible ? mintResourceSuspend : undefined;
79
79
  const suspendForPlatformLimit = durableSuspendInfraReady ? mintResourceSuspend : undefined;
80
80
  const suspendForReview = checkpointStore
81
- ? async (reason) => {
81
+ ? async (reason, requestedByCallId) => {
82
82
  if (!checkpointStore)
83
83
  return false;
84
84
  if (abortController.signal.aborted)
85
85
  return false;
86
- if (incompleteSuspendAdapter !== undefined) {
86
+ if (suspendTargetGap !== undefined) {
87
87
  try {
88
- deps.onError?.(new Error(`plan_review park skipped: the per-task execution env declares capabilities.suspendable but its adapter does not implement ${incompleteSuspendAdapter.join(" or ")}, so its workspace could not be restored on resume (the plan-review request was dropped; the run continues without pausing)`), { phase: "config", sessionId });
88
+ deps.onError?.(new Error(`plan_review park skipped: the per-task execution env ${suspendTargetGap}, so its workspace could not be restored on resume (the plan-review request was dropped; the run continues without pausing)`), { phase: "config", sessionId });
89
89
  }
90
90
  catch {
91
91
  }
@@ -133,7 +133,7 @@ export function prepareBoundaryParks(input) {
133
133
  sessionId,
134
134
  leafId,
135
135
  gate,
136
- pendingAction: { kind: "plan_review" },
136
+ pendingAction: { kind: "plan_review", ...(requestedByCallId !== undefined && requestedByCallId !== "" ? { requestedByCallId } : {}) },
137
137
  state: serializeCheckpointState(remoteHandle, inFlightSpendMicroUsd()),
138
138
  status: "pending",
139
139
  createdAt: mintedAt,
@@ -75,8 +75,8 @@ export interface PrepareCapsAndWorkflowInput {
75
75
  model: Model;
76
76
  /** borrowed-readonly — the run's resolved thinking level, when one is (the Workflow mount's parentThinking fallback). */
77
77
  thinking: ThinkingLevel | undefined;
78
- /** borrowed-readonly — the frozen preflight; only `mcp` (the compliance veto's mcp_servers conflict check). */
79
- lockedPreflight: Pick<LockedPreflight, "mcp">;
78
+ /** borrowed-readonly — the frozen preflight; only `mcp` and `a2a` (the compliance veto's mcp_servers / a2a_peers conflict checks). */
79
+ lockedPreflight: Pick<LockedPreflight, "mcp" | "a2a">;
80
80
  /** borrowed-mutable — the effect collection (`Prepared.toolEffects`): the safety scan's caller entries, then the mounts' writes. */
81
81
  toolEffects: Prepared["toolEffects"];
82
82
  /** borrowed-readonly — the frozen tool-face snapshot the Workflow mount forwards (exclude / defer / alwaysLoad / restoreGated). */
@@ -105,10 +105,10 @@ export interface PrepareCapsAndWorkflowInput {
105
105
  offload?: boolean;
106
106
  offloadThresholdChars?: number;
107
107
  }) => AgentTool;
108
+ /** borrowed-readonly — where a workflow run's full record is stored when its completion carries less (the driver's one mint). */
109
+ taskArtifacts: import("../tool-result-store.js").TaskArtifactSeat | undefined;
108
110
  /** borrowed-readonly — the plan-review primitive the ExitPlanMode tool calls. */
109
- requestReview: (opts?: {
110
- reason?: string;
111
- }) => void;
111
+ requestReview: (opts?: import("../present-plan-tool.js").ReviewRequest) => void;
112
112
  /** borrowed-readonly — the declared session plan file as ExitPlanMode's FILE arm reads it (absent ⇒ the parameter arm). */ planFileSource?: PlanFileSource;
113
113
  /** borrowed-readonly — the plan-mode primitive the EnterPlanMode tool calls: a steer of the leg's mode seat into `plan`. */
114
114
  enterPlanMode: () => Promise<void>;
@@ -146,6 +146,8 @@ export interface PrepareCapsAndWorkflowInput {
146
146
  artifact: PromptArtifact;
147
147
  sourceRevision?: string;
148
148
  } | undefined;
149
+ /** borrowed-readonly — LATE-BOUND: the leg's agent stations; the Workflow mount's getter reads them at ITS call time. */
150
+ agentStations: () => import("../mods/agent-stations.js").AgentStations | undefined;
149
151
  }
150
152
  export interface PrepareCapsAndWorkflowResult {
151
153
  /** owned — THE run's roster BUILDER (the mount array is private to it; `Prepared.tools` is its read face,
@@ -117,7 +117,7 @@ function autoModeArmReasonOf(intent, facePresent, caps, capsFaulted) {
117
117
  return { armed: true, reason: "armed" };
118
118
  }
119
119
  export async function prepareCapsAndWorkflow(input) {
120
- const { spec, deps, parentSpecSeat, checkpointSeat, internals, session, sessionId, runId, hostTaskId, taskScope, taskRootFinal, model, thinking, lockedPreflight, toolEffects, toolFaceSnapshot, promptLean, resolvedInteractionPosture, harnessRef, askSeat, runClampSource, forwardEvent, inheritedGateForChildren, enrichSpecToolCtx, maybeOffload, requestReview, enterPlanMode, permissionMode, readDenyEntries, peerLaneActive, peerSendMessageBuiltIn, runnerSelf, delegated, sideCallBookRef } = input;
120
+ const { spec, deps, parentSpecSeat, checkpointSeat, internals, session, sessionId, runId, hostTaskId, taskScope, taskRootFinal, model, thinking, lockedPreflight, toolEffects, toolFaceSnapshot, promptLean, resolvedInteractionPosture, harnessRef, askSeat, runClampSource, forwardEvent, inheritedGateForChildren, enrichSpecToolCtx, maybeOffload, taskArtifacts, requestReview, enterPlanMode, permissionMode, readDenyEntries, peerLaneActive, peerSendMessageBuiltIn, runnerSelf, delegated, sideCallBookRef } = input;
121
121
  const roster = new RosterBuilder(toolEffects);
122
122
  for (const t of spec.tools ?? []) {
123
123
  const mounted = mountCallerTool(t);
@@ -196,6 +196,8 @@ export async function prepareCapsAndWorkflow(input) {
196
196
  if (complianceDenies.has("mcp_servers") && lockedPreflight.mcp?.length) {
197
197
  complianceRefuse("mcp_servers", "TaskSpec.mcp (MCP server materialization)");
198
198
  }
199
+ if (complianceDenies.has("a2a_peers") && lockedPreflight.a2a?.length)
200
+ complianceRefuse("a2a_peers", "TaskSpec.a2a (A2A peer materialization)");
199
201
  if (complianceDenies.has("workflows") && spec.selfOrchestration === true) {
200
202
  complianceRefuse("workflows", "TaskSpec.selfOrchestration (workflow self-orchestration)");
201
203
  }
@@ -236,7 +238,7 @@ export async function prepareCapsAndWorkflow(input) {
236
238
  const classifierRungs = classifierLadderRungs(am.classifierFallback, classifierModel, model);
237
239
  const denialTracking = createAutoModeDenialTracker(am.denialLimit);
238
240
  const decider = createAutoModeDecider({
239
- ...(am.timeoutMs !== undefined ? { timeoutMs: am.timeoutMs } : {}),
241
+ ...(am.timeoutMs !== undefined ? { timeoutMs: am.timeoutMs } : {}), ...(am.rateLimitBreakAfter !== undefined ? { rateLimitBreakAfter: am.rateLimitBreakAfter } : {}),
240
242
  candidates: classifierRungs.map((m) => m.id),
241
243
  onClassified: classifierRoundObserver({ tracer: deps.tracer, onNotice: deps.onNotice, taskId: hostTaskId, seatModelId: classifierModel.id, ...(sessionId !== undefined ? { sessionId } : {}), ...(runId !== undefined ? { runId } : {}) }),
242
244
  assemble: async (input) => {
@@ -331,7 +333,7 @@ export async function prepareCapsAndWorkflow(input) {
331
333
  originatingSessionId: sessionId,
332
334
  rootSessionId: internals?.rootSessionId ?? sessionId, ...(internals?.placementRoot !== undefined ? { placementRoot: internals.placementRoot } : {}), crossBoundaryTree: input.crossBoundaryTree,
333
335
  taskRegistry: defaultTaskRegistry,
334
- taskNotification: internals?.onTaskNotification,
336
+ taskNotification: internals?.onTaskNotification, ...(taskArtifacts !== undefined ? { taskArtifacts } : {}),
335
337
  taskOwner: hostTaskId,
336
338
  limits: deps.workflowLimits,
337
339
  sourceTaskId: hostTaskId,
@@ -362,6 +364,7 @@ export async function prepareCapsAndWorkflow(input) {
362
364
  return assembleParentCaptureState(co?.optedOut() ?? false, co?.indeterminate() ?? false, ctl, [...(internals?.memoryCaptureAncestors ?? []), { sessionId, ...(ctl !== undefined ? { controlDir: ctl } : {}) }]);
363
365
  },
364
366
  autoModeReview: () => (autoModeDeciderRef.current !== undefined ? { decider: autoModeDeciderRef.current } : undefined),
367
+ agentStations: input.agentStations,
365
368
  workflowDepth: internals?.workflowDepth,
366
369
  parentCwd: taskRootFinal,
367
370
  parentThinking: () => childThinkingSeat(undefined, deploymentSubagentThinking(runnerSelf.agentCatalog?.roles), harnessRef.current?.getThinkingLevel() ?? thinking).thinking,
@@ -26,7 +26,7 @@ import { type CrossBoundaryPosture } from "../cross-boundary-taint.js";
26
26
  import { type HostFloor } from "../host-floor.js";
27
27
  import { type CheckpointState } from "../checkpoint-store.js";
28
28
  import { runOriginOfLeg, type RunOrigin } from "../run-origin.js";
29
- import { type ConfigDoorEntry, type LockedPreflight } from "../locked-config.js";
29
+ import { type ConfigDoorEntry, type LockedPreflight, type ReceivedPeerDeclarations } from "../locked-config.js";
30
30
  import { type ResolvedRole } from "../roles.js";
31
31
  import { type ResolvedSkillListingBudget } from "../skill-listing-budget.js";
32
32
  import type { SessionStore } from "../session.js";
@@ -133,6 +133,8 @@ export interface PrepareConfigDoorsResult {
133
133
  * `spec.agents` was set, in which case it is a shallow copy whose `tools` is the
134
134
  * withAgents-rebuilt roster. Every later phase (the safety scan above all — T21) must read THIS, never the original input. */
135
135
  spec: RosterSpec;
136
+ /** The deps the leg reads from here on: the caller's, with the deployment role map's one receipt in place of the live map. */
137
+ deps: RunnerDeps;
136
138
  /** owned — the frozen task-start copies of the caller's tool-face control arrays; the driver compiles the leg's selector
137
139
  * from them, and the selector (with the disclosure lists) is the ONLY thing later face reads consult. Frozen-immutable. */
138
140
  toolFaceLists: ToolFaceLists;
@@ -243,6 +245,8 @@ type ConfigValueDoorsResult = Pick<PrepareConfigDoorsResult, "toolFaceLists" | "
243
245
  };
244
246
  skills: TaskSpec["skills"];
245
247
  projectMemory: TaskSpec["projectMemory"];
248
+ deploymentRoles: RunnerDeps["roles"];
249
+ taskRoles: TaskSpec["roles"];
246
250
  };
247
251
  /**
248
252
  * The phase's VALUE doors as ONE function with two callers — each judges a declared value against its own vocabulary, reading only the
@@ -259,6 +263,7 @@ export declare function configValueDoors(input: {
259
263
  sessions: SessionStore;
260
264
  holder?: string | undefined;
261
265
  resumedRow?: Parameters<typeof runOriginOfLeg>[1];
266
+ receivedPeers?: ReceivedPeerDeclarations;
262
267
  }, enter?: ConfigDoorEntry): ConfigValueDoorsResult;
263
268
  /**
264
269
  * The doors a RESUMED leg's prepare refuses at, run as one screen BEFORE the claim — prepare's own functions, so a refusal carries
@@ -29,7 +29,7 @@ import { effectiveTraitsOf, readModelPromptTraits, resolveHost, resolvePromptLea
29
29
  import { assertNoRetiredKeys, RETIRED_MODEL_KEYS } from "../retired-keys.js";
30
30
  import { resolvePromptBinding } from "../../prompt-assembly/overlay.js";
31
31
  import { assertPeerPresenceValue } from "../../agents/peer-directory.js";
32
- import { snapshotDefinitionLists } from "../../agents/tool-filter.js";
32
+ import { snapshotDefinitionLists } from "../../agents/agent-definition.js";
33
33
  import { mcpUnavailableOn, TOTAL_TOKENS_REMINDER_MODES } from "./turn-attachments.js";
34
34
  import { refuseRetiredMember, rosterFaceOf } from "./caller-roster.js";
35
35
  import { assertToolBoundaryLegs } from "../tool-roster.js";
@@ -183,7 +183,8 @@ export function assertResumeConfigRecord(config) {
183
183
  }
184
184
  }
185
185
  export function configValueDoors(input, enter = ENTER_AS_IS) {
186
- const { spec, deps, resumeLeg, sessions, holder } = input;
186
+ const { spec, resumeLeg, sessions, holder } = input;
187
+ let deps = input.deps;
187
188
  enter("deps", () => assertNoRetiredRunnerDeps(deps));
188
189
  enter("taskConfig", () => assertPrincipalValue(spec.principal));
189
190
  const runOrigin = enter("taskConfig", () => runOriginOfLeg(spec.runOrigin, input.resumedRow));
@@ -225,8 +226,10 @@ export function configValueDoors(input, enter = ENTER_AS_IS) {
225
226
  : undefined,
226
227
  };
227
228
  const promptHost = enter("taskConfig", () => resolveHost(spec));
228
- enter("deps", () => screenRoleMap(deps.roles, "RunnerDeps.roles"));
229
- enter("taskConfig", () => screenRoleMap(spec.roles, "TaskSpec.roles"));
229
+ const deploymentRoles = enter("deps", () => screenRoleMap(deps.roles, "RunnerDeps.roles"));
230
+ if (deploymentRoles !== undefined)
231
+ deps = { ...deps, roles: deploymentRoles };
232
+ const taskRoles = enter("taskConfig", () => screenRoleMap(spec.roles, "TaskSpec.roles"));
230
233
  const promptBinding = enter("taskConfig", () => resolvePromptBinding(spec));
231
234
  const promptLean = enter("taskConfig", () => resolvePromptLean(spec));
232
235
  if (spec.resumeAt !== undefined)
@@ -282,6 +285,8 @@ export function configValueDoors(input, enter = ENTER_AS_IS) {
282
285
  e.code = "config.memory_persistence_invalid";
283
286
  throw e;
284
287
  });
288
+ if (spec.classifyAllShell !== undefined && typeof spec.classifyAllShell !== "boolean")
289
+ enter("taskConfig", () => { throw limitConfigError("config.invalid_argument", `TaskSpec.classifyAllShell must be a boolean when present (got ${describeRejectedValue(spec.classifyAllShell)}) — true lets no shell allow entry clear a call in auto mode; omit the key for the default.`); });
285
290
  if (spec.toolMaterializeStrategy === "static" && spec.deferSelfResolve === false)
286
291
  enter("taskConfig", () => {
287
292
  const e = new Error(`toolMaterializeStrategy "static" cannot be combined with deferSelfResolve: false — with the direct-call ` +
@@ -295,7 +300,7 @@ export function configValueDoors(input, enter = ENTER_AS_IS) {
295
300
  e.code = "config.empty_objective";
296
301
  throw e;
297
302
  }
298
- const lockedPreflight = preflightLockedConfig(spec, deps, enter);
303
+ const lockedPreflight = preflightLockedConfig(spec, deps, enter, input.receivedPeers);
299
304
  const declaredSkills = spec.skills;
300
305
  const skills = declaredSkills === undefined ? undefined : enter("taskConfig", () => readSkillsSeat(declaredSkills));
301
306
  enter("deps", () => screenHandsBandOptions(deps.hands));
@@ -340,7 +345,7 @@ export function configValueDoors(input, enter = ENTER_AS_IS) {
340
345
  }));
341
346
  if (taskStore !== undefined)
342
347
  enter("taskConfig", () => assertRetentionWords({ ...retention, stores: [{ name: "checkpointStore", store: taskStore }] }));
343
- return { toolFaceLists, promptHost, promptBinding, promptLean, lockedPreflight, skillListingSeats, skills, projectMemory, microCompactKnob, memoryDelegationEvidence, memoryProvenance, memoryCapturePolicy, usageWindows, brainCallGuardrailMs, crossBoundaryPosture, advisorTool, hostFloor, runOrigin };
348
+ return { toolFaceLists, promptHost, promptBinding, promptLean, lockedPreflight, skillListingSeats, skills, projectMemory, microCompactKnob, memoryDelegationEvidence, memoryProvenance, memoryCapturePolicy, usageWindows, brainCallGuardrailMs, crossBoundaryPosture, advisorTool, hostFloor, runOrigin, deploymentRoles, taskRoles };
344
349
  }
345
350
  export function refuseResumeDoors(config, recorded, deps, sessions, holder) {
346
351
  asResumeConfigRefusal("taskConfig", () => {
@@ -357,13 +362,14 @@ export function refuseResumeDoors(config, recorded, deps, sessions, holder) {
357
362
  return { ...config, ...(config.mcp !== undefined ? { mcp: lockedPreflight.mcp ?? [] } : {}), ...(config.a2a !== undefined ? { a2a: lockedPreflight.a2a ?? [] } : {}), skills };
358
363
  }
359
364
  export function prepareConfigDoors(input) {
360
- const { deps, sessions, resume, internals } = input;
365
+ const { sessions, resume, internals } = input;
361
366
  assertToolBoundaryLegs(input.spec.tools);
362
367
  assertToolCardDeclarations(input.spec.tools);
363
368
  let spec = input.spec;
364
- const { toolFaceLists, promptHost, promptBinding, promptLean, lockedPreflight, skillListingSeats, skills, projectMemory, microCompactKnob, memoryDelegationEvidence, memoryProvenance, memoryCapturePolicy, usageWindows, brainCallGuardrailMs, crossBoundaryPosture, advisorTool, hostFloor, runOrigin } = configValueDoors({ spec, deps, resumeLeg: resume !== undefined, sessions, holder: internals?.holder, ...(resume !== undefined ? { resumedRow: { recorded: screenRecordedRunOrigin(resume.seed.runOrigin), ...(resume.opening !== undefined ? { opening: resume.opening } : {}) } } : {}) });
369
+ const { toolFaceLists, promptHost, promptBinding, promptLean, lockedPreflight, skillListingSeats, skills, projectMemory, microCompactKnob, memoryDelegationEvidence, memoryProvenance, memoryCapturePolicy, usageWindows, brainCallGuardrailMs, crossBoundaryPosture, advisorTool, hostFloor, runOrigin, deploymentRoles, taskRoles } = configValueDoors({ spec, deps: input.deps, resumeLeg: resume !== undefined, sessions, holder: internals?.holder, ...(internals?.receivedPeers !== undefined ? { receivedPeers: internals.receivedPeers } : {}), ...(resume !== undefined ? { resumedRow: { recorded: screenRecordedRunOrigin(resume.seed.runOrigin), ...(resume.opening !== undefined ? { opening: resume.opening } : {}) } } : {}) });
365
370
  const doorRead = (value) => ({ value, enumerable: value !== undefined, writable: false, configurable: false });
366
- spec = Object.create(Object.getPrototypeOf(spec), { ...Object.getOwnPropertyDescriptors(spec), skills: doorRead(skills), projectMemory: doorRead(projectMemory), runOrigin: doorRead(runOrigin) });
371
+ const deps = deploymentRoles !== undefined ? { ...input.deps, roles: deploymentRoles } : input.deps;
372
+ spec = Object.create(Object.getPrototypeOf(spec), { ...Object.getOwnPropertyDescriptors(spec), skills: doorRead(skills), projectMemory: doorRead(projectMemory), runOrigin: doorRead(runOrigin), ...(taskRoles !== undefined ? { roles: doorRead(taskRoles) } : {}) });
367
373
  const resolvedInteractionPosture = spec.interactionPosture ?? internals?.parentInteractionPosture ?? deps.interactionPosture;
368
374
  const askSeat = resolveAskSeat(spec, deps);
369
375
  {
@@ -490,6 +496,7 @@ export function prepareConfigDoors(input) {
490
496
  const compModel = resolveCompactionModel(spec, deps, "TaskSpec.compactionModel");
491
497
  return {
492
498
  spec,
499
+ deps,
493
500
  toolFaceLists,
494
501
  promptLean,
495
502
  promptTraits,
@@ -12,6 +12,7 @@ import { applyGitFrameGuard } from "./git-status-frame.js";
12
12
  import { applyContextShrinkToReadFileState } from "../../tools/fs/index.js";
13
13
  import { rosterToolName } from "../tool-roster.js";
14
14
  import { createToolTurnRepairSeat } from "./tool-turn-repair-seat.js";
15
+ import { createImageRemovedSeat } from "./image-removed-seat.js";
15
16
  export function prepareContextLane(input) {
16
17
  const { model, deps, sessionId, runId, hostTaskId, offloadStore, toolRosterDeltas, microCompactKnob, harness, batchHaltRef, gitStatusRef, postureFrameRef, requestLossyRef, trimPressureRef, readFileState } = input;
17
18
  const toolNameOf = (recorded) => rosterToolName(toolRosterDeltas.current, recorded);
@@ -29,6 +30,7 @@ export function prepareContextLane(input) {
29
30
  requestLossyRef.current = true;
30
31
  announceRepairs(repairs);
31
32
  };
33
+ harness.onImagesRemoved = createImageRemovedSeat((notice) => deps.onNotice?.(notice), { sessionId, runId });
32
34
  harness.on("context", async ({ messages, recheck, signal }) => {
33
35
  batchHaltRef.current = undefined;
34
36
  const pendingProjectionObservations = [];
@@ -20,6 +20,7 @@ import type { AgentTool, ExecutionEnv, WorkspaceState } from "../../internal/har
20
20
  import { type PeerLaneRefs } from "../../agents/peer-session-drain.js";
21
21
  import type { SubagentRetainLedger } from "../../agents/retain-ledger.js";
22
22
  import type { ShellReadAdmission } from "../../tools/fs/shell-read-check.js";
23
+ import type { ReadFloorSeat } from "../../tools/fs/read-floor.js";
23
24
  import { type WorktreeSessionRef } from "../../tools/worktree.js";
24
25
  import type { CwdRef } from "../../tools/fs/index.js";
25
26
  import { type ToolResultStore } from "../tool-result-store.js";
@@ -28,9 +29,9 @@ import type { PrepareResume, RunInternals, RunnerSelfSeat, ToolFaceSnapshot } fr
28
29
  import { RosterBuilder } from "../tool-roster.js";
29
30
  export interface PrepareDelegationSurfaceInput {
30
31
  /** borrowed-readonly — the REBOUND spec. Read: `tools` (the shadow checks and the revival spawner's delegation-tool
31
- * lookup), `oneShot` (the read/kill faces' completion promises), `retainBackgroundProcesses` (the Monitor receipt),
32
- * `handsReadOnly` is NOT read here (the hands mount decided the surface). Never mutated. */
33
- spec: Pick<TaskSpec, "tools" | "oneShot" | "retainBackgroundProcesses" | "excludeAllTools">;
32
+ * lookup), `retainBackgroundProcesses` (the Monitor receipt), `handsReadOnly` is NOT read here (the hands mount
33
+ * decided the surface). Never mutated. */
34
+ spec: Pick<TaskSpec, "tools" | "retainBackgroundProcesses" | "excludeAllTools">;
34
35
  /** borrowed-readonly — the deployment seats the mounts read: `workflowRunStore` / `backgroundAgentStore` / `mailboxStore` (the
35
36
  * read/kill faces and the tier-3 revival seams), `rosterStore`, `peerLane`, `peerDirectory`, `peerChannel`, `onNotice`,
36
37
  * `onBackgroundChildEvent`, `tracer`. */
@@ -61,6 +62,9 @@ export interface PrepareDelegationSurfaceInput {
61
62
  backgroundTaskToolsActive: boolean;
62
63
  /** borrowed-readonly — this run's shell read station's pre-spawn ADMISSION (declared at the hands phase), for `Monitor`: the only P11 face that spawns a shell command. */
63
64
  shellReadAdmission: ShellReadAdmission | undefined;
65
+ /** borrowed-readonly — the byte floor's seat over the run's read-deny table (declared at the hands phase), for `Monitor`:
66
+ * the watched command's start carries the table to the environment, as the band's shell starts do. */
67
+ shellReadFloor: ReadFloorSeat | undefined;
64
68
  /** borrowed-readonly — the door's second half: the Workflow tool is on the roster. */
65
69
  workflowToolsActive: boolean;
66
70
  /** borrowed-readonly — the peer lane's mount verdict for this leg. */
@@ -95,6 +99,8 @@ export interface PrepareDelegationSurfaceInput {
95
99
  /** borrowed-readonly — the run's offload store, or undefined when offload is disabled (then no reader mounts and the
96
100
  * read/kill faces spill nowhere). */
97
101
  offloadStore: ToolResultStore | undefined;
102
+ /** borrowed-readonly — where a cut completion's full result is stored (the driver's one mint over `offloadStore`). */
103
+ taskArtifacts: import("../tool-result-store.js").TaskArtifactSeat | undefined;
98
104
  /** borrowed-readonly — the retain ledger the SendMessage mount continues children through (absent ⇒ honest not-retained). */
99
105
  subagentRetain: SubagentRetainLedger | undefined;
100
106
  /** borrowed-readonly — the caller-tool ctx enrichment: the revival spawner re-enters the delegation tool through it, and
@@ -13,7 +13,7 @@ import { deliverEngineNotice } from "../types.js";
13
13
  import { RosterBuilder } from "../tool-roster.js";
14
14
  import { sendMessageContinuationSeats } from "./send-message-continuation.js";
15
15
  export function prepareDelegationSurface(input) {
16
- const { spec, deps, internals, resume, sessionId, hostTaskId, taskScope, taskRootFinal, taskRootCanonical, executionEnv, runnerSelf, backgroundTaskToolsActive, workflowToolsActive, peerLaneActive, peerSendMessageBuiltIn, peerLaneRefs, sessionBox, roster, axisExplicitNegatives, envHandToolNames, toolFaceSnapshot, firstPartyOffload, offloadStore, subagentRetain, enrichSpecToolCtx, checkpointSeat, handsCwdRef, wsSnapshot, rebaseWsPath, rebaseRestoredPath, workspaceStateSettle, worktreeSeat } = input;
16
+ const { spec, deps, internals, resume, sessionId, hostTaskId, taskScope, taskRootFinal, taskRootCanonical, executionEnv, runnerSelf, backgroundTaskToolsActive, workflowToolsActive, peerLaneActive, peerSendMessageBuiltIn, peerLaneRefs, sessionBox, roster, axisExplicitNegatives, envHandToolNames, toolFaceSnapshot, firstPartyOffload, offloadStore, taskArtifacts, subagentRetain, enrichSpecToolCtx, checkpointSeat, handsCwdRef, wsSnapshot, rebaseWsPath, rebaseRestoredPath, workspaceStateSettle, worktreeSeat } = input;
17
17
  let worktreeSessionRef;
18
18
  const delegationSurfaceActive = backgroundTaskToolsActive || workflowToolsActive;
19
19
  const leaves = valveLeaves(spec, toolFaceSnapshot.selector);
@@ -21,7 +21,7 @@ export function prepareDelegationSurface(input) {
21
21
  if (delegationSurfaceActive || internals?.parentNotify !== undefined || peerLaneActive) {
22
22
  if (delegationSurfaceActive) {
23
23
  roster.mountAll([
24
- firstPartyOffload(createTaskOutputTool({ registry: defaultTaskRegistry, owner: hostTaskId, scope: taskScope, sessionId, workflowStore: deps.workflowRunStore, agentStore: deps.backgroundAgentStore, notificationWired: internals?.onTaskNotification !== undefined, oneShot: spec.oneShot, toolResultStore: offloadStore, ...(checkpointSeat !== undefined ? { checkpointSeat } : {}) })),
24
+ firstPartyOffload(createTaskOutputTool({ registry: defaultTaskRegistry, owner: hostTaskId, scope: taskScope, sessionId, workflowStore: deps.workflowRunStore, agentStore: deps.backgroundAgentStore, notificationWired: internals?.onTaskNotification !== undefined, toolResultStore: offloadStore, ...(checkpointSeat !== undefined ? { checkpointSeat } : {}) })),
25
25
  firstPartyOffload(createTaskStopTool({ registry: defaultTaskRegistry, owner: hostTaskId, scope: taskScope, sessionId, workflowStore: deps.workflowRunStore, agentStore: deps.backgroundAgentStore })),
26
26
  ], { source: "builtin", mountedBy: "delegation" });
27
27
  }
@@ -36,7 +36,7 @@ export function prepareDelegationSurface(input) {
36
36
  owner: hostTaskId,
37
37
  scope: taskScope,
38
38
  ...(sessionId !== undefined ? { sessionId } : {}),
39
- ...(internals?.onTaskNotification !== undefined ? { notify: internals.onTaskNotification } : {}), ...(spec.oneShot !== undefined ? { oneShot: spec.oneShot } : {}), retrievalToolMounted: delegationSurfaceActive,
39
+ ...(internals?.onTaskNotification !== undefined ? { notify: internals.onTaskNotification } : {}), ...(taskArtifacts !== undefined ? { taskArtifacts } : {}),
40
40
  ...(internals?.onSubagentSpawn !== undefined ? { sink: internals.onSubagentSpawn } : {}),
41
41
  ...(internals?.parentNotify !== undefined
42
42
  ? { uplink: internals.parentNotify, ...(internals.parentPeerRef !== undefined ? { uplinkRecipient: internals.parentPeerRef } : {}) }
@@ -93,6 +93,7 @@ export function prepareDelegationSurface(input) {
93
93
  roster.mount(firstPartyOffload(createMonitorTool(executionEnv, {
94
94
  registry: defaultTaskRegistry,
95
95
  ...(input.shellReadAdmission !== undefined ? { shellReadAdmission: input.shellReadAdmission } : {}),
96
+ ...(input.shellReadFloor !== undefined ? { readFloor: input.shellReadFloor } : {}),
96
97
  owner: hostTaskId,
97
98
  scope: taskScope,
98
99
  ...(sessionId !== undefined ? { sessionId } : {}),
@@ -125,6 +126,6 @@ export function prepareDelegationSurface(input) {
125
126
  roster.mountAll(createWorktreeTools(executionEnv, { repoRoot: taskRootFinal, cwdRef: handsCwdRef, session: worktreeSessionRef }).map((t) => (envHandToolNames.add(t.name), firstPartyOffload(t))), { source: "builtin", mountedBy: "hands" });
126
127
  }
127
128
  if (offloadStore)
128
- roster.mount(createReadToolResultTool(offloadStore), { source: "builtin", mountedBy: "optional" });
129
+ roster.mount(createReadToolResultTool(offloadStore, (ref, tree) => defaultTaskRegistry.artifactBoundaryLegs(ref, { owner: hostTaskId, scope: taskScope, sessionId }, tree)), { source: "builtin", mountedBy: "optional" });
129
130
  return { delegationSurfaceActive, worktreeSessionRef };
130
131
  }