@sema-agent/core 7.59.0 → 7.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (643) hide show
  1. package/CHANGELOG.md +1169 -0
  2. package/README.md +2 -2
  3. package/dist/agents/agent-definition.d.ts +7 -0
  4. package/dist/agents/agent-definition.js +12 -0
  5. package/dist/agents/agent-transcript-tool.d.ts +4 -3
  6. package/dist/agents/agent-transcript-tool.js +4 -2
  7. package/dist/agents/cascade.d.ts +61 -10
  8. package/dist/agents/cascade.js +60 -20
  9. package/dist/agents/child-model-seat.js +6 -3
  10. package/dist/agents/composition-allowance.d.ts +53 -0
  11. package/dist/agents/composition-allowance.js +49 -0
  12. package/dist/agents/composition-placement.d.ts +29 -0
  13. package/dist/agents/composition-placement.js +24 -0
  14. package/dist/agents/cumulative-stats.d.ts +4 -0
  15. package/dist/agents/cumulative-stats.js +3 -1
  16. package/dist/agents/inherited-tool-pool.d.ts +28 -1
  17. package/dist/agents/inherited-tool-pool.js +22 -0
  18. package/dist/agents/list-agents-tool.d.ts +1 -1
  19. package/dist/agents/peer-notice-route.d.ts +1 -1
  20. package/dist/agents/peer-notice-route.js +4 -3
  21. package/dist/agents/peer-notices.d.ts +4 -4
  22. package/dist/agents/peer-notices.js +8 -4
  23. package/dist/agents/peer-session-drain.d.ts +8 -1
  24. package/dist/agents/peer-session-drain.js +36 -7
  25. package/dist/agents/repair-loop.js +16 -6
  26. package/dist/agents/retain-ledger.d.ts +11 -1
  27. package/dist/agents/retain-ledger.js +16 -3
  28. package/dist/agents/roster-store.d.ts +2 -2
  29. package/dist/agents/roster-store.js +8 -3
  30. package/dist/agents/send-message-tool.d.ts +14 -27
  31. package/dist/agents/send-message-tool.js +47 -54
  32. package/dist/agents/subagent-completion-gate.d.ts +35 -0
  33. package/dist/agents/subagent-completion-gate.js +62 -0
  34. package/dist/agents/subagent-steps.d.ts +7 -6
  35. package/dist/agents/subagent.d.ts +52 -28
  36. package/dist/agents/subagent.js +276 -246
  37. package/dist/agents/suspend-guard.d.ts +9 -0
  38. package/dist/agents/suspend-guard.js +4 -0
  39. package/dist/agents/tool-filter.d.ts +1 -3
  40. package/dist/agents/tool-filter.js +4 -12
  41. package/dist/agents/verify.d.ts +41 -14
  42. package/dist/agents/verify.js +37 -27
  43. package/dist/bench/metrics.d.ts +3 -5
  44. package/dist/bench/metrics.js +0 -1
  45. package/dist/brain/anthropic.js +1 -0
  46. package/dist/brain/degrading.js +3 -1
  47. package/dist/brain/errors.d.ts +7 -1
  48. package/dist/brain/errors.js +6 -0
  49. package/dist/brain/failover.js +2 -1
  50. package/dist/brain/open-responses.js +1 -0
  51. package/dist/brain/openai.js +1 -0
  52. package/dist/brain/provider-dialect.d.ts +10 -0
  53. package/dist/brain/provider-dialect.js +13 -2
  54. package/dist/brain/route-adjudicator.js +3 -1
  55. package/dist/brain/status-sink.d.ts +7 -1
  56. package/dist/brain/status-sink.js +6 -0
  57. package/dist/brain/stream-engine.d.ts +3 -0
  58. package/dist/brain/stream-engine.js +4 -0
  59. package/dist/brain/timeout.d.ts +3 -1
  60. package/dist/brain/timeout.js +18 -5
  61. package/dist/core/a2a.d.ts +15 -5
  62. package/dist/core/a2a.js +34 -19
  63. package/dist/core/agent-definition.d.ts +20 -0
  64. package/dist/core/agent-state.d.ts +1 -1
  65. package/dist/core/allow-entry.d.ts +61 -23
  66. package/dist/core/allow-entry.js +134 -39
  67. package/dist/core/artifact-host.d.ts +0 -2
  68. package/dist/core/artifact-host.js +0 -1
  69. package/dist/core/ask-origin.d.ts +79 -0
  70. package/dist/core/ask-origin.js +76 -0
  71. package/dist/core/ask-question.d.ts +19 -13
  72. package/dist/core/ask-question.js +8 -2
  73. package/dist/core/auto-compaction.d.ts +2 -0
  74. package/dist/core/auto-compaction.js +2 -1
  75. package/dist/core/auto-mode-defaults.d.ts +8 -0
  76. package/dist/core/auto-mode-defaults.js +1 -0
  77. package/dist/core/auto-mode-rebuild.d.ts +2 -1
  78. package/dist/core/auto-mode.d.ts +39 -4
  79. package/dist/core/auto-mode.js +66 -17
  80. package/dist/core/background-agent-store.d.ts +17 -6
  81. package/dist/core/background-agent-store.js +15 -13
  82. package/dist/core/background-shell.d.ts +12 -1
  83. package/dist/core/background-shell.js +12 -0
  84. package/dist/core/checkpoint-requirements.d.ts +24 -3
  85. package/dist/core/checkpoint-requirements.js +9 -1
  86. package/dist/core/checkpoint-store.d.ts +86 -32
  87. package/dist/core/checkpoint-store.js +10 -5
  88. package/dist/core/child-clamp-seats.d.ts +3 -2
  89. package/dist/core/child-clamp-seats.js +4 -3
  90. package/dist/core/closest-name.d.ts +13 -0
  91. package/dist/core/closest-name.js +35 -0
  92. package/dist/core/compliance.d.ts +1 -1
  93. package/dist/core/context-settings.js +3 -5
  94. package/dist/core/credential-echo.d.ts +52 -0
  95. package/dist/core/credential-echo.js +65 -0
  96. package/dist/core/credential-vocabulary.d.ts +13 -3
  97. package/dist/core/credential-vocabulary.js +12 -4
  98. package/dist/core/cross-boundary-taint.d.ts +5 -6
  99. package/dist/core/decision-receipt.d.ts +14 -1
  100. package/dist/core/decision-receipt.js +6 -3
  101. package/dist/core/delegation-frames.d.ts +13 -9
  102. package/dist/core/effective-path-target.js +2 -3
  103. package/dist/core/engine-attestation.d.ts +11 -1
  104. package/dist/core/engine-attestation.js +2 -0
  105. package/dist/core/engine-notice.d.ts +106 -32
  106. package/dist/core/file-history-retention.d.ts +8 -0
  107. package/dist/core/file-history-retention.js +14 -11
  108. package/dist/core/file-history-store.d.ts +31 -1
  109. package/dist/core/file-history-store.js +31 -2
  110. package/dist/core/frame-settlement.d.ts +15 -0
  111. package/dist/core/frame-settlement.js +10 -1
  112. package/dist/core/fs-write-gate-policy.d.ts +3 -3
  113. package/dist/core/fs-write-gate-policy.js +8 -7
  114. package/dist/core/gate-fold.js +9 -6
  115. package/dist/core/gate-lanes.js +46 -12
  116. package/dist/core/gate-outcome.d.ts +40 -1
  117. package/dist/core/gate-outcome.js +10 -0
  118. package/dist/core/git-worktree-env.d.ts +7 -3
  119. package/dist/core/git-worktree-env.js +16 -13
  120. package/dist/core/governance-codes.d.ts +19 -3
  121. package/dist/core/governance-codes.js +27 -3
  122. package/dist/core/hands-band-screen.js +0 -1
  123. package/dist/core/hands-band.d.ts +0 -3
  124. package/dist/core/hooks.d.ts +51 -60
  125. package/dist/core/hooks.js +131 -78
  126. package/dist/core/host-floor.js +3 -5
  127. package/dist/core/image-admission.d.ts +145 -52
  128. package/dist/core/image-admission.js +202 -47
  129. package/dist/core/image-downsample.d.ts +36 -69
  130. package/dist/core/image-downsample.js +111 -73
  131. package/dist/core/input-author.d.ts +36 -0
  132. package/dist/core/input-author.js +39 -0
  133. package/dist/core/integer-option.d.ts +21 -0
  134. package/dist/core/integer-option.js +13 -0
  135. package/dist/core/leg-identity.d.ts +62 -0
  136. package/dist/core/leg-identity.js +18 -0
  137. package/dist/core/locked-config.d.ts +55 -3
  138. package/dist/core/locked-config.js +84 -51
  139. package/dist/core/lsp.d.ts +5 -3
  140. package/dist/core/lsp.js +3 -2
  141. package/dist/core/mailbox-store.d.ts +85 -10
  142. package/dist/core/mailbox-store.js +31 -10
  143. package/dist/core/mcp-call-meta.d.ts +2 -2
  144. package/dist/core/mcp-call-meta.js +9 -10
  145. package/dist/core/mcp-connection-pool.d.ts +6 -20
  146. package/dist/core/mcp-connection-pool.js +10 -28
  147. package/dist/core/mcp-failure.d.ts +83 -16
  148. package/dist/core/mcp-failure.js +67 -30
  149. package/dist/core/mcp-host-seat.d.ts +131 -0
  150. package/dist/core/mcp-host-seat.js +305 -0
  151. package/dist/core/mcp-probe.d.ts +7 -2
  152. package/dist/core/mcp-probe.js +9 -4
  153. package/dist/core/mcp-server-link.d.ts +18 -6
  154. package/dist/core/mcp-server-link.js +19 -4
  155. package/dist/core/mcp-server-spec.d.ts +39 -9
  156. package/dist/core/mcp-server-spec.js +55 -21
  157. package/dist/core/mcp-session-end.d.ts +1 -2
  158. package/dist/core/mcp-session-end.js +1 -1
  159. package/dist/core/mcp.d.ts +23 -55
  160. package/dist/core/mcp.js +172 -156
  161. package/dist/core/media-byte-cap.d.ts +21 -46
  162. package/dist/core/media-byte-cap.js +55 -55
  163. package/dist/core/member-group.d.ts +7 -0
  164. package/dist/core/member-group.js +35 -0
  165. package/dist/core/memory-admission.d.ts +23 -6
  166. package/dist/core/memory-admission.js +19 -9
  167. package/dist/core/memory-engine/consolidation.d.ts +1 -1
  168. package/dist/core/memory-engine/consolidation.js +7 -1
  169. package/dist/core/memory-engine/content-origin.d.ts +13 -0
  170. package/dist/core/memory-engine/content-origin.js +21 -3
  171. package/dist/core/memory-engine/dual-root.d.ts +31 -0
  172. package/dist/core/memory-engine/dual-root.js +59 -11
  173. package/dist/core/memory-engine/engine.js +27 -24
  174. package/dist/core/memory-engine/file-backend.d.ts +13 -0
  175. package/dist/core/memory-engine/file-backend.js +35 -15
  176. package/dist/core/memory-engine/index.d.ts +2 -1
  177. package/dist/core/memory-engine/index.js +2 -1
  178. package/dist/core/memory-engine/layout.d.ts +3 -0
  179. package/dist/core/memory-engine/layout.js +13 -3
  180. package/dist/core/memory-engine/memory-deployment.d.ts +110 -0
  181. package/dist/core/memory-engine/memory-deployment.js +182 -0
  182. package/dist/core/memory-engine/scope-contract.d.ts +13 -3
  183. package/dist/core/memory-engine/scope-contract.js +2 -2
  184. package/dist/core/memory-engine/sync-client.d.ts +68 -13
  185. package/dist/core/memory-engine/sync-client.js +147 -18
  186. package/dist/core/memory-engine/sync-report.d.ts +106 -0
  187. package/dist/core/memory-engine/sync-report.js +119 -0
  188. package/dist/core/memory-engine/sync.d.ts +13 -3
  189. package/dist/core/mode-policy.d.ts +15 -7
  190. package/dist/core/mode-policy.js +18 -6
  191. package/dist/core/model-receipt.d.ts +39 -0
  192. package/dist/core/model-receipt.js +139 -0
  193. package/dist/core/mods/agent-stations.d.ts +100 -0
  194. package/dist/core/mods/agent-stations.js +154 -0
  195. package/dist/core/mods/dollar.d.ts +62 -0
  196. package/dist/core/mods/extension-call.d.ts +15 -1
  197. package/dist/core/mods/extension-call.js +7 -2
  198. package/dist/core/mods/kernel/dispatch.d.ts +9 -4
  199. package/dist/core/mods/kernel/dispatch.js +8 -8
  200. package/dist/core/mods/kernel/events.d.ts +13 -4
  201. package/dist/core/mods/kernel/events.js +14 -10
  202. package/dist/core/mods/kernel/receive.d.ts +5 -0
  203. package/dist/core/mods/kernel/receive.js +10 -0
  204. package/dist/core/mods/kernel/registration.d.ts +3 -0
  205. package/dist/core/mods/kernel/registration.js +5 -0
  206. package/dist/core/mods/kernel/site-rules.d.ts +6 -3
  207. package/dist/core/mods/kernel/site-rules.js +10 -2
  208. package/dist/core/mods/lifecycle-stations.d.ts +41 -0
  209. package/dist/core/mods/lifecycle-stations.js +35 -0
  210. package/dist/core/mods/session-append.d.ts +115 -0
  211. package/dist/core/mods/session-append.js +311 -0
  212. package/dist/core/mods/session-compact.d.ts +48 -0
  213. package/dist/core/mods/session-compact.js +194 -0
  214. package/dist/core/mods/session-receive.d.ts +93 -0
  215. package/dist/core/mods/session-receive.js +141 -0
  216. package/dist/core/mods/session-send.d.ts +72 -0
  217. package/dist/core/mods/session-send.js +88 -0
  218. package/dist/core/mods/stations.d.ts +89 -75
  219. package/dist/core/mods/stations.js +57 -53
  220. package/dist/core/mods/tool-call.d.ts +12 -4
  221. package/dist/core/mods/tool-call.js +32 -16
  222. package/dist/core/mounted-mcp.d.ts +5 -0
  223. package/dist/core/mounted-mcp.js +2 -2
  224. package/dist/core/namespaced-rule-name.d.ts +7 -1
  225. package/dist/core/namespaced-rule-name.js +13 -2
  226. package/dist/core/oracle-isolation.js +1 -1
  227. package/dist/core/output-style.js +3 -4
  228. package/dist/core/own-property-receipt.d.ts +62 -0
  229. package/dist/core/own-property-receipt.js +43 -0
  230. package/dist/core/park-selfcheck.js +12 -10
  231. package/dist/core/path-identity.d.ts +11 -0
  232. package/dist/core/path-identity.js +4 -0
  233. package/dist/core/path-rule-binding.d.ts +3 -1
  234. package/dist/core/path-rule-binding.js +3 -1
  235. package/dist/core/peer-seat.d.ts +66 -11
  236. package/dist/core/peer-seat.js +199 -42
  237. package/dist/core/permission-rule-consent.d.ts +21 -26
  238. package/dist/core/permission-rule-consent.js +22 -3
  239. package/dist/core/permission-rule-model.d.ts +38 -13
  240. package/dist/core/permission-rule-model.js +54 -16
  241. package/dist/core/permission-rule-org.d.ts +1 -1
  242. package/dist/core/permission-rule-provider.js +4 -1
  243. package/dist/core/permission-rules.d.ts +4 -0
  244. package/dist/core/permission-rules.js +11 -16
  245. package/dist/core/protocol-http-auth.d.ts +14 -2
  246. package/dist/core/protocol-http-auth.js +16 -7
  247. package/dist/core/read-face-seats.d.ts +7 -5
  248. package/dist/core/read-face-seats.js +4 -1
  249. package/dist/core/redaction-marks.d.ts +4 -3
  250. package/dist/core/redaction-marks.js +2 -2
  251. package/dist/core/remote-env.d.ts +218 -122
  252. package/dist/core/remote-env.js +133 -14
  253. package/dist/core/retention-policy.d.ts +24 -23
  254. package/dist/core/retention-policy.js +36 -2
  255. package/dist/core/retention.d.ts +4 -1
  256. package/dist/core/retention.js +37 -12
  257. package/dist/core/retired-keys.d.ts +8 -3
  258. package/dist/core/retired-keys.js +4 -1
  259. package/dist/core/rewrite-rejudge.d.ts +12 -5
  260. package/dist/core/rewrite-rejudge.js +9 -5
  261. package/dist/core/roles.d.ts +37 -3
  262. package/dist/core/roles.js +126 -78
  263. package/dist/core/row-admission.d.ts +10 -0
  264. package/dist/core/row-admission.js +5 -0
  265. package/dist/core/rule-owner.d.ts +3 -0
  266. package/dist/core/runner/advisor-instructions.d.ts +2 -1
  267. package/dist/core/runner/advisor-instructions.js +2 -1
  268. package/dist/core/runner/announce-once-ledger.d.ts +4 -4
  269. package/dist/core/runner/assemble-result.d.ts +13 -8
  270. package/dist/core/runner/assemble-result.js +12 -8
  271. package/dist/core/runner/call-hook-stations.d.ts +17 -10
  272. package/dist/core/runner/call-hook-stations.js +21 -10
  273. package/dist/core/runner/caller-roster.d.ts +12 -9
  274. package/dist/core/runner/caller-roster.js +5 -2
  275. package/dist/core/runner/checkpoint-scope.d.ts +16 -1
  276. package/dist/core/runner/checkpoint-scope.js +21 -0
  277. package/dist/core/runner/child-tree.d.ts +7 -8
  278. package/dist/core/runner/child-tree.js +6 -6
  279. package/dist/core/runner/classifier-ladder.d.ts +10 -2
  280. package/dist/core/runner/classifier-ladder.js +39 -8
  281. package/dist/core/runner/compact-session.js +14 -2
  282. package/dist/core/runner/compaction-call-options.d.ts +1 -1
  283. package/dist/core/runner/compaction-restate.d.ts +2 -2
  284. package/dist/core/runner/compaction-restate.js +4 -3
  285. package/dist/core/runner/construction-doors.d.ts +2 -2
  286. package/dist/core/runner/construction-doors.js +7 -2
  287. package/dist/core/runner/contracts.d.ts +158 -65
  288. package/dist/core/runner/cross-boundary-lane.d.ts +4 -6
  289. package/dist/core/runner/cross-boundary-lane.js +11 -2
  290. package/dist/core/runner/decide-continuation.d.ts +4 -2
  291. package/dist/core/runner/decide-continuation.js +7 -4
  292. package/dist/core/runner/denial-limit-arms.d.ts +15 -21
  293. package/dist/core/runner/denial-limit-arms.js +17 -10
  294. package/dist/core/runner/env-capability-census.d.ts +15 -20
  295. package/dist/core/runner/env-capability-census.js +25 -34
  296. package/dist/core/runner/expire-settle.d.ts +44 -0
  297. package/dist/core/runner/expire-settle.js +55 -0
  298. package/dist/core/runner/file-history-request.d.ts +2 -2
  299. package/dist/core/runner/file-history-request.js +0 -8
  300. package/dist/core/runner/gate-exit.d.ts +75 -7
  301. package/dist/core/runner/gate-exit.js +20 -1
  302. package/dist/core/runner/git-status-frame.d.ts +5 -2
  303. package/dist/core/runner/git-status-frame.js +4 -4
  304. package/dist/core/runner/halt-attribution.d.ts +2 -1
  305. package/dist/core/runner/halt-attribution.js +2 -1
  306. package/dist/core/runner/image.d.ts +7 -2
  307. package/dist/core/runner/image.js +14 -8
  308. package/dist/core/runner/inline-image.d.ts +10 -8
  309. package/dist/core/runner/inline-image.js +11 -9
  310. package/dist/core/runner/local-claims.d.ts +17 -0
  311. package/dist/core/runner/local-claims.js +18 -0
  312. package/dist/core/runner/media-removed-seat.d.ts +46 -0
  313. package/dist/core/runner/media-removed-seat.js +88 -0
  314. package/dist/core/runner/memory-consolidation-driver.js +4 -4
  315. package/dist/core/runner/park-commit.d.ts +2 -2
  316. package/dist/core/runner/permission-rule-lanes.d.ts +5 -1
  317. package/dist/core/runner/permission-rule-lanes.js +29 -10
  318. package/dist/core/runner/person-path-rows.js +1 -1
  319. package/dist/core/runner/placement-fence.d.ts +26 -0
  320. package/dist/core/runner/placement-fence.js +38 -0
  321. package/dist/core/runner/prepare-ask-lane.d.ts +6 -12
  322. package/dist/core/runner/prepare-ask-lane.js +4 -4
  323. package/dist/core/runner/prepare-boundary-parks.d.ts +6 -3
  324. package/dist/core/runner/prepare-boundary-parks.js +4 -4
  325. package/dist/core/runner/prepare-caps-and-workflow.d.ts +6 -0
  326. package/dist/core/runner/prepare-caps-and-workflow.js +5 -3
  327. package/dist/core/runner/prepare-config-doors.d.ts +6 -1
  328. package/dist/core/runner/prepare-config-doors.js +30 -26
  329. package/dist/core/runner/prepare-context-lane.d.ts +6 -2
  330. package/dist/core/runner/prepare-context-lane.js +13 -13
  331. package/dist/core/runner/prepare-delegation-surface.d.ts +13 -11
  332. package/dist/core/runner/prepare-delegation-surface.js +7 -8
  333. package/dist/core/runner/prepare-execution-env.d.ts +5 -2
  334. package/dist/core/runner/prepare-execution-env.js +7 -4
  335. package/dist/core/runner/prepare-file-history.d.ts +10 -12
  336. package/dist/core/runner/prepare-file-history.js +3 -12
  337. package/dist/core/runner/prepare-gate-stations.d.ts +23 -17
  338. package/dist/core/runner/prepare-gate-stations.js +10 -7
  339. package/dist/core/runner/prepare-hands-readface.d.ts +8 -6
  340. package/dist/core/runner/prepare-hands-readface.js +19 -11
  341. package/dist/core/runner/prepare-inherited-gate.d.ts +11 -4
  342. package/dist/core/runner/prepare-inherited-gate.js +12 -5
  343. package/dist/core/runner/prepare-lsp.d.ts +3 -0
  344. package/dist/core/runner/prepare-lsp.js +2 -2
  345. package/dist/core/runner/prepare-memory-engine-session.js +1 -1
  346. package/dist/core/runner/prepare-memory.d.ts +2 -2
  347. package/dist/core/runner/prepare-memory.js +2 -2
  348. package/dist/core/runner/prepare-park-ask.d.ts +8 -7
  349. package/dist/core/runner/prepare-park-ask.js +6 -12
  350. package/dist/core/runner/prepare-policy-chain.d.ts +15 -25
  351. package/dist/core/runner/prepare-policy-chain.js +131 -128
  352. package/dist/core/runner/prepare-project-context.d.ts +2 -2
  353. package/dist/core/runner/prepare-project-context.js +8 -5
  354. package/dist/core/runner/prepare-prompt-inputs.d.ts +4 -0
  355. package/dist/core/runner/prepare-prompt-inputs.js +4 -2
  356. package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
  357. package/dist/core/runner/prepare-protocol-tools.js +9 -2
  358. package/dist/core/runner/prepare-question-face.d.ts +6 -4
  359. package/dist/core/runner/prepare-question-face.js +2 -2
  360. package/dist/core/runner/prepare-run-refs.d.ts +3 -0
  361. package/dist/core/runner/prepare-run-refs.js +2 -2
  362. package/dist/core/runner/prepare-suspend-saga.d.ts +11 -9
  363. package/dist/core/runner/prepare-suspend-saga.js +21 -13
  364. package/dist/core/runner/prepare-task.d.ts +1 -1
  365. package/dist/core/runner/prepare-task.js +84 -42
  366. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +6 -0
  367. package/dist/core/runner/prepare-tool-disclosure-mount.js +3 -1
  368. package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
  369. package/dist/core/runner/prepare-turn-wiring.js +7 -2
  370. package/dist/core/runner/prepare-wiring-manifest.d.ts +7 -3
  371. package/dist/core/runner/prepare-wiring-manifest.js +34 -19
  372. package/dist/core/runner/prepare-workspace-restore.d.ts +5 -0
  373. package/dist/core/runner/prepare-workspace-restore.js +12 -8
  374. package/dist/core/runner/read-root-grant.d.ts +1 -1
  375. package/dist/core/runner/read-root-grant.js +2 -1
  376. package/dist/core/runner/resume-admission.d.ts +5 -3
  377. package/dist/core/runner/resume-admission.js +17 -3
  378. package/dist/core/runner/resume-apply.js +3 -1
  379. package/dist/core/runner/resume-checkpoint-screen.js +4 -4
  380. package/dist/core/runner/resume-claim.d.ts +8 -3
  381. package/dist/core/runner/resume-claim.js +28 -12
  382. package/dist/core/runner/resume-internals-and-config.d.ts +2 -2
  383. package/dist/core/runner/resume-internals-and-config.js +10 -1
  384. package/dist/core/runner/resume-preflight.d.ts +3 -2
  385. package/dist/core/runner/resume-preflight.js +13 -26
  386. package/dist/core/runner/retired-runner-deps.js +6 -1
  387. package/dist/core/runner/run-attachment-seats.js +3 -3
  388. package/dist/core/runner/run-brain-sinks.js +1 -0
  389. package/dist/core/runner/run-git-lane.d.ts +3 -1
  390. package/dist/core/runner/run-git-lane.js +3 -2
  391. package/dist/core/runner/run-harness-handlers.d.ts +3 -1
  392. package/dist/core/runner/run-harness-handlers.js +5 -3
  393. package/dist/core/runner/run-identity-wiring.d.ts +2 -2
  394. package/dist/core/runner/run-identity-wiring.js +15 -6
  395. package/dist/core/runner/run-leg.d.ts +3 -3
  396. package/dist/core/runner/run-leg.js +65 -56
  397. package/dist/core/runner/run-notification-lane.d.ts +3 -1
  398. package/dist/core/runner/run-notification-lane.js +36 -12
  399. package/dist/core/runner/run-recovery-lanes.js +3 -2
  400. package/dist/core/runner/run-settle-and-teardown.js +14 -8
  401. package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
  402. package/dist/core/runner/run-stop-and-final-verify.js +12 -4
  403. package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +1 -1
  404. package/dist/core/runner/run-terminal-adoption.d.ts +1 -1
  405. package/dist/core/runner/run-terminal-adoption.js +26 -17
  406. package/dist/core/runner/run-turn-boundary.js +37 -19
  407. package/dist/core/runner/runtask.d.ts +25 -7
  408. package/dist/core/runner/runtask.js +46 -22
  409. package/dist/core/runner/session-rule-policy.d.ts +1 -1
  410. package/dist/core/runner/session-rule-policy.js +6 -1
  411. package/dist/core/runner/shell-env-withheld.d.ts +1 -1
  412. package/dist/core/runner/skills-seat.js +2 -2
  413. package/dist/core/runner/stream-halt-verbs.d.ts +1 -14
  414. package/dist/core/runner/stream-halt-verbs.js +4 -3
  415. package/dist/core/runner/stream-reap.d.ts +7 -6
  416. package/dist/core/runner/stream-reap.js +13 -16
  417. package/dist/core/runner/stream-settle-backstop.d.ts +3 -2
  418. package/dist/core/runner/stream-settle-backstop.js +5 -3
  419. package/dist/core/runner/stream-steer-verb.d.ts +5 -2
  420. package/dist/core/runner/stream-steer-verb.js +8 -7
  421. package/dist/core/runner/sub-agent-deny-lists.js +10 -7
  422. package/dist/core/runner/synthetic-tools.js +2 -2
  423. package/dist/core/runner/terminal-account.d.ts +11 -1
  424. package/dist/core/runner/terminal-account.js +20 -0
  425. package/dist/core/runner/terminal-projection.d.ts +8 -2
  426. package/dist/core/runner/terminal-projection.js +2 -2
  427. package/dist/core/runner/tool-disclosure.d.ts +3 -0
  428. package/dist/core/runner/tool-disclosure.js +5 -4
  429. package/dist/core/runner/tool-end-body.d.ts +3 -3
  430. package/dist/core/runner/tool-end-body.js +1 -1
  431. package/dist/core/runner/tool-face-overlay.d.ts +1 -1
  432. package/dist/core/runner/tool-face-overlay.js +26 -19
  433. package/dist/core/runner/tool-output-projection.d.ts +3 -3
  434. package/dist/core/runner/tool-output-projection.js +7 -6
  435. package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
  436. package/dist/core/runner/tool-result-media-seat.js +17 -1
  437. package/dist/core/runner/tool-table-view.d.ts +56 -0
  438. package/dist/core/runner/tool-table-view.js +51 -0
  439. package/dist/core/runner/turn-attachments.d.ts +6 -7
  440. package/dist/core/runner/turn-attachments.js +4 -17
  441. package/dist/core/runner/void-verifier-pause.d.ts +33 -0
  442. package/dist/core/runner/void-verifier-pause.js +41 -0
  443. package/dist/core/runner-deps.d.ts +55 -43
  444. package/dist/core/secret-env.d.ts +14 -13
  445. package/dist/core/secret-env.js +8 -9
  446. package/dist/core/session-log-transfer.js +9 -10
  447. package/dist/core/session-policy-store.d.ts +10 -3
  448. package/dist/core/session-policy-store.js +21 -3
  449. package/dist/core/session-reconcile.d.ts +3 -2
  450. package/dist/core/session-reconcile.js +7 -4
  451. package/dist/core/session-store.d.ts +5 -2
  452. package/dist/core/session-store.js +53 -16
  453. package/dist/core/session.d.ts +2 -1
  454. package/dist/core/shell-confinement.d.ts +37 -0
  455. package/dist/core/shell-confinement.js +56 -0
  456. package/dist/core/skill-grant.d.ts +9 -0
  457. package/dist/core/skill-grant.js +18 -0
  458. package/dist/core/store-contracts/checkpoint-store-contract.d.ts +2 -2
  459. package/dist/core/store-contracts/checkpoint-store-contract.js +15 -2
  460. package/dist/core/store-contracts/file-history-store-contract.d.ts +5 -2
  461. package/dist/core/store-contracts/file-history-store-contract.js +25 -1
  462. package/dist/core/store-contracts/mailbox-store-contract.d.ts +12 -5
  463. package/dist/core/store-contracts/mailbox-store-contract.js +156 -9
  464. package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
  465. package/dist/core/store-contracts/tool-result-store-contract.js +67 -0
  466. package/dist/core/stub-env.d.ts +5 -5
  467. package/dist/core/stub-env.js +11 -1
  468. package/dist/core/swappable-deps.d.ts +17 -43
  469. package/dist/core/swappable-deps.js +15 -5
  470. package/dist/core/synthetic-read-verdict.d.ts +1 -1
  471. package/dist/core/task-event.d.ts +35 -10
  472. package/dist/core/task-limits.d.ts +5 -0
  473. package/dist/core/task-notification.d.ts +172 -12
  474. package/dist/core/task-notification.js +209 -12
  475. package/dist/core/task-registry-agent.d.ts +23 -55
  476. package/dist/core/task-registry-agent.js +41 -56
  477. package/dist/core/task-registry-monitor.d.ts +8 -1
  478. package/dist/core/task-registry-monitor.js +43 -61
  479. package/dist/core/task-registry-shared.d.ts +52 -114
  480. package/dist/core/task-registry-shared.js +24 -48
  481. package/dist/core/task-registry-workflow.js +5 -22
  482. package/dist/core/task-registry.d.ts +64 -90
  483. package/dist/core/task-registry.js +73 -119
  484. package/dist/core/task-result.d.ts +27 -19
  485. package/dist/core/task-spec-members.d.ts +39 -0
  486. package/dist/core/task-spec-members.js +92 -0
  487. package/dist/core/task-spec.d.ts +13 -16
  488. package/dist/core/task-stream.d.ts +1 -1
  489. package/dist/core/task-tool-shape.d.ts +7 -57
  490. package/dist/core/task-tool-shape.js +7 -66
  491. package/dist/core/terminal-cause.d.ts +30 -0
  492. package/dist/core/terminal-cause.js +1 -0
  493. package/dist/core/tool-catalog-entries.js +3 -6
  494. package/dist/core/tool-check-reading.js +16 -10
  495. package/dist/core/tool-conformance.js +1 -2
  496. package/dist/core/tool-errors.d.ts +6 -3
  497. package/dist/core/tool-errors.js +2 -0
  498. package/dist/core/tool-face-reader.d.ts +7 -6
  499. package/dist/core/tool-face-reader.js +6 -4
  500. package/dist/core/tool-face.d.ts +2 -3
  501. package/dist/core/tool-name-aliases.d.ts +23 -28
  502. package/dist/core/tool-name-aliases.js +63 -7
  503. package/dist/core/tool-name-readings.d.ts +14 -3
  504. package/dist/core/tool-name-readings.js +2 -0
  505. package/dist/core/tool-policy.d.ts +113 -22
  506. package/dist/core/tool-policy.js +85 -15
  507. package/dist/core/tool-registry.d.ts +5 -5
  508. package/dist/core/tool-registry.js +2 -2
  509. package/dist/core/tool-result-store.d.ts +111 -5
  510. package/dist/core/tool-result-store.js +52 -12
  511. package/dist/core/tool-spec.d.ts +39 -10
  512. package/dist/core/trace.d.ts +18 -2
  513. package/dist/core/types.d.ts +3 -3
  514. package/dist/core/types.js +1 -1
  515. package/dist/core/untrusted-text.js +1 -1
  516. package/dist/core/user-attachment.d.ts +10 -5
  517. package/dist/core/user-attachment.js +40 -27
  518. package/dist/core/workflow-journal-store.d.ts +1 -1
  519. package/dist/core/workflow-run-store.d.ts +2 -0
  520. package/dist/core/workflow-run-store.js +6 -5
  521. package/dist/core/workflow-settled-run.d.ts +5 -0
  522. package/dist/core/workflow-settled-run.js +7 -0
  523. package/dist/engine/execution-env/node-execution-env.d.ts +37 -7
  524. package/dist/engine/execution-env/node-execution-env.js +224 -21
  525. package/dist/engine/harness/agent-harness.d.ts +66 -19
  526. package/dist/engine/harness/agent-harness.js +98 -27
  527. package/dist/engine/harness/messages.d.ts +4 -3
  528. package/dist/engine/harness/messages.js +2 -2
  529. package/dist/engine/harness/types.d.ts +151 -34
  530. package/dist/engine/llm/media-removed.d.ts +14 -0
  531. package/dist/engine/llm/media-removed.js +9 -0
  532. package/dist/engine/llm/rejected-images.d.ts +35 -25
  533. package/dist/engine/llm/rejected-images.js +59 -10
  534. package/dist/engine/llm/types.d.ts +24 -3
  535. package/dist/engine/llm/types.js +7 -3
  536. package/dist/engine/loop/agent-loop.d.ts +18 -13
  537. package/dist/engine/loop/agent-loop.js +173 -32
  538. package/dist/engine/loop/types.d.ts +21 -5
  539. package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
  540. package/dist/engine/lsp/node-lsp-manager.js +32 -13
  541. package/dist/engine/session/import-validate.js +7 -0
  542. package/dist/fixtures/index.d.ts +7 -5
  543. package/dist/fixtures/index.js +5 -3
  544. package/dist/index.d.ts +41 -23
  545. package/dist/index.js +29 -16
  546. package/dist/internal/harness-types.d.ts +3 -1
  547. package/dist/internal/llm.d.ts +2 -1
  548. package/dist/internal/llm.js +1 -0
  549. package/dist/orchestration/goal.d.ts +6 -2
  550. package/dist/orchestration/goal.js +6 -3
  551. package/dist/orchestration/run-workflow-tool.d.ts +20 -20
  552. package/dist/orchestration/run-workflow-tool.js +63 -56
  553. package/dist/orchestration/workflow-governance.d.ts +1 -1
  554. package/dist/orchestration/workflow-governance.js +2 -1
  555. package/dist/orchestration/workflow-types.d.ts +2 -2
  556. package/dist/orchestration/workflow.d.ts +8 -0
  557. package/dist/orchestration/workflow.js +33 -9
  558. package/dist/prompts/default.d.ts +1 -10
  559. package/dist/prompts/default.js +0 -2
  560. package/dist/stores/file/background-agent-store.d.ts +1 -1
  561. package/dist/stores/file/background-agent-store.js +19 -14
  562. package/dist/stores/file/checkpoint-store.d.ts +127 -2
  563. package/dist/stores/file/checkpoint-store.js +24 -16
  564. package/dist/stores/file/file-history-store.d.ts +1 -1
  565. package/dist/stores/file/file-history-store.js +4 -1
  566. package/dist/stores/file/index.d.ts +9 -6
  567. package/dist/stores/file/index.js +33 -9
  568. package/dist/stores/file/ledger-tuning.d.ts +23 -0
  569. package/dist/stores/file/ledger-tuning.js +21 -0
  570. package/dist/stores/file/mailbox-store.d.ts +1 -1
  571. package/dist/stores/file/mailbox-store.js +43 -21
  572. package/dist/stores/file/memory-store.d.ts +1 -1
  573. package/dist/stores/file/memory-store.js +4 -1
  574. package/dist/stores/file/permission-rule-adopt.js +24 -21
  575. package/dist/stores/file/permission-rule-store.js +6 -3
  576. package/dist/stores/file/session-policy-store.d.ts +1 -1
  577. package/dist/stores/file/session-policy-store.js +4 -1
  578. package/dist/stores/file/session-store.d.ts +17 -4
  579. package/dist/stores/file/session-store.js +22 -19
  580. package/dist/stores/file/shared-ledger.d.ts +26 -0
  581. package/dist/stores/file/shared-ledger.js +38 -9
  582. package/dist/stores/file/tool-result-store.d.ts +31 -2
  583. package/dist/stores/file/tool-result-store.js +129 -7
  584. package/dist/stores/file/usage-window-store.d.ts +1 -1
  585. package/dist/stores/file/usage-window-store.js +4 -1
  586. package/dist/stores/file/workflow-journal-store.d.ts +1 -13
  587. package/dist/stores/file/workflow-journal-store.js +4 -18
  588. package/dist/stores/file/workflow-run-store.d.ts +1 -1
  589. package/dist/stores/file/workflow-run-store.js +15 -10
  590. package/dist/tools/fs/containment-face.d.ts +5 -0
  591. package/dist/tools/fs/dead-cwd.d.ts +5 -5
  592. package/dist/tools/fs/dead-cwd.js +4 -11
  593. package/dist/tools/fs/encoding.d.ts +13 -4
  594. package/dist/tools/fs/encoding.js +17 -2
  595. package/dist/tools/fs/fs-bash-background-text.d.ts +13 -0
  596. package/dist/tools/fs/fs-bash-background-text.js +7 -0
  597. package/dist/tools/fs/fs-bash.d.ts +11 -22
  598. package/dist/tools/fs/fs-bash.js +58 -154
  599. package/dist/tools/fs/fs-pdf.d.ts +2 -2
  600. package/dist/tools/fs/fs-pdf.js +34 -27
  601. package/dist/tools/fs/fs-read.d.ts +5 -4
  602. package/dist/tools/fs/fs-read.js +35 -18
  603. package/dist/tools/fs/fs-search-tools.js +4 -1
  604. package/dist/tools/fs/fs-shared.d.ts +39 -16
  605. package/dist/tools/fs/fs-shared.js +25 -6
  606. package/dist/tools/fs/fs-write.js +5 -5
  607. package/dist/tools/fs/index.d.ts +15 -9
  608. package/dist/tools/fs/index.js +12 -18
  609. package/dist/tools/fs/pdf.d.ts +4 -4
  610. package/dist/tools/fs/pdf.js +6 -6
  611. package/dist/tools/fs/read-deny-home.js +8 -1
  612. package/dist/tools/fs/read-deny.d.ts +26 -2
  613. package/dist/tools/fs/read-deny.js +9 -2
  614. package/dist/tools/fs/read-floor.d.ts +57 -6
  615. package/dist/tools/fs/read-floor.js +241 -2
  616. package/dist/tools/fs/removal-targets.d.ts +9 -4
  617. package/dist/tools/fs/removal-targets.js +17 -9
  618. package/dist/tools/fs/search.d.ts +6 -5
  619. package/dist/tools/fs/search.js +10 -10
  620. package/dist/tools/fs/shell-read-establish.js +3 -1
  621. package/dist/tools/fs/shell-read-identity.d.ts +3 -1
  622. package/dist/tools/fs/shell-read-identity.js +4 -2
  623. package/dist/tools/fs/shell-read-judge.d.ts +7 -1
  624. package/dist/tools/fs/shell-read-judge.js +1 -1
  625. package/dist/tools/monitor.d.ts +12 -10
  626. package/dist/tools/monitor.js +22 -13
  627. package/dist/tools/scheduler-tools.js +42 -4
  628. package/dist/tools/web.d.ts +0 -10
  629. package/dist/tools/web.js +1 -4
  630. package/dist/tools/worktree.d.ts +5 -1
  631. package/dist/tools/worktree.js +20 -17
  632. package/package.json +8 -3
  633. package/test/export-surface.snapshot.json +166 -30
  634. package/wire-changes/core-stores-sql@7.60.0.json +30 -0
  635. package/wire-changes/core-stores-sql@7.61.0.json +480 -0
  636. package/wire-changes/core@7.60.0.json +3274 -0
  637. package/wire-changes/core@7.61.0.json +4405 -0
  638. package/wire-changes/mods-kernel@7.60.0.json +62 -0
  639. package/wire-changes/mods-kernel@7.61.0.json +65 -0
  640. package/wire-changes/primitives@7.60.0.json +30 -0
  641. package/wire-changes/primitives@7.61.0.json +30 -0
  642. package/dist/core/runner/image-removed-seat.d.ts +0 -12
  643. package/dist/core/runner/image-removed-seat.js +0 -19
@@ -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 withoutWakerSeats(internals) {
26
+ const { mcpHostSeats: _live, placementTarget: _spawnersTarget, objectiveAuthor: _spawnAuthor, ...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
+ }
@@ -101,7 +101,7 @@ export interface ListAgentsRow {
101
101
  * COMPLETED and nothing else: a model applies the continuable rule to that word. */
102
102
  state: "busy" | "idle" | "offline" | "running" | "parked" | "finished" | "failed" | "killed" | "cancelled" | "unknown";
103
103
  /** Agent lanes with a live registry row: the agent's current state
104
- * ({@link import("../core/agent-state.js").readAgentState}, the one reading AgentTranscript and TaskOutput
104
+ * ({@link import("../core/agent-state.js").readAgentState}, the one reading AgentTranscript and the host task poll
105
105
  * render too); {@link state} is this status word through the lane table. Absent on peer rows and on a
106
106
  * roster row with no live row. */
107
107
  agentState?: AgentState;
@@ -20,7 +20,7 @@ export interface PeerNoticeRoute {
20
20
  }
21
21
  /** A delivery RECEIPT to the sender of one message this session judged (held / expired / delivered /
22
22
  * refused / denied). `refSeq` = the seq of the sender's message in THIS session's box. */
23
- export declare function routePeerDeliveryReceipt(route: PeerNoticeRoute, toSession: string, state: Exclude<PeerDeliveryReceiptState, "dropped">, refSeq: number): Promise<boolean>;
23
+ export declare function routePeerDeliveryReceipt(route: PeerNoticeRoute, toSession: string, state: Exclude<PeerDeliveryReceiptState, "dropped">, refSeq: number, detail?: string): Promise<boolean>;
24
24
  /** A `dropped` receipt (the ingress guard's arm). */
25
25
  export declare function routePeerDroppedReceipt(route: PeerNoticeRoute, toSession: string, refSeq: number, dropReason?: PeerDropReason): Promise<boolean>;
26
26
  /** An idle NOTICE to a requester (`idle` / `exited` / `unavailable` from the target; `expired` from the
@@ -28,10 +28,11 @@ async function appendNotice(route, toSession, content, peerMeta, classification)
28
28
  return false;
29
29
  }
30
30
  }
31
- export function routePeerDeliveryReceipt(route, toSession, state, refSeq) {
31
+ export function routePeerDeliveryReceipt(route, toSession, state, refSeq, detail) {
32
32
  const recipient = route.self.name ?? peerSessionBoxHandle(route.self.sessionId);
33
- const notice = { state, refSeq, recipient };
34
- return appendNotice(route, toSession, renderCrossSessionDeliveryNotice(state, 1, [recipient]), noticeMeta(route, "delivery_notice", notice), "peer-receipt-route");
33
+ const said = state === "refused" && detail !== undefined ? peerIdleNoticeLabel(detail) : undefined;
34
+ const notice = { state, refSeq, recipient, ...(said !== undefined ? { detail: said } : {}) };
35
+ return appendNotice(route, toSession, renderCrossSessionDeliveryNotice(state, 1, [recipient], said), noticeMeta(route, "delivery_notice", notice), "peer-receipt-route");
35
36
  }
36
37
  export function routePeerDroppedReceipt(route, toSession, refSeq, dropReason) {
37
38
  const recipient = route.self.name ?? peerSessionBoxHandle(route.self.sessionId);
@@ -65,7 +65,7 @@ export declare function peerRecipientSuffix(recipients: readonly string[]): stri
65
65
  * CC `y$e` — the model-face delivery receipt for the five non-drop states. `count` folds several
66
66
  * receipts of one state into one line (the requester's drain may fold; a single record renders as 1).
67
67
  */
68
- export declare function renderCrossSessionDeliveryNotice(state: Exclude<PeerDeliveryReceiptState, "dropped">, count: number, recipients?: readonly string[]): string;
68
+ export declare function renderCrossSessionDeliveryNotice(state: Exclude<PeerDeliveryReceiptState, "dropped">, count: number, recipients?: readonly string[], detail?: string): string;
69
69
  /** CC `S$e` — the drop reasons, rendered. */
70
70
  export declare function describePeerDropReasons(reasons: readonly (PeerDropReason | undefined)[]): string;
71
71
  /** CC `b$e` — the model-face receipt for messages DROPPED at the recipient's ingress guard. */
@@ -79,9 +79,9 @@ export declare function isPeerIdleNoticeKind(v: unknown): v is PeerIdleNoticeKin
79
79
  export declare const PEER_IDLE_UNAVAILABLE_CAUSES = "it is shutting down, its subscription table is full, a newer subscription displaced this one, or it answered in a form this version does not recognize";
80
80
  /**
81
81
  * CC `nYt` — a label or detail line made safe for the notice text: format/control characters and the
82
- * envelope-ish punctuation (`<>«»"[]`) become spaces, whitespace collapses, the notice's own prefix
83
- * phrase cannot be smuggled in, and the result is capped at {@link PEER_IDLE_LABEL_MAX}. `undefined`
84
- * when nothing printable is left.
82
+ * envelope-ish punctuation (`<>«»"[]`) become spaces, whitespace collapses, neither notice's own prefix
83
+ * phrase can be smuggled in (the idle notice's, and the delivery notice's a `refused` receipt's detail
84
+ * rides), and the result is capped at {@link PEER_IDLE_LABEL_MAX}. `undefined` when nothing printable is left.
85
85
  */
86
86
  export declare function peerIdleNoticeLabel(raw: string): string | undefined;
87
87
  export interface PeerIdleNoticeFields {
@@ -33,7 +33,7 @@ export function peerRecipientSuffix(recipients) {
33
33
  return ` (recipient: ${uniq[0]})`;
34
34
  return ` (recipients: ${uniq.slice(0, 3).join(", ")}${uniq.length > 3 ? ", …" : ""})`;
35
35
  }
36
- export function renderCrossSessionDeliveryNotice(state, count, recipients = []) {
36
+ export function renderCrossSessionDeliveryNotice(state, count, recipients = [], detail) {
37
37
  const n = Math.max(1, Math.floor(count));
38
38
  const P = n === 1 ? "Your message to another session" : `${n} of your messages to another session`;
39
39
  const J = n === 1 ? "was" : "were";
@@ -47,8 +47,12 @@ export function renderCrossSessionDeliveryNotice(state, count, recipients = [])
47
47
  return `[Cross-session delivery notice] ${P} ${J} not approved before expiry${R}. Not delivered to that session's assistant. Do not wait for a reply; continue, or choose another approach.`;
48
48
  case "delivered":
49
49
  return `[Cross-session delivery notice] ${P} ${J} approved and released to that session${R}.`;
50
- case "refused":
51
- return `[Cross-session delivery notice] ${P} ${J} refused${R}: that session is not accepting cross-session messages (the feature is off there, or a setting or policy there refuses them). Not delivered to that session's assistant. Do not wait for a reply and do not resend; tell the user, or choose another approach.`;
50
+ case "refused": {
51
+ const said = detail !== undefined ? peerIdleNoticeLabel(detail) : undefined;
52
+ return said !== undefined
53
+ ? `[Cross-session delivery notice] ${P} ${J} refused${R} by ${said}. Not delivered to that session's assistant. Do not wait for a reply and do not resend; tell the user, or choose another approach.`
54
+ : `[Cross-session delivery notice] ${P} ${J} refused${R}: that session is not accepting cross-session messages (the feature is off there, or a setting or policy there refuses them). Not delivered to that session's assistant. Do not wait for a reply and do not resend; tell the user, or choose another approach.`;
55
+ }
52
56
  default: {
53
57
  const _exhaustive = state;
54
58
  void _exhaustive;
@@ -98,7 +102,7 @@ export function peerIdleNoticeLabel(raw) {
98
102
  .replace(/[\p{Cc}\p{Cf}<>«»"[\]]/gu, " ")
99
103
  .replace(/[\s\p{Z}]+/gu, " ");
100
104
  for (;;) {
101
- const r = t.replace(/cross-session idle notice/giu, " ").replace(/ {2,}/g, " ");
105
+ const r = t.replace(/cross-session (?:idle|delivery) notice/giu, " ").replace(/ {2,}/g, " ");
102
106
  if (r === t)
103
107
  break;
104
108
  t = r;
@@ -1,5 +1,5 @@
1
1
  import { type MailboxCrossProcessVerdict, type MailboxStore } from "../core/mailbox-store.js";
2
- import { type SessionBoxBinding, type SystemInjectionPriority, type TaskNotificationPayload } from "../core/task-notification.js";
2
+ import { type FrameReceiver, type SessionBoxBinding, type SystemInjectionPriority, type TaskNotificationPayload } from "../core/task-notification.js";
3
3
  import { type FrameSettlement } from "../core/frame-settlement.js";
4
4
  import { type EngineNotice, type RunnerDeps } from "../core/types.js";
5
5
  import { type PermissionModeClass } from "./cross-session-envelope.js";
@@ -140,6 +140,11 @@ export interface PeerSessionDrainOptions {
140
140
  * private one, which is honest but inert: nothing fills it, so every delivered record waits for a
141
141
  * receipt that never comes and stays parked (at-least-once). Every production binding supplies it. */
142
142
  settlement?: FrameSettlement;
143
+ /** The leg's receiving station (`session.receive`): every record the PULL face hands back passes it first, and a
144
+ * record it consumed is settled as that decision (its sender told `refused`). A record the drain injects passes it on
145
+ * the live lane, which answers a consume through the settlement seam ({@link FrameSettlement.consumed}). Absent ⇒ no
146
+ * station: every record is handed over as made. */
147
+ receive?: FrameReceiver;
143
148
  leaseTtlMs?: number;
144
149
  /** Tests: a virtual clock for the held deadlines and idle timers (honored when this process first sees the session). */
145
150
  clock?: PeerClock;
@@ -318,6 +323,8 @@ export declare function bindPeerLaneDrain(harness: PeerDrainHarness, args: {
318
323
  /** #1036 — the leg's settlement seam (receipts + compaction effects), minted by the
319
324
  * orchestrator and shared with the harness sink and the compaction commit beat. */
320
325
  settlement?: FrameSettlement;
326
+ /** The leg's receiving station ({@link PeerSessionDrainOptions.receive}). */
327
+ receive?: FrameReceiver;
321
328
  selfName?: () => string | undefined;
322
329
  parked?: () => boolean;
323
330
  lastTurnText?: () => string | undefined;
@@ -156,6 +156,13 @@ export function createPeerSessionDrain(opts) {
156
156
  else
157
157
  void routePeerDeliveryReceipt(route(), to, state, entry.seq);
158
158
  };
159
+ const settleConsumed = (lane, seq, payload, by, reason) => {
160
+ lane.ledger.set(seq, { kind: "terminal", why: "consumed" });
161
+ const peerMeta = payload._sema_provenance?.kind === "cross_session_message" ? payload._sema_provenance.peerMeta : undefined;
162
+ const to = peerMeta !== undefined ? receiptAddress(lane, { peerMeta }) : undefined;
163
+ if (to !== undefined)
164
+ void routePeerDeliveryReceipt(route(), to, "refused", seq, by === "engine" ? "the receiving engine (it could not judge the message)" : `extension ${by} of that session: ${reason}`);
165
+ };
159
166
  const heldSink = (lane, live) => ({
160
167
  judge: (entry) => judgeMeta(readFacts(), entry.peerMeta),
161
168
  ...(live
@@ -164,6 +171,10 @@ export function createPeerSessionDrain(opts) {
164
171
  if (currentRound === undefined || !currentRound.holds(lane))
165
172
  return "deferred";
166
173
  const payload = buildPeerMessagePayload(lane, entry);
174
+ if (currentRound.out !== undefined && opts.receive?.listens() === true) {
175
+ currentRound.batch.push({ lane, payload, priority: "next", urgent: false, seq: entry.seq, attempt: 1 });
176
+ return undefined;
177
+ }
167
178
  if (currentRound.deliver(payload, "next") === "deferred")
168
179
  return "deferred";
169
180
  noteDelivered(lane, entry.seq, 1, payload, currentRound.carrier);
@@ -253,7 +264,7 @@ export function createPeerSessionDrain(opts) {
253
264
  return true;
254
265
  return false;
255
266
  };
256
- const noteDelivered = (lane, seq, attempt, payload, carrier) => {
267
+ const noteDelivered = (lane, seq, attempt, payload, carrier, shown = payload) => {
257
268
  const own = taskNotificationDedupKey(payload);
258
269
  const key = carrier === undefined ? own : `${carrier}|${own}`;
259
270
  lane.ledger.set(seq, { kind: "delivered", attempt, key, payload });
@@ -266,7 +277,7 @@ export function createPeerSessionDrain(opts) {
266
277
  opts.onError?.(e, { phase: "degraded", sessionId, classification: "peer-external-mark" });
267
278
  }
268
279
  }
269
- seam.awaiting.set(key, carrier === undefined ? { carrier: own } : { carrier, frameText: renderTaskNotificationXml(payload) });
280
+ seam.awaiting.set(key, carrier === undefined ? { carrier: own } : { carrier, frameText: renderTaskNotificationXml(shown) });
270
281
  };
271
282
  const deriveAckPrefix = (lane, messages) => {
272
283
  let prefix;
@@ -287,10 +298,16 @@ export function createPeerSessionDrain(opts) {
287
298
  const settleLaneLocally = (lane, landed) => {
288
299
  const { ledger, boxHandle } = lane;
289
300
  const hostWithheldSeqs = [];
290
- if (seam.receipts.size > 0 || seam.withheld.size > 0 || seam.hostWithheld.size > 0) {
301
+ if (seam.receipts.size > 0 || seam.withheld.size > 0 || seam.hostWithheld.size > 0 || seam.consumed.size > 0) {
291
302
  for (const [seq, d] of ledger) {
292
303
  if (d.kind !== "delivered")
293
304
  continue;
305
+ const consumed = seam.consumed.get(d.key);
306
+ if (consumed !== undefined) {
307
+ seam.consumed.delete(d.key);
308
+ settleConsumed(lane, seq, d.payload, consumed.by, consumed.reason);
309
+ continue;
310
+ }
294
311
  if (seam.hostWithheld.delete(d.key)) {
295
312
  ledger.set(seq, { kind: "terminal", why: "host_withheld" });
296
313
  hostWithheldSeqs.push(seq);
@@ -311,7 +328,7 @@ export function createPeerSessionDrain(opts) {
311
328
  }
312
329
  }
313
330
  if (hostWithheldSeqs.length > 0) {
314
- opts.onError?.(new Error(`${hostWithheldSeqs.length} cross-session message frame(s) (seq ${hostWithheldSeqs.join(", ")}) could not be found in this session's ReadInbox result as a postToolUse hook rewrote it (removed, truncated or reshaped beyond whitespace) — settled as the host's decision: they leave ${boxHandle} and are not handed over again`), { phase: "degraded", sessionId, classification: "peer-inbox-host-withheld" });
331
+ opts.onError?.(new Error(`${hostWithheldSeqs.length} cross-session message frame(s) (seq ${hostWithheldSeqs.join(", ")}) could not be found in this session's ReadInbox result as the host side rewrote it (a postToolUse hook or an extension's session.append handler: removed, truncated or reshaped beyond whitespace) — settled as the host's decision: they leave ${boxHandle} and are not handed over again`), { phase: "degraded", sessionId, classification: "peer-inbox-host-withheld" });
315
332
  }
316
333
  for (const effect of landed) {
317
334
  for (const [seq, d] of ledger) {
@@ -373,7 +390,7 @@ export function createPeerSessionDrain(opts) {
373
390
  else {
374
391
  const state = notice.state;
375
392
  const recipients = [notice.recipient ?? m.from ?? ""];
376
- text = state === "dropped" ? renderCrossSessionDroppedNotice(1, recipients, [notice.dropReason]) : renderCrossSessionDeliveryNotice(state, 1, recipients);
393
+ text = state === "dropped" ? renderCrossSessionDroppedNotice(1, recipients, [notice.dropReason]) : renderCrossSessionDeliveryNotice(state, 1, recipients, notice.detail);
377
394
  }
378
395
  const judged = judgeMeta(facts, meta);
379
396
  if (judged.verdict === "refuse") {
@@ -647,15 +664,26 @@ export function createPeerSessionDrain(opts) {
647
664
  finally {
648
665
  const ordered = round.batch.splice(0).sort((a, b) => Number(b.urgent) - Number(a.urgent));
649
666
  for (const item of ordered) {
667
+ let shown = item.payload;
668
+ if (round.out !== undefined && opts.receive?.listens() === true) {
669
+ if (round.spent)
670
+ continue;
671
+ const verdict = await opts.receive.receive(item.payload);
672
+ if (verdict.kind === "consumed") {
673
+ settleConsumed(item.lane, item.seq, item.payload, verdict.by, verdict.reason);
674
+ continue;
675
+ }
676
+ shown = verdict.payload;
677
+ }
650
678
  try {
651
- if (round.deliver(item.payload, item.priority) === "deferred")
679
+ if (round.deliver(shown, item.priority) === "deferred")
652
680
  continue;
653
681
  }
654
682
  catch (e) {
655
683
  opts.onError?.(e, { phase: "degraded", sessionId, classification: "peer-box-inject" });
656
684
  break;
657
685
  }
658
- noteDelivered(item.lane, item.seq, item.attempt, item.payload, round.carrier);
686
+ noteDelivered(item.lane, item.seq, item.attempt, item.payload, round.carrier, shown);
659
687
  }
660
688
  }
661
689
  for (const { lane, lease } of leased) {
@@ -872,6 +900,7 @@ export function bindPeerLaneDrain(harness, args) {
872
900
  selfName: () => rowName ?? args.selfName?.(),
873
901
  warmup: lookupRowName,
874
902
  ...(args.settlement !== undefined ? { settlement: args.settlement } : {}),
903
+ ...(args.receive !== undefined ? { receive: args.receive } : {}),
875
904
  ...(args.parked !== undefined ? { parked: args.parked } : {}),
876
905
  ...(args.lastTurnText !== undefined ? { lastTurnText: args.lastTurnText } : {}),
877
906
  ...(args.markExternalContent !== undefined ? { markExternalContent: args.markExternalContent } : {}),
@@ -1,7 +1,9 @@
1
1
  import { isDurablePause, pauseFamily } from "./suspend-guard.js";
2
2
  import { delimitUntrusted, sanitizeUntrustedText } from "../core/untrusted-text.js";
3
+ import { recipeContinuationLeg } from "../core/input-author.js";
3
4
  import { assertOracleIsolation } from "../core/oracle-isolation.js";
4
5
  import { buildCumulativeStats } from "./cumulative-stats.js";
6
+ import { laterLegAllowance } from "./composition-allowance.js";
5
7
  export function isolationPermitsAutoAccept(verdict) {
6
8
  return verdict.protected && verdict.isolationClass === "out_of_process";
7
9
  }
@@ -154,8 +156,11 @@ export async function runRepairLoop(runner, implSpec, config) {
154
156
  });
155
157
  let restartedOnce = false;
156
158
  let restartUsed = false;
159
+ let firstAttempt = true;
160
+ let laterAttemptSpec = implSpec;
161
+ const ownSpend = () => ({ costMicroUsd: anyAttemptUnpriced ? undefined : ownCostMicro, tokens: ownTokens, turns: ownTurns });
157
162
  const cleanRestartSpec = () => {
158
- const { sessionId: _drop, ...rest } = implSpec;
163
+ const { sessionId: _drop, ...rest } = laterAttemptSpec;
159
164
  return { ...rest, objective: `${implSpec.objective}\n\n${repairObjective(bundle)}` };
160
165
  };
161
166
  const exhaustedBeforeDispatch = (message, errorCode) => ({
@@ -188,7 +193,7 @@ export async function runRepairLoop(runner, implSpec, config) {
188
193
  const spec = restartedOnce
189
194
  ? cleanRestartSpec()
190
195
  : isRepair
191
- ? { ...implSpec, sessionId: lastResult.sessionId, objective: repairObjective(bundle) }
196
+ ? { ...laterAttemptSpec, sessionId: lastResult.sessionId, objective: repairObjective(bundle) }
192
197
  : isSeededResume
193
198
  ? {
194
199
  ...implSpec,
@@ -200,10 +205,11 @@ export async function runRepairLoop(runner, implSpec, config) {
200
205
  liveStamp.unref?.();
201
206
  let result;
202
207
  try {
203
- result = await runner.runTask(spec, { repairBundle: bundle });
208
+ result = await runner.runTask(spec, firstAttempt ? { repairBundle: bundle } : recipeContinuationLeg({ repairBundle: bundle }));
204
209
  }
205
210
  finally {
206
211
  clearInterval(liveStamp);
212
+ firstAttempt = false;
207
213
  }
208
214
  spend += (result.stats.costMicroUsd ?? 0) + (result.stats.nested?.costMicroUsd ?? 0);
209
215
  stampAccount();
@@ -258,8 +264,12 @@ export async function runRepairLoop(runner, implSpec, config) {
258
264
  }
259
265
  const overTime = config.totalTimeoutMs != null && priorActiveMs + (Date.now() - startedAt) >= config.totalTimeoutMs;
260
266
  const overCost = config.costCeilingMicroUsd != null && spend >= config.costCeilingMicroUsd;
261
- if (bundle.attemptCount >= maxAttempts || overTime || overCost) {
262
- if (bundle.attemptCount >= maxAttempts && !overTime && !overCost && lastResult !== undefined && !restartUsed) {
267
+ const allowance = laterLegAllowance(implSpec, ownSpend());
268
+ if (allowance.spec !== undefined)
269
+ laterAttemptSpec = allowance.spec;
270
+ const overAllowance = allowance.exhausted;
271
+ if (bundle.attemptCount >= maxAttempts || overTime || overCost || overAllowance !== undefined) {
272
+ if (bundle.attemptCount >= maxAttempts && !overTime && !overCost && overAllowance === undefined && lastResult !== undefined && !restartUsed) {
263
273
  restartUsed = true;
264
274
  restartedOnce = true;
265
275
  continue;
@@ -272,7 +282,7 @@ export async function runRepairLoop(runner, implSpec, config) {
272
282
  bundle,
273
283
  ...(isolationClass ? { isolationClass } : {}),
274
284
  oracleCostMicroUsd,
275
- verification: outcomeFor(terminal, lastOracle, bundle.attemptCount),
285
+ verification: { ...outcomeFor(terminal, lastOracle, bundle.attemptCount), ...(overAllowance !== undefined ? { allowanceExhausted: overAllowance } : {}) },
276
286
  };
277
287
  }
278
288
  }
@@ -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,
@@ -3,7 +3,17 @@ import { PEER_MESSAGE_NOTICE } from "./peer-admission.js";
3
3
  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
+ import { optionKeys, receiveMembers } from "../core/own-property-receipt.js";
7
+ const RETAIN_CONFIG_KEYS = optionKeys()({ ttlMs: 0, max: 0 });
6
8
  export const SUBAGENT_RESUME_CAP = 8;
9
+ export function holdChildDeclarations(runner, declared) {
10
+ if (typeof runner.holdDeclarations !== "function") {
11
+ 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"), {
12
+ code: "config.invalid_argument",
13
+ });
14
+ }
15
+ return runner.holdDeclarations(declared);
16
+ }
7
17
  export class SubagentRetainLedger {
8
18
  ttlMs;
9
19
  max;
@@ -16,7 +26,7 @@ export class SubagentRetainLedger {
16
26
  lastFailure;
17
27
  notifier = createSafeNotifier();
18
28
  constructor(config, hooks) {
19
- const cfg = config === true ? {} : config;
29
+ const cfg = config === true ? {} : receiveMembers(config, { subject: "TaskSpec.retainSubagentSessions", unit: "member", moment: "when the retain ledger is made" }, RETAIN_CONFIG_KEYS);
20
30
  this.ttlMs = cfg.ttlMs ?? RETAIN_DEFAULT_TTL_MS;
21
31
  this.max = cfg.max ?? RETAIN_DEFAULT_MAX;
22
32
  this.hooks = hooks;
@@ -77,7 +87,7 @@ export class SubagentRetainLedger {
77
87
  }
78
88
  register(parentToolCallId, entry) {
79
89
  if (this.isDisposed)
80
- return undefined;
90
+ return void entry.declarations.release();
81
91
  this.sweepExpired();
82
92
  if (this.entries.size >= this.max) {
83
93
  let oldest;
@@ -90,11 +100,12 @@ export class SubagentRetainLedger {
90
100
  }
91
101
  if (oldest === undefined) {
92
102
  this.tombstone(parentToolCallId);
93
- return undefined;
103
+ return void entry.declarations.release();
94
104
  }
95
105
  this.evictDetached(oldest, "lru_overflow");
96
106
  }
97
107
  const full = { ...entry, running: true, settled: false, settledAt: Date.now(), resumeCount: 0, cycleSeq: 1 };
108
+ this.entries.get(parentToolCallId)?.declarations.release();
98
109
  this.entries.set(parentToolCallId, full);
99
110
  return full;
100
111
  }
@@ -151,6 +162,7 @@ export class SubagentRetainLedger {
151
162
  abandon(parentToolCallId) {
152
163
  const e = this.entries.get(parentToolCallId);
153
164
  if (e !== undefined && this.entries.delete(parentToolCallId)) {
165
+ e.declarations.release();
154
166
  this.clearTtlTimer(parentToolCallId);
155
167
  this.flushDeferredNotify(e);
156
168
  this.tombstone(parentToolCallId);
@@ -161,6 +173,7 @@ export class SubagentRetainLedger {
161
173
  if (!e)
162
174
  return;
163
175
  this.entries.delete(parentToolCallId);
176
+ e.declarations.release();
164
177
  this.clearTtlTimer(parentToolCallId);
165
178
  this.flushDeferredNotify(e);
166
179
  this.tombstone(parentToolCallId);
@@ -133,7 +133,7 @@ export declare class MemoryRosterStore implements RosterStore {
133
133
  private entries;
134
134
  private readonly maxAgeMs;
135
135
  private readonly gc;
136
- constructor(opts?: RosterGcOptions);
136
+ constructor(options?: RosterGcOptions);
137
137
  record(entry: RosterEntry): void;
138
138
  resolve(name: string, access: RosterAccess): RosterEntry | undefined;
139
139
  list(): RosterEntry[];
@@ -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 { optionKeys, 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";
@@ -28,6 +29,8 @@ function resolveIn(entries, name, access) {
28
29
  return undefined;
29
30
  return latestOf(entries.filter((e) => normalizeAgentName(e.name) === key && entryAccessible(e, access)));
30
31
  }
32
+ const ROSTER_GC_OPTION_KEYS = optionKeys()({ onNotifyError: 0, maxAgeMs: 0, maxEntries: 0, onEvicted: 0 });
33
+ const FILE_ROSTER_STORE_OPTION_KEYS = optionKeys()({ onNotifyError: 0, maxAgeMs: 0, maxEntries: 0, onEvicted: 0, onCorruptRead: 0 });
31
34
  function freshOnly(entries, maxAgeMs, now = Date.now()) {
32
35
  if (maxAgeMs === undefined)
33
36
  return entries;
@@ -50,9 +53,10 @@ export class MemoryRosterStore {
50
53
  entries = [];
51
54
  maxAgeMs;
52
55
  gc;
53
- constructor(opts) {
56
+ constructor(options) {
57
+ const opts = receiveOptions(options, "MemoryRosterStore", ROSTER_GC_OPTION_KEYS);
54
58
  assertRetentionPolicy("RosterStore", opts);
55
- this.maxAgeMs = opts?.maxAgeMs;
59
+ this.maxAgeMs = opts.maxAgeMs;
56
60
  this.gc = opts;
57
61
  }
58
62
  record(entry) {
@@ -79,7 +83,8 @@ export class FileRosterStore {
79
83
  maxAgeMs;
80
84
  gc;
81
85
  onCorruptRead;
82
- constructor(path, opts) {
86
+ constructor(path, options) {
87
+ const opts = receiveOptions(options, "FileRosterStore", FILE_ROSTER_STORE_OPTION_KEYS);
83
88
  assertRetentionPolicy("RosterStore", opts);
84
89
  this.path = path;
85
90
  this.maxAgeMs = opts?.maxAgeMs;
@@ -20,7 +20,7 @@ export interface SendMessageToolOptions {
20
20
  /** design/122 D1 — the parent run's retain ledger (present only when `TaskSpec.retainSubagentSessions`
21
21
  * opted in). Absent ⇒ the tool stays mounted but every call returns the honest not-retained text. */
22
22
  retain?: SubagentRetainLedger;
23
- /** Registry access identity (mirrors TaskOutput's closure identity — the mount fills these). */
23
+ /** Registry access identity (mirrors TaskStop's closure identity — the mount fills these). */
24
24
  owner?: string;
25
25
  scope?: string;
26
26
  sessionId?: string;
@@ -33,34 +33,19 @@ export interface SendMessageToolOptions {
33
33
  /** Completion-notify sink for the resumed run. The Runner mount wires the SENDING run's own
34
34
  * notification injector here (its runtask-wrapped `injectTaskNotification`), so the completion
35
35
  * notice lands in the sender's live injection queue at a turn boundary; a direct mount may wire a
36
- * deployment-level background-notify sink instead. Absent ⇒ completion is silent. */
36
+ * deployment-level background-notify sink instead. A call's own run lane (`ctx.onTaskNotification`) wins over it —
37
+ * the one completion-sink resolution. With neither (and no {@link notificationWired} channel) continuing a finished
38
+ * agent is refused at the call: a continuation is a background run, and nothing would hear it complete. */
37
39
  notify?: (n: TaskNotificationPayload, opts?: {
38
40
  priority?: "now" | "next" | "later";
39
41
  }) => void;
40
- /** Whether a completion notification really reaches the sender — drives every "you will be notified"
41
- * sentence on this face (description + four receipts), mirroring TaskOutput's `notificationWired`.
42
- * Default = `notify !== undefined`, which is the truth on both the first-party mount and a direct
43
- * mount that wires its own sink here. Pass `true` only when the deployment announces a finished
44
- * agent through a channel of its own (this tool then keeps the wired wording); `false` states the
45
- * degraded truth explicitly. */
42
+ /** The sending run's result store, the pair of {@link notify}: a continued agent's cut completion is stored where that
43
+ * run's `ReadToolResult` reads. Absent ⇒ the cut says the full text is not readable from this session. */
44
+ taskArtifacts?: import("../core/tool-result-store.js").TaskArtifactSeat;
45
+ /** `true` when the deployment announces a finished agent through a channel of its own — the deployment-channel term
46
+ * of the one background admission: continuing a finished agent is then admitted without a sink here (its
47
+ * completion reaches the sender that way). Absent / `false` ⇒ only a resolved sink admits a continuation. */
46
48
  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
49
  /** Steer-handle sink: the revived run re-emits a FRESH handle (design/122 risk-table contract). */
65
50
  sink?: (handle: SubagentSteerHandle) => void;
66
51
  /**
@@ -96,7 +81,7 @@ export interface SendMessageToolOptions {
96
81
  * resolved fine). RB-409 opened the ctx route as well ({@link enrichCtx}), and the Runner mount
97
82
  * fills BOTH from the same internals chain; this seat remains the fallback (and the only route for
98
83
  * a host that wires the tool itself). A `ctx.parentTaskId` wins when present. SendMessage ONLY —
99
- * the TaskStop/TaskOutput mounts deliberately have no such seat (no widening of the kill/read
84
+ * the TaskStop mount deliberately has no such seat (no widening of the kill
100
85
  * surface). */
101
86
  parentTaskId?: string;
102
87
  /** RB-390 — companion session axis of {@link parentTaskId} (RunInternals.parentSessionId): a
@@ -178,7 +163,9 @@ export interface SendMessageToolOptions {
178
163
  /**
179
164
  * Subagent transcript persistence — the "declared durability contradicted by reality" disclosure
180
165
  * 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
166
+ * when a durable row with a bound sessionId meets a session store that attests `not_found` AND the
167
+ * mount's transcript tier declares transcript durability (`full`; under `rows` a gone transcript is the
168
+ * declared fate and the sink is not called). The
182
169
  * first-party mount wires an EngineNotice (`delegation.transcript_integrity`); absent ⇒ the
183
170
  * per-call honest refusal is the only loudness (unchanged behavior).
184
171
  */