@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
@@ -7,7 +7,7 @@ import type { StoreFidelity, Checkpoint, CheckpointGate, PendingAction } from ".
7
7
  * had carried beside the one its word now names, and the members added after the table, each a capability a reader
8
8
  * must have. Downstream reads them for display only (`CheckpointError.detail.requires`).
9
9
  */
10
- export declare const REQUIREMENT_WORDS: readonly ["resource", "binding", "token", "orgAdmission", "f012", "realApproval", "face", "requirements_digest", "org_admission_inherited", "org_write_grant", "org_governed", "delegation_provenance", "skill_grants", "skill_card_binding", "hands_coordinates", "hands_home", "path_rule_anchors", "path_rule_installations", "permission_mode", "plan_mode_restore", "persisted_rule_mandate", "deployment_authored", "call_names", "write_face", "denial_limit_fallback", "leg_scope", "tool_ceiling", "tool_lists_judged", "own_tool_lists", "approval_targets", "approval_target_reads", "cross_boundary", "mount_site", "skill_scopes", "run_origin", "tool_declaration", "composition_leg", "row_task_id", "held_rows", "source_session", "tool_binding", "raw_name_identity", "isolation_scope", "from_subagent", "command_sandbox", "agent_config_dirs", "agent_home_dirs", "read_block", "persisted_rule_buckets", "constraint_layer_kinds"];
10
+ export declare const REQUIREMENT_WORDS: readonly ["resource", "binding", "token", "orgAdmission", "f012", "realApproval", "face", "requirements_digest", "org_admission_inherited", "org_write_grant", "org_governed", "delegation_provenance", "skill_grants", "skill_card_binding", "hands_coordinates", "hands_home", "path_rule_anchors", "path_rule_installations", "permission_mode", "plan_mode_restore", "persisted_rule_mandate", "deployment_authored", "call_names", "write_face", "denial_limit_fallback", "leg_scope", "tool_ceiling", "tool_lists_judged", "own_tool_lists", "approval_targets", "approval_target_reads", "cross_boundary", "mount_site", "skill_scopes", "run_origin", "tool_declaration", "composition_leg", "row_task_id", "held_rows", "source_session", "tool_binding", "raw_name_identity", "isolation_scope", "from_subagent", "command_sandbox", "agent_config_dirs", "agent_home_dirs", "read_block", "persisted_rule_buckets", "constraint_layer_kinds", "run_ledger", "leg_identity"];
11
11
  export type RequirementWord = (typeof REQUIREMENT_WORDS)[number];
12
12
  /** Runtime twin of {@link RequirementWord}. */
13
13
  export declare function isRequirementWord(word: unknown): word is RequirementWord;
@@ -327,6 +327,12 @@ export declare const CHECKPOINT_STATE_REQUIREMENTS: {
327
327
  readonly agentHomeDirs: {
328
328
  readonly word: "agent_home_dirs";
329
329
  };
330
+ readonly runLedger: {
331
+ readonly word: "run_ledger";
332
+ };
333
+ readonly legIdentity: {
334
+ readonly word: "leg_identity";
335
+ };
330
336
  };
331
337
  export declare const PENDING_ACTION_REQUIREMENTS: {
332
338
  readonly tool_approval: {
@@ -567,7 +573,11 @@ export declare const CHECKPOINT_GATE_REQUIREMENTS: {
567
573
  };
568
574
  readonly plan_review: {
569
575
  readonly kind: {
570
- readonly digest: "decision-read";
576
+ readonly word: "leg_identity";
577
+ readonly earlier: {
578
+ readonly was: "decision-read";
579
+ readonly agrees: () => true;
580
+ };
571
581
  };
572
582
  readonly reason: {
573
583
  readonly digest: "decision-read";
@@ -797,6 +807,12 @@ export declare const CHECKPOINT_REQUIREMENTS: {
797
807
  readonly agentHomeDirs: {
798
808
  readonly word: "agent_home_dirs";
799
809
  };
810
+ readonly runLedger: {
811
+ readonly word: "run_ledger";
812
+ };
813
+ readonly legIdentity: {
814
+ readonly word: "leg_identity";
815
+ };
800
816
  };
801
817
  };
802
818
  readonly resourceLedger: {
@@ -939,7 +955,11 @@ export declare const CHECKPOINT_REQUIREMENTS: {
939
955
  };
940
956
  readonly plan_review: {
941
957
  readonly kind: {
942
- readonly digest: "decision-read";
958
+ readonly word: "leg_identity";
959
+ readonly earlier: {
960
+ readonly was: "decision-read";
961
+ readonly agrees: () => true;
962
+ };
943
963
  };
944
964
  readonly reason: {
945
965
  readonly digest: "decision-read";
@@ -54,6 +54,8 @@ export const REQUIREMENT_WORDS = Object.freeze([
54
54
  "read_block",
55
55
  "persisted_rule_buckets",
56
56
  "constraint_layer_kinds",
57
+ "run_ledger",
58
+ "leg_identity",
57
59
  ]);
58
60
  export function isRequirementWord(word) {
59
61
  return typeof word === "string" && REQUIREMENT_WORDS.includes(word);
@@ -129,6 +131,8 @@ export const CHECKPOINT_STATE_REQUIREMENTS = {
129
131
  commandSandbox: { word: "command_sandbox" },
130
132
  agentConfigDirs: { word: "agent_config_dirs" },
131
133
  agentHomeDirs: { word: "agent_home_dirs" },
134
+ runLedger: { word: "run_ledger" },
135
+ legIdentity: { word: "leg_identity" },
132
136
  };
133
137
  export const PENDING_ACTION_REQUIREMENTS = {
134
138
  tool_approval: {
@@ -188,7 +192,7 @@ export const CHECKPOINT_GATE_REQUIREMENTS = {
188
192
  irreversible_ask: { kind: DECISION_READ, reason: DECISION_READ, toolName: DECISION_READ, approvalCard: DECISION_READ, safetyAxis: SHOWN, realApproval: { word: "realApproval" }, riskDescriptor: SHOWN },
189
193
  resource_limit: { kind: { word: "resource" }, reason: DECISION_READ, resumeAfterMs: DECISION_READ },
190
194
  needs_review: { kind: DECISION_READ, reason: DECISION_READ },
191
- plan_review: { kind: DECISION_READ, reason: DECISION_READ },
195
+ plan_review: { kind: { word: "leg_identity", earlier: { was: "decision-read", agrees: () => true } }, reason: DECISION_READ },
192
196
  task_done: { kind: DECISION_READ },
193
197
  };
194
198
  export const CHECKPOINT_REQUIREMENTS = {
@@ -91,7 +91,7 @@ export declare const ROW_REFUSAL_SENTENCES: Readonly<{
91
91
  readonly "checkpoint.invalid_outcome|hands_coordinates_damaged": "This engine cannot resume this checkpoint: one of its recorded workspace coordinates is not an absolute path (a corruption guard). The checkpoint stays pending. Expire it, then start the task again.";
92
92
  readonly "checkpoint.invalid_outcome|constraint_chain_missing": "This engine cannot resume this checkpoint: it requires parent constraints but does not carry both their frozen chain and its digest (a corruption or downgrade guard). The checkpoint stays pending. Expire it, then start the task again.";
93
93
  readonly "checkpoint.walltime_axis_retired|": "This engine cannot resume this checkpoint: its budget carries a wall-clock allocation, an axis this engine retired, so resuming here would run the work with that ceiling unenforced. The checkpoint stays pending. Expire it and start a fresh task bounded by tokens or budget.";
94
- readonly "resume.parent_constraint_mismatch|": "This engine cannot resume this checkpoint: its own recorded constraint chain does not match the digest it records (a corrupt or inconsistently minted row). The checkpoint stays pending. Expire it, then start the task again.";
94
+ readonly "resume.parent_constraint_mismatch|constraint_chain_damaged": "This engine cannot resume this checkpoint: its own recorded constraint chain does not match the digest it records (a corrupt or inconsistently minted row). The checkpoint stays pending. Expire it, then start the task again.";
95
95
  readonly "config.permission_mode_invalid": "This engine cannot resume this checkpoint: a permission mode it records is not one this engine reads (or not one a plan can return to). The checkpoint stays pending. Expire it and run the work again.";
96
96
  readonly "config.run_origin_invalid": "This engine cannot resume this checkpoint: the run origin it records is not a word this engine knows. The checkpoint stays pending. Expire it and run the work again.";
97
97
  readonly "config.tool_face_control": "This engine cannot resume this checkpoint: its frozen inherited constraint chain records a tool name in a spelling this engine does not replay. The checkpoint stays pending. Expire it and run the work again under a policy that names each tool by its bare name.";
@@ -5,6 +5,7 @@ import { validatePath } from "./effective-path-target.js";
5
5
  import { persistedReadDenyEntryProblem } from "../tools/fs/read-deny.js";
6
6
  import { readFrozenSkillGrants } from "./skill-grant.js";
7
7
  import { readFrozenSkillScopes } from "./mods/spec-seats.js";
8
+ import { readRunLedgerParked } from "./run-ledger.js";
8
9
  import { constraintChainDigestReading } from "./tool-policy.js";
9
10
  import { asResumeConfigRefusal } from "./mode-policy.js";
10
11
  import { screenRecordedRunOrigin } from "./run-origin.js";
@@ -12,7 +13,7 @@ import { refusePersistedToolNames } from "./runner/sub-agent-deny-lists.js";
12
13
  import { boundedThrownName } from "./thrown-value.js";
13
14
  import { memberPresent } from "./own-property-receipt.js";
14
15
  import { CHECKPOINT_ROW_DAMAGED_SENTENCE, checkpointRowUnreadable, rowMemberProblem } from "./checkpoint-queries.js";
15
- import { SYNC_CHILD_BLOCK_MEMBERS } from "./leg-identity.js";
16
+ import { readLegIdentityRecord, SYNC_CHILD_BLOCK_MEMBERS } from "./leg-identity.js";
16
17
  import { checkpointExecutionRecorded } from "./checkpoint-execution-record.js";
17
18
  import { readStoredPrincipal, recordedPrincipalNameOf } from "./principal-name.js";
18
19
  import { GLOBAL_USAGE_KEY } from "./usage-window-store.js";
@@ -45,7 +46,7 @@ export const ROW_REFUSAL_SENTENCES = Object.freeze({
45
46
  "checkpoint.invalid_outcome|hands_coordinates_damaged": "This engine cannot resume this checkpoint: one of its recorded workspace coordinates is not an absolute path (a corruption guard). The checkpoint stays pending. Expire it, then start the task again.",
46
47
  "checkpoint.invalid_outcome|constraint_chain_missing": "This engine cannot resume this checkpoint: it requires parent constraints but does not carry both their frozen chain and its digest (a corruption or downgrade guard). The checkpoint stays pending. Expire it, then start the task again.",
47
48
  "checkpoint.walltime_axis_retired|": "This engine cannot resume this checkpoint: its budget carries a wall-clock allocation, an axis this engine retired, so resuming here would run the work with that ceiling unenforced. The checkpoint stays pending. Expire it and start a fresh task bounded by tokens or budget.",
48
- "resume.parent_constraint_mismatch|": "This engine cannot resume this checkpoint: its own recorded constraint chain does not match the digest it records (a corrupt or inconsistently minted row). The checkpoint stays pending. Expire it, then start the task again.",
49
+ "resume.parent_constraint_mismatch|constraint_chain_damaged": "This engine cannot resume this checkpoint: its own recorded constraint chain does not match the digest it records (a corrupt or inconsistently minted row). The checkpoint stays pending. Expire it, then start the task again.",
49
50
  "config.permission_mode_invalid": "This engine cannot resume this checkpoint: a permission mode it records is not one this engine reads (or not one a plan can return to). The checkpoint stays pending. Expire it and run the work again.",
50
51
  "config.run_origin_invalid": "This engine cannot resume this checkpoint: the run origin it records is not a word this engine knows. The checkpoint stays pending. Expire it and run the work again.",
51
52
  "config.tool_face_control": "This engine cannot resume this checkpoint: its frozen inherited constraint chain records a tool name in a spelling this engine does not replay. The checkpoint stays pending. Expire it and run the work again under a policy that names each tool by its bare name.",
@@ -65,7 +66,7 @@ export const ROW_REFUSAL_TERMINAL = Object.freeze({
65
66
  "checkpoint.invalid_outcome|hands_coordinates_damaged": true,
66
67
  "checkpoint.invalid_outcome|constraint_chain_missing": true,
67
68
  "checkpoint.walltime_axis_retired|": false,
68
- "resume.parent_constraint_mismatch|": true,
69
+ "resume.parent_constraint_mismatch|constraint_chain_damaged": true,
69
70
  "config.permission_mode_invalid": false,
70
71
  "config.run_origin_invalid": false,
71
72
  "config.tool_face_control": false,
@@ -227,6 +228,11 @@ function rowRefusalOf(cp) {
227
228
  return new CheckpointError("checkpoint.invalid_outcome", "this checkpoint carries a skill-grant section (state.skillGrants) that does not read as grant rows under this engine — a damaged section, or a row an earlier release wrote whose entry this release reads as nothing (an entry with a surrounding space, say) — refusing to resume without the grant rows and refusals it carries; the checkpoint stays pending: expire it and run the work again", { reason: "skill_grants_damaged" });
228
229
  if (readFrozenSkillScopes(cp.state.skillScopes) === undefined)
229
230
  return new CheckpointError("checkpoint.invalid_outcome", "this checkpoint carries a skill-scope section (state.skillScopes) that does not read as a list of SkillSpec names — a damaged section — refusing to resume without the active skills' hooks it records; the checkpoint stays pending: expire it and run the work again", { reason: "skill_scopes_damaged" });
231
+ const runLedgerRaw = cp.state.runLedger;
232
+ if (runLedgerRaw !== undefined && readRunLedgerParked(runLedgerRaw) === undefined)
233
+ return new CheckpointError("checkpoint.invalid_outcome", "this checkpoint's member ledger section (state.runLedger) does not read as the book an engine froze — a damaged row; the checkpoint stays pending", { reason: "requirements_damaged" });
234
+ if (readLegIdentityRecord(cp.state.legIdentity) === "damaged")
235
+ return new CheckpointError("checkpoint.invalid_outcome", "this checkpoint's leg identity section (state.legIdentity) does not read as the record an engine mints — a damaged row; the checkpoint stays pending", { reason: "requirements_damaged" });
230
236
  for (const field of ["handsRoot", "handsHome", "handsCwd"]) {
231
237
  const coordinate = cp.state[field];
232
238
  if (coordinate !== undefined && validatePath(coordinate, { intent: "validate-coordinate" }) === undefined)
@@ -250,7 +256,7 @@ function rowRefusalOf(cp) {
250
256
  if (expectedDigest !== undefined && reading !== "same") {
251
257
  return new CheckpointError("resume.parent_constraint_mismatch", "the checkpoint's OWN recorded constraint chain does not match its recorded digest " +
252
258
  "(corrupt / inconsistently-minted row) — the frozen deny data the resume would execute is not the data the " +
253
- "digest authenticates; rejected pre-CAS (the checkpoint stays pending)");
259
+ "digest authenticates; rejected pre-CAS (the checkpoint stays pending)", { reason: "constraint_chain_damaged" });
254
260
  }
255
261
  }
256
262
  return undefined;
@@ -670,6 +670,12 @@ export type ResumeOutcome = {
670
670
  decision: "approve" | "edit" | "reject";
671
671
  editedPlan?: string;
672
672
  reason?: string;
673
+ /** The mode the approved plan runs under — the approver's choice, on `approve` / `edit` only: any mode but `plan` (an approved
674
+ * plan is not kept open). Absent ⇒ the resume config's mode (a config of `plan` reads as none), else the mode the leg had before
675
+ * the plan. Recorded on the decided row (`ResolvedOutcome.permissionMode`), so an `env_failed` retry replays it. Refused before the
676
+ * claim (`checkpoint.invalid_outcome`, the row pending): a word outside the set, `plan`, a mode on a `reject`, or a mode the
677
+ * resume config contradicts (a config naming another mode but `plan`). */
678
+ permissionMode?: PermissionMode;
673
679
  /** Who ended this wait — the tool-approval arm's member, same shape, closed set, validation and refusals; REQUIRED.
674
680
  * `reject` is the refusal direction; `"sla_timeout"` is refused here (a plan pause expires, a sweep never resolves it). */
675
681
  hostDecision: HostDecisionFacts;
@@ -1373,8 +1379,8 @@ export interface CheckpointState {
1373
1379
  * frame — a deployment watching only that seat saw a human-approved delegation frozen at its
1374
1380
  * park-leg `"suspended"` terminal forever. Live internals still win when re-supplied (the in-engine
1375
1381
  * resume lanes all do); the checkpoint key is the fallback for the deps-only leg. Of the delegation
1376
- * axes this one, {@link fromSubagent} and the asks' display name ({@link sourceAgentName}) persist — `insideFork`, the hook identity's
1377
- * `agentName` / `spawnName` and `parentToolCallId` stay internals-only, honestly absent on a deps-only resume rather than guessed. `insideFork` needs no axis: no lane holds a fork leg's
1382
+ * axes this one, {@link fromSubagent}, the asks' display name ({@link sourceAgentName}) and the {@link legIdentity} section (the spawn name
1383
+ * among it) persist — `insideFork`, the hook identity's `agentName` and `parentToolCallId` stay internals-only, honestly absent on a deps-only resume rather than guessed. `insideFork` needs no axis: no lane holds a fork leg's
1378
1384
  * parks (`RunInternals.parkLaneHeld` is set only by a background lane that can park and an armed
1379
1385
  * workflow), so a fork leg mints no row and no resume of one exists to read the facet back. Schema ADDITION (additive, old readers ignore it —
1380
1386
  * the Q5 posture; no version movement): an older worker resuming a newer row keeps the pre-key
@@ -1500,6 +1506,18 @@ export interface CheckpointState {
1500
1506
  agentConfigDirs?: string[];
1501
1507
  /** The caller homes a task layer of the parked leg declared: a resume places the home-anchored rows there again. */
1502
1508
  agentHomeDirs?: string[];
1509
+ /** The parked leg's member ledger book (`TaskSpec.runLedger`; {@link import("./run-ledger.js").RunLedgerParked}): the members it
1510
+ * dispatched, the calls a check may cite, the accepted claims and the snapshot numbering — the leg that resumes the row continues
1511
+ * the same book. Written on every park of a leg that keeps a book; absent ⇒ the leg kept none, and a resumed leg that declares a
1512
+ * ledger starts a new one. A reader that lacks the word would resume the leg with the members dispatched before the park gone
1513
+ * from its ledger (an older engine refuses the row as newer); a section that does not read is a damaged row. */
1514
+ runLedger?: import("./run-ledger.js").RunLedgerParked;
1515
+ /** The parked leg's identity facts ({@link import("./leg-identity.js").LegIdentityRecord}: the task id its host declared, the task that
1516
+ * spawned it, its tree's root and that root's occupant, its explicit spawn name), stamped at every mint; a resume reads each one
1517
+ * the resuming call does not hand (live wins), so the resumed leg runs as the leg that parked. Absent ⇒ the leg had none of them, or
1518
+ * an earlier release minted the row (each then reads as the resume hands it). A reader that lacks the word would resume the leg
1519
+ * under the resuming call's identities (an older engine refuses the row as newer); a section that does not read is a damaged row. */
1520
+ legIdentity?: import("./leg-identity.js").LegIdentityRecord;
1503
1521
  }
1504
1522
  /**
1505
1523
  * {@link CheckpointState} with **every** field made required-PRESENT, while each value keeps its original
@@ -1622,6 +1640,10 @@ export interface ResolvedOutcome {
1622
1640
  * and bound by the replay equality on the same ADDITIVE rule as {@link reason}: absence means "never recorded". No
1623
1641
  * reader requirement word guards it: `resolvedOutcome` is a store-written state-machine member, never minted with the row. */
1624
1642
  feedback?: string;
1643
+ /** The mode an approved or edited `plan_review` exits the plan to, as the approval named it (`outcome.permissionMode`): the
1644
+ * substance of the approval, bound by the replay equality on the same ADDITIVE rule as {@link reason} (absence = never recorded:
1645
+ * a winner of a decision that named none, or one written before the member, leaves the mode unbound on a retry). */
1646
+ permissionMode?: PermissionMode;
1625
1647
  /** The settlement record core minted for this decide ({@link import("./gate-outcome.js").GateOutcome}):
1626
1648
  * the row's own copy of what the resolved call's `tool_end` frame carries, written with the winner so
1627
1649
  * an audit reading the row reads the same record the stream carried. NOT part of the replay equality
@@ -478,6 +478,7 @@ export function winnerFromOutcome(outcome) {
478
478
  decision: outcome.decision,
479
479
  ...(editedPlan !== undefined ? { updatedInput: editedPlan } : {}),
480
480
  ...(outcome.reason !== undefined ? { reason: outcome.reason } : {}),
481
+ ...(outcome.gate === "plan_review" && outcome.permissionMode !== undefined ? { permissionMode: outcome.permissionMode } : {}),
481
482
  ...(outcome.gate === "plan_review" && outcome.gateOutcome !== undefined ? { gateOutcome: outcome.gateOutcome } : {}),
482
483
  };
483
484
  }
@@ -343,6 +343,21 @@ export declare const CHILD_CLAMP_SEATS_NOT_CARRIED: Readonly<Record<string, stri
343
343
  * shape it misses leaves the real constructor invisible while a namesake answers for it.
344
344
  */
345
345
  export declare const ENGINE_CHILD_SPEC_CONSTRUCTORS: readonly ["src/agents/subagent.ts#buildChildSpec", "src/agents/subagent.ts#observerSpec", "src/agents/subagent.ts#resumeSpec", "src/agents/verify.ts#verifierSpec", "src/agents/verify.ts#fixLegSpec", "src/orchestration/workflow-primitives.ts#workflowChildClamps"];
346
+ /**
347
+ * THE leg-local narrowing of a leg's hands ({@link TaskSpec.ownHandsReadOnly}) — the one place it meets the table's
348
+ * `handsReadOnly` row. A leg that declares it reads its own hands exactly as a `handsReadOnly` leg does (every reader of
349
+ * the leg reads the one `handsReadOnly` cell, rebound here), while the clamp its children inherit stays the one it was
350
+ * handed: {@link handsReadOnlyCarried} is what the run's clamp source reads for that row. The narrowing therefore subtracts
351
+ * from this leg alone and never reaches a child — a child's hands are exactly what they would be without it.
352
+ *
353
+ * Rebound shape: `ownHandsReadOnly` is kept on the spec only while it is the SOLE reason the leg is read-only (a spec that
354
+ * was also handed the clamp drops it: the clamp already travels), so "the read-only cell here is this leg's own" is one
355
+ * reading of the rebound spec. A value other than `true` or absent is refused (a `false` would read as a loosening).
356
+ */
357
+ export declare function withOwnLegHands<S extends Pick<TaskSpec, "handsReadOnly" | "ownHandsReadOnly">>(spec: S): S;
358
+ /** The `handsReadOnly` cell a rebound spec hands its children: the spec's own cell, unless that cell is the leg-local
359
+ * narrowing ({@link withOwnLegHands}), which never travels. */
360
+ export declare function handsReadOnlyCarried(spec: Pick<TaskSpec, "handsReadOnly" | "ownHandsReadOnly">): TaskSpec["handsReadOnly"];
346
361
  /** Do these clamps leave nobody on the leg to ask — the hard-headless clamp (`interactiveTools: false`) or the declaration
347
362
  * that nobody can be asked (`approvalReach: "none"`)? The one reading {@link postureUnderClamps} and a revival's posture read. */
348
363
  export declare function clampsReachNoPerson(clamps: {
@@ -342,6 +342,21 @@ export const ENGINE_CHILD_SPEC_CONSTRUCTORS = Object.freeze([
342
342
  "src/agents/verify.ts#fixLegSpec",
343
343
  "src/orchestration/workflow-primitives.ts#workflowChildClamps",
344
344
  ]);
345
+ export function withOwnLegHands(spec) {
346
+ const own = spec.ownHandsReadOnly;
347
+ if (own === undefined)
348
+ return spec;
349
+ if (own !== true)
350
+ throw clampRecordError(`TaskSpec.ownHandsReadOnly must be true or absent (got ${describeStated(own)}) — it only narrows this leg's own hands; to keep them whole, leave it out.`);
351
+ if (spec.handsReadOnly === CLAMP_SET.handsReadOnly.value) {
352
+ const { ownHandsReadOnly: _dropped, ...rest } = spec;
353
+ return rest;
354
+ }
355
+ return { ...spec, handsReadOnly: CLAMP_SET.handsReadOnly.value };
356
+ }
357
+ export function handsReadOnlyCarried(spec) {
358
+ return spec.ownHandsReadOnly === true ? undefined : spec.handsReadOnly;
359
+ }
345
360
  export function clampsReachNoPerson(clamps) {
346
361
  return clamps.interactiveTools === false || clamps.approvalReach === "none";
347
362
  }
@@ -423,6 +423,7 @@ export declare function taskStartedFrame(run: {
423
423
  sessionId: string;
424
424
  model: string;
425
425
  identity: import("./hooks.js").HookInvocationIdentity;
426
+ startedAt: number;
426
427
  }, spawner: {
427
428
  delegationTaskType?: import("./task-event.js").DelegationTaskType;
428
429
  cycleSeq?: number;
@@ -75,7 +75,7 @@ export function taskStartedFrame(run, spawner, stamp) {
75
75
  ...(spawner?.explicitAgentName !== undefined ? { spawnName: spawner.explicitAgentName } : {}),
76
76
  ...(spawner?.spawnAgentType !== undefined ? { agentType: spawner.spawnAgentType } : {}),
77
77
  model: run.model,
78
- startedAt: Date.now(),
78
+ startedAt: run.startedAt,
79
79
  ...stamp,
80
80
  };
81
81
  }
@@ -133,6 +133,19 @@ export declare function effectivePathSpellingOf(call: ToolCallLike, pt: ToolCall
133
133
  } | {
134
134
  readonly refused: Win32NamespaceRefusal;
135
135
  } | undefined;
136
+ /** One target's selection ({@link effectivePathSpellingOf}'s answer), or an element of a slot that names several which is not a
137
+ * non-empty string (`malformed`: nothing a reader can place). */
138
+ export type PathSpellingSelection = NonNullable<ReturnType<typeof effectivePathSpellingOf>> | {
139
+ readonly malformed: true;
140
+ };
141
+ /**
142
+ * The SELECTION of EVERY target a call's slot names. A slot the call's own face declares for a read (a caller's or an MCP tool's) is
143
+ * read ONCE by {@link declaredReadValuesOf} (never falling back to {@link pathTargetValue}): every element that is a non-empty string
144
+ * selects against the slot's base, any other value is `malformed`, and an absent slot reads {@link absentPathSpellingOf}. Every other
145
+ * slot (an engine tool's, a write's) is the one selection {@link effectivePathSpellingOf} makes. `[]` ⇔ only empty lists; `undefined`
146
+ * ⇔ no target in this reading.
147
+ */
148
+ export declare function effectivePathSpellingsOf(call: ToolCallLike, pt: ToolCallPathTarget | undefined, bases: ToolPathBases): readonly PathSpellingSelection[] | undefined;
136
149
  /**
137
150
  * THE path prelude: ONE spelling → the identity of the path the TOOL will open it as. Every reading of a spelling passes
138
151
  * through here — the target slot's own value, a `patternParam`'s derived base, an empty slot's base, the views of
@@ -176,6 +189,12 @@ export type CallTargetView = {
176
189
  export interface CallTargetReading {
177
190
  readonly protective?: CallTargetView;
178
191
  readonly declared?: CallTargetView;
192
+ /** A slot that names several targets (`pathTarget.each`): the views of EVERY element, per reading, in slot order — the call is
193
+ * about all of them, so `protective` / `declared` are absent. A rule lane reads them through {@link callTargetViewsOf}. */
194
+ readonly each?: {
195
+ readonly protective?: readonly CallTargetView[];
196
+ readonly declared?: readonly CallTargetView[];
197
+ };
179
198
  /** Where each location on the way to a rule row's head that this leg's lanes hold LEADS in the leg's environment (a
180
199
  * link, a firmlink, an alias of the tree) — the rows' twins are judged there too. A fact of the judging leg, taken
181
200
  * once per location per leg; absent when no row head leads elsewhere. */
@@ -1,5 +1,5 @@
1
1
  import { anchorSpelling, canonicalizeTarget, familyFor, hasWin32AliasedComponent, isAbsoluteForFamily, normalizeAbsPathLexically, pathFamilyOf, pathIdentityOf, spellingOfIdentity, win32NamespaceScreen } from "../tools/fs/safety.js";
2
- import { declaredPathTargetOf, pathTargetValue, protectivePathTargetOf } from "./tool-registry.js";
2
+ import { declaredPathTargetOf, declaredReadValuesOf, pathTargetValue, protectivePathTargetOf } from "./tool-registry.js";
3
3
  import { leafChainMayHold, symlinkChainHops } from "./path-identity.js";
4
4
  import { DEFAULT_GATE_AWAIT_TIMEOUT_MS, withGateTimeout } from "./gate-bounded-await.js";
5
5
  import { thrownText } from "./thrown-value.js";
@@ -33,25 +33,14 @@ export function splitAbsoluteGlobPattern(pattern, tree) {
33
33
  }
34
34
  export function effectivePathTargetOf(call, pt, bases) {
35
35
  const spelling = effectivePathSpellingOf(call, pt, bases);
36
- if (spelling === undefined)
37
- return undefined;
38
- if ("refused" in spelling)
39
- return { kind: "refused", reason: spelling.refused };
40
- if (spelling.spelled !== undefined)
41
- return placeSpelling(spelling.spelled, spelling.base, bases);
42
- return spelling.base !== undefined && isAbsoluteForFamily(readingFamilyOf(bases, spelling.base), spelling.base) ? placeSpelling(spelling.base, undefined, bases) : unreadableBase(spelling.base);
36
+ return spelling === undefined ? undefined : selectionTargetOf(spelling, bases);
43
37
  }
44
- export function effectivePathSpellingOf(call, pt, bases) {
45
- if (pt === undefined)
46
- return undefined;
38
+ function absentPathSpellingOf(args, pt, bases) {
47
39
  const declaredBase = pathTargetBaseOf(pt, bases);
48
- const spelled = pathTargetValue(call.args, pt);
49
- if (spelled !== undefined)
50
- return { spelled, base: declaredBase };
51
40
  if (pathTargetResolutionOf(pt).absent === "none")
52
41
  return undefined;
53
42
  if (pt.patternParam !== undefined) {
54
- const pattern = pathTargetValue(call.args, { param: pt.patternParam });
43
+ const pattern = pathTargetValue(args, { param: pt.patternParam });
55
44
  const split = pattern === undefined ? undefined : splitAbsoluteGlobPattern(pattern, pathFamilyOf(bases));
56
45
  if (split !== undefined && "refused" in split)
57
46
  return { refused: split.refused };
@@ -60,6 +49,38 @@ export function effectivePathSpellingOf(call, pt, bases) {
60
49
  }
61
50
  return { base: declaredBase };
62
51
  }
52
+ export function effectivePathSpellingOf(call, pt, bases) {
53
+ if (pt === undefined)
54
+ return undefined;
55
+ const spelled = pathTargetValue(call.args, pt);
56
+ if (spelled !== undefined)
57
+ return { spelled, base: pathTargetBaseOf(pt, bases) };
58
+ return absentPathSpellingOf(call.args, pt, bases);
59
+ }
60
+ export function effectivePathSpellingsOf(call, pt, bases) {
61
+ if (pt === undefined)
62
+ return undefined;
63
+ const declared = declaredReadValuesOf(call);
64
+ if (declared === undefined) {
65
+ const one = effectivePathSpellingOf(call, pt, bases);
66
+ return one === undefined ? undefined : [one];
67
+ }
68
+ if (!declared.present) {
69
+ const absent = absentPathSpellingOf(call.args, declared.slot, bases);
70
+ return absent === undefined ? undefined : [absent];
71
+ }
72
+ const declaredBase = pathTargetBaseOf(declared.slot, bases);
73
+ return declared.values.map((el) => (typeof el === "string" && el.length > 0 ? { spelled: el, base: declaredBase } : { malformed: true }));
74
+ }
75
+ function selectionTargetOf(sel, bases) {
76
+ if ("malformed" in sel)
77
+ return { kind: "unreadable", reason: MALFORMED_ELEMENT };
78
+ if ("refused" in sel)
79
+ return { kind: "refused", reason: sel.refused };
80
+ if (sel.spelled !== undefined)
81
+ return placeSpelling(sel.spelled, sel.base, bases);
82
+ return sel.base !== undefined && isAbsoluteForFamily(readingFamilyOf(bases, sel.base), sel.base) ? placeSpelling(sel.base, undefined, bases) : unreadableBase(sel.base);
83
+ }
63
84
  export function placeSpelling(spelled, declaredBase, bases) {
64
85
  const family = readingFamilyOf(bases, spelled);
65
86
  const screened = win32NamespaceScreen(spelled, family);
@@ -121,10 +142,16 @@ const REREAD = new WeakMap();
121
142
  export async function readCallTarget(env, call, signal, leads) {
122
143
  const bases = { ...(call.root !== undefined ? { root: call.root } : {}), ...(call.cwd !== undefined ? { cwd: call.cwd } : {}) };
123
144
  const views = new Map();
124
- const viewOf = (pt) => {
125
- const sel = effectivePathSpellingOf(call, pt, bases);
126
- if (sel === undefined)
127
- return Promise.resolve(undefined);
145
+ const viewsOf = async (pt) => {
146
+ const sels = effectivePathSpellingsOf(call, pt, bases);
147
+ if (sels === undefined)
148
+ return undefined;
149
+ const read = await Promise.all(sels.map(viewOf));
150
+ return read.filter((v) => v !== undefined);
151
+ };
152
+ const viewOf = (sel) => {
153
+ if ("malformed" in sel)
154
+ return Promise.resolve({ kind: "unreadable", reason: MALFORMED_ELEMENT });
128
155
  if ("refused" in sel)
129
156
  return Promise.resolve({ kind: "refused", reason: sel.refused });
130
157
  const target = sel.spelled !== undefined ? { spelled: sel.spelled, base: sel.base } : sel.base !== undefined && isAbsoluteForFamily(readingFamilyOf(bases, sel.base), sel.base) ? { spelled: sel.base, base: undefined } : undefined;
@@ -141,10 +168,16 @@ export async function readCallTarget(env, call, signal, leads) {
141
168
  views.set(key, read);
142
169
  return read;
143
170
  };
144
- const protective = await viewOf(protectivePathTargetOf(call));
145
- const declared = call.face === undefined ? undefined : await viewOf(declaredPathTargetOf(call));
171
+ const protectivePt = protectivePathTargetOf(call);
172
+ const declaredPt = call.face === undefined ? undefined : declaredPathTargetOf(call);
173
+ const protectiveAll = await viewsOf(protectivePt);
174
+ const declaredAll = declaredPt === undefined ? undefined : declaredPt === protectivePt ? protectiveAll : await viewsOf(declaredPt);
175
+ const several = protectivePt?.each === true || declaredPt?.each === true || (protectiveAll !== undefined && protectiveAll.length !== 1) || (declaredAll !== undefined && declaredAll.length !== 1);
176
+ const protective = several ? undefined : protectiveAll?.[0];
177
+ const declared = several ? undefined : declaredAll?.[0];
178
+ const each = several ? Object.freeze({ ...(protectiveAll !== undefined ? { protective: Object.freeze([...protectiveAll]) } : {}), ...(declaredAll !== undefined ? { declared: Object.freeze([...declaredAll]) } : {}) }) : undefined;
146
179
  const led = leads === undefined ? undefined : [...leads].filter((e) => e[1] !== undefined && e[1] !== e[0]);
147
- const reading = Object.freeze({ ...(protective !== undefined ? { protective } : {}), ...(declared !== undefined ? { declared } : {}), ...(led !== undefined && led.length > 0 ? { leads: new Map(led) } : {}) });
180
+ const reading = Object.freeze({ ...(protective !== undefined ? { protective } : {}), ...(declared !== undefined ? { declared } : {}), ...(each !== undefined ? { each } : {}), ...(led !== undefined && led.length > 0 ? { leads: new Map(led) } : {}) });
148
181
  if (typeof call.args === "object" && call.args !== null)
149
182
  READ_FOR.set(reading, call.args);
150
183
  REREAD.set(reading, (args, rereadSignal) => readCallTarget(env, { ...call, args }, rereadSignal, leads));
@@ -197,24 +230,36 @@ export function callTargetReadingOf(req) {
197
230
  export function callTargetViewsOf(req, direction, bare = {}) {
198
231
  const reading = callTargetReadingOf(req);
199
232
  if (reading !== undefined) {
200
- const v = direction === "tighten" ? reading.protective : reading.declared;
201
- if (v === undefined || v.kind === "refused")
202
- return undefined;
203
- if (v.kind === "unreadable")
204
- return { views: [], unreadable: v.reason };
205
- if (direction === "allow" && (v.canonical === undefined || v.unread === true))
206
- return { views: [], unreadable: ALLOW_UNRESOLVED };
207
- const views = [{ path: v.lexical, kind: "lexical" }];
208
- const seen = (p) => views.some((w) => w.path === p);
209
- if (v.canonical !== undefined && !seen(v.canonical))
210
- views.push({ path: v.canonical, kind: "canonical" });
211
- for (const hop of v.hops ?? [])
212
- if (!seen(hop))
213
- views.push({ path: hop, kind: "hop" });
214
- return { views };
233
+ const several = direction === "tighten" ? reading.each?.protective : reading.each?.declared;
234
+ if (several !== undefined)
235
+ return everyTarget(several.map((v) => viewsOfOne(v, direction)));
236
+ return viewsOfOne(direction === "tighten" ? reading.protective : reading.declared, direction);
215
237
  }
216
238
  const own = req.root !== undefined || req.cwd !== undefined ? { ...(req.root !== undefined ? { root: req.root } : {}), ...(req.cwd !== undefined ? { cwd: req.cwd } : {}) } : bare;
217
- const target = effectivePathTargetOf(req, direction === "tighten" ? protectivePathTargetOf(req) : declaredPathTargetOf(req), own);
239
+ const pt = direction === "tighten" ? protectivePathTargetOf(req) : declaredPathTargetOf(req);
240
+ const sels = effectivePathSpellingsOf(req, pt, own);
241
+ if (sels === undefined)
242
+ return undefined;
243
+ return everyTarget(sels.map((sel) => lexicalViewsOf(selectionTargetOf(sel, own), direction)));
244
+ }
245
+ const MALFORMED_ELEMENT = "an element of the call's path list is not a path";
246
+ function viewsOfOne(v, direction) {
247
+ if (v === undefined || v.kind === "refused")
248
+ return undefined;
249
+ if (v.kind === "unreadable")
250
+ return { views: [], unreadable: v.reason };
251
+ if (direction === "allow" && (v.canonical === undefined || v.unread === true))
252
+ return { views: [], unreadable: ALLOW_UNRESOLVED };
253
+ const views = [{ path: v.lexical, kind: "lexical" }];
254
+ const seen = (p) => views.some((w) => w.path === p);
255
+ if (v.canonical !== undefined && !seen(v.canonical))
256
+ views.push({ path: v.canonical, kind: "canonical" });
257
+ for (const hop of v.hops ?? [])
258
+ if (!seen(hop))
259
+ views.push({ path: hop, kind: "hop" });
260
+ return { views };
261
+ }
262
+ function lexicalViewsOf(target, direction) {
218
263
  if (target === undefined || target.kind === "refused")
219
264
  return undefined;
220
265
  if (target.kind === "unreadable")
@@ -223,6 +268,18 @@ export function callTargetViewsOf(req, direction, bare = {}) {
223
268
  return { views: [], unreadable: ALLOW_UNRESOLVED };
224
269
  return { views: [{ path: spellingOfIdentity(target.identity, target.family), kind: "lexical" }] };
225
270
  }
271
+ function everyTarget(each) {
272
+ const named = each.filter((t) => t !== undefined);
273
+ if (named.length === 0)
274
+ return undefined;
275
+ const views = [];
276
+ for (const t of named)
277
+ for (const v of t.views)
278
+ if (!views.some((w) => w.path === v.path && w.kind === v.kind))
279
+ views.push(v);
280
+ const unreadable = named.find((t) => t.unreadable !== undefined)?.unreadable;
281
+ return { views, ...(unreadable !== undefined ? { unreadable } : {}) };
282
+ }
226
283
  const ALLOW_UNRESOLVED = "where the target resolves was not read, so no allow by path can speak for it";
227
284
  export function stampedCallOf(given, answer) {
228
285
  const same = (a, b) => a === b || ((d) => d !== undefined && d === exactBoundInputHashOf(given.toolName, b))(exactBoundInputHashOf(given.toolName, a));
@@ -208,7 +208,11 @@
208
208
  * nothing from elsewhere and puts everything inline. One bad entry refuses the whole Artifact mount (`config.artifact_host_invalid`,
209
209
  * the sentence naming the entry and repeating none of its url). An engine without the word ignores the member and says nothing
210
210
  * of libraries; a host that declares them gates on the word.
211
+ * - `instruction_family.preview` — `WiringManifest.instructions` carries first-load `included` (`@`-included files) and `withheld`
212
+ * (lane-discovered and host-text withholds, with `blockedAfterApproval` on `outside_its_root` when Read admission still refuses after
213
+ * approval), and `Runner.previewInstructions(spec)` returns that identical object before any turn with no model call, session/read-state
214
+ * write, checkpoint, or notice (coded refusal on invalid specs). A host that prompts for external includes before Turn 1 gates on the word.
211
215
  */
212
- export declare const ENGINE_CAPABILITIES: readonly ["inherit_env.own_credentials_withheld", "inherit_env.own_credential_values_withheld", "mods.skill_seat", "user_attachments.read_state", "task.wake", "file_history.recorded_place", "ask.workflow_member", "task.fast_mode", "user_attachments.instruction_access", "task_notification.note_key", "task.continues_from", "execution_env.workspace_sync", "session.rewind_conversation", "instruction_family.external_includes", "instruction_family.host_text", "instruction_family.local_files", "session_changes.checkpoints", "session_changes.git", "task.agent_config_dirs", "task.agent_home_dirs", "artifact_host.libraries", "file_history.unplaced_recorded_under"];
216
+ export declare const ENGINE_CAPABILITIES: readonly ["inherit_env.own_credentials_withheld", "inherit_env.own_credential_values_withheld", "mods.skill_seat", "user_attachments.read_state", "task.wake", "file_history.recorded_place", "ask.workflow_member", "task.fast_mode", "user_attachments.instruction_access", "task_notification.note_key", "task.continues_from", "execution_env.workspace_sync", "session.rewind_conversation", "instruction_family.external_includes", "instruction_family.host_text", "instruction_family.local_files", "instruction_family.preview", "session_changes.checkpoints", "session_changes.git", "task.agent_config_dirs", "task.agent_home_dirs", "artifact_host.libraries", "file_history.unplaced_recorded_under"];
213
217
  /** One word of {@link ENGINE_CAPABILITIES}. */
214
218
  export type EngineCapability = (typeof ENGINE_CAPABILITIES)[number];
@@ -1 +1 @@
1
- export const ENGINE_CAPABILITIES = Object.freeze(["inherit_env.own_credentials_withheld", "inherit_env.own_credential_values_withheld", "mods.skill_seat", "user_attachments.read_state", "task.wake", "file_history.recorded_place", "ask.workflow_member", "task.fast_mode", "user_attachments.instruction_access", "task_notification.note_key", "task.continues_from", "execution_env.workspace_sync", "session.rewind_conversation", "instruction_family.external_includes", "instruction_family.host_text", "instruction_family.local_files", "session_changes.checkpoints", "session_changes.git", "task.agent_config_dirs", "task.agent_home_dirs", "artifact_host.libraries", "file_history.unplaced_recorded_under"]);
1
+ export const ENGINE_CAPABILITIES = Object.freeze(["inherit_env.own_credentials_withheld", "inherit_env.own_credential_values_withheld", "mods.skill_seat", "user_attachments.read_state", "task.wake", "file_history.recorded_place", "ask.workflow_member", "task.fast_mode", "user_attachments.instruction_access", "task_notification.note_key", "task.continues_from", "execution_env.workspace_sync", "session.rewind_conversation", "instruction_family.external_includes", "instruction_family.host_text", "instruction_family.local_files", "instruction_family.preview", "session_changes.checkpoints", "session_changes.git", "task.agent_config_dirs", "task.agent_home_dirs", "artifact_host.libraries", "file_history.unplaced_recorded_under"]);