@sema-agent/core 7.59.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 (360) hide show
  1. package/CHANGELOG.md +564 -0
  2. package/dist/agents/agent-definition.d.ts +7 -0
  3. package/dist/agents/agent-definition.js +12 -0
  4. package/dist/agents/agent-transcript-tool.d.ts +2 -1
  5. package/dist/agents/agent-transcript-tool.js +3 -1
  6. package/dist/agents/child-model-seat.js +6 -3
  7. package/dist/agents/cumulative-stats.js +0 -1
  8. package/dist/agents/inherited-tool-pool.d.ts +26 -1
  9. package/dist/agents/inherited-tool-pool.js +22 -0
  10. package/dist/agents/retain-ledger.d.ts +11 -1
  11. package/dist/agents/retain-ledger.js +13 -2
  12. package/dist/agents/roster-store.d.ts +1 -1
  13. package/dist/agents/roster-store.js +3 -1
  14. package/dist/agents/send-message-tool.d.ts +8 -19
  15. package/dist/agents/send-message-tool.js +11 -38
  16. package/dist/agents/subagent.d.ts +51 -17
  17. package/dist/agents/subagent.js +117 -78
  18. package/dist/agents/tool-filter.d.ts +1 -3
  19. package/dist/agents/tool-filter.js +4 -12
  20. package/dist/bench/metrics.d.ts +3 -5
  21. package/dist/bench/metrics.js +0 -1
  22. package/dist/brain/degrading.js +3 -1
  23. package/dist/brain/route-adjudicator.js +3 -1
  24. package/dist/brain/status-sink.d.ts +7 -1
  25. package/dist/brain/status-sink.js +6 -0
  26. package/dist/brain/timeout.d.ts +3 -1
  27. package/dist/brain/timeout.js +18 -5
  28. package/dist/core/a2a.d.ts +15 -5
  29. package/dist/core/a2a.js +34 -19
  30. package/dist/core/agent-definition.d.ts +20 -0
  31. package/dist/core/allow-entry.d.ts +2 -0
  32. package/dist/core/allow-entry.js +3 -1
  33. package/dist/core/artifact-host.d.ts +0 -2
  34. package/dist/core/artifact-host.js +0 -1
  35. package/dist/core/auto-mode-defaults.d.ts +8 -0
  36. package/dist/core/auto-mode-defaults.js +1 -0
  37. package/dist/core/auto-mode-rebuild.d.ts +2 -1
  38. package/dist/core/auto-mode.d.ts +39 -4
  39. package/dist/core/auto-mode.js +63 -12
  40. package/dist/core/background-agent-store.d.ts +10 -1
  41. package/dist/core/background-agent-store.js +3 -2
  42. package/dist/core/background-shell.d.ts +12 -1
  43. package/dist/core/background-shell.js +12 -0
  44. package/dist/core/checkpoint-store.d.ts +8 -13
  45. package/dist/core/checkpoint-store.js +4 -3
  46. package/dist/core/compliance.d.ts +1 -1
  47. package/dist/core/credential-echo.d.ts +52 -0
  48. package/dist/core/credential-echo.js +65 -0
  49. package/dist/core/credential-vocabulary.d.ts +13 -3
  50. package/dist/core/credential-vocabulary.js +12 -4
  51. package/dist/core/cross-boundary-taint.d.ts +4 -5
  52. package/dist/core/engine-notice.d.ts +58 -15
  53. package/dist/core/frame-settlement.d.ts +5 -0
  54. package/dist/core/frame-settlement.js +4 -0
  55. package/dist/core/gate-fold.js +7 -5
  56. package/dist/core/gate-lanes.js +39 -8
  57. package/dist/core/governance-codes.d.ts +9 -1
  58. package/dist/core/governance-codes.js +12 -0
  59. package/dist/core/hands-band-screen.js +0 -1
  60. package/dist/core/hands-band.d.ts +0 -3
  61. package/dist/core/hooks.d.ts +39 -56
  62. package/dist/core/hooks.js +123 -77
  63. package/dist/core/image-admission.d.ts +104 -51
  64. package/dist/core/image-admission.js +170 -46
  65. package/dist/core/image-downsample.d.ts +36 -69
  66. package/dist/core/image-downsample.js +111 -73
  67. package/dist/core/integer-option.d.ts +21 -0
  68. package/dist/core/integer-option.js +13 -0
  69. package/dist/core/locked-config.d.ts +54 -3
  70. package/dist/core/locked-config.js +81 -50
  71. package/dist/core/mcp-call-meta.d.ts +2 -2
  72. package/dist/core/mcp-call-meta.js +9 -10
  73. package/dist/core/mcp-failure.d.ts +9 -3
  74. package/dist/core/mcp-failure.js +10 -0
  75. package/dist/core/mcp-host-seat.d.ts +92 -0
  76. package/dist/core/mcp-host-seat.js +131 -0
  77. package/dist/core/mcp-probe.d.ts +7 -2
  78. package/dist/core/mcp-probe.js +7 -2
  79. package/dist/core/mcp-server-spec.d.ts +38 -9
  80. package/dist/core/mcp-server-spec.js +55 -21
  81. package/dist/core/mcp.d.ts +17 -6
  82. package/dist/core/mcp.js +67 -55
  83. package/dist/core/memory-admission.d.ts +23 -6
  84. package/dist/core/memory-admission.js +19 -9
  85. package/dist/core/memory-engine/content-origin.d.ts +13 -0
  86. package/dist/core/memory-engine/content-origin.js +21 -3
  87. package/dist/core/memory-engine/index.d.ts +2 -1
  88. package/dist/core/memory-engine/index.js +2 -1
  89. package/dist/core/memory-engine/scope-contract.d.ts +13 -3
  90. package/dist/core/memory-engine/scope-contract.js +2 -2
  91. package/dist/core/memory-engine/sync-client.d.ts +45 -11
  92. package/dist/core/memory-engine/sync-client.js +82 -11
  93. package/dist/core/memory-engine/sync-report.d.ts +103 -0
  94. package/dist/core/memory-engine/sync-report.js +119 -0
  95. package/dist/core/memory-engine/sync.d.ts +4 -2
  96. package/dist/core/mode-policy.d.ts +9 -1
  97. package/dist/core/mode-policy.js +11 -1
  98. package/dist/core/model-receipt.d.ts +39 -0
  99. package/dist/core/model-receipt.js +139 -0
  100. package/dist/core/mods/agent-stations.d.ts +65 -0
  101. package/dist/core/mods/agent-stations.js +105 -0
  102. package/dist/core/mods/kernel/dispatch.d.ts +5 -1
  103. package/dist/core/mods/kernel/dispatch.js +4 -4
  104. package/dist/core/mods/kernel/events.d.ts +10 -4
  105. package/dist/core/mods/kernel/events.js +10 -6
  106. package/dist/core/mods/kernel/receive.d.ts +5 -0
  107. package/dist/core/mods/kernel/receive.js +10 -0
  108. package/dist/core/mods/lifecycle-stations.d.ts +41 -0
  109. package/dist/core/mods/lifecycle-stations.js +35 -0
  110. package/dist/core/mods/stations.d.ts +51 -59
  111. package/dist/core/mods/stations.js +32 -42
  112. package/dist/core/mods/tool-call.d.ts +10 -4
  113. package/dist/core/mods/tool-call.js +28 -12
  114. package/dist/core/mounted-mcp.d.ts +5 -0
  115. package/dist/core/mounted-mcp.js +2 -2
  116. package/dist/core/namespaced-rule-name.d.ts +7 -1
  117. package/dist/core/namespaced-rule-name.js +13 -2
  118. package/dist/core/oracle-isolation.js +1 -1
  119. package/dist/core/own-property-receipt.d.ts +3 -0
  120. package/dist/core/own-property-receipt.js +3 -0
  121. package/dist/core/park-selfcheck.js +8 -8
  122. package/dist/core/peer-seat.d.ts +63 -8
  123. package/dist/core/peer-seat.js +179 -34
  124. package/dist/core/permission-rule-consent.d.ts +0 -21
  125. package/dist/core/permission-rule-consent.js +1 -2
  126. package/dist/core/permission-rule-model.d.ts +4 -2
  127. package/dist/core/permission-rule-model.js +7 -6
  128. package/dist/core/protocol-http-auth.d.ts +14 -2
  129. package/dist/core/protocol-http-auth.js +16 -7
  130. package/dist/core/read-face-seats.d.ts +7 -5
  131. package/dist/core/read-face-seats.js +4 -1
  132. package/dist/core/redaction-marks.d.ts +4 -3
  133. package/dist/core/redaction-marks.js +2 -2
  134. package/dist/core/remote-env.d.ts +146 -98
  135. package/dist/core/remote-env.js +113 -14
  136. package/dist/core/retention.js +37 -12
  137. package/dist/core/retired-keys.d.ts +6 -1
  138. package/dist/core/retired-keys.js +4 -1
  139. package/dist/core/rewrite-rejudge.d.ts +12 -5
  140. package/dist/core/rewrite-rejudge.js +9 -5
  141. package/dist/core/roles.d.ts +37 -3
  142. package/dist/core/roles.js +126 -78
  143. package/dist/core/rule-owner.d.ts +3 -0
  144. package/dist/core/runner/assemble-result.d.ts +0 -5
  145. package/dist/core/runner/assemble-result.js +0 -1
  146. package/dist/core/runner/call-hook-stations.d.ts +17 -10
  147. package/dist/core/runner/call-hook-stations.js +21 -10
  148. package/dist/core/runner/child-tree.d.ts +7 -8
  149. package/dist/core/runner/child-tree.js +6 -6
  150. package/dist/core/runner/classifier-ladder.d.ts +10 -2
  151. package/dist/core/runner/classifier-ladder.js +39 -8
  152. package/dist/core/runner/construction-doors.js +5 -0
  153. package/dist/core/runner/contracts.d.ts +62 -41
  154. package/dist/core/runner/cross-boundary-lane.d.ts +3 -5
  155. package/dist/core/runner/cross-boundary-lane.js +11 -2
  156. package/dist/core/runner/env-capability-census.d.ts +15 -20
  157. package/dist/core/runner/env-capability-census.js +25 -34
  158. package/dist/core/runner/file-history-request.d.ts +2 -2
  159. package/dist/core/runner/file-history-request.js +0 -8
  160. package/dist/core/runner/gate-exit.d.ts +75 -7
  161. package/dist/core/runner/gate-exit.js +20 -1
  162. package/dist/core/runner/git-status-frame.d.ts +5 -2
  163. package/dist/core/runner/git-status-frame.js +3 -4
  164. package/dist/core/runner/image.d.ts +7 -2
  165. package/dist/core/runner/image.js +14 -8
  166. package/dist/core/runner/inline-image.d.ts +10 -8
  167. package/dist/core/runner/inline-image.js +11 -9
  168. package/dist/core/runner/memory-consolidation-driver.js +4 -4
  169. package/dist/core/runner/permission-rule-lanes.js +1 -1
  170. package/dist/core/runner/prepare-boundary-parks.d.ts +2 -2
  171. package/dist/core/runner/prepare-boundary-parks.js +3 -3
  172. package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -0
  173. package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
  174. package/dist/core/runner/prepare-config-doors.d.ts +6 -1
  175. package/dist/core/runner/prepare-config-doors.js +14 -9
  176. package/dist/core/runner/prepare-delegation-surface.d.ts +5 -3
  177. package/dist/core/runner/prepare-delegation-surface.js +4 -4
  178. package/dist/core/runner/prepare-file-history.d.ts +10 -12
  179. package/dist/core/runner/prepare-file-history.js +3 -12
  180. package/dist/core/runner/prepare-gate-stations.d.ts +4 -3
  181. package/dist/core/runner/prepare-gate-stations.js +4 -3
  182. package/dist/core/runner/prepare-hands-readface.d.ts +3 -1
  183. package/dist/core/runner/prepare-hands-readface.js +15 -7
  184. package/dist/core/runner/prepare-inherited-gate.d.ts +5 -4
  185. package/dist/core/runner/prepare-inherited-gate.js +9 -5
  186. package/dist/core/runner/prepare-memory-engine-session.js +1 -1
  187. package/dist/core/runner/prepare-memory.d.ts +2 -2
  188. package/dist/core/runner/prepare-memory.js +2 -2
  189. package/dist/core/runner/prepare-park-ask.d.ts +3 -5
  190. package/dist/core/runner/prepare-park-ask.js +3 -8
  191. package/dist/core/runner/prepare-policy-chain.d.ts +5 -4
  192. package/dist/core/runner/prepare-policy-chain.js +120 -108
  193. package/dist/core/runner/prepare-project-context.js +8 -5
  194. package/dist/core/runner/prepare-prompt-inputs.d.ts +4 -1
  195. package/dist/core/runner/prepare-prompt-inputs.js +3 -2
  196. package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
  197. package/dist/core/runner/prepare-protocol-tools.js +9 -2
  198. package/dist/core/runner/prepare-suspend-saga.d.ts +0 -2
  199. package/dist/core/runner/prepare-suspend-saga.js +5 -7
  200. package/dist/core/runner/prepare-task.js +41 -27
  201. package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
  202. package/dist/core/runner/prepare-turn-wiring.js +7 -2
  203. package/dist/core/runner/prepare-wiring-manifest.d.ts +4 -3
  204. package/dist/core/runner/prepare-wiring-manifest.js +32 -18
  205. package/dist/core/runner/prepare-workspace-restore.js +3 -3
  206. package/dist/core/runner/resume-checkpoint-screen.js +4 -4
  207. package/dist/core/runner/retired-runner-deps.js +4 -1
  208. package/dist/core/runner/run-attachment-seats.js +3 -3
  209. package/dist/core/runner/run-brain-sinks.js +1 -0
  210. package/dist/core/runner/run-git-lane.d.ts +3 -1
  211. package/dist/core/runner/run-git-lane.js +1 -1
  212. package/dist/core/runner/run-harness-handlers.d.ts +3 -1
  213. package/dist/core/runner/run-harness-handlers.js +3 -1
  214. package/dist/core/runner/run-identity-wiring.js +1 -1
  215. package/dist/core/runner/run-leg.js +26 -28
  216. package/dist/core/runner/run-notification-lane.d.ts +3 -1
  217. package/dist/core/runner/run-notification-lane.js +16 -10
  218. package/dist/core/runner/run-settle-and-teardown.js +5 -1
  219. package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
  220. package/dist/core/runner/run-stop-and-final-verify.js +12 -4
  221. package/dist/core/runner/run-turn-boundary.js +12 -7
  222. package/dist/core/runner/runtask.d.ts +7 -4
  223. package/dist/core/runner/runtask.js +19 -11
  224. package/dist/core/runner/skills-seat.js +2 -2
  225. package/dist/core/runner/sub-agent-deny-lists.js +10 -7
  226. package/dist/core/runner/synthetic-tools.js +2 -2
  227. package/dist/core/runner/tool-disclosure.js +0 -2
  228. package/dist/core/runner/tool-face-overlay.d.ts +1 -1
  229. package/dist/core/runner/tool-face-overlay.js +26 -19
  230. package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
  231. package/dist/core/runner/tool-result-media-seat.js +17 -1
  232. package/dist/core/runner/turn-attachments.d.ts +3 -5
  233. package/dist/core/runner/turn-attachments.js +3 -16
  234. package/dist/core/runner-deps.d.ts +31 -18
  235. package/dist/core/secret-env.d.ts +3 -2
  236. package/dist/core/session-policy-store.d.ts +9 -2
  237. package/dist/core/session-policy-store.js +16 -1
  238. package/dist/core/session-store.d.ts +3 -2
  239. package/dist/core/session-store.js +50 -11
  240. package/dist/core/skill-grant.d.ts +9 -0
  241. package/dist/core/skill-grant.js +18 -0
  242. package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
  243. package/dist/core/store-contracts/tool-result-store-contract.js +37 -0
  244. package/dist/core/stub-env.d.ts +5 -5
  245. package/dist/core/stub-env.js +11 -1
  246. package/dist/core/swappable-deps.d.ts +17 -43
  247. package/dist/core/swappable-deps.js +15 -5
  248. package/dist/core/synthetic-read-verdict.d.ts +1 -1
  249. package/dist/core/task-event.d.ts +18 -2
  250. package/dist/core/task-notification.d.ts +88 -5
  251. package/dist/core/task-notification.js +130 -7
  252. package/dist/core/task-registry-agent.d.ts +18 -12
  253. package/dist/core/task-registry-agent.js +18 -6
  254. package/dist/core/task-registry-monitor.d.ts +7 -0
  255. package/dist/core/task-registry-monitor.js +28 -1
  256. package/dist/core/task-registry-shared.d.ts +38 -3
  257. package/dist/core/task-registry-shared.js +21 -7
  258. package/dist/core/task-registry-workflow.js +1 -1
  259. package/dist/core/task-registry.d.ts +50 -35
  260. package/dist/core/task-registry.js +64 -23
  261. package/dist/core/task-result.d.ts +3 -12
  262. package/dist/core/task-spec.d.ts +3 -6
  263. package/dist/core/task-stream.d.ts +1 -1
  264. package/dist/core/tool-catalog-entries.js +1 -1
  265. package/dist/core/tool-face-reader.d.ts +7 -6
  266. package/dist/core/tool-face-reader.js +4 -3
  267. package/dist/core/tool-name-aliases.d.ts +19 -0
  268. package/dist/core/tool-name-aliases.js +54 -2
  269. package/dist/core/tool-policy.d.ts +5 -4
  270. package/dist/core/tool-policy.js +1 -1
  271. package/dist/core/tool-registry.d.ts +5 -5
  272. package/dist/core/tool-registry.js +2 -2
  273. package/dist/core/tool-result-store.d.ts +88 -5
  274. package/dist/core/tool-result-store.js +51 -12
  275. package/dist/core/tool-spec.d.ts +20 -4
  276. package/dist/core/trace.d.ts +0 -1
  277. package/dist/core/types.d.ts +3 -3
  278. package/dist/core/types.js +1 -1
  279. package/dist/core/untrusted-text.js +1 -1
  280. package/dist/core/user-attachment.d.ts +10 -5
  281. package/dist/core/user-attachment.js +14 -6
  282. package/dist/engine/execution-env/node-execution-env.d.ts +7 -2
  283. package/dist/engine/execution-env/node-execution-env.js +12 -1
  284. package/dist/engine/harness/agent-harness.d.ts +1 -1
  285. package/dist/engine/harness/agent-harness.js +8 -4
  286. package/dist/engine/harness/types.d.ts +112 -29
  287. package/dist/engine/loop/agent-loop.d.ts +12 -12
  288. package/dist/engine/loop/agent-loop.js +153 -21
  289. package/dist/engine/loop/types.d.ts +9 -2
  290. package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
  291. package/dist/engine/lsp/node-lsp-manager.js +32 -13
  292. package/dist/index.d.ts +22 -14
  293. package/dist/index.js +15 -10
  294. package/dist/internal/harness-types.d.ts +1 -1
  295. package/dist/orchestration/run-workflow-tool.d.ts +9 -3
  296. package/dist/orchestration/run-workflow-tool.js +59 -29
  297. package/dist/orchestration/workflow-governance.d.ts +1 -1
  298. package/dist/orchestration/workflow-governance.js +2 -1
  299. package/dist/orchestration/workflow.d.ts +4 -0
  300. package/dist/orchestration/workflow.js +25 -4
  301. package/dist/prompts/default.d.ts +1 -10
  302. package/dist/prompts/default.js +0 -2
  303. package/dist/stores/file/background-agent-store.d.ts +1 -1
  304. package/dist/stores/file/background-agent-store.js +3 -1
  305. package/dist/stores/file/checkpoint-store.d.ts +127 -2
  306. package/dist/stores/file/checkpoint-store.js +19 -14
  307. package/dist/stores/file/file-history-store.d.ts +1 -1
  308. package/dist/stores/file/file-history-store.js +3 -1
  309. package/dist/stores/file/index.d.ts +4 -3
  310. package/dist/stores/file/index.js +17 -8
  311. package/dist/stores/file/mailbox-store.d.ts +1 -1
  312. package/dist/stores/file/mailbox-store.js +3 -1
  313. package/dist/stores/file/memory-store.d.ts +1 -1
  314. package/dist/stores/file/memory-store.js +3 -1
  315. package/dist/stores/file/session-policy-store.d.ts +1 -1
  316. package/dist/stores/file/session-policy-store.js +3 -1
  317. package/dist/stores/file/session-store.d.ts +1 -1
  318. package/dist/stores/file/session-store.js +3 -1
  319. package/dist/stores/file/shared-ledger.d.ts +26 -0
  320. package/dist/stores/file/shared-ledger.js +38 -9
  321. package/dist/stores/file/tool-result-store.d.ts +20 -2
  322. package/dist/stores/file/tool-result-store.js +74 -6
  323. package/dist/stores/file/usage-window-store.d.ts +1 -1
  324. package/dist/stores/file/usage-window-store.js +3 -1
  325. package/dist/stores/file/workflow-journal-store.d.ts +1 -11
  326. package/dist/stores/file/workflow-journal-store.js +3 -2
  327. package/dist/tools/fs/containment-face.d.ts +5 -0
  328. package/dist/tools/fs/encoding.d.ts +13 -4
  329. package/dist/tools/fs/encoding.js +17 -2
  330. package/dist/tools/fs/fs-bash-background-text.d.ts +7 -0
  331. package/dist/tools/fs/fs-bash-background-text.js +1 -0
  332. package/dist/tools/fs/fs-bash.d.ts +8 -4
  333. package/dist/tools/fs/fs-bash.js +26 -35
  334. package/dist/tools/fs/fs-pdf.d.ts +2 -2
  335. package/dist/tools/fs/fs-pdf.js +26 -21
  336. package/dist/tools/fs/fs-read.d.ts +5 -4
  337. package/dist/tools/fs/fs-read.js +35 -18
  338. package/dist/tools/fs/fs-search-tools.js +4 -1
  339. package/dist/tools/fs/fs-shared.d.ts +11 -13
  340. package/dist/tools/fs/fs-shared.js +11 -7
  341. package/dist/tools/fs/fs-write.js +5 -5
  342. package/dist/tools/fs/index.d.ts +14 -8
  343. package/dist/tools/fs/index.js +8 -4
  344. package/dist/tools/fs/read-floor.d.ts +44 -1
  345. package/dist/tools/fs/read-floor.js +35 -0
  346. package/dist/tools/fs/removal-targets.d.ts +9 -4
  347. package/dist/tools/fs/removal-targets.js +17 -9
  348. package/dist/tools/fs/search.d.ts +3 -3
  349. package/dist/tools/fs/search.js +4 -4
  350. package/dist/tools/monitor.d.ts +5 -4
  351. package/dist/tools/monitor.js +15 -8
  352. package/dist/tools/scheduler-tools.js +42 -4
  353. package/dist/tools/web.d.ts +0 -10
  354. package/dist/tools/web.js +1 -4
  355. package/package.json +4 -2
  356. package/test/export-surface.snapshot.json +75 -21
  357. package/wire-changes/core-stores-sql@7.60.0.json +30 -0
  358. package/wire-changes/core@7.60.0.json +3274 -0
  359. package/wire-changes/mods-kernel@7.60.0.json +62 -0
  360. package/wire-changes/primitives@7.60.0.json +30 -0
@@ -1,4 +1,11 @@
1
1
  import type { AgentDefinition } from "../core/types.js";
2
+ /**
3
+ * A definition as the engine receives it — where it is handed to the delegation tool and where a task carries it: its two tool-name
4
+ * lists replaced by their one copy (the copy every later reader takes instead of the host's container), and its MCP server declarations
5
+ * by the copy the door that judges `TaskSpec.mcp` makes of them ({@link snapshotAndValidateMcpEntries}) — a declaration that door refuses
6
+ * is refused here, by the same code and sentence.
7
+ */
8
+ export declare function snapshotDefinitionLists(def: AgentDefinition): AgentDefinition;
2
9
  /**
3
10
  * Validate + freeze a declarative sub-agent definition (design/38 1B). A thin, fail-fast factory: it
4
11
  * checks the only hard requirement (a non-empty `name`) and returns a shallow-frozen copy so a stored
@@ -1,3 +1,15 @@
1
+ import { snapshotToolNameList } from "../core/tool-name-list.js";
2
+ import { snapshotAndValidateMcpEntries } from "../core/locked-config.js";
3
+ export function snapshotDefinitionLists(def) {
4
+ const copy = { ...def };
5
+ if (copy.allowTools !== undefined)
6
+ copy.allowTools = snapshotToolNameList(copy.allowTools);
7
+ if (copy.denyTools !== undefined)
8
+ copy.denyTools = snapshotToolNameList(copy.denyTools);
9
+ if (copy.mcp !== undefined)
10
+ copy.mcp = snapshotAndValidateMcpEntries(copy.mcp, `AgentDefinition.mcp of ${typeof copy.name === "string" ? JSON.stringify(copy.name.slice(0, 80)) : "an unnamed definition"}`);
11
+ return copy;
12
+ }
1
13
  export function defineAgent(def) {
2
14
  if (!def.name || !def.name.trim()) {
3
15
  const e = new Error("defineAgent: `name` is required and must be a non-empty string.");
@@ -33,7 +33,8 @@ export interface AgentTranscriptToolOptions {
33
33
  enrichCtx?: import("../core/tools.js").ToolCtxEnricher;
34
34
  /** Subagent transcript persistence — the declared-durability integrity-gap disclosure sink (see
35
35
  * the SendMessage twin): a durable row with a bound sessionId whose session store attests
36
- * not_found. Announced once per (handle, process); absent ⇒ the honest per-call degrade alone. */
36
+ * not_found, on a mount whose transcript tier declares transcript durability (`full`). Announced once
37
+ * per (handle, process); absent ⇒ the honest per-call degrade alone. */
37
38
  onTranscriptIntegrityGap?: (handle: string, scope: string | undefined) => void;
38
39
  /** The run's checkpoint seat — where a PARKED agent's approval card is read from for the state line
39
40
  * (the same seat the Agent tool parks children into). Absent ⇒ the ctx seat
@@ -1,6 +1,7 @@
1
1
  import { Type } from "typebox";
2
2
  import { defineTool } from "../core/tools.js";
3
3
  import { announceTranscriptIntegrityGapOnce, canAccessAgentRecord } from "../core/background-agent-store.js";
4
+ import { resolveSubagentTranscriptTier } from "../core/wiring-manifest.js";
4
5
  import { DURABLE_AGENT_HANDLE_RE } from "../core/task-registry.js";
5
6
  import { inlineUntrusted } from "../core/untrusted-text.js";
6
7
  import { stepsFromMessages } from "./subagent-steps.js";
@@ -22,6 +23,7 @@ function renderSteps(steps, readAt) {
22
23
  }
23
24
  const clipStateHeader = (state) => `State: ${agentStateSummary(state).slice(0, REPORT_FIELD_MAX)}\n`;
24
25
  export function createAgentTranscriptTool(opts) {
26
+ const transcriptTier = resolveSubagentTranscriptTier(opts.agentStore !== undefined, opts.runner.sessions);
25
27
  return defineTool({
26
28
  name: AGENT_TRANSCRIPT_TOOL_NAME,
27
29
  ...toolFace("agent-transcript"),
@@ -77,7 +79,7 @@ export function createAgentTranscriptTool(opts) {
77
79
  }
78
80
  catch (e) {
79
81
  if (e?.code === "not_found") {
80
- announceTranscriptIntegrityGapOnce(id, access.scope, opts.onTranscriptIntegrityGap);
82
+ announceTranscriptIntegrityGapOnce(id, access.scope, opts.onTranscriptIntegrityGap, transcriptTier);
81
83
  }
82
84
  return live === undefined ? await transcriptGone(recordSource) : undefined;
83
85
  }
@@ -1,4 +1,4 @@
1
- import { resolveModel, resolveTaskModel, unheldSeatWord } from "../core/roles.js";
1
+ import { receiveRoleMap, resolveModel, resolveTaskModel, unheldSeatWord } from "../core/roles.js";
2
2
  export function runnerRoleMap(runner) {
3
3
  try {
4
4
  return runner?.agentCatalog?.roles;
@@ -38,9 +38,12 @@ export function childThinkingSeat(explicit, deploymentStated, parent) {
38
38
  return level !== undefined ? { thinking: level } : {};
39
39
  }
40
40
  export function deploymentSubagentTierModel(deps) {
41
- if (deps === undefined || !deploymentStatesSubagentModel(deps.roles, deps.models))
41
+ if (deps === undefined)
42
42
  return undefined;
43
- const resolved = resolveTaskModel({ modelRole: "subagent" }, deps);
43
+ const roles = receiveRoleMap(deps.roles, "RunnerDeps.roles");
44
+ if (!deploymentStatesSubagentModel(roles, deps.models))
45
+ return undefined;
46
+ const resolved = resolveTaskModel({ modelRole: "subagent" }, { models: deps.models, roles });
44
47
  return { model: resolved.model, ...(inheritableRef(resolved.modelRef, resolved.model, deps.models) !== undefined ? { modelRef: resolved.modelRef } : {}) };
45
48
  }
46
49
  export function inheritedParentModel(parent, catalog) {
@@ -19,7 +19,6 @@ export function buildCumulativeStats(base, acc) {
19
19
  : {
20
20
  llmRootMicroUsd: acc.llmRootMicroUsd,
21
21
  nestedSubagentMicroUsd: acc.nested.costMicroUsd,
22
- memoryConsolidationMicroUsd: 0,
23
22
  compactionMicroUsd: acc.compactionMicroUsd,
24
23
  ...(acc.sideCallMicroUsd !== undefined ? { sideCallMicroUsd: acc.sideCallMicroUsd } : {}),
25
24
  },
@@ -1,6 +1,8 @@
1
- import type { McpServerSpec, ToolSpec } from "../core/types.js";
1
+ import type { AgentDefinition, McpServerSpec, ToolSpec } from "../core/types.js";
2
2
  import type { ToolSelector } from "../core/tool-face.js";
3
3
  import type { MountedMcp } from "../core/mounted-mcp.js";
4
+ import type { McpHostSeat } from "../core/mcp-host-seat.js";
5
+ import type { RunInternals } from "../core/runner/contracts.js";
4
6
  /**
5
7
  * What a delegated child inherits when its delegation tool has no explicit pool (`SubagentToolOptions.inheritedTools`):
6
8
  * the parent surface, narrowed at spawn by two laws, and the parent's MCP declarations. The mint of the parent bound
@@ -30,3 +32,26 @@ export declare function inheritedChildPool(surface: readonly ToolSpec[], mountsC
30
32
  * the server's tools mount.
31
33
  */
32
34
  export declare function inheritedMcpDeclarations(mounted: MountedMcp, selector: ToolSelector): McpServerSpec[];
35
+ /** The host seats a child is handed: of `held` (the seats of the run that spawns or wakes it — `MountedMcp.hostSeats`), those of the
36
+ * host-transport servers among the child's declarations (`servers`), as the child's internals carry them — none ⇒ no member, so such a server
37
+ * of the child fails its dial like any declaration without a seat. */
38
+ export declare function inheritedHostSeats(held: ReadonlyMap<string, McpHostSeat> | undefined, servers: ReadonlyArray<McpServerSpec>): Pick<RunInternals, "mcpHostSeats">;
39
+ /** A child's internals as a retained snapshot keeps them: without host seats — they are live objects of the run that held them, and each wake
40
+ * hands the waker's own ({@link inheritedHostSeats} over the waker's mount). */
41
+ export declare function withoutHostSeats(internals: RunInternals): RunInternals;
42
+ /**
43
+ * The MCP servers a leg spawned as an agent definition is declared ({@link AgentDefinition.mcp}): the servers its lane hands it (the
44
+ * spawning run's it inherits, a workflow child's governed spec's) first, then each of the definition's own whose tool namespace none of
45
+ * those holds — a run holds one server per namespace, and a name the lane already declares for the leg names the lane's server. Every
46
+ * entry as declared; two of the definition's own under one namespace both stay, so the leg's mount refuses them as it refuses a task's
47
+ * own pair (`config.mcp_server_name_collision`). Which of their tools mount is the leg's own selector's question at its prepare.
48
+ */
49
+ export declare function withDefinitionServers<S extends {
50
+ readonly name: string;
51
+ }>(handed: readonly S[] | undefined, own: readonly S[] | undefined): S[];
52
+ /**
53
+ * A definition's own allowed-tools list as its leg's selector reads it: the list it wrote, extended by every tool of each MCP server it
54
+ * declares (`mcp__<server>__*`) — the servers an agent brings are its own whatever its list names, and its denied list still wins over them.
55
+ * No list (absent or `null`) stays no list.
56
+ */
57
+ export declare function definitionAllowTools(def: Pick<AgentDefinition, "allowTools" | "mcp">): string[] | undefined;
@@ -1,3 +1,4 @@
1
+ import { transportKindOf } from "../core/mcp-server-spec.js";
1
2
  import { mintNamespacePrefix } from "../core/protocol-naming.js";
2
3
  import { MCP_NAMESPACE } from "../core/protocol-table.js";
3
4
  import { TASK_CREATE_TOOL_NAME, TASK_GET_TOOL_NAME, TASK_LIST_TOOL_NAME, TASK_UPDATE_TOOL_NAME } from "../core/tool-catalog-entries.js";
@@ -14,3 +15,24 @@ export function inheritedChildPool(surface, mountsCallerTool, anonymousBackgroun
14
15
  export function inheritedMcpDeclarations(mounted, selector) {
15
16
  return mounted.servers.filter((m) => selector.admitsPeer(mintNamespacePrefix(MCP_NAMESPACE, m.server.name))).map((m) => m.server);
16
17
  }
18
+ export function inheritedHostSeats(held, servers) {
19
+ const seats = servers.flatMap((s) => {
20
+ const seat = transportKindOf(s) === "host" ? held?.get(s.name) : undefined;
21
+ return seat !== undefined ? [[s.name, seat]] : [];
22
+ });
23
+ return seats.length > 0 ? { mcpHostSeats: new Map(seats) } : {};
24
+ }
25
+ export function withoutHostSeats(internals) {
26
+ const { mcpHostSeats: _live, ...kept } = internals;
27
+ return kept;
28
+ }
29
+ export function withDefinitionServers(handed, own) {
30
+ const held = new Set((handed ?? []).map((s) => mintNamespacePrefix(MCP_NAMESPACE, s.name)));
31
+ return [...(handed ?? []), ...(own ?? []).filter((s) => !held.has(mintNamespacePrefix(MCP_NAMESPACE, s.name)))];
32
+ }
33
+ export function definitionAllowTools(def) {
34
+ const written = def.allowTools ?? undefined;
35
+ if (!Array.isArray(written) || def.mcp === undefined || def.mcp.length === 0)
36
+ return written;
37
+ return [...written, ...def.mcp.map((s) => `${mintNamespacePrefix(MCP_NAMESPACE, s.name)}*`)];
38
+ }
@@ -1,7 +1,12 @@
1
1
  import type { RunInternals, RunnerSelfSeat } from "../core/runner/contracts.js";
2
2
  import type { TaskSpec } from "../core/types.js";
3
+ import type { PeerDeclarationHold, PeerDeclarations } from "../core/peer-seat.js";
3
4
  /** design/122 D2 — per-child resume cap (default 8): a child can be revived at most this many times. */
4
5
  export declare const SUBAGENT_RESUME_CAP = 8;
6
+ /** The one read of a seat's `holdDeclarations` — both retention registrations take their hold here. The member is required, so a typed host
7
+ * is stopped by the compiler; a seat built by hand without it (untyped, cast) is refused by name, where the bare call was a TypeError
8
+ * from the middle of a delegation. */
9
+ export declare function holdChildDeclarations(runner: RunnerSelfSeat, declared: PeerDeclarations): PeerDeclarationHold;
5
10
  /**
6
11
  * design/122 D1 — one RETAINED child ledger row. `specSnapshot` is a FROZEN plain value-copy of the spawn
7
12
  * childSpec (r1-m5: retaining the live `ctx`/spec-builder closures would pin the parent run's whole prepare
@@ -33,6 +38,10 @@ export interface SubagentRetainEntry {
33
38
  * Expiry (lazy sweep + active timer) uses this when present, the ledger default otherwise. */
34
39
  ttlMs?: number;
35
40
  specSnapshot: Readonly<TaskSpec>;
41
+ /** The entry's hold on the references `specSnapshot`'s declarations name, on the seat the runner that revives it asks
42
+ * (`RunnerSelfSeat.holdDeclarations`): handed to {@link SubagentRetainLedger.register}, which owns it from then on — kept while the
43
+ * row is in the ledger, released the moment the row leaves it (or at once when the row is not taken). */
44
+ declarations: PeerDeclarationHold;
36
45
  internalsSnapshot: RunInternals;
37
46
  /** True while the initial run OR a resume run is in flight (resume re-entry rejects `steering.still_running`). */
38
47
  running: boolean;
@@ -168,7 +177,8 @@ export declare class SubagentRetainLedger {
168
177
  sweepExpired(now?: number): void;
169
178
  /** Register a child at SPAWN (running until `markSettled`). Over `max`: the oldest settled idle entry is
170
179
  * evicted (unpin+release); when every slot is still running, the NEW child is NOT retained (tombstoned →
171
- * its resume rejects `resume.evicted`) and `undefined` is returned — the caller falls back to throwaway. */
180
+ * its resume rejects `resume.evicted`) and `undefined` is returned — the caller falls back to throwaway.
181
+ * The entry's `declarations` hold is the ledger's from this call on: a row not taken releases it here. */
172
182
  register(parentToolCallId: string, entry: Omit<SubagentRetainEntry, "running" | "settled" | "settledAt" | "resumeCount" | "cycleSeq" | "activeAbort" | "deferredNotify">): SubagentRetainEntry | undefined;
173
183
  /** Flip a child to settled (idle, resumable) — called when the initial run's stream drains.
174
184
  * fidelity R4-1: also (re-)arms the entry's own TTL timer, so the retain window expires by TIME,
@@ -4,6 +4,14 @@ import { createSafeNotifier } from "../core/safe-notify.js";
4
4
  import { RETAIN_DEFAULT_TTL_MS, RETAIN_DEFAULT_MAX } from "../config/defaults.js";
5
5
  import { asThrownError } from "../core/thrown-value.js";
6
6
  export const SUBAGENT_RESUME_CAP = 8;
7
+ export function holdChildDeclarations(runner, declared) {
8
+ if (typeof runner.holdDeclarations !== "function") {
9
+ throw Object.assign(new Error("the runner seat this tool runs children on has no `holdDeclarations` function — a seat built by hand forwards `holdDeclarations(declared)` to the Runner it stands for, or the Runner itself is handed in"), {
10
+ code: "config.invalid_argument",
11
+ });
12
+ }
13
+ return runner.holdDeclarations(declared);
14
+ }
7
15
  export class SubagentRetainLedger {
8
16
  ttlMs;
9
17
  max;
@@ -77,7 +85,7 @@ export class SubagentRetainLedger {
77
85
  }
78
86
  register(parentToolCallId, entry) {
79
87
  if (this.isDisposed)
80
- return undefined;
88
+ return void entry.declarations.release();
81
89
  this.sweepExpired();
82
90
  if (this.entries.size >= this.max) {
83
91
  let oldest;
@@ -90,11 +98,12 @@ export class SubagentRetainLedger {
90
98
  }
91
99
  if (oldest === undefined) {
92
100
  this.tombstone(parentToolCallId);
93
- return undefined;
101
+ return void entry.declarations.release();
94
102
  }
95
103
  this.evictDetached(oldest, "lru_overflow");
96
104
  }
97
105
  const full = { ...entry, running: true, settled: false, settledAt: Date.now(), resumeCount: 0, cycleSeq: 1 };
106
+ this.entries.get(parentToolCallId)?.declarations.release();
98
107
  this.entries.set(parentToolCallId, full);
99
108
  return full;
100
109
  }
@@ -151,6 +160,7 @@ export class SubagentRetainLedger {
151
160
  abandon(parentToolCallId) {
152
161
  const e = this.entries.get(parentToolCallId);
153
162
  if (e !== undefined && this.entries.delete(parentToolCallId)) {
163
+ e.declarations.release();
154
164
  this.clearTtlTimer(parentToolCallId);
155
165
  this.flushDeferredNotify(e);
156
166
  this.tombstone(parentToolCallId);
@@ -161,6 +171,7 @@ export class SubagentRetainLedger {
161
171
  if (!e)
162
172
  return;
163
173
  this.entries.delete(parentToolCallId);
174
+ e.declarations.release();
164
175
  this.clearTtlTimer(parentToolCallId);
165
176
  this.flushDeferredNotify(e);
166
177
  this.tombstone(parentToolCallId);
@@ -144,7 +144,7 @@ export declare class FileRosterStore implements RosterStore {
144
144
  private readonly maxAgeMs;
145
145
  private readonly gc;
146
146
  private readonly onCorruptRead;
147
- constructor(path: string, opts?: RosterGcOptions & {
147
+ constructor(path: string, options?: RosterGcOptions & {
148
148
  onCorruptRead?: (info: CorruptReadInfo) => void;
149
149
  });
150
150
  /** RB-482 #25 (baggage class-4 ruling): the LENIENT read grade's swallow stays (a store fault must read as a
@@ -1,5 +1,6 @@
1
1
  import { mkdirSync, readFileSync } from "node:fs";
2
2
  import { assertRetentionPolicy } from "../core/retention-policy.js";
3
+ import { receiveOptions } from "../core/own-property-receipt.js";
3
4
  import { atomicWriteFile } from "../stores/file/fs-atomic.js";
4
5
  import { dirname } from "node:path";
5
6
  import { normalizeAgentName } from "../core/task-registry.js";
@@ -79,7 +80,8 @@ export class FileRosterStore {
79
80
  maxAgeMs;
80
81
  gc;
81
82
  onCorruptRead;
82
- constructor(path, opts) {
83
+ constructor(path, options) {
84
+ const opts = options === undefined ? undefined : receiveOptions(options, "FileRosterStore");
83
85
  assertRetentionPolicy("RosterStore", opts);
84
86
  this.path = path;
85
87
  this.maxAgeMs = opts?.maxAgeMs;
@@ -37,30 +37,17 @@ export interface SendMessageToolOptions {
37
37
  notify?: (n: TaskNotificationPayload, opts?: {
38
38
  priority?: "now" | "next" | "later";
39
39
  }) => void;
40
+ /** The sending run's result store, the pair of {@link notify}: a continued agent's cut completion is stored where that
41
+ * run's `ReadToolResult` reads. Absent ⇒ the cut says the full text is not readable from this session. */
42
+ taskArtifacts?: import("../core/tool-result-store.js").TaskArtifactSeat;
40
43
  /** Whether a completion notification really reaches the sender — drives every "you will be notified"
41
44
  * sentence on this face (description + four receipts), mirroring TaskOutput's `notificationWired`.
42
45
  * Default = `notify !== undefined`, which is the truth on both the first-party mount and a direct
43
46
  * mount that wires its own sink here. Pass `true` only when the deployment announces a finished
44
47
  * agent through a channel of its own (this tool then keeps the wired wording); `false` states the
45
- * degraded truth explicitly. */
48
+ * degraded truth explicitly. A one-shot submission needs no wording of its own: its ending waits for a continued
49
+ * agent's completion, owed to the lane `notify` delivers into (`DeliveryObligations`). */
46
50
  notificationWired?: boolean;
47
- /** RB-220 mirror of {@link import("../core/types.js").TaskSpec.oneShot} (the Runner mount fills it):
48
- * this run's process exits when the turn ends, so no completion notification can ever land — checked
49
- * AHEAD of {@link notificationWired}, since no amount of wiring makes a later turn exist. */
50
- oneShot?: boolean;
51
- /**
52
- * Whether a RETRIEVAL tool (`TaskOutput`) is mounted beside this tool on the same face. Every
53
- * degraded completion promise on this face (the one-shot and silent arms of the description and
54
- * the receipt/refusal texts) tells the model how to collect a continued agent's result; naming
55
- * `TaskOutput(task_id, block: true)` as an imperative is only true where that tool exists. Since
56
- * design/385 §1.5 this tool also mounts on the delegated-child arm WITHOUT the background door
57
- * TaskOutput/TaskStop keep, so the two can no longer be assumed to travel together. Three states:
58
- * `true` — the advice names TaskOutput plainly; `false` — this face has no retrieval tool, and the
59
- * advice says the result cannot be collected by this run instead of naming a tool the model cannot
60
- * call (an unknown-tool error on a one-shot run is the turn where the result is lost); absent — the
61
- * mount did not say, and the advice is hedged ("where that tool is mounted").
62
- */
63
- retrievalToolMounted?: boolean;
64
51
  /** Steer-handle sink: the revived run re-emits a FRESH handle (design/122 risk-table contract). */
65
52
  sink?: (handle: SubagentSteerHandle) => void;
66
53
  /**
@@ -178,7 +165,9 @@ export interface SendMessageToolOptions {
178
165
  /**
179
166
  * Subagent transcript persistence — the "declared durability contradicted by reality" disclosure
180
167
  * sink: called (at most once per (scope, handle) per process, {@link announceTranscriptIntegrityGapOnce})
181
- * when a durable row with a bound sessionId meets a session store that attests `not_found`. The
168
+ * when a durable row with a bound sessionId meets a session store that attests `not_found` AND the
169
+ * mount's transcript tier declares transcript durability (`full`; under `rows` a gone transcript is the
170
+ * declared fate and the sink is not called). The
182
171
  * first-party mount wires an EngineNotice (`delegation.transcript_integrity`); absent ⇒ the
183
172
  * per-call honest refusal is the only loudness (unchanged behavior).
184
173
  */
@@ -102,36 +102,13 @@ export function createSendMessageTool(opts) {
102
102
  const sendMessageParameters = peerLane.active
103
103
  ? Type.Object({ ...baseParameters.properties, message: Type.Optional(Type.String({ description: `${baseParameters.properties.message.description ?? ""} Optional only for a pure notify_when_idle subscription.`.trim() })), ...notifyWhenIdleParameter })
104
104
  : baseParameters;
105
- const retrievalMounted = opts.retrievalToolMounted;
106
- const retrievalHedge = retrievalMounted === undefined ? " (where that tool is mounted)" : "";
107
- const RETRIEVE_NOW = retrievalMounted === false
108
- ? "its result cannot be collected by this run (no TaskOutput is mounted beside this tool) — do not wait for it, and say so in your answer if the result matters"
109
- : `retrieve its result NOW with TaskOutput(task_id, block: true)${retrievalHedge} rather than ending your turn`;
110
- const RETRIEVE_LATER = retrievalMounted === false
111
- ? "its result cannot be collected by this run (no TaskOutput is mounted beside this tool)"
112
- : "retrieve its status and result with TaskOutput(task_id) where mounted";
113
- const WAIT_NOW = retrievalMounted === false
114
- ? "do not wait for it — this face has no TaskOutput to block on, and"
115
- : `wait for it NOW with TaskOutput(task_id, block: true)${retrievalHedge} —`;
116
- const CHECK_LATER = retrievalMounted === false
117
- ? "its completion cannot be checked from this face (no TaskOutput is mounted beside this tool)"
118
- : "check for its completion with TaskOutput(task_id) where mounted";
105
+ const RETRIEVE_LATER = "retrieve its status and result with TaskOutput(task_id) where mounted";
106
+ const CHECK_LATER = "check for its completion with TaskOutput(task_id) where mounted";
119
107
  const capitalize = (text) => `${text.charAt(0).toUpperCase()}${text.slice(1)}`;
120
- const completionMode = opts.oneShot === true ? "one_shot" : (opts.notificationWired ?? opts.notify !== undefined) ? "notified" : "silent";
121
- const notifyWired = completionMode === "notified";
122
- const NO_COMPLETION_NOTICE = completionMode === "one_shot"
123
- ? `this is a ONE-SHOT submission — there is no later turn for a completion notification to land in, so ${RETRIEVE_NOW}`
124
- : `its completion is NOT announced on this mount — ${RETRIEVE_LATER}`;
125
- const AWAIT_COMPLETION = notifyWired
126
- ? "Wait for its completion notification"
127
- : completionMode === "one_shot"
128
- ? `${capitalize(WAIT_NOW)} this one-shot submission ends with this turn`
129
- : capitalize(CHECK_LATER);
130
- const awaitCompletion = notifyWired
131
- ? "wait for its completion notification"
132
- : completionMode === "one_shot"
133
- ? `${WAIT_NOW} this one-shot submission ends with this turn`
134
- : CHECK_LATER;
108
+ const notifyWired = opts.notificationWired ?? opts.notify !== undefined;
109
+ const NO_COMPLETION_NOTICE = `its completion is NOT announced on this mount — ${RETRIEVE_LATER}`;
110
+ const AWAIT_COMPLETION = notifyWired ? "Wait for its completion notification" : capitalize(CHECK_LATER);
111
+ const awaitCompletion = notifyWired ? "wait for its completion notification" : CHECK_LATER;
135
112
  const sendMessagePins = new Map();
136
113
  const pinGuard = (targetId, targetName, rung, to) => {
137
114
  if (rung === "other")
@@ -175,13 +152,7 @@ export function createSendMessageTool(opts) {
175
152
  `send is refused rather than silently redirected — re-send with the task_id of whichever agent you meant. ` +
176
153
  (notifyWired
177
154
  ? `You will be notified automatically when it completes — prefer ending your turn; do not poll. `
178
- : completionMode === "one_shot"
179
- ? `This is a ONE-SHOT submission: there is no later turn for a completion notification to land in, so do NOT end your turn expecting one${retrievalMounted === false
180
- ? "; a continued agent's result cannot be collected by this run (no TaskOutput is mounted beside this tool) — say so if the result matters"
181
- : ` — wait actively with TaskOutput(task_id, block: true)${retrievalHedge} when you need a continued agent's result`}. `
182
- : `A finished agent is NOT announced on this mount${retrievalMounted === false
183
- ? ", and its result cannot be collected by this run (no TaskOutput is mounted beside this tool) — do not end your turn to wait for a notification that never comes"
184
- : " — check on it with TaskOutput(task_id) where mounted rather than ending your turn to wait for a notification that never comes"}. `) +
155
+ : `A finished agent is NOT announced on this mount — check on it with TaskOutput(task_id) where mounted rather than ending your turn to wait for a notification that never comes. `) +
185
156
  (continuationTier === "full"
186
157
  ? `Continuing a finished agent works for agents with a durable record — by name or task_id, even across restarts — and for runs that retain sub-agent sessions; when neither covers it you get an honest error and should launch a new agent with the needed context instead.`
187
158
  : continuationTier === "rows"
@@ -637,7 +608,7 @@ export function createSendMessageTool(opts) {
637
608
  catch (e) {
638
609
  await rollbackDrain();
639
610
  if (e?.code === "not_found") {
640
- announceTranscriptIntegrityGapOnce(handle, scope, opts.onTranscriptIntegrityGap);
611
+ announceTranscriptIntegrityGapOnce(handle, scope, opts.onTranscriptIntegrityGap, continuationTier);
641
612
  return queueFullReceipt(`No transcript found for agent ${handle}, so a revival cannot drain the backlog.`);
642
613
  }
643
614
  return queueFullReceipt(`Its transcript store did not answer (${thrownText(e)}) — this send did not start a backlog drain; a later resend will try again.`);
@@ -736,7 +707,7 @@ export function createSendMessageTool(opts) {
736
707
  catch (e) {
737
708
  await rollback();
738
709
  if (e?.code === "not_found") {
739
- announceTranscriptIntegrityGapOnce(handle, scope, opts.onTranscriptIntegrityGap);
710
+ announceTranscriptIntegrityGapOnce(handle, scope, opts.onTranscriptIntegrityGap, continuationTier);
740
711
  return {
741
712
  content: `Message not sent: no transcript found for agent ${handle} — it cannot be revived. Launch a new agent with the needed context instead.`,
742
713
  details: { error: "resume.session_not_found", to },
@@ -1075,9 +1046,11 @@ export function createSendMessageTool(opts) {
1075
1046
  ...(row.createdAt !== undefined ? { rowSpawnedAt: row.createdAt } : {}),
1076
1047
  ...(opts.onNotifyError !== undefined ? { onNotifyError: opts.onNotifyError } : {}),
1077
1048
  ...(opts.notify ? { currentParentNotify: opts.notify } : {}),
1049
+ ...(opts.taskArtifacts !== undefined ? { currentTaskArtifacts: opts.taskArtifacts } : {}),
1078
1050
  ...(ctx.onQuestion !== undefined && row.sessionScoped !== true ? { currentOnQuestion: ctx.onQuestion } : {}),
1079
1051
  currentClamps: clampValuesOf(ctx, ctx.parentSpecSeat),
1080
1052
  ...(ctx.autoModeReview !== undefined ? { currentAutoModeReview: ctx.autoModeReview } : {}),
1053
+ currentMcpHostSeats: ctx.mountedMcp?.().hostSeats,
1081
1054
  });
1082
1055
  const fromPrefix = senderIsChild ? `(message from teammate "${senderLabel}")\n` : "";
1083
1056
  try {
@@ -397,6 +397,9 @@ export declare function createSubagentResume(deps: {
397
397
  currentParentNotify?: (n: TaskNotificationPayload, opts?: {
398
398
  priority?: "now" | "next" | "later";
399
399
  }) => void;
400
+ /** The RESUMING caller's result store, the pair of `currentParentNotify`: a cut completion is stored where the run that
401
+ * hears it reads (its `ToolExecuteContext.taskArtifacts`). Absent ⇒ the cut says the full text is not readable here. */
402
+ currentTaskArtifacts?: import("../core/tool-result-store.js").TaskArtifactSeat;
400
403
  /** The RESUMING caller's live content-ask face (its trusted `ToolExecuteContext.onQuestion`), same
401
404
  * reasoning as `currentParentNotify` one line up: the retained snapshot deliberately carries NO
402
405
  * question face (the spawn turn's is stripped at freeze time — a per-request lane is torn down with
@@ -423,6 +426,9 @@ export declare function createSubagentResume(deps: {
423
426
  currentAutoModeReview?: {
424
427
  decider: import("../core/auto-mode.js").AutoModeDecider;
425
428
  };
429
+ /** The RESUMING caller's own host seats (its trusted `ToolExecuteContext.mountedMcp` seats), same turn-bound reasoning: the snapshot keeps
430
+ * none, so the resumed cycle's host-transport servers dial through the waker's seats of their names, or fail their dial without one. */
431
+ currentMcpHostSeats?: ReadonlyMap<string, import("../core/mcp-host-seat.js").McpHostSeat> | undefined;
426
432
  /** design/176 — present iff this resume is PEER-DRIVEN (the SendMessage carrier): the resume
427
433
  * prompt takes the peer-resume trust frame (teammate header + fence label + the per-message
428
434
  * discipline block — never the operator-authority wording), and the woken cycle's inbound peer
@@ -470,6 +476,13 @@ export declare function createSubagentResume(deps: {
470
476
  /** RB-473 batch 2b — bounded disclosure when a deployment sink throws inside this resume closure's
471
477
  * isolation scope (first failure per site; later ones counted only). */
472
478
  onNotifyError?: (failure: import("../core/safe-notify.js").SafeNotifyFailure) => void;
479
+ /** The delegation entry gate the child was SPAWNED under — its tree's concurrency pool. A woken
480
+ * cycle is a running agent like any other, so it occupies that pool for exactly its own life:
481
+ * a cycle that revived its registry row is counted by the row (`registered`), one that runs with
482
+ * no row is charged to the pool's local half (`local`). Occupy only — the cap verdicts stay on the
483
+ * spawn door: CC 2.1.309's resume path calls `takeConcurrencySlot` (cli309.js:288053) with no cap read.
484
+ * Absent ⇒ the waker wakes rows only (SendMessage: every launch it makes revives a row, which counts itself). */
485
+ entryGate?: Pick<DelegationEntryGate, "occupy">;
473
486
  }): (content: string) => Promise<string>;
474
487
  /** Subagent transcript persistence — the RESOLVED delegation entry-caps pair (both members present;
475
488
  * see {@link resolveDelegationEntryCaps}). */
@@ -495,6 +508,36 @@ export declare function delegationEntryLedgerFootprint(registry: object): {
495
508
  keys: number;
496
509
  handles: number;
497
510
  };
511
+ /** A refused entry-cap door: the coded reason plus the lane-neutral half of its prose. Each spawn
512
+ * lane owns its own "Sub-agent not started…" head and its own cleanup obligations (worktree,
513
+ * observer, abort listener, settlement row), which is why the gate hands back the reason instead
514
+ * of the finished envelope. */
515
+ interface DelegationEntryRefusal {
516
+ code: "delegation.concurrency_cap" | "delegation.session_cap";
517
+ text: string;
518
+ }
519
+ /** The gate's synchronous verdict. `release` is the local reservation's giveback (a no-op for the
520
+ * registered kind, whose giveback IS its registry row settling). */
521
+ type DelegationEntryAdmission = {
522
+ admitted: true;
523
+ release: () => void;
524
+ } | {
525
+ admitted: false;
526
+ refusal: DelegationEntryRefusal;
527
+ };
528
+ /** Which half of the running count a started child lives in: `registered` = it has a running registry
529
+ * row (the row IS its count), `local` = it runs with no row and is counted by the pool's in-flight map. */
530
+ type DelegationEntryKind = "registered" | "local";
531
+ /** One opened delegation entry gate (see {@link openDelegationEntryGate}). `occupy` is the pool's ONE
532
+ * reservation — every child that starts running is charged through it; `admit` is the spawn door,
533
+ * the two cap verdicts in front of that same reservation. A resume cycle occupies without the
534
+ * verdicts: waking a retained child counts in its tree's pool but is not refused by a full one. */
535
+ interface DelegationEntryGate {
536
+ key: string | undefined;
537
+ admit: (kind: DelegationEntryKind) => DelegationEntryAdmission;
538
+ /** Reserve this pool's slot for a child of `kind`; returns the idempotent giveback. */
539
+ occupy: (kind: DelegationEntryKind) => () => void;
540
+ }
498
541
  /**
499
542
  * Options for {@link createSubagentTool}.
500
543
  *
@@ -571,14 +614,14 @@ export interface SubagentToolOptions {
571
614
  * matching the engine chain's `principal ?? "default"`), never implied by omission. */
572
615
  scope: string;
573
616
  /**
574
- * Deployment-level completion-push FALLBACK — not an always-on tap. The settle notification is
617
+ * Deployment-level completion-push FALLBACK for a spawn's settle — not an always-on tap. That settle is
575
618
  * delivered through `ctx.onTaskNotification ?? background.notify`: inside an engine-driven run
576
619
  * the tool-execution context carries the run's own notification injector (the completion lands
577
- * in the PARENT's live injection queue at its next turn boundary), and this sink is then never
578
- * called — one completion, one channel, no double-send. It fires only when the tool is executed
579
- * WITHOUT an engine notification channel (direct `execute()` harnesses, minimal mounts). A
580
- * deployment that wants an unconditional process-level completion tap should use
581
- * `RunnerDeps.onBackgroundChildEvent` (the BCE terminal frame) instead.
620
+ * in the PARENT's live injection queue at its next turn boundary) and this sink is not called for it —
621
+ * one completion, one channel. It fires for a settle only WITHOUT an engine notification channel (direct
622
+ * `execute()` harnesses, minimal mounts). An operator resume (`handle.resume`) is launched by no call of a run, so
623
+ * its completion always goes to this sink, engine-driven or not; absent, it is not delivered. An unconditional
624
+ * process-level completion tap is `RunnerDeps.onBackgroundChildEvent` (the BCE terminal frame).
582
625
  */
583
626
  notify?: (n: import("../core/task-notification.js").TaskNotificationPayload, opts?: {
584
627
  priority?: "now" | "next" | "later";
@@ -852,18 +895,9 @@ export declare function asyncLaunchedReceipt(p: {
852
895
  taskId: string;
853
896
  /** The lane's own "what is running" opener — the Agent lane and the fork lane say different things. */
854
897
  workingLine: string;
855
- /** Whether a real notification sink is wired (the receipt speaks the RUNTIME sink truth). */
898
+ /** Whether a real notification sink is wired (the receipt speaks the RUNTIME sink truth). A one-shot submission needs
899
+ * no wording of its own: its ending waits for the completion its lane is owed (`DeliveryObligations`). */
856
900
  notify: boolean;
857
- /**
858
- * RB-220 — mirrors {@link import("../core/types.js").ToolExecuteContext.oneShot}: this run has no
859
- * later turn for an async background notification to land in (a headless `-p` process exits once
860
- * the turn ends). Checked AHEAD of `notify` below — a one-shot submission is wrong to promise a
861
- * notification regardless of whether a notify sink happens to be wired, the same failure form
862
- * `run_workflow`'s launch note was fixed for (RB-215/run-workflow-tool.ts): a model that follows
863
- * "end your turn and wait" advice in a one-shot process loses the result — the process exits with
864
- * nothing left alive to receive it. Default undefined ⇒ byte-compat (pre-RB-220 wording).
865
- */
866
- oneShot?: boolean;
867
901
  /** Per-call honest notes, rendered one per line between the status line and the closing instruction. */
868
902
  notes?: (string | undefined)[];
869
903
  }): string;