@sema-agent/core 7.47.0 → 7.49.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 (431) hide show
  1. package/CHANGELOG.md +472 -0
  2. package/README.md +2 -2
  3. package/dist/agents/cascade.d.ts +2 -5
  4. package/dist/agents/child-failure.d.ts +20 -0
  5. package/dist/agents/child-failure.js +28 -0
  6. package/dist/agents/cross-session-ref.d.ts +11 -3
  7. package/dist/agents/cross-session-ref.js +6 -0
  8. package/dist/agents/cumulative-stats.d.ts +12 -15
  9. package/dist/agents/cumulative-stats.js +1 -1
  10. package/dist/agents/extra-tool-names.js +1 -1
  11. package/dist/agents/inherited-tool-pool.d.ts +17 -13
  12. package/dist/agents/inherited-tool-pool.js +4 -3
  13. package/dist/agents/peer-session-drain.d.ts +3 -2
  14. package/dist/agents/peer-session-drain.js +5 -4
  15. package/dist/agents/send-message-tool.js +2 -9
  16. package/dist/agents/subagent.d.ts +10 -29
  17. package/dist/agents/subagent.js +65 -53
  18. package/dist/agents/suspend-guard.d.ts +1 -1
  19. package/dist/agents/tool-filter.d.ts +76 -65
  20. package/dist/agents/tool-filter.js +122 -92
  21. package/dist/agents/verify.d.ts +4 -7
  22. package/dist/agents/verify.js +6 -7
  23. package/dist/bench/metrics.d.ts +1 -2
  24. package/dist/brain/anthropic.js +133 -79
  25. package/dist/brain/errors.d.ts +53 -6
  26. package/dist/brain/errors.js +22 -2
  27. package/dist/brain/input-too-long.d.ts +40 -19
  28. package/dist/brain/input-too-long.js +3 -16
  29. package/dist/brain/open-responses.js +19 -10
  30. package/dist/brain/openai.js +123 -32
  31. package/dist/brain/provider-dialect.d.ts +214 -0
  32. package/dist/brain/provider-dialect.js +186 -0
  33. package/dist/brain/request-params.d.ts +27 -8
  34. package/dist/brain/request-params.js +7 -12
  35. package/dist/brain/request-route.d.ts +84 -0
  36. package/dist/brain/request-route.js +41 -0
  37. package/dist/brain/retry.d.ts +8 -0
  38. package/dist/brain/retry.js +10 -4
  39. package/dist/brain/route-adjudicator.d.ts +7 -0
  40. package/dist/brain/route-adjudicator.js +5 -1
  41. package/dist/brain/status-sink.d.ts +20 -0
  42. package/dist/brain/status-sink.js +11 -0
  43. package/dist/brain/stream-engine.d.ts +52 -1
  44. package/dist/brain/stream-engine.js +81 -24
  45. package/dist/brain/stream-shared.d.ts +57 -11
  46. package/dist/brain/stream-shared.js +28 -2
  47. package/dist/core/a2a.d.ts +1 -0
  48. package/dist/core/agent-config-dir.js +3 -2
  49. package/dist/core/allow-entry.d.ts +21 -12
  50. package/dist/core/allow-entry.js +39 -32
  51. package/dist/core/arg-summary.d.ts +17 -24
  52. package/dist/core/arg-summary.js +169 -68
  53. package/dist/core/ask-origin.d.ts +42 -24
  54. package/dist/core/ask-origin.js +18 -13
  55. package/dist/core/auto-mode-prompt-assets.d.ts +2 -2
  56. package/dist/core/auto-mode-prompt-assets.js +1 -1
  57. package/dist/core/auto-mode-prompt.d.ts +11 -1
  58. package/dist/core/auto-mode-prompt.js +13 -10
  59. package/dist/core/auto-mode-rebuild.d.ts +7 -0
  60. package/dist/core/auto-mode-rebuild.js +4 -1
  61. package/dist/core/canonical-json.d.ts +3 -0
  62. package/dist/core/canonical-json.js +2 -1
  63. package/dist/core/checkpoint-requirements.d.ts +892 -0
  64. package/dist/core/checkpoint-requirements.js +333 -0
  65. package/dist/core/checkpoint-store.d.ts +95 -66
  66. package/dist/core/checkpoint-store.js +14 -26
  67. package/dist/core/child-clamp-seats.d.ts +228 -69
  68. package/dist/core/child-clamp-seats.js +211 -17
  69. package/dist/core/classifier-unavailable-arm.d.ts +5 -1
  70. package/dist/core/classifier-unavailable-arm.js +3 -3
  71. package/dist/core/compliance.d.ts +3 -0
  72. package/dist/core/compliance.js +9 -4
  73. package/dist/core/credential-vocabulary.d.ts +140 -0
  74. package/dist/core/credential-vocabulary.js +131 -0
  75. package/dist/core/decision-receipt.js +1 -1
  76. package/dist/core/effective-path-target.d.ts +73 -16
  77. package/dist/core/effective-path-target.js +63 -33
  78. package/dist/core/engine-notice.d.ts +32 -7
  79. package/dist/core/file-history-store.js +2 -2
  80. package/dist/core/fs-write-gate-policy.d.ts +4 -0
  81. package/dist/core/fs-write-gate-policy.js +22 -5
  82. package/dist/core/gate-bounded-await.d.ts +28 -13
  83. package/dist/core/gate-bounded-await.js +41 -4
  84. package/dist/core/gate-fold.d.ts +1 -1
  85. package/dist/core/gate-fold.js +24 -25
  86. package/dist/core/gate-lanes.js +16 -15
  87. package/dist/core/gate-outcome.d.ts +20 -5
  88. package/dist/core/gate-outcome.js +5 -0
  89. package/dist/core/governance-codes.d.ts +11 -4
  90. package/dist/core/governance-codes.js +14 -3
  91. package/dist/core/hooks.d.ts +4 -0
  92. package/dist/core/locked-config.d.ts +8 -0
  93. package/dist/core/locked-config.js +14 -2
  94. package/dist/core/lsp.js +3 -5
  95. package/dist/core/mailbox-store.d.ts +3 -4
  96. package/dist/core/mcp-connection-pool.d.ts +75 -0
  97. package/dist/core/mcp-connection-pool.js +128 -0
  98. package/dist/core/mcp-failure.d.ts +2 -1
  99. package/dist/core/mcp-failure.js +13 -2
  100. package/dist/core/mcp-server-spec.d.ts +1 -1
  101. package/dist/core/mcp.d.ts +4 -0
  102. package/dist/core/mcp.js +70 -43
  103. package/dist/core/memory-engine/content-origin.js +2 -14
  104. package/dist/core/memory-engine/engine.d.ts +32 -22
  105. package/dist/core/memory-engine/engine.js +103 -55
  106. package/dist/core/memory-engine/file-backend.d.ts +13 -30
  107. package/dist/core/memory-engine/file-backend.js +37 -252
  108. package/dist/core/memory-engine/index.d.ts +1 -1
  109. package/dist/core/memory-engine/index.js +1 -1
  110. package/dist/core/memory-engine/layout.d.ts +139 -9
  111. package/dist/core/memory-engine/layout.js +350 -7
  112. package/dist/core/memory-engine/scope-contract.d.ts +10 -0
  113. package/dist/core/memory-engine/scope-contract.js +8 -0
  114. package/dist/core/memory-engine/session-incarnation.d.ts +14 -4
  115. package/dist/core/memory-engine/session-incarnation.js +5 -2
  116. package/dist/core/memory-engine/types.d.ts +10 -1
  117. package/dist/core/memory.js +5 -17
  118. package/dist/core/model-seat.d.ts +4 -4
  119. package/dist/core/model-seat.js +1 -1
  120. package/dist/core/mounted-mcp.d.ts +57 -0
  121. package/dist/core/mounted-mcp.js +19 -0
  122. package/dist/core/namespaced-rule-name.d.ts +29 -0
  123. package/dist/core/namespaced-rule-name.js +52 -0
  124. package/dist/core/park-selfcheck.d.ts +1 -1
  125. package/dist/core/park-selfcheck.js +16 -6
  126. package/dist/core/path-guard-rows.d.ts +99 -0
  127. package/dist/core/path-guard-rows.js +45 -0
  128. package/dist/core/path-identity.d.ts +22 -16
  129. package/dist/core/path-identity.js +10 -10
  130. package/dist/core/path-rule-binding.d.ts +2 -1
  131. package/dist/core/path-rule-binding.js +3 -1
  132. package/dist/core/pause-registry.d.ts +16 -2
  133. package/dist/core/pause-registry.js +6 -0
  134. package/dist/core/permission-rule-consent.js +0 -7
  135. package/dist/core/permission-rule-model.d.ts +68 -24
  136. package/dist/core/permission-rule-model.js +105 -24
  137. package/dist/core/permission-rule-store.js +2 -2
  138. package/dist/core/permission-rules.d.ts +3 -30
  139. package/dist/core/permission-rules.js +4 -54
  140. package/dist/core/read-root-candidate.d.ts +1 -3
  141. package/dist/core/read-root-candidate.js +4 -15
  142. package/dist/core/real-approval.d.ts +4 -3
  143. package/dist/core/retired-keys.d.ts +13 -0
  144. package/dist/core/retired-keys.js +14 -0
  145. package/dist/core/roles.d.ts +2 -3
  146. package/dist/core/roles.js +15 -6
  147. package/dist/core/runner/assemble-result.d.ts +0 -7
  148. package/dist/core/runner/assemble-result.js +19 -31
  149. package/dist/core/runner/caller-roster.d.ts +78 -0
  150. package/dist/core/runner/caller-roster.js +219 -0
  151. package/dist/core/runner/checkpoint-scope.d.ts +16 -16
  152. package/dist/core/runner/checkpoint-scope.js +2 -2
  153. package/dist/core/runner/child-tree.js +2 -2
  154. package/dist/core/runner/contracts.d.ts +68 -35
  155. package/dist/core/runner/decide-continuation.d.ts +51 -3
  156. package/dist/core/runner/decide-continuation.js +76 -21
  157. package/dist/core/runner/denial-limit-arms.d.ts +17 -5
  158. package/dist/core/runner/denial-limit-arms.js +11 -9
  159. package/dist/core/runner/extra-body-dropped-seat.d.ts +8 -0
  160. package/dist/core/runner/extra-body-dropped-seat.js +22 -0
  161. package/dist/core/runner/finish-reason-seat.d.ts +9 -0
  162. package/dist/core/runner/finish-reason-seat.js +40 -0
  163. package/dist/core/runner/gate-exit.d.ts +44 -32
  164. package/dist/core/runner/gate-exit.js +112 -25
  165. package/dist/core/runner/inherited-ask-grants.js +6 -4
  166. package/dist/core/runner/mcp-redial.d.ts +3 -3
  167. package/dist/core/runner/mcp-redial.js +3 -4
  168. package/dist/core/runner/park-commit.d.ts +1 -1
  169. package/dist/core/runner/permission-rule-lanes.d.ts +1 -2
  170. package/dist/core/runner/permission-rule-lanes.js +5 -4
  171. package/dist/core/runner/prepare-artifact.d.ts +4 -0
  172. package/dist/core/runner/prepare-artifact.js +2 -1
  173. package/dist/core/runner/prepare-ask-lane.d.ts +2 -0
  174. package/dist/core/runner/prepare-ask-lane.js +12 -6
  175. package/dist/core/runner/prepare-boundary-parks.d.ts +5 -8
  176. package/dist/core/runner/prepare-boundary-parks.js +4 -7
  177. package/dist/core/runner/prepare-caps-and-workflow.d.ts +11 -15
  178. package/dist/core/runner/prepare-caps-and-workflow.js +19 -27
  179. package/dist/core/runner/prepare-config-doors.d.ts +9 -9
  180. package/dist/core/runner/prepare-config-doors.js +10 -5
  181. package/dist/core/runner/prepare-defer-classify.d.ts +2 -2
  182. package/dist/core/runner/prepare-defer-classify.js +5 -3
  183. package/dist/core/runner/prepare-delegation-surface.d.ts +1 -1
  184. package/dist/core/runner/prepare-delegation-surface.js +3 -3
  185. package/dist/core/runner/prepare-gate-stations.d.ts +4 -4
  186. package/dist/core/runner/prepare-gate-stations.js +9 -7
  187. package/dist/core/runner/prepare-hands-readface.d.ts +7 -7
  188. package/dist/core/runner/prepare-hands-readface.js +7 -7
  189. package/dist/core/runner/prepare-inherited-gate.d.ts +7 -6
  190. package/dist/core/runner/prepare-inherited-gate.js +14 -15
  191. package/dist/core/runner/prepare-listings.d.ts +7 -24
  192. package/dist/core/runner/prepare-listings.js +4 -5
  193. package/dist/core/runner/prepare-memory-engine-session.d.ts +2 -0
  194. package/dist/core/runner/prepare-memory-engine-session.js +4 -3
  195. package/dist/core/runner/prepare-memory.d.ts +6 -0
  196. package/dist/core/runner/prepare-memory.js +13 -13
  197. package/dist/core/runner/prepare-offload-wrappers.d.ts +5 -0
  198. package/dist/core/runner/prepare-offload-wrappers.js +3 -3
  199. package/dist/core/runner/prepare-park-ask.d.ts +7 -8
  200. package/dist/core/runner/prepare-park-ask.js +17 -10
  201. package/dist/core/runner/prepare-policy-chain.js +24 -44
  202. package/dist/core/runner/prepare-project-context.d.ts +1 -1
  203. package/dist/core/runner/prepare-project-context.js +3 -4
  204. package/dist/core/runner/prepare-protocol-tools.d.ts +9 -3
  205. package/dist/core/runner/prepare-protocol-tools.js +3 -4
  206. package/dist/core/runner/prepare-run-refs.d.ts +3 -0
  207. package/dist/core/runner/prepare-run-refs.js +2 -1
  208. package/dist/core/runner/prepare-safety-scan.d.ts +4 -8
  209. package/dist/core/runner/prepare-safety-scan.js +1 -2
  210. package/dist/core/runner/prepare-suspend-saga.d.ts +7 -1
  211. package/dist/core/runner/prepare-suspend-saga.js +28 -12
  212. package/dist/core/runner/prepare-task.d.ts +1 -1
  213. package/dist/core/runner/prepare-task.js +67 -56
  214. package/dist/core/runner/prepare-wiring-manifest.d.ts +11 -10
  215. package/dist/core/runner/prepare-wiring-manifest.js +5 -8
  216. package/dist/core/runner/resume-apply.js +7 -14
  217. package/dist/core/runner/resume-checkpoint-screen.js +11 -4
  218. package/dist/core/runner/resume-internals-and-config.js +2 -2
  219. package/dist/core/runner/resume-policy-outcome.js +5 -32
  220. package/dist/core/runner/resume-review-outcome.js +4 -1
  221. package/dist/core/runner/retired-runner-deps.d.ts +6 -0
  222. package/dist/core/runner/retired-runner-deps.js +10 -1
  223. package/dist/core/runner/run-brain-sinks.d.ts +4 -0
  224. package/dist/core/runner/run-brain-sinks.js +5 -2
  225. package/dist/core/runner/run-harness-handlers.js +27 -34
  226. package/dist/core/runner/run-leg.d.ts +0 -2
  227. package/dist/core/runner/run-leg.js +32 -33
  228. package/dist/core/runner/run-terminal-adoption.js +4 -3
  229. package/dist/core/runner/runtask.js +8 -8
  230. package/dist/core/runner/session-rule-policy.js +5 -5
  231. package/dist/core/runner/stream-settle-backstop.js +7 -4
  232. package/dist/core/runner/sub-agent-deny-lists.d.ts +51 -12
  233. package/dist/core/runner/sub-agent-deny-lists.js +111 -80
  234. package/dist/core/runner/terminal-account.d.ts +48 -0
  235. package/dist/core/runner/terminal-account.js +186 -0
  236. package/dist/core/runner/tool-end-body.d.ts +54 -17
  237. package/dist/core/runner/tool-end-body.js +27 -2
  238. package/dist/core/runner/tool-face-overlay.d.ts +3 -1
  239. package/dist/core/runner/tool-face-overlay.js +6 -4
  240. package/dist/core/runner/tool-occurrence.d.ts +106 -0
  241. package/dist/core/runner/tool-occurrence.js +123 -0
  242. package/dist/core/runner/tool-progress-lane.d.ts +16 -8
  243. package/dist/core/runner/tool-progress-lane.js +25 -34
  244. package/dist/core/runner/turn-attachments.d.ts +1 -1
  245. package/dist/core/runner/write-protection-station.d.ts +21 -9
  246. package/dist/core/runner/write-protection-station.js +20 -17
  247. package/dist/core/runner-deps.d.ts +12 -22
  248. package/dist/core/safety-axis-vocab.d.ts +1 -1
  249. package/dist/core/safety-merge-corpus.d.ts +1 -1
  250. package/dist/core/secret-env.d.ts +16 -5
  251. package/dist/core/secret-env.js +23 -63
  252. package/dist/core/sensitive-path-policy.d.ts +19 -18
  253. package/dist/core/sensitive-path-policy.js +73 -49
  254. package/dist/core/session-policy-store.d.ts +6 -3
  255. package/dist/core/session-policy-store.js +28 -10
  256. package/dist/core/session-reconcile.d.ts +3 -0
  257. package/dist/core/session-reconcile.js +5 -4
  258. package/dist/core/session-store.d.ts +5 -0
  259. package/dist/core/session-store.js +12 -0
  260. package/dist/core/session.d.ts +13 -0
  261. package/dist/core/shared-memory/normalize.d.ts +17 -4
  262. package/dist/core/shared-memory/normalize.js +7 -7
  263. package/dist/core/shell-lexer.js +5 -4
  264. package/dist/core/shell-wrapper-table.d.ts +2 -2
  265. package/dist/core/shell-wrapper-table.js +1 -1
  266. package/dist/core/skill-grant.js +1 -1
  267. package/dist/core/store-contracts/checkpoint-store-contract.js +13 -0
  268. package/dist/core/store-contracts/mailbox-store-contract.d.ts +7 -14
  269. package/dist/core/store-contracts/session-store-incarnation-contract.d.ts +27 -0
  270. package/dist/core/store-contracts/session-store-incarnation-contract.js +92 -0
  271. package/dist/core/stub-env.d.ts +2 -0
  272. package/dist/core/stub-env.js +1 -0
  273. package/dist/core/synthetic-read-verdict.js +2 -2
  274. package/dist/core/task-event.d.ts +59 -5
  275. package/dist/core/task-result.d.ts +1 -1
  276. package/dist/core/task-spec.d.ts +42 -9
  277. package/dist/core/terminal-cause.d.ts +94 -11
  278. package/dist/core/tighten-task-spec.d.ts +5 -4
  279. package/dist/core/tighten-task-spec.js +20 -25
  280. package/dist/core/tool-catalog-entries.d.ts +5 -7
  281. package/dist/core/tool-catalog-entries.js +14 -15
  282. package/dist/core/tool-face.d.ts +47 -0
  283. package/dist/core/tool-face.js +5 -0
  284. package/dist/core/tool-model-gate.d.ts +5 -5
  285. package/dist/core/tool-name-aliases.d.ts +35 -10
  286. package/dist/core/tool-name-aliases.js +15 -0
  287. package/dist/core/tool-name-list.d.ts +30 -0
  288. package/dist/core/tool-name-list.js +55 -0
  289. package/dist/core/tool-name-readings.d.ts +1 -9
  290. package/dist/core/tool-name-readings.js +1 -3
  291. package/dist/core/tool-policy.d.ts +195 -85
  292. package/dist/core/tool-policy.js +165 -381
  293. package/dist/core/tool-registry.d.ts +44 -1
  294. package/dist/core/tool-registry.js +26 -0
  295. package/dist/core/tool-roster.d.ts +19 -1
  296. package/dist/core/tool-roster.js +21 -2
  297. package/dist/core/tool-spec-members.d.ts +45 -0
  298. package/dist/core/tool-spec-members.js +169 -0
  299. package/dist/core/tool-spec.d.ts +46 -8
  300. package/dist/core/tools.d.ts +6 -2
  301. package/dist/core/tools.js +8 -4
  302. package/dist/core/untrusted-egress.js +29 -26
  303. package/dist/core/untrusted-text.d.ts +13 -10
  304. package/dist/core/untrusted-text.js +6 -44
  305. package/dist/core/workflow-journal-store.d.ts +4 -1
  306. package/dist/core/write-protect.d.ts +65 -29
  307. package/dist/core/write-protect.js +235 -177
  308. package/dist/engine/compaction/compaction.d.ts +2 -2
  309. package/dist/engine/execution-env/node-execution-env.d.ts +5 -23
  310. package/dist/engine/execution-env/node-execution-env.js +16 -38
  311. package/dist/engine/execution-env/symlink-chain.d.ts +23 -0
  312. package/dist/engine/execution-env/symlink-chain.js +32 -0
  313. package/dist/engine/harness/types.d.ts +7 -0
  314. package/dist/engine/llm/tool-turns.d.ts +3 -0
  315. package/dist/engine/llm/tool-turns.js +1 -0
  316. package/dist/engine/llm/types.d.ts +59 -23
  317. package/dist/engine/loop/agent-loop.js +16 -2
  318. package/dist/engine/session/memory-repo.js +11 -3
  319. package/dist/engine/session/repo-utils.d.ts +8 -0
  320. package/dist/engine/session/repo-utils.js +13 -0
  321. package/dist/index.d.ts +20 -23
  322. package/dist/index.js +17 -20
  323. package/dist/internal/harness.d.ts +1 -1
  324. package/dist/internal/harness.js +1 -1
  325. package/dist/internal/llm.d.ts +2 -2
  326. package/dist/internal/llm.js +1 -1
  327. package/dist/orchestration/governance-baseline-validity.js +1 -1
  328. package/dist/orchestration/run-spec.js +3 -3
  329. package/dist/orchestration/run-workflow-tool.d.ts +16 -35
  330. package/dist/orchestration/run-workflow-tool.js +38 -78
  331. package/dist/orchestration/workflow-governance.d.ts +21 -25
  332. package/dist/orchestration/workflow-governance.js +38 -78
  333. package/dist/orchestration/workflow-primitives.d.ts +7 -22
  334. package/dist/orchestration/workflow-primitives.js +5 -12
  335. package/dist/orchestration/workflow-types.d.ts +1 -1
  336. package/dist/orchestration/workflow.d.ts +61 -11
  337. package/dist/orchestration/workflow.js +191 -119
  338. package/dist/prompt-assembly/types.d.ts +1 -1
  339. package/dist/scenarios/full-body.d.ts +1 -1
  340. package/dist/shell/lex.d.ts +0 -21
  341. package/dist/shell/lex.js +278 -70
  342. package/dist/shell/shell-words.d.ts +35 -0
  343. package/dist/shell/shell-words.js +65 -0
  344. package/dist/stores/file/checkpoint-store.d.ts +5 -5
  345. package/dist/stores/file/checkpoint-store.js +5 -2
  346. package/dist/stores/file/index.d.ts +0 -8
  347. package/dist/stores/file/index.js +0 -12
  348. package/dist/stores/file/session-store.d.ts +3 -0
  349. package/dist/stores/file/session-store.js +44 -19
  350. package/dist/tools/artifact/artifact-tool.js +2 -0
  351. package/dist/tools/fs/bash-program-position.d.ts +17 -3
  352. package/dist/tools/fs/bash-program-position.js +25 -10
  353. package/dist/tools/fs/bash-readonly-classifier.d.ts +1 -1
  354. package/dist/tools/fs/bash-readonly-classifier.js +8 -7
  355. package/dist/tools/fs/containment-face.d.ts +4 -0
  356. package/dist/tools/fs/containment-face.js +3 -0
  357. package/dist/tools/fs/fs-shared.d.ts +10 -0
  358. package/dist/tools/fs/fs-shared.js +18 -0
  359. package/dist/tools/fs/fs-write.js +4 -2
  360. package/dist/tools/fs/index.d.ts +3 -2
  361. package/dist/tools/fs/index.js +2 -2
  362. package/dist/tools/fs/program-read-model.d.ts +99 -23
  363. package/dist/tools/fs/program-read-model.js +129 -55
  364. package/dist/tools/fs/program-read-model.rows.d.ts +0 -14
  365. package/dist/tools/fs/program-read-model.rows.js +18 -10
  366. package/dist/tools/fs/read-deny-home.d.ts +35 -30
  367. package/dist/tools/fs/read-deny-home.js +45 -38
  368. package/dist/tools/fs/read-deny.d.ts +35 -27
  369. package/dist/tools/fs/read-deny.js +126 -92
  370. package/dist/tools/fs/removal-targets.d.ts +56 -23
  371. package/dist/tools/fs/removal-targets.js +74 -87
  372. package/dist/tools/fs/safety.d.ts +29 -22
  373. package/dist/tools/fs/safety.js +17 -11
  374. package/dist/tools/fs/search.js +10 -8
  375. package/dist/tools/fs/shell-read-argv.d.ts +4 -7
  376. package/dist/tools/fs/shell-read-argv.js +6 -8
  377. package/dist/tools/fs/shell-read-bindings.d.ts +203 -46
  378. package/dist/tools/fs/shell-read-bindings.js +488 -144
  379. package/dist/tools/fs/shell-read-builtins.d.ts +35 -0
  380. package/dist/tools/fs/shell-read-builtins.js +43 -0
  381. package/dist/tools/fs/shell-read-check.d.ts +15 -1
  382. package/dist/tools/fs/shell-read-check.js +51 -42
  383. package/dist/tools/fs/shell-read-establish.js +9 -10
  384. package/dist/tools/fs/shell-read-functions.d.ts +22 -0
  385. package/dist/tools/fs/shell-read-functions.js +29 -0
  386. package/dist/tools/fs/shell-read-judge.d.ts +48 -18
  387. package/dist/tools/fs/shell-read-judge.js +33 -4
  388. package/dist/tools/fs/shell-read-plan.d.ts +13 -20
  389. package/dist/tools/fs/shell-read-plan.js +200 -194
  390. package/dist/tools/fs/shell-read-start.d.ts +80 -0
  391. package/dist/tools/fs/shell-read-start.js +99 -0
  392. package/dist/tools/fs/shell-read-word.d.ts +35 -6
  393. package/dist/tools/fs/shell-read-word.js +89 -9
  394. package/dist/tools/fs/shell-read-workdir.d.ts +156 -0
  395. package/dist/tools/fs/shell-read-workdir.js +281 -0
  396. package/dist/tools/fs/shell-read-write-targets.d.ts +5 -2
  397. package/dist/tools/fs/shell-read-write-targets.js +14 -5
  398. package/dist/tools/fs/shell-reentry-text.d.ts +26 -26
  399. package/dist/tools/fs/shell-reentry-text.js +31 -34
  400. package/dist/tools/task-list.d.ts +1 -2
  401. package/dist/tools/web.js +1 -1
  402. package/package.json +4 -1
  403. package/test/export-surface.snapshot.json +107 -143
  404. package/wire-changes/core@7.48.0.json +252 -0
  405. package/wire-changes/core@7.49.0.json +4765 -0
  406. package/dist/agents/teacher.d.ts +0 -159
  407. package/dist/agents/teacher.js +0 -577
  408. package/dist/agents/team.d.ts +0 -226
  409. package/dist/agents/team.js +0 -257
  410. package/dist/core/strategy-store.d.ts +0 -238
  411. package/dist/core/strategy-store.js +0 -253
  412. package/dist/orchestration/builtin-workflows.d.ts +0 -133
  413. package/dist/orchestration/builtin-workflows.js +0 -159
  414. package/dist/scenarios/env.d.ts +0 -40
  415. package/dist/scenarios/env.js +0 -39
  416. package/dist/scenarios/scenario-registry.d.ts +0 -110
  417. package/dist/scenarios/scenario-registry.js +0 -140
  418. package/dist/scenarios/teacher-quickstart.d.ts +0 -40
  419. package/dist/scenarios/teacher-quickstart.js +0 -12
  420. package/dist/stores/cc/lockfile.d.ts +0 -10
  421. package/dist/stores/cc/lockfile.js +0 -98
  422. package/dist/stores/cc/mailbox-store.d.ts +0 -20
  423. package/dist/stores/cc/mailbox-store.js +0 -255
  424. package/dist/stores/cc/roster-adapter.d.ts +0 -12
  425. package/dist/stores/cc/roster-adapter.js +0 -117
  426. package/dist/stores/cc/sidecar-transcript.d.ts +0 -97
  427. package/dist/stores/cc/sidecar-transcript.js +0 -264
  428. package/dist/stores/cc/task-list-store.d.ts +0 -2
  429. package/dist/stores/cc/task-list-store.js +0 -125
  430. package/dist/stores/file/strategy-store.d.ts +0 -97
  431. package/dist/stores/file/strategy-store.js +0 -341
@@ -15,14 +15,16 @@ import { COMPLIANCE_CAPABILITIES, WEB_FETCH_TOOL_NAME, resolveComplianceDenies }
15
15
  import { createPresentPlanTool, createEnterPlanModeTool } from "../present-plan-tool.js";
16
16
  import { brainToRuntime } from "../runtime.js";
17
17
  import { defaultTaskRegistry } from "../task-registry.js";
18
- import { defineTool, isDefineToolProduct, rebindDefineToolCtx } from "../tools.js";
18
+ import { defineTool } from "../tools.js";
19
19
  const MOUNT_REMEDY = "author it as a plain-object ToolSpec (own `name` and `execute`), hand the defineTool product itself, or wrap a product through the supported wrapper form (a fresh object re-stamped with `stampDefineToolBrand` whose rebind re-wraps the rebound product)";
20
20
  import { isAutoModeDenySource } from "../runtime-caps.js";
21
+ import { unionAddOnly } from "../child-clamp-seats.js";
21
22
  import { derivedRouteFallsBack } from "./derived-route-fallback.js";
22
23
  import { CLASSIFIER_ATTEMPT_SUFFIX, CLASSIFIER_THINK_SEAT, announceClassifierRoleDefaulted, classifierLadderRungs, classifierReplyAsksAgain, classifierReplyFailure, classifierReplyVerdictText, classifierRoundObserver, classifierRungSeat, classifierSeatModel } from "./classifier-ladder.js";
23
24
  import { REPORT_FINDINGS_TOOL_NAME, createReportBlockedTool, createReportFindingsTool } from "./synthetic-tools.js";
24
25
  import { RosterBuilder, callerMountSource } from "../tool-roster.js";
25
26
  import { asThrownError, thrownText } from "../thrown-value.js";
27
+ import { callerEntryOrigin, rebindProductEntry, specArmCanBuild } from "./caller-roster.js";
26
28
  function assembleParentCaptureState(o, i, ctl, ancestors) {
27
29
  const build = (optedOut, indeterminate) => ({
28
30
  optedOut: optedOut === true,
@@ -114,31 +116,26 @@ function autoModeArmReasonOf(intent, facePresent, caps, capsFaulted) {
114
116
  return { armed: true, reason: "armed" };
115
117
  }
116
118
  export async function prepareCapsAndWorkflow(input) {
117
- const { spec, deps, parentSpecSeat, checkpointSeat, internals, session, sessionId, runId, hostTaskId, taskScope, taskRootFinal, model, thinking, lockedPreflight, toolEffects, toolFaceSnapshot, promptProfile, resolvedInteractionPosture, harnessRef, askSeat, carrierReadFace, carrierWriteFace, forwardEvent, inheritedGateForChildren, enrichSpecToolCtx, maybeOffload, requestReview, enterPlanMode, permissionMode, readDenyEntries, peerLaneActive, peerSendMessageBuiltIn, runnerSelf } = input;
119
+ const { spec, deps, parentSpecSeat, checkpointSeat, internals, session, sessionId, runId, hostTaskId, taskScope, taskRootFinal, model, thinking, lockedPreflight, toolEffects, toolFaceSnapshot, promptProfile, resolvedInteractionPosture, harnessRef, askSeat, runClampSource, forwardEvent, inheritedGateForChildren, enrichSpecToolCtx, maybeOffload, requestReview, enterPlanMode, permissionMode, readDenyEntries, peerLaneActive, peerSendMessageBuiltIn, runnerSelf, delegated } = input;
118
120
  const roster = new RosterBuilder(toolEffects);
119
121
  for (const t of spec.tools ?? []) {
120
122
  const mounted = mountCallerTool(t);
121
123
  roster.mount(mounted, { source: callerMountSource(mounted), mountedBy: "scenario" });
122
124
  }
123
- function specArmCanConstruct(t) {
124
- if (typeof t !== "object" || t === null)
125
- return false;
126
- const name = Object.getOwnPropertyDescriptor(t, "name");
127
- const execute = Object.getOwnPropertyDescriptor(t, "execute");
128
- return name !== undefined && "value" in name && typeof name.value === "string" && name.enumerable === true && execute !== undefined && "value" in execute && typeof execute.value === "function" && execute.enumerable === true;
129
- }
130
125
  function mountCallerTool(t) {
131
- if (isDefineToolProduct(t))
132
- return maybeOffload(rebindDefineToolCtx(t, enrichSpecToolCtx), t);
133
- if (!specArmCanConstruct(t)) {
126
+ const rebound = rebindProductEntry(t, enrichSpecToolCtx);
127
+ if (rebound !== undefined)
128
+ return maybeOffload(rebound, t);
129
+ if (!specArmCanBuild(t)) {
134
130
  const shown = Object.getOwnPropertyDescriptor(t, "name")?.value;
135
131
  const e = new Error(`spec.tools entry ${typeof shown === "string" ? JSON.stringify(shown) : "(no own name)"}: the ToolSpec arm rebuilds a caller tool from its OWN enumerable members, and this entry does not carry a string \`name\` and a function \`execute\` as own properties (a class instance, a prototype child of a spec or of a defineTool product, a function, or a Proxy over one) — ${MOUNT_REMEDY}`);
136
132
  e.code = "config.tool_mount_denied";
137
133
  throw e;
138
134
  }
135
+ const execute = t.execute, self = callerEntryOrigin(t);
139
136
  return maybeOffload(defineTool({
140
137
  ...t,
141
- execute: (args, ctx) => t.execute(args, enrichSpecToolCtx(ctx)),
138
+ execute: (args, ctx) => execute.call(self, args, enrichSpecToolCtx(ctx)),
142
139
  }), t);
143
140
  }
144
141
  const blockedRef = {};
@@ -172,19 +169,22 @@ export async function prepareCapsAndWorkflow(input) {
172
169
  runtimeCaps = screened.caps;
173
170
  runtimeCapsFaulted ||= screened.faulted;
174
171
  }
175
- let complianceDenies = new Set();
172
+ let deploymentDenies = new Set();
176
173
  let complianceDegraded = false;
177
174
  if (deps.compliancePostureResolver) {
178
175
  try {
179
176
  const posture = (await deps.compliancePostureResolver(spec.principal)) ?? undefined;
180
177
  if (posture !== undefined)
181
- complianceDenies = resolveComplianceDenies(posture);
178
+ deploymentDenies = resolveComplianceDenies(posture);
182
179
  }
183
180
  catch (err) {
184
181
  deps.onError?.(asThrownError(err), { phase: "config", sessionId });
185
- complianceDenies = new Set(COMPLIANCE_CAPABILITIES);
182
+ deploymentDenies = new Set(COMPLIANCE_CAPABILITIES);
186
183
  complianceDegraded = true;
187
184
  }
185
+ }
186
+ const complianceDenies = new Set(unionAddOnly("complianceAdditionalDenies", [...deploymentDenies], spec.complianceAdditionalDenies));
187
+ if (complianceDenies.size > 0) {
188
188
  const complianceRefuse = (capability, requested) => {
189
189
  const e = new Error(`${requested} is denied for this principal by the compliance posture (capability "${capability}"` +
190
190
  `${complianceDegraded ? "; the posture resolver is currently failing, so every managed capability is denied fail-closed" : ""}) — ` +
@@ -240,7 +240,7 @@ export async function prepareCapsAndWorkflow(input) {
240
240
  assemble: async (input) => {
241
241
  const ctx = await session.buildContext();
242
242
  const known = ctx.messages.filter((m) => !isSyntheticApiErrorMessage(m) && (m.role === "user" || m.role === "assistant" || m.role === "toolResult"));
243
- return renderAutoModeWindow(known, am.window) + renderAutoModeAction(input);
243
+ return renderAutoModeWindow(known, am.window, { delegated }) + renderAutoModeAction(input);
244
244
  },
245
245
  classify: async (_input, signal, rung, userPrompt) => {
246
246
  const rungModel = rung !== undefined ? classifierRungs[rung.index] : undefined;
@@ -294,7 +294,7 @@ export async function prepareCapsAndWorkflow(input) {
294
294
  runner: runnerSelf,
295
295
  scriptRunner: deps.workflowScriptRunner,
296
296
  governanceBaseline: deps.workflowGovernanceBaseline,
297
- parentExcludeTools: toolFaceSnapshot.exclude,
297
+ parentToolCeiling: toolFaceSnapshot.selector.layers,
298
298
  parentDeferTools: toolFaceSnapshot.defer,
299
299
  parentAlwaysLoadTools: toolFaceSnapshot.alwaysLoad,
300
300
  ...(toolFaceSnapshot.restoreGated !== undefined ? { parentRestoreGatedTools: toolFaceSnapshot.restoreGated } : {}),
@@ -306,7 +306,6 @@ export async function prepareCapsAndWorkflow(input) {
306
306
  journalStore: deps.workflowJournalStore,
307
307
  ...(deps.onBackgroundChildEvent ? { onBackgroundChildEvent: deps.onBackgroundChildEvent } : {}),
308
308
  scriptStore: deps.workflowScriptStore,
309
- builtinWorkflows: deps.builtinWorkflows,
310
309
  onAgentSpawn: deps.onWorkflowAgentSpawn,
311
310
  scope: taskScope,
312
311
  notifier: deps.workflowCompletionNotifier,
@@ -327,7 +326,6 @@ export async function prepareCapsAndWorkflow(input) {
327
326
  },
328
327
  ...(spec.getApiKeyAndHeaders !== undefined ? { parentGetApiKeyAndHeaders: spec.getApiKeyAndHeaders } : {}),
329
328
  ...(askSeat.value !== undefined ? { parentOnAsk: askSeat.value } : {}),
330
- ...(askSeat.reach !== undefined ? { parentApprovalReach: askSeat.reach } : {}),
331
329
  ...(spec.durableApproval !== undefined ? { parentDurableApproval: { ...spec.durableApproval } } : {}),
332
330
  ...(internals?.workflowParkedResume !== undefined
333
331
  ? { parkedResume: (resumeFromRunId) => {
@@ -347,13 +345,7 @@ export async function prepareCapsAndWorkflow(input) {
347
345
  workflowDepth: internals?.workflowDepth,
348
346
  parentCwd: taskRootFinal,
349
347
  parentThinking: () => childThinkingSeat(undefined, deploymentSubagentThinking(runnerSelf.agentCatalog?.roles), harnessRef.current?.getThinkingLevel() ?? thinking).thinking,
350
- parentReadFace: () => carrierReadFace(),
351
- parentWriteFace: () => carrierWriteFace(),
352
- parentReadDenyPatterns: () => {
353
- const readDenyAdditionsNormalized = input.readDenyAdditionsNormalized();
354
- return readDenyAdditionsNormalized.length > 0 ? readDenyAdditionsNormalized : undefined;
355
- },
356
- ...(spec.handsReadOnly === true ? { parentHandsReadOnly: true } : {}), ...(spec.interactiveTools === false ? { parentInteractiveTools: false } : {}),
348
+ parentClamps: runClampSource,
357
349
  onNotice: deps.onNotice,
358
350
  ...(checkpointSeat !== undefined ? { parentCheckpointStore: checkpointSeat } : {}),
359
351
  parentCenterArtifactDigest: () => input.centerAdoption()?.artifact.artifactDigest,
@@ -30,7 +30,8 @@ import type { SessionStore } from "../session.js";
30
30
  import type { RunnerDeps, TaskLimits, TaskSpec } from "../types.js";
31
31
  import { type UsageWindow } from "../usage-window-store.js";
32
32
  import { type AskSeat } from "../wiring-manifest.js";
33
- import type { PrepareResume, RunInternals, ToolFaceSnapshot } from "./contracts.js";
33
+ import type { PrepareResume, RunInternals, ToolFaceLists } from "./contracts.js";
34
+ import { type RosterSpec } from "./caller-roster.js";
34
35
  export declare function limitConfigError(code: string, message: string): Error & {
35
36
  code?: string;
36
37
  };
@@ -114,9 +115,9 @@ export declare function resolveModelPromptTraits(model: {
114
115
  fableMitigations: boolean;
115
116
  };
116
117
  export interface PrepareConfigDoorsInput {
117
- /** borrowed-readonly — the caller's spec. NEVER mutated here: the per-task agents rebind returns a
118
- * SHALLOW COPY on {@link PrepareConfigDoorsResult.spec} (only `tools` replaced). */
119
- spec: TaskSpec;
118
+ /** borrowed-readonly — the snapshot spec (its roster is faces). NEVER mutated here: the per-task agents rebind returns a
119
+ * SHALLOW COPY on {@link PrepareConfigDoorsResult.spec} (only `tools` replaced, each rebuilt entry through the snapshot). */
120
+ spec: RosterSpec;
120
121
  /** borrowed-readonly — deployment seats. Read for: the two containment-face value screens, locked-config preflight,
121
122
  * retention door, interaction-posture door (incl. `deps.onError` disclosure), usage windows,
122
123
  * brain-call guardrail default, model/role maps. */
@@ -136,11 +137,10 @@ export interface PrepareConfigDoorsResult {
136
137
  * `spec.agents` was set, in which case it is a shallow copy whose `tools` is the
137
138
  * withAgents-rebuilt roster. Every later phase (the safety scan above all — T21) must read THIS,
138
139
  * never the original input. */
139
- spec: TaskSpec;
140
- /** owned — the frozen task-start snapshot of the caller's tool-face control arrays; the ONLY thing
141
- * later face reads consult (own-task filter, defer classify, delegation ctx). Frozen-immutable ⇒
142
- * shared by reference into tool execution ctxs. */
143
- toolFaceSnapshot: ToolFaceSnapshot;
140
+ spec: RosterSpec;
141
+ /** owned — the frozen task-start copies of the caller's tool-face control arrays; the driver compiles the leg's selector
142
+ * from them, and the selector (with the disclosure lists) is the ONLY thing later face reads consult. Frozen-immutable. */
143
+ toolFaceLists: ToolFaceLists;
144
144
  /** owned — the profile half of the single decision point (model-independent by contract). */
145
145
  promptProfile: "simple" | "classic";
146
146
  /** owned — the administrator lock snapshot; the rest of prepare reads guarded slots through it. */
@@ -1,6 +1,7 @@
1
1
  import { resolveBrainCallGuardrailMs } from "../../brain/timeout.js";
2
2
  import { assertContainmentFaceValue } from "../../tools/fs/index.js";
3
3
  import { MICRO_COMPACT_MACHINES } from "../context-edit.js";
4
+ import { assertAddOnlySeats } from "../child-clamp-seats.js";
4
5
  import { assertNoRetiredRunnerDeps } from "./retired-runner-deps.js";
5
6
  import { resolveCheckpointStore } from "../checkpoint-store.js";
6
7
  import { assertAutoConsolidationWirable } from "./memory-consolidation-driver.js";
@@ -16,6 +17,7 @@ import { deriveAskEffective, resolveAskSeat, resolveQuestionSeam } from "../wiri
16
17
  import { assertPeerPresenceValue } from "../../agents/peer-directory.js";
17
18
  import { snapshotDefinitionLists } from "../../agents/tool-filter.js";
18
19
  import { TOTAL_TOKENS_REMINDER_MODES } from "./turn-attachments.js";
20
+ import { rosterFaceOf } from "./caller-roster.js";
19
21
  const TASK_LIMIT_KEY_DICT = {
20
22
  maxTokens: true,
21
23
  maxCostUsd: true,
@@ -166,10 +168,12 @@ export function prepareConfigDoors(input) {
166
168
  }
167
169
  }
168
170
  };
171
+ assertToolNameListValue(spec.allowTools, "allowTools");
169
172
  assertToolNameListValue(spec.excludeTools, "excludeTools");
170
173
  assertToolNameListValue(spec.deferTools, "deferTools");
171
174
  assertToolNameListValue(spec.alwaysLoadTools, "alwaysLoadTools");
172
- const toolFaceSnapshot = {
175
+ const toolFaceLists = {
176
+ allow: spec.allowTools ? Object.freeze([...spec.allowTools]) : undefined,
173
177
  exclude: spec.excludeTools ? Object.freeze([...spec.excludeTools]) : undefined,
174
178
  defer: spec.deferTools ? Object.freeze([...spec.deferTools]) : undefined,
175
179
  alwaysLoad: spec.alwaysLoadTools ? Object.freeze([...spec.alwaysLoadTools]) : undefined,
@@ -196,6 +200,7 @@ export function prepareConfigDoors(input) {
196
200
  assertContainmentFaceValue(deps.readFace, "read", "deps");
197
201
  assertContainmentFaceValue(spec.writeFace, "write", "spec");
198
202
  assertContainmentFaceValue(deps.writeFace, "write", "deps");
203
+ assertAddOnlySeats(spec);
199
204
  const memoryDelegationEvidenceRaw = deps.memoryDelegationEvidence;
200
205
  if (memoryDelegationEvidenceRaw !== undefined && memoryDelegationEvidenceRaw !== "static-face" && memoryDelegationEvidenceRaw !== "attested-only") {
201
206
  const evidence = memoryDelegationEvidenceRaw;
@@ -364,11 +369,11 @@ export function prepareConfigDoors(input) {
364
369
  spec = {
365
370
  ...spec,
366
371
  agents: perTask,
367
- tools: pool.map((t) => {
372
+ tools: pool.map((t, index) => {
368
373
  if (typeof t.withAgents !== "function")
369
374
  return t;
370
375
  const rebuilt = t.withAgents(perTask);
371
- return t.modelGate !== undefined && rebuilt.modelGate === undefined ? { ...rebuilt, modelGate: t.modelGate } : rebuilt;
376
+ return rosterFaceOf(t.modelGate !== undefined && rebuilt.modelGate === undefined ? { ...rebuilt, modelGate: t.modelGate } : rebuilt, index);
372
377
  }),
373
378
  };
374
379
  }
@@ -409,7 +414,7 @@ export function prepareConfigDoors(input) {
409
414
  tools: spec.tools,
410
415
  modelId: model.id,
411
416
  depsSeat: deps.toolModelGate,
412
- restoreGated: toolFaceSnapshot.restoreGated,
417
+ restoreGated: toolFaceLists.restoreGated,
413
418
  envRaw: process.env.SEMA_TOOL_MODEL_GATE,
414
419
  });
415
420
  if (gateDecision.survivors !== undefined) {
@@ -431,7 +436,7 @@ export function prepareConfigDoors(input) {
431
436
  : roleModelIfSet("summarize", spec, deps);
432
437
  return {
433
438
  spec,
434
- toolFaceSnapshot,
439
+ toolFaceLists,
435
440
  promptProfile,
436
441
  lockedPreflight,
437
442
  resolvedInteractionPosture,
@@ -16,8 +16,8 @@ export interface PrepareDeferClassifyInput {
16
16
  * (element replacement with the wrapped object), the disclosure mount, the MCP refresh re-splice. Since
17
17
  * Every one of those writes is a builder verb (`unmountWhere` / `replaceAt`). */
18
18
  roster: RosterBuilder;
19
- /** borrowed-readonly — the frozen task-start tool face: `exclude` (the valve), `defer` (operator defers, exact wire names), `alwaysLoad` (the pins). */
20
- toolFaceSnapshot: Pick<ToolFaceSnapshot, "exclude" | "defer" | "alwaysLoad">;
19
+ /** borrowed-readonly — the frozen task-start tool face: the selector (the valve, and whether the search tool deferral needs is admitted), `defer` (operator defers, exact wire names), `alwaysLoad` (the pins). */
20
+ toolFaceSnapshot: Pick<ToolFaceSnapshot, "selector" | "defer" | "alwaysLoad">;
21
21
  /** borrowed-readonly — whether a real execution env is mounted (the full-shell invariant runs only where a shell could be on the roster). */
22
22
  handsEnabled: boolean;
23
23
  /** borrowed-readonly — the spec-time precomputation the invariant checks the post-exclusion roster against: a mismatch is an engine bug, thrown. */
@@ -21,9 +21,8 @@ export function prepareDeferClassify(input) {
21
21
  if (spec.excludeAllTools === true) {
22
22
  roster.unmountWhere(() => true);
23
23
  }
24
- else if (toolFaceSnapshot.exclude !== undefined && toolFaceSnapshot.exclude.length > 0) {
25
- const excluded = new Set(toolFaceSnapshot.exclude);
26
- roster.unmountWhere((t) => excluded.has(t.name));
24
+ else {
25
+ roster.unmountWhere((t) => !toolFaceSnapshot.selector.admits(t));
27
26
  }
28
27
  if (handsEnabled) {
29
28
  const fullShellOnRoster = tools.some((t) => t.name === "Bash" && getToolContract(t, "core").contractId === FULL_SHELL_CONTRACT_ID);
@@ -48,6 +47,7 @@ export function prepareDeferClassify(input) {
48
47
  .map((t) => t.name);
49
48
  const resolvedToolSearch = resolveToolSearch(deps.toolSearch);
50
49
  const toolSearchSeat = toolSearchSettingOf(resolvedToolSearch);
50
+ const toolSearchAdmitted = toolFaceSnapshot.selector.admits({ name: TOOL_SEARCH_NAME });
51
51
  const classifyDeferredOverFace = (face, builtinDeferNames) => {
52
52
  const mounted = new Set(face.map((t) => t.name));
53
53
  const classified = classifyDeferredWithGate({
@@ -69,6 +69,8 @@ export function prepareDeferClassify(input) {
69
69
  for (const n of [...deferredSet])
70
70
  if (!mounted.has(n))
71
71
  deferredSet.delete(n);
72
+ if (!toolSearchAdmitted)
73
+ deferredSet.clear();
72
74
  return deferredSet;
73
75
  };
74
76
  const sharedMemoryPair = sharedMemoryPairMounted ? SHARED_MEMORY_TOOL_NAMES.filter((n) => tools.some((t) => t.name === n)) : [];
@@ -88,7 +88,7 @@ export interface PrepareDelegationSurfaceInput {
88
88
  * (membership minted at the mount). */
89
89
  envHandToolNames: Set<string>;
90
90
  /** borrowed-readonly — the frozen tool-face snapshot (`exclude` feeds the ListAgents mount predicate). */
91
- toolFaceSnapshot: Pick<ToolFaceSnapshot, "exclude">;
91
+ toolFaceSnapshot: Pick<ToolFaceSnapshot, "selector">;
92
92
  /** borrowed-readonly — the large-result wrapper for first-party mounts. */
93
93
  firstPartyOffload: (tool: AgentTool) => AgentTool;
94
94
  /** borrowed-readonly — the run's offload store, or undefined when offload is disabled (then no reader mounts and the
@@ -54,7 +54,7 @@ export function prepareDelegationSurface(input) {
54
54
  ...(deps.backgroundAgentStore !== undefined ? { agentStore: deps.backgroundAgentStore } : {}),
55
55
  ...(deps.mailboxStore !== undefined ? { mailbox: deps.mailboxStore } : {}),
56
56
  ...(reviveSpawn !== undefined ? { reviveSpawn } : {}),
57
- ...(peerLaneActive ? peerLaneSendMessageSeats({ peerDirectory: deps.peerDirectory, sessionId, scope: taskScope, ...(internals?.explicitAgentName !== undefined ? { name: internals.explicitAgentName } : {}), refs: peerLaneRefs, listingMounted: listAgentsMountable({ exclude: toolFaceSnapshot.exclude, specTools: spec.tools ?? [] }) }) : {}),
57
+ ...(peerLaneActive ? peerLaneSendMessageSeats({ peerDirectory: deps.peerDirectory, sessionId, scope: taskScope, ...(internals?.explicitAgentName !== undefined ? { name: internals.explicitAgentName } : {}), refs: peerLaneRefs, listingMounted: listAgentsMountable({ selector: toolFaceSnapshot.selector, specTools: spec.tools ?? [] }) }) : {}),
58
58
  onNotifyError: (f) => emitTrace(deps.tracer, () => ({ kind: "observer.notify_failed", version: 1, taskId: hostTaskId, site: f.site, message: f.error.message, ts: Date.now() })),
59
59
  onTranscriptIntegrityGap: (handle, scope) => deliverEngineNotice(deps.onNotice, {
60
60
  code: "delegation.transcript_integrity",
@@ -80,11 +80,11 @@ export function prepareDelegationSurface(input) {
80
80
  }
81
81
  }
82
82
  }
83
- if (sessionBox !== undefined && internals?.onTaskNotification !== undefined && !(toolFaceSnapshot.exclude ?? []).includes(READ_INBOX_TOOL_NAME) && !(spec.tools ?? []).some((t) => t.name === READ_INBOX_TOOL_NAME)) {
83
+ if (sessionBox !== undefined && internals?.onTaskNotification !== undefined && toolFaceSnapshot.selector.admits({ name: READ_INBOX_TOOL_NAME }) && !(spec.tools ?? []).some((t) => t.name === READ_INBOX_TOOL_NAME)) {
84
84
  toolEffects.set(READ_INBOX_TOOL_NAME, "read");
85
85
  roster.mount(firstPartyOffload(createReadInboxTool({ pull: () => peerLaneRefs.pull })), { source: "builtin", mountedBy: "peerLane" });
86
86
  }
87
- const listAgents = (peerLaneActive || delegationSurfaceActive) && peerSendMessageBuiltIn && listAgentsMountable({ exclude: toolFaceSnapshot.exclude, specTools: spec.tools ?? [] }) ? mountListAgents({ ...(peerLaneActive ? { peerDirectory: deps.peerDirectory } : {}), freshWindowMs: resolvePeerLaneConfig(deps.peerLane, deps.onNotice).listingFreshWindowMs, sessionId, scope: taskScope, hostTaskId, ...(internals?.parentTaskId !== undefined ? { parentTaskId: internals.parentTaskId } : {}), ...(internals?.parentSessionId !== undefined ? { parentSessionId: internals.parentSessionId } : {}), registry: defaultTaskRegistry, ...(deps.rosterStore !== undefined ? { roster: deps.rosterStore } : {}), ...(sendMessageTier !== undefined ? { continuationTier: sendMessageTier } : {}), ...(checkpointSeat !== undefined ? { readSeats: { checkpointSeat } } : {}), specTools: spec.tools ?? [], toolEffects }) : undefined;
87
+ const listAgents = (peerLaneActive || delegationSurfaceActive) && peerSendMessageBuiltIn && listAgentsMountable({ selector: toolFaceSnapshot.selector, specTools: spec.tools ?? [] }) ? mountListAgents({ ...(peerLaneActive ? { peerDirectory: deps.peerDirectory } : {}), freshWindowMs: resolvePeerLaneConfig(deps.peerLane, deps.onNotice).listingFreshWindowMs, sessionId, scope: taskScope, hostTaskId, ...(internals?.parentTaskId !== undefined ? { parentTaskId: internals.parentTaskId } : {}), ...(internals?.parentSessionId !== undefined ? { parentSessionId: internals.parentSessionId } : {}), registry: defaultTaskRegistry, ...(deps.rosterStore !== undefined ? { roster: deps.rosterStore } : {}), ...(sendMessageTier !== undefined ? { continuationTier: sendMessageTier } : {}), ...(checkpointSeat !== undefined ? { readSeats: { checkpointSeat } } : {}), specTools: spec.tools ?? [], toolEffects }) : undefined;
88
88
  if (listAgents !== undefined)
89
89
  roster.mount(firstPartyOffload(listAgents), { source: "builtin", mountedBy: "peerLane" });
90
90
  if (backgroundTaskToolsActive) {
@@ -2,7 +2,7 @@
2
2
  * PrepareTask's two GATE STATIONS, verbatim from the driver: the `tool_call` station (the final-roster
3
3
  * effect sync, the write-protection judge compiled once per task, the arming predicate, the compliance and plan-mode
4
4
  * short-circuits, the `runToolGate` call with every seat it is handed, the lifecycle sweep, the deferred sandbox-admission
5
- * disclosure, the PreToolUse context stash, the settlement sideband write and the bare-human-rejection boundary) and the
5
+ * disclosure, the PreToolUse context stash, the gate record's write on the call's occurrence and the bare-human-rejection boundary) and the
6
6
  * `tool_result` station's registration (its body, the PostToolUse / PostToolUseFailure seats and the PreToolUse context
7
7
  * drain, lives in call-hook-stations.ts). The two module-scope
8
8
  * helpers only these stations called moved with them (the settlement screen, the rejection-boundary judgment). The
@@ -131,9 +131,9 @@ export interface PrepareGateStationsInput {
131
131
  /** borrowed-mutable — PreToolUse `additionalContext` per call id. Writers here: the `tool_call` station's stash (`set`, only
132
132
  * for calls that will execute) and the `tool_result` station's one-shot drain (`delete`). */
133
133
  preToolContexts: Map<string, string[]>;
134
- /** borrowed-mutable — the gate-outcome sideband (`Prepared.gateOutcomes`). Writer here: the single screened write per
135
- * gated call (the two short-circuits and the gate's terminal exits); the frame mint reads and deletes. */
136
- gateOutcomes: Prepared["gateOutcomes"];
134
+ /** borrowed-mutable — the leg's occurrence table (`Prepared.toolOccurrences`). Writers here: the one screened gate record per
135
+ * gated call, and the wait-on-the-person count around the gate's two asking seats. */
136
+ toolOccurrences: Prepared["toolOccurrences"];
137
137
  /** borrowed-mutable — the turn halt fact (`Prepared.batchHaltRef`). Writer here: the bare-rejection boundary (`current`). */
138
138
  batchHaltRef: Prepared["batchHaltRef"];
139
139
  /** borrowed-readonly — whether blocked/suspended ids are tracked at all (the post-tool callbacks exist). */
@@ -3,7 +3,7 @@ import { mountedToolRequiresUserInteraction } from "../mode-policy.js";
3
3
  import { complianceCallDenial } from "../compliance.js";
4
4
  import { cloneObserverInput, formatHookFeedback, runToolGate } from "../hooks.js";
5
5
  import { screenGateOutcome } from "../gate-outcome.js";
6
- import { directDeny } from "./gate-exit.js";
6
+ import { directDeny, frozenInputSnapshot } from "./gate-exit.js";
7
7
  import { emitTrace } from "../trace.js";
8
8
  import { deliverEngineNotice } from "../engine-notice.js";
9
9
  import { askUnresolvableNotice } from "../ask-unresolvable-notice.js";
@@ -46,7 +46,7 @@ export function maybeHumanRejectionHalt(input) {
46
46
  };
47
47
  }
48
48
  export function prepareGateStations(input) {
49
- const { askLane, parkAsk, tools, toolRosterDeltas, toolEffects, deps, toolCallGateArmedRef, effectivePolicy, hooks, egressTools, irreversibleTools, spec, complianceDenies, harness, blockedToolCalls, inheritedAskGrants, inheritedUnavailableAsks, foldAskClasses, ancestorSandboxAdmissions, preToolContexts, gateOutcomes, batchHaltRef, blockedTracked, hookIdentity, reminderMark, hostTaskId, sessionId, ownGatePreToolUse, hookTimeoutMs, handsCwdRef, stampCallTarget, hookEnvFace, writeProtectionCheck, shellReadCheck, readFace, irreversibilityTier, reversibilityProbes, abortController, shellGatedTools, autoModeDecider, autoModeDenialTracking, askRoute, permissionMode, toolMarkSources, a2aIsolatePeers, ancestorArbitrations, runId, stopForDenialLimit, permissionRuleLane, permissionRuleOrgLane, questionToolMounted, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, delegation, notifyOwnHookCrash, frameSettlement, seatInputsFor } = input;
49
+ const { askLane, parkAsk, tools, toolRosterDeltas, toolEffects, deps, toolCallGateArmedRef, effectivePolicy, hooks, egressTools, irreversibleTools, spec, complianceDenies, harness, blockedToolCalls, inheritedAskGrants, inheritedUnavailableAsks, foldAskClasses, ancestorSandboxAdmissions, preToolContexts, toolOccurrences, batchHaltRef, blockedTracked, hookIdentity, reminderMark, hostTaskId, sessionId, ownGatePreToolUse, hookTimeoutMs, handsCwdRef, stampCallTarget, hookEnvFace, writeProtectionCheck, shellReadCheck, readFace, irreversibilityTier, reversibilityProbes, abortController, shellGatedTools, autoModeDecider, autoModeDenialTracking, askRoute, permissionMode, toolMarkSources, a2aIsolatePeers, ancestorArbitrations, runId, stopForDenialLimit, permissionRuleLane, permissionRuleOrgLane, questionToolMounted, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, delegation, notifyOwnHookCrash, frameSettlement, seatInputsFor } = input;
50
50
  const gatePreToolUse = ownGatePreToolUse !== undefined ? (name, args, ctx) => ownGatePreToolUse(name, args, { ...ctx, permissionMode: permissionMode.observed }) : undefined;
51
51
  const releasesAnnounced = new Map();
52
52
  const onModeReleased = (info) => {
@@ -92,6 +92,7 @@ export function prepareGateStations(input) {
92
92
  harness.on("tool_call", async (called) => {
93
93
  const e = { ...called, toolName: rosterToolName(toolRosterDeltas.current, called.toolName) };
94
94
  const call = { toolName: e.toolName, ...callFaceSeat(toolCallFaceOf(toolRosterDeltas.current, called.toolName)) };
95
+ toolOccurrences.ensure({ toolCallId: e.toolCallId, spelledName: called.toolName, wireName: e.toolName, args: called.input });
95
96
  const tierSeat = seatOf("gate.shellSeat", irreversibilityTier, call);
96
97
  const markSources = new Set(heldValues("gate.markSources", toolMarkSources, call).flatMap((s) => [...s]));
97
98
  blockedToolCalls.delete(e.toolCallId);
@@ -102,9 +103,10 @@ export function prepareGateStations(input) {
102
103
  if (blockedTracked)
103
104
  blockedToolCalls.add(e.toolCallId);
104
105
  const gate = directDeny("compliance");
105
- gateOutcomes.set(e.toolCallId, gate);
106
+ const finalInput = frozenInputSnapshot(e.input);
107
+ toolOccurrences.gateRound(e.toolCallId, gate, finalInput);
106
108
  if (notifyPermissionDenied) {
107
- await notifyPermissionDenied({ toolName: e.toolName, input: cloneObserverInput(e.input), toolCallId: e.toolCallId, reason: complianceDeny, gate, identity: hookIdentity, permissionMode: permissionMode.observed });
109
+ await notifyPermissionDenied({ toolName: e.toolName, input: cloneObserverInput(finalInput), toolCallId: e.toolCallId, reason: complianceDeny, gate, identity: hookIdentity, permissionMode: permissionMode.observed });
108
110
  }
109
111
  return { block: true, reason: formatHookFeedback(complianceDeny, reminderMark), preToolContext: [] };
110
112
  }
@@ -124,9 +126,9 @@ export function prepareGateStations(input) {
124
126
  ...(hookEnvFace !== undefined ? { hookEnv: hookEnvFace } : {}),
125
127
  toolFaceOf: (name) => toolCallFaceOf(toolRosterDeltas.current, name === e.toolName ? called.toolName : name),
126
128
  adjudicate,
127
- resolveAsk: resolveAskBound,
129
+ resolveAsk: (...args) => toolOccurrences.whileAwaitingUser(args[1].toolCallId, () => resolveAskBound(...args)),
128
130
  suspendAsk,
129
- resolveContentAsk,
131
+ resolveContentAsk: (...args) => toolOccurrences.whileAwaitingUser(args[0].toolCallId, () => resolveContentAsk(...args)),
130
132
  egress: heldBy("gate.egress", egressTools, call),
131
133
  peerMessage: heldBy("gate.peerMessage", PEER_MESSAGE_NAMES, call),
132
134
  ...(writeProtectionCheck !== undefined ? { writeProtectionCheck } : {}),
@@ -224,7 +226,7 @@ export function prepareGateStations(input) {
224
226
  for (const defect of screened.defects)
225
227
  deps.onError?.(new Error(defect), { phase: "config", sessionId });
226
228
  if (screened.gate !== undefined)
227
- gateOutcomes.set(e.toolCallId, screened.gate);
229
+ toolOccurrences.gateRound(e.toolCallId, screened.gate, result.finalInput);
228
230
  if (result.block) {
229
231
  const haltRemaining = maybeHumanRejectionHalt({
230
232
  gate: screened.gate,
@@ -11,6 +11,7 @@ import type { AdvertisedWritableDirs } from "./advertised-writable-dirs.js";
11
11
  import { type ArtifactStoreRef, type GrantReadRoot } from "./read-root-grant.js";
12
12
  import type { StoredSession } from "../session.js";
13
13
  import type { IrreversibilityTier, PrepareResume, ReversibilityProbes, RunInternals, ToolFaceSnapshot, ToolProgressLane, WriteFaceSeat } from "./contracts.js";
14
+ import type { ToolOccurrenceTable } from "./tool-occurrence.js";
14
15
  import { RosterBuilder } from "../tool-roster.js";
15
16
  import type { PermissionMode } from "../ask-origin.js";
16
17
  /** Test seam (mirrors `__resetMalformedNoticeSeatAnnouncement`): never called by production code.
@@ -61,13 +62,10 @@ export interface PrepareHandsReadFaceInput {
61
62
  denyRuleRows: readonly PathRuleDenyRow[];
62
63
  /** borrowed-readonly — the leg's one resolution of where rule heads lead (the rows' twins, the same the gate's lanes read). */
63
64
  headLeads: HeadLeads;
64
- /** borrowed-readonly — the two judges a shell command's write targets meet for the mode's file-command placement: the
65
- * leg's write-protection judge (read per judgment — it is compiled at the manifest phase, before any gate is mounted)
66
- * and the chain's write-target guard (`toolPolicyWriteTargetGuard`). Absent ⇒ neither (a standalone phase drive). */
67
- writeGuards?: {
68
- readonly protection: () => ShellReadBoundary["writeProtectionJudge"];
69
- readonly target: ShellReadBoundary["writeTargetGuard"];
70
- };
65
+ /** borrowed-readonly — the ONE judgment a shell command's write targets meet for the mode's file-command placement: the
66
+ * leg's write judgment over the write-protection table and the chain's guarded write rows (read per judgment — it is
67
+ * compiled at the manifest phase, before any gate is mounted). Absent ⇒ none (a standalone phase drive). */
68
+ writeTargetJudge?: () => ShellReadBoundary["writeTargetJudge"];
71
69
  /** borrowed-readonly — the directories of the person's persisted `Read(//dir/**)` allow rows: read directories of this
72
70
  * run, canonicalized and admitted exactly as `additionalReadDirectories` entries are. */
73
71
  persistedReadDirectories?: readonly string[];
@@ -112,6 +110,8 @@ export interface PrepareHandsReadFaceInput {
112
110
  toolProgressRef: {
113
111
  current?: ToolProgressLane;
114
112
  };
113
+ /** borrowed-mutable — the leg's occurrence table; writer here: the shell read station's refused-admission callback. */
114
+ toolOccurrences: ToolOccurrenceTable;
115
115
  /** borrowed-readonly — ABSOLUTE paths this prepare's restore wrote, deleted,
116
116
  * or failed to write. Every read-state seed above describes the PRE-restore tree, so these keys are
117
117
  * dropped from the map: the engine replaced those bytes itself, and a surviving entry makes the
@@ -16,6 +16,7 @@ import { readRootGrantOver, rootAdmittingArtifactStore } from "./read-root-grant
16
16
  import { sessionSeatAnchorHolds } from "./session-read-file-states.js";
17
17
  import { rebaseWorkspacePath } from "./workspace-path.js";
18
18
  import { RosterBuilder } from "../tool-roster.js";
19
+ import { unionAddOnly } from "../child-clamp-seats.js";
19
20
  import { modePolicyOf } from "../mode-policy.js";
20
21
  const faceClampAnnouncedSinks = { read: new WeakSet(), write: new WeakSet() };
21
22
  const faceClampConsoleAnnounced = { read: false, write: false };
@@ -67,7 +68,6 @@ function writeFaceReader(input, onDeploymentClamp) {
67
68
  export function resolveHandsLessReadFace(input) {
68
69
  const { resume, fullShellReachable, spec, deps } = input;
69
70
  assertStringArraySeat(deps.readDenyPatterns, "RunnerDeps.readDenyPatterns", "compiler-owned");
70
- assertStringArraySeat(spec.readDenyPatterns, "TaskSpec.readDenyPatterns", "compiler-owned");
71
71
  let handsLessResolvedFace;
72
72
  let handsLessResolvedWriteFace;
73
73
  let readDenyAdditionsNormalized = [];
@@ -84,7 +84,7 @@ export function resolveHandsLessReadFace(input) {
84
84
  const seed = resume?.seed.readFace;
85
85
  handsLessResolvedFace = resume !== undefined && (seed === undefined || seed.face === "roots") ? "roots" : liveFace;
86
86
  handsLessResolvedWriteFace = writeFaceReader(input);
87
- const denyAdditions = [...(deps.readDenyPatterns ?? []), ...(spec.readDenyPatterns ?? []), ...(seed?.denyEntries ?? [])];
87
+ const denyAdditions = unionAddOnly("readDenyPatterns", deps.readDenyPatterns, spec.readDenyPatterns, seed?.denyEntries);
88
88
  readDenyBuiltinTiersActive = activeReadDenyBuiltinTiers(readDenyBuiltinConfigOf({ tiers: deps.readDenyBuiltinTiers, exclude: deps.readDenyBuiltinExclude }));
89
89
  if (denyAdditions.length > 0) {
90
90
  readDenyAdditionsNormalized = compileReadDeny(denyAdditions, "readDenyPatterns", { tiers: [] }).entries;
@@ -124,7 +124,6 @@ export async function prepareHandsMount(input) {
124
124
  assertStringArraySeat(spec.additionalDirectories, "TaskSpec.additionalDirectories", "strings");
125
125
  assertStringArraySeat(spec.additionalReadDirectories, "TaskSpec.additionalReadDirectories", "strings");
126
126
  assertStringArraySeat(deps.readDenyPatterns, "RunnerDeps.readDenyPatterns", "compiler-owned");
127
- assertStringArraySeat(spec.readDenyPatterns, "TaskSpec.readDenyPatterns", "compiler-owned");
128
127
  let readFileStateForCheckpoint;
129
128
  let sealReadStateSeat;
130
129
  let seedContextFiles;
@@ -219,7 +218,7 @@ export async function prepareHandsMount(input) {
219
218
  };
220
219
  }
221
220
  const seedReadFaceSection = resume?.seed.readFace;
222
- const readDenyAdditions = [...(deps.readDenyPatterns ?? []), ...(spec.readDenyPatterns ?? []), ...(seedReadFaceSection?.denyEntries ?? [])];
221
+ const readDenyAdditions = unionAddOnly("readDenyPatterns", deps.readDenyPatterns, spec.readDenyPatterns, seedReadFaceSection?.denyEntries);
223
222
  const readDenyBuiltinCfg = readDenyBuiltinConfigOf({ tiers: deps.readDenyBuiltinTiers, exclude: deps.readDenyBuiltinExclude });
224
223
  const denyRuleRows = rowsWhereTheyLead(input.denyRuleRows, await input.headLeads.resolve(input.denyRuleRows));
225
224
  const readDenyPlacement = await placeReadDenyAtHome(executionEnv, (homes, linked) => compileReadDeny(readDenyAdditions, "readDenyPatterns", readDenyBuiltinCfg, denyRuleRows, homes, linked), undefined, undefined, deps.agentConfigDir);
@@ -301,8 +300,8 @@ export async function prepareHandsMount(input) {
301
300
  ...denySeat,
302
301
  ...writeDenySeat,
303
302
  writeRoots: [rootCanonical, ...additionalRootsCanonical],
304
- ...((judge) => (judge !== undefined ? { writeProtectionJudge: judge } : {}))(input.writeGuards?.protection()),
305
- ...(input.writeGuards?.target !== undefined ? { writeTargetGuard: input.writeGuards.target } : {}),
303
+ ...(resolvedWriteFace !== undefined ? { writeFace: resolvedWriteFace.inForce() } : {}),
304
+ ...((judge) => (judge !== undefined ? { writeTargetJudge: judge } : {}))(input.writeTargetJudge?.()),
306
305
  ...(resolvedReadFace !== undefined ? { face: resolvedReadFace } : {}),
307
306
  });
308
307
  if (handsIncludeShell) {
@@ -315,6 +314,7 @@ export async function prepareHandsMount(input) {
315
314
  seatOf: () => (handsReadOnly ? "readonly" : "full_shell"),
316
315
  boundaryOf: () => readonlyBoundary() ?? shellReadBoundary(), rootsCanonical: true,
317
316
  homeViews: readDenyPlacement.matcher.homeViews,
317
+ onAdmissionRefused: (toolCallId) => void input.toolOccurrences.refuse(toolCallId, "read_boundary"),
318
318
  });
319
319
  }
320
320
  if (!handsReadOnly) {
@@ -377,7 +377,7 @@ export async function prepareHandsMount(input) {
377
377
  return memoryWriteGate?.(w);
378
378
  },
379
379
  mountBackgroundTaskTools: false,
380
- monitorToolActive: backgroundTaskToolsActive && !(toolFaceSnapshot.exclude?.includes("Monitor") ?? false),
380
+ monitorToolActive: backgroundTaskToolsActive && toolFaceSnapshot.selector.admits({ name: "Monitor" }),
381
381
  });
382
382
  {
383
383
  const bandNames = new Set(band.flatMap((t) => [t.name, ...(t.aliases ?? [])]));
@@ -37,6 +37,7 @@ import type { AutoModeArmingRecipe } from "../auto-mode-arming.js";
37
37
  import type { AutoModeDecider, AutoModeDenialTracker } from "../auto-mode.js";
38
38
  import { type OnQuestion } from "../ask-question.js";
39
39
  import { type ParentSpecSeat } from "../parent-spec-seat.js";
40
+ import { type ChildClampSource } from "../child-clamp-seats.js";
40
41
  import { type HookEnvCapabilities, type Hooks } from "../hooks.js";
41
42
  import type { LockedPreflight } from "../locked-config.js";
42
43
  import type { OwnOrgAdmissionVerdict } from "../memory-admission.js";
@@ -58,6 +59,8 @@ export interface PrepareInheritedGateInput {
58
59
  spec: Pick<TaskSpec, "shellGate" | "durableApproval" | "onQuestion" | "handsReadOnly" | "interactiveTools" | "oneShot" | "clientContext" | "principal" | "additionalDirectories" | "additionalReadDirectories" | "envFacts" | "memoryPersistenceCapable" | "getApiKeyAndHeaders" | "backgroundScope" | "enablePlanMode" | "excludeAllTools">;
59
60
  /** borrowed-readonly — the seat this run hands its children (`checkpointSeatOf`, minted once by the driver after the config doors): the ctx's `checkpointStoreForChildren`, absent when the run has no seat. */
60
61
  checkpointSeat: import("../checkpoint-seat.js").CheckpointSeat | undefined;
62
+ /** borrowed-readonly — this leg's checkpoint scope (the driver's one `checkpointScopeOf` derivation): the ctx's `checkpointScopeForChildren`, which every delegation lane copies into its children's internals. */
63
+ checkpointScope: string;
61
64
  /** borrowed-readonly — the deployment seats: `autoMode.denialLimit` (the rebuilt trackers' bounds), `memoryScopeAdmission` /
62
65
  * `deploymentMemoryScopes` / `compliancePostureResolver` (the governed-provenance bit), `onError` (the screening-face crash
63
66
  * lane), `onNotice` (the stop seat's notice), `executionEnv` (the hook-env identity predicate), `delegationEntryCaps` (resolved
@@ -101,6 +104,8 @@ export interface PrepareInheritedGateInput {
101
104
  toolFaceSnapshot: ToolFaceSnapshot;
102
105
  /** borrowed-readonly — the ctx's `mountsCallerTool` seat: identity membership in the caller's `spec.tools`, pre-gate. */
103
106
  mountsCallerTool: (tool: ToolSpec) => boolean;
107
+ /** borrowed-readonly — the ctx's `mountedMcp` seat: the MCP surface the run mounts right now (call-time; the roster is minted after this phase). Present iff the run declared a server. */
108
+ mountedMcp?: () => import("../mounted-mcp.js").MountedMcp;
104
109
  /** borrowed-readonly — the resolved prompt profile (ctx seat). */
105
110
  promptProfile: ToolExecuteContext["promptProfile"];
106
111
  /** borrowed-readonly — the resolved interaction posture (ctx seat; absent ⇒ no key). */
@@ -267,8 +272,6 @@ export interface PrepareInheritedGateResult {
267
272
  ownOrgVerdictRef: {
268
273
  current: OwnOrgAdmissionVerdict | undefined;
269
274
  };
270
- /** owned — the org-admission checkpoint stamp predicate (inherited set ∨ own verdict ∨ governed). */
271
- orgAdmissionCheckpointState: () => boolean;
272
275
  /** owned — the read-face checkpoint section builder (hands-less resume carries the seed; every other leg mints from the live
273
276
  * resolution; undefined for the default posture). */
274
277
  faceCheckpointSection: () => {
@@ -278,8 +281,6 @@ export interface PrepareInheritedGateResult {
278
281
  caseSensitive: boolean;
279
282
  }>;
280
283
  } | undefined;
281
- /** owned — the face stamp predicate (`faceCheckpointSection() !== undefined`). */
282
- faceCheckpointState: () => boolean;
283
284
  /** owned — the WRITE-face checkpoint section builder: written ONLY for a non-default (open) write
284
285
  * posture, so an absent section IS "roots" on every reader, including an engine that predates the
285
286
  * seat. No version stamp rides it — dropping the section can only ever make a resume STRICTER
@@ -290,8 +291,6 @@ export interface PrepareInheritedGateResult {
290
291
  /** owned — the SKILL-GRANT checkpoint section builder: the rows this run's table grew (the model's activations, a
291
292
  * delegated child's capture), read off the live table at mint time; absent when there are none. */
292
293
  skillGrantCheckpointSection: () => import("../skill-grant.js").SkillGrantRecord[] | undefined;
293
- /** owned — the F-012 stamp predicate (opaque constraints present ∨ seed frozen chain ∨ provenance-armed). */
294
- f012CheckpointState: () => boolean;
295
294
  /** owned — the FROZEN approver seat (spec over deps) every station of this leg and its children's chain resolve at. */
296
295
  frozenOnAsk: OnAsk | undefined;
297
296
  /** owned — the env the screening face sees through `ctx.env` (identity half of a chain entry's `hookEnv`); the policy-chain
@@ -322,6 +321,8 @@ export interface PrepareInheritedGateResult {
322
321
  carrierReadFace: () => ContainmentFace | undefined;
323
322
  /** owned — the same expression on the WRITE seat. */
324
323
  carrierWriteFace: () => ContainmentFace | undefined;
324
+ /** owned — the run's clamp source (every clamp-carrier row of the clamp table, resolved seats resolved), read at call time by both delegation mounts. */
325
+ runClampSource: () => ChildClampSource;
325
326
  /** owned — the full shell's structural reachability from spec-time facts. */
326
327
  fullShellReachable: boolean;
327
328
  /** borrowed-mutable — the gate's typed stop seat (`Prepared.gateStopRef`). Writers: `stopForDenialLimit` only. */