@sema-agent/core 7.71.1 → 7.73.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 (348) hide show
  1. package/CHANGELOG.md +500 -0
  2. package/dist/agents/cross-session-ref.d.ts +2 -2
  3. package/dist/agents/cross-session-ref.js +7 -2
  4. package/dist/agents/inherited-tool-pool.d.ts +30 -2
  5. package/dist/agents/inherited-tool-pool.js +53 -7
  6. package/dist/agents/parked-resume-drive.d.ts +10 -0
  7. package/dist/agents/parked-resume-drive.js +9 -0
  8. package/dist/agents/retain-ledger.d.ts +3 -0
  9. package/dist/agents/send-message-tool.js +7 -2
  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 +47 -12
  16. package/dist/agents/verify.js +23 -7
  17. package/dist/agents/yield-adoption.js +3 -1
  18. package/dist/brain/anthropic.js +14 -9
  19. package/dist/brain/open-responses.js +4 -5
  20. package/dist/brain/openai.js +30 -23
  21. package/dist/brain/stream-engine.js +159 -151
  22. package/dist/core/a2a.d.ts +24 -3
  23. package/dist/core/a2a.js +27 -8
  24. package/dist/core/actions-digest.d.ts +43 -0
  25. package/dist/core/actions-digest.js +22 -0
  26. package/dist/core/agent-state.d.ts +28 -7
  27. package/dist/core/agent-state.js +19 -6
  28. package/dist/core/allow-entry.js +3 -3
  29. package/dist/core/approval-object.d.ts +7 -3
  30. package/dist/core/approval-object.js +30 -9
  31. package/dist/core/auto-mode.d.ts +7 -9
  32. package/dist/core/auto-mode.js +114 -8
  33. package/dist/core/checkpoint-features.d.ts +16 -5
  34. package/dist/core/checkpoint-features.js +35 -6
  35. package/dist/core/checkpoint-rekey.d.ts +1 -1
  36. package/dist/core/checkpoint-rekey.js +6 -1
  37. package/dist/core/checkpoint-requirements.d.ts +23 -3
  38. package/dist/core/checkpoint-requirements.js +5 -1
  39. package/dist/core/checkpoint-row-verdict.d.ts +1 -1
  40. package/dist/core/checkpoint-row-verdict.js +10 -4
  41. package/dist/core/checkpoint-store.d.ts +24 -2
  42. package/dist/core/checkpoint-store.js +1 -0
  43. package/dist/core/child-clamp-seats.d.ts +15 -0
  44. package/dist/core/child-clamp-seats.js +15 -0
  45. package/dist/core/delegation-frames.d.ts +1 -0
  46. package/dist/core/delegation-frames.js +1 -1
  47. package/dist/core/effective-path-target.d.ts +19 -0
  48. package/dist/core/effective-path-target.js +95 -38
  49. package/dist/core/engine-capabilities.d.ts +5 -1
  50. package/dist/core/engine-capabilities.js +1 -1
  51. package/dist/core/engine-notice.d.ts +34 -23
  52. package/dist/core/engine-version.js +1 -1
  53. package/dist/core/entries-not-applied.d.ts +19 -7
  54. package/dist/core/entries-not-applied.js +33 -1
  55. package/dist/core/file-history-store.d.ts +15 -4
  56. package/dist/core/file-history-store.js +53 -23
  57. package/dist/core/gate-fold.js +3 -1
  58. package/dist/core/governance-codes.d.ts +10 -1
  59. package/dist/core/governance-codes.js +17 -5
  60. package/dist/core/hooks.d.ts +3 -0
  61. package/dist/core/hooks.js +1 -0
  62. package/dist/core/host-instance.d.ts +23 -0
  63. package/dist/core/host-instance.js +69 -0
  64. package/dist/core/instruction-preview.d.ts +63 -0
  65. package/dist/core/instruction-preview.js +406 -0
  66. package/dist/core/judged-read.d.ts +57 -0
  67. package/dist/core/judged-read.js +1 -0
  68. package/dist/core/leg-budget.d.ts +26 -0
  69. package/dist/core/leg-budget.js +9 -0
  70. package/dist/core/leg-identity.d.ts +51 -1
  71. package/dist/core/leg-identity.js +45 -2
  72. package/dist/core/manager-launch-check.d.ts +48 -0
  73. package/dist/core/manager-launch-check.js +64 -0
  74. package/dist/core/mcp-call-meta.d.ts +2 -2
  75. package/dist/core/mcp-host-seat.d.ts +5 -0
  76. package/dist/core/mcp-host-seat.js +7 -1
  77. package/dist/core/mcp-injection-drop.d.ts +20 -10
  78. package/dist/core/mcp-injection-drop.js +9 -3
  79. package/dist/core/mcp-server-spec.d.ts +2 -1
  80. package/dist/core/mcp.js +3 -1
  81. package/dist/core/member-outcome.d.ts +3 -2
  82. package/dist/core/member-outcome.js +1 -1
  83. package/dist/core/memory-engine/deletion-record.d.ts +46 -0
  84. package/dist/core/memory-engine/deletion-record.js +96 -0
  85. package/dist/core/memory-engine/engine.js +24 -16
  86. package/dist/core/memory-engine/file-backend.js +7 -5
  87. package/dist/core/memory-engine/index.d.ts +1 -1
  88. package/dist/core/memory-engine/index.js +1 -1
  89. package/dist/core/memory-engine/layout.js +6 -4
  90. package/dist/core/memory-engine/projection-ledger.d.ts +1 -1
  91. package/dist/core/memory-engine/projection-ledger.js +1 -1
  92. package/dist/core/memory-engine/scope-contract.d.ts +69 -11
  93. package/dist/core/memory-engine/scope-contract.js +99 -34
  94. package/dist/core/memory-engine/sync-client.js +26 -6
  95. package/dist/core/memory-engine/sync.d.ts +20 -2
  96. package/dist/core/memory-engine/sync.js +18 -17
  97. package/dist/core/mode-policy.d.ts +21 -6
  98. package/dist/core/mode-policy.js +15 -6
  99. package/dist/core/mounted-mcp.d.ts +7 -2
  100. package/dist/core/mounted-mcp.js +10 -1
  101. package/dist/core/own-property-receipt.js +11 -4
  102. package/dist/core/param-rule-reach.d.ts +8 -3
  103. package/dist/core/param-rule-reach.js +9 -1
  104. package/dist/core/parent-spec-seat.d.ts +13 -1
  105. package/dist/core/parent-spec-seat.js +18 -0
  106. package/dist/core/peer-registration.d.ts +52 -0
  107. package/dist/core/peer-registration.js +37 -0
  108. package/dist/core/peer-seat.d.ts +3 -1
  109. package/dist/core/peer-seat.js +3 -3
  110. package/dist/core/peer-task-store.d.ts +365 -0
  111. package/dist/core/peer-task-store.js +682 -0
  112. package/dist/core/permission-rule-consent.js +6 -11
  113. package/dist/core/permission-rule-model.d.ts +27 -0
  114. package/dist/core/permission-rule-model.js +34 -6
  115. package/dist/core/permission-rule-provider.d.ts +35 -33
  116. package/dist/core/permission-rule-provider.js +38 -295
  117. package/dist/core/permission-rule-store.d.ts +181 -8
  118. package/dist/core/permission-rule-store.js +420 -17
  119. package/dist/core/permission-rule-sync.js +15 -1
  120. package/dist/core/project-seat.d.ts +55 -0
  121. package/dist/core/project-seat.js +96 -0
  122. package/dist/core/protocol-http-auth.d.ts +3 -2
  123. package/dist/core/protocol-http-auth.js +26 -18
  124. package/dist/core/remote-env.d.ts +4 -4
  125. package/dist/core/retired-keys.js +1 -0
  126. package/dist/core/rule-offer-read.d.ts +1 -1
  127. package/dist/core/rule-offer-read.js +32 -4
  128. package/dist/core/run-ledger-seat.d.ts +66 -0
  129. package/dist/core/run-ledger-seat.js +70 -0
  130. package/dist/core/run-ledger.d.ts +332 -0
  131. package/dist/core/run-ledger.js +550 -0
  132. package/dist/core/runner/chain-mismatch.d.ts +32 -0
  133. package/dist/core/runner/chain-mismatch.js +29 -0
  134. package/dist/core/runner/changes-history.d.ts +1 -0
  135. package/dist/core/runner/changes-history.js +2 -2
  136. package/dist/core/runner/checkpoint-scope.d.ts +13 -3
  137. package/dist/core/runner/checkpoint-scope.js +12 -4
  138. package/dist/core/runner/construction-doors.js +6 -0
  139. package/dist/core/runner/contracts.d.ts +22 -3
  140. package/dist/core/runner/delegation-owner.d.ts +30 -0
  141. package/dist/core/runner/delegation-owner.js +20 -4
  142. package/dist/core/runner/file-history-restore.d.ts +3 -1
  143. package/dist/core/runner/file-history-restore.js +9 -6
  144. package/dist/core/runner/finish-reason-seat.js +4 -2
  145. package/dist/core/runner/leg-frame.js +3 -0
  146. package/dist/core/runner/loaded-skills.d.ts +2 -0
  147. package/dist/core/runner/loaded-skills.js +10 -0
  148. package/dist/core/runner/nested-memory-lane.d.ts +22 -5
  149. package/dist/core/runner/nested-memory-lane.js +91 -30
  150. package/dist/core/runner/person-path-rows.d.ts +23 -20
  151. package/dist/core/runner/person-path-rows.js +82 -18
  152. package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -0
  153. package/dist/core/runner/prepare-caps-and-workflow.js +105 -90
  154. package/dist/core/runner/prepare-config-doors.d.ts +1 -0
  155. package/dist/core/runner/prepare-config-doors.js +5 -3
  156. package/dist/core/runner/prepare-context-lane.js +1 -0
  157. package/dist/core/runner/prepare-delegation-surface.d.ts +3 -0
  158. package/dist/core/runner/prepare-delegation-surface.js +6 -0
  159. package/dist/core/runner/prepare-execution-env.d.ts +3 -3
  160. package/dist/core/runner/prepare-file-history.js +1 -1
  161. package/dist/core/runner/prepare-hands-readface.d.ts +10 -2
  162. package/dist/core/runner/prepare-hands-readface.js +36 -22
  163. package/dist/core/runner/prepare-inherited-gate.d.ts +8 -5
  164. package/dist/core/runner/prepare-inherited-gate.js +14 -6
  165. package/dist/core/runner/prepare-memory-engine-session.d.ts +2 -2
  166. package/dist/core/runner/prepare-memory-engine-session.js +2 -2
  167. package/dist/core/runner/prepare-memory.js +3 -15
  168. package/dist/core/runner/prepare-project-context.d.ts +1 -1
  169. package/dist/core/runner/prepare-project-context.js +3 -7
  170. package/dist/core/runner/prepare-protocol-tools.d.ts +5 -0
  171. package/dist/core/runner/prepare-protocol-tools.js +2 -2
  172. package/dist/core/runner/prepare-run-refs.d.ts +1 -1
  173. package/dist/core/runner/prepare-run-refs.js +3 -2
  174. package/dist/core/runner/prepare-suspend-saga.d.ts +6 -2
  175. package/dist/core/runner/prepare-suspend-saga.js +4 -2
  176. package/dist/core/runner/prepare-task.js +50 -37
  177. package/dist/core/runner/prepare-turn-wiring.d.ts +4 -3
  178. package/dist/core/runner/prepare-turn-wiring.js +2 -1
  179. package/dist/core/runner/prepare-wiring-manifest.d.ts +5 -1
  180. package/dist/core/runner/prepare-wiring-manifest.js +8 -4
  181. package/dist/core/runner/read-session-changes.js +1 -1
  182. package/dist/core/runner/resume-apply.js +11 -5
  183. package/dist/core/runner/resume-checkpoint-screen.d.ts +8 -7
  184. package/dist/core/runner/resume-checkpoint-screen.js +7 -6
  185. package/dist/core/runner/resume-review-outcome.d.ts +3 -0
  186. package/dist/core/runner/resume-review-outcome.js +24 -1
  187. package/dist/core/runner/rewind-files.js +3 -2
  188. package/dist/core/runner/run-harness-handlers.js +3 -0
  189. package/dist/core/runner/run-identity-wiring.js +3 -2
  190. package/dist/core/runner/run-leg.js +9 -2
  191. package/dist/core/runner/run-notification-lane.js +20 -1
  192. package/dist/core/runner/run-settle-and-teardown.js +21 -12
  193. package/dist/core/runner/run-stop-and-final-verify.js +6 -0
  194. package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
  195. package/dist/core/runner/runtask.d.ts +6 -2
  196. package/dist/core/runner/runtask.js +21 -9
  197. package/dist/core/runner/shell-env-withheld.d.ts +3 -2
  198. package/dist/core/runner/shell-env-withheld.js +1 -2
  199. package/dist/core/runner/stop-tail-notice.d.ts +10 -2
  200. package/dist/core/runner/stop-tail-notice.js +9 -2
  201. package/dist/core/runner/stream-settle-backstop.d.ts +1 -0
  202. package/dist/core/runner/stream-settle-backstop.js +1 -0
  203. package/dist/core/runner/task-start-doors.js +6 -3
  204. package/dist/core/runner/terminal-account.d.ts +10 -1
  205. package/dist/core/runner/terminal-account.js +23 -3
  206. package/dist/core/runner/tool-face-overlay.d.ts +2 -11
  207. package/dist/core/runner/tool-face-overlay.js +39 -0
  208. package/dist/core/runner/trim-stretch.js +7 -2
  209. package/dist/core/runner/unreadable-person-rows.d.ts +2 -1
  210. package/dist/core/runner-deps.d.ts +13 -10
  211. package/dist/core/scheduler.d.ts +47 -7
  212. package/dist/core/scheduler.js +19 -7
  213. package/dist/core/secret-env.d.ts +60 -37
  214. package/dist/core/secret-env.js +45 -48
  215. package/dist/core/sensitive-path-policy.js +14 -7
  216. package/dist/core/session-checkout.d.ts +3 -0
  217. package/dist/core/session-checkout.js +1 -0
  218. package/dist/core/session-store.d.ts +12 -6
  219. package/dist/core/session-store.js +26 -6
  220. package/dist/core/session.d.ts +31 -8
  221. package/dist/core/shell-read-silence.js +1 -0
  222. package/dist/core/store-contracts/checkpoint-store-contract.js +17 -0
  223. package/dist/core/store-contracts/peer-task-store-contract.d.ts +21 -0
  224. package/dist/core/store-contracts/peer-task-store-contract.js +516 -0
  225. package/dist/core/store-contracts/session-store-contract.d.ts +15 -2
  226. package/dist/core/store-contracts/session-store-contract.js +87 -3
  227. package/dist/core/store-contracts/workflow-journal-store-contract.d.ts +19 -1
  228. package/dist/core/store-contracts/workflow-journal-store-contract.js +89 -1
  229. package/dist/core/task-event.d.ts +11 -3
  230. package/dist/core/task-notification.d.ts +97 -10
  231. package/dist/core/task-notification.js +129 -5
  232. package/dist/core/task-registry-shared.d.ts +12 -1
  233. package/dist/core/task-registry-shared.js +3 -1
  234. package/dist/core/task-registry-workflow.d.ts +1 -1
  235. package/dist/core/task-registry-workflow.js +9 -1
  236. package/dist/core/task-registry.d.ts +39 -2
  237. package/dist/core/task-registry.js +76 -12
  238. package/dist/core/task-result.d.ts +13 -0
  239. package/dist/core/task-spec-members.d.ts +3 -1
  240. package/dist/core/task-spec-members.js +11 -3
  241. package/dist/core/task-spec.d.ts +57 -23
  242. package/dist/core/tool-catalog-entries.js +4 -0
  243. package/dist/core/tool-face-reader.js +1 -1
  244. package/dist/core/tool-face.d.ts +7 -0
  245. package/dist/core/tool-face.js +1 -0
  246. package/dist/core/tool-mount-facts.d.ts +5 -3
  247. package/dist/core/tool-mount-facts.js +4 -3
  248. package/dist/core/tool-mount-plan.d.ts +7 -3
  249. package/dist/core/tool-mount-plan.js +11 -5
  250. package/dist/core/tool-mount-static.d.ts +2 -2
  251. package/dist/core/tool-mount-static.js +28 -14
  252. package/dist/core/tool-registry.d.ts +33 -1
  253. package/dist/core/tool-registry.js +33 -0
  254. package/dist/core/tool-result-store.d.ts +19 -2
  255. package/dist/core/tool-result-store.js +51 -2
  256. package/dist/core/tool-roster.d.ts +16 -0
  257. package/dist/core/tool-roster.js +6 -0
  258. package/dist/core/tool-spec.d.ts +13 -4
  259. package/dist/core/tools.d.ts +6 -0
  260. package/dist/core/tools.js +1 -1
  261. package/dist/core/user-attachment.d.ts +5 -1
  262. package/dist/core/user-attachment.js +14 -7
  263. package/dist/core/wiring-manifest.d.ts +89 -29
  264. package/dist/core/wiring-manifest.js +44 -4
  265. package/dist/core/workflow-journal-store.d.ts +53 -10
  266. package/dist/core/workflow-journal-store.js +27 -4
  267. package/dist/core/workflow-run-store-contract.js +16 -0
  268. package/dist/core/workflow-run-store.d.ts +9 -7
  269. package/dist/core/workflow-run-store.js +4 -1
  270. package/dist/engine/execution-env/node-execution-env.js +3 -1
  271. package/dist/engine/harness/messages.d.ts +1 -1
  272. package/dist/engine/harness/messages.js +2 -1
  273. package/dist/engine/harness/types.d.ts +24 -1
  274. package/dist/engine/harness/types.js +10 -0
  275. package/dist/engine/llm/types.d.ts +5 -7
  276. package/dist/engine/loop/types.d.ts +2 -0
  277. package/dist/engine/lsp/node-lsp-manager.js +2 -1
  278. package/dist/engine/session/import-validate.js +6 -1
  279. package/dist/engine/session/session.d.ts +15 -2
  280. package/dist/engine/session/session.js +35 -5
  281. package/dist/index.d.ts +27 -12
  282. package/dist/index.js +20 -8
  283. package/dist/orchestration/run-workflow-tool.js +40 -32
  284. package/dist/orchestration/workflow-park-adoption.d.ts +51 -12
  285. package/dist/orchestration/workflow-park-adoption.js +47 -12
  286. package/dist/orchestration/workflow-stop.d.ts +128 -0
  287. package/dist/orchestration/workflow-stop.js +156 -0
  288. package/dist/orchestration/workflow.d.ts +30 -6
  289. package/dist/orchestration/workflow.js +117 -54
  290. package/dist/prompts/manager-recipe.d.ts +18 -0
  291. package/dist/prompts/manager-recipe.js +24 -0
  292. package/dist/stores/file/adoption/marker.d.ts +2 -27
  293. package/dist/stores/file/adoption/marker.js +12 -0
  294. package/dist/stores/file/index.d.ts +1 -1
  295. package/dist/stores/file/index.js +1 -1
  296. package/dist/stores/file/permission-rule-store.d.ts +3 -1
  297. package/dist/stores/file/permission-rule-store.js +0 -1
  298. package/dist/stores/file/workflow-journal-store.d.ts +16 -3
  299. package/dist/stores/file/workflow-journal-store.js +93 -5
  300. package/dist/stores/file/workflow-run-store.d.ts +1 -1
  301. package/dist/tools/artifact/artifact-tool.js +11 -6
  302. package/dist/tools/fs/file-read-check.d.ts +45 -11
  303. package/dist/tools/fs/file-read-check.js +200 -57
  304. package/dist/tools/fs/file-write-check.js +9 -3
  305. package/dist/tools/fs/index.d.ts +8 -7
  306. package/dist/tools/fs/index.js +4 -4
  307. package/dist/tools/fs/judged-reads.d.ts +51 -0
  308. package/dist/tools/fs/judged-reads.js +68 -0
  309. package/dist/tools/fs/read-deny-home.d.ts +1 -1
  310. package/dist/tools/fs/read-deny-home.js +5 -5
  311. package/dist/tools/fs/read-deny.d.ts +33 -8
  312. package/dist/tools/fs/read-deny.js +114 -25
  313. package/dist/tools/fs/safety.d.ts +12 -1
  314. package/dist/tools/fs/safety.js +16 -3
  315. package/dist/tools/fs/shell-read-check.d.ts +25 -5
  316. package/dist/tools/fs/shell-read-check.js +100 -15
  317. package/dist/tools/fs/shell-read-establish.d.ts +9 -0
  318. package/dist/tools/fs/shell-read-establish.js +34 -14
  319. package/dist/tools/fs/shell-read-judge.d.ts +13 -1
  320. package/dist/tools/fs/shell-read-judge.js +26 -7
  321. package/dist/tools/fs/shell-read-plan.d.ts +5 -0
  322. package/dist/tools/fs/shell-read-write-targets.js +17 -9
  323. package/dist/tools/scheduler-store-move.d.ts +74 -0
  324. package/dist/tools/scheduler-store-move.js +103 -0
  325. package/dist/tools/scheduler-tools.d.ts +43 -29
  326. package/dist/tools/scheduler-tools.js +161 -118
  327. package/package.json +2 -2
  328. package/test/export-surface.snapshot.json +173 -3
  329. package/wire-changes/answers/core-stores-sql@7.72.0.json +12 -0
  330. package/wire-changes/answers/core-stores-sql@7.73.0.json +28 -0
  331. package/wire-changes/answers/core@7.72.0.json +84 -0
  332. package/wire-changes/answers/core@7.73.0.json +216 -0
  333. package/wire-changes/answers/mods-kernel@7.72.0.json +7 -0
  334. package/wire-changes/answers/mods-kernel@7.73.0.json +7 -0
  335. package/wire-changes/answers/primitives@7.72.0.json +6 -0
  336. package/wire-changes/answers/primitives@7.73.0.json +12 -0
  337. package/wire-changes/answers/wiki-gate@7.72.0.json +7 -0
  338. package/wire-changes/answers/wiki-gate@7.73.0.json +7 -0
  339. package/wire-changes/core-stores-sql@7.72.0.json +215 -0
  340. package/wire-changes/core-stores-sql@7.73.0.json +326 -0
  341. package/wire-changes/core@7.72.0.json +2426 -0
  342. package/wire-changes/core@7.73.0.json +6480 -0
  343. package/wire-changes/mods-kernel@7.72.0.json +147 -0
  344. package/wire-changes/mods-kernel@7.73.0.json +147 -0
  345. package/wire-changes/primitives@7.72.0.json +143 -0
  346. package/wire-changes/primitives@7.73.0.json +227 -0
  347. package/wire-changes/wiki-gate@7.72.0.json +145 -0
  348. package/wire-changes/wiki-gate@7.73.0.json +145 -0
@@ -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,13 +286,27 @@ 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
- * The project the host files this session under — a project UUID (the id a `.sema/project` marker carries; send it on
289
- * every leg). The engine has ONE judge of a leg's project identity: when the leg's checkout carries a marker, the marker
290
- * decides and this value must EQUAL it (else the leg is refused, `config.project_identity_mismatch`); in a checkout with
291
- * no marker this value IS the identity. Not a UUID ⇒ `config.project_id_invalid`. The verdict rides
292
- * `workspace_changed.project`; read it there rather than re-deriving it. Memory keys only by the marker.
293
- */
294
- projectId?: string;
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
300
+ * `wiring_manifest.manifest.project` (every prepared leg, including legs with no workspace snapshot) or `workspace_changed.project` (absent on legs
301
+ * that emit no `workspace_changed` frame); a marker that could not be read arrives as `wiring_manifest.manifest.projectMarkerUnreadable` (`{ reason, markerPath? }`,
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;
303
+ * refusal detail rides `terminal.detail`), and a delegated child's manifest rides the child's own stream, never forwarded onto the parent's. Under `scopeContract: "v2"`, `proj:` / `userproj:`
304
+ * write keys are checked against this verdict (`config.memory_project_identity`; mount dirs stay marker-only). Coded details ride `terminal.detail = { kind: "coded", detail }`
305
+ * (`PROJECT_IDENTITY_REFUSAL_KINDS`): `{ kind: "mismatch", declared, marker, markerPath }`, `{ kind: "marker_unreadable", markerPath?, reason }`
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),
307
+ * `{ kind: "write_project_mismatch", writeScope, writeProjectId, verdictProjectId, verdictSource }`, `{ kind: "write_without_verdict", writeScope, writeProjectId }`.
308
+ */
309
+ project?: ProjectSeat;
295
310
  /**
296
311
  * The session's workspace. The session's first leg turns it into the session's checkout, an immutable record every later leg
297
312
  * is judged against. A later leg (a resumed leg's config included) may OMIT it — the session's own declaration stands, the
@@ -1040,6 +1055,25 @@ export interface TaskSpec {
1040
1055
  * modify the project. No effect unless an `executionEnv` is injected. Default false.
1041
1056
  */
1042
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;
1043
1077
  /**
1044
1078
  * Whether this run can persist a user's "remember X" somewhere durable — the deployment's own
1045
1079
  * statement, overriding the runner's inference. The runner mounts a read-only-memory disclosure
@@ -1092,21 +1126,21 @@ export interface TaskSpec {
1092
1126
  */
1093
1127
  additionalReadDirectories?: string[];
1094
1128
  /**
1095
- * design/199 件B — TASK-layer ADDITIONS to the built-in sensitive-path READ deny set
1096
- * ({@link import("../tools/fs/read-deny.js").READ_FACE_DEFAULT_DENY_ENTRIES}). Judged by the
1097
- * structured read faces (Read/Grep/Glob/RepoMap, their traversals, the compaction attachment reader) and
1098
- * by the shell READ STATION under every mode — the full shell (`Bash`, `Monitor`, whatever
1099
- * {@link shellGate} says) and the `bash_readonly` shell mounted by {@link handsReadOnly} alike: a
1100
- * deny-listed shell read is REFUSED at the gate (`deniedBy: "read_boundary"`), never asked, with the same
1101
- * sentence the structured faces refuse with — one deny judge for every read face — in BOTH containment
1102
- * modes. Add-only at
1103
- * the task layer: entries here UNION with the active built-ins and the deployment's
1104
- * {@link RunnerDeps.readDenyPatterns}; `[]` ≡ absent (union identity); NOTHING at the task layer
1105
- * can remove a built-in — the one removal channel is the DEPLOYMENT's built-in configuration
1106
- * ({@link RunnerDeps.readDenyBuiltinTiers} / {@link RunnerDeps.readDenyBuiltinExclude}, #245
1107
- * revision of D-4), which no TaskSpec key reaches (an unconfigured deployment judges the default tiers,
1108
- * {@link import("../tools/fs/read-deny.js").READ_DENY_DEFAULT_TIERS}). Bad entry shapes refuse loudly at prepare
1109
- * (#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).
1110
1144
  */
1111
1145
  readDenyPatterns?: readonly import("../tools/fs/read-deny.js").ReadDenyEntry[];
1112
1146
  /**
@@ -1444,7 +1478,7 @@ export interface TaskSpec {
1444
1478
  /**
1445
1479
  * Subagent viewing pane (dogfood finding 2026-07-03): widen the opt-in display sink
1446
1480
  * (`RunInternals.onForwardEvent`) from `task_progress`-only to a SUBAGENT's live CONTENT events
1447
- * (`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
1448
1482
  * child's transcript live. Default OFF (progress-only, prior behavior). The child stream is still
1449
1483
  * NEVER merged into the parent's model context — this is purely a render channel; forwarded events
1450
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"] } } },
@@ -182,6 +183,7 @@ export const ENGINE_CARDS = Object.freeze({
182
183
  read_path_denied: "src/tools/fs/safety.ts",
183
184
  readonly_out_of_root: "src/tools/fs/shell-read-check.ts",
184
185
  read_unestablished: "src/tools/fs/shell-read-check.ts",
186
+ read_targets_refused: "src/tools/fs/shell-read-check.ts",
185
187
  bash_self_kill_refused: "src/tools/fs/pattern-kill-guard.ts",
186
188
  bash: "src/tools/fs/fs-shared.ts",
187
189
  });
@@ -202,6 +204,7 @@ export const CARD_SKELETONS = Object.freeze({
202
204
  bash_self_kill_refused: ["code", "finding", "pid", "relation"],
203
205
  readonly_out_of_root: ["code"],
204
206
  read_unestablished: ["code"],
207
+ read_targets_refused: ["code"],
205
208
  path_not_in_root: ["code", "target"],
206
209
  read_path_denied: ["code", "target", "pattern"],
207
210
  artifact: ["action", "plane", "code", "invalidArguments", "url", "path", "bytes", "mediaType", "ref.url", "ref.slug", "ref.version"],
@@ -214,6 +217,7 @@ export const CARD_SKELETONS = Object.freeze({
214
217
  "read-inbox": ["error", "delivered", "pending", "urgent", "notTaken"],
215
218
  "workflow-run": ["status", "workflowRunId", "task_id"],
216
219
  "report-findings": ["count", "level"],
220
+ "send-user-message": ["status", "kind", "ledger.open", "ledger.unverified"],
217
221
  "tool-search": ["total_deferred_tools"],
218
222
  advisor: ["outcome", "model", "servedModel", "stopReason", "code", "errorKind", "hold", "inputTooLongRuledOut", "usage"],
219
223
  "ask-question": ["questionId", "continuationSource", "runContinues", "reason", "code"],
@@ -5,7 +5,7 @@ import { strayMembersOf } from "./own-property-receipt.js";
5
5
  import { faceProblem } from "./runner/tool-face-overlay.js";
6
6
  import { inlineUntrusted } from "./untrusted-text.js";
7
7
  const TOOL_FACE_MEMBERS = { family: true, pathTarget: true, hostTarget: true, renderHints: true, ruleFace: true };
8
- const PATH_TARGET_KINDS = { param: "string", aliases: "list", access: "string", skillScopeEligible: "boolean", base: "string", absent: "string", patternParam: "string" };
8
+ const PATH_TARGET_KINDS = { param: "string", aliases: "list", access: "string", skillScopeEligible: "boolean", base: "string", absent: "string", patternParam: "string", each: "boolean" };
9
9
  const PATH_TARGET_REQUIRED = ["param", "access"];
10
10
  const HOST_TARGET_KINDS = { param: "string" };
11
11
  const HOST_TARGET_REQUIRED = ["param"];
@@ -118,6 +118,13 @@ export interface ToolCallPathTarget {
118
118
  * relative pattern leaves the base alone.
119
119
  */
120
120
  patternParam?: string;
121
+ /**
122
+ * `true` ⇔ the slot names SEVERAL read targets: the call's value there is a string or a list of strings, each one a target
123
+ * judged exactly as a single one is. Only on `access: "read"`. Absent ⇒ the slot names one target, a string. A read target
124
+ * the engine does not catalog is judged by the file read station on this declaration, element by element, and its tool reads
125
+ * through {@link import("./tool-spec.js").ToolExecuteContext.judgedReads}.
126
+ */
127
+ each?: true;
121
128
  }
122
129
  /** The DECLARATION spelling of {@link ToolCallPathTarget}: what a catalog row, a `ToolSpec` or an MCP
123
130
  * overlay writes. `skillScopeEligible` is narrowed to `true` — a declaration says "eligible" or says
@@ -14,6 +14,7 @@ export function pathTargetSlotOnly(pt) {
14
14
  access: pt.access,
15
15
  ...(pt.aliases !== undefined ? { aliases: pt.aliases } : {}),
16
16
  ...(pt.skillScopeEligible !== undefined ? { skillScopeEligible: pt.skillScopeEligible } : {}),
17
+ ...(pt.each === true ? { each: true } : {}),
17
18
  };
18
19
  }
19
20
  export const TOOL_WIRE_NAME_MAX_CHARS = 128;
@@ -9,13 +9,14 @@
9
9
  * phase's point) are not here: the phase that computes one states it beside the judgment that reads it.
10
10
  */
11
11
  import type { ExecutionEnv } from "../internal/harness-types.js";
12
+ import { type SchedulerReading } from "./scheduler.js";
12
13
  import type { ApprovalParkNotResumable } from "./park-resumability.js";
13
14
  import type { ToolMountFact, ToolMountIdentity } from "./tool-mount-plan.js";
14
15
  import type { RunnerDeps, TaskSpec } from "./types.js";
15
16
  /** Facts a reader of the mount table states; a fact absent from the record is one it cannot read. */
16
17
  export type ToolMountFacts = Partial<Record<ToolMountFact, boolean>>;
17
18
  /** The spec members the task's own word is read from. */
18
- 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">;
19
20
  /** The task's own word. */
20
21
  export declare function specMountFacts(spec: MountFactSpec): ToolMountFacts;
21
22
  /** The deps members the deployment's seats are read from. */
@@ -57,5 +58,6 @@ export declare function legSeatMountFacts(deps: Pick<RunnerDeps, "onQuestion" |
57
58
  * a background lane, both read from its `execute` where the factory bound them ({@link delegationHasBackgroundLane}): a copy whose face
58
59
  * dropped `run_in_background` still launches in the background by default, and a synchronous one whose face gained it does not. */
59
60
  export declare function backgroundAgentsFact(callerTools: readonly unknown[], leaves: (identity: ToolMountIdentity) => boolean): boolean;
60
- /** The execution environment's reach: hands at all, a target its shell faces reach, the two daemon capabilities. */
61
- export declare function envMountFacts(handsEnabled: boolean, env: ExecutionEnv): ToolMountFacts;
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;
@@ -1,7 +1,7 @@
1
1
  import { workflowsCapability } from "../orchestration/workflow-script-runner.js";
2
2
  import { hasBackgroundShell } from "./background-shell.js";
3
3
  import { performsIo } from "./remote-env.js";
4
- import { hasScheduler } from "./scheduler.js";
4
+ import { readSchedulerDeclaration } from "./scheduler.js";
5
5
  import { durableParkOptInDeclared } from "./tool-policy.js";
6
6
  import { memoryEngineOpens, normalizeMemorySpec } from "./memory.js";
7
7
  import { DEFAULT_TOOL_RESULT_THRESHOLD_CHARS } from "./tool-result-store.js";
@@ -15,6 +15,7 @@ export function specMountFacts(spec) {
15
15
  "spec.selfOrchestration": spec.selfOrchestration === true,
16
16
  "spec.outputSchema": spec.outputSchema !== undefined,
17
17
  "spec.handsReadOnly": spec.handsReadOnly === true,
18
+ "spec.runLedger": spec.runLedger === true,
18
19
  "spec.advisorModel": spec.advisorModel !== undefined,
19
20
  };
20
21
  }
@@ -50,11 +51,11 @@ export function legSeatMountFacts(deps, spec, leg) {
50
51
  export function backgroundAgentsFact(callerTools, leaves) {
51
52
  return callerTools.some((t) => delegationHasBackgroundLane(t) && leaves(t));
52
53
  }
53
- export function envMountFacts(handsEnabled, env) {
54
+ export function envMountFacts(handsEnabled, env, scheduler = readSchedulerDeclaration(env)) {
54
55
  return {
55
56
  "env.hands": handsEnabled,
56
57
  "env.performsIo": performsIo(env) === true,
57
58
  "env.backgroundShell": hasBackgroundShell(env),
58
- "env.scheduler": hasScheduler(env),
59
+ "env.scheduler": scheduler.kind === "mounted",
59
60
  };
60
61
  }
@@ -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.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 {
@@ -156,9 +156,10 @@ export interface ToolMountPlannedMember {
156
156
  * The plan the rows give over a reading's facts: each catalog row is a member (holds), a conditional member (open) or an
157
157
  * absent definition (fails); the reading's members add the family members a reader knows by name (each under its own
158
158
  * condition and the valve); its families the listings it only knows by peer; `executionEnv` its answer to whether the leg
159
- * needs an environment.
159
+ * needs an environment — read by the caller ({@link readExecutionEnv}), once, at the moment the leg reads it, over the facts the
160
+ * leg holds then (a fact the leg states after it decides is not yet stated), and carried here.
160
161
  */
161
- export declare function planToolMounts(reading: ExecutionEnvReading): ToolMountPlan;
162
+ export declare function planToolMounts(reading: ExecutionEnvReading, executionEnv: ToolMountPlanExecutionEnv): ToolMountPlan;
162
163
  /** Whether a leg needs an execution environment: a consumer of it mounts or a need beside the tools holds (`needed`), one
163
164
  * of them is open (`conditional`), or neither (`unneeded`). */
164
165
  export declare const EXECUTION_ENV_NEEDS: readonly ["needed", "conditional", "unneeded"];
@@ -193,6 +194,7 @@ export interface ExecutionEnvReading {
193
194
  readonly families: readonly {
194
195
  readonly family: ToolMountPlanFamily;
195
196
  readonly writesPath: boolean;
197
+ readonly readsPath?: boolean;
196
198
  }[];
197
199
  readonly writeProtected: boolean;
198
200
  readonly asks: ExecutionEnvAskReading;
@@ -240,6 +242,8 @@ export declare class ToolMountLedger<T extends ToolMountIdentity> {
240
242
  know(facts: Partial<Record<ToolMountFact, boolean>>): void;
241
243
  /** Has this fact been stated? */
242
244
  knows(f: ToolMountFact): boolean;
245
+ /** The word stated for this fact, or `undefined` when none was. */
246
+ factOf(f: ToolMountFact): boolean | undefined;
243
247
  /** Does row `id`'s condition hold — a READING (a fact another phase derives from the row), never a mount: nothing is
244
248
  * recorded. */
245
249
  holds(id: string): boolean;
@@ -19,6 +19,7 @@ export const TOOL_MOUNT_FACTS = Object.freeze([
19
19
  "spec.selfOrchestration",
20
20
  "spec.outputSchema",
21
21
  "spec.handsReadOnly",
22
+ "spec.runLedger",
22
23
  "spec.mcp",
23
24
  "spec.advisorModel",
24
25
  "spec.selector",
@@ -75,6 +76,7 @@ const namesOf = (e) => [e.name, ...(e.face.aliases ?? [])];
75
76
  const SHARED_MEMORY_IDS = ["memory-list", "memory-read"];
76
77
  const ENGINE_MEMORY_IDS = ["memory-search", "memory-get", "memory-index"];
77
78
  const LIST_AGENTS = entryOf("list-agents");
79
+ const SEND_USER_MESSAGE = entryOf("send-user-message");
78
80
  export const TOOL_MOUNT_RULES = Object.freeze([
79
81
  { id: "report-blocked", segment: "synthetic", tag: "always", when: F("spec.enableBlockedReport") },
80
82
  { id: "report-findings", segment: "synthetic", tag: "always", when: NOT(DECLARED("ReportFindings", true)) },
@@ -104,6 +106,7 @@ export const TOOL_MOUNT_RULES = Object.freeze([
104
106
  tag: "peerLane",
105
107
  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
108
  },
109
+ { id: "send-user-message", segment: "delegation", tag: "optional", when: ALL(F("spec.runLedger"), NOT(DECLARED(SEND_USER_MESSAGE.name))) },
107
110
  { id: "monitor", segment: "delegation", tag: "backgroundTasks", when: BACKGROUND, envHand: true },
108
111
  { id: "enter-worktree", segment: "delegation", tag: "hands", when: FULL_SHELL, envHand: true },
109
112
  { id: "exit-worktree", segment: "delegation", tag: "hands", when: FULL_SHELL, envHand: true },
@@ -230,7 +233,7 @@ export function mountRowVerdict(id, facts, leaves) {
230
233
  throw mismatch(`the row "${id}" asked ${v.why.join(", ")}, which was never stated`);
231
234
  return v.value;
232
235
  }
233
- export function planToolMounts(reading) {
236
+ export function planToolMounts(reading, executionEnv) {
234
237
  const { src, members } = reading;
235
238
  const families = reading.families.map((f) => f.family);
236
239
  const row = rowVerdicts(src);
@@ -253,7 +256,7 @@ export function planToolMounts(reading) {
253
256
  }
254
257
  const kept = dedupeLaterWins(out);
255
258
  const named = new Set(kept.map((m) => m.name));
256
- return { half: "static", members: kept, families: [...families], absent: absent.filter((a) => !named.has(a.name)), executionEnv: readExecutionEnv(reading) };
259
+ return { half: "static", members: kept, families: [...families], absent: absent.filter((a) => !named.has(a.name)), executionEnv };
257
260
  }
258
261
  export const EXECUTION_ENV_NEEDS = Object.freeze(["needed", "conditional", "unneeded"]);
259
262
  export const EXECUTION_ENV_ASKS = Object.freeze(["workspace", "attachment_paths", "plan_file", "restore_files", "checkout", "restore", "compaction_restore", "caller_placement", "delegation", "mods", "memory", "park_lane"]);
@@ -274,7 +277,7 @@ export function readExecutionEnv(r) {
274
277
  const p = placementOf(evaluateMountCond(memberCond(m), withEnv, rowWith));
275
278
  const q = placementOf(evaluateMountCond(memberCond(m), without, rowWithout));
276
279
  callable.push(p);
277
- if (p !== q || (r.writeProtected && writesProtectedPath([m.identity.name, ...(m.identity.aliases ?? [])], m.pathTarget)))
280
+ if (p !== q || m.pathTarget?.access === "read" || (r.writeProtected && writesProtectedPath([m.identity.name, ...(m.identity.aliases ?? [])], m.pathTarget)))
278
281
  consume(m.identity.name, p);
279
282
  }
280
283
  for (const rule of TOOL_MOUNT_RULES) {
@@ -286,8 +289,8 @@ export function readExecutionEnv(r) {
286
289
  if (p !== q || rule.envHand === true || (r.writeProtected && writesProtectedPath(namesOf(e), e.face.pathTarget)))
287
290
  consume(e.name, p);
288
291
  }
289
- for (const { family, writesPath } of r.families)
290
- if (r.writeProtected && writesPath)
292
+ for (const { family, writesPath, readsPath } of r.families)
293
+ if ((r.writeProtected && writesPath) || readsPath === true)
291
294
  consume(`${family.source}:${family.peer}`, "conditional");
292
295
  const delegators = [finalCond(RULE_BY_ID.get("workflow")), ...r.members.filter((m) => m.delegates === true).map(memberCond)].map((c) => placementOf(evaluateMountCond(c, withEnv, rowWith)));
293
296
  const canCall = !callable.some((p) => p !== "absent") ? false : callable.includes("mounted") ? true : undefined;
@@ -344,6 +347,9 @@ export class ToolMountLedger {
344
347
  knows(f) {
345
348
  return this.#facts.has(f);
346
349
  }
350
+ factOf(f) {
351
+ return this.#facts.get(f);
352
+ }
347
353
  #source() {
348
354
  const leg = () => {
349
355
  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 {
@@ -55,4 +55,4 @@ export declare function readLegExecutionEnv(input: LegExecutionEnvInput): ToolMo
55
55
  * peers' families, evaluated over the facts read above. Refuses a spec prepare would refuse at the same doors. Whether the
56
56
  * leg needs an execution environment reads the session's own needs as open unless `statement` says the session is new.
57
57
  */
58
- export declare function planStaticToolMounts(deps: StaticToolPlanDeps, spec: StaticToolPlanSpec, statement?: StaticWiringStatement): ToolMountPlan;
58
+ export declare function planStaticToolMounts(deps: StaticToolPlanDeps, handed: StaticToolPlanSpec, statement?: StaticWiringStatement): ToolMountPlan;
@@ -24,10 +24,13 @@ import { seatsReachEnv } from "./mods/kernel/registration.js";
24
24
  import { legWriteProtectionTable } from "./runner/write-protection-station.js";
25
25
  import { readSkillsSeat } from "./runner/skills-seat.js";
26
26
  import { skillsThatLoad } from "./runner/synthetic-tools.js";
27
+ import { loadedSkills } from "./runner/loaded-skills.js";
28
+ import { readCallerSpec } from "./task-spec-members.js";
27
29
  import { screenUserAttachments, userAttachmentsNeedWorkspace } from "./user-attachment.js";
28
30
  import { workspaceDeclared } from "./session-checkout.js";
29
31
  import { writesProtectedPath } from "./tool-registry.js";
30
32
  import { callerMountSource, entryDelegates, planIdentityOf } from "./tool-roster.js";
33
+ import { withOwnLegHands } from "./child-clamp-seats.js";
31
34
  function anyOf(values) {
32
35
  if (values.includes(true))
33
36
  return true;
@@ -117,7 +120,8 @@ function protocolReading(preflight, leavesPeer) {
117
120
  if (!leavesPeer(prefix))
118
121
  continue;
119
122
  const writesPath = Object.entries(s.toolFaces ?? {}).some(([tool, face]) => writesProtectedPath([`${prefix}${tool}`], face.pathTarget));
120
- families.push({ family: { source: "mcp", peer: s.name, state: "conditional", when: ["listing.mcp"] }, writesPath });
123
+ const readsPath = Object.values(s.toolFaces ?? {}).some((face) => face.pathTarget?.access === "read");
124
+ families.push({ family: { source: "mcp", peer: s.name, state: "conditional", when: ["listing.mcp"] }, writesPath, ...(readsPath ? { readsPath } : {}) });
121
125
  }
122
126
  for (const p of preflight?.a2a ?? [])
123
127
  if (leavesPeer(mintNamespacePrefix(A2A_NAMESPACE, p.name)))
@@ -166,8 +170,13 @@ export function readLegExecutionEnv(input) {
166
170
  mods: word.mods,
167
171
  });
168
172
  }
169
- export function planStaticToolMounts(deps, spec, statement = {}) {
170
- const mode = refusePermissionModeDoors(spec) ?? "default";
173
+ export function planStaticToolMounts(deps, handed, statement = {}) {
174
+ const read = readCallerSpec(handed);
175
+ if (read.refusal !== undefined)
176
+ throw read.refusal;
177
+ const caller = read.spec;
178
+ const mode = refusePermissionModeDoors(caller) ?? "default";
179
+ const spec = withOwnLegHands(caller);
171
180
  const moded = withModeSeats(spec, mode);
172
181
  checkedPlanFileShape(spec.planFile);
173
182
  const lists = readToolFaceLists(spec);
@@ -195,18 +204,12 @@ export function planStaticToolMounts(deps, spec, statement = {}) {
195
204
  state(envFacts(deps));
196
205
  state(legFacts(deps, spec));
197
206
  state(seatFacts(deps, spec, leaves({ name: OFFLOAD_TOOL_NAME })));
198
- state({ "spec.planFile": spec.planFile !== undefined, "spec.mcp": (preflight?.mcp?.length ?? 0) > 0 });
207
+ state({ "spec.planFile": spec.planFile !== undefined });
199
208
  const declared = (name, viaAlias) => anyOf(entries.filter((e) => e.face.name === name || (viaAlias && e.face.aliases?.includes(name) === true)).map((e) => e.kept));
200
209
  const backgroundAgents = anyOf(entries.filter((e) => delegationHasBackgroundLane(e.face) && leaves(entryIdentity(e.face))).map((e) => e.kept));
201
210
  if (backgroundAgents !== undefined)
202
211
  facts.set("leg.backgroundAgents", backgroundAgents);
203
- const occupied = (names) => anyOf(names.map((n) => declared(n, true)));
204
- const sharedOccupied = occupied(mountGroupNames("sharedMemory"));
205
- const engineOccupied = occupied(mountGroupNames("memoryEngine"));
206
- if (sharedOccupied !== undefined)
207
- facts.set("names.occupied.sharedMemory", sharedOccupied);
208
- if (engineOccupied !== undefined)
209
- facts.set("names.occupied.memoryEngine", engineOccupied);
212
+ const skillsSeat = readSkillsSeat(spec.skills);
210
213
  const src = {
211
214
  fact: (f) => facts.get(f),
212
215
  valve: (identity) => leaves(identity),
@@ -219,13 +222,24 @@ export function planStaticToolMounts(deps, spec, statement = {}) {
219
222
  retracted: () => undefined,
220
223
  };
221
224
  const sessionNew = statement.session === "new" ? false : undefined;
222
- const word = wordReading(deps, spec, screenUserAttachments(spec.userAttachments, { resumeLeg: false }), listLegModSeats({ spec, deps, skills: skillsThatLoad(readSkillsSeat(spec.skills)) }));
223
- return planToolMounts({
225
+ const word = wordReading(deps, spec, screenUserAttachments(spec.userAttachments, { resumeLeg: false }), listLegModSeats({ spec, deps, skills: skillsThatLoad(skillsSeat) }));
226
+ const reading = {
224
227
  src,
225
228
  members: [...callerMembers(entries, leaves), ...protocol.members],
226
229
  families: protocol.families,
227
230
  writeProtected: legWriteProtectionTable(deps, spec).length > 0,
228
231
  asks: { ...word.asks, checkout: sessionNew, restore: sessionNew, compaction_restore: sessionNew, caller_placement: sessionNew },
229
232
  mods: word.mods,
230
- });
233
+ };
234
+ const executionEnv = readExecutionEnv(reading);
235
+ state({ "spec.mcp": (preflight?.mcp?.length ?? 0) > 0 });
236
+ state({ "listing.skills": loadedSkills(skillsSeat).length > 0 });
237
+ const occupied = (names) => anyOf(names.map((n) => declared(n, true)));
238
+ const sharedOccupied = occupied(mountGroupNames("sharedMemory"));
239
+ const engineOccupied = occupied(mountGroupNames("memoryEngine"));
240
+ if (sharedOccupied !== undefined)
241
+ facts.set("names.occupied.sharedMemory", sharedOccupied);
242
+ if (engineOccupied !== undefined)
243
+ facts.set("names.occupied.memoryEngine", engineOccupied);
244
+ return planToolMounts(reading, executionEnv);
231
245
  }
@@ -92,11 +92,42 @@ export declare function writeTargetToolNames(): ReadonlySet<string>;
92
92
  export declare function compactableToolNames(): ReadonlySet<string>;
93
93
  /** A-5 — the aggregate-budget exemptions (`budgetExempt: true`). */
94
94
  export declare function budgetExemptToolNames(): ReadonlySet<string>;
95
- /** The value a call's args carry under a path target: `param` first, then each alias, first non-empty string wins. */
95
+ /** The value a call's args carry under a path target: `param` first, then each alias, first non-empty string wins — the spelling
96
+ * an engine tool's body opens, so every judge of an engine tool's target and of every write reads this one. */
96
97
  export declare function pathTargetValue(args: unknown, pt: {
97
98
  param: string;
98
99
  aliases?: readonly string[];
99
100
  }): string | undefined;
101
+ /** The most targets one call's slot may name: a judge resolves each of them in the call's environment before the gate's deadline. */
102
+ export declare const PATH_TARGET_ELEMENTS_MAX = 100;
103
+ /**
104
+ * The read slot a call's OWN face declares, when the tool is not one the engine mounted (a caller's `TaskSpec.tools` entry, an MCP
105
+ * tool under its server's `toolFaces`) — whatever names it answers to. Such a slot is read by {@link declaredSlotValues}; every other
106
+ * slot (an engine tool's, a write's, the catalog floor of a name) by {@link pathTargetValue}.
107
+ */
108
+ export declare function declaredReadSlotOf(call: Pick<ToolCallLike, "face">): ToolCallPathTarget | undefined;
109
+ /**
110
+ * The values a DECLARED read slot ({@link declaredReadSlotOf}) carries: decided without reading a value, the slot's
111
+ * spellings that are the call's OWN keys (`Object.hasOwn`) if any, otherwise every spelling (ordinary lookup, inherited
112
+ * keys included); each chosen spelling is read once. `undefined` is absent; with `each: true` a list expands to its
113
+ * elements; every other value is handed on as read (a non-string or empty string is kept for the reader to refuse).
114
+ */
115
+ export declare function declaredSlotValues(args: unknown, pt: {
116
+ param: string;
117
+ aliases?: readonly string[];
118
+ each?: true | boolean;
119
+ }): readonly unknown[];
120
+ /**
121
+ * THE reading of a declared read slot every reader of a call's targets takes (the read station's selection, the sensitive-path list):
122
+ * the call's declared read slot ({@link declaredReadSlotOf}) with the values its chosen spellings carry ({@link declaredSlotValues}) —
123
+ * an empty list where nothing was carried, never falling back to {@link pathTargetValue}; `undefined` only when the call has no
124
+ * declared read slot.
125
+ */
126
+ export declare function declaredReadValuesOf(call: Pick<ToolCallLike, "face" | "args">): {
127
+ readonly slot: ToolCallPathTarget;
128
+ readonly values: readonly unknown[];
129
+ readonly present: boolean;
130
+ } | undefined;
100
131
  /**
101
132
  * CC parity: Read/Edit/Write take the file path as `file_path`. Read the target the same way
102
133
  * EVERYWHERE the path is consumed from a tool-call's args — not just the tool body but ALSO every gate that
@@ -128,6 +159,7 @@ export interface ToolCallLike {
128
159
  pathTarget?: ToolCallPathTarget;
129
160
  hostTarget?: ToolHostTarget;
130
161
  names?: readonly string[];
162
+ engineMounted?: boolean;
131
163
  } | undefined;
132
164
  }
133
165
  type CallPathTarget = ToolCallPathTarget;
@@ -96,6 +96,39 @@ export function pathTargetValue(args, pt) {
96
96
  }
97
97
  return undefined;
98
98
  }
99
+ export const PATH_TARGET_ELEMENTS_MAX = 100;
100
+ export function declaredReadSlotOf(call) {
101
+ const f = call.face;
102
+ return f !== undefined && f.engineMounted !== true && f.pathTarget?.access === "read" ? f.pathTarget : undefined;
103
+ }
104
+ function readDeclaredSlot(args, pt) {
105
+ if (args === null || typeof args !== "object")
106
+ return { values: [], present: false };
107
+ const a = args;
108
+ const spellings = [...new Set([pt.param, ...(pt.aliases ?? [])])];
109
+ const own = spellings.filter((k) => Object.hasOwn(a, k));
110
+ const chosen = own.length > 0 ? own : spellings;
111
+ let present = false;
112
+ const out = [];
113
+ for (const k of chosen) {
114
+ const v = a[k];
115
+ if (v === undefined)
116
+ continue;
117
+ present = true;
118
+ if (pt.each === true && Array.isArray(v))
119
+ out.push(...Array.from(v));
120
+ else
121
+ out.push(v);
122
+ }
123
+ return { values: out, present };
124
+ }
125
+ export function declaredSlotValues(args, pt) {
126
+ return readDeclaredSlot(args, pt).values;
127
+ }
128
+ export function declaredReadValuesOf(call) {
129
+ const slot = declaredReadSlotOf(call);
130
+ return slot === undefined ? undefined : { slot, ...readDeclaredSlot(call.args, slot) };
131
+ }
99
132
  const FILE_ARG_PATH_TARGET = { param: "file_path", aliases: ["path"] };
100
133
  export function fileArgPath(args) {
101
134
  return pathTargetValue(args, FILE_ARG_PATH_TARGET);
@@ -810,9 +810,26 @@ 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
+ /** The run's offload persist: called, it starts the put under this session's ref and returns the ref at once; `flush` settles
822
+ * when every put started so far has settled (a rejected put settles too — it is reported, never rethrown), when `signal`
823
+ * 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
824
+ * (`tool_result.offload_put_unsettled`), run on, and no later `flush` waits for them again. */
825
+ export interface OffloadPersist {
826
+ (toolCallId: string, fullText: string): string;
827
+ readonly flush: (signal?: AbortSignal) => Promise<void>;
828
+ }
813
829
  /**
814
830
  * 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).
831
+ * live inline in prepare-task). The caller gets the ref synchronously; the put runs on, and the request builder waits for the
832
+ * puts in flight (`flush`) before the refs reach the model, giving way to a cut of the turn.
816
833
  *
817
834
  * A failed put REPORTS the loss, it never writes under the ref. The previous arm
818
835
  * wrote a lost-marker row under the SAME ref "so the page-back face reports the true cause", and that
@@ -852,7 +869,7 @@ export declare function createOffloadPersist(store: ToolResultSeat, sessionId: s
852
869
  onNotice?: (notice: import("./types.js").EngineNotice) => void,
853
870
  /** The session's once-record for the one fact this persist tells once (an entry of the session's own with no identity
854
871
  * 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;
872
+ tellOnce?: (deliver: () => void) => void): OffloadPersist;
856
873
  /**
857
874
  * The byte sibling of {@link createOffloadPersist}: keep `bytes` (claimed `mimeType`) a tool result carried for the call
858
875
  * `toolCallId` in the seat's store (its byte arm), under a content-addressed ref and the session's owner — or say why not, in