@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
@@ -309,9 +309,11 @@ export interface TaskResult {
309
309
  /** The PROVIDER'S OWN name for the model that answered this run's FINAL turn, when it DIFFERS from the
310
310
  * id the request was sent with — the result-face twin of `turn_end.responseModel`. {@link model} above
311
311
  * stays the ENGINE-SELECTED id a resume re-seeds and a catalog resolves; a UI echoing "served by X"
312
- * prints this one when it is here and {@link model} when it is not. **In-presence condition**: the final
313
- * assistant message carried one. ABSENT ⇒ the provider named the requested id or named nothing (one
314
- * reading, not two), there was no final assistant message, or the final turn AGREED while an earlier one
312
+ * prints this one when it is here, and when it is not says no name was reported — absence is not agreement.
313
+ * **In-presence condition**: the final assistant message carried one. ABSENT ⇒ the provider named the
314
+ * requested id or named nothing (one reading, not two), it named one the engine dropped (outside the echo
315
+ * shape, or holding a value the request was declared with; counted as the trace frame `brain.echo_dropped`,
316
+ * field `responseModel`), there was no final assistant message, or the final turn AGREED while an earlier one
315
317
  * did not — the per-turn frames are the complete record, this is the terminal one. Never present on the
316
318
  * engine's synthetic messages, which carry no provider report; a mismatch is announced either way as
317
319
  * `route.response_model_mismatch`. */
@@ -803,6 +805,19 @@ export interface TaskResult {
803
805
  * know whether it is reading a saturated list can compare the length against that ceiling.
804
806
  */
805
807
  editedFiles?: import("../agents/subagent-steps.js").SubagentEditedFile[];
808
+ /**
809
+ * The run's MEMBER LEDGER (`RunLedger`) — present exactly when the task keeps one (its first leg declared `TaskSpec.runLedger`;
810
+ * a resumed leg keeps its row's), on every terminal:
811
+ * one row per member it dispatched with the engine's reading of how each ended, what each said and did, and which completed
812
+ * rows no accepted check points at; the run's coverage; a headline computed from those counts (never the model's words); and
813
+ * the same in fixed sentences (`text`) for an outlet with no interface of its own. `result` is unchanged by it — the ledger
814
+ * stands BESIDE the model's answer. A host's wire carries it under {@link import("./run-ledger.js").RUN_LEDGER_WIRE_KEY}.
815
+ */
816
+ runLedger?: import("./run-ledger.js").RunLedger;
817
+ /** Present exactly on a resumed leg whose spec declares `TaskSpec.runLedger` while the row it resumed was parked by a leg that
818
+ * kept no ledger: the sentence saying the task keeps none ({@link import("./run-ledger.js").RUN_LEDGER_NOT_KEPT_SENTENCE}) —
819
+ * whether a task keeps one is fixed by its first leg. No notice code. */
820
+ runLedgerNotKept?: string;
806
821
  /**
807
822
  * Present (`true`) exactly when the run's FINAL turn was halted by a person's BARE rejection of a
808
823
  * tool call, or of the plan a plan pause held — the parent-thread control-flow boundary: the rejected
@@ -45,7 +45,7 @@ declare const SPEC_MEMBER_TABLE: {
45
45
  images: 0;
46
46
  userAttachments: 0;
47
47
  sessionId: "session";
48
- projectId: 0;
48
+ project: 0;
49
49
  workspace: 0;
50
50
  requireExistingSession: "session";
51
51
  oneShot: 0;
@@ -101,6 +101,8 @@ declare const SPEC_MEMBER_TABLE: {
101
101
  maxSuspends: 0;
102
102
  checkpointStore: 0;
103
103
  handsReadOnly: 0;
104
+ ownHandsReadOnly: 0;
105
+ runLedger: 0;
104
106
  memoryPersistenceCapable: 0;
105
107
  additionalDirectories: 0;
106
108
  additionalReadDirectories: 0;
@@ -1,18 +1,20 @@
1
1
  import { RETIRED_TASK_SPEC_KEYS, retiredKeyOf, retiredKeyRefusal } from "./retired-keys.js";
2
- import { thrownText } from "./thrown-value.js";
2
+ import { codedRefusal, thrownText } from "./thrown-value.js";
3
+ import { screenProjectSeat } from "./project-seat.js";
4
+ import { retainSeatError, screenRetainSeat } from "./retain-seat.js";
3
5
  import { callerKey } from "./caller-text.js";
4
6
  import { strayMembersOf } from "./own-property-receipt.js";
5
7
  const SESSION = "session";
6
8
  const ENTRY = "entry";
7
9
  const SPEC_MEMBER_TABLE = {
8
10
  taskId: 0, objective: 0, wake: ENTRY, principal: 0, isolationScope: 0, actor: 0, runOrigin: 0, interactionPosture: 0, approvalReach: 0, interactiveQuestionFallback: 0,
9
- images: 0, userAttachments: 0, sessionId: SESSION, projectId: 0, workspace: 0, requireExistingSession: SESSION, oneShot: 0, clientContext: 0, resumeAt: ENTRY,
11
+ images: 0, userAttachments: 0, sessionId: SESSION, project: 0, workspace: 0, requireExistingSession: SESSION, oneShot: 0, clientContext: 0, resumeAt: ENTRY,
10
12
  resumeAtMode: ENTRY, model: 0, modelRole: 0, roles: 0, advisorModel: 0, thinking: 0, fastMode: 0, systemPrompt: 0,
11
13
  promptRole: 0, promptForm: 0, promptBinding: 0, promptLocale: 0, appendSystemPrompt: 0, outputStyle: 0, memory: 0, suggestNextPrompts: 0, fileHistory: 0,
12
14
  projectMemory: 0, instructionFamily: 0, restoreFiles: ENTRY, acceptPartialRestore: ENTRY, unplacedHistoryRecordedUnder: ENTRY, rewindFilesTo: ENTRY, tools: 0, allowTools: 0, excludeTools: 0, excludeAllTools: 0,
13
15
  deferTools: 0, toolMaterializeStrategy: 0, alwaysLoadTools: 0, restoreGatedTools: 0, deferSelfResolve: 0, promptLean: 0, agents: 0, toolPolicy: 0,
14
16
  basePolicyForResumeEdit: 0, onAsk: 0, onQuestion: 0, lspManager: 0, lspDiagnostics: 0, mods: 0, peerPresence: 0, durableApproval: 0,
15
- resourceSuspend: 0, preemptSignal: 0, resilience: 0, finalVerification: 0, maxSuspends: 0, checkpointStore: 0, handsReadOnly: 0, memoryPersistenceCapable: 0,
17
+ resourceSuspend: 0, preemptSignal: 0, resilience: 0, finalVerification: 0, maxSuspends: 0, checkpointStore: 0, handsReadOnly: 0, ownHandsReadOnly: 0, runLedger: 0, memoryPersistenceCapable: 0,
16
18
  additionalDirectories: 0, additionalReadDirectories: 0, readDenyPatterns: 0, writeProtectedAdditions: 0, agentConfigDirs: 0, agentHomeDirs: 0, complianceAdditionalDenies: 0, readFace: 0, writeFace: 0, enablePlanMode: 0,
17
19
  planFile: 0, interactiveTools: 0, enableFork: 0, shellGate: 0, permissionMode: 0, classifyAllShell: 0, blockReadsOutsideRoots: 0, mcp: 0, a2a: 0,
18
20
  skills: 0, userInvokedSkills: 0, allowedTools: 0, skillListingBudgetFraction: 0, skillListingMaxDescChars: 0, backgroundScope: 0, sandbox: 0, envFacts: 0, limits: 0,
@@ -110,6 +112,20 @@ export function readCallerSpec(spec, takeSeat) {
110
112
  else if (own.stray !== undefined)
111
113
  refusal = unknownKeys(own.stray.names);
112
114
  }
115
+ if (refusal === undefined && "project" in values) {
116
+ const screened = screenProjectSeat(values["project"]);
117
+ if (screened.ok)
118
+ values["project"] = screened.seat;
119
+ else
120
+ refusal = codedRefusal(screened.code, screened.message);
121
+ }
122
+ if (refusal === undefined && "retainSubagentSessions" in values) {
123
+ const screened = screenRetainSeat(values["retainSubagentSessions"]);
124
+ if (!screened.ok)
125
+ refusal = retainSeatError(screened);
126
+ else if (screened.seat !== undefined)
127
+ values["retainSubagentSessions"] = screened.seat;
128
+ }
113
129
  const members = {};
114
130
  for (const name of TASK_SPEC_MEMBERS)
115
131
  if (name in values)
@@ -15,6 +15,7 @@ import type { TaskLimits } from "./task-limits.js";
15
15
  import type { ToolSpec } from "./tool-spec.js";
16
16
  import type { WorkspaceDeclaration } from "./session-checkout.js";
17
17
  import type { TaskSandboxSettings } from "./command-sandbox.js";
18
+ import type { ProjectSeat } from "./project-seat.js";
18
19
  /** design/169-F — knobs for the opt-in stale tool-result offload (see
19
20
  * `TaskSpec.compaction.staleToolResultOffload`, where the semantics are documented). */
20
21
  export interface StaleToolResultOffloadOptions {
@@ -285,11 +286,17 @@ export interface TaskSpec {
285
286
  /** Reuse an existing in-memory session for chat continuity; omit to start fresh. */
286
287
  sessionId?: string;
287
288
  /**
288
- * Project UUID the host declares for this leg (`.sema/project` id). Decided once at prepare: a valid marker decides and this value must EQUAL it
289
- * (`config.project_identity_mismatch`); without a marker this value IS the identity; an unreadable marker refuses (`config.memory_project_marker` /
290
- * `config.memory_project_marker_nested`); non-UUID ⇒ `config.project_id_invalid`. Every new leg (resume, wake, delegated child, fork) is judged afresh
291
- * from the declaration handed to it; a delegated child with no declaration and no workspace marker inherits its parent leg's verdict as a default.
292
- * Host duty: everything chosen by project for a leg must be picked at the same moment from the same value as this declaration. Read the verdict from
289
+ * The leg's project — ONE seat ({@link ProjectSeat}): `id` (the project UUID, the `.sema/project` id) with the texts people wrote for it
290
+ * (`name`, `description`, `instructions`, `files`), handed as one value. Screened at the spec's read by `screenProjectSeat` (a fresh run and a
291
+ * resume's screen before its claim alike): a malformed seat ⇒ `config.invalid_argument` (the sentence opens with the field path,
292
+ * `TaskSpec.project.<member>`); an `id` that is no UUID ⇒ `config.project_id_invalid`. The retired `projectId` is refused (`config.spec_retired_key`).
293
+ * The id is decided once at prepare: a valid marker decides and `id` must EQUAL it (`config.project_identity_mismatch`); without a marker `id` IS the
294
+ * identity; an unreadable marker refuses (`config.memory_project_marker` / `config.memory_project_marker_nested`). Every new leg (resume, wake, delegated
295
+ * child, fork) is judged afresh from the seat handed to it: a resume from its config's; a woken agent is handed its WAKER's as a default (a retained agent's spawn
296
+ * seat is not kept; no seat on the waker ⇒ none handed); a delegated child that declares none takes its parent leg's seat as a default (never compared
297
+ * with the child's own marker, which decides when present). The texts belong to the id: a leg's seat is its own declaration whole, else the handed
298
+ * seat whole when the verdict's id is that seat's id, else the verdict's id alone. Absent ⇒ the leg states no project text. Host duty: anything
299
+ * else chosen by project for a leg (a `proj:` memory write key) is picked at the same moment from the same value as this seat's `id`. Read the verdict from
293
300
  * `wiring_manifest.manifest.project` (every prepared leg, including legs with no workspace snapshot) or `workspace_changed.project` (absent on legs
294
301
  * that emit no `workspace_changed` frame); a marker that could not be read arrives as `wiring_manifest.manifest.projectMarkerUnreadable` (`{ reason, markerPath? }`,
295
302
  * never present beside `project` — leave stored project rows untouched on it). Limits: only prepared legs emit a manifest (a refused leg has no manifest;
@@ -299,7 +306,7 @@ export interface TaskSpec {
299
306
  * (`PROJECT_MARKER_UNREADABLE_REASONS`: `"io_error"` | `"unparseable"` | `"not_uuid"` | `"nested"` carry `markerPath` for a marker at the task root itself, not above it; `"repo_root_unreadable"` omits it),
300
307
  * `{ kind: "write_project_mismatch", writeScope, writeProjectId, verdictProjectId, verdictSource }`, `{ kind: "write_without_verdict", writeScope, writeProjectId }`.
301
308
  */
302
- projectId?: string;
309
+ project?: ProjectSeat;
303
310
  /**
304
311
  * The session's workspace. The session's first leg turns it into the session's checkout, an immutable record every later leg
305
312
  * is judged against. A later leg (a resumed leg's config included) may OMIT it — the session's own declaration stands, the
@@ -1048,6 +1055,25 @@ export interface TaskSpec {
1048
1055
  * modify the project. No effect unless an `executionEnv` is injected. Default false.
1049
1056
  */
1050
1057
  handsReadOnly?: boolean;
1058
+ /**
1059
+ * Narrow THIS leg's own hands to the read-only band ({@link handsReadOnly}'s reading: no Write / Edit / NotebookEdit,
1060
+ * the read-only shell in place of the full one) WITHOUT handing the narrowing to its children: an agent this leg spawns
1061
+ * gets exactly the hands it would get were this absent — the clamp the leg was handed, the tool selector's ceiling and
1062
+ * the host's own grant still bound it, and nothing is added. For a leg that directs others and must not edit itself
1063
+ * (the manager recipe) while its workers keep the hands the deployment gives them. `true` or absent; any other value is
1064
+ * refused. Not a tighten-only seat: it does not travel, and a workflow script cannot declare it.
1065
+ */
1066
+ ownHandsReadOnly?: true;
1067
+ /**
1068
+ * Declare that this run carries a MEMBER LEDGER (`TaskResult.runLedger`): one row per member the run dispatched (its
1069
+ * background agents, workflow runs and synchronous agents) with the engine's own reading of how each ended, the run's
1070
+ * coverage and how many rows no accepted check points at, and a headline the engine computes from them. On such a run —
1071
+ * and only there — the engine also mounts the `SendUserMessage` report tool (unless the host declares its own of that
1072
+ * name), adds an `<actions>` section to its workers' completion notifications, records the ledger in the session log at
1073
+ * every delivery, runs the launch check at prepare, and gives the run one more turn when a one-shot ending's wait reaches
1074
+ * its ceiling. A run that does not declare it is unchanged in every byte. `true` or absent; any other value is refused.
1075
+ */
1076
+ runLedger?: true;
1051
1077
  /**
1052
1078
  * Whether this run can persist a user's "remember X" somewhere durable — the deployment's own
1053
1079
  * statement, overriding the runner's inference. The runner mounts a read-only-memory disclosure
@@ -1100,21 +1126,21 @@ export interface TaskSpec {
1100
1126
  */
1101
1127
  additionalReadDirectories?: string[];
1102
1128
  /**
1103
- * design/199 件B — TASK-layer ADDITIONS to the built-in sensitive-path READ deny set
1104
- * ({@link import("../tools/fs/read-deny.js").READ_FACE_DEFAULT_DENY_ENTRIES}). Judged by the
1105
- * structured read faces (Read/Grep/Glob/RepoMap, their traversals, the compaction attachment reader) and
1106
- * by the shell READ STATION under every mode — the full shell (`Bash`, `Monitor`, whatever
1107
- * {@link shellGate} says) and the `bash_readonly` shell mounted by {@link handsReadOnly} alike: a
1108
- * deny-listed shell read is REFUSED at the gate (`deniedBy: "read_boundary"`), never asked, with the same
1109
- * sentence the structured faces refuse with — one deny judge for every read face — in BOTH containment
1110
- * modes. Add-only at
1111
- * the task layer: entries here UNION with the active built-ins and the deployment's
1112
- * {@link RunnerDeps.readDenyPatterns}; `[]` ≡ absent (union identity); NOTHING at the task layer
1113
- * can remove a built-in — the one removal channel is the DEPLOYMENT's built-in configuration
1114
- * ({@link RunnerDeps.readDenyBuiltinTiers} / {@link RunnerDeps.readDenyBuiltinExclude}, #245
1115
- * revision of D-4), which no TaskSpec key reaches (an unconfigured deployment judges the default tiers,
1116
- * {@link import("../tools/fs/read-deny.js").READ_DENY_DEFAULT_TIERS}). Bad entry shapes refuse loudly at prepare
1117
- * (#123). The write faces are untouched.
1129
+ * design/199 件B / #4800 — TASK-layer ADDITIONS to the sensitive-path deny set
1130
+ * ({@link import("../tools/fs/read-deny.js").READ_FACE_DEFAULT_DENY_ENTRIES}). Judged on BOTH the read
1131
+ * faces (Read/Grep/Glob/RepoMap, their traversals, the compaction attachment reader, and the shell READ
1132
+ * STATION under every mode — full shell `Bash`/`Monitor` and `bash_readonly` alike) AND the write faces
1133
+ * (`Write`/`Edit`/`NotebookEdit`/`SaveToolResult` at the gate's file write station; on the shell, the write
1134
+ * targets a command spells as literal operands): a matching read or write is REFUSED (`deniedBy: "read_boundary"`
1135
+ * at the gate, zero approval cards, zero classifier calls) in every permission mode and both containment faces.
1136
+ * The shell station is not containment: shell-made paths, hard links and mounts of the same bytes, a rename in an
1137
+ * earlier call are not covered — their floor is the execution environment's containment (wiki page
1138
+ * protected-removals-and-reads). Built-in tiers stay read-only (their write side is the write-protection table).
1139
+ * Add-only at the task layer: entries here UNION with the active built-ins and the deployment's
1140
+ * {@link RunnerDeps.readDenyPatterns}; `[]` ≡ absent; NOTHING at the task layer can remove a built-in — the one
1141
+ * removal channel is the DEPLOYMENT's built-in configuration ({@link RunnerDeps.readDenyBuiltinTiers} /
1142
+ * {@link RunnerDeps.readDenyBuiltinExclude}, #245 revision of D-4), which no TaskSpec key reaches (an unconfigured
1143
+ * deployment judges {@link import("../tools/fs/read-deny.js").READ_DENY_DEFAULT_TIERS}). Bad entry shapes refuse loudly at prepare (#123).
1118
1144
  */
1119
1145
  readDenyPatterns?: readonly import("../tools/fs/read-deny.js").ReadDenyEntry[];
1120
1146
  /**
@@ -1452,7 +1478,7 @@ export interface TaskSpec {
1452
1478
  /**
1453
1479
  * Subagent viewing pane (dogfood finding 2026-07-03): widen the opt-in display sink
1454
1480
  * (`RunInternals.onForwardEvent`) from `task_progress`-only to a SUBAGENT's live CONTENT events
1455
- * (`text_delta` / `text_end` (#447) / `reasoning_delta` / `tool_start` / `tool_end`), so a UI can render a delegated
1481
+ * (`text_delta` / `text_end` (#447) / `reasoning_delta` / `reasoning_end` / `tool_start` / `tool_end`), so a UI can render a delegated
1456
1482
  * child's transcript live. Default OFF (progress-only, prior behavior). The child stream is still
1457
1483
  * NEVER merged into the parent's model context — this is purely a render channel; forwarded events
1458
1484
  * carry `parentToolCallId` (attribution) and the same UNTRUSTED-RAW contract as the main stream's
@@ -136,6 +136,7 @@ export const TOOL_CATALOG_ENTRIES = [
136
136
  { id: "agent-transcript", name: "AgentTranscript", source: "builtin", definedIn: "src/agents/agent-transcript-tool.ts", mountedBy: ["delegation"], cards: ["agent-transcript"], face: { family: "delegate", boundaryLegs: [], effect: "read", contract: c("core.agent_transcript@1"), ruleFace: { params: ["id", "lastN"] } } },
137
137
  { id: "list-agents", name: "ListAgents", source: "builtin", definedIn: "src/agents/list-agents-tool.ts", mountedBy: ["delegation", "peerLane"], cards: ["list-agents"], face: { family: "protocol", boundaryLegs: [], effect: "read", aliases: ["ListPeers"], contract: c("core.list_agents@1"), ruleFace: { params: ["includeAll"] } } },
138
138
  { id: "read-inbox", name: "ReadInbox", source: "builtin", definedIn: "src/agents/read-inbox-tool.ts", mountedBy: ["peerLane"], cards: ["read-inbox"], face: { family: "protocol", boundaryLegs: [], effect: "read", contract: c("core.read_inbox@1"), offload: false, budgetExempt: true, ruleFace: { params: ["limit"] } } },
139
+ { id: "send-user-message", name: "SendUserMessage", source: "builtin", definedIn: "src/agents/send-user-message-tool.ts", mountedBy: ["optional"], cards: ["send-user-message"], face: { family: "other", boundaryLegs: [], effect: "read", contract: c("core.send_user_message@1"), offload: false, ruleFace: { params: ["message", "status"] } } },
139
140
  { id: "workflow", name: "Workflow", source: "builtin", definedIn: "src/orchestration/run-workflow-tool.ts", mountedBy: ["workflow"], cards: ["workflow-run"], face: { family: "delegate", boundaryLegs: [], effect: "write", contract: c("core.workflow@1"), renderHints: { approvalCard: "workflow" }, ruleFace: { params: ["script", "name", "scriptPath", "resumeFromRunId"] } } },
140
141
  { id: "report-blocked", name: "ReportBlocked", protocol: ["delegated"], verdict: "blocked", source: "builtin", definedIn: "src/core/runner/synthetic-tools.ts", mountedBy: ["always"], cards: [], face: { family: "scaffold", boundaryLegs: [], effect: "read", contract: c("core.report_blocked@1"), ruleFace: { params: ["reason"] } } },
141
142
  { id: "report-findings", name: "ReportFindings", source: "builtin", definedIn: "src/core/runner/synthetic-tools.ts", mountedBy: ["always"], cards: ["report-findings"], face: { family: "scaffold", boundaryLegs: [], effect: "read", contract: c("core.report_findings@1"), ruleFace: { params: ["level"] } } },
@@ -216,6 +217,7 @@ export const CARD_SKELETONS = Object.freeze({
216
217
  "read-inbox": ["error", "delivered", "pending", "urgent", "notTaken"],
217
218
  "workflow-run": ["status", "workflowRunId", "task_id"],
218
219
  "report-findings": ["count", "level"],
220
+ "send-user-message": ["status", "kind", "ledger.open", "ledger.unverified"],
219
221
  "tool-search": ["total_deferred_tools"],
220
222
  advisor: ["outcome", "model", "servedModel", "stopReason", "code", "errorKind", "hold", "inputTooLongRuledOut", "usage"],
221
223
  "ask-question": ["questionId", "continuationSource", "runContinues", "reason", "code"],
@@ -1,3 +1,4 @@
1
+ import type { AssertAllKeysHandled } from "./ask-origin.js";
1
2
  /**
2
3
  * WHO holds a tool call at its gate — the closed set behind `tool_progress.gate`, exported at the package root as a frozen word list; the type
3
4
  * is read off the list, so the two cannot part. `classifier` = an auto-mode classification of the call is in flight; `approval` = a question
@@ -10,7 +11,9 @@ export type ToolGatePhase = (typeof TOOL_GATE_PHASES)[number];
10
11
  /**
11
12
  * WHOSE model call a liveness frame is about, when it is not the run's own turn — the closed set behind `BrainStatus.seat`. `classifier` = a
12
13
  * call made for the auto-mode classifier lane (the classifier seat's model, or the main model standing in behind it): a side call beside the
13
- * person's turn, never the turn itself. The word IS the gate phase `classifier` (one definition, read in two places): the type is the
14
- * phase set's member, so the two cannot be spelled apart.
14
+ * person's turn, never the turn itself. The list is spelled for the release manifest and held to the gate-phase set by the fence below: a seat
15
+ * word that is not a gate phase reds `tsc`.
15
16
  */
16
- export type BrainStatusSeat = Extract<ToolGatePhase, "classifier">;
17
+ export declare const BRAIN_STATUS_SEATS: readonly ["classifier"];
18
+ export type BrainStatusSeat = (typeof BRAIN_STATUS_SEATS)[number];
19
+ export type BrainStatusSeatsArePhases = AssertAllKeysHandled<Exclude<BrainStatusSeat, ToolGatePhase>>;
@@ -1 +1,2 @@
1
1
  export const TOOL_GATE_PHASES = Object.freeze(["classifier", "approval", "hook"]);
2
+ export const BRAIN_STATUS_SEATS = Object.freeze(["classifier"]);
@@ -16,7 +16,7 @@ import type { RunnerDeps, TaskSpec } from "./types.js";
16
16
  /** Facts a reader of the mount table states; a fact absent from the record is one it cannot read. */
17
17
  export type ToolMountFacts = Partial<Record<ToolMountFact, boolean>>;
18
18
  /** The spec members the task's own word is read from. */
19
- export type MountFactSpec = Pick<TaskSpec, "enableBlockedReport" | "enablePlanMode" | "interactiveTools" | "selfOrchestration" | "outputSchema" | "handsReadOnly" | "advisorModel" | "lspManager">;
19
+ export type MountFactSpec = Pick<TaskSpec, "enableBlockedReport" | "enablePlanMode" | "interactiveTools" | "selfOrchestration" | "outputSchema" | "handsReadOnly" | "runLedger" | "advisorModel" | "lspManager">;
20
20
  /** The task's own word. */
21
21
  export declare function specMountFacts(spec: MountFactSpec): ToolMountFacts;
22
22
  /** The deps members the deployment's seats are read from. */
@@ -58,6 +58,10 @@ export declare function legSeatMountFacts(deps: Pick<RunnerDeps, "onQuestion" |
58
58
  * a background lane, both read from its `execute` where the factory bound them ({@link delegationHasBackgroundLane}): a copy whose face
59
59
  * dropped `run_in_background` still launches in the background by default, and a synchronous one whose face gained it does not. */
60
60
  export declare function backgroundAgentsFact(callerTools: readonly unknown[], leaves: (identity: ToolMountIdentity) => boolean): boolean;
61
- /** The execution environment's reach: hands at all, a target its shell faces reach, the two daemon capabilities. A leg hands in the
62
- * scheduler reading it took ({@link readSchedulerDeclaration}), so the declaration is read once per leg; a static reader takes its own. */
63
- export declare function envMountFacts(handsEnabled: boolean, env: ExecutionEnv, scheduler?: SchedulerReading): ToolMountFacts;
61
+ /** The execution environment's reach: hands at all, a target its shell faces reach, its start for model text, the two daemon
62
+ * capabilities (a background shell counts only beside a start with a background face — its commands are the model's text). A leg
63
+ * hands in the scheduler reading and the start's reading it took ({@link readSchedulerDeclaration}, `readModelShell`: `mounted` or
64
+ * not), so each declaration is read once per leg; a static reader takes its own — for the start, the same declaration before
65
+ * anything is asked (`modelShellFactBeforeAsking`): a start whose `ready` the leg still asks is not stated, so the rows that read it
66
+ * stay conditional on it. */
67
+ export declare function envMountFacts(handsEnabled: boolean, env: ExecutionEnv, scheduler?: SchedulerReading, modelShellMounted?: boolean): ToolMountFacts;
@@ -1,5 +1,6 @@
1
1
  import { workflowsCapability } from "../orchestration/workflow-script-runner.js";
2
2
  import { hasBackgroundShell } from "./background-shell.js";
3
+ import { modelShellFactBeforeAsking, modelShellOf, startsInBackground } from "./model-shell.js";
3
4
  import { performsIo } from "./remote-env.js";
4
5
  import { readSchedulerDeclaration } from "./scheduler.js";
5
6
  import { durableParkOptInDeclared } from "./tool-policy.js";
@@ -15,6 +16,7 @@ export function specMountFacts(spec) {
15
16
  "spec.selfOrchestration": spec.selfOrchestration === true,
16
17
  "spec.outputSchema": spec.outputSchema !== undefined,
17
18
  "spec.handsReadOnly": spec.handsReadOnly === true,
19
+ "spec.runLedger": spec.runLedger === true,
18
20
  "spec.advisorModel": spec.advisorModel !== undefined,
19
21
  };
20
22
  }
@@ -50,11 +52,14 @@ export function legSeatMountFacts(deps, spec, leg) {
50
52
  export function backgroundAgentsFact(callerTools, leaves) {
51
53
  return callerTools.some((t) => delegationHasBackgroundLane(t) && leaves(t));
52
54
  }
53
- export function envMountFacts(handsEnabled, env, scheduler = readSchedulerDeclaration(env)) {
55
+ export function envMountFacts(handsEnabled, env, scheduler = readSchedulerDeclaration(env), modelShellMounted) {
56
+ const start = modelShellOf(env);
57
+ const modelShell = modelShellMounted ?? modelShellFactBeforeAsking(env);
54
58
  return {
55
59
  "env.hands": handsEnabled,
56
60
  "env.performsIo": performsIo(env) === true,
57
- "env.backgroundShell": hasBackgroundShell(env),
61
+ ...(modelShell !== undefined ? { "env.modelShell": modelShell } : {}),
62
+ "env.backgroundShell": hasBackgroundShell(env) && startsInBackground(start),
58
63
  "env.scheduler": scheduler.kind === "mounted",
59
64
  };
60
65
  }
@@ -1,6 +1,6 @@
1
1
  import type { ToolCallPathTarget, ToolCatalogEntry, ToolMountTag } from "./tool-face.js";
2
2
  /** The closed set of facts a mount row may read. */
3
- export declare const TOOL_MOUNT_FACTS: readonly ["runner.self", "leg.parentNotify", "leg.peerLane", "leg.taskNotification", "leg.session", "leg.backgroundAgents", "env.hands", "env.performsIo", "env.backgroundShell", "env.scheduler", "spec.enableBlockedReport", "spec.planMode", "spec.interactiveTools.on", "spec.interactiveTools.off", "spec.planFile", "spec.selfOrchestration", "spec.outputSchema", "spec.handsReadOnly", "spec.mcp", "spec.advisorModel", "spec.selector", "seat.checkpoint", "seat.workflows", "seat.offload", "seat.offloadBytes", "seat.lsp", "seat.artifact", "seat.question", "seat.sharedMemory", "seat.memoryEngine", "caps.allowWorkflows", "model.gate", "listing.skills", "listing.mcp", "listing.mcp.resources", "listing.a2a", "artifact.verdict", "advisor.route", "lsp.readFace", "names.declared", "names.occupied.sharedMemory", "names.occupied.memoryEngine", "names.deferred", "names.retracted"];
3
+ export declare const TOOL_MOUNT_FACTS: readonly ["runner.self", "leg.parentNotify", "leg.peerLane", "leg.taskNotification", "leg.session", "leg.backgroundAgents", "env.hands", "env.performsIo", "env.modelShell", "env.backgroundShell", "env.scheduler", "spec.enableBlockedReport", "spec.planMode", "spec.interactiveTools.on", "spec.interactiveTools.off", "spec.planFile", "spec.selfOrchestration", "spec.outputSchema", "spec.handsReadOnly", "spec.runLedger", "spec.mcp", "spec.advisorModel", "spec.selector", "seat.checkpoint", "seat.workflows", "seat.offload", "seat.offloadBytes", "seat.lsp", "seat.artifact", "seat.question", "seat.sharedMemory", "seat.memoryEngine", "caps.allowWorkflows", "model.gate", "listing.skills", "listing.mcp", "listing.mcp.resources", "listing.a2a", "artifact.verdict", "advisor.route", "lsp.readFace", "names.declared", "names.occupied.sharedMemory", "names.occupied.memoryEngine", "names.deferred", "names.retracted"];
4
4
  export type ToolMountFact = (typeof TOOL_MOUNT_FACTS)[number];
5
5
  /** The name identity a mount judgment reads: a name and the spellings that dispatch to it. */
6
6
  export interface ToolMountIdentity {
@@ -242,6 +242,8 @@ export declare class ToolMountLedger<T extends ToolMountIdentity> {
242
242
  know(facts: Partial<Record<ToolMountFact, boolean>>): void;
243
243
  /** Has this fact been stated? */
244
244
  knows(f: ToolMountFact): boolean;
245
+ /** The word stated for this fact, or `undefined` when none was. */
246
+ factOf(f: ToolMountFact): boolean | undefined;
245
247
  /** Does row `id`'s condition hold — a READING (a fact another phase derives from the row), never a mount: nothing is
246
248
  * recorded. */
247
249
  holds(id: string): boolean;
@@ -9,6 +9,7 @@ export const TOOL_MOUNT_FACTS = Object.freeze([
9
9
  "leg.backgroundAgents",
10
10
  "env.hands",
11
11
  "env.performsIo",
12
+ "env.modelShell",
12
13
  "env.backgroundShell",
13
14
  "env.scheduler",
14
15
  "spec.enableBlockedReport",
@@ -19,6 +20,7 @@ export const TOOL_MOUNT_FACTS = Object.freeze([
19
20
  "spec.selfOrchestration",
20
21
  "spec.outputSchema",
21
22
  "spec.handsReadOnly",
23
+ "spec.runLedger",
22
24
  "spec.mcp",
23
25
  "spec.advisorModel",
24
26
  "spec.selector",
@@ -61,7 +63,7 @@ const HANDS = F("env.hands");
61
63
  const WRITES = ALL(HANDS, NOT(F("spec.handsReadOnly")));
62
64
  const SHELL = ALL(HANDS, F("env.performsIo"));
63
65
  const FULL_SHELL = ALL(SHELL, NOT(F("spec.handsReadOnly")));
64
- const BACKGROUND = ALL(FULL_SHELL, F("env.backgroundShell"));
66
+ const BACKGROUND = ALL(FULL_SHELL, F("env.modelShell"), F("env.backgroundShell"));
65
67
  const DELEGATION = ANY(BACKGROUND, ROW("workflow"), F("leg.backgroundAgents"));
66
68
  const PLAN_PAIR = ALL(F("spec.planMode"), NOT(F("spec.interactiveTools.off")), ANY(F("spec.interactiveTools.on"), F("seat.checkpoint")));
67
69
  const ENTRY_BY_ID = new Map(TOOL_CATALOG_ENTRIES.map((e) => [e.id, e]));
@@ -75,6 +77,7 @@ const namesOf = (e) => [e.name, ...(e.face.aliases ?? [])];
75
77
  const SHARED_MEMORY_IDS = ["memory-list", "memory-read"];
76
78
  const ENGINE_MEMORY_IDS = ["memory-search", "memory-get", "memory-index"];
77
79
  const LIST_AGENTS = entryOf("list-agents");
80
+ const SEND_USER_MESSAGE = entryOf("send-user-message");
78
81
  export const TOOL_MOUNT_RULES = Object.freeze([
79
82
  { id: "report-blocked", segment: "synthetic", tag: "always", when: F("spec.enableBlockedReport") },
80
83
  { id: "report-findings", segment: "synthetic", tag: "always", when: NOT(DECLARED("ReportFindings", true)) },
@@ -92,8 +95,8 @@ export const TOOL_MOUNT_RULES = Object.freeze([
92
95
  { id: "grep", segment: "hands", tag: "hands", when: HANDS, envHand: true },
93
96
  { id: "glob", segment: "hands", tag: "hands", when: HANDS, envHand: true },
94
97
  { id: "repo-map", segment: "hands", tag: "hands", when: HANDS, envHand: true },
95
- { id: "bash", segment: "hands", tag: "hands", when: FULL_SHELL, envHand: true },
96
- { id: "bash-readonly", segment: "hands", tag: "hands", when: ALL(SHELL, F("spec.handsReadOnly")), envHand: true },
98
+ { id: "bash", segment: "hands", tag: "hands", when: ALL(FULL_SHELL, F("env.modelShell")), envHand: true },
99
+ { id: "bash-readonly", segment: "hands", tag: "hands", when: ALL(SHELL, F("spec.handsReadOnly"), F("env.modelShell")), envHand: true },
97
100
  { id: "task-stop", segment: "delegation", tag: "delegation", when: DELEGATION },
98
101
  { id: "send-message", segment: "delegation", tag: "delegation", when: ALL(ANY(DELEGATION, F("leg.parentNotify"), F("leg.peerLane")), F("runner.self"), NOT(DECLARED("SendMessage"))) },
99
102
  { id: "agent-transcript", segment: "delegation", tag: "delegation", when: ALL(DELEGATION, F("runner.self"), NOT(DECLARED("SendMessage")), NOT(DECLARED("AgentTranscript"))) },
@@ -104,6 +107,7 @@ export const TOOL_MOUNT_RULES = Object.freeze([
104
107
  tag: "peerLane",
105
108
  when: ALL(ANY(F("leg.peerLane"), DELEGATION), F("runner.self"), NOT(DECLARED("SendMessage")), VALVE("SendMessage"), VALVE(LIST_AGENTS.name, LIST_AGENTS.face.aliases), ...namesOf(LIST_AGENTS).map((n) => NOT(DECLARED(n, true)))),
106
109
  },
110
+ { id: "send-user-message", segment: "delegation", tag: "optional", when: ALL(F("spec.runLedger"), NOT(DECLARED(SEND_USER_MESSAGE.name))) },
107
111
  { id: "monitor", segment: "delegation", tag: "backgroundTasks", when: BACKGROUND, envHand: true },
108
112
  { id: "enter-worktree", segment: "delegation", tag: "hands", when: FULL_SHELL, envHand: true },
109
113
  { id: "exit-worktree", segment: "delegation", tag: "hands", when: FULL_SHELL, envHand: true },
@@ -344,6 +348,9 @@ export class ToolMountLedger {
344
348
  knows(f) {
345
349
  return this.#facts.has(f);
346
350
  }
351
+ factOf(f) {
352
+ return this.#facts.get(f);
353
+ }
347
354
  #source() {
348
355
  const leg = () => {
349
356
  if (this.#leg === undefined)
@@ -9,7 +9,7 @@ import type { RunInternals } from "./runner/contracts.js";
9
9
  /** The deps members the static reading reads. */
10
10
  export type StaticToolPlanDeps = MountFactDeps & Pick<RunnerDeps, "checkpointStore" | "sessionStore" | "peerDirectory" | "mailboxStore" | "executionEnv" | "executionEnvFactory" | "runtimeCapsResolver" | "memoryBackend" | "toolResultThresholdChars" | "toolResultStore" | "toolModelGate" | "models" | "tiers" | "roles" | "onQuestion" | "lockedConfig" | "toolPolicy" | "basePolicyForResumeEdit" | "peerSeat" | "mods" | "writeProtectedPaths">;
11
11
  /** The spec members the static reading reads. */
12
- export type StaticToolPlanSpec = MountFactSpec & Pick<TaskSpec, "tools" | "allowTools" | "excludeTools" | "excludeAllTools" | "deferTools" | "alwaysLoadTools" | "restoreGatedTools" | "permissionMode" | "shellGate" | "planFile" | "mcp" | "a2a" | "toolPolicy" | "basePolicyForResumeEdit" | "sessionId" | "memory" | "model" | "modelRole" | "roles" | "thinking" | "toolResultThresholdChars" | "checkpointStore" | "onQuestion" | "durableApproval" | "mods" | "skills" | "workspace" | "userAttachments" | "restoreFiles" | "rewindFilesTo" | "writeProtectedAdditions">;
12
+ export type StaticToolPlanSpec = MountFactSpec & Pick<TaskSpec, "tools" | "allowTools" | "excludeTools" | "excludeAllTools" | "deferTools" | "alwaysLoadTools" | "restoreGatedTools" | "permissionMode" | "shellGate" | "planFile" | "mcp" | "a2a" | "toolPolicy" | "basePolicyForResumeEdit" | "sessionId" | "memory" | "model" | "modelRole" | "roles" | "thinking" | "toolResultThresholdChars" | "checkpointStore" | "onQuestion" | "durableApproval" | "mods" | "skills" | "ownHandsReadOnly" | "workspace" | "userAttachments" | "restoreFiles" | "rewindFilesTo" | "writeProtectedAdditions">;
13
13
  /** What a host states about the session a static reading is made for: `session: "new"` — the submission mints its session,
14
14
  * so there is no checkout record, no resume and no delegating caller's placement. Absent ⇒ unknown: those needs stay open. */
15
15
  export interface StaticWiringStatement {
@@ -30,6 +30,7 @@ import { screenUserAttachments, userAttachmentsNeedWorkspace } from "./user-atta
30
30
  import { workspaceDeclared } from "./session-checkout.js";
31
31
  import { writesProtectedPath } from "./tool-registry.js";
32
32
  import { callerMountSource, entryDelegates, planIdentityOf } from "./tool-roster.js";
33
+ import { withOwnLegHands } from "./child-clamp-seats.js";
33
34
  function anyOf(values) {
34
35
  if (values.includes(true))
35
36
  return true;
@@ -173,8 +174,9 @@ export function planStaticToolMounts(deps, handed, statement = {}) {
173
174
  const read = readCallerSpec(handed);
174
175
  if (read.refusal !== undefined)
175
176
  throw read.refusal;
176
- const spec = read.spec;
177
- const mode = refusePermissionModeDoors(spec) ?? "default";
177
+ const caller = read.spec;
178
+ const mode = refusePermissionModeDoors(caller) ?? "default";
179
+ const spec = withOwnLegHands(caller);
178
180
  const moded = withModeSeats(spec, mode);
179
181
  checkedPlanFileShape(spec.planFile);
180
182
  const lists = readToolFaceLists(spec);
@@ -810,9 +810,59 @@ export declare const OFFLOAD_TOOL_NAME = "ReadToolResult";
810
810
  /** The ref the clear-with-offload persist ({@link createOffloadPersist}) writes one result's full text under: the session, the
811
811
  * call and the text's digest. Read alone (writing nothing) where a marker is checked against the ref a clear would name. */
812
812
  export declare function offloadRefOf(sessionId: string, toolCallId: string, fullText: string): string;
813
+ /**
814
+ * How long a request waits for the clear-with-offload puts in flight ({@link OffloadPersist.flush}) before it is sent without
815
+ * them. The wait exists so a model that pages a just-cleared result back at once reads the whole text from a slow but healthy
816
+ * store; one row to a remote, loaded database is a second or a few, never tens — the figure of the engine's other store waits
817
+ * that give up into a stated answer (`WORKFLOW_STORE_WAIT_BOUND_MS`, `PARK_SELFCHECK_STEP_TIMEOUT_MS`). Longer would hold every
818
+ * batch of clears that long on a store that is not answering, where the release before waited for none.
819
+ */
820
+ export declare const OFFLOAD_PUT_WAIT_BOUND_MS = 10000;
821
+ /** Per-put outcome reported by {@link waitForOffloadPuts}: settled with its value, rejected with its reason, or still pending when the bound or abort ended the wait. */
822
+ export type OffloadPutWaitOutcome<T> = {
823
+ readonly status: "settled";
824
+ readonly value: T;
825
+ } | {
826
+ readonly status: "rejected";
827
+ readonly reason: unknown;
828
+ } | {
829
+ readonly status: "pending";
830
+ };
831
+ /** Aggregate result of {@link waitForOffloadPuts}: per-put outcomes fixed at the moment the wait ended, plus whether the bound or an abort ended it. */
832
+ export interface OffloadPutWaitResult<T> {
833
+ readonly outcomes: readonly OffloadPutWaitOutcome<T>[];
834
+ readonly timedOut: boolean;
835
+ readonly aborted: boolean;
836
+ }
837
+ /** Shared deadline handle so one tool call's `details` and content waits draw from one {@link OFFLOAD_PUT_WAIT_BOUND_MS} timer from the first wait. */
838
+ interface OffloadWaitWindow {
839
+ readonly expired: boolean;
840
+ start(): void;
841
+ onExpire(fn: () => void): () => void;
842
+ dispose(): void;
843
+ }
844
+ /**
845
+ * Wait for one or more engine-awaited tool-result store writes at most {@link OFFLOAD_PUT_WAIT_BOUND_MS}, ending at once on
846
+ * `signal` abort when given. Every promise gets a settlement handler at entry so a write abandoned at the bound or on abort
847
+ * keeps running in the background without ever raising `unhandledRejection` (late rejections are reported nowhere, and late
848
+ * settlements never mutate the returned outcomes). Internal — not exported from the package root.
849
+ */
850
+ export declare function waitForOffloadPuts<T>(puts: readonly Promise<T>[], opts?: {
851
+ readonly signal?: AbortSignal;
852
+ readonly window?: OffloadWaitWindow;
853
+ }): Promise<OffloadPutWaitResult<T>>;
854
+ /** The run's offload persist: called, it starts the put under this session's ref and returns the ref at once; `flush` settles
855
+ * when every put started so far has settled (a rejected put settles too — it is reported, never rethrown), when `signal`
856
+ * aborts (a cut ends the wait, not the put), or at {@link OFFLOAD_PUT_WAIT_BOUND_MS}: the puts still owed then are told once
857
+ * (`tool_result.offload_put_unsettled`), run on, and no later `flush` waits for them again. */
858
+ export interface OffloadPersist {
859
+ (toolCallId: string, fullText: string): string;
860
+ readonly flush: (signal?: AbortSignal) => Promise<void>;
861
+ }
813
862
  /**
814
863
  * The runner's clear-with-offload persist, as ONE construction point (the closure used to
815
- * live inline in prepare-task). Fire-and-forget by design (the caller returns the ref synchronously).
864
+ * live inline in prepare-task). The caller gets the ref synchronously; the put runs on, and the request builder waits for the
865
+ * puts in flight (`flush`) before the refs reach the model, giving way to a cut of the turn.
816
866
  *
817
867
  * A failed put REPORTS the loss, it never writes under the ref. The previous arm
818
868
  * wrote a lost-marker row under the SAME ref "so the page-back face reports the true cause", and that
@@ -852,7 +902,7 @@ export declare function createOffloadPersist(store: ToolResultSeat, sessionId: s
852
902
  onNotice?: (notice: import("./types.js").EngineNotice) => void,
853
903
  /** The session's once-record for the one fact this persist tells once (an entry of the session's own with no identity
854
904
  * recorded): runs `deliver` unless the session was already told. Absent ⇒ nothing remembers a telling, so every meeting is told. */
855
- tellOnce?: (deliver: () => void) => void): (toolCallId: string, fullText: string) => string;
905
+ tellOnce?: (deliver: () => void) => void): OffloadPersist;
856
906
  /**
857
907
  * The byte sibling of {@link createOffloadPersist}: keep `bytes` (claimed `mimeType`) a tool result carried for the call
858
908
  * `toolCallId` in the seat's store (its byte arm), under a content-addressed ref and the session's owner — or say why not, in
@@ -958,7 +1008,9 @@ export declare function withToolResultOffload(tool: AgentTool, store: ToolResult
958
1008
  * so a mid-run ToolSearch activation is reflected by the next preview). Absent/`undefined`-returning
959
1009
  * ⇒ byte-identical historic preview. An accessor (not a snapshot) because the wrap happens at
960
1010
  * prepare time, before the deferred classification exists and before any activation can. */
961
- reachableTools?: () => ReadonlySet<string> | undefined): AgentTool;
1011
+ reachableTools?: () => ReadonlySet<string> | undefined,
1012
+ /** Structured notice seat for reporting tool-call offload writes still unsettled at {@link OFFLOAD_PUT_WAIT_BOUND_MS}. */
1013
+ onNotice?: (notice: EngineNotice) => void): AgentTool;
962
1014
  /** The injected `read_tool_result` tool: pages through an offloaded result. `effect:"read"` (verifier/reconcile-safe).
963
1015
  * `legsOfRef` = the legs a page-back of one ref travels: a ref holding a background task's result (`persistTaskArtifact`, its
964
1016
  * origin in the ref — {@link taskArtifactOriginOf}) travels the legs a poll of that task travels — content from another tree is
@@ -968,3 +1020,4 @@ reachableTools?: () => ReadonlySet<string> | undefined): AgentTool;
968
1020
  * reach of SaveToolResult); a ref holding neither is the honest miss. `store` is the run's {@link LegToolResultView}: a ref this
969
1021
  * run may not read reads as absent, so it takes the miss sentence too. */
970
1022
  export declare function createReadToolResultTool(store: LegToolResultView, legsOfRef?: (ref: string, tree: import("./cross-boundary-taint.js").CrossBoundaryTreeToken) => import("./cross-boundary-taint.js").BoundaryLegsGiven, bytesSeat?: ToolResultBytesSeat): AgentTool;
1023
+ export {};