@sema-agent/core 7.72.0 → 7.74.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 (375) hide show
  1. package/CHANGELOG.md +565 -0
  2. package/dist/agents/inherited-tool-pool.d.ts +26 -1
  3. package/dist/agents/inherited-tool-pool.js +46 -2
  4. package/dist/agents/list-agents-tool.js +1 -1
  5. package/dist/agents/parked-resume-drive.d.ts +10 -0
  6. package/dist/agents/parked-resume-drive.js +9 -0
  7. package/dist/agents/retain-ledger.d.ts +3 -0
  8. package/dist/agents/retain-ledger.js +3 -3
  9. package/dist/agents/send-message-tool.js +5 -4
  10. package/dist/agents/send-user-message-tool.d.ts +12 -0
  11. package/dist/agents/send-user-message-tool.js +67 -0
  12. package/dist/agents/subagent-steps.d.ts +9 -0
  13. package/dist/agents/subagent-steps.js +38 -0
  14. package/dist/agents/subagent.d.ts +2 -0
  15. package/dist/agents/subagent.js +43 -12
  16. package/dist/agents/verify.js +23 -8
  17. package/dist/agents/yield-adoption.js +3 -1
  18. package/dist/brain/anthropic.d.ts +42 -1
  19. package/dist/brain/anthropic.js +68 -13
  20. package/dist/brain/failover.d.ts +5 -0
  21. package/dist/brain/failover.js +51 -22
  22. package/dist/brain/model-lane.d.ts +12 -3
  23. package/dist/brain/model-lane.js +5 -5
  24. package/dist/brain/open-responses.js +7 -8
  25. package/dist/brain/openai.js +31 -24
  26. package/dist/brain/route-adjudicator.d.ts +33 -4
  27. package/dist/brain/route-adjudicator.js +49 -12
  28. package/dist/brain/stream-engine.js +166 -156
  29. package/dist/brain/stream-shared.d.ts +4 -3
  30. package/dist/brain/stream-shared.js +2 -2
  31. package/dist/core/actions-digest.d.ts +43 -0
  32. package/dist/core/actions-digest.js +22 -0
  33. package/dist/core/allow-entry.js +4 -4
  34. package/dist/core/ask-class.d.ts +2 -2
  35. package/dist/core/ask-headline.d.ts +1 -1
  36. package/dist/core/ask-origin.d.ts +44 -4
  37. package/dist/core/ask-origin.js +29 -10
  38. package/dist/core/auto-mode.d.ts +7 -9
  39. package/dist/core/auto-mode.js +114 -8
  40. package/dist/core/background-agent-store.d.ts +1 -0
  41. package/dist/core/background-agent-store.js +49 -8
  42. package/dist/core/checkpoint-features.d.ts +3 -2
  43. package/dist/core/checkpoint-features.js +1 -1
  44. package/dist/core/checkpoint-rekey.d.ts +1 -1
  45. package/dist/core/checkpoint-rekey.js +6 -1
  46. package/dist/core/checkpoint-requirements.d.ts +23 -3
  47. package/dist/core/checkpoint-requirements.js +5 -1
  48. package/dist/core/checkpoint-row-verdict.d.ts +1 -1
  49. package/dist/core/checkpoint-row-verdict.js +9 -3
  50. package/dist/core/checkpoint-store.d.ts +26 -2
  51. package/dist/core/checkpoint-store.js +9 -2
  52. package/dist/core/child-clamp-seats.d.ts +15 -0
  53. package/dist/core/child-clamp-seats.js +15 -0
  54. package/dist/core/config-refusal-codes.d.ts +1 -1
  55. package/dist/core/config-refusal-codes.js +1 -0
  56. package/dist/core/cron.js +9 -1
  57. package/dist/core/delegation-frames.d.ts +1 -0
  58. package/dist/core/delegation-frames.js +1 -1
  59. package/dist/core/deployment-shape.d.ts +7 -0
  60. package/dist/core/deployment-shape.js +19 -0
  61. package/dist/core/engine-capabilities.d.ts +13 -1
  62. package/dist/core/engine-capabilities.js +1 -1
  63. package/dist/core/engine-notice.d.ts +41 -28
  64. package/dist/core/engine-version.js +1 -1
  65. package/dist/core/entries-not-applied.d.ts +19 -7
  66. package/dist/core/entries-not-applied.js +33 -1
  67. package/dist/core/gate-fold.js +5 -4
  68. package/dist/core/gate-lanes.js +8 -12
  69. package/dist/core/gate-outcome.d.ts +8 -2
  70. package/dist/core/gate-outcome.js +10 -3
  71. package/dist/core/governance-codes.d.ts +14 -2
  72. package/dist/core/governance-codes.js +22 -6
  73. package/dist/core/hook-condition.d.ts +37 -0
  74. package/dist/core/hook-condition.js +567 -0
  75. package/dist/core/hooks.d.ts +5 -0
  76. package/dist/core/hooks.js +1 -0
  77. package/dist/core/host-instance.d.ts +23 -0
  78. package/dist/core/host-instance.js +69 -0
  79. package/dist/core/instruction-preview.d.ts +63 -0
  80. package/dist/core/instruction-preview.js +406 -0
  81. package/dist/core/leg-budget.d.ts +26 -0
  82. package/dist/core/leg-budget.js +9 -0
  83. package/dist/core/leg-identity.d.ts +51 -1
  84. package/dist/core/leg-identity.js +45 -2
  85. package/dist/core/manager-launch-check.d.ts +48 -0
  86. package/dist/core/manager-launch-check.js +64 -0
  87. package/dist/core/mcp-call-meta.d.ts +2 -2
  88. package/dist/core/mcp-injection-drop.d.ts +20 -10
  89. package/dist/core/mcp-injection-drop.js +9 -3
  90. package/dist/core/mcp-server-spec.d.ts +2 -1
  91. package/dist/core/member-outcome.d.ts +3 -2
  92. package/dist/core/member-outcome.js +1 -1
  93. package/dist/core/memory-engine/deletion-record.d.ts +46 -0
  94. package/dist/core/memory-engine/deletion-record.js +96 -0
  95. package/dist/core/memory-engine/engine.js +24 -16
  96. package/dist/core/memory-engine/file-backend.js +7 -5
  97. package/dist/core/memory-engine/projection-ledger.d.ts +1 -1
  98. package/dist/core/memory-engine/projection-ledger.js +1 -1
  99. package/dist/core/memory-engine/scope-contract.d.ts +18 -13
  100. package/dist/core/memory-engine/scope-contract.js +18 -18
  101. package/dist/core/memory-engine/sync-client.js +26 -6
  102. package/dist/core/memory-engine/sync.d.ts +20 -2
  103. package/dist/core/memory-engine/sync.js +18 -17
  104. package/dist/core/mode-policy.d.ts +25 -6
  105. package/dist/core/mode-policy.js +33 -8
  106. package/dist/core/model-seat.d.ts +8 -5
  107. package/dist/core/model-shell.d.ts +129 -0
  108. package/dist/core/model-shell.js +249 -0
  109. package/dist/core/mods/kernel/digest.d.ts +4 -0
  110. package/dist/core/mods/kernel/digest.js +5 -0
  111. package/dist/core/mods/kernel/dispatch.d.ts +3 -0
  112. package/dist/core/mods/kernel/dispatch.js +15 -6
  113. package/dist/core/mods/kernel/events.d.ts +21 -5
  114. package/dist/core/mods/kernel/events.js +19 -10
  115. package/dist/core/mods/kernel/hash-mirror.d.ts +1 -0
  116. package/dist/core/mods/kernel/hash-mirror.js +55 -0
  117. package/dist/core/mods/kernel/index.d.ts +1 -0
  118. package/dist/core/mods/kernel/index.js +1 -0
  119. package/dist/core/mods/kernel/package-reader.d.ts +48 -0
  120. package/dist/core/mods/kernel/package-reader.js +149 -0
  121. package/dist/core/mods/kernel/site-rules.d.ts +4 -0
  122. package/dist/core/mods/kernel/site-rules.js +13 -0
  123. package/dist/core/mods/package.d.ts +7 -3
  124. package/dist/core/mods/package.js +47 -80
  125. package/dist/core/own-property-receipt.js +11 -4
  126. package/dist/core/parent-spec-seat.d.ts +13 -11
  127. package/dist/core/parent-spec-seat.js +13 -9
  128. package/dist/core/peer-seat.js +3 -3
  129. package/dist/core/peer-task-store.d.ts +365 -0
  130. package/dist/core/peer-task-store.js +682 -0
  131. package/dist/core/permission-rule-consent.js +6 -11
  132. package/dist/core/permission-rule-model.d.ts +27 -0
  133. package/dist/core/permission-rule-model.js +33 -5
  134. package/dist/core/permission-rule-org.js +13 -3
  135. package/dist/core/permission-rule-provider.d.ts +35 -33
  136. package/dist/core/permission-rule-provider.js +38 -295
  137. package/dist/core/permission-rule-store.d.ts +181 -8
  138. package/dist/core/permission-rule-store.js +420 -17
  139. package/dist/core/permission-rule-sync.js +15 -1
  140. package/dist/core/permission-rules.js +4 -1
  141. package/dist/core/project-seat.d.ts +55 -0
  142. package/dist/core/project-seat.js +96 -0
  143. package/dist/core/protocol-http-auth.d.ts +3 -2
  144. package/dist/core/protocol-http-auth.js +26 -18
  145. package/dist/core/remote-env.d.ts +4 -4
  146. package/dist/core/retain-seat.d.ts +42 -0
  147. package/dist/core/retain-seat.js +76 -0
  148. package/dist/core/retired-keys.js +1 -0
  149. package/dist/core/rewind-refusal-codes.d.ts +8 -0
  150. package/dist/core/rewind-refusal-codes.js +12 -0
  151. package/dist/core/roles.d.ts +2 -2
  152. package/dist/core/roles.js +15 -1
  153. package/dist/core/rule-offer-read.d.ts +1 -1
  154. package/dist/core/rule-offer-read.js +32 -4
  155. package/dist/core/rule-store-fault.d.ts +9 -7
  156. package/dist/core/rule-store-fault.js +8 -3
  157. package/dist/core/run-ledger-seat.d.ts +66 -0
  158. package/dist/core/run-ledger-seat.js +70 -0
  159. package/dist/core/run-ledger.d.ts +332 -0
  160. package/dist/core/run-ledger.js +550 -0
  161. package/dist/core/runner/checkpoint-scope.d.ts +14 -3
  162. package/dist/core/runner/checkpoint-scope.js +16 -6
  163. package/dist/core/runner/compact-session.js +1 -1
  164. package/dist/core/runner/construction-doors.js +8 -0
  165. package/dist/core/runner/contracts.d.ts +21 -5
  166. package/dist/core/runner/cross-boundary-lane.d.ts +8 -1
  167. package/dist/core/runner/cross-boundary-lane.js +4 -0
  168. package/dist/core/runner/delegation-owner.d.ts +30 -0
  169. package/dist/core/runner/delegation-owner.js +20 -4
  170. package/dist/core/runner/finish-reason-seat.js +4 -2
  171. package/dist/core/runner/gate-exit.d.ts +7 -0
  172. package/dist/core/runner/gate-exit.js +2 -1
  173. package/dist/core/runner/leg-frame.js +3 -0
  174. package/dist/core/runner/model-lane-seat.d.ts +3 -0
  175. package/dist/core/runner/model-lane-seat.js +4 -0
  176. package/dist/core/runner/nested-memory-lane.d.ts +22 -5
  177. package/dist/core/runner/nested-memory-lane.js +91 -30
  178. package/dist/core/runner/person-path-rows.d.ts +27 -16
  179. package/dist/core/runner/person-path-rows.js +93 -15
  180. package/dist/core/runner/prepare-caps-and-workflow.js +98 -88
  181. package/dist/core/runner/prepare-config-doors.d.ts +1 -0
  182. package/dist/core/runner/prepare-config-doors.js +13 -7
  183. package/dist/core/runner/prepare-context-lane.js +1 -0
  184. package/dist/core/runner/prepare-delegation-surface.d.ts +3 -0
  185. package/dist/core/runner/prepare-delegation-surface.js +6 -0
  186. package/dist/core/runner/prepare-execution-env.d.ts +3 -3
  187. package/dist/core/runner/prepare-gate-stations.d.ts +6 -0
  188. package/dist/core/runner/prepare-gate-stations.js +3 -1
  189. package/dist/core/runner/prepare-hands-readface.d.ts +5 -2
  190. package/dist/core/runner/prepare-hands-readface.js +15 -3
  191. package/dist/core/runner/prepare-inherited-gate.d.ts +6 -3
  192. package/dist/core/runner/prepare-inherited-gate.js +13 -5
  193. package/dist/core/runner/prepare-offload-wrappers.js +1 -1
  194. package/dist/core/runner/prepare-run-refs.d.ts +1 -1
  195. package/dist/core/runner/prepare-run-refs.js +3 -2
  196. package/dist/core/runner/prepare-suspend-saga.d.ts +6 -2
  197. package/dist/core/runner/prepare-suspend-saga.js +4 -2
  198. package/dist/core/runner/prepare-task.js +42 -30
  199. package/dist/core/runner/prepare-turn-wiring.d.ts +4 -3
  200. package/dist/core/runner/prepare-turn-wiring.js +2 -1
  201. package/dist/core/runner/prepare-wiring-manifest.d.ts +3 -1
  202. package/dist/core/runner/prepare-wiring-manifest.js +8 -6
  203. package/dist/core/runner/resume-apply.js +11 -5
  204. package/dist/core/runner/resume-policy-outcome.js +5 -2
  205. package/dist/core/runner/resume-review-outcome.d.ts +3 -0
  206. package/dist/core/runner/resume-review-outcome.js +24 -1
  207. package/dist/core/runner/role-seat-defaulted.d.ts +3 -3
  208. package/dist/core/runner/role-seat-defaulted.js +1 -1
  209. package/dist/core/runner/rule-store-unreadable-notice.d.ts +1 -1
  210. package/dist/core/runner/rule-store-unreadable-notice.js +3 -3
  211. package/dist/core/runner/run-harness-handlers.js +4 -1
  212. package/dist/core/runner/run-identity-wiring.js +3 -2
  213. package/dist/core/runner/run-leg.js +5 -2
  214. package/dist/core/runner/run-notification-lane.js +20 -1
  215. package/dist/core/runner/run-settle-and-teardown.js +21 -12
  216. package/dist/core/runner/run-stop-and-final-verify.js +6 -0
  217. package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
  218. package/dist/core/runner/runtask.d.ts +6 -2
  219. package/dist/core/runner/runtask.js +21 -9
  220. package/dist/core/runner/shell-env-withheld.d.ts +6 -4
  221. package/dist/core/runner/shell-env-withheld.js +25 -3
  222. package/dist/core/runner/stop-tail-notice.d.ts +10 -2
  223. package/dist/core/runner/stop-tail-notice.js +9 -2
  224. package/dist/core/runner/stream-settle-backstop.d.ts +1 -0
  225. package/dist/core/runner/stream-settle-backstop.js +1 -0
  226. package/dist/core/runner/sub-agent-deny-lists.js +9 -5
  227. package/dist/core/runner/task-start-doors.js +6 -3
  228. package/dist/core/runner/terminal-account.d.ts +6 -1
  229. package/dist/core/runner/terminal-account.js +16 -1
  230. package/dist/core/runner/tool-end-body.d.ts +1 -1
  231. package/dist/core/runner/tool-not-executed.d.ts +27 -8
  232. package/dist/core/runner/tool-not-executed.js +22 -11
  233. package/dist/core/runner/unreadable-person-rows.d.ts +2 -1
  234. package/dist/core/runner/write-protection-station.d.ts +1 -1
  235. package/dist/core/runner/write-protection-station.js +1 -1
  236. package/dist/core/runner-deps.d.ts +17 -10
  237. package/dist/core/secret-env.d.ts +61 -37
  238. package/dist/core/secret-env.js +49 -49
  239. package/dist/core/session-checkout.d.ts +3 -0
  240. package/dist/core/session-checkout.js +1 -0
  241. package/dist/core/session-store.d.ts +12 -6
  242. package/dist/core/session-store.js +26 -6
  243. package/dist/core/session.d.ts +31 -8
  244. package/dist/core/shell-read-silence.d.ts +40 -2
  245. package/dist/core/shell-read-silence.js +23 -4
  246. package/dist/core/store-contracts/checkpoint-store-contract.js +10 -0
  247. package/dist/core/store-contracts/peer-task-store-contract.d.ts +21 -0
  248. package/dist/core/store-contracts/peer-task-store-contract.js +516 -0
  249. package/dist/core/store-contracts/session-store-contract.d.ts +15 -2
  250. package/dist/core/store-contracts/session-store-contract.js +87 -3
  251. package/dist/core/store-contracts/workflow-journal-store-contract.d.ts +19 -1
  252. package/dist/core/store-contracts/workflow-journal-store-contract.js +89 -1
  253. package/dist/core/task-event.d.ts +14 -7
  254. package/dist/core/task-notification.d.ts +96 -10
  255. package/dist/core/task-notification.js +135 -6
  256. package/dist/core/task-registry-agent.d.ts +1 -0
  257. package/dist/core/task-registry-agent.js +1 -1
  258. package/dist/core/task-registry-shared.d.ts +12 -1
  259. package/dist/core/task-registry-shared.js +3 -1
  260. package/dist/core/task-registry-workflow.d.ts +1 -1
  261. package/dist/core/task-registry-workflow.js +9 -1
  262. package/dist/core/task-registry.d.ts +40 -2
  263. package/dist/core/task-registry.js +80 -15
  264. package/dist/core/task-result.d.ts +18 -3
  265. package/dist/core/task-spec-members.d.ts +3 -1
  266. package/dist/core/task-spec-members.js +19 -3
  267. package/dist/core/task-spec.d.ts +48 -22
  268. package/dist/core/tool-catalog-entries.js +2 -0
  269. package/dist/core/tool-gate-phase.d.ts +6 -3
  270. package/dist/core/tool-gate-phase.js +1 -0
  271. package/dist/core/tool-mount-facts.d.ts +8 -4
  272. package/dist/core/tool-mount-facts.js +7 -2
  273. package/dist/core/tool-mount-plan.d.ts +3 -1
  274. package/dist/core/tool-mount-plan.js +10 -3
  275. package/dist/core/tool-mount-static.d.ts +1 -1
  276. package/dist/core/tool-mount-static.js +4 -2
  277. package/dist/core/tool-result-store.d.ts +56 -3
  278. package/dist/core/tool-result-store.js +219 -25
  279. package/dist/core/tool-spec.d.ts +9 -2
  280. package/dist/core/trace.d.ts +3 -3
  281. package/dist/core/user-attachment.d.ts +5 -1
  282. package/dist/core/user-attachment.js +14 -7
  283. package/dist/core/wiring-manifest.d.ts +26 -20
  284. package/dist/core/wiring-manifest.js +7 -3
  285. package/dist/core/workflow-journal-store.d.ts +53 -10
  286. package/dist/core/workflow-journal-store.js +27 -4
  287. package/dist/core/workflow-run-store-contract.js +16 -0
  288. package/dist/core/workflow-run-store.d.ts +9 -7
  289. package/dist/core/workflow-run-store.js +4 -1
  290. package/dist/engine/execution-env/node-execution-env.d.ts +75 -1
  291. package/dist/engine/execution-env/node-execution-env.js +227 -13
  292. package/dist/engine/harness/types.d.ts +49 -1
  293. package/dist/engine/harness/types.js +10 -0
  294. package/dist/engine/llm/types.d.ts +13 -7
  295. package/dist/engine/llm/validation.d.ts +8 -1
  296. package/dist/engine/llm/validation.js +31 -2
  297. package/dist/engine/lsp/node-lsp-manager.js +2 -1
  298. package/dist/engine/session/import-validate.js +6 -1
  299. package/dist/engine/session/session.d.ts +15 -2
  300. package/dist/engine/session/session.js +34 -4
  301. package/dist/host-env.d.ts +10 -0
  302. package/dist/host-env.js +1 -0
  303. package/dist/index.d.ts +28 -9
  304. package/dist/index.js +22 -6
  305. package/dist/internal/harness-types.d.ts +1 -1
  306. package/dist/orchestration/goal.js +1 -1
  307. package/dist/orchestration/run-workflow-tool.js +40 -32
  308. package/dist/orchestration/workflow-park-adoption.d.ts +51 -12
  309. package/dist/orchestration/workflow-park-adoption.js +47 -12
  310. package/dist/orchestration/workflow-primitives.js +10 -1
  311. package/dist/orchestration/workflow-script-runner.d.ts +2 -2
  312. package/dist/orchestration/workflow-stop.d.ts +128 -0
  313. package/dist/orchestration/workflow-stop.js +156 -0
  314. package/dist/orchestration/workflow.d.ts +31 -7
  315. package/dist/orchestration/workflow.js +119 -57
  316. package/dist/prompts/manager-recipe.d.ts +18 -0
  317. package/dist/prompts/manager-recipe.js +24 -0
  318. package/dist/shell/lex.d.ts +2 -2
  319. package/dist/shell/lex.js +1 -1
  320. package/dist/stores/file/permission-rule-store.d.ts +3 -1
  321. package/dist/stores/file/permission-rule-store.js +0 -1
  322. package/dist/stores/file/workflow-journal-store.d.ts +16 -3
  323. package/dist/stores/file/workflow-journal-store.js +93 -5
  324. package/dist/stores/file/workflow-run-store.d.ts +1 -1
  325. package/dist/tools/fs/bash-model-shell.d.ts +23 -0
  326. package/dist/tools/fs/bash-model-shell.js +25 -0
  327. package/dist/tools/fs/bash-readonly-classifier.d.ts +6 -0
  328. package/dist/tools/fs/bash-readonly-classifier.js +3 -0
  329. package/dist/tools/fs/file-write-check.js +9 -3
  330. package/dist/tools/fs/fs-bash.js +13 -11
  331. package/dist/tools/fs/index.d.ts +8 -7
  332. package/dist/tools/fs/index.js +4 -4
  333. package/dist/tools/fs/read-deny-home.d.ts +1 -1
  334. package/dist/tools/fs/read-deny-home.js +5 -5
  335. package/dist/tools/fs/read-deny.d.ts +33 -8
  336. package/dist/tools/fs/read-deny.js +114 -25
  337. package/dist/tools/fs/safety.d.ts +4 -1
  338. package/dist/tools/fs/safety.js +4 -2
  339. package/dist/tools/fs/shell-read-argv.js +1 -0
  340. package/dist/tools/fs/shell-read-check.d.ts +9 -2
  341. package/dist/tools/fs/shell-read-check.js +134 -22
  342. package/dist/tools/fs/shell-read-establish.d.ts +9 -0
  343. package/dist/tools/fs/shell-read-establish.js +21 -11
  344. package/dist/tools/fs/shell-read-judge.d.ts +13 -1
  345. package/dist/tools/fs/shell-read-judge.js +26 -7
  346. package/dist/tools/fs/shell-read-plan.d.ts +7 -3
  347. package/dist/tools/fs/shell-read-plan.js +8 -5
  348. package/dist/tools/fs/shell-read-word.d.ts +8 -0
  349. package/dist/tools/fs/shell-read-word.js +13 -4
  350. package/dist/tools/fs/shell-read-write-targets.js +17 -9
  351. package/dist/tools/monitor.js +12 -8
  352. package/dist/tools/scheduler-tools.d.ts +1 -0
  353. package/dist/tools/scheduler-tools.js +5 -2
  354. package/package.json +3 -2
  355. package/test/export-surface.snapshot.json +192 -3
  356. package/wire-changes/answers/core-stores-sql@7.73.0.json +28 -0
  357. package/wire-changes/answers/core-stores-sql@7.74.0.json +7 -0
  358. package/wire-changes/answers/core@7.73.0.json +216 -0
  359. package/wire-changes/answers/core@7.74.0.json +68 -0
  360. package/wire-changes/answers/mods-kernel@7.73.0.json +7 -0
  361. package/wire-changes/answers/mods-kernel@7.74.0.json +21 -0
  362. package/wire-changes/answers/primitives@7.73.0.json +12 -0
  363. package/wire-changes/answers/primitives@7.74.0.json +7 -0
  364. package/wire-changes/answers/wiki-gate@7.73.0.json +7 -0
  365. package/wire-changes/answers/wiki-gate@7.74.0.json +8 -0
  366. package/wire-changes/core-stores-sql@7.73.0.json +326 -0
  367. package/wire-changes/core-stores-sql@7.74.0.json +143 -0
  368. package/wire-changes/core@7.73.0.json +6480 -0
  369. package/wire-changes/core@7.74.0.json +2210 -0
  370. package/wire-changes/mods-kernel@7.73.0.json +147 -0
  371. package/wire-changes/mods-kernel@7.74.0.json +421 -0
  372. package/wire-changes/primitives@7.73.0.json +227 -0
  373. package/wire-changes/primitives@7.74.0.json +174 -0
  374. package/wire-changes/wiki-gate@7.73.0.json +145 -0
  375. package/wire-changes/wiki-gate@7.74.0.json +145 -0
@@ -2,8 +2,9 @@ import { CheckpointError } from "../checkpoint-store.js";
2
2
  import { isGateKind, PAUSE_REGISTRY, resumeGateMatches } from "../pause-registry.js";
3
3
  import { sanitizeUntrustedText, sentinelTagRefusal } from "../untrusted-text.js";
4
4
  import { assertOutcomeText, captureHostDecision, describeSuppliedValue, refuseSuppliedKeys, SUPPLIED_RECORD_KEY } from "./decide-continuation.js";
5
+ import { isPermissionMode, PERMISSION_MODES } from "../ask-origin.js";
5
6
  export function resumeReviewOutcome(input) {
6
- const { cp, outcome, outcomeGate, wakeMessage } = input;
7
+ const { cp, outcome, outcomeGate, wakeMessage, configPermissionMode } = input;
7
8
  const gateMatch = isGateKind(cp.gate.kind) && resumeGateMatches(cp.gate.kind, outcomeGate);
8
9
  if (!gateMatch) {
9
10
  throw new CheckpointError("checkpoint.gate_mismatch", `resume outcome (gate "${describeSuppliedValue(outcomeGate)}") does not match checkpoint gate "${cp.gate.kind}" — resume serves ${Object.entries(PAUSE_REGISTRY)
@@ -17,6 +18,7 @@ export function resumeReviewOutcome(input) {
17
18
  const decision = decide.decision;
18
19
  const editedPlan = decide.editedPlan;
19
20
  const reason = decide.reason;
21
+ const permissionMode = decide.permissionMode;
20
22
  if (decision !== "approve" && decision !== "edit" && decision !== "reject") {
21
23
  throw new CheckpointError("checkpoint.invalid_outcome", `resume decision "${describeSuppliedValue(decision)}" is outside the plan_review domain — a plan review is exactly "approve", "edit" or "reject"; refusing pre-CAS, the checkpoint stays pending`);
22
24
  }
@@ -24,11 +26,15 @@ export function resumeReviewOutcome(input) {
24
26
  const hostDecision = captureHostDecision(cp, decide.hostDecision, "plan_review", { word: decision, allows: decision !== "reject" });
25
27
  assertOutcomeText(editedPlan, "editedPlan");
26
28
  assertOutcomeText(reason, "reason");
29
+ const modeRefusal = planApprovalModeRefusal(permissionMode, decision, configPermissionMode);
30
+ if (modeRefusal !== undefined)
31
+ throw new CheckpointError("checkpoint.invalid_outcome", `${modeRefusal}; refusing pre-CAS, the checkpoint stays pending`);
27
32
  plainReviewOutcome = {
28
33
  gate: "plan_review",
29
34
  decision,
30
35
  ...(editedPlan !== undefined ? { editedPlan } : {}),
31
36
  ...(reason !== undefined ? { reason } : {}),
37
+ ...(permissionMode !== undefined ? { permissionMode: permissionMode } : {}),
32
38
  hostDecision,
33
39
  };
34
40
  }
@@ -71,6 +77,10 @@ export function resumeReviewOutcome(input) {
71
77
  if (winner.reason !== undefined && winner.reason !== plainReviewOutcome.reason) {
72
78
  throw new CheckpointError("checkpoint.reopen_revote", "an env_failed reopen replays the ALREADY-RECORDED review decision — refusing a re-vote whose reviewer note differs from the recorded one");
73
79
  }
80
+ const replayedMode = plainReviewOutcome.gate === "plan_review" ? plainReviewOutcome.permissionMode : undefined;
81
+ if (winner.permissionMode !== undefined && winner.permissionMode !== replayedMode) {
82
+ throw new CheckpointError("checkpoint.reopen_revote", `an env_failed reopen replays the ALREADY-RECORDED review decision — refusing a re-vote whose approved mode ("${describeSuppliedValue(replayedMode)}") differs from the recorded one ("${winner.permissionMode}")`);
83
+ }
74
84
  }
75
85
  }
76
86
  let plainParkOutcome;
@@ -89,3 +99,16 @@ export function resumeReviewOutcome(input) {
89
99
  }
90
100
  return { plainReviewOutcome, plainParkOutcome };
91
101
  }
102
+ function planApprovalModeRefusal(mode, decision, configMode) {
103
+ if (mode === undefined)
104
+ return undefined;
105
+ if (!isPermissionMode(mode))
106
+ return `plan_review permissionMode "${describeSuppliedValue(mode)}" is not one of ${PERMISSION_MODES.map((w) => JSON.stringify(w)).join(", ")}`;
107
+ if (mode === "plan")
108
+ return 'plan_review permissionMode "plan" would keep an approved plan open — name the mode the plan runs under, or leave it out';
109
+ if (decision === "reject")
110
+ return "plan_review permissionMode names the mode an approved plan runs under, and a reject approves none — leave it out";
111
+ if (configMode !== undefined && configMode !== "plan" && configMode !== mode)
112
+ return `plan_review permissionMode "${mode}" contradicts the resume config's permissionMode "${configMode}" — name the mode once`;
113
+ return undefined;
114
+ }
@@ -11,9 +11,9 @@
11
11
  * `classifier.role_defaulted`) are never named here.
12
12
  *
13
13
  * The word may be a TIER the deployment's tiers leave absent (nothing bound at that tier or below it, #2614): the same reading and the same
14
- * chain, with `reason: "tier_unbound"` where a name the catalog does not hold says `"unknown_model_ref"` (the `summarize` line then leaves out
15
- * "or the tier default for that role" when that role's own tier default is the absent one: the compaction pass is on the conversation's
16
- * own model). A role whose own tier DEFAULT is absent while its seat names nothing is said nowhere — nothing was stated that went unmet; the
14
+ * chain, with `reason: "tier_unbound"` where a name the catalog does not hold says `"unknown_model_ref"` (the `summarize` line says "or the tier
15
+ * default for that role" only while that role's own tier default is bound, whatever the cause: with none declared or none bound there, the
16
+ * compaction pass is on the conversation's own model). A role whose own tier DEFAULT is absent while its seat names nothing is said nowhere — nothing was stated that went unmet; the
17
17
  * walk goes on to the next role of its chain (`roleHop`, `src/core/roles.ts`).
18
18
  *
19
19
  * Root legs only: a delegated child inherits the deployment's maps and would repeat the parent's line once per spawn.
@@ -14,7 +14,7 @@ export function roleDefaultedNotice(u, ids) {
14
14
  const shown = bindingShown(u.word);
15
15
  const reason = u.cause === "tier_unbound" ? "tier_unbound" : "unknown_model_ref";
16
16
  const absent = reason === "tier_unbound" ? absentTierReading(u.word) : undefined;
17
- const standsIn = (STANDS_IN[u.role] ?? "its fallback chain decides") + (u.role === "summarize" && !(absent !== undefined && u.ownTierAbsent === true) ? TIER_DEFAULT_STANDS_IN : "");
17
+ const standsIn = (STANDS_IN[u.role] ?? "its fallback chain decides") + (u.role === "summarize" && u.ownTierBound ? TIER_DEFAULT_STANDS_IN : "");
18
18
  return {
19
19
  code: "config.entries_not_applied",
20
20
  message: absent !== undefined
@@ -7,7 +7,7 @@ import { type AnnounceOnceLedger } from "./announce-once-ledger.js";
7
7
  * told where the mode answers it unasked; the person is told by the run's row notice (`config.entries_not_applied`, kind `stored_rule_row`), not here. A read
8
8
  * is told once the mode has settled ({@link PermissionModeController.whenArmed}) — the run's start read comes before the deployment's
9
9
  * arming facts bind, and a mode the arming folds back (`auto` with no classifier wired, a relaxed mode the deployment denies) would read
10
- * as itself then, the person left untold and the operator's line naming a mode the leg does not run under. A call's read finds the mode
10
+ * as itself then, the person's sentence stating the wrong cost and the operator's line naming a mode the leg does not run under. A call's read finds the mode
11
11
  * settled and tells at once. */
12
12
  export declare function ruleStoreUnreadableNotice(onNotice: RunnerDeps["onNotice"], ids: {
13
13
  readonly sessionId: string;
@@ -8,19 +8,19 @@ export function ruleStoreUnreadableNotice(onNotice, ids, record, modeSeat) {
8
8
  const tell = (at, faults, rows) => {
9
9
  const mode = modeSeat.observed;
10
10
  const data = faults.map((f) => ({ sources: [...f.sources], reason: f.reason }));
11
- if (modeAnswersUnasked(mode, "rule_unreadable")) {
11
+ const relaxed = modeAnswersUnasked(mode, "rule_unreadable");
12
+ if (relaxed) {
12
13
  record.oncePerSession(announceDigest(RULE_STORE_UNREADABLE_RELAXED, `${mode}\n${rows !== undefined ? "rows\n" : ""}${ruleStoreFaultsKey(faults)}`), () => deliverEngineNotice(onNotice, {
13
14
  code: RULE_STORE_UNREADABLE_RELAXED,
14
15
  message: ruleStoreUnreadableRelaxedSentence(mode, at, faults, rows),
15
16
  detail: { at, mode, sessionId: ids.sessionId, runId: ids.runId, faults: data },
16
17
  }));
17
- return;
18
18
  }
19
19
  if (rows !== undefined)
20
20
  return;
21
21
  record.oncePerSession(announceDigest(RULE_STORE_UNAVAILABLE, ruleStoreFaultsKey(faults)), () => deliverEngineNotice(onNotice, {
22
22
  code: RULE_STORE_UNAVAILABLE,
23
- message: ruleStoreUnreadableNoticeSentence(at, faults),
23
+ message: ruleStoreUnreadableNoticeSentence(at, faults, relaxed ? mode : undefined),
24
24
  detail: { at, sessionId: ids.sessionId, runId: ids.runId, faults: data },
25
25
  }));
26
26
  };
@@ -67,6 +67,9 @@ export function createHarnessHandlers(input) {
67
67
  else if (ev.type === "thinking_delta" && ev.delta) {
68
68
  pushContent({ type: "reasoning_delta", delta: ev.delta, ...ident() });
69
69
  }
70
+ else if (ev.type === "thinking_end" && typeof ev.content === "string" && ev.content.length !== 0) {
71
+ pushContent({ type: "reasoning_end", content: ev.content, ...ident() });
72
+ }
70
73
  if (callsModel && rs.budget.streamCancel && !rs.limits.budgetHit && (ev.type === "text_delta" || ev.type === "thinking_delta") && ev.delta) {
71
74
  rs.budget.callOutputChars += ev.delta.length;
72
75
  if (rs.budget.callOutputChars - rs.budget.lastStreamBudgetCheck >= 256) {
@@ -278,7 +281,7 @@ export function createHarnessHandlers(input) {
278
281
  }, frames);
279
282
  if (settled.gate?.disposition.kind === "denied")
280
283
  noteExtensionCallDenied(prepared.modBus, event.toolCallId);
281
- stampRowNotExecuted(event.result, settled.notExecuted === true);
284
+ stampRowNotExecuted(event.result, settled);
282
285
  emitTrace(rs.telemetry.tracer, () => ({
283
286
  kind: "tool.call",
284
287
  version: 1,
@@ -5,7 +5,7 @@ import { createSnapshotFrameSeat } from "../snapshot-frame-seat.js";
5
5
  import { emitsChildRowFrames, taskStartedFrame } from "../delegation-frames.js";
6
6
  import { recordFrameReceipt, toolResultReceiptKey } from "../frame-settlement.js";
7
7
  import { createReceivingChain } from "../mods/session-receive.js";
8
- import { discloseDroppedPending, isSystemInjectionPriority, parkAtSeat, renderTaskNotificationXml, sessionAddressOf, taskNotificationDedupKey, taskNotificationFrame, taskNotificationNoteOptions } from "../task-notification.js";
8
+ import { discloseDroppedPending, isSystemInjectionPriority, isTerminalTaskNotification, parkAtSeat, renderTaskNotificationXml, sessionAddressOf, taskNotificationDedupKey, taskNotificationFrame, taskNotificationNoteOptions } from "../task-notification.js";
9
9
  import { buildAppliedHumanInputEvent } from "../human-input-projection.js";
10
10
  import { announceAcceptance, nextHumanInputSeq } from "./steer-admission.js";
11
11
  import { deliverDelegationLifecycle, deliverEngineNotice, parentLegIds, parkedInputIdsOf, undrainedUserInputNotices } from "../types.js";
@@ -55,7 +55,7 @@ export function runIdentityWiring(input) {
55
55
  deliverDelegationLifecycle(runner.deps.onDelegationLifecycle, event, delegationLifecycleNotifier, "runtask.onDelegationLifecycle", runner.deps.onNotice);
56
56
  };
57
57
  if (emitsChildRowFrames(prepared.hookIdentity) && (resume === undefined || resume.opensCycle === true)) {
58
- const started = taskStartedFrame({ taskId: runSourceTaskId, sessionId: prepared.sessionId, model: prepared.model.id, identity: prepared.hookIdentity }, internals, ident());
58
+ const started = taskStartedFrame({ taskId: runSourceTaskId, sessionId: prepared.sessionId, model: prepared.model.id, identity: prepared.hookIdentity, startedAt: prepared.legStartedAt }, internals, ident());
59
59
  queue.push(started);
60
60
  forwardSafely(internals, started);
61
61
  emitDelegationLifecycle({ phase: "spawn", identity: prepared.hookIdentity });
@@ -154,6 +154,7 @@ export function runIdentityWiring(input) {
154
154
  for (const payload of discloseDroppedPending(pendingIdle, prepared.taskReadHandleOf, () => prepared.listBackgroundTasks({ settled: true }))) {
155
155
  const parkedPriority = pendingIdle.priorities?.get(payload);
156
156
  deliveredAtTurnOpen.add(taskNotificationDedupKey(payload));
157
+ prepared.runLedgerBook?.observeFrame(payload, isTerminalTaskNotification(payload));
157
158
  queue.push({ ...taskNotificationFrame(payload, parkedPriority), ...ident() });
158
159
  const handOver = (shown) => {
159
160
  void prepared.harness.nextTurn(renderTaskNotificationXml(shown), taskNotificationNoteOptions(payload, parkedPriority)).catch(() => {
@@ -761,11 +761,11 @@ async function resolvePendingCall(runner, prepared, resume, emit, emitCommitted,
761
761
  announceToolCall(occurrences, callStart, { push: emit });
762
762
  const decidedInput = frozenInputSnapshot(resolvedArgs);
763
763
  occurrences.gateRound(pendingAction.toolCallId, decidedGate, decidedInput);
764
- let notExecuted = false;
764
+ let notExecuted;
765
765
  const resultRow = (text, isError) => withRowNotExecuted(toolResultMsg(pendingAction.toolCallId, pendingAction.toolName, text, isError), notExecuted);
766
766
  const settleEnd = async (isError, result, neverRan) => {
767
767
  const settled = emitSettled(occurrences, callStart, { result, isError, ...(neverRan ? { notExecuted: true } : {}) }, { push: emit, structured: prepared.structuredProjector, mediaBudgetBase64Chars: runner.deps.mediaBudgetBase64Chars, reviewRequest: prepared.reviewRequestRef, verdicts: prepared.verdictLedger });
768
- notExecuted = settled.notExecuted === true;
768
+ notExecuted = settled;
769
769
  const gate = settled.gate ?? decidedGate;
770
770
  const word = await resume.recordExecutionOutcome(gate);
771
771
  settleExecutionRecord(runner.deps.onNotice, word, { toolName: pendingAction.toolName, gate, sessionId: prepared.sessionId, runId: prepared.runId, scope: resume.cp.scope, identity: readGateIdentity(resume.cp.checkpointId, resume.cp.token) });
@@ -959,6 +959,7 @@ async function resolvePendingCall(runner, prepared, resume, emit, emitCommitted,
959
959
  const args = structuredClone(executedArgs);
960
960
  screened?.admit();
961
961
  onExecuteStart?.(pendingAction.toolCallId);
962
+ prepared.runLedgerBook?.callResumed(pendingAction.toolCallId);
962
963
  occurrences.release(pendingAction.toolCallId);
963
964
  prepared.suspendProgressRef.executedApproved = true;
964
965
  const finalize = (executed) => prepared.harness.finalizeToolCall({ type: "toolCall", id: pendingAction.toolCallId, name: spelledName, arguments: executedArgs }, executedArgs, executed);
@@ -973,12 +974,14 @@ async function resolvePendingCall(runner, prepared, resume, emit, emitCommitted,
973
974
  const failed = await finalize({ result: { content: [{ type: "text", text: execError }], details: marks ?? {} }, isError: true });
974
975
  const failedText = failed.result.content.flatMap((c) => (c.type === "text" ? [c.text] : [])).join("\n");
975
976
  await settleEnd(true, { content: failedText, ...(marks !== undefined ? { details: marks } : {}) });
977
+ prepared.runLedgerBook?.callEnded(pendingAction.toolCallId);
976
978
  const eid = await appendAdmittedRow(prepared.admitRows, prepared.session, resultRow(failedText, true));
977
979
  emitCommitted(eid, "toolResult", pendingAction.toolCallId);
978
980
  return;
979
981
  }
980
982
  const ran = await finalize({ result: res, isError: res.isError === true });
981
983
  await settleEnd(ran.isError, ran.result);
984
+ prepared.runLedgerBook?.callEnded(pendingAction.toolCallId);
982
985
  onResolvedToolSuccess?.(pendingAction.toolName, ran.isError ? undefined : ran.result.details);
983
986
  const eid = await appendAdmittedRow(prepared.admitRows, prepared.session, {
984
987
  role: "toolResult",
@@ -3,6 +3,9 @@ import { boundInputHashOf } from "../canonical-json.js";
3
3
  import { readPendingSteerQueue } from "../checkpoint-store.js";
4
4
  import { scopeKeyOf } from "../isolation-scope.js";
5
5
  import { wakeOpening } from "../run-origin.js";
6
+ import { runLedgerBookFor } from "../run-ledger.js";
7
+ import { bindRunLedgerBook } from "../run-ledger-seat.js";
8
+ import { rootAnchorOf } from "../leg-identity.js";
6
9
  import { bindDeliveryObligations, createLiveNotificationLane, DeliveryObligations, DurableAppendObligations, injectionLaneOf, isDelegatedAgentTerminal, isTerminalTaskNotification, renderTaskNotificationXml, routeOrParkNotification, sessionAddressOf, SystemInjectionQueue, taskNotificationDedupKey, taskNotificationFrame, taskNotificationNoteOptions } from "../task-notification.js";
7
10
  import { settleConsumedFrame, settleUndeliveredFrame } from "../frame-settlement.js";
8
11
  import { createReceivingChain } from "../mods/session-receive.js";
@@ -85,6 +88,7 @@ async function runNotificationLaneAs(input, obligations) {
85
88
  };
86
89
  const receiving = createReceivingChain(() => prepared.receiveSeat);
87
90
  const unsubscribeTaskNotifications = taskNotificationQueue.subscribe((item) => {
91
+ runLedgerBook?.observeFrame(item.payload, isTerminalTaskNotification(item.payload));
88
92
  queue.push({ ...taskNotificationFrame(item.payload, item.priority), ...notificationIdent() });
89
93
  receiving.pass(item.payload, {
90
94
  handOver: (shown) => handOver(item, shown),
@@ -124,7 +128,13 @@ async function runNotificationLaneAs(input, obligations) {
124
128
  });
125
129
  const takeOnThisLane = laneSeat.take;
126
130
  const takeAsDestination = laneSeat.takeAsDestination;
131
+ const refusePeerTaskFrame = (notification) => {
132
+ runner.deps.onError?.(new Error(`peer_task notification ${notification.task_id} refused: no peer-task producer is active on this lane in this engine release`), { phase: "degraded", sessionId: notificationAddress?.sessionId ?? "", classification: "peer-task-frame-refused" });
133
+ return Promise.resolve("refused");
134
+ };
127
135
  const injectTaskNotification = (notification, opts) => {
136
+ if (notification.task_type === "peer_task")
137
+ return refusePeerTaskFrame(notification);
128
138
  const priority = opts?.priority ?? "later";
129
139
  return new Promise((resolve) => {
130
140
  const own = takeOnThisLane(notification, priority, resolve);
@@ -140,14 +150,20 @@ async function runNotificationLaneAs(input, obligations) {
140
150
  const peerInboundChainRef = internals?.peerInboundChainRef ?? createPeerInboundChainRef();
141
151
  const modelCatalog = runner.deps.models;
142
152
  const deliveryObligations = new DeliveryObligations();
153
+ const runLedgerBook = runLedgerBookFor(spec, resume !== undefined ? { section: resume.cp.state.runLedger } : undefined, internals?.rowTaskId);
154
+ if (taskIdRef !== undefined && runLedgerBook?.taskId !== undefined)
155
+ taskIdRef.current = runLedgerBook.taskId;
143
156
  const laneSink = (notification, opts) => {
157
+ if (notification.task_type === "peer_task")
158
+ return refusePeerTaskFrame(notification);
144
159
  try {
145
160
  upstreamTaskNotification?.(notification, opts);
146
161
  }
147
162
  catch {
148
163
  }
164
+ const terminal = isTerminalTaskNotification(notification);
149
165
  const outcome = injectTaskNotification(notification, opts);
150
- if (isTerminalTaskNotification(notification))
166
+ if (terminal)
151
167
  deliveryObligations.discharge(notification);
152
168
  return outcome;
153
169
  };
@@ -162,8 +178,11 @@ async function runNotificationLaneAs(input, obligations) {
162
178
  sessionReadStates,
163
179
  sessionModeSeats, sessionFastModeSeats, sessionPromptSeats, sessionMcpPools,
164
180
  onTaskNotification: laneSink,
181
+ runLedgerBook,
165
182
  }, self, taskIdRef, holdSessionLock, legWrites, (destination, delivery) => pendingSessionNotifications.discardsStaleNotice(destination, delivery), promptSubmitRef, runEnd);
166
183
  settlementSeat = prepared.frameSettlement;
184
+ if (runLedgerBook !== undefined)
185
+ bindRunLedgerBook(runLedgerBook, prepared, rootAnchorOf(internals, prepared.sessionId, prepared.sessionIncarnation).occupant);
167
186
  try {
168
187
  pendingSessionNotifications.admit(sessionAddressOf(prepared), prepared.sessionBox);
169
188
  const settling = pendingSessionNotifications.settleBoxDebts(sessionAddressOf(prepared), prepared.abortController.signal);
@@ -15,6 +15,8 @@ import { emitTrace } from "../trace.js";
15
15
  import { deliverEngineNotice, parentLegIds, settleOwedUserInput } from "../types.js";
16
16
  import { assembleResult } from "./assemble-result.js";
17
17
  import { discloseUnconsumedEndings, haltConsumed } from "./halt-attribution.js";
18
+ import { runLedgerIdentityOf } from "../run-ledger.js";
19
+ import { reapTaskAgentsBeforeLastWord } from "../run-ledger-seat.js";
18
20
  import { forwardSafely } from "./forward-sink.js";
19
21
  import { completedPastLimitNotice, limitCrossedOf, TIMER_LATENESS_REPORT_MS } from "./clock-and-limits.js";
20
22
  import { verdictRefusedNotice } from "./verdict-refusal.js";
@@ -37,6 +39,10 @@ export async function runSettleAndTeardown(input) {
37
39
  const { spec, queue, prepared, resume, internals, rs, stats, ident, loopLatch, timeout, ownCommittedTailRef, legWrites, emitDelegationLifecycle, taskIdRef, manualCompactRef, drainManualCompact, final, threw, abortedLive, userInterruptedLive, answerSettled, strandedHumanAnswers, reasoningResolution, deliveryObligations, compactionBreaker, owedUserInput, setResult, onSuggestions, onSuspend, runner, sessions, display } = input;
38
40
  const bound = settleBound(), writeOwedSessionRecords = legEndRecords(prepared, rs, runner, bound);
39
41
  let rowAnswer;
42
+ const runEndNow = () => prepared.pausedRef.current !== undefined
43
+ ? undefined
44
+ : runEndCauseOf({ ceiling: oneShotEndingBook(spec.oneShot, deliveryObligations)?.stoppedWaitingAtCeiling === true, abortedLive, userInterrupted: userInterruptedLive, userHalted: haltConsumed(prepared.harness.haltConsumption()), walltime: timeout.fired, turns: rs.limits.turnsExceeded, spendStopped: rs.limits.budgetHit !== undefined });
45
+ const stopSourceNow = () => abortedLive && !answerSettled && !timeout.fired && !rs.limits.turnsExceeded && rs.limits.budgetHit === undefined && prepared.pausedRef.current === undefined ? "user" : "parent";
40
46
  try {
41
47
  const shown = display?.settled();
42
48
  if (shown !== undefined)
@@ -137,7 +143,7 @@ export async function runSettleAndTeardown(input) {
137
143
  if (abortedLive && answerSettled && result.terminal.kind === "completed") {
138
144
  const origin = runEndCauseOf({ ceiling: false, abortedLive, userInterrupted: userInterruptedLive, userHalted: false, walltime: timeout.fired, turns: rs.limits.turnsExceeded, spendStopped: rs.limits.budgetHit !== undefined });
139
145
  const waitedFor = stopTailWaitedFor(waitStoppedAtCeiling ? undefined : endingBook, endingReach);
140
- deliverEngineNotice(runner.deps.onNotice, interruptUnconsumedNotice(waitedFor, origin, { sessionId: prepared.sessionId, runId: rs.telemetry.runId, ...legNoticeTaskId(prepared) }));
146
+ deliverEngineNotice(runner.deps.onNotice, interruptUnconsumedNotice(waitedFor, origin, { sessionId: prepared.sessionId, runId: rs.telemetry.runId, ...legNoticeTaskId(prepared) }, result.limitCrossed?.axis));
141
147
  }
142
148
  if (result.limitCrossed !== undefined && result.terminal.kind === "completed")
143
149
  deliverEngineNotice(runner.deps.onNotice, completedPastLimitNotice(result.limitCrossed, { sessionId: prepared.sessionId, runId: rs.telemetry.runId, ...legNoticeTaskId(prepared) }));
@@ -262,6 +268,18 @@ export async function runSettleAndTeardown(input) {
262
268
  }));
263
269
  if (prepared.pausedRef.current !== undefined)
264
270
  await yieldParkedLegBackground(prepared, runner);
271
+ if (prepared.runLedgerBook === undefined) {
272
+ const kept = runLedgerIdentityOf(spec, resume !== undefined ? { section: resume.cp.state.runLedger } : undefined, undefined);
273
+ if (kept !== undefined && "notKept" in kept)
274
+ result.runLedgerNotKept = kept.notKept;
275
+ }
276
+ if (prepared.runLedgerBook !== undefined) {
277
+ if (result.terminal.kind !== "paused")
278
+ await reapTaskAgentsBeforeLastWord(prepared.registryAccess, stopSourceNow(), runEndNow());
279
+ const ledger = prepared.runLedgerBook.snapshot(result.terminal.kind === "paused" ? { kind: "park" } : { kind: "run_end" });
280
+ result.runLedger = ledger;
281
+ await settleTeardownLeg(async () => void (await prepared.session.appendRunLedger?.(ledger)), "session.appendRunLedger (settle leg)", (e) => runner.deps.onError?.(e, { phase: "config", sessionId: prepared.sessionId }));
282
+ }
265
283
  await writeOwedSessionRecords();
266
284
  result.continuesFrom = await settledContinuesFrom({
267
285
  closed: legWrites.close(), bound,
@@ -305,20 +323,11 @@ export async function runSettleAndTeardown(input) {
305
323
  finally {
306
324
  settleOwedUserInput(owedUserInput, !prepared.suspendProgressRef.executedApproved, { taskId: prepared.taskId, sessionId: prepared.sessionId, runId: prepared.runId, parent: parentLegIds(internals) }, runner.deps.onNotice);
307
325
  await writeOwedSessionRecords();
308
- const runEnd = prepared.pausedRef.current !== undefined
309
- ? undefined
310
- : runEndCauseOf({ ceiling: oneShotEndingBook(spec.oneShot, deliveryObligations)?.stoppedWaitingAtCeiling === true, abortedLive, userInterrupted: userInterruptedLive, userHalted: haltConsumed(prepared.harness.haltConsumption()), walltime: timeout.fired, turns: rs.limits.turnsExceeded, spendStopped: rs.limits.budgetHit !== undefined });
326
+ const runEnd = runEndNow();
311
327
  const envGoing = envDestroyedAtTeardown(prepared, resume?.cp.state.workspaceHandle !== undefined && rowKeepsWhatItsRetryNeeds(rowAnswer));
312
328
  const ownedEnvDying = envGoing !== undefined && isIsolated(envGoing);
313
329
  await settleTeardownLeg(() => defaultTaskRegistry.settleKilledForOwner({ ...prepared.registryAccess, sessionId: prepared.sessionId }, {
314
- source: abortedLive &&
315
- !answerSettled &&
316
- !timeout.fired &&
317
- !rs.limits.turnsExceeded &&
318
- rs.limits.budgetHit === undefined &&
319
- prepared.pausedRef.current === undefined
320
- ? "user"
321
- : "parent",
330
+ source: stopSourceNow(),
322
331
  skipSessionScoped: true,
323
332
  envDying: ownedEnvDying,
324
333
  retainProcesses: spec.retainBackgroundProcesses === true,
@@ -6,6 +6,7 @@ import { classicEventBase, legEventsOf } from "../mods/stations.js";
6
6
  import { judgeStopFamily, stopFamilyBlockText, stopFamilyContextText, stopFamilyWord, teammateStopPass } from "../mods/teammate-stations.js";
7
7
  import { heldInProgress } from "../../tools/task-list.js";
8
8
  import { steeringPreview } from "./steering-preview.js";
9
+ import { ceilingTurnNote, stopTailWaitedFor } from "./stop-tail-notice.js";
9
10
  import { taskAxisCrossed } from "./clock-and-limits.js";
10
11
  import { oneShotEndingBook, oneShotWaitCeilingOf } from "../task-notification.js";
11
12
  import { FINAL_VERIFICATION_MARK } from "./clock-and-limits.js";
@@ -40,6 +41,7 @@ export function runStopAndFinalVerify(input) {
40
41
  const owed = oneShotEndingBook(spec.oneShot, deliveryObligations);
41
42
  if (stopArmed || teammateArmed || finalVerificationOn || owed !== undefined) {
42
43
  let consecutiveBlocks = 0;
44
+ let ceilingTurnGiven = false;
43
45
  const ending = () => prepared.abortController.signal.aborted || prepared.pausedRef.current !== undefined || prepared.batchHaltRef.current !== undefined || taskAxisCrossed(rs.limits, walltimeMonotonicDeadline);
44
46
  prepared.harness.setStopGate(async () => {
45
47
  if (ending())
@@ -48,6 +50,10 @@ export function runStopAndFinalVerify(input) {
48
50
  const waitEnd = pushedBack.length === 0 ? await owed?.waitOut(AbortSignal.any([prepared.abortController.signal, callerStop.signal]), () => !ending() && prepared.harness.pendingInjectionCount() === 0, (wake) => prepared.harness.subscribe((e) => void (e.type === "queue_update" && wake())), oneShotWaitCeilingOf(spec.limits)) : undefined;
49
51
  if (waitEnd === "signal")
50
52
  prepared.harness.consumeStopAtEnding();
53
+ if (waitEnd === "ceiling" && prepared.runLedgerBook !== undefined && !ceilingTurnGiven && owed !== undefined) {
54
+ ceilingTurnGiven = true;
55
+ return [{ role: "user", engineMinted: true, content: ceilingTurnNote(stopTailWaitedFor(owed, { read: { ...prepared.registryAccess, sessionId: prepared.sessionId }, owner: prepared.registryAccess }), oneShotWaitCeilingOf(spec.limits)), timestamp: Date.now() }];
56
+ }
51
57
  return pushedBack;
52
58
  });
53
59
  async function pushBack() {
@@ -70,7 +70,7 @@ export function runTelemetryAndBudgetSeats(input) {
70
70
  taskIdRef.current = rs.telemetry.taskId;
71
71
  taskIdRef.sessionId = prepared.sessionId;
72
72
  }
73
- rs.telemetry.taskStart = Date.now();
73
+ rs.telemetry.taskStart = prepared.legStartedAt;
74
74
  rs.telemetry.taskStartMonotonic = performance.now();
75
75
  const discloseNoteTaskRunFailure = (err) => {
76
76
  try {
@@ -1,3 +1,4 @@
1
+ import { type NoticeRoute } from "../leg-identity.js";
1
2
  import type { Model } from "../../internal/llm.js";
2
3
  import { type CheckpointToken, type ResumeOutcome } from "../checkpoint-store.js";
3
4
  import { type TaskOutcome } from "../task-outcome.js";
@@ -13,6 +14,7 @@ export type { ResumeTaskConfig } from "./contracts.js";
13
14
  import { type ResumeConfigQuestion, type ResumeConfigVerdict } from "../resume-config-judge.js";
14
15
  import { type TaskStartVerdict } from "../task-start-judge.js";
15
16
  import type { SessionChanges, SessionChangesRequest } from "../session-changes.js";
17
+ import { type InstructionPreviewResult } from "../instruction-preview.js";
16
18
  import type { CompactSessionRequest, CompactSessionResult } from "../auto-compaction.js";
17
19
  import type { RewindFilesRequest, RewindFilesResult } from "../file-history-store.js";
18
20
  import type { RewindConversationRequest, RewindConversationResult } from "../rewind-conversation.js";
@@ -87,7 +89,7 @@ export declare class Runner implements RunnerSelfSeat {
87
89
  * into private deps. */
88
90
  emitTaskOutcome(outcome: TaskOutcome): void;
89
91
  /** Announce a composition's own fact on `RunnerDeps.onNotice` (read at the call: `swapDeps` replaces the deps): {@link RunnerSelfSeat.emitNotice}. */
90
- emitNotice(notice: EngineNotice): void;
92
+ emitNotice(notice: EngineNotice, route?: NoticeRoute): void;
91
93
  /** Whether a child this Runner runs can be placed in another tree: {@link RunnerSelfSeat.canRerootChild}. */
92
94
  canRerootChild(): boolean;
93
95
  /** A completion addressed to a tree's root, through this Runner's route: {@link RunnerSelfSeat.sessionCompletionLane}. */
@@ -162,6 +164,8 @@ export declare class Runner implements RunnerSelfSeat {
162
164
  rewindFiles(request: RewindFilesRequest): Promise<RewindFilesResult>;
163
165
  /** What changed in a session's files, read outside any run — the contract is {@link readSessionChanges}'s (no lock: a leg running on the session does not refuse it; no gate, no frame, no write). */
164
166
  readSessionChanges(request: SessionChangesRequest): Promise<SessionChanges>;
167
+ /** Pre-run instruction-file manifest preview via the lane's single first-load reading (zero model calls, session/read-state writes, or notices; coded refusal on bad specs). */
168
+ previewInstructions(spec: TaskSpec, internals?: RunInternals): Promise<InstructionPreviewResult>;
165
169
  /** The out-of-run manual compaction, no run and no user turn — the contract is {@link compactIdleSession}'s (the one pass every lane runs; refused while a leg of this Runner holds or awaits the session's lock, or a write issued to it has not settled, and while the session is parked at a pending checkpoint). */
166
170
  compactSession(request: CompactSessionRequest): Promise<CompactSessionResult>;
167
171
  /** The out-of-run conversation rewind, no model call and no run — the contract is {@link rewindSessionConversation}'s (the landing a run's `resumeAt` + `resumeAtMode: "before"` makes; refused while a leg of this Runner holds or awaits the session's lock, or a write issued to it has not settled, and while the session is parked at a pending checkpoint; `dryRun` judges the same and writes nothing). */
@@ -335,6 +339,6 @@ export declare class Runner implements RunnerSelfSeat {
335
339
  */
336
340
  private resumeHandoff;
337
341
  }
338
- /** Convenience: one-shot run with explicit deps (creates a throwaway Runner). */
342
+ /** Convenience: one-shot run with explicit deps (creates a throwaway Runner; delivers a construction refusal as a failed TaskResult rather than throwing synchronously). */
339
343
  export declare function runTask(spec: TaskSpec, deps: RunnerDeps): Promise<TaskResult>;
340
344
  export type { TaskEvent, TaskStream };
@@ -1,7 +1,7 @@
1
1
  import { classicEventBase, legEventsOf, legNoticeTaskId } from "../mods/stations.js";
2
2
  import { openMessageDisplay } from "../mods/message-display.js";
3
- import { legTaskIdOf } from "../leg-identity.js";
4
- import { restoreRowTaskId } from "./checkpoint-scope.js";
3
+ import { legNoticeAdmission, legTaskIdOf } from "../leg-identity.js";
4
+ import { restoreRowIdentity, resumedDeclaredTaskId } from "./checkpoint-scope.js";
5
5
  import { checkpointClaimRevOf, checkpointRevOf } from "../checkpoint-generation.js";
6
6
  import { judgedOwnerSeat, readRootOccupant } from "./delegation-owner.js";
7
7
  import { raceSettlementAgainstSignal } from "./abort-race.js";
@@ -59,7 +59,7 @@ import { resumePreflight } from "./resume-preflight.js";
59
59
  import { resumeClaim } from "./resume-claim.js";
60
60
  import { voidVerifierPause } from "./void-verifier-pause.js";
61
61
  import { LocalClaims } from "./local-claims.js";
62
- import { streamSettleBackstop } from "./stream-settle-backstop.js";
62
+ import { failedPreRunResult, streamSettleBackstop } from "./stream-settle-backstop.js";
63
63
  import { streamReap } from "./stream-reap.js";
64
64
  import { streamSteerVerb } from "./stream-steer-verb.js";
65
65
  import { bindAuthoredSteer } from "../input-author.js";
@@ -90,6 +90,7 @@ import { deploymentCanRerootChild } from "./child-tree.js";
90
90
  import { rewindSessionFiles } from "./rewind-files.js";
91
91
  import { rewindOutcomeOf } from "./rewind-outcome.js";
92
92
  import { readSessionChanges } from "./read-session-changes.js";
93
+ import { previewInstructionsOf } from "../instruction-preview.js";
93
94
  import { compactIdleSession } from "./compact-session.js";
94
95
  import { rewindSessionConversation } from "./rewind-conversation.js";
95
96
  import { egressThrownText } from "../untrusted-egress.js";
@@ -171,8 +172,8 @@ export class Runner {
171
172
  emitTaskOutcome(outcome) {
172
173
  emitTaskOutcome(this.deps, outcome);
173
174
  }
174
- emitNotice(notice) {
175
- deliverEngineNotice(this.deps.onNotice, notice);
175
+ emitNotice(notice, route) {
176
+ deliverEngineNotice(this.deps.onNotice, notice, route !== undefined ? legNoticeAdmission(route, (destination, delivery) => this.pendingSessionNotifications.discardsStaleNotice(destination, delivery)) : undefined);
176
177
  }
177
178
  canRerootChild() { return deploymentCanRerootChild(this.deps); }
178
179
  sessionCompletionLane(root, unkept) { return this.pendingSessionNotifications.completionLaneOf(root, unkept); }
@@ -294,6 +295,7 @@ export class Runner {
294
295
  }
295
296
  rewindFiles(request) { return rewindSessionFiles({ deps: this.deps, sessions: this.sessions, readStates: this.sessionReadStates, ...this.verbLockSeats }, request); }
296
297
  readSessionChanges(request) { return readSessionChanges({ deps: this.deps, sessions: this.sessions }, request); }
298
+ previewInstructions(spec, internals) { return previewInstructionsOf({ deps: this.deps, sessions: this.sessions, readStates: this.sessionReadStates }, spec, internals); }
297
299
  compactSession(request) { return compactIdleSession({ deps: this.deps, liveModels: () => this.deps.models, sessions: this.sessions, ...this.verbLockSeats }, request); }
298
300
  rewindConversation(request) { return rewindSessionConversation({ deps: this.deps, sessions: this.sessions, ...this.verbLockSeats }, request); }
299
301
  forgetMcpFailure(request) { return forgetSessionMcpFailure(this.sessionMcpPools, request, this.deps.peerSeat); }
@@ -305,6 +307,8 @@ export class Runner {
305
307
  throw new TypeError("runTaskStream: `resume` must be a ResumeRun carrying `outcome` — got a value without one. " +
306
308
  "(Note the parameter order: runTaskStream(spec, resume?, internals?) — internals is the THIRD parameter.)");
307
309
  }
310
+ if (resume !== undefined)
311
+ internals = restoreRowIdentity(internals, resume.cp.state);
308
312
  const entry = readEntrySpec(spec, () => this.deps.models);
309
313
  spec = entry.spec;
310
314
  const entryActor = entry.actor;
@@ -341,7 +345,7 @@ export class Runner {
341
345
  };
342
346
  const runStartedAt = Date.now();
343
347
  const rewind = rewindOutcomeOf(spec);
344
- const taskIdRef = { current: legTaskIdOf(spec, restoreRowTaskId(internals, resume?.cp.state.rowTaskId), undefined), sessionId: spec.sessionId, intake: { committed: false }, ...(judgedOwnerSeat(internals) !== undefined ? { rowVerified: false } : {}), ...(rewind !== undefined ? { rewind } : {}) };
348
+ const taskIdRef = { current: legTaskIdOf(spec, internals, undefined), sessionId: spec.sessionId, intake: { committed: false }, ...(judgedOwnerSeat(internals) !== undefined ? { rowVerified: false } : {}), ...(rewind !== undefined ? { rewind } : {}) };
345
349
  let held = resumeHold === undefined ? undefined : { sessionId: resumeHold.sessionId, taken: Promise.resolve() };
346
350
  let releaseLock = resumeHold?.release;
347
351
  const holdSessionLock = (sessionId) => {
@@ -641,7 +645,7 @@ export class Runner {
641
645
  async resumeLadder(token, outcome, admitted) {
642
646
  const { config, internals, store, cp, outcomeGate, resumeSignal, wakeMessage, chainRefusal, rootLayerUnrestated } = admitted;
643
647
  const readGeneration = checkpointRevOf(cp);
644
- const { plainReviewOutcome, plainParkOutcome } = resumeReviewOutcome({ cp, outcome, outcomeGate, wakeMessage });
648
+ const { plainReviewOutcome, plainParkOutcome } = resumeReviewOutcome({ cp, outcome, outcomeGate, wakeMessage, configPermissionMode: config.permissionMode });
645
649
  const { plainPolicyOutcome: capturedPolicyOutcome, redeemedAnswer } = resumePolicyOutcome({ cp, outcome, config, runner: this.depsSeat });
646
650
  const { resumeInternals, chainRung } = resumeCheckpointScreen({ cp, resumeSignal, internals, tools: config.tools, runner: this.depsSeat, chainRefusal });
647
651
  const { recheckGovernanceWindow } = resumeInternalsAndConfig({ cp, config, internals, outcomeGate, runner: this.depsSeat, resumeSignal, chainRefused: chainRung !== undefined });
@@ -687,11 +691,13 @@ export class Runner {
687
691
  const answerFace = plainPolicyOutcome !== undefined && redeemedAnswer !== undefined
688
692
  ? answerFaceForRedeemedCall(redeemedAnswer, plainPolicyOutcome.boundCallId, config.onQuestion ?? this.deps.onQuestion, boundInputHashOf(cp.pendingAction.args?.questions))
689
693
  : undefined;
694
+ const declaredTaskId = resumedDeclaredTaskId(config, cp.state);
690
695
  const spec = {
691
696
  ...config,
692
697
  ...((config.principal || undefined) === undefined && (cp.principal || undefined) !== undefined ? { principal: cp.principal } : {}),
693
698
  ...((config.isolationScope || undefined) === undefined && (cp.isolationScope || undefined) !== undefined ? { isolationScope: cp.isolationScope } : {}),
694
699
  ...(config.durableApproval === undefined && cp.durableApproval === false ? { durableApproval: cp.durableApproval } : {}),
700
+ ...(declaredTaskId !== undefined ? { taskId: declaredTaskId } : {}),
695
701
  objective: "",
696
702
  sessionId: cp.sessionId,
697
703
  requireExistingSession: true,
@@ -724,6 +730,12 @@ async function sessionLockUnlessAborted(taken, signal, row) {
724
730
  void taken.then((release) => release(), () => { });
725
731
  throw new CheckpointError("checkpoint.resume_aborted", resumeCancelledSentence("while it waited for the session to be free", row));
726
732
  }
727
- export function runTask(spec, deps) {
728
- return new Runner(deps).runTask(spec);
733
+ export async function runTask(spec, deps) {
734
+ try {
735
+ const runner = enterConfigDoor("deps", () => new Runner(deps));
736
+ return runner.runTask(spec);
737
+ }
738
+ catch (err) {
739
+ return failedPreRunResult(err, spec);
740
+ }
729
741
  }
@@ -23,7 +23,8 @@
23
23
  * `"unknown"` (or a read that throws) is a wiring fault: it is announced to the operator under the existing
24
24
  * capability-shape code, once per run, and the person is told nothing — no reading defaults to `"unknown"`.
25
25
  *
26
- * The same seat relays the environment's one other disclosure about what its shell gets (`relayLateDeclaration`, below).
26
+ * The same seat relays the environment's two other disclosures about what its shell gets (`relayLateDeclaration`,
27
+ * `relayModelShellDropped`, below).
27
28
  */
28
29
  import { type EngineNotice } from "../engine-notice.js";
29
30
  import { type PeerEntriesTaken } from "../secret-env.js";
@@ -31,13 +32,14 @@ import type { ExecutionEnv } from "../../internal/harness.js";
31
32
  import type { Prepared } from "./contracts.js";
32
33
  export type WithheldShellEnvSeatInput = Pick<Prepared, "runId" | "sessionId" | "legNotice" | "toolRosterDeltas" | "announcedListingsRef" | "frameReceipts"> & {
33
34
  readonly harness: {
34
- readonly env: Pick<ExecutionEnv, "withheldEnv" | "lateDeclarationNotice">;
35
+ readonly env: Pick<ExecutionEnv, "withheldEnv" | "lateDeclarationNotice" | "modelShellDropped">;
35
36
  };
36
37
  };
37
38
  /** The seat, per run. `onToolStart` and `onToolEnd` never throw: a diagnostic may not be what fails a call. `peerEntries` = the (variable,
38
- * entry) pairs the leg's receipt took in (leg-receipt.ts `LegReceipt.peerEntries`), and `isolationScope` = the leg's isolation scope
39
+ * entry) pairs the leg's receipt took in (leg-receipt.ts `LegReceipt.peerEntries`) and `isolationScope` = the leg's isolation scope
39
40
  * (isolation-scope.ts `legIdentityOf`): the entries its notice names, each for its variable, are those pairs and the ones the host declared
40
- * to every leg or — on a top-level leg, whose notice its own session reads — to that scope (secret-env.ts `declarePeerHeldEnv`). */
41
+ * to every leg or to the scope of the session the notice is delivered to — read off the leg's one notice route (`Prepared.legNotice`:
42
+ * a delegated leg's root address carries its scope), by the notice's own reading (secret-env.ts `withheldEnvUserNotice`). */
41
43
  export declare function createWithheldShellEnvSeat(prepared: WithheldShellEnvSeatInput, onNotice: ((notice: EngineNotice) => void) | undefined, peerEntries: PeerEntriesTaken | undefined, isolationScope?: string): {
42
44
  onToolStart(toolName: string): void;
43
45
  onToolEnd(): void;
@@ -1,4 +1,5 @@
1
1
  import { deliverEngineNotice } from "../engine-notice.js";
2
+ import { shellStateEnvDroppedNotice } from "../model-shell.js";
2
3
  import { withheldEnvUserNotice } from "../secret-env.js";
3
4
  import { isEngineShellFace } from "../tool-catalog-entries.js";
4
5
  import { toolCallFaceOf } from "../tool-roster.js";
@@ -18,6 +19,24 @@ function readWithheldEnv(env) {
18
19
  return { malformed: "unreadable" };
19
20
  }
20
21
  }
22
+ function relayModelShellDropped(prepared, onNotice) {
23
+ const told = new WeakMap();
24
+ return () => {
25
+ try {
26
+ const record = prepared.harness.env.modelShellDropped;
27
+ const entries = readMember(record, "entries");
28
+ if (typeof record !== "object" || record === null || !Array.isArray(entries))
29
+ return;
30
+ const fresh = entries.slice(told.get(record) ?? 0);
31
+ if (fresh.length === 0)
32
+ return;
33
+ told.set(record, entries.length);
34
+ deliverEngineNotice(onNotice, shellStateEnvDroppedNotice(fresh));
35
+ }
36
+ catch {
37
+ }
38
+ };
39
+ }
21
40
  function relayLateDeclaration(prepared, onNotice) {
22
41
  let told = false;
23
42
  return () => {
@@ -43,9 +62,12 @@ function relayLateDeclaration(prepared, onNotice) {
43
62
  export function createWithheldShellEnvSeat(prepared, onNotice, peerEntries, isolationScope) {
44
63
  let shapeFaultTold = false;
45
64
  const relay = relayLateDeclaration(prepared, onNotice);
46
- const readerScope = prepared.legNotice.route.address.sourceSessionId === undefined ? isolationScope : undefined;
65
+ const relayDropped = relayModelShellDropped(prepared, onNotice);
47
66
  return {
48
- onToolEnd: relay,
67
+ onToolEnd: () => {
68
+ relay();
69
+ relayDropped();
70
+ },
49
71
  onToolStart(toolName) {
50
72
  if (!isEngineShellFace(toolCallFaceOf(prepared.toolRosterDeltas.current, toolName)))
51
73
  return;
@@ -61,7 +83,7 @@ export function createWithheldShellEnvSeat(prepared, onNotice, peerEntries, isol
61
83
  });
62
84
  return;
63
85
  }
64
- const notice = withheldEnvUserNotice(answer, { ...prepared.legNotice.route.address, runId: prepared.runId }, peerEntries, readerScope);
86
+ const notice = withheldEnvUserNotice(answer, { ...prepared.legNotice.route.address, runId: prepared.runId }, peerEntries, isolationScope, prepared.legNotice.route.destination?.scope);
65
87
  if (notice === undefined)
66
88
  return;
67
89
  const d = notice.detail;