@sema-agent/core 7.48.0 → 7.49.1

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 (421) hide show
  1. package/CHANGELOG.md +457 -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 +38 -31
  51. package/dist/core/arg-summary.d.ts +21 -28
  52. package/dist/core/arg-summary.js +235 -88
  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 +94 -65
  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 +43 -11
  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 +21 -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.d.ts +4 -0
  101. package/dist/core/mcp.js +70 -43
  102. package/dist/core/memory-engine/content-origin.js +2 -14
  103. package/dist/core/memory-engine/engine.d.ts +32 -22
  104. package/dist/core/memory-engine/engine.js +103 -55
  105. package/dist/core/memory-engine/file-backend.d.ts +13 -30
  106. package/dist/core/memory-engine/file-backend.js +37 -252
  107. package/dist/core/memory-engine/index.d.ts +1 -1
  108. package/dist/core/memory-engine/index.js +1 -1
  109. package/dist/core/memory-engine/layout.d.ts +139 -9
  110. package/dist/core/memory-engine/layout.js +350 -7
  111. package/dist/core/memory-engine/scope-contract.d.ts +10 -0
  112. package/dist/core/memory-engine/scope-contract.js +8 -0
  113. package/dist/core/memory-engine/session-incarnation.d.ts +14 -4
  114. package/dist/core/memory-engine/session-incarnation.js +5 -2
  115. package/dist/core/memory-engine/types.d.ts +10 -1
  116. package/dist/core/memory.js +5 -17
  117. package/dist/core/model-seat.d.ts +4 -4
  118. package/dist/core/model-seat.js +1 -1
  119. package/dist/core/mounted-mcp.d.ts +57 -0
  120. package/dist/core/mounted-mcp.js +19 -0
  121. package/dist/core/namespaced-rule-name.d.ts +29 -0
  122. package/dist/core/namespaced-rule-name.js +52 -0
  123. package/dist/core/park-selfcheck.d.ts +1 -1
  124. package/dist/core/park-selfcheck.js +16 -6
  125. package/dist/core/path-guard-rows.d.ts +99 -0
  126. package/dist/core/path-guard-rows.js +45 -0
  127. package/dist/core/path-identity.d.ts +22 -16
  128. package/dist/core/path-identity.js +10 -10
  129. package/dist/core/path-rule-binding.d.ts +2 -1
  130. package/dist/core/path-rule-binding.js +3 -1
  131. package/dist/core/pause-registry.d.ts +16 -2
  132. package/dist/core/pause-registry.js +6 -0
  133. package/dist/core/permission-rule-consent.js +0 -7
  134. package/dist/core/permission-rule-model.d.ts +68 -24
  135. package/dist/core/permission-rule-model.js +105 -24
  136. package/dist/core/permission-rule-store.js +2 -2
  137. package/dist/core/permission-rules.d.ts +3 -30
  138. package/dist/core/permission-rules.js +4 -54
  139. package/dist/core/read-root-candidate.d.ts +1 -3
  140. package/dist/core/read-root-candidate.js +4 -15
  141. package/dist/core/real-approval.d.ts +4 -3
  142. package/dist/core/retired-keys.d.ts +13 -0
  143. package/dist/core/retired-keys.js +14 -0
  144. package/dist/core/roles.d.ts +2 -3
  145. package/dist/core/roles.js +15 -6
  146. package/dist/core/runner/assemble-result.d.ts +0 -7
  147. package/dist/core/runner/assemble-result.js +19 -31
  148. package/dist/core/runner/caller-roster.d.ts +78 -0
  149. package/dist/core/runner/caller-roster.js +219 -0
  150. package/dist/core/runner/checkpoint-scope.d.ts +16 -16
  151. package/dist/core/runner/checkpoint-scope.js +2 -2
  152. package/dist/core/runner/child-tree.js +2 -2
  153. package/dist/core/runner/contracts.d.ts +68 -35
  154. package/dist/core/runner/decide-continuation.d.ts +51 -3
  155. package/dist/core/runner/decide-continuation.js +76 -21
  156. package/dist/core/runner/denial-limit-arms.d.ts +17 -5
  157. package/dist/core/runner/denial-limit-arms.js +11 -9
  158. package/dist/core/runner/extra-body-dropped-seat.d.ts +8 -0
  159. package/dist/core/runner/extra-body-dropped-seat.js +22 -0
  160. package/dist/core/runner/finish-reason-seat.d.ts +9 -0
  161. package/dist/core/runner/finish-reason-seat.js +40 -0
  162. package/dist/core/runner/gate-exit.d.ts +44 -32
  163. package/dist/core/runner/gate-exit.js +112 -25
  164. package/dist/core/runner/inherited-ask-grants.js +6 -4
  165. package/dist/core/runner/mcp-redial.d.ts +3 -3
  166. package/dist/core/runner/mcp-redial.js +3 -4
  167. package/dist/core/runner/permission-rule-lanes.d.ts +1 -2
  168. package/dist/core/runner/permission-rule-lanes.js +5 -4
  169. package/dist/core/runner/prepare-artifact.d.ts +4 -0
  170. package/dist/core/runner/prepare-artifact.js +2 -1
  171. package/dist/core/runner/prepare-ask-lane.d.ts +2 -0
  172. package/dist/core/runner/prepare-ask-lane.js +12 -6
  173. package/dist/core/runner/prepare-boundary-parks.d.ts +5 -8
  174. package/dist/core/runner/prepare-boundary-parks.js +4 -7
  175. package/dist/core/runner/prepare-caps-and-workflow.d.ts +11 -15
  176. package/dist/core/runner/prepare-caps-and-workflow.js +19 -27
  177. package/dist/core/runner/prepare-config-doors.d.ts +9 -9
  178. package/dist/core/runner/prepare-config-doors.js +10 -5
  179. package/dist/core/runner/prepare-defer-classify.d.ts +2 -2
  180. package/dist/core/runner/prepare-defer-classify.js +5 -3
  181. package/dist/core/runner/prepare-delegation-surface.d.ts +1 -1
  182. package/dist/core/runner/prepare-delegation-surface.js +3 -3
  183. package/dist/core/runner/prepare-gate-stations.d.ts +4 -4
  184. package/dist/core/runner/prepare-gate-stations.js +9 -7
  185. package/dist/core/runner/prepare-hands-readface.d.ts +7 -7
  186. package/dist/core/runner/prepare-hands-readface.js +7 -7
  187. package/dist/core/runner/prepare-inherited-gate.d.ts +7 -6
  188. package/dist/core/runner/prepare-inherited-gate.js +14 -15
  189. package/dist/core/runner/prepare-listings.d.ts +7 -24
  190. package/dist/core/runner/prepare-listings.js +4 -5
  191. package/dist/core/runner/prepare-memory-engine-session.d.ts +2 -0
  192. package/dist/core/runner/prepare-memory-engine-session.js +4 -3
  193. package/dist/core/runner/prepare-memory.d.ts +6 -0
  194. package/dist/core/runner/prepare-memory.js +13 -13
  195. package/dist/core/runner/prepare-offload-wrappers.d.ts +5 -0
  196. package/dist/core/runner/prepare-offload-wrappers.js +3 -3
  197. package/dist/core/runner/prepare-park-ask.d.ts +7 -8
  198. package/dist/core/runner/prepare-park-ask.js +17 -10
  199. package/dist/core/runner/prepare-policy-chain.js +24 -44
  200. package/dist/core/runner/prepare-project-context.d.ts +1 -1
  201. package/dist/core/runner/prepare-project-context.js +3 -4
  202. package/dist/core/runner/prepare-protocol-tools.d.ts +9 -3
  203. package/dist/core/runner/prepare-protocol-tools.js +3 -4
  204. package/dist/core/runner/prepare-run-refs.d.ts +3 -0
  205. package/dist/core/runner/prepare-run-refs.js +2 -1
  206. package/dist/core/runner/prepare-safety-scan.d.ts +4 -8
  207. package/dist/core/runner/prepare-safety-scan.js +1 -2
  208. package/dist/core/runner/prepare-suspend-saga.d.ts +7 -1
  209. package/dist/core/runner/prepare-suspend-saga.js +28 -12
  210. package/dist/core/runner/prepare-task.d.ts +1 -1
  211. package/dist/core/runner/prepare-task.js +67 -56
  212. package/dist/core/runner/prepare-wiring-manifest.d.ts +11 -10
  213. package/dist/core/runner/prepare-wiring-manifest.js +5 -8
  214. package/dist/core/runner/resume-apply.js +7 -14
  215. package/dist/core/runner/resume-checkpoint-screen.js +11 -4
  216. package/dist/core/runner/resume-internals-and-config.js +2 -2
  217. package/dist/core/runner/resume-policy-outcome.js +5 -32
  218. package/dist/core/runner/resume-review-outcome.js +4 -1
  219. package/dist/core/runner/retired-runner-deps.d.ts +6 -0
  220. package/dist/core/runner/retired-runner-deps.js +10 -1
  221. package/dist/core/runner/run-brain-sinks.d.ts +4 -0
  222. package/dist/core/runner/run-brain-sinks.js +5 -2
  223. package/dist/core/runner/run-harness-handlers.js +29 -36
  224. package/dist/core/runner/run-leg.d.ts +0 -2
  225. package/dist/core/runner/run-leg.js +32 -33
  226. package/dist/core/runner/run-terminal-adoption.js +4 -3
  227. package/dist/core/runner/runtask.js +8 -8
  228. package/dist/core/runner/session-rule-policy.js +5 -5
  229. package/dist/core/runner/stream-settle-backstop.js +7 -4
  230. package/dist/core/runner/sub-agent-deny-lists.d.ts +51 -12
  231. package/dist/core/runner/sub-agent-deny-lists.js +111 -80
  232. package/dist/core/runner/terminal-account.d.ts +48 -0
  233. package/dist/core/runner/terminal-account.js +186 -0
  234. package/dist/core/runner/tool-end-body.d.ts +54 -17
  235. package/dist/core/runner/tool-end-body.js +27 -2
  236. package/dist/core/runner/tool-face-overlay.d.ts +3 -1
  237. package/dist/core/runner/tool-face-overlay.js +6 -4
  238. package/dist/core/runner/tool-occurrence.d.ts +106 -0
  239. package/dist/core/runner/tool-occurrence.js +123 -0
  240. package/dist/core/runner/tool-progress-lane.d.ts +16 -8
  241. package/dist/core/runner/tool-progress-lane.js +25 -34
  242. package/dist/core/runner/tool-turn-repair-seat.d.ts +28 -4
  243. package/dist/core/runner/tool-turn-repair-seat.js +36 -13
  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/secret-env.d.ts +16 -5
  249. package/dist/core/secret-env.js +23 -63
  250. package/dist/core/sensitive-path-policy.d.ts +19 -18
  251. package/dist/core/sensitive-path-policy.js +73 -49
  252. package/dist/core/session-reconcile.d.ts +3 -0
  253. package/dist/core/session-reconcile.js +5 -4
  254. package/dist/core/session-store.d.ts +5 -0
  255. package/dist/core/session-store.js +12 -0
  256. package/dist/core/session.d.ts +13 -0
  257. package/dist/core/shared-memory/normalize.d.ts +17 -4
  258. package/dist/core/shared-memory/normalize.js +7 -7
  259. package/dist/core/shell-lexer.js +5 -4
  260. package/dist/core/shell-wrapper-projection.js +1 -1
  261. package/dist/core/skill-grant.js +1 -1
  262. package/dist/core/store-contracts/checkpoint-store-contract.js +13 -0
  263. package/dist/core/store-contracts/mailbox-store-contract.d.ts +7 -14
  264. package/dist/core/store-contracts/session-store-incarnation-contract.d.ts +27 -0
  265. package/dist/core/store-contracts/session-store-incarnation-contract.js +92 -0
  266. package/dist/core/stub-env.d.ts +2 -0
  267. package/dist/core/stub-env.js +1 -0
  268. package/dist/core/synthetic-read-verdict.js +2 -2
  269. package/dist/core/task-event.d.ts +59 -5
  270. package/dist/core/task-result.d.ts +1 -1
  271. package/dist/core/task-spec.d.ts +42 -9
  272. package/dist/core/terminal-cause.d.ts +94 -11
  273. package/dist/core/tighten-task-spec.d.ts +5 -4
  274. package/dist/core/tighten-task-spec.js +20 -25
  275. package/dist/core/tool-catalog-entries.d.ts +5 -7
  276. package/dist/core/tool-catalog-entries.js +14 -15
  277. package/dist/core/tool-face.d.ts +47 -0
  278. package/dist/core/tool-face.js +5 -0
  279. package/dist/core/tool-model-gate.d.ts +5 -5
  280. package/dist/core/tool-name-aliases.d.ts +26 -2
  281. package/dist/core/tool-name-aliases.js +13 -0
  282. package/dist/core/tool-name-list.d.ts +30 -0
  283. package/dist/core/tool-name-list.js +55 -0
  284. package/dist/core/tool-name-readings.d.ts +1 -9
  285. package/dist/core/tool-name-readings.js +1 -3
  286. package/dist/core/tool-policy.d.ts +195 -85
  287. package/dist/core/tool-policy.js +165 -380
  288. package/dist/core/tool-registry.d.ts +44 -1
  289. package/dist/core/tool-registry.js +26 -0
  290. package/dist/core/tool-roster.d.ts +19 -1
  291. package/dist/core/tool-roster.js +21 -2
  292. package/dist/core/tool-spec-members.d.ts +45 -0
  293. package/dist/core/tool-spec-members.js +169 -0
  294. package/dist/core/tool-spec.d.ts +46 -8
  295. package/dist/core/tools.d.ts +6 -2
  296. package/dist/core/tools.js +8 -4
  297. package/dist/core/untrusted-egress.js +29 -26
  298. package/dist/core/untrusted-text.d.ts +13 -10
  299. package/dist/core/untrusted-text.js +6 -44
  300. package/dist/core/workflow-journal-store.d.ts +4 -1
  301. package/dist/core/write-protect.d.ts +65 -29
  302. package/dist/core/write-protect.js +235 -177
  303. package/dist/engine/compaction/compaction.d.ts +2 -2
  304. package/dist/engine/execution-env/node-execution-env.d.ts +5 -23
  305. package/dist/engine/execution-env/node-execution-env.js +16 -38
  306. package/dist/engine/execution-env/symlink-chain.d.ts +23 -0
  307. package/dist/engine/execution-env/symlink-chain.js +32 -0
  308. package/dist/engine/harness/types.d.ts +7 -0
  309. package/dist/engine/llm/tool-turns.d.ts +3 -0
  310. package/dist/engine/llm/tool-turns.js +1 -0
  311. package/dist/engine/llm/types.d.ts +59 -23
  312. package/dist/engine/loop/agent-loop.js +16 -2
  313. package/dist/engine/session/memory-repo.js +11 -3
  314. package/dist/engine/session/repo-utils.d.ts +8 -0
  315. package/dist/engine/session/repo-utils.js +13 -0
  316. package/dist/index.d.ts +20 -23
  317. package/dist/index.js +17 -20
  318. package/dist/internal/harness.d.ts +1 -1
  319. package/dist/internal/harness.js +1 -1
  320. package/dist/internal/llm.d.ts +2 -2
  321. package/dist/internal/llm.js +1 -1
  322. package/dist/orchestration/governance-baseline-validity.js +1 -1
  323. package/dist/orchestration/run-spec.js +3 -3
  324. package/dist/orchestration/run-workflow-tool.d.ts +16 -35
  325. package/dist/orchestration/run-workflow-tool.js +38 -78
  326. package/dist/orchestration/workflow-governance.d.ts +21 -25
  327. package/dist/orchestration/workflow-governance.js +38 -78
  328. package/dist/orchestration/workflow-primitives.d.ts +7 -22
  329. package/dist/orchestration/workflow-primitives.js +5 -12
  330. package/dist/orchestration/workflow-types.d.ts +1 -1
  331. package/dist/orchestration/workflow.d.ts +61 -11
  332. package/dist/orchestration/workflow.js +189 -117
  333. package/dist/scenarios/full-body.d.ts +1 -1
  334. package/dist/shell/lex.d.ts +0 -21
  335. package/dist/shell/lex.js +250 -68
  336. package/dist/shell/shell-words.d.ts +35 -0
  337. package/dist/shell/shell-words.js +65 -0
  338. package/dist/stores/file/checkpoint-store.d.ts +5 -5
  339. package/dist/stores/file/checkpoint-store.js +5 -2
  340. package/dist/stores/file/index.d.ts +0 -8
  341. package/dist/stores/file/index.js +0 -12
  342. package/dist/stores/file/session-store.d.ts +3 -0
  343. package/dist/stores/file/session-store.js +44 -19
  344. package/dist/tools/artifact/artifact-tool.js +2 -0
  345. package/dist/tools/fs/bash-program-position.d.ts +12 -4
  346. package/dist/tools/fs/bash-program-position.js +32 -9
  347. package/dist/tools/fs/bash-readonly-classifier.d.ts +1 -1
  348. package/dist/tools/fs/bash-readonly-classifier.js +8 -7
  349. package/dist/tools/fs/containment-face.d.ts +4 -0
  350. package/dist/tools/fs/containment-face.js +3 -0
  351. package/dist/tools/fs/fs-shared.d.ts +10 -0
  352. package/dist/tools/fs/fs-shared.js +18 -0
  353. package/dist/tools/fs/fs-write.js +4 -2
  354. package/dist/tools/fs/index.d.ts +1 -1
  355. package/dist/tools/fs/program-read-model.d.ts +46 -20
  356. package/dist/tools/fs/program-read-model.js +50 -20
  357. package/dist/tools/fs/program-read-model.rows.d.ts +0 -14
  358. package/dist/tools/fs/program-read-model.rows.js +16 -15
  359. package/dist/tools/fs/read-deny-home.d.ts +33 -47
  360. package/dist/tools/fs/read-deny-home.js +35 -49
  361. package/dist/tools/fs/read-deny.d.ts +23 -22
  362. package/dist/tools/fs/read-deny.js +114 -89
  363. package/dist/tools/fs/removal-targets.d.ts +56 -23
  364. package/dist/tools/fs/removal-targets.js +65 -87
  365. package/dist/tools/fs/safety.d.ts +29 -22
  366. package/dist/tools/fs/safety.js +17 -11
  367. package/dist/tools/fs/search.js +10 -8
  368. package/dist/tools/fs/shell-read-argv.js +1 -1
  369. package/dist/tools/fs/shell-read-bindings.d.ts +169 -37
  370. package/dist/tools/fs/shell-read-bindings.js +324 -86
  371. package/dist/tools/fs/shell-read-builtins.d.ts +35 -0
  372. package/dist/tools/fs/shell-read-builtins.js +43 -0
  373. package/dist/tools/fs/shell-read-check.d.ts +15 -1
  374. package/dist/tools/fs/shell-read-check.js +67 -43
  375. package/dist/tools/fs/shell-read-establish.js +6 -6
  376. package/dist/tools/fs/shell-read-functions.d.ts +22 -0
  377. package/dist/tools/fs/shell-read-functions.js +29 -0
  378. package/dist/tools/fs/shell-read-judge.d.ts +51 -18
  379. package/dist/tools/fs/shell-read-judge.js +40 -4
  380. package/dist/tools/fs/shell-read-plan.d.ts +12 -6
  381. package/dist/tools/fs/shell-read-plan.js +118 -113
  382. package/dist/tools/fs/shell-read-start.d.ts +29 -6
  383. package/dist/tools/fs/shell-read-start.js +16 -9
  384. package/dist/tools/fs/shell-read-word.js +4 -0
  385. package/dist/tools/fs/shell-read-workdir.d.ts +156 -0
  386. package/dist/tools/fs/shell-read-workdir.js +281 -0
  387. package/dist/tools/fs/shell-read-write-targets.d.ts +5 -2
  388. package/dist/tools/fs/shell-read-write-targets.js +14 -5
  389. package/dist/tools/fs/shell-reentry-text.d.ts +4 -6
  390. package/dist/tools/fs/shell-reentry-text.js +3 -11
  391. package/dist/tools/task-list.d.ts +1 -2
  392. package/dist/tools/web.js +1 -1
  393. package/package.json +4 -1
  394. package/test/export-surface.snapshot.json +107 -143
  395. package/wire-changes/core@7.49.0.json +4765 -0
  396. package/dist/agents/teacher.d.ts +0 -159
  397. package/dist/agents/teacher.js +0 -577
  398. package/dist/agents/team.d.ts +0 -226
  399. package/dist/agents/team.js +0 -257
  400. package/dist/core/strategy-store.d.ts +0 -238
  401. package/dist/core/strategy-store.js +0 -253
  402. package/dist/orchestration/builtin-workflows.d.ts +0 -133
  403. package/dist/orchestration/builtin-workflows.js +0 -159
  404. package/dist/scenarios/env.d.ts +0 -40
  405. package/dist/scenarios/env.js +0 -39
  406. package/dist/scenarios/scenario-registry.d.ts +0 -110
  407. package/dist/scenarios/scenario-registry.js +0 -140
  408. package/dist/scenarios/teacher-quickstart.d.ts +0 -40
  409. package/dist/scenarios/teacher-quickstart.js +0 -12
  410. package/dist/stores/cc/lockfile.d.ts +0 -10
  411. package/dist/stores/cc/lockfile.js +0 -98
  412. package/dist/stores/cc/mailbox-store.d.ts +0 -20
  413. package/dist/stores/cc/mailbox-store.js +0 -255
  414. package/dist/stores/cc/roster-adapter.d.ts +0 -12
  415. package/dist/stores/cc/roster-adapter.js +0 -117
  416. package/dist/stores/cc/sidecar-transcript.d.ts +0 -97
  417. package/dist/stores/cc/sidecar-transcript.js +0 -264
  418. package/dist/stores/cc/task-list-store.d.ts +0 -2
  419. package/dist/stores/cc/task-list-store.js +0 -125
  420. package/dist/stores/file/strategy-store.d.ts +0 -97
  421. package/dist/stores/file/strategy-store.js +0 -341
@@ -1,7 +1,8 @@
1
1
  import { Type } from "typebox";
2
2
  import { isAbsolute } from "node:path";
3
3
  import { applyParentSpecSeat, memoryTurnedOff, parentSpecSeatOfCtx } from "../core/parent-spec-seat.js";
4
- import { childClampSeats, engineHeadlessLegSeats, postureUnderClamps } from "../core/child-clamp-seats.js";
4
+ import { assertClampRecord, childClampSeats, clampSeatsOf, clampSourceOf, engineHeadlessLegSeats, foldClampSources, postureUnderClamps } from "../core/child-clamp-seats.js";
5
+ import { assertNoRetiredKeys } from "../core/retired-keys.js";
5
6
  import { stripSpawnTurnQuestionFace } from "../core/ask-question.js";
6
7
  import { withDelegationProvenance } from "../core/tool-policy.js";
7
8
  import { errorResult } from "../core/tools.js";
@@ -15,13 +16,15 @@ export { childThinkingSeat, deploymentSubagentThinking, deploymentSubagentTierMo
15
16
  import { OUTPUT_TOOL_NAME, REPORT_BLOCKED_TOOL_NAME } from "../core/runner/synthetic-tools.js";
16
17
  import { TOOL_SEARCH_NAME } from "../core/runner/tool-disclosure.js";
17
18
  import { OFFLOAD_TOOL_NAME } from "../core/tool-result-store.js";
18
- import { readToolNameList, resolveAgentToolSubset, snapshotDefinitionLists, snapshotToolNameList, toolNameAllowed, toolNameListFlaw } from "./tool-filter.js";
19
+ import { compileToolSelector, delegationListWhere, snapshotDefinitionLists, toolListsDigest, toolNameAllowed, toolNameListFlaw } from "./tool-filter.js";
20
+ import { readToolNameList, snapshotToolNameList } from "../core/tool-name-list.js";
19
21
  import { EXTRA_TOOL_NAMES_CODE, delegationPoolFace, extraToolNamesError, firstUndeclaredExtraTool, readExtraToolNames } from "./extra-tool-names.js";
20
22
  import { builtinAgentDefinitions } from "./builtin-agents.js";
23
+ import { normalizePeerName, reservedPeerNameReason } from "./cross-session-ref.js";
21
24
  import { SUBAGENT_PROMPT } from "../prompts/default.js";
22
25
  import { hasSessionFork } from "../core/session.js";
23
26
  import { isDurablePause, pauseFamily } from "./suspend-guard.js";
24
- import { terminalProjection } from "../core/runner/terminal-projection.js";
27
+ import { childRejection, childTerminalFace, childThrownText } from "./child-failure.js";
25
28
  import { forwardSafely } from "../core/runner/forward-sink.js";
26
29
  import { delimitUntrusted, inlineUntrusted } from "../core/untrusted-text.js";
27
30
  import { createSafeNotifier } from "../core/safe-notify.js";
@@ -70,7 +73,7 @@ import { LAUNCH_RECEIPT_OWN_WORDS_CLAUSE, launchReceiptNoQuoteClause } from "./l
70
73
  import { ObserverDigestTap, ObserverPairing, createObserverReportToolSpec, markObserverTaskId, unmarkObserverTaskId, isObserverTaskId, ObserverResumeStateError, ObserverStoppedByUserError, observerFramingPrompt, observerSlug, resolveObserverDeclaration, } from "./observer.js";
71
74
  import { SubagentStepRecorder } from "./subagent-steps.js";
72
75
  import { toolFace } from "../core/tool-catalog-entries.js";
73
- import { inheritedChildPool, teammateInheritedFamily } from "./inherited-tool-pool.js";
76
+ import { inheritedChildPool, inheritedMcpDeclarations } from "./inherited-tool-pool.js";
74
77
  import { readMember, thrownText } from "../core/thrown-value.js";
75
78
  const BG_AGENT_RESULT_MAX = 4_000;
76
79
  const BG_AGENT_RESULT_FULL_MAX = 200_000;
@@ -388,7 +391,7 @@ function thrownErrorCode(e) {
388
391
  return typeof code === "string" ? code : undefined;
389
392
  }
390
393
  export function completedAgentCard(child, extras) {
391
- const face = terminalProjection(child.terminal);
394
+ const face = childTerminalFace(child.terminal);
392
395
  return {
393
396
  type: "agent",
394
397
  ...(extras.attestation !== undefined ? { attestation: extras.attestation } : {}),
@@ -492,7 +495,13 @@ function createSteerHandle(stream, parentToolCallId, agentName, settled, retain)
492
495
  : {}),
493
496
  };
494
497
  }
498
+ const RETIRED_RESUME_CLAMP_KEYS = Object.freeze({
499
+ "currentClamps.readFaceRoots": 'the waker\'s read-face clamp is `currentClamps.readFace: "roots"` (the clamp table\'s own seat name)',
500
+ "currentClamps.writeFaceRoots": 'the waker\'s write-face clamp is `currentClamps.writeFace: "roots"` (the clamp table\'s own seat name)',
501
+ });
495
502
  export function createSubagentResume(deps) {
503
+ assertNoRetiredKeys(deps, RETIRED_RESUME_CLAMP_KEYS, "createSubagentResume");
504
+ assertClampRecord(deps.currentClamps, "createSubagentResume currentClamps", undefined, ["memoryOff"]);
496
505
  const notifier = createSafeNotifier(deps.onNotifyError !== undefined ? { onError: deps.onNotifyError } : undefined);
497
506
  const resume = async (content) => {
498
507
  const ledger = deps.ledger;
@@ -551,26 +560,16 @@ export function createSubagentResume(deps) {
551
560
  marker = `resume-${markerFragment()}`;
552
561
  entry.resumeCount += 1;
553
562
  entry.cycleSeq += 1;
563
+ const wakeClamps = foldClampSources(entry.specSnapshot, deps.currentClamps);
554
564
  const resumeSpec = {
555
565
  ...entry.specSnapshot,
556
566
  objective: createResumePrompt(marker, content, deps.peerOrigin !== undefined ? "peer" : "operator"),
557
567
  sessionId: entry.childSessionId,
558
568
  requireExistingSession: true,
559
569
  ...(deps.currentOnQuestion !== undefined ? { onQuestion: deps.currentOnQuestion } : {}),
560
- ...childClampSeats({
561
- handsReadOnly: entry.specSnapshot.handsReadOnly === true || deps.currentClamps?.handsReadOnly === true,
562
- interactiveTools: entry.specSnapshot.interactiveTools === false || deps.currentClamps?.interactiveTools === false ? false : undefined,
563
- approvalReach: entry.specSnapshot.approvalReach === "none" || deps.currentClamps?.approvalReach === "none" ? "none" : undefined,
564
- readFace: entry.specSnapshot.readFace === "roots" || deps.currentClamps?.readFaceRoots === true ? "roots" : entry.specSnapshot.readFace,
565
- writeFace: entry.specSnapshot.writeFace === "roots" || deps.currentClamps?.writeFaceRoots === true ? "roots" : entry.specSnapshot.writeFace,
566
- readDenyPatterns: [...(entry.specSnapshot.readDenyPatterns ?? []), ...(deps.currentClamps?.readDenyPatterns ?? [])],
567
- }),
568
- ...(entry.specSnapshot.oneShot === true || deps.currentClamps?.oneShot === true ? { oneShot: true } : {}),
569
- ...(entry.specSnapshot.memoryPersistenceCapable === false || deps.currentClamps?.memoryPersistenceCapable === false
570
- ? { memoryPersistenceCapable: false }
571
- : {}),
570
+ ...childClampSeats(wakeClamps),
571
+ ...clampSeatsOf(wakeClamps, "specSeat"),
572
572
  ...(deps.currentClamps?.memoryOff === true ? { memory: memoryTurnedOff(entry.specSnapshot.memory) } : {}),
573
- ...(deps.currentClamps?.fileHistory === "disabled" ? { fileHistory: "disabled" } : {}),
574
573
  signal: abort.signal,
575
574
  };
576
575
  if (deps.registry !== undefined && deps.taskId !== undefined && deps.taskAccess !== undefined) {
@@ -714,7 +713,7 @@ export function createSubagentResume(deps) {
714
713
  for await (const _ of stream)
715
714
  void _;
716
715
  const child = await stream.result();
717
- const childFace = terminalProjection(child.terminal);
716
+ const childFace = childTerminalFace(child.terminal);
718
717
  let status = child.terminal.kind === "completed" ? "completed" : abort.signal.aborted ? "killed" : "failed";
719
718
  const resumeHandbackWarning = await reviewHandback({
720
719
  review: deps.currentAutoModeReview,
@@ -820,7 +819,7 @@ export function createSubagentResume(deps) {
820
819
  }
821
820
  }
822
821
  catch (e) {
823
- const msgRevive = thrownText(e);
822
+ const msgRevive = childThrownText(e);
824
823
  const errCodeReviveReject = abort.signal.aborted ? undefined : thrownErrorCode(e);
825
824
  const errClassReviveReject = abort.signal.aborted ? undefined : classifySubagentError({ kind: "failed", ...(errCodeReviveReject !== undefined ? { code: errCodeReviveReject } : {}) });
826
825
  if (reviveCycle !== undefined && deps.registry !== undefined && deps.taskId !== undefined) {
@@ -1400,6 +1399,7 @@ function createSubagentToolNode(opts, depth, excluded, extraToolsBudget) {
1400
1399
  ...(depth === 0 && opts.allowTools !== undefined ? { agentToolLevelAllowTools: opts.allowTools } : {}),
1401
1400
  ...(depth === 0 && opts.denyTools !== undefined ? { agentToolLevelDenyTools: opts.denyTools } : {}),
1402
1401
  ...(agentToolPool !== undefined ? { agentToolPool } : {}),
1402
+ ...(opts.tools === undefined ? { agentToolInheritsMcp: true } : {}),
1403
1403
  ...(rosterNames !== undefined ? { agentModels: rosterNames } : {}),
1404
1404
  executionMode: "parallel",
1405
1405
  description: `Launch a new agent to handle complex, multi-step tasks. Each agent type has specific capabilities and tools available to it.\n` +
@@ -1542,9 +1542,12 @@ function createSubagentToolNode(opts, depth, excluded, extraToolsBudget) {
1542
1542
  details: { error: "unknown subagent_type" },
1543
1543
  };
1544
1544
  }
1545
- const allowFlaw = toolNameListFlaw(`delegation tool "${toolName}": ${def !== undefined ? `agent definition "${def.name}"` : "the tool-level list"}`, "allowed", def !== undefined ? def.allowTools : opts.allowTools);
1545
+ const allowFlaw = toolNameListFlaw(delegationListWhere(toolName, def?.name), "allowed", def !== undefined ? def.allowTools : opts.allowTools);
1546
1546
  if (allowFlaw !== undefined)
1547
1547
  return { isError: true, content: `Sub-agent not started: ${inlineUntrusted(allowFlaw, 480)}`, details: { error: "config.agent.unknown_tool" } };
1548
+ const denyFlaw = toolNameListFlaw(delegationListWhere(toolName, def?.name), "denied", def !== undefined ? def.denyTools : opts.denyTools);
1549
+ if (denyFlaw !== undefined)
1550
+ return { isError: true, content: `Sub-agent not started: ${inlineUntrusted(denyFlaw, 480)}`, details: { error: "config.agent.unknown_tool" } };
1548
1551
  if (a.name !== undefined && typeof a.name !== "string") {
1549
1552
  return { isError: true, content: "Sub-agent not started: name must be a string.", details: { error: "name.invalid" } };
1550
1553
  }
@@ -1557,12 +1560,8 @@ function createSubagentToolNode(opts, depth, excluded, extraToolsBudget) {
1557
1560
  details: { error: "name.invalid" },
1558
1561
  };
1559
1562
  }
1560
- if (agentName.toLowerCase() === "main") {
1561
- return {
1562
- isError: true,
1563
- content: 'Sub-agent not started: "main" is reserved — SendMessage routes it to the main conversation.',
1564
- details: { error: "name.reserved" },
1565
- };
1563
+ if (reservedPeerNameReason(agentName) !== undefined) {
1564
+ return { isError: true, content: normalizePeerName(agentName) === "main" ? 'Sub-agent not started: "main" is reserved — SendMessage routes it to the main conversation.' : 'Sub-agent not started: name must not be a reserved name ("main", "team-lead", "user" or "system", in any spelling) or have the shape of an agent id — those already address an agent directly.', details: { error: "name.reserved" } };
1566
1565
  }
1567
1566
  if (ctx.spawnedAgentName !== undefined && reviveClaim === undefined) {
1568
1567
  return {
@@ -1845,17 +1844,19 @@ function createSubagentToolNode(opts, depth, excluded, extraToolsBudget) {
1845
1844
  }
1846
1845
  childPool = [...(opts.tools ?? inherited.filter((t) => ![t.name, ...(t.aliases ?? [])].some((n) => taken.has(n)))), ...accepted];
1847
1846
  }
1848
- const subset = resolveAgentToolSubset(childPool, def ? def.allowTools : opts.allowTools, def ? def.denyTools : opts.denyTools);
1849
- const allowed = new Set([...subset.handed, ...(agentName !== undefined ? teammateInheritedFamily(childPool.filter((t) => inherited.includes(t)), def ? def.denyTools : opts.denyTools) : [])]);
1850
- const childTools = childPool.filter((t) => allowed.has(t));
1851
- const childExcludeTools = ctx.excludeTools !== undefined || subset.withheldHands.length > 0 ? [...new Set([...(ctx.excludeTools ?? []), ...subset.withheldHands])] : undefined;
1847
+ const governingLists = def !== undefined ? { allow: def.allowTools, deny: def.denyTools } : { allow: opts.allowTools, deny: opts.denyTools };
1848
+ const childOwnLayer = Object.freeze({ ...(governingLists.allow != null ? { allow: Object.freeze([...governingLists.allow]) } : {}), deny: Object.freeze([...(governingLists.deny ?? [])]) });
1849
+ const childListsJudged = toolListsDigest(childOwnLayer.allow, childOwnLayer.deny);
1850
+ const childCeiling = ctx.toolSelector?.layers ?? [];
1851
+ const parentMcp = opts.tools === undefined && extraToolsNote === undefined ? ctx.mountedMcp?.() : undefined;
1852
+ const childMcp = parentMcp !== undefined ? inheritedMcpDeclarations(parentMcp, compileToolSelector([...childCeiling, childOwnLayer])) : undefined;
1853
+ const childTools = [...childPool];
1852
1854
  const childSystemPrompt = def?.systemPrompt ?? opts.systemPrompt;
1853
1855
  const childDefaultPersona = childSystemPrompt === undefined && !wantsFork ? SUBAGENT_PROMPT : undefined;
1854
1856
  const defMaxTurns = typeof def?.maxTurns === "number" && Number.isFinite(def.maxTurns) && def.maxTurns > 0 ? def.maxTurns : undefined;
1855
1857
  const childLimits = defMaxTurns !== undefined ? { ...opts.limits, maxTurns: defMaxTurns } : opts.limits;
1856
1858
  const nextExcluded = def ? new Set([...excluded, def.name]) : excluded;
1857
- const defAllowsDelegation = def === undefined || toolNameAllowed(opts.name ?? DEFAULT_SUBAGENT_TOOL_NAME, def.allowTools, def.denyTools);
1858
- if (depth + 1 < maxDepth && defAllowsDelegation) {
1859
+ if (depth + 1 < maxDepth) {
1859
1860
  childTools.push(createSubagentToolNode(opts, depth + 1, nextExcluded, treeBudget));
1860
1861
  }
1861
1862
  const childAgentName = (typeof a.description === "string" && a.description.trim() ? a.description.trim() : undefined) ?? def?.name;
@@ -1873,7 +1874,7 @@ function createSubagentToolNode(opts, depth, excluded, extraToolsBudget) {
1873
1874
  let observerDegradedCount = 0;
1874
1875
  let observerDegradedFirst;
1875
1876
  const noteObserverFailure = (err) => {
1876
- const msg = (thrownText(err)).slice(0, REPORT_FIELD_MAX);
1877
+ const msg = childThrownText(err).slice(0, REPORT_FIELD_MAX);
1877
1878
  if (observerPairing !== undefined && observerPairing.state === "armed") {
1878
1879
  observerDegradedCount++;
1879
1880
  if (observerDegradedFirst === undefined)
@@ -1926,13 +1927,12 @@ function createSubagentToolNode(opts, depth, excluded, extraToolsBudget) {
1926
1927
  ...(ctx.getApiKeyAndHeaders !== undefined ? { getApiKeyAndHeaders: ctx.getApiKeyAndHeaders } : {}),
1927
1928
  ...(ctx.checkpointStoreForChildren !== undefined ? { checkpointStore: ctx.checkpointStoreForChildren } : {}),
1928
1929
  tools: [reportTool],
1929
- ...(childExcludeTools !== undefined ? { excludeTools: [...childExcludeTools] } : {}),
1930
1930
  ...(ctx.deferTools !== undefined ? { deferTools: [...ctx.deferTools] } : {}),
1931
1931
  ...(ctx.alwaysLoadTools !== undefined ? { alwaysLoadTools: [...ctx.alwaysLoadTools] } : {}),
1932
1932
  ...(ctx.restoreGatedTools !== undefined ? { restoreGatedTools: ctx.restoreGatedTools === true ? true : [...ctx.restoreGatedTools] } : {}),
1933
1933
  ...(ctx.promptProfile !== undefined ? { promptProfile: ctx.promptProfile } : {}),
1934
1934
  ...engineHeadlessLegSeats(),
1935
- ...childClampSeats({ handsReadOnly: ctx.handsReadOnly, interactiveTools: ctx.interactiveTools, approvalReach: ctx.approvalReach, readFace: ctx.readFace, writeFace: ctx.writeFace, readDenyPatterns: ctx.readDenyPatterns }),
1935
+ ...childClampSeats(clampSourceOf(ctx)),
1936
1936
  enableBlockedReport: false,
1937
1937
  limits: {
1938
1938
  maxTurns: typeof observerDef.maxTurns === "number" && Number.isFinite(observerDef.maxTurns) && observerDef.maxTurns > 0 ? observerDef.maxTurns : 8,
@@ -1952,15 +1952,14 @@ function createSubagentToolNode(opts, depth, excluded, extraToolsBudget) {
1952
1952
  ...(parentGate.shellGate !== undefined ? { shellGate: parentGate.shellGate } : {}),
1953
1953
  admittedOrgScopes: parentGate.admittedOrgScopes,
1954
1954
  };
1955
- const observerInternals = ctx.interactionPosture !== undefined || pickedRef !== undefined || observerGate !== undefined
1956
- ? { ...(ctx.interactionPosture !== undefined ? { parentInteractionPosture: ctx.interactionPosture } : {}), ...(pickedRef !== undefined ? { inheritedModelRef: pickedRef } : {}), ...(observerGate !== undefined ? { inheritedGate: observerGate } : {}) }
1957
- : undefined;
1955
+ const observerInternals = { ...(ctx.interactionPosture !== undefined ? { parentInteractionPosture: ctx.interactionPosture } : {}), ...(pickedRef !== undefined ? { inheritedModelRef: pickedRef } : {}), ...(observerGate !== undefined ? { inheritedGate: observerGate } : {}), toolCeiling: [...childCeiling, childOwnLayer], observerLeg: true };
1958
1956
  const r = await opts.runner.runTask(spec, observerInternals);
1959
1957
  if (r.terminal.kind !== "completed") {
1960
- const failedText = r.terminal.kind === "failed" && r.terminal.message ? `: ${r.terminal.message}` : "";
1958
+ const endedFace = childTerminalFace(r.terminal);
1959
+ const failedText = r.terminal.kind === "failed" && endedFace.errorMessage ? `: ${endedFace.errorMessage}` : "";
1961
1960
  if (r.terminal.kind === "failed" && r.terminal.code === "resume.session_not_found")
1962
1961
  throw new ObserverResumeStateError(`observer session no longer exists${failedText}`);
1963
- throw new Error(`observer run ended ${terminalProjection(r.terminal).status}${failedText}`);
1962
+ throw new Error(`observer run ended ${endedFace.status}${failedText}`);
1964
1963
  }
1965
1964
  };
1966
1965
  const spawner = {
@@ -2112,11 +2111,15 @@ function createSubagentToolNode(opts, depth, excluded, extraToolsBudget) {
2112
2111
  ? { optedOut: (await ctx.memoryCaptureOptedOut) === true, indeterminate: (await ctx.memoryCaptureIndeterminate) === true }
2113
2112
  : undefined;
2114
2113
  const childInternals = {
2114
+ ...(ctx.toolSelector !== undefined ? { toolCeiling: childCeiling, ...(childListsJudged !== undefined ? { toolListsJudged: childListsJudged } : {}) } : {}),
2115
+ ownToolListsWhere: delegationListWhere(toolName, def?.name),
2116
+ ...(parentMcp?.pool !== undefined && childMcp !== undefined && childMcp.length > 0 ? { mcpPool: parentMcp.pool } : {}),
2115
2117
  ...(childPick.modelRef !== undefined ? { inheritedModelRef: childPick.modelRef } : {}),
2116
2118
  ...(inheritedSkillGrants.length > 0 ? { inheritedSkillGrants } : {}),
2117
2119
  ...(inheritedAllowedTools !== undefined && inheritedAllowedTools.length > 0 ? { inheritedAllowedTools: [...inheritedAllowedTools] } : {}),
2118
2120
  ...(childProvenanceRef !== undefined && provenanceRequest !== undefined ? { delegationProvenance: { ref: childProvenanceRef, contentSafety: provenanceRequest } } : {}),
2119
2121
  ...(treeScope !== undefined ? { registryScope: treeScope } : {}),
2122
+ ...(ctx.checkpointScopeForChildren !== undefined ? { checkpointScope: ctx.checkpointScopeForChildren } : {}),
2120
2123
  ...(ctx.inheritedGateForChildren ? { inheritedGate: ctx.inheritedGateForChildren() } : {}),
2121
2124
  ...(ctx.questionFaceStripped === true ? { questionFaceStripped: true } : {}),
2122
2125
  ownOrgAdmissionRef: { current: reviveClaim !== undefined ? readDurableOrgAdmission(reviveClaim.row) : undefined },
@@ -2200,14 +2203,16 @@ function createSubagentToolNode(opts, depth, excluded, extraToolsBudget) {
2200
2203
  ...childSeat,
2201
2204
  ...childThinking,
2202
2205
  tools: childTools,
2206
+ ...(childMcp !== undefined && childMcp.length > 0 ? { mcp: childMcp } : {}),
2203
2207
  systemPrompt: childSystemPrompt,
2204
2208
  ...(def?.memory ? { memory: def.memory } : {}),
2205
2209
  ...(def?.skills?.length ? { skills: def.skills } : {}),
2206
2210
  ...(def?.memoryPersistenceCapable !== undefined ? { memoryPersistenceCapable: def.memoryPersistenceCapable } : {}),
2207
2211
  ...(ctx.checkpointStoreForChildren !== undefined ? { checkpointStore: ctx.checkpointStoreForChildren } : {}),
2208
2212
  ...(childOnAsk !== undefined ? { onAsk: childOnAsk } : {}),
2209
- ...childClampSeats({ handsReadOnly: ctx.handsReadOnly, interactiveTools: ctx.interactiveTools, approvalReach: ctx.approvalReach, readFace: ctx.readFace, writeFace: ctx.writeFace, readDenyPatterns: ctx.readDenyPatterns }),
2210
- ...(childExcludeTools !== undefined ? { excludeTools: [...childExcludeTools] } : {}),
2213
+ ...childClampSeats(clampSourceOf(ctx)),
2214
+ ...(childOwnLayer.allow !== undefined ? { allowTools: [...childOwnLayer.allow] } : {}),
2215
+ ...(childOwnLayer.deny.length > 0 ? { excludeTools: [...childOwnLayer.deny] } : {}),
2211
2216
  ...(ctx.deferTools !== undefined ? { deferTools: [...ctx.deferTools] } : {}),
2212
2217
  ...(ctx.alwaysLoadTools !== undefined ? { alwaysLoadTools: [...ctx.alwaysLoadTools] } : {}),
2213
2218
  ...(ctx.restoreGatedTools !== undefined ? { restoreGatedTools: ctx.restoreGatedTools === true ? true : [...ctx.restoreGatedTools] } : {}),
@@ -2235,6 +2240,7 @@ function createSubagentToolNode(opts, depth, excluded, extraToolsBudget) {
2235
2240
  ...(plainSpec.limits ? { limits: { ...plainSpec.limits } } : {}),
2236
2241
  ...(plainSpec.memory !== undefined && typeof plainSpec.memory === "object" ? { memory: { ...plainSpec.memory } } : {}),
2237
2242
  ...(plainSpec.clientContext !== undefined ? { clientContext: { ...plainSpec.clientContext } } : {}),
2243
+ ...(plainSpec.allowTools !== undefined ? { allowTools: [...plainSpec.allowTools] } : {}),
2238
2244
  ...(plainSpec.excludeTools !== undefined ? { excludeTools: [...plainSpec.excludeTools] } : {}),
2239
2245
  ...(plainSpec.deferTools !== undefined ? { deferTools: [...plainSpec.deferTools] } : {}),
2240
2246
  ...(plainSpec.alwaysLoadTools !== undefined ? { alwaysLoadTools: [...plainSpec.alwaysLoadTools] } : {}),
@@ -2317,6 +2323,7 @@ function createSubagentToolNode(opts, depth, excluded, extraToolsBudget) {
2317
2323
  ...(plainSpec.limits ? { limits: { ...plainSpec.limits } } : {}),
2318
2324
  ...(plainSpec.memory !== undefined && typeof plainSpec.memory === "object" ? { memory: { ...plainSpec.memory } } : {}),
2319
2325
  ...(plainSpec.clientContext !== undefined ? { clientContext: { ...plainSpec.clientContext } } : {}),
2326
+ ...(plainSpec.allowTools !== undefined ? { allowTools: [...plainSpec.allowTools] } : {}),
2320
2327
  ...(plainSpec.excludeTools !== undefined ? { excludeTools: [...plainSpec.excludeTools] } : {}),
2321
2328
  ...(plainSpec.deferTools !== undefined ? { deferTools: [...plainSpec.deferTools] } : {}),
2322
2329
  ...(plainSpec.alwaysLoadTools !== undefined ? { alwaysLoadTools: [...plainSpec.alwaysLoadTools] } : {}),
@@ -2689,7 +2696,7 @@ function createSubagentToolNode(opts, depth, excluded, extraToolsBudget) {
2689
2696
  void opts.runner
2690
2697
  .runTask(bgForkSpec, bgForkInternals)
2691
2698
  .then(async (child) => {
2692
- const childFace = terminalProjection(child.terminal);
2699
+ const childFace = childTerminalFace(child.terminal);
2693
2700
  settleForkRow(child.terminal);
2694
2701
  dropHostAbortListener();
2695
2702
  await finishWorktree(child.terminal);
@@ -2792,7 +2799,7 @@ function createSubagentToolNode(opts, depth, excluded, extraToolsBudget) {
2792
2799
  dropHostAbortListener();
2793
2800
  void finishWorktree();
2794
2801
  const killed = abort.signal.aborted;
2795
- const msgFork = thrownText(e);
2802
+ const msgFork = childThrownText(e);
2796
2803
  const errCodeForkReject = killed ? undefined : thrownErrorCode(e);
2797
2804
  const errClassForkReject = killed ? undefined : classifySubagentError({ kind: "failed", ...(errCodeForkReject !== undefined ? { code: errCodeForkReject } : {}) });
2798
2805
  const settledBg = bg.registry.settleBackgroundAgent(taskId, {
@@ -2902,7 +2909,7 @@ function createSubagentToolNode(opts, depth, excluded, extraToolsBudget) {
2902
2909
  catch {
2903
2910
  }
2904
2911
  const wt = await finishWorktree();
2905
- return { isError: true, content: `Fork failed: the forked run threw (${thrownText(e)}).${wt ? `\n${wt}` : ""}`, details: { error: "fork run failed" } };
2912
+ return { isError: true, content: `Fork failed: the forked run threw (${childThrownText(e)}).${wt ? `\n${wt}` : ""}`, details: { error: "fork run failed" } };
2906
2913
  }
2907
2914
  finally {
2908
2915
  syncForkAdmission.release();
@@ -2925,7 +2932,7 @@ function createSubagentToolNode(opts, depth, excluded, extraToolsBudget) {
2925
2932
  return durablePauseDelegationReport(` · ${FORK_SUBAGENT_TYPE}`, forkChild.terminal);
2926
2933
  }
2927
2934
  const wtLine = await finishWorktree();
2928
- const forkFace = terminalProjection(forkChild.terminal);
2935
+ const forkFace = childTerminalFace(forkChild.terminal);
2929
2936
  const forkErr = classifySubagentError(forkChild.terminal);
2930
2937
  const forkLines = [
2931
2938
  ...(forkHandbackWarning ? [forkHandbackWarning, ""] : []),
@@ -3466,7 +3473,7 @@ function createSubagentToolNode(opts, depth, excluded, extraToolsBudget) {
3466
3473
  : opts.runner.runTask(bgSpec, bgInternals);
3467
3474
  void bgChildPromise
3468
3475
  .then(async (child) => {
3469
- const childFace = terminalProjection(child.terminal);
3476
+ const childFace = childTerminalFace(child.terminal);
3470
3477
  settleDelegationRow(child.terminal);
3471
3478
  closeObserverWindow(childFace.status);
3472
3479
  dropHostAbortListener();
@@ -3676,7 +3683,7 @@ function createSubagentToolNode(opts, depth, excluded, extraToolsBudget) {
3676
3683
  else
3677
3684
  bgRetainLedger?.markSettled(ctx.toolCallId);
3678
3685
  }
3679
- const msg = thrownText(e);
3686
+ const msg = childThrownText(e);
3680
3687
  const errCodeBgReject = killed ? undefined : thrownErrorCode(e);
3681
3688
  const errClassBgReject = killed ? undefined : classifySubagentError({ kind: "failed", ...(errCodeBgReject !== undefined ? { code: errCodeBgReject } : {}) });
3682
3689
  const settled = bg.registry.settleBackgroundAgent(taskId, {
@@ -3740,7 +3747,7 @@ function createSubagentToolNode(opts, depth, excluded, extraToolsBudget) {
3740
3747
  ]);
3741
3748
  if (startup === "settled") {
3742
3749
  if (parkedResume !== undefined) {
3743
- const err = await bgChildPromise.then(() => undefined, (e) => (thrownText(e)));
3750
+ const err = await bgChildPromise.then(() => undefined, (e) => childThrownText(e));
3744
3751
  return {
3745
3752
  isError: true,
3746
3753
  content: `Parked resume did not complete: ${(err ?? "the resumed run settled before its delivery lane bound").slice(0, 600)}`,
@@ -3822,7 +3829,7 @@ function createSubagentToolNode(opts, depth, excluded, extraToolsBudget) {
3822
3829
  }
3823
3830
  catch (e) {
3824
3831
  await settleObserver("failed");
3825
- throw e;
3832
+ throw childRejection(e);
3826
3833
  }
3827
3834
  finally {
3828
3835
  settleResolve();
@@ -3830,13 +3837,18 @@ function createSubagentToolNode(opts, depth, excluded, extraToolsBudget) {
3830
3837
  }
3831
3838
  }
3832
3839
  else {
3833
- child = await opts.runner.runTask(buildChildSpec(ctx.signal), childInternals);
3840
+ try {
3841
+ child = await opts.runner.runTask(buildChildSpec(ctx.signal), childInternals);
3842
+ }
3843
+ catch (e) {
3844
+ throw childRejection(e);
3845
+ }
3834
3846
  }
3835
3847
  }
3836
3848
  finally {
3837
3849
  syncAdmission.release();
3838
3850
  }
3839
- const childFace = terminalProjection(child.terminal);
3851
+ const childFace = childTerminalFace(child.terminal);
3840
3852
  await settleObserver(childFace.status);
3841
3853
  const handbackWarning = await reviewHandback({
3842
3854
  review: ctx.autoModeReview,
@@ -1,7 +1,7 @@
1
1
  import type { PausedCause, TaskResult, TerminalCause } from "../core/types.js";
2
2
  /**
3
3
  * design/45 §11 Q6 — the **durable-suspend hard boundary** (v1). A `paused` terminal is only safe to
4
- * handle at the **top-level `runTask`** boundary: the orchestrators (cascade / verify / teacher / team)
4
+ * handle at the **top-level `runTask`** boundary: the orchestrators (cascade / verify / repair-loop)
5
5
  * run their work as *nested* `runTask`s, and none of them can drive a resume from the inside. If a nested
6
6
  * task pauses on a durable gate, the orchestrator must **fail fast** — not silently treat it as an
7
7
  * ordinary failure (which would escalate/re-run side effects) and not release its pinned session (which
@@ -1,27 +1,25 @@
1
1
  import type { AgentDefinition, ToolSpec } from "../core/types.js";
2
+ import type { ToolLegKind, ToolSelector, ToolSelectorLayer } from "../core/tool-face.js";
3
+ import { type ProtocolId } from "../core/protocol-table.js";
4
+ import { type ToolNameListReading } from "../core/tool-name-list.js";
2
5
  /**
3
- * Per-agent tool allow/deny (design/38 1A). Statically narrows a tool POOL to the subset a delegated
4
- * sub-agent / team member may use — assembly-time filtering (the tool simply never appears in the
5
- * child's `tools[]`), distinct from design/37's execution-time policy interception.
6
+ * The tool selector (design/38 1A, one operation since #1623): what tools a run may use, read once over the universe it can get
7
+ * (its pool, every tool the engine mounts on it, the protocol tools it connects) at its own prepare —
8
+ * `available = universe ∩ ceiling ∩ allow − deny` — and on every later roster change. The same compiled object answers the
9
+ * root run (`TaskSpec.allowTools` / `TaskSpec.excludeTools`) and every child (its definition's lists, under the ceiling of the
10
+ * run that spawned it), so there is no spawn-time filter and no complement anywhere.
6
11
  *
7
- * Resolution order (council finding 6): `pool → ∩ allowTools → − denyTools`.
8
- * - `allowTools` undefined OR contains `"*"` → start from the whole pool; otherwise keep only the named
9
- * tools (an explicit allowlist; `[]` means "no work tools", which is intentional, not a mistake).
10
- * - `denyTools` then removes named tools from whatever remains (a denied tool always loses).
12
+ * - an allowed list absent, or holding `"*"`, sets no allowlist on its layer; otherwise the layer keeps only what it names
13
+ * (`[]` keeps nothing — intentional, not a mistake);
14
+ * - a denied list removes what it names from whatever remains (a denied tool always loses);
15
+ * - a layer above a run (its ceiling) bounds it: a child's `"*"` never widens what its parent could use.
11
16
  *
12
- * Allowlist is the security-recommended shape (finding 5): a denylist-only config silently exposes any
13
- * newly-added sensitive tool to every agent. Names not present in the pool are ignored (no error) — an
14
- * allow/deny list is a filter over what's available, not an assertion that those tools exist.
17
+ * An entry is read as the reference reads a rule string ({@link readDeniedEntry}: `Tool(content)` names `Tool`, the content is
18
+ * not read, the whole tool is hidden); a protocol spelling (`mcp__srv`, `mcp__srv__*`, a glob over the tool segment) reaches the
19
+ * tools of that peer, including ones it lists later. Each list is judged at the prepare that receives it: a name that names no
20
+ * tool is refused (`sub-agent-deny-lists.ts`).
15
21
  *
16
- * Anchored (dual-leg verified): this spawn-time item-level filter IS the upstream shape for allow
17
- * entries — CC's resolveAgentTools partitions unknown names into an `invalidTools` bucket nobody
18
- * consumes at runtime, and a live 2.1.207 probe shows the agent stays listed/delegable with the
19
- * unknown item silently dropped, zero warnings. A DENY entry is read as the reference reads it
20
- * ({@link readDeniedEntry}: `Tool(content)` names `Tool`, the content is not read, the whole tool is hidden). The
21
- * list is judged once before the run, from every place a deployment writes one (prepare's
22
- * `judgeDeniedToolNames`): a spelling that can name no tool is refused, the rest is told to the host.
23
- *
24
- * Note: `"*"` in `allowTools` is the "allow all" sentinel, so a tool literally NAMED `"*"` cannot be
22
+ * Note: `"*"` in an allowed list is the "allow all" sentinel, so a tool literally NAMED `"*"` cannot be
25
23
  * the sole allowed tool via this path (tool names are conventionally identifiers, so this is moot).
26
24
  */
27
25
  /**
@@ -40,28 +38,6 @@ export type DeniedEntryReading = {
40
38
  readonly type: string;
41
39
  };
42
40
  export declare function readDeniedEntry(entry: unknown): DeniedEntryReading;
43
- /** A fixed label of a host value's TYPE for a sentence that must not print or convert the value (`typeof` and the array test only). */
44
- export declare function valueTypeLabel(value: unknown): string;
45
- /**
46
- * How a tool-name list's VALUE (an agent definition's allowed-tools or denied-tools list) reads as a list. A host that reads its
47
- * definitions from a file can hand over anything, and a list can be hostile as a container (an accessor or a proxy trap that
48
- * throws, an overridden iterator, holes): it is read BY INDEX over its length, once, into a dense copy — no iterator of the host
49
- * runs, a hole reads as `undefined` (an entry that is not a string) — and a value that is not an array, or an array whose read
50
- * throws, is reported as such and never printed or converted.
51
- */
52
- export type ToolNameListReading = {
53
- readonly kind: "entries";
54
- readonly entries: readonly unknown[];
55
- } | {
56
- readonly kind: "not_a_list";
57
- readonly type: string;
58
- } | {
59
- readonly kind: "unreadable";
60
- };
61
- export declare function readToolNameList(value: unknown): ToolNameListReading;
62
- /** A tool-name list as the mount keeps it: the dense copy when it reads as a list, the failure marker when it cannot be read, else
63
- * the value itself (not a list: the judge refuses it, and its type never changes). */
64
- export declare function snapshotToolNameList(value: unknown): unknown;
65
41
  /** The two tool-name lists of a definition, and the words a sentence calls each. */
66
42
  export type ToolNameListSide = "allowed" | "denied";
67
43
  /** The sentence for an entry that is not a string: it can be no tool name; the sentence names its place and its type, never its value. */
@@ -70,6 +46,16 @@ export declare function notAStringSentence(where: string, side: ToolNameListSide
70
46
  export declare function notAListSentence(where: string, side: ToolNameListSide, list: Exclude<ToolNameListReading, {
71
47
  kind: "entries";
72
48
  }>): string;
49
+ /** Whose lists a delegated child's own are, in the words every sentence about them uses (the judgment before the run, the spawn-time
50
+ * check, the child's own prepare): the agent definition it was spawned as, or — with none — the delegation tool's tool-level list. */
51
+ export declare function delegationListWhere(toolName: string, definitionName: string | undefined): string;
52
+ /**
53
+ * The digest of a run's own two tool lists as its selector reads them (an absent denied list reads as an empty one): sha256 over the
54
+ * binding serializer's canonical form — the serializer the checkpoint row digest uses. It is the evidence that the spawning run judged
55
+ * EXACTLY these lists (`RunInternals.toolListsJudged`, and the row's `CheckpointState.toolListsJudged` on a resume); `undefined` for
56
+ * lists the serializer cannot encode, which therefore never match any evidence.
57
+ */
58
+ export declare function toolListsDigest(allow: readonly unknown[] | undefined, deny: readonly unknown[] | undefined): string | undefined;
73
59
  /**
74
60
  * Why a host-written tool-name list cannot be one, as a sentence — or `undefined` when it is absent (`undefined` / `null`) or a list
75
61
  * of strings. The one reading the judgment before the run and the spawn-time check of a tool that never went through prepare share.
@@ -79,34 +65,59 @@ export declare function toolNameListFlaw(where: string, side: ToolNameListSide,
79
65
  * run, the roster, the filter at each spawn) takes instead of the host's container. */
80
66
  export declare function snapshotDefinitionLists(def: AgentDefinition): AgentDefinition;
81
67
  /**
82
- * The names an allowed-tools value admits, or `undefined` when it names no allowlist: absent, `null`, or a list holding the
83
- * wildcard. A list admits its string entries (an entry that is not a string admits nothing); a value that is not a list admits
84
- * NOTHING — the judge before the run refuses it, and a reader that meets it first fails closed.
68
+ * What ONE tool-name list reaches — the single reading every consumer of an allowed or a denied list takes (the spawn-time
69
+ * filter, the nested-delegation check, the memory content-origin face, the judgment before the run):
70
+ * - `names`: exact spellings; a tool answers to its wire name and to every alias it declares;
71
+ * - `covering`: the protocol spellings that cover a SET — a peer (`mcp__srv`), the same set written with the star
72
+ * (`mcp__srv__*`), a glob over the tool segment (`mcp__srv__get_*`) — matched by the allow layer's own covering matcher,
73
+ * peers compared exactly, both sides in the same namespace;
74
+ * - `wholeProtocols`: a denied list's `mcp__*` — every tool of that protocol. An allowed list reads it as nothing (the
75
+ * reference's allow resolution has no such form: it keeps no MCP tool by it).
85
76
  */
86
- export declare function allowedToolNames(allowTools: unknown): ReadonlySet<string> | undefined;
77
+ export interface ToolNameListReach {
78
+ readonly names: ReadonlySet<string>;
79
+ readonly covering: readonly string[];
80
+ readonly wholeProtocols: ReadonlySet<ProtocolId>;
81
+ }
87
82
  /**
88
- * Membership check for ONE tool name under the same allow/deny semantics as {@link resolveToolSubset}
89
- * (canonicalized both sides; `"*"` allow sentinel; deny wins). Used by the delegation tool to decide
90
- * whether a chosen agent DEFINITION may re-delegate: a per-agent allow/deny that excludes the
91
- * delegation tool's own name suppresses the nested delegation tool (upstream parity — the built-in
92
- * Explore/Plan denials include Agent, and the delegation tool is filtered like any other). The
93
- * TOOL-level allow/deny keeps its own semantics (delegation governed by `maxDepth`).
83
+ * What an allowed-tools value admits, or `undefined` when it names no allowlist: absent, `null`, or a list holding the
84
+ * wildcard. A list admits its string entries (an entry that is not a string admits nothing); a value that is not a list admits
85
+ * NOTHING — the judge before the run refuses it, and a reader that meets it first fails closed.
94
86
  */
95
- export declare function toolNameAllowed(name: string, allowTools?: ReadonlyArray<string>, denyTools?: ReadonlyArray<string>): boolean;
96
- export declare function resolveToolSubset<T extends {
87
+ export declare function readAllowedToolList(allowTools: unknown): ToolNameListReach | undefined;
88
+ /** What a denied value hides: its string entries read as {@link readDeniedEntry} reads them (an entry that is not a string, or a value that is not a list, hides nothing). */
89
+ export declare function readDeniedToolList(denyTools: unknown): ToolNameListReach;
90
+ /** Does the list reach this tool — through its wire name, any alias it declares, or a protocol spelling that covers it? The one matcher. */
91
+ export declare function listReaches(reach: ToolNameListReach, tool: {
92
+ readonly name: string;
93
+ readonly aliases?: readonly string[];
94
+ }): boolean;
95
+ /** A member of a universe: a wire name and the other spellings it answers to. */
96
+ type UniverseTool = {
97
97
  readonly name: string;
98
98
  readonly aliases?: readonly string[];
99
- } = ToolSpec>(pool: ReadonlyArray<T>, allowTools?: ReadonlyArray<string>, denyTools?: ReadonlyArray<string>): T[];
99
+ };
100
+ /** The wire names a leg of these kinds relies on (the catalog's protocol column). */
101
+ export declare function protocolToolNames(legs: readonly ToolLegKind[]): string[];
100
102
  /**
101
- * What ONE agent's tool-name lists leave it, read once over everything it can get: the tools the delegation tool hands it
102
- * (`handed` — its pool and the factory's products, the subset in pool order) and the engine's hand tools its own run mounts
103
- * over an execution environment ({@link HAND_TOOLS} — `withheldHands`, the wire names the lists take away, which the spawn
104
- * adds to the child's exclusion list: the one fact every reader of "is this tool mounted" consults). One
105
- * {@link resolveToolSubset} call over both halves, so a name reads the same whichever half carries it. The exclusion list
106
- * unmounts by wire name, so a withheld hand name that a handed tool is mounted under stays off it (it would take the kept
107
- * tool with it); a handed tool's alias does not count — the exclusion never reaches an alias, so the hand tool stays withheld.
103
+ * Compile ONE run's tool selector from its layers (the ceiling it was spawned under, then its own lists — the LAST layer is its own)
104
+ * and the kinds of leg it is. Each list is read by the one reading ({@link readAllowedToolList} / {@link readDeniedToolList}) and
105
+ * matched by the one matcher ({@link listReaches}); a protocol tool of one of `legs` is admitted whatever the leg's own lists say —
106
+ * and whatever the ceiling says too, unless its row is one the leg shares with its spawner (`protocolUnderCeiling`: the ceiling
107
+ * layers decide it). Whether a list may reach a protocol tool at all is judged at prepare. The layers are kept as handed — the
108
+ * producer passes frozen copies of the lists it read.
108
109
  */
109
- export declare function resolveAgentToolSubset(pool: ReadonlyArray<ToolSpec>, allowTools?: ReadonlyArray<string>, denyTools?: ReadonlyArray<string>): {
110
- handed: ToolSpec[];
111
- withheldHands: string[];
112
- };
110
+ export declare function compileToolSelector(layers: readonly ToolSelectorLayer[], legs?: readonly ToolLegKind[]): ToolSelector;
111
+ /** One protocol tool a denylist reaches, and whose list it is: the leg's own (the last layer) or one it inherits (a ceiling layer). */
112
+ export interface DeniedProtocolTool {
113
+ readonly name: string;
114
+ readonly own: boolean;
115
+ }
116
+ /** The protocol tools of these leg kinds that a layer's denylist reaches — a contradiction the run refuses (the leg relies on the tool) —
117
+ * once per side that reaches it (a tool both its own list and an inherited one deny is two hits). */
118
+ export declare function deniedProtocolTools(layers: readonly ToolSelectorLayer[], legs: readonly ToolLegKind[]): DeniedProtocolTool[];
119
+ /** Is ONE tool name admitted by one allowed / denied pair (`"*"` sentinel; deny wins) — the selector's own answer for a single layer. */
120
+ export declare function toolNameAllowed(name: string, allowTools?: ReadonlyArray<string>, denyTools?: ReadonlyArray<string>): boolean;
121
+ /** The members of a pool one allowed / denied pair admits, in pool order (a fresh array; the pool is never mutated) — the selector's own answer for a single layer. */
122
+ export declare function resolveToolSubset<T extends UniverseTool = ToolSpec>(pool: ReadonlyArray<T>, allowTools?: ReadonlyArray<string>, denyTools?: ReadonlyArray<string>): T[];
123
+ export {};