@sema-agent/core 7.57.0 → 7.59.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 (399) hide show
  1. package/CHANGELOG.md +1161 -0
  2. package/README.md +6 -4
  3. package/dist/agents/cc-peer-directory.js +8 -8
  4. package/dist/agents/child-model-seat.d.ts +4 -2
  5. package/dist/agents/child-model-seat.js +5 -3
  6. package/dist/agents/peer-directory.d.ts +9 -0
  7. package/dist/agents/peer-directory.js +6 -2
  8. package/dist/agents/send-message-tool.js +21 -12
  9. package/dist/agents/subagent-steps.js +2 -4
  10. package/dist/agents/subagent.js +33 -34
  11. package/dist/brain/anthropic.js +161 -45
  12. package/dist/brain/errors.d.ts +9 -3
  13. package/dist/brain/errors.js +7 -1
  14. package/dist/brain/failover.js +2 -1
  15. package/dist/brain/open-responses.js +3 -3
  16. package/dist/brain/openai.js +103 -53
  17. package/dist/brain/provider-dialect.d.ts +11 -0
  18. package/dist/brain/provider-dialect.js +5 -2
  19. package/dist/brain/reasoning-request.js +5 -4
  20. package/dist/brain/reasoning.d.ts +19 -0
  21. package/dist/brain/reasoning.js +17 -2
  22. package/dist/brain/request-route.d.ts +4 -1
  23. package/dist/brain/request-route.js +4 -1
  24. package/dist/brain/route-adjudicator.d.ts +84 -18
  25. package/dist/brain/route-adjudicator.js +89 -22
  26. package/dist/brain/route-conformance.js +1 -1
  27. package/dist/brain/stream-engine.js +84 -49
  28. package/dist/brain/stream-shared.d.ts +30 -0
  29. package/dist/brain/stream-shared.js +34 -1
  30. package/dist/brain/timeout.d.ts +62 -5
  31. package/dist/brain/timeout.js +93 -6
  32. package/dist/core/a2a.d.ts +2 -1
  33. package/dist/core/a2a.js +23 -10
  34. package/dist/core/account-row.d.ts +61 -0
  35. package/dist/core/account-row.js +51 -0
  36. package/dist/core/advisor-verdict.d.ts +2 -1
  37. package/dist/core/advisor-verdict.js +1 -1
  38. package/dist/core/allow-entry.d.ts +20 -7
  39. package/dist/core/allow-entry.js +18 -9
  40. package/dist/core/approval-object.d.ts +29 -15
  41. package/dist/core/approval-object.js +47 -19
  42. package/dist/core/ask-origin.d.ts +21 -2
  43. package/dist/core/ask-origin.js +5 -1
  44. package/dist/core/auto-compaction.d.ts +4 -0
  45. package/dist/core/auto-compaction.js +2 -2
  46. package/dist/core/auto-mode-directive.d.ts +29 -5
  47. package/dist/core/auto-mode-directive.js +38 -8
  48. package/dist/core/background-agent-store.d.ts +16 -3
  49. package/dist/core/checkpoint-requirements.d.ts +19 -1
  50. package/dist/core/checkpoint-requirements.js +5 -1
  51. package/dist/core/checkpoint-store.d.ts +85 -23
  52. package/dist/core/checkpoint-store.js +31 -9
  53. package/dist/core/child-clamp-seats.d.ts +29 -0
  54. package/dist/core/child-clamp-seats.js +56 -1
  55. package/dist/core/compliance.d.ts +2 -2
  56. package/dist/core/compliance.js +1 -1
  57. package/dist/core/effective-path-target.d.ts +8 -2
  58. package/dist/core/effective-path-target.js +8 -3
  59. package/dist/core/engine-notice.d.ts +99 -9
  60. package/dist/core/engine-notice.js +19 -5
  61. package/dist/core/fs-write-gate-policy.d.ts +4 -2
  62. package/dist/core/fs-write-gate-policy.js +7 -3
  63. package/dist/core/gate-fold.js +7 -4
  64. package/dist/core/gate-lanes.js +19 -6
  65. package/dist/core/gate-outcome.d.ts +32 -3
  66. package/dist/core/gate-outcome.js +19 -1
  67. package/dist/core/git-worktree-env.d.ts +53 -11
  68. package/dist/core/git-worktree-env.js +96 -12
  69. package/dist/core/governance-codes.d.ts +9 -1
  70. package/dist/core/governance-codes.js +13 -0
  71. package/dist/core/hooks.d.ts +35 -4
  72. package/dist/core/hooks.js +17 -11
  73. package/dist/core/human-input-projection.d.ts +1 -0
  74. package/dist/core/human-input-projection.js +3 -0
  75. package/dist/core/image-admission.d.ts +6 -5
  76. package/dist/core/image-admission.js +18 -14
  77. package/dist/core/locked-config.d.ts +20 -3
  78. package/dist/core/locked-config.js +40 -3
  79. package/dist/core/mailbox-store.d.ts +45 -1
  80. package/dist/core/mailbox-store.js +53 -9
  81. package/dist/core/mcp-call-meta.d.ts +66 -0
  82. package/dist/core/mcp-call-meta.js +103 -0
  83. package/dist/core/mcp-connection-pool.d.ts +3 -1
  84. package/dist/core/mcp-connection-pool.js +3 -1
  85. package/dist/core/mcp-failure.d.ts +117 -15
  86. package/dist/core/mcp-failure.js +71 -3
  87. package/dist/core/mcp-probe.d.ts +4 -0
  88. package/dist/core/mcp-probe.js +1 -1
  89. package/dist/core/mcp-server-link.d.ts +27 -3
  90. package/dist/core/mcp-server-link.js +25 -1
  91. package/dist/core/mcp-server-spec.d.ts +46 -18
  92. package/dist/core/mcp-server-spec.js +1 -18
  93. package/dist/core/mcp.d.ts +16 -20
  94. package/dist/core/mcp.js +112 -55
  95. package/dist/core/memory-engine/consolidation-driver.d.ts +2 -4
  96. package/dist/core/memory-engine/consolidation-driver.js +3 -3
  97. package/dist/core/memory-engine/consolidation.d.ts +4 -0
  98. package/dist/core/memory-engine/consolidation.js +1 -0
  99. package/dist/core/memory-engine/delegation-settlement.js +5 -12
  100. package/dist/core/memory-engine/distiller.js +2 -2
  101. package/dist/core/memory-engine/dual-root.d.ts +50 -1
  102. package/dist/core/memory-engine/dual-root.js +44 -1
  103. package/dist/core/memory-engine/engine.d.ts +67 -14
  104. package/dist/core/memory-engine/engine.js +384 -212
  105. package/dist/core/memory-engine/export-bundle.d.ts +23 -0
  106. package/dist/core/memory-engine/export-bundle.js +23 -4
  107. package/dist/core/memory-engine/file-backend.d.ts +128 -55
  108. package/dist/core/memory-engine/file-backend.js +290 -117
  109. package/dist/core/memory-engine/index.d.ts +1 -1
  110. package/dist/core/memory-engine/layout.d.ts +59 -11
  111. package/dist/core/memory-engine/layout.js +190 -40
  112. package/dist/core/memory-engine/memory-backend-contract.d.ts +1 -1
  113. package/dist/core/memory-engine/memory-backend-contract.js +39 -2
  114. package/dist/core/memory-engine/scope-contract.d.ts +45 -4
  115. package/dist/core/memory-engine/scope-contract.js +80 -11
  116. package/dist/core/memory-engine/sync-client.d.ts +9 -1
  117. package/dist/core/memory-engine/sync-client.js +31 -8
  118. package/dist/core/memory-engine/sync.d.ts +5 -0
  119. package/dist/core/memory-engine/types.d.ts +6 -0
  120. package/dist/core/mode-policy.d.ts +8 -5
  121. package/dist/core/mode-policy.js +5 -4
  122. package/dist/core/mods/classic-events.d.ts +5 -1
  123. package/dist/core/mods/host.js +1 -1
  124. package/dist/core/mods/kernel/dispatch.d.ts +3 -0
  125. package/dist/core/mods/kernel/dispatch.js +12 -9
  126. package/dist/core/mods/kernel/events.d.ts +6 -1
  127. package/dist/core/mods/kernel/events.js +2 -2
  128. package/dist/core/mods/kernel/registration.d.ts +9 -1
  129. package/dist/core/mods/kernel/registration.js +3 -0
  130. package/dist/core/mods/kernel/site-rules.d.ts +3 -0
  131. package/dist/core/mods/kernel/site-rules.js +10 -0
  132. package/dist/core/mods/package.d.ts +23 -0
  133. package/dist/core/mods/package.js +118 -0
  134. package/dist/core/mods/stations.d.ts +33 -12
  135. package/dist/core/mods/stations.js +45 -11
  136. package/dist/core/mods/tool-call.d.ts +5 -1
  137. package/dist/core/mods/tool-call.js +13 -4
  138. package/dist/core/parent-spec-seat.d.ts +8 -3
  139. package/dist/core/parent-spec-seat.js +2 -0
  140. package/dist/core/park-selfcheck.js +6 -0
  141. package/dist/core/path-guard-rows.d.ts +20 -0
  142. package/dist/core/path-guard-rows.js +11 -0
  143. package/dist/core/peer-seat.d.ts +248 -0
  144. package/dist/core/peer-seat.js +439 -0
  145. package/dist/core/permission-rule-consent.js +10 -4
  146. package/dist/core/permission-rule-model.d.ts +16 -0
  147. package/dist/core/permission-rule-model.js +1 -1
  148. package/dist/core/present-plan-tool.d.ts +20 -3
  149. package/dist/core/present-plan-tool.js +48 -4
  150. package/dist/core/protocol-http-auth.d.ts +40 -29
  151. package/dist/core/protocol-http-auth.js +30 -32
  152. package/dist/core/redaction-marks.d.ts +16 -0
  153. package/dist/core/redaction-marks.js +16 -0
  154. package/dist/core/redaction-passes.js +8 -9
  155. package/dist/core/resume-startup-cause.js +1 -0
  156. package/dist/core/retention.d.ts +41 -15
  157. package/dist/core/retention.js +59 -12
  158. package/dist/core/rewrite-rejudge.d.ts +38 -0
  159. package/dist/core/rewrite-rejudge.js +42 -2
  160. package/dist/core/roles.d.ts +34 -2
  161. package/dist/core/roles.js +43 -4
  162. package/dist/core/run-origin.d.ts +40 -0
  163. package/dist/core/run-origin.js +37 -0
  164. package/dist/core/runner/advertised-writable-dirs.d.ts +57 -38
  165. package/dist/core/runner/advertised-writable-dirs.js +126 -0
  166. package/dist/core/runner/announce-once-ledger.d.ts +5 -4
  167. package/dist/core/runner/announce-once-ledger.js +4 -2
  168. package/dist/core/runner/call-hook-stations.js +2 -2
  169. package/dist/core/runner/compaction-restate.d.ts +15 -6
  170. package/dist/core/runner/compaction-restate.js +28 -2
  171. package/dist/core/runner/contracts.d.ts +33 -21
  172. package/dist/core/runner/credential-origin-seat.js +4 -3
  173. package/dist/core/runner/cwd-alignment-probe.d.ts +20 -0
  174. package/dist/core/runner/cwd-alignment-probe.js +21 -0
  175. package/dist/core/runner/decide-continuation.d.ts +2 -2
  176. package/dist/core/runner/gate-exit.d.ts +30 -8
  177. package/dist/core/runner/gate-exit.js +15 -8
  178. package/dist/core/runner/image-removed-seat.d.ts +12 -0
  179. package/dist/core/runner/image-removed-seat.js +19 -0
  180. package/dist/core/runner/inline-image.js +1 -1
  181. package/dist/core/runner/memory-consolidation-driver.js +3 -3
  182. package/dist/core/runner/park-commit.d.ts +1 -1
  183. package/dist/core/runner/park-commit.js +3 -0
  184. package/dist/core/runner/prepare-ask-lane.d.ts +1 -1
  185. package/dist/core/runner/prepare-ask-lane.js +2 -1
  186. package/dist/core/runner/prepare-boundary-parks.js +2 -2
  187. package/dist/core/runner/prepare-caps-and-workflow.d.ts +5 -5
  188. package/dist/core/runner/prepare-caps-and-workflow.js +3 -1
  189. package/dist/core/runner/prepare-config-doors.d.ts +8 -5
  190. package/dist/core/runner/prepare-config-doors.js +14 -10
  191. package/dist/core/runner/prepare-context-lane.js +2 -0
  192. package/dist/core/runner/prepare-delegation-surface.d.ts +8 -0
  193. package/dist/core/runner/prepare-delegation-surface.js +16 -18
  194. package/dist/core/runner/prepare-gate-stations.js +1 -1
  195. package/dist/core/runner/prepare-hands-readface.d.ts +11 -3
  196. package/dist/core/runner/prepare-hands-readface.js +9 -1
  197. package/dist/core/runner/prepare-inherited-gate.d.ts +1 -3
  198. package/dist/core/runner/prepare-inherited-gate.js +14 -27
  199. package/dist/core/runner/prepare-memory.d.ts +3 -0
  200. package/dist/core/runner/prepare-memory.js +26 -37
  201. package/dist/core/runner/prepare-park-ask.d.ts +1 -1
  202. package/dist/core/runner/prepare-park-ask.js +2 -1
  203. package/dist/core/runner/prepare-policy-chain.d.ts +7 -7
  204. package/dist/core/runner/prepare-policy-chain.js +18 -15
  205. package/dist/core/runner/prepare-project-context.d.ts +2 -2
  206. package/dist/core/runner/prepare-project-context.js +2 -2
  207. package/dist/core/runner/prepare-prompt-inputs.d.ts +1 -1
  208. package/dist/core/runner/prepare-prompt-inputs.js +8 -19
  209. package/dist/core/runner/prepare-protocol-tools.d.ts +4 -2
  210. package/dist/core/runner/prepare-protocol-tools.js +11 -3
  211. package/dist/core/runner/prepare-run-refs.d.ts +2 -3
  212. package/dist/core/runner/prepare-run-refs.js +4 -1
  213. package/dist/core/runner/prepare-suspend-saga.d.ts +2 -0
  214. package/dist/core/runner/prepare-suspend-saga.js +2 -1
  215. package/dist/core/runner/prepare-task.js +28 -13
  216. package/dist/core/runner/prepare-wiring-manifest.d.ts +2 -1
  217. package/dist/core/runner/prepare-wiring-manifest.js +4 -3
  218. package/dist/core/runner/prepare-workspace-restore.d.ts +3 -0
  219. package/dist/core/runner/prepare-workspace-restore.js +4 -4
  220. package/dist/core/runner/reply-pricing.d.ts +30 -0
  221. package/dist/core/runner/reply-pricing.js +19 -0
  222. package/dist/core/runner/resume-admission.js +5 -3
  223. package/dist/core/runner/resume-apply.js +6 -1
  224. package/dist/core/runner/resume-checkpoint-screen.js +2 -0
  225. package/dist/core/runner/resume-policy-outcome.js +5 -5
  226. package/dist/core/runner/role-seat-defaulted.d.ts +44 -0
  227. package/dist/core/runner/role-seat-defaulted.js +40 -0
  228. package/dist/core/runner/run-brain-sinks.js +2 -0
  229. package/dist/core/runner/run-harness-handlers.d.ts +3 -4
  230. package/dist/core/runner/run-harness-handlers.js +1 -8
  231. package/dist/core/runner/run-identity-wiring.d.ts +2 -5
  232. package/dist/core/runner/run-identity-wiring.js +6 -4
  233. package/dist/core/runner/run-leg.d.ts +2 -0
  234. package/dist/core/runner/run-leg.js +42 -29
  235. package/dist/core/runner/run-notification-lane.js +3 -0
  236. package/dist/core/runner/run-stop-and-final-verify.js +2 -2
  237. package/dist/core/runner/run-terminal-adoption.d.ts +2 -5
  238. package/dist/core/runner/run-terminal-adoption.js +9 -3
  239. package/dist/core/runner/run-turn-boundary.js +77 -70
  240. package/dist/core/runner/runtask.d.ts +1 -1
  241. package/dist/core/runner/runtask.js +2 -2
  242. package/dist/core/runner/side-call-account.d.ts +1 -1
  243. package/dist/core/runner/side-call-account.js +3 -18
  244. package/dist/core/runner/sub-agent-deny-lists.d.ts +24 -0
  245. package/dist/core/runner/sub-agent-deny-lists.js +10 -0
  246. package/dist/core/runner/terminal-account.js +3 -3
  247. package/dist/core/runner/tool-end-body.js +2 -1
  248. package/dist/core/runner/tool-occurrence.d.ts +5 -2
  249. package/dist/core/runner/tool-occurrence.js +4 -3
  250. package/dist/core/runner/turn-attachments.d.ts +26 -22
  251. package/dist/core/runner/turn-attachments.js +24 -26
  252. package/dist/core/runner/write-protection-station.d.ts +8 -2
  253. package/dist/core/runner/write-protection-station.js +2 -0
  254. package/dist/core/runner-deps.d.ts +3 -3
  255. package/dist/core/secret-env.d.ts +32 -2
  256. package/dist/core/secret-env.js +65 -3
  257. package/dist/core/sensitive-path-policy.js +9 -10
  258. package/dist/core/session-log-transfer.d.ts +24 -0
  259. package/dist/core/session-log-transfer.js +166 -0
  260. package/dist/core/session-policy-store.d.ts +3 -1
  261. package/dist/core/session-policy-store.js +13 -9
  262. package/dist/core/session-store.d.ts +86 -24
  263. package/dist/core/session-store.js +162 -24
  264. package/dist/core/session.d.ts +92 -1
  265. package/dist/core/shell-read-silence.js +1 -0
  266. package/dist/core/side-query.d.ts +11 -1
  267. package/dist/core/side-query.js +9 -0
  268. package/dist/core/skill-grant-binding.d.ts +31 -2
  269. package/dist/core/skill-grant-binding.js +31 -1
  270. package/dist/core/skill-grant.d.ts +8 -5
  271. package/dist/core/skill-grant.js +6 -6
  272. package/dist/core/steer-replay.d.ts +4 -2
  273. package/dist/core/steer-replay.js +2 -1
  274. package/dist/core/store-contracts/background-agent-store-contract.js +27 -0
  275. package/dist/core/store-contracts/checkpoint-store-contract.js +20 -2
  276. package/dist/core/store-contracts/mailbox-store-contract.js +31 -1
  277. package/dist/core/store-contracts/session-repo-contract.js +112 -5
  278. package/dist/core/store-contracts/session-store-contract.d.ts +4 -1
  279. package/dist/core/store-contracts/session-store-contract.js +236 -2
  280. package/dist/core/synthetic-read-verdict.js +2 -1
  281. package/dist/core/task-event.d.ts +92 -8
  282. package/dist/core/task-notification.js +16 -10
  283. package/dist/core/task-registry-agent.js +1 -0
  284. package/dist/core/task-registry-shared.d.ts +7 -1
  285. package/dist/core/task-spec.d.ts +49 -1
  286. package/dist/core/task-stream.d.ts +2 -1
  287. package/dist/core/terminal-cause.d.ts +11 -1
  288. package/dist/core/tool-catalog-entries.js +1 -0
  289. package/dist/core/tool-check-reading.d.ts +1 -0
  290. package/dist/core/tool-check-reading.js +3 -3
  291. package/dist/core/tool-policy.d.ts +16 -0
  292. package/dist/core/tool-result-store.d.ts +17 -10
  293. package/dist/core/tool-result-store.js +3 -1
  294. package/dist/core/tool-roster.d.ts +112 -5
  295. package/dist/core/tool-roster.js +42 -1
  296. package/dist/core/tool-spec.d.ts +3 -1
  297. package/dist/core/types.d.ts +3 -3
  298. package/dist/core/types.js +1 -1
  299. package/dist/core/untrusted-egress.d.ts +0 -2
  300. package/dist/core/untrusted-egress.js +10 -14
  301. package/dist/core/user-attachment.js +1 -1
  302. package/dist/core/wiring-manifest.d.ts +18 -6
  303. package/dist/core/wiring-manifest.js +4 -3
  304. package/dist/core/workspace-snapshot.d.ts +44 -0
  305. package/dist/core/workspace-snapshot.js +34 -0
  306. package/dist/core/write-protect.d.ts +43 -3
  307. package/dist/core/write-protect.js +43 -16
  308. package/dist/engine/compaction/compaction.js +29 -3
  309. package/dist/engine/execution-env/node-execution-env.d.ts +4 -3
  310. package/dist/engine/execution-env/node-execution-env.js +24 -23
  311. package/dist/engine/execution-env/symlink-chain.d.ts +7 -5
  312. package/dist/engine/harness/agent-harness.d.ts +30 -2
  313. package/dist/engine/harness/agent-harness.js +43 -12
  314. package/dist/engine/harness/messages.d.ts +3 -1
  315. package/dist/engine/harness/messages.js +3 -2
  316. package/dist/engine/harness/types.d.ts +56 -7
  317. package/dist/engine/harness/types.js +5 -1
  318. package/dist/engine/llm/rejected-images.d.ts +46 -0
  319. package/dist/engine/llm/rejected-images.js +54 -0
  320. package/dist/engine/llm/tool-turns.d.ts +2 -1
  321. package/dist/engine/llm/types.d.ts +30 -10
  322. package/dist/engine/llm/types.js +1 -1
  323. package/dist/engine/loop/agent-loop.d.ts +8 -0
  324. package/dist/engine/loop/agent-loop.js +52 -15
  325. package/dist/engine/loop/types.d.ts +3 -1
  326. package/dist/engine/session/import-validate.js +3 -0
  327. package/dist/engine/session/memory-repo.d.ts +17 -9
  328. package/dist/engine/session/memory-repo.js +44 -34
  329. package/dist/engine/session/path-to-root.d.ts +38 -0
  330. package/dist/engine/session/path-to-root.js +39 -0
  331. package/dist/engine/session/repo-utils.d.ts +22 -4
  332. package/dist/engine/session/repo-utils.js +49 -1
  333. package/dist/engine/session/storage-base.d.ts +10 -1
  334. package/dist/engine/session/storage-base.js +11 -22
  335. package/dist/index.d.ts +29 -16
  336. package/dist/index.js +21 -11
  337. package/dist/internal/harness-types.d.ts +2 -2
  338. package/dist/internal/harness.d.ts +3 -2
  339. package/dist/internal/harness.js +2 -2
  340. package/dist/internal/llm.d.ts +1 -0
  341. package/dist/orchestration/workflow-observe.d.ts +17 -1
  342. package/dist/orchestration/workflow-observe.js +20 -0
  343. package/dist/orchestration/workflow-types.d.ts +32 -7
  344. package/dist/orchestration/workflow.js +739 -489
  345. package/dist/shell/counting-pass.d.ts +50 -0
  346. package/dist/shell/counting-pass.js +502 -0
  347. package/dist/shell/lex.d.ts +4 -2
  348. package/dist/shell/lex.js +93 -34
  349. package/dist/shell/shell-words.d.ts +1 -1
  350. package/dist/shell/shell-words.js +7 -6
  351. package/dist/stores/file/index.d.ts +4 -1
  352. package/dist/stores/file/index.js +4 -1
  353. package/dist/stores/file/mailbox-store.js +6 -10
  354. package/dist/stores/file/session-store.d.ts +15 -8
  355. package/dist/stores/file/session-store.js +28 -13
  356. package/dist/tools/fs/fs-bash.d.ts +6 -0
  357. package/dist/tools/fs/fs-bash.js +6 -3
  358. package/dist/tools/fs/fs-write.d.ts +6 -3
  359. package/dist/tools/fs/fs-write.js +8 -7
  360. package/dist/tools/fs/index.d.ts +3 -0
  361. package/dist/tools/fs/index.js +7 -3
  362. package/dist/tools/fs/program-read-model.d.ts +13 -0
  363. package/dist/tools/fs/program-read-model.js +15 -0
  364. package/dist/tools/fs/program-read-model.rows.js +1 -1
  365. package/dist/tools/fs/read-deny.d.ts +13 -10
  366. package/dist/tools/fs/read-deny.js +25 -5
  367. package/dist/tools/fs/read-floor.d.ts +19 -0
  368. package/dist/tools/fs/read-floor.js +23 -0
  369. package/dist/tools/fs/safety.js +40 -8
  370. package/dist/tools/fs/search.js +6 -24
  371. package/dist/tools/fs/shell-read-check.d.ts +9 -2
  372. package/dist/tools/fs/shell-read-check.js +61 -16
  373. package/dist/tools/fs/shell-read-establish.js +2 -1
  374. package/dist/tools/fs/shell-read-identity.js +1 -1
  375. package/dist/tools/fs/shell-read-judge.d.ts +26 -9
  376. package/dist/tools/fs/shell-read-judge.js +10 -6
  377. package/dist/tools/fs/shell-read-plan.d.ts +6 -1
  378. package/dist/tools/fs/shell-read-plan.js +22 -15
  379. package/dist/tools/fs/shell-read-start.js +1 -0
  380. package/dist/tools/fs/shell-reentry-text.d.ts +15 -1
  381. package/dist/tools/fs/shell-reentry-text.js +25 -3
  382. package/dist/tools/monitor.d.ts +4 -0
  383. package/dist/tools/monitor.js +2 -0
  384. package/dist/tools/worktree.d.ts +42 -15
  385. package/dist/tools/worktree.js +60 -32
  386. package/package.json +5 -2
  387. package/test/export-surface.snapshot.json +149 -1
  388. package/wire-changes/core-stores-sql@7.58.0.json +29 -0
  389. package/wire-changes/core-stores-sql@7.59.0.json +29 -0
  390. package/wire-changes/core@7.58.0.json +2188 -0
  391. package/wire-changes/core@7.59.0.json +2459 -0
  392. package/wire-changes/mods-kernel@7.58.0.json +81 -0
  393. package/wire-changes/mods-kernel@7.59.0.json +29 -0
  394. package/wire-changes/primitives@7.58.0.json +29 -0
  395. package/wire-changes/primitives@7.59.0.json +29 -0
  396. package/dist/primitives/credential-ref.d.ts +0 -89
  397. package/dist/primitives/credential-ref.js +0 -125
  398. package/dist/primitives/index.d.ts +0 -2
  399. package/dist/primitives/index.js +0 -1
@@ -1,9 +1,10 @@
1
1
  import { composePostureFrames, owedPostureRow, postureStandingOf } from "../auto-mode-directive.js";
2
+ import { planFileShown } from "./advertised-writable-dirs.js";
2
3
  import { PRESENT_PLAN_TOOL_NAME } from "../present-plan-tool.js";
3
4
  import { mintSystemReminder } from "../reminder-mint.js";
4
5
  import { thrownText } from "../thrown-value.js";
5
6
  import { rosterEntryNamed } from "../tool-roster.js";
6
- import { sanitizeUntrustedText } from "../untrusted-text.js";
7
+ import { delimitUntrusted, sanitizeUntrustedText } from "../untrusted-text.js";
7
8
  import { appendAdvisorRestate } from "./advisor-instructions.js";
8
9
  import { gitRestateOption } from "./git-leg-delivery.js";
9
10
  import { attachmentEnvelopeTags } from "./turn-attachments.js";
@@ -13,6 +14,7 @@ export function postureFactsOf(prepared) {
13
14
  askEffective: prepared.approvalPosture.askEffective,
14
15
  exitToolMounted: rosterEntryNamed(prepared.toolRoster, PRESENT_PLAN_TOOL_NAME) !== undefined,
15
16
  isChildLeg: prepared.hookIdentity.isDelegatedChild,
17
+ ...(prepared.advertisedWritableDirs?.planFile !== undefined ? { planFile: planFileShown(prepared.advertisedWritableDirs.planFile.spelled) } : {}),
16
18
  };
17
19
  }
18
20
  export async function owedPostureText(prepared, ask) {
@@ -99,6 +101,30 @@ export function appendBoundaryFrames(prepared, turnOwesRequest) {
99
101
  const posture = appendOwedPosture(prepared, "on_change");
100
102
  return styleOwed ? posture.then(() => appendOutputStyleRestate(prepared)) : posture;
101
103
  }
104
+ export function planFileRestateOption(prepared) {
105
+ const seat = prepared.advertisedWritableDirs;
106
+ const planFile = seat?.planFile;
107
+ if (seat === undefined || planFile === undefined)
108
+ return {};
109
+ return {
110
+ planFileRestate: async () => {
111
+ const read = await seat.readPlanFile();
112
+ if (!read.ok || read.text === undefined)
113
+ return;
114
+ const body = `A plan file exists from plan mode at: ${planFileShown(planFile.spelled)}\n\nPlan contents:\n\n${delimitUntrusted("plan", read.text)}\n\nIf this plan is relevant to the current work and not already complete, continue working on it.`;
115
+ try {
116
+ await prepared.session.appendMessage({ role: "user", content: [{ type: "text", text: mintSystemReminder(body, prepared.reminderMark) }], timestamp: Date.now(), engineMinted: true });
117
+ }
118
+ catch (err) {
119
+ try {
120
+ prepared.postureFrameRef.report?.(new Error(`the plan file reference could not be written to the transcript after the compaction: ${thrownText(err)}`));
121
+ }
122
+ catch {
123
+ }
124
+ }
125
+ },
126
+ };
127
+ }
102
128
  export function compactionRestateOptions(prepared) {
103
- return { ...gitRestateOption(prepared), ...postureRestateOption(prepared), ...(prepared.advisorInstruction?.mounted === true ? { advisorRestate: () => appendAdvisorRestate(prepared) } : {}) };
129
+ return { ...gitRestateOption(prepared), ...postureRestateOption(prepared), ...planFileRestateOption(prepared), ...(prepared.advisorInstruction?.mounted === true ? { advisorRestate: () => appendAdvisorRestate(prepared) } : {}) };
104
130
  }
@@ -17,7 +17,7 @@ import type { HumanReviewGateRow } from "../task-result.js";
17
17
  import type { RepairBundle } from "../../agents/repair-loop.js";
18
18
  import type { SubagentRetainLedger } from "../../agents/retain-ledger.js";
19
19
  import type { BrainCallGuardrailRef } from "../../brain/timeout.js";
20
- import type { ActiveWorktreeSession, AgentHarness, AgentMessage, AgentTool, AnnouncedListingSnapshotInput, AnnouncedMcpFailure, ExecutionEnv, ThinkingLevel } from "../../internal/harness.js";
20
+ import type { ActiveWorktreeSession, AgentHarness, AgentMessage, AgentTool, AnnouncedListingSnapshotInput, ExecutionEnv, ThinkingLevel } from "../../internal/harness.js";
21
21
  import type { Model } from "../../internal/llm.js";
22
22
  import type { WorkflowSizeGuideline } from "../../orchestration/workflow-size-guideline.js";
23
23
  import type { ToolManifestRow } from "../../prompt-assembly/tool-catalog.js";
@@ -63,7 +63,7 @@ import type { GitStatusLaneRef } from "./git-status-frame.js";
63
63
  import type { SessionReadFileStates } from "./session-read-file-states.js";
64
64
  import type { LegModeCeiling, SessionModeSeats } from "./session-mode-seats.js";
65
65
  import type { BlockedRef, OutputRef, SkillListingEntry } from "./synthetic-tools.js";
66
- import type { createAttachmentState, WriteFamily } from "./turn-attachments.js";
66
+ import type { AttachmentSource, createAttachmentState, WriteFamily } from "./turn-attachments.js";
67
67
  import type { SideCallBook } from "./side-call-account.js";
68
68
  import type { cacheFamilyOf } from "./usage-accounting.js";
69
69
  /**
@@ -221,20 +221,20 @@ export interface DateAnchorRead {
221
221
  * One engine frame whose commit waits for the receipt of the message carrying it.
222
222
  *
223
223
  * @contract frames.commit_on_receipt — an engine-minted frame that rides a user message (the git-status
224
- * frame, an `agent_listing`, `skills_listing` or `date_change` frame) is recorded as announced ONLY when the run loop's
225
- * `message_end` walk sees a persisted user entry whose text equals the carrying text it was registered
226
- * with; every receipt with that text settles on that one entry. Until then nothing is recorded — a
227
- * message that never reaches the transcript (a pre-append failure, a suppressed or undrained steer, a
228
- * leg that ends first) leaves the frame unannounced, and the next boundary or leg renders it again.
229
- * The error asymmetry is one-directional by design: a lost receipt costs a duplicate frame, never a
230
- * fact the model was recorded as told and was not.
224
+ * frame, a leg's first-request frames, every turn-boundary attachment, a limit-approach notice) is recorded —
225
+ * an announced set or value, a drained pending entry, a once digest, a window's stamp, a latch, its echo and count
226
+ * — ONLY when the run loop's `message_end` walk sees a persisted user entry whose text equals the carrying text it
227
+ * was registered with; every receipt with that text settles on that one entry. Collection records nothing: a
228
+ * message that never reaches the transcript (a pre-append failure, a suppressed or undrained steer, a leg that
229
+ * ends first) leaves the frame unannounced, and the next boundary or leg renders it again. A lost receipt costs a
230
+ * duplicate frame, never a fact the model was recorded as told and was not.
231
231
  */
232
232
  export interface FrameReceipt {
233
233
  /** The carrying message's exact text (its first text block) — the receipt's match key. */
234
234
  text: string;
235
235
  /** Which frame this receipt settles. No collector renders a frame whose receipt is still pending (the frame is on
236
236
  * its way, not yet in the transcript) — the one reading is `frameCarried` (compaction-restate.ts). */
237
- source: "git_status" | "agent_listing" | "skills_listing" | "date_change" | "output_style" | "mcp_unavailable" | "posture" | "advisor_tool";
237
+ source: "git_status" | "posture" | "advisor_tool" | "limit_approach" | AttachmentSource;
238
238
  /** Runs inside the `message_end` walk (synchronous, never awaited): advances the run-local record
239
239
  * and parks any session write for the next serialization point. */
240
240
  commit: (entryId: string) => void;
@@ -406,8 +406,10 @@ export interface Prepared {
406
406
  * states are their own values); the seat is optional only so a Prepared shape without the phase
407
407
  * cannot fabricate one. */
408
408
  effectiveMemoryScopes?: import("../types.js").EffectiveMemoryScopes;
409
- /** The per-task logical cwd ref when a real shell is mounted (else undefined); read after each tool for `workspace_changed`. */
409
+ /** The per-task logical cwd ref when a real shell is mounted (else undefined); the workspace frame reads it. */
410
410
  cwdRef?: CwdRef;
411
+ /** The leg's `workspace_changed` seat (its one snapshot projection): the run binds the sink after `wiring_manifest` (the leg-start frame) and observes after each tool. */
412
+ workspaceFrame: import("../workspace-snapshot.js").WorkspaceFrameSeat;
411
413
  /** The root the hand tools resolve root-relative spellings against (present with hands; read-only hands included). */
412
414
  handsRoot?: string;
413
415
  /** The leg's target-reading stamp (present with hands): the resume belts stamp the executed bytes' request with it. */
@@ -419,8 +421,8 @@ export interface Prepared {
419
421
  toolProgressRef: {
420
422
  current?: ToolProgressLane;
421
423
  };
422
- /** The run's advertised-writable-directory seat (present with hands): `roots` is what the prompt advertised as writable and the fence admitted. Read live wherever a policy is adjudicated off a resumed leg, so the write gate's exemption domain is that same list. */
423
- advertisedWritableDirs?: Pick<import("./advertised-writable-dirs.js").AdvertisedWritableDirs, "roots">;
424
+ /** The run's advertised-writable-directory seat (present with hands): `roots` is what the prompt advertised as writable and the fence admitted. Read live wherever a policy is adjudicated off a resumed leg, so the write gate's exemption domain is that same list. `planFile` is the session plan file it admitted (`TaskSpec.planFile`) — the posture frames name it. */
425
+ advertisedWritableDirs?: Pick<import("./advertised-writable-dirs.js").AdvertisedWritableDirs, "roots" | "planFile" | "readPlanFile">;
424
426
  /** The leg's ONE exempt root (its single resolution of `RunnerDeps.memoryEngineDir`), stamped wherever a policy is adjudicated off a resumed leg (`ToolCallRequest.exemptRoots`) — the same list the live gate stamps. */
425
427
  exemptRoots: readonly string[];
426
428
  /** The ACTIVE EnterWorktree session ref (mounted with the worktree tools; undefined without
@@ -470,6 +472,7 @@ export interface Prepared {
470
472
  decidedBy: HostDecider;
471
473
  }) => Promise<{
472
474
  readonly refused: string;
475
+ readonly extension?: string;
473
476
  } | {
474
477
  readonly args: unknown;
475
478
  readonly admit: () => void;
@@ -888,18 +891,17 @@ export interface Prepared {
888
891
  /** Set by a tool calling `ctx.requestReview()` (the first-party `present_plan` tool, CC
889
892
  * ExitPlanMode parity): the run loop honors it at the next CLEAN turn boundary by minting a `plan_review`
890
893
  * checkpoint. `{ pending }` is set (with an optional reason) the moment a tool requests review; the boundary
891
- * reads + clears it. First request in a batch wins (idempotent). */
894
+ * reads + clears it. First request in a batch wins (idempotent), and so does its `requestedByCallId` — the
895
+ * engine-bound id of the call that asked, which the mint writes onto the parked row. */
892
896
  reviewRequestRef: {
893
- pending?: {
894
- reason?: string;
895
- };
897
+ pending?: import("../present-plan-tool.js").ReviewRequest;
896
898
  };
897
899
  /** Present (≠ undefined) ONLY when a `checkpointStore` is wired (the deployment can pause). The
898
900
  * run loop calls it at a CLEAN turn boundary when `reviewRequestRef.pending` is set: it mints a `plan_review`
899
901
  * checkpoint (`status:"needs_review"` by its registry row) + pauses the workspace + aborts the loop, reusing
900
902
  * the SAME commit saga as the human/resource suspends. Returns true iff it committed a resumable checkpoint;
901
903
  * false ⇒ the request could not be honored (caller drops it and continues). */
902
- suspendForReview?: (reason?: string) => Promise<boolean>;
904
+ suspendForReview?: (reason?: string, requestedByCallId?: string) => Promise<boolean>;
903
905
  /** The prior cross-slice {@link ResourceLedger} (from the resumed checkpoint), so the run
904
906
  * loop can size this slice's effective budget = `min(maxCostUsd, remaining)`. Undefined on the first slice
905
907
  * (or a non-resource task). */
@@ -1163,7 +1165,7 @@ export interface Prepared {
1163
1165
  * task whose every MCP tool went missing with its server is exactly the one that must say so. Carried by the leg's first
1164
1166
  * request (a fresh leg's first message, a resumed leg's continuation) and drained by that message's receipt (`settleMcpUnavailable`). */
1165
1167
  mcpUnavailable?: {
1166
- pending: AnnouncedMcpFailure[];
1168
+ pending: import("../mcp-failure.js").McpUnavailableEntry[];
1167
1169
  };
1168
1170
  /** G1 通告层续批 (CC `agent_listing_delta` parity) — the mounted delegation tool's agent-type roster
1169
1171
  * (read off `ToolSpec.agentListing`, filled by createSubagentTool), plus the tool's mounted name for
@@ -1312,6 +1314,11 @@ export interface PrepareResume {
1312
1314
  /** The decision this resume carries (the gate word and, for a review, approve / edit / reject) — read by the mode seed
1313
1315
  * (`modeRequestAfterResume`: an approved or edited `plan_review` exits a recorded plan to its pre-plan word). Absent on a prepare that resumes nothing. */
1314
1316
  outcome?: ResumeRun["outcome"];
1317
+ /** Present when the resume opens this leg with inputs it hands over — a wake: the newest of them (its message, else the parked
1318
+ * entry delivered last; `wakeOpening`): its run-origin word (absent = it said none) is the leg's word instead of the row's. */
1319
+ opening?: {
1320
+ readonly word: unknown;
1321
+ };
1315
1322
  /** The leg's mods bus, when the resume entrance already admitted it (a wake message's screen raises
1316
1323
  * `classic.UserPromptSubmit` before this leg prepares): prepare adopts it instead of admitting a second time. */
1317
1324
  legMods?: LegMods;
@@ -1832,6 +1839,10 @@ export interface RunInternals {
1832
1839
  * mirroring `insideFork`.
1833
1840
  */
1834
1841
  isDelegatedChild?: boolean;
1842
+ /** `true` iff this delegated leg's objective carries an operator's words — minted ONLY by a retained child's resume
1843
+ * through its steer handle (a SendMessage resume is a peer's): it passes `classic.UserPromptSubmit` before the leg
1844
+ * opens on `classic.SubagentStart`. TRUSTED run-scoped channel (NOT a {@link TaskSpec} field). */
1845
+ operatorObjective?: true;
1835
1846
  /**
1836
1847
  * Subagent transcript persistence — the child transcript session's PLACEMENT declaration, minted
1837
1848
  * by the background delegation lane (the trusted spawner: it knows the a* handle, scope and root)
@@ -2602,8 +2613,9 @@ export interface RunState {
2602
2613
  * an internally-generated continuation, so both are omitted.
2603
2614
  */
2604
2615
  /** A resume continues the suspended leg: it sends no new human message, so it takes neither an objective nor the
2605
- * objective's attachments (a config that carries `userAttachments` anyway is refused before the claim). */
2606
- export type ResumeTaskConfig = Omit<TaskSpec, "objective" | "sessionId" | "userAttachments">;
2616
+ * objective's attachments nor the objective's run origin (a config that carries `userAttachments` or `runOrigin` anyway is
2617
+ * refused before the claim; a wake states its leg's word on the input it hands over). */
2618
+ export type ResumeTaskConfig = Omit<TaskSpec, "objective" | "sessionId" | "userAttachments" | "runOrigin">;
2607
2619
  /** Resume plan threaded from {@link Runner.resume} into the shared run loop. */
2608
2620
  export interface ResumeRun {
2609
2621
  cp: Checkpoint;
@@ -1,3 +1,4 @@
1
+ import { KEYLESS_EXIT } from "../../brain/route-adjudicator.js";
1
2
  import { runWithCredentialOriginRefusals } from "../../brain/status-sink.js";
2
3
  import { deliverEngineNotice } from "../engine-notice.js";
3
4
  export function createCredentialOriginRefusalScope({ onNotice, sessionId, runId }) {
@@ -9,10 +10,10 @@ export function createCredentialOriginRefusalScope({ onNotice, sessionId, runId
9
10
  announced.add(key);
10
11
  deliverEngineNotice(onNotice, {
11
12
  code: "route.credential_origin_mismatch",
12
- message: `A request for model "${modelId}" was not sent: the model's own credential belongs to ${boundOrigin}, the host it was ` +
13
- `first sent to, and this request was going to ${requestOrigin}. A credential does not follow its model to another host — ` +
13
+ message: `A request for model "${modelId}" was not sent: the model's own credential belongs to ${boundOrigin} (the host it was ` +
14
+ `first sent to, or the one the deployment rebound it to), and this request was going to ${requestOrigin}. A credential does not follow its model to another host — ` +
14
15
  `the deployment has to give the model a credential for ${requestOrigin} (or point it back at ${boundOrigin}). ` +
15
- `Said once per run for this model and these two hosts.`,
16
+ `If ${requestOrigin} takes no credential, ${KEYLESS_EXIT}. Said once per run for this model and these two hosts.`,
16
17
  detail: { modelId, boundOrigin, requestOrigin, sessionId, runId },
17
18
  });
18
19
  }, fn);
@@ -0,0 +1,20 @@
1
+ /** The shell's answer. `unknown` = the root is not a directory in the shell's view, or its `test` has no `-ef`:
2
+ * no judgment, so no observation. */
3
+ export type CwdAlignmentVerdict = "same" | "differ" | "unknown";
4
+ /**
5
+ * The probe's last sub-command: the shell asks whether its working directory and the task root are one directory
6
+ * (`test . -ef <root>`: the same filesystem object, links followed, spelling and case irrelevant) and prints one
7
+ * line `cwd-alignment:<same|differ|unknown>:<its pwd -P>`. The line carries its own marker, so a banner a login
8
+ * shell prints first moves nothing.
9
+ */
10
+ export declare function cwdAlignmentProbe(taskRoot: string): string;
11
+ /** The framed answer and the shell's own `pwd -P` reading, found by its marker (the last such line — the probe's
12
+ * last sub-command — wherever earlier output put it); a word outside the closed set reads `unknown`; no framed
13
+ * line at all reads `undefined` (the probe's tail never arrived: nothing to judge). */
14
+ export declare function readCwdAlignment(lines: readonly string[]): {
15
+ verdict: CwdAlignmentVerdict;
16
+ shellPwd: string;
17
+ } | undefined;
18
+ /** The operator-lane sentence for a `differ` verdict: the two readings and the shell's finding, nothing about
19
+ * where an exec or an artifact would land. */
20
+ export declare function cwdMisalignmentMessage(taskRoot: string, shellPwd: string): string;
@@ -0,0 +1,21 @@
1
+ import { shellQuote } from "../../tools/fs/search.js";
2
+ const CWD_ALIGNMENT_MARK = "cwd-alignment:";
3
+ export function cwdAlignmentProbe(taskRoot) {
4
+ const root = shellQuote(taskRoot);
5
+ return `(p=$(pwd -P 2>/dev/null || pwd); if test -d ${root} >/dev/null 2>&1; then test . -ef ${root} >/dev/null 2>&1; case $? in 0) v=same;; 1) v=differ;; *) v=unknown;; esac; else v=unknown; fi; printf '%s\\n' "${CWD_ALIGNMENT_MARK}$v:$p")`;
6
+ }
7
+ export function readCwdAlignment(lines) {
8
+ for (let i = lines.length - 1; i >= 0; i--) {
9
+ const line = lines[i] ?? "";
10
+ if (!line.startsWith(CWD_ALIGNMENT_MARK))
11
+ continue;
12
+ const rest = line.slice(CWD_ALIGNMENT_MARK.length);
13
+ const cut = rest.indexOf(":");
14
+ const word = cut < 0 ? rest : rest.slice(0, cut);
15
+ return { verdict: word === "same" || word === "differ" ? word : "unknown", shellPwd: cut < 0 ? "" : rest.slice(cut + 1).trim() };
16
+ }
17
+ return undefined;
18
+ }
19
+ export function cwdMisalignmentMessage(taskRoot, shellPwd) {
20
+ return `execution-env cwd misalignment: a probe run with the task root "${taskRoot}" as its working directory reports pwd "${shellPwd}", and the env's shell found that directory to be a different one from the task root`;
21
+ }
@@ -131,8 +131,8 @@ export declare function mintDecideRecord(cp: Checkpoint, facts: HostDecisionFact
131
131
  * row stays `pending` for a well-formed decide, exactly like the other capture-time domain refusals,
132
132
  * and BEFORE the hygiene check so no guard ever consults a value outside the domain. The rejected field
133
133
  * is named in the message, and in `detail` where the caller hands the closed set's word for the cell
134
- * (`CheckpointErrorField`: `feedback` has one; `reason` and `editedPlan` have none, and widening the set is a
135
- * wire-surface change of its own).
134
+ * (`CheckpointErrorField`: `feedback` and the approval lane's deny `reason` have one; the other lanes' `reason` and
135
+ * `editedPlan` have none, and widening the set is a wire-surface change of its own).
136
136
  */
137
137
  export declare function assertOutcomeText(value: string | undefined, field: "editedPlan" | "reason" | "feedback", detail?: {
138
138
  field: CheckpointErrorField;
@@ -26,6 +26,7 @@ import type { AllowRuleClearance } from "../allow-rule-shadow.js";
26
26
  import type { AutoModeClassifierRound } from "../auto-mode.js";
27
27
  import { type Arbitration, type AskClassification, type AskFace, type AskOrigin, type AskOriginFacts } from "../ask-origin.js";
28
28
  import { type PermissionResult, type ResolvedAsk, type ToolCallRequest } from "../tool-policy.js";
29
+ import { type RewriteAccount } from "../rewrite-rejudge.js";
29
30
  import type { SafeNotifier } from "../safe-notify.js";
30
31
  import type { PermissionDeniedPayload, PreToolUseResult, ToolGateInput, ToolGateResult } from "../hooks.js";
31
32
  /** The ask a gate pass settled, as the gate captured it at its resolution site: the settlement the
@@ -54,6 +55,9 @@ export interface GateExitFacts {
54
55
  clearedBy?: AllowRuleClearance;
55
56
  /** The permission mode REFUSED the surviving ask — only beside `deniedBy: "mode"`. */
56
57
  modeRefusal?: ModeRefusal;
58
+ /** The registration whose handler ended the call at the hook layer (its deny answer or its failure) — only beside `deniedBy: "hook"`.
59
+ * As the bus names it: the engine's own origin word is read as no extension at the mint, once. */
60
+ extension?: string;
57
61
  }
58
62
  /**
59
63
  * Mint the outcome. A defect here is an ENGINE defect (a refusing site that did not say who refused, a
@@ -64,7 +68,7 @@ export interface GateExitFacts {
64
68
  export declare function mintGateOutcome(facts: GateExitFacts): GateOutcome;
65
69
  /** A direct refusal by one layer, with no ask settled — the five short-circuit exits (a hook that threw or
66
70
  * never answered, the hook's own deny, the compliance lock, the plan-mode block). */
67
- export declare function directDeny(deniedBy: Exclude<DeniedBy, "ask_resolution">): GateOutcome;
71
+ export declare function directDeny(deniedBy: Exclude<DeniedBy, "ask_resolution">, extension?: string): GateOutcome;
68
72
  /**
69
73
  * The gate's settlement LEDGER for one pass — the one place "which ask did this pass consume" is written,
70
74
  * with ONE rule for every read, all through the decision's engine record ({@link attestationOf}):
@@ -137,14 +141,17 @@ export declare function frozenInputSnapshot(input: unknown): unknown;
137
141
  * engine's fail-closed refusal of the call with its sentence (a handler that failed or broke the site's contract,
138
142
  * or a cancel). */
139
143
  /** A screen's outcome; an answer names the registration whose answer the chain returned (`answeredBy`, absent when no
140
- * handler spoke). */
144
+ * handler spoke) and the extensions that authored its `updatedInput` (`rewrittenBy`, in the order they rewrote; absent
145
+ * when the answer carries no rewrite). */
141
146
  export type PreToolUseScreen = {
142
147
  readonly kind: "answered";
143
148
  readonly answer: PreToolUseResult | undefined;
144
149
  readonly answeredBy?: string;
150
+ readonly rewrittenBy?: readonly string[];
145
151
  } | {
146
152
  readonly kind: "refused";
147
- readonly reason: string;
153
+ readonly reason: string; /** the registration the bus names for the failed screening (the mint reads whether it names an extension); absent on a cancel */
154
+ readonly extension?: string;
148
155
  };
149
156
  /**
150
157
  * The PreToolUse screening face as the gate's stations see it — `classic.PreToolUse` raised on the leg's bus, the
@@ -153,9 +160,12 @@ export type PreToolUseScreen = {
153
160
  * event (an observe handler runs inside the screening too; it never decides).
154
161
  */
155
162
  export interface PreToolUseScreening {
156
- /** Raise `classic.PreToolUse` over `args`; `subject` names what is screened in a fail-closed sentence. What the gate
157
- * does after the screen answers runs in the screen's own continuation. */
158
- screen(args: unknown, subject: string): Promise<PreToolUseScreen>;
163
+ /** Raise `classic.PreToolUse` over `args`; `subject` names what is screened in a fail-closed sentence; `readAs` is the call
164
+ * whose reading of its args the rewrite authors are compared under (absent ⇒ the values as given). What the gate does after
165
+ * the screen answers runs in the screen's own continuation. */
166
+ screen(args: unknown, subject: string, readAs?: {
167
+ readonly face?: object | undefined;
168
+ }): Promise<PreToolUseScreen>;
159
169
  /** The model-facing text for the screen's OWN deny of this call (unwrapped; every exit wraps it with the leg's mark). */
160
170
  deniedReason(answer: PreToolUseResult): string;
161
171
  }
@@ -223,6 +233,9 @@ export interface GatePass {
223
233
  * of a value nothing took ({@link untakenValueExit}), where it holds that value as given and only the deny exit's receipt
224
234
  * reads it. Writers: the dispatch (phase 1), the lanes, the exits. */
225
235
  currentInput: unknown;
236
+ /** borrowed-mutable — who replaced the args, against the bytes taken at the entry ({@link RewriteAccount}): every station that
237
+ * adopts other bytes names its author there; the allow exit reads it into the call's record. */
238
+ readonly rewrites: RewriteAccount;
226
239
  /** borrowed-mutable — the adjudication request. Minted over the pass's args so the record is whole from
227
240
  * the first station, and RE-MINTED by the adjudication station over the FINAL post-screen args (the
228
241
  * pre-existing `const req` site); `args` is re-pointed at the policy rewrite on the ask path. Writers: the
@@ -255,6 +268,10 @@ export interface GatePass {
255
268
  * that ended as a refusal). The exit mints the outcome from it beside the ledger's `settled`; a refusal
256
269
  * that reaches the exit without it is an engine defect and the mint throws. */
257
270
  deniedBy: DeniedBy | undefined;
271
+ /** borrowed-mutable — the registration whose handler refused, written by every site that writes `deniedBy: "hook"` (its deny
272
+ * answer, or its failure; absent when the refusal names no extension — the engine's own failed raise, a cancel). Read only
273
+ * beside `deniedBy: "hook"` ({@link DENIED_BY_MAY_NAME_EXTENSION}); the exit mints `GateDisposition.extension` from it. */
274
+ deniedExtension?: string;
258
275
  /** borrowed-mutable — a refusing station's STRUCTURED details (the shell read station's refusal card), written
259
276
  * beside `deniedBy` by that station alone; the exit puts it on the gate result for the loop's error result.
260
277
  * OPTIONAL (the `probeUnanswered` form): the dispatch that builds the pass has nothing to declare here. */
@@ -318,6 +335,11 @@ export interface GatePass {
318
335
  * on BOTH its arms (a write tool's target), and the fold's read station (a shell command's written targets,
319
336
  * `ShellReadVerdict.writeProtected`). Reader: the lanes' mandate. */
320
337
  writeProtected?: true;
338
+ /** borrowed-mutable — the same judge's table was met by a written target only where the path resolves on disk (the path as
339
+ * written names no row): the class the auto-mode classifier does not answer. Writers: the two writers of `writeProtected`
340
+ * (`writeProtectionReachOf` for a write tool's target, `ShellReadVerdict.writeProtectedOnDisk` for a command's). Reader: the
341
+ * lanes' mandate. */
342
+ writeProtectedOnDisk?: true;
321
343
  /** borrowed-mutable — the READING of a written target could not say where it leads on disk (a target a shell command's
322
344
  * program writes, placed, whose destination the read station could not resolve): no automatic lane may answer the ask.
323
345
  * A fact of the reading, not of a judge. Writer: the fold's read station (`ShellReadVerdict.targetUnresolved`). Reader:
@@ -348,7 +370,7 @@ export interface GatePass {
348
370
  * here — an attribution channel whose job is "why was this call denied" must see an engine deny, or the
349
371
  * deployment's only evidence of a broken hook is a tool that mysteriously stops working.
350
372
  */
351
- export declare function engineFailClosedExit(pass: GatePass, reason: string): Promise<ToolGateResult>;
373
+ export declare function engineFailClosedExit(pass: GatePass, reason: string, extension?: string): Promise<ToolGateResult>;
352
374
  /** The refusal sentence for args the gate could not take into its own copy (`ownArgs` refused them), naming what. */
353
375
  export declare const unownedArgsMessage: (subject: string, reason: string) => string;
354
376
  /**
@@ -374,7 +396,7 @@ export declare function untakenValueExit(pass: GatePass, untaken: {
374
396
  export declare function unownedArgsExit(pass: GatePass, reason: string): Promise<ToolGateResult>;
375
397
  /** The hook's OWN deny in phase 1. A PreToolUse hook deny does NOT fire `permissionDenied`
376
398
  * (the exclusion recorded on `PermissionDeniedPayload`) — this return stays observer-free. */
377
- export declare function hookDenyExit(pass: GatePass, deniedReason: string): ToolGateResult;
399
+ export declare function hookDenyExit(pass: GatePass, deniedReason: string, extension?: string): ToolGateResult;
378
400
  /**
379
401
  * The exit of the adjudicate chain — the pass has a standing `deny` or `allow` (every ask was resolved or
380
402
  * parked before this), and this is where it becomes the gate result and the ONE record of the pass.
@@ -5,14 +5,17 @@ import { isProtectedWrite } from "../tool-registry.js";
5
5
  import { attestationOf, decisionText, licenseCovers } from "../tool-policy.js";
6
6
  import { pathDenialCardOf } from "../../tools/fs/safety.js";
7
7
  import { argsAsTheToolReads } from "../effective-path-target.js";
8
+ import { rewriteRecordOf } from "../rewrite-rejudge.js";
8
9
  import { askUnresolvableRemedySeat } from "../ask-unresolvable-notice.js";
9
10
  import { inlineUntrusted } from "../untrusted-text.js";
10
11
  import { formatHookFeedback } from "../reminder-mint.js";
11
12
  import { types } from "node:util";
12
13
  import { receive } from "../mods/kernel/receive.js";
14
+ import { namedRegistration } from "../mods/kernel/registration.js";
13
15
  import { describeBindingFault, MAX_DEPTH } from "../canonical-json.js";
14
16
  export function mintGateOutcome(facts) {
15
17
  const settlement = facts.settled !== undefined ? Object.freeze({ ...facts.settled.settlement, who: Object.freeze({ ...facts.settled.settlement.who }) }) : undefined;
18
+ const extension = namedRegistration(facts.extension);
16
19
  const attribution = facts.classifier !== undefined ? Object.freeze({ ...facts.classifier, ...(facts.classifier.fallback !== undefined ? { fallback: Object.freeze({ ...facts.classifier.fallback }) } : {}) }) : undefined;
17
20
  const outcome = Object.freeze({
18
21
  disposition: Object.freeze(facts.deniedBy !== undefined
@@ -20,6 +23,7 @@ export function mintGateOutcome(facts) {
20
23
  kind: "denied",
21
24
  deniedBy: facts.deniedBy,
22
25
  ...(facts.cause !== undefined ? { cause: facts.cause } : {}),
26
+ ...(extension !== undefined ? { extension } : {}),
23
27
  ...(attribution !== undefined ? { classifier: attribution } : {}),
24
28
  ...(facts.modeRefusal !== undefined ? { mode: facts.modeRefusal.mode, askClass: facts.modeRefusal.askClass, classes: Object.freeze([...facts.modeRefusal.classes]) } : {}),
25
29
  }
@@ -40,8 +44,8 @@ function releaseRecordOf(a) {
40
44
  const { kind: _kind, ...record } = a;
41
45
  return record;
42
46
  }
43
- export function directDeny(deniedBy) {
44
- return mintGateOutcome({ deniedBy });
47
+ export function directDeny(deniedBy, extension) {
48
+ return mintGateOutcome({ deniedBy, ...(extension !== undefined ? { extension } : {}) });
45
49
  }
46
50
  const SETTLEMENT_IS_HUMAN = {
47
51
  human_allowed: true,
@@ -217,9 +221,9 @@ function withParkFailureCause(reason, parkFailed, nobodyJudged) {
217
221
  export function passAskFace(pass) {
218
222
  return askFaceOf(wireOf("gate.askFace", pass.req));
219
223
  }
220
- export async function engineFailClosedExit(pass, reason) {
224
+ export async function engineFailClosedExit(pass, reason, extension) {
221
225
  const { input, toolName, toolCallId, notifyPermissionDenied } = pass;
222
- const gate = directDeny("hook");
226
+ const gate = directDeny("hook", extension);
223
227
  const finalInput = frozenInputSnapshot(pass.currentInput);
224
228
  await notifyPermissionDenied({ toolName, input: cloneObserverInput(finalInput), toolCallId, reason, gate, ...(input.identity !== undefined ? { identity: input.identity } : {}) });
225
229
  return { block: true, reason: formatHookFeedback(reason, input.reminderMark), gate, finalInput, preToolContext: pass.preToolContext };
@@ -234,12 +238,12 @@ export async function untakenValueExit(pass, untaken) {
234
238
  export async function unownedArgsExit(pass, reason) {
235
239
  return await untakenValueExit(pass, { value: pass.currentInput, message: unownedArgsMessage(`the arguments of "${pass.toolName}"`, reason), deniedBy: "policy" });
236
240
  }
237
- export function hookDenyExit(pass, deniedReason) {
241
+ export function hookDenyExit(pass, deniedReason, extension) {
238
242
  const { input } = pass;
239
243
  return {
240
244
  block: true,
241
245
  reason: formatHookFeedback(deniedReason, input.reminderMark),
242
- gate: directDeny("hook"),
246
+ gate: directDeny("hook", extension),
243
247
  finalInput: frozenInputSnapshot(pass.currentInput),
244
248
  preToolContext: pass.preToolContext,
245
249
  };
@@ -268,7 +272,7 @@ export async function exitGate(pass) {
268
272
  pass.deniedBy = "mode";
269
273
  ledger.supersede();
270
274
  }
271
- const gate = mintGateOutcome({ deniedBy: pass.deniedBy, ...(pass.denyCause !== undefined ? { cause: pass.denyCause } : {}), ...(ledger.settled !== undefined ? { settled: ledger.settled } : {}), ...(pass.classifierRound !== undefined ? { classifier: pass.classifierRound } : {}), ...(modeRefusal !== undefined ? { modeRefusal: { mode: modeRefusal.mode, askClass: modeRefusal.askClass, classes: modeRefusal.classes } } : {}) });
275
+ const gate = mintGateOutcome({ deniedBy: pass.deniedBy, ...(pass.deniedBy === "hook" && pass.deniedExtension !== undefined ? { extension: pass.deniedExtension } : {}), ...(pass.denyCause !== undefined ? { cause: pass.denyCause } : {}), ...(ledger.settled !== undefined ? { settled: ledger.settled } : {}), ...(pass.classifierRound !== undefined ? { classifier: pass.classifierRound } : {}), ...(modeRefusal !== undefined ? { modeRefusal: { mode: modeRefusal.mode, askClass: modeRefusal.askClass, classes: modeRefusal.classes } } : {}) });
272
276
  const foldCause = attestationOf(pass.decision, { toolCallId, toolName })?.unresolvableCause;
273
277
  const unresolvable = foldCause ?? unresolvableCauseOfSettlement(gate);
274
278
  const tableSeat = unresolvable !== undefined ? askUnresolvableRemedySeat(unresolvable) : undefined;
@@ -319,10 +323,13 @@ export async function exitGate(pass) {
319
323
  }
320
324
  const release = pass.arbitration?.kind === "released" ? pass.arbitration : (() => { if (ledger.settled !== undefined)
321
325
  return undefined; const a = pass.arbitration === undefined ? input.ancestorArbitrationOf?.(toolCallId) : undefined; return a?.kind === "released" ? a : undefined; })();
326
+ const finalInput = frozenInputSnapshot(pass.currentInput);
327
+ const rewrite = rewriteRecordOf(pass.rewrites, pass.req, pass.currentInput, finalInput);
322
328
  return {
323
329
  updatedInput: pass.currentInput,
324
330
  gate: mintGateOutcome({ ...(ledger.settled !== undefined ? { settled: ledger.settled } : {}), ...(pass.classifierRound !== undefined ? { classifier: pass.classifierRound } : {}), ...(release !== undefined ? { released: releaseRecordOf(release) } : {}), ...(pass.clearedBy !== undefined && ledger.settled === undefined && release === undefined ? { clearedBy: pass.clearedBy } : {}) }),
325
- finalInput: frozenInputSnapshot(pass.currentInput),
331
+ finalInput,
332
+ ...(rewrite !== undefined ? { rewrite } : {}),
326
333
  preToolContext: pass.preToolContext,
327
334
  };
328
335
  }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The run's account of the images a provider refused (`context.image_removed`, user). The harness's request view
3
+ * removes the images a provider refusal points at (`engine/llm/rejected-images.ts`) and hands this seat the removals
4
+ * the run itself met; every request re-reads the transcript — the live failure, then its record or a rebuilt copy —
5
+ * so the seat announces ONCE PER RUN PER REFUSAL, keyed by the identity all of those share (`refusalAt`).
6
+ */
7
+ import { type EngineNotice } from "../engine-notice.js";
8
+ import type { RejectedImageRemoval } from "../../internal/llm.js";
9
+ export declare function createImageRemovedSeat(onNotice: ((notice: EngineNotice) => void) | undefined, ids: {
10
+ sessionId: string;
11
+ runId: string;
12
+ }): (removals: readonly RejectedImageRemoval[]) => void;
@@ -0,0 +1,19 @@
1
+ import { deliverEngineNotice } from "../engine-notice.js";
2
+ export function createImageRemovedSeat(onNotice, ids) {
3
+ const announced = new Set();
4
+ return (removals) => {
5
+ for (const { refusalAt, images } of removals) {
6
+ if (announced.has(refusalAt))
7
+ continue;
8
+ announced.add(refusalAt);
9
+ const one = images === 1;
10
+ deliverEngineNotice(onNotice, {
11
+ code: "context.image_removed",
12
+ message: `The model provider could not process ${one ? "an image" : `${images} images`} in this conversation, so ${one ? "it was" : "they were"} removed ` +
13
+ `from what the model sees (each replaced by a line saying so) and the request was sent again without ${one ? "it" : "them"}. ` +
14
+ `The session still holds the original; to show the model this content again, send it in another format.`,
15
+ detail: { images, sessionId: ids.sessionId, runId: ids.runId },
16
+ });
17
+ }
18
+ };
19
+ }
@@ -17,7 +17,7 @@ export async function admitInlineImage(img) {
17
17
  case "mime_unsupported":
18
18
  throw inlineImageRefusal(`an inline image declares mimeType ${JSON.stringify(mimeType.slice(0, 80))}, which the model API does not accept (accepted: ${ADMITTED_IMAGE_MIME_TYPES.join(", ")}).`);
19
19
  case "magic_mismatch":
20
- throw inlineImageRefusal(`an inline image's bytes do not begin with a ${mimeType} signature (empty, mis-declared, or not base64) — refused rather than sent.`);
20
+ throw inlineImageRefusal(`an inline image's bytes do not open with a valid ${mimeType} header (empty, truncated, mis-declared, not base64, or a variant such as an Apple-optimized PNG that model APIs cannot read) — refused rather than sent.`);
21
21
  case "raw_too_large":
22
22
  throw inlineImageRefusal(`an inline image is ${admitted.rawBytes} bytes, over the ${admitted.cap}-byte cap.`);
23
23
  case "base64_too_large":
@@ -1,5 +1,5 @@
1
1
  import { brainToRuntime } from "../runtime.js";
2
- import { expandTiers, roleModelIfSet } from "../roles.js";
2
+ import { expandTiers, roleModelIfSet, unheldChainRefusal } from "../roles.js";
3
3
  import { isAliasModelId, openAiCompatChatSeat } from "../memory-engine/distiller.js";
4
4
  import { runMemoryConsolidationDriver } from "../memory-engine/consolidation-driver.js";
5
5
  import { recommendationUnconsumed } from "../memory-engine/consolidation.js";
@@ -29,7 +29,7 @@ export function resolveMemoryConsolidationDriver(deps) {
29
29
  const models = expandTiers(deps.models, deps.tiers);
30
30
  const resolved = roleModelIfSet("consolidate", {}, { models, roles: deps.roles }) ?? roleModelIfSet("summarize", {}, { models, roles: deps.roles });
31
31
  if (resolved === undefined) {
32
- throw seatRefusal('memory consolidation has no model seat: configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize (a tier-expanded catalog\'s "flash" binding also satisfies the summarize hop). The chain deliberately does NOT fall back to the default main model — a whole-library distillation must not silently ride the most expensive seat.');
32
+ throw unheldChainRefusal(["consolidate", "summarize"], models, deps.roles) ?? seatRefusal('memory consolidation has no model seat: configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize (a tier-expanded catalog\'s "flash" binding also satisfies the summarize hop). The chain deliberately does NOT fall back to the default main model — a whole-library distillation must not silently ride the most expensive seat.');
33
33
  }
34
34
  if (isAliasModelId(resolved.id)) {
35
35
  throw seatRefusal(`the resolved consolidation model id ${JSON.stringify(resolved.id)} is an alias spelling — an alias can be re-pointed upstream and would move the run with no trace in the archive; bind an explicit id.`);
@@ -116,6 +116,6 @@ export function assertAutoConsolidationWirable(deps) {
116
116
  throw autoRunRefusal("RunnerDeps.autoRunOnRecommendation is true but RunnerDeps.memoryConsolidation is absent — the recommendation that would trigger a run is never minted (consolidation is OFF) and the engine's verbs refuse coded, so the trigger can never fire. An armed-but-unrunnable trigger is refused, never folded to off: wire memoryConsolidation, or leave autoRunOnRecommendation unset.");
117
117
  }
118
118
  if (!consolidationSeatResolvable(deps)) {
119
- throw autoRunRefusal("RunnerDeps.autoRunOnRecommendation is true but no consolidation model seat resolves — configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize. Arming auto-run with no model to run it is refused, never folded to off (a whole-library distillation must not silently ride the default main model).");
119
+ throw unheldChainRefusal(["consolidate", "summarize"], expandTiers(deps.models, deps.tiers), deps.roles) ?? autoRunRefusal("RunnerDeps.autoRunOnRecommendation is true but no consolidation model seat resolves — configure RunnerDeps.memoryConsolidationDriver.chat (an endpoint triple or a chat function), or declare roles.consolidate / roles.summarize. Arming auto-run with no model to run it is refused, never folded to off (a whole-library distillation must not silently ride the default main model).");
120
120
  }
121
121
  }
@@ -6,7 +6,7 @@
6
6
  * numbers, and the driver keeps reaching down for the marker its harness stamps. Pure: no engine state; the only clock
7
7
  * is the caller's.
8
8
  */
9
- import type { CheckpointGate, CheckpointToken, PendingAction } from "../checkpoint-store.js";
9
+ import { type CheckpointGate, type CheckpointToken, type PendingAction } from "../checkpoint-store.js";
10
10
  import type { WorkspaceHandle } from "../remote-env.js";
11
11
  import type { Prepared } from "./contracts.js";
12
12
  /** Default resource-checkpoint retention (30 days, the spec's
@@ -1,3 +1,4 @@
1
+ import { planReviewRequesterOf } from "../checkpoint-store.js";
1
2
  export const DEFAULT_RESOURCE_TTL_MS = 30 * 24 * 60 * 60 * 1000;
2
3
  export const USAGE_WINDOW_REAP_MARGIN_MS = 60 * 60 * 1000;
3
4
  export const DEFAULT_UNATTENDED_APPROVAL_TTL_MS = 30 * 24 * 60 * 60 * 1000;
@@ -16,12 +17,14 @@ export function parkContaminationMarker(refs) {
16
17
  return { code: "gate.parked", ...(gatedCallId !== undefined ? { gatedCallId } : {}) };
17
18
  }
18
19
  export function publishCommittedSuspend(refs, token, gate, scope, remoteHandle, checkpointId, pendingAction) {
20
+ const requestedByCallId = pendingAction !== undefined ? planReviewRequesterOf(pendingAction) : undefined;
19
21
  const pause = {
20
22
  cause: {
21
23
  kind: "paused",
22
24
  gate,
23
25
  token,
24
26
  ...(checkpointId !== undefined ? { checkpointId } : {}),
27
+ ...(requestedByCallId !== undefined ? { requestedByCallId } : {}),
25
28
  ...(remoteHandle !== undefined ? { restoreMode: remoteHandle.restoreMode === "park_only" ? "park_only" : "snapshot" } : {}),
26
29
  },
27
30
  scope,
@@ -7,7 +7,7 @@ import { type OnAsk, type ToolCallRequest, type ToolPolicy } from "../tool-polic
7
7
  import type { RunnerDeps, TaskSpec } from "../types.js";
8
8
  import type { CwdRef } from "../../tools/fs/fs-shared.js";
9
9
  import type { AskLane, Prepared } from "./contracts.js";
10
- import type { GrantBindingOf } from "../skill-grant-binding.js";
10
+ import { type GrantBindingOf } from "../skill-grant-binding.js";
11
11
  import { consumeInheritedAskGrant } from "./inherited-ask-grants.js";
12
12
  import { type GrantReadRoot } from "./read-root-grant.js";
13
13
  import type { createRuleOffersOf } from "./permission-rule-lanes.js";
@@ -8,6 +8,7 @@ import { failedJudgmentDeny, policyCheckAbortedDeny } from "./policy-throw.js";
8
8
  import { askMandateMember } from "../ask-origin.js";
9
9
  import { approvalCardMemberOf, survivorsByName } from "../tool-roster.js";
10
10
  import { toolNameIndex } from "../../internal/llm.js";
11
+ import { requestGrantBinding } from "../skill-grant-binding.js";
11
12
  import { gateAskCarry, lateAskSettlementObserver } from "./denial-limit-arms.js";
12
13
  import { consumeInheritedAskGrant } from "./inherited-ask-grants.js";
13
14
  import { requesterOf } from "../mods/extension-call.js";
@@ -61,7 +62,7 @@ export function prepareAskLane(input) {
61
62
  const adjudicate = effectivePolicy
62
63
  ? async (req, callSignal) => {
63
64
  const signal = composedCallSignal(callSignal);
64
- const stampedReq = () => ({ ...req, budget: budgetSnapshot, ...(handsCwdRef !== undefined ? { cwd: handsCwdRef.current } : {}), ...(handsRoot !== undefined ? { root: handsRoot } : {}), ...advertisedWritableRootsSeat(advertisedWritableDirs), ...exemptRootsSeat(exemptRoots) });
65
+ const stampedReq = () => ({ ...req, budget: budgetSnapshot, ...(handsCwdRef !== undefined ? { cwd: handsCwdRef.current } : {}), ...(handsRoot !== undefined ? { root: handsRoot } : {}), ...advertisedWritableRootsSeat(advertisedWritableDirs), ...exemptRootsSeat(exemptRoots), ...requestGrantBinding(grantBindingOf, req, req.args) });
65
66
  const judged = (async () => {
66
67
  const withReading = stampCallTarget?.(stampedReq(), signal);
67
68
  return withReading === undefined ? effectivePolicy.check(stampedReq(), signal) : effectivePolicy.check(await withReading, signal);