@sema-agent/core 7.59.0 → 7.61.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 (643) hide show
  1. package/CHANGELOG.md +1169 -0
  2. package/README.md +2 -2
  3. package/dist/agents/agent-definition.d.ts +7 -0
  4. package/dist/agents/agent-definition.js +12 -0
  5. package/dist/agents/agent-transcript-tool.d.ts +4 -3
  6. package/dist/agents/agent-transcript-tool.js +4 -2
  7. package/dist/agents/cascade.d.ts +61 -10
  8. package/dist/agents/cascade.js +60 -20
  9. package/dist/agents/child-model-seat.js +6 -3
  10. package/dist/agents/composition-allowance.d.ts +53 -0
  11. package/dist/agents/composition-allowance.js +49 -0
  12. package/dist/agents/composition-placement.d.ts +29 -0
  13. package/dist/agents/composition-placement.js +24 -0
  14. package/dist/agents/cumulative-stats.d.ts +4 -0
  15. package/dist/agents/cumulative-stats.js +3 -1
  16. package/dist/agents/inherited-tool-pool.d.ts +28 -1
  17. package/dist/agents/inherited-tool-pool.js +22 -0
  18. package/dist/agents/list-agents-tool.d.ts +1 -1
  19. package/dist/agents/peer-notice-route.d.ts +1 -1
  20. package/dist/agents/peer-notice-route.js +4 -3
  21. package/dist/agents/peer-notices.d.ts +4 -4
  22. package/dist/agents/peer-notices.js +8 -4
  23. package/dist/agents/peer-session-drain.d.ts +8 -1
  24. package/dist/agents/peer-session-drain.js +36 -7
  25. package/dist/agents/repair-loop.js +16 -6
  26. package/dist/agents/retain-ledger.d.ts +11 -1
  27. package/dist/agents/retain-ledger.js +16 -3
  28. package/dist/agents/roster-store.d.ts +2 -2
  29. package/dist/agents/roster-store.js +8 -3
  30. package/dist/agents/send-message-tool.d.ts +14 -27
  31. package/dist/agents/send-message-tool.js +47 -54
  32. package/dist/agents/subagent-completion-gate.d.ts +35 -0
  33. package/dist/agents/subagent-completion-gate.js +62 -0
  34. package/dist/agents/subagent-steps.d.ts +7 -6
  35. package/dist/agents/subagent.d.ts +52 -28
  36. package/dist/agents/subagent.js +276 -246
  37. package/dist/agents/suspend-guard.d.ts +9 -0
  38. package/dist/agents/suspend-guard.js +4 -0
  39. package/dist/agents/tool-filter.d.ts +1 -3
  40. package/dist/agents/tool-filter.js +4 -12
  41. package/dist/agents/verify.d.ts +41 -14
  42. package/dist/agents/verify.js +37 -27
  43. package/dist/bench/metrics.d.ts +3 -5
  44. package/dist/bench/metrics.js +0 -1
  45. package/dist/brain/anthropic.js +1 -0
  46. package/dist/brain/degrading.js +3 -1
  47. package/dist/brain/errors.d.ts +7 -1
  48. package/dist/brain/errors.js +6 -0
  49. package/dist/brain/failover.js +2 -1
  50. package/dist/brain/open-responses.js +1 -0
  51. package/dist/brain/openai.js +1 -0
  52. package/dist/brain/provider-dialect.d.ts +10 -0
  53. package/dist/brain/provider-dialect.js +13 -2
  54. package/dist/brain/route-adjudicator.js +3 -1
  55. package/dist/brain/status-sink.d.ts +7 -1
  56. package/dist/brain/status-sink.js +6 -0
  57. package/dist/brain/stream-engine.d.ts +3 -0
  58. package/dist/brain/stream-engine.js +4 -0
  59. package/dist/brain/timeout.d.ts +3 -1
  60. package/dist/brain/timeout.js +18 -5
  61. package/dist/core/a2a.d.ts +15 -5
  62. package/dist/core/a2a.js +34 -19
  63. package/dist/core/agent-definition.d.ts +20 -0
  64. package/dist/core/agent-state.d.ts +1 -1
  65. package/dist/core/allow-entry.d.ts +61 -23
  66. package/dist/core/allow-entry.js +134 -39
  67. package/dist/core/artifact-host.d.ts +0 -2
  68. package/dist/core/artifact-host.js +0 -1
  69. package/dist/core/ask-origin.d.ts +79 -0
  70. package/dist/core/ask-origin.js +76 -0
  71. package/dist/core/ask-question.d.ts +19 -13
  72. package/dist/core/ask-question.js +8 -2
  73. package/dist/core/auto-compaction.d.ts +2 -0
  74. package/dist/core/auto-compaction.js +2 -1
  75. package/dist/core/auto-mode-defaults.d.ts +8 -0
  76. package/dist/core/auto-mode-defaults.js +1 -0
  77. package/dist/core/auto-mode-rebuild.d.ts +2 -1
  78. package/dist/core/auto-mode.d.ts +39 -4
  79. package/dist/core/auto-mode.js +66 -17
  80. package/dist/core/background-agent-store.d.ts +17 -6
  81. package/dist/core/background-agent-store.js +15 -13
  82. package/dist/core/background-shell.d.ts +12 -1
  83. package/dist/core/background-shell.js +12 -0
  84. package/dist/core/checkpoint-requirements.d.ts +24 -3
  85. package/dist/core/checkpoint-requirements.js +9 -1
  86. package/dist/core/checkpoint-store.d.ts +86 -32
  87. package/dist/core/checkpoint-store.js +10 -5
  88. package/dist/core/child-clamp-seats.d.ts +3 -2
  89. package/dist/core/child-clamp-seats.js +4 -3
  90. package/dist/core/closest-name.d.ts +13 -0
  91. package/dist/core/closest-name.js +35 -0
  92. package/dist/core/compliance.d.ts +1 -1
  93. package/dist/core/context-settings.js +3 -5
  94. package/dist/core/credential-echo.d.ts +52 -0
  95. package/dist/core/credential-echo.js +65 -0
  96. package/dist/core/credential-vocabulary.d.ts +13 -3
  97. package/dist/core/credential-vocabulary.js +12 -4
  98. package/dist/core/cross-boundary-taint.d.ts +5 -6
  99. package/dist/core/decision-receipt.d.ts +14 -1
  100. package/dist/core/decision-receipt.js +6 -3
  101. package/dist/core/delegation-frames.d.ts +13 -9
  102. package/dist/core/effective-path-target.js +2 -3
  103. package/dist/core/engine-attestation.d.ts +11 -1
  104. package/dist/core/engine-attestation.js +2 -0
  105. package/dist/core/engine-notice.d.ts +106 -32
  106. package/dist/core/file-history-retention.d.ts +8 -0
  107. package/dist/core/file-history-retention.js +14 -11
  108. package/dist/core/file-history-store.d.ts +31 -1
  109. package/dist/core/file-history-store.js +31 -2
  110. package/dist/core/frame-settlement.d.ts +15 -0
  111. package/dist/core/frame-settlement.js +10 -1
  112. package/dist/core/fs-write-gate-policy.d.ts +3 -3
  113. package/dist/core/fs-write-gate-policy.js +8 -7
  114. package/dist/core/gate-fold.js +9 -6
  115. package/dist/core/gate-lanes.js +46 -12
  116. package/dist/core/gate-outcome.d.ts +40 -1
  117. package/dist/core/gate-outcome.js +10 -0
  118. package/dist/core/git-worktree-env.d.ts +7 -3
  119. package/dist/core/git-worktree-env.js +16 -13
  120. package/dist/core/governance-codes.d.ts +19 -3
  121. package/dist/core/governance-codes.js +27 -3
  122. package/dist/core/hands-band-screen.js +0 -1
  123. package/dist/core/hands-band.d.ts +0 -3
  124. package/dist/core/hooks.d.ts +51 -60
  125. package/dist/core/hooks.js +131 -78
  126. package/dist/core/host-floor.js +3 -5
  127. package/dist/core/image-admission.d.ts +145 -52
  128. package/dist/core/image-admission.js +202 -47
  129. package/dist/core/image-downsample.d.ts +36 -69
  130. package/dist/core/image-downsample.js +111 -73
  131. package/dist/core/input-author.d.ts +36 -0
  132. package/dist/core/input-author.js +39 -0
  133. package/dist/core/integer-option.d.ts +21 -0
  134. package/dist/core/integer-option.js +13 -0
  135. package/dist/core/leg-identity.d.ts +62 -0
  136. package/dist/core/leg-identity.js +18 -0
  137. package/dist/core/locked-config.d.ts +55 -3
  138. package/dist/core/locked-config.js +84 -51
  139. package/dist/core/lsp.d.ts +5 -3
  140. package/dist/core/lsp.js +3 -2
  141. package/dist/core/mailbox-store.d.ts +85 -10
  142. package/dist/core/mailbox-store.js +31 -10
  143. package/dist/core/mcp-call-meta.d.ts +2 -2
  144. package/dist/core/mcp-call-meta.js +9 -10
  145. package/dist/core/mcp-connection-pool.d.ts +6 -20
  146. package/dist/core/mcp-connection-pool.js +10 -28
  147. package/dist/core/mcp-failure.d.ts +83 -16
  148. package/dist/core/mcp-failure.js +67 -30
  149. package/dist/core/mcp-host-seat.d.ts +131 -0
  150. package/dist/core/mcp-host-seat.js +305 -0
  151. package/dist/core/mcp-probe.d.ts +7 -2
  152. package/dist/core/mcp-probe.js +9 -4
  153. package/dist/core/mcp-server-link.d.ts +18 -6
  154. package/dist/core/mcp-server-link.js +19 -4
  155. package/dist/core/mcp-server-spec.d.ts +39 -9
  156. package/dist/core/mcp-server-spec.js +55 -21
  157. package/dist/core/mcp-session-end.d.ts +1 -2
  158. package/dist/core/mcp-session-end.js +1 -1
  159. package/dist/core/mcp.d.ts +23 -55
  160. package/dist/core/mcp.js +172 -156
  161. package/dist/core/media-byte-cap.d.ts +21 -46
  162. package/dist/core/media-byte-cap.js +55 -55
  163. package/dist/core/member-group.d.ts +7 -0
  164. package/dist/core/member-group.js +35 -0
  165. package/dist/core/memory-admission.d.ts +23 -6
  166. package/dist/core/memory-admission.js +19 -9
  167. package/dist/core/memory-engine/consolidation.d.ts +1 -1
  168. package/dist/core/memory-engine/consolidation.js +7 -1
  169. package/dist/core/memory-engine/content-origin.d.ts +13 -0
  170. package/dist/core/memory-engine/content-origin.js +21 -3
  171. package/dist/core/memory-engine/dual-root.d.ts +31 -0
  172. package/dist/core/memory-engine/dual-root.js +59 -11
  173. package/dist/core/memory-engine/engine.js +27 -24
  174. package/dist/core/memory-engine/file-backend.d.ts +13 -0
  175. package/dist/core/memory-engine/file-backend.js +35 -15
  176. package/dist/core/memory-engine/index.d.ts +2 -1
  177. package/dist/core/memory-engine/index.js +2 -1
  178. package/dist/core/memory-engine/layout.d.ts +3 -0
  179. package/dist/core/memory-engine/layout.js +13 -3
  180. package/dist/core/memory-engine/memory-deployment.d.ts +110 -0
  181. package/dist/core/memory-engine/memory-deployment.js +182 -0
  182. package/dist/core/memory-engine/scope-contract.d.ts +13 -3
  183. package/dist/core/memory-engine/scope-contract.js +2 -2
  184. package/dist/core/memory-engine/sync-client.d.ts +68 -13
  185. package/dist/core/memory-engine/sync-client.js +147 -18
  186. package/dist/core/memory-engine/sync-report.d.ts +106 -0
  187. package/dist/core/memory-engine/sync-report.js +119 -0
  188. package/dist/core/memory-engine/sync.d.ts +13 -3
  189. package/dist/core/mode-policy.d.ts +15 -7
  190. package/dist/core/mode-policy.js +18 -6
  191. package/dist/core/model-receipt.d.ts +39 -0
  192. package/dist/core/model-receipt.js +139 -0
  193. package/dist/core/mods/agent-stations.d.ts +100 -0
  194. package/dist/core/mods/agent-stations.js +154 -0
  195. package/dist/core/mods/dollar.d.ts +62 -0
  196. package/dist/core/mods/extension-call.d.ts +15 -1
  197. package/dist/core/mods/extension-call.js +7 -2
  198. package/dist/core/mods/kernel/dispatch.d.ts +9 -4
  199. package/dist/core/mods/kernel/dispatch.js +8 -8
  200. package/dist/core/mods/kernel/events.d.ts +13 -4
  201. package/dist/core/mods/kernel/events.js +14 -10
  202. package/dist/core/mods/kernel/receive.d.ts +5 -0
  203. package/dist/core/mods/kernel/receive.js +10 -0
  204. package/dist/core/mods/kernel/registration.d.ts +3 -0
  205. package/dist/core/mods/kernel/registration.js +5 -0
  206. package/dist/core/mods/kernel/site-rules.d.ts +6 -3
  207. package/dist/core/mods/kernel/site-rules.js +10 -2
  208. package/dist/core/mods/lifecycle-stations.d.ts +41 -0
  209. package/dist/core/mods/lifecycle-stations.js +35 -0
  210. package/dist/core/mods/session-append.d.ts +115 -0
  211. package/dist/core/mods/session-append.js +311 -0
  212. package/dist/core/mods/session-compact.d.ts +48 -0
  213. package/dist/core/mods/session-compact.js +194 -0
  214. package/dist/core/mods/session-receive.d.ts +93 -0
  215. package/dist/core/mods/session-receive.js +141 -0
  216. package/dist/core/mods/session-send.d.ts +72 -0
  217. package/dist/core/mods/session-send.js +88 -0
  218. package/dist/core/mods/stations.d.ts +89 -75
  219. package/dist/core/mods/stations.js +57 -53
  220. package/dist/core/mods/tool-call.d.ts +12 -4
  221. package/dist/core/mods/tool-call.js +32 -16
  222. package/dist/core/mounted-mcp.d.ts +5 -0
  223. package/dist/core/mounted-mcp.js +2 -2
  224. package/dist/core/namespaced-rule-name.d.ts +7 -1
  225. package/dist/core/namespaced-rule-name.js +13 -2
  226. package/dist/core/oracle-isolation.js +1 -1
  227. package/dist/core/output-style.js +3 -4
  228. package/dist/core/own-property-receipt.d.ts +62 -0
  229. package/dist/core/own-property-receipt.js +43 -0
  230. package/dist/core/park-selfcheck.js +12 -10
  231. package/dist/core/path-identity.d.ts +11 -0
  232. package/dist/core/path-identity.js +4 -0
  233. package/dist/core/path-rule-binding.d.ts +3 -1
  234. package/dist/core/path-rule-binding.js +3 -1
  235. package/dist/core/peer-seat.d.ts +66 -11
  236. package/dist/core/peer-seat.js +199 -42
  237. package/dist/core/permission-rule-consent.d.ts +21 -26
  238. package/dist/core/permission-rule-consent.js +22 -3
  239. package/dist/core/permission-rule-model.d.ts +38 -13
  240. package/dist/core/permission-rule-model.js +54 -16
  241. package/dist/core/permission-rule-org.d.ts +1 -1
  242. package/dist/core/permission-rule-provider.js +4 -1
  243. package/dist/core/permission-rules.d.ts +4 -0
  244. package/dist/core/permission-rules.js +11 -16
  245. package/dist/core/protocol-http-auth.d.ts +14 -2
  246. package/dist/core/protocol-http-auth.js +16 -7
  247. package/dist/core/read-face-seats.d.ts +7 -5
  248. package/dist/core/read-face-seats.js +4 -1
  249. package/dist/core/redaction-marks.d.ts +4 -3
  250. package/dist/core/redaction-marks.js +2 -2
  251. package/dist/core/remote-env.d.ts +218 -122
  252. package/dist/core/remote-env.js +133 -14
  253. package/dist/core/retention-policy.d.ts +24 -23
  254. package/dist/core/retention-policy.js +36 -2
  255. package/dist/core/retention.d.ts +4 -1
  256. package/dist/core/retention.js +37 -12
  257. package/dist/core/retired-keys.d.ts +8 -3
  258. package/dist/core/retired-keys.js +4 -1
  259. package/dist/core/rewrite-rejudge.d.ts +12 -5
  260. package/dist/core/rewrite-rejudge.js +9 -5
  261. package/dist/core/roles.d.ts +37 -3
  262. package/dist/core/roles.js +126 -78
  263. package/dist/core/row-admission.d.ts +10 -0
  264. package/dist/core/row-admission.js +5 -0
  265. package/dist/core/rule-owner.d.ts +3 -0
  266. package/dist/core/runner/advisor-instructions.d.ts +2 -1
  267. package/dist/core/runner/advisor-instructions.js +2 -1
  268. package/dist/core/runner/announce-once-ledger.d.ts +4 -4
  269. package/dist/core/runner/assemble-result.d.ts +13 -8
  270. package/dist/core/runner/assemble-result.js +12 -8
  271. package/dist/core/runner/call-hook-stations.d.ts +17 -10
  272. package/dist/core/runner/call-hook-stations.js +21 -10
  273. package/dist/core/runner/caller-roster.d.ts +12 -9
  274. package/dist/core/runner/caller-roster.js +5 -2
  275. package/dist/core/runner/checkpoint-scope.d.ts +16 -1
  276. package/dist/core/runner/checkpoint-scope.js +21 -0
  277. package/dist/core/runner/child-tree.d.ts +7 -8
  278. package/dist/core/runner/child-tree.js +6 -6
  279. package/dist/core/runner/classifier-ladder.d.ts +10 -2
  280. package/dist/core/runner/classifier-ladder.js +39 -8
  281. package/dist/core/runner/compact-session.js +14 -2
  282. package/dist/core/runner/compaction-call-options.d.ts +1 -1
  283. package/dist/core/runner/compaction-restate.d.ts +2 -2
  284. package/dist/core/runner/compaction-restate.js +4 -3
  285. package/dist/core/runner/construction-doors.d.ts +2 -2
  286. package/dist/core/runner/construction-doors.js +7 -2
  287. package/dist/core/runner/contracts.d.ts +158 -65
  288. package/dist/core/runner/cross-boundary-lane.d.ts +4 -6
  289. package/dist/core/runner/cross-boundary-lane.js +11 -2
  290. package/dist/core/runner/decide-continuation.d.ts +4 -2
  291. package/dist/core/runner/decide-continuation.js +7 -4
  292. package/dist/core/runner/denial-limit-arms.d.ts +15 -21
  293. package/dist/core/runner/denial-limit-arms.js +17 -10
  294. package/dist/core/runner/env-capability-census.d.ts +15 -20
  295. package/dist/core/runner/env-capability-census.js +25 -34
  296. package/dist/core/runner/expire-settle.d.ts +44 -0
  297. package/dist/core/runner/expire-settle.js +55 -0
  298. package/dist/core/runner/file-history-request.d.ts +2 -2
  299. package/dist/core/runner/file-history-request.js +0 -8
  300. package/dist/core/runner/gate-exit.d.ts +75 -7
  301. package/dist/core/runner/gate-exit.js +20 -1
  302. package/dist/core/runner/git-status-frame.d.ts +5 -2
  303. package/dist/core/runner/git-status-frame.js +4 -4
  304. package/dist/core/runner/halt-attribution.d.ts +2 -1
  305. package/dist/core/runner/halt-attribution.js +2 -1
  306. package/dist/core/runner/image.d.ts +7 -2
  307. package/dist/core/runner/image.js +14 -8
  308. package/dist/core/runner/inline-image.d.ts +10 -8
  309. package/dist/core/runner/inline-image.js +11 -9
  310. package/dist/core/runner/local-claims.d.ts +17 -0
  311. package/dist/core/runner/local-claims.js +18 -0
  312. package/dist/core/runner/media-removed-seat.d.ts +46 -0
  313. package/dist/core/runner/media-removed-seat.js +88 -0
  314. package/dist/core/runner/memory-consolidation-driver.js +4 -4
  315. package/dist/core/runner/park-commit.d.ts +2 -2
  316. package/dist/core/runner/permission-rule-lanes.d.ts +5 -1
  317. package/dist/core/runner/permission-rule-lanes.js +29 -10
  318. package/dist/core/runner/person-path-rows.js +1 -1
  319. package/dist/core/runner/placement-fence.d.ts +26 -0
  320. package/dist/core/runner/placement-fence.js +38 -0
  321. package/dist/core/runner/prepare-ask-lane.d.ts +6 -12
  322. package/dist/core/runner/prepare-ask-lane.js +4 -4
  323. package/dist/core/runner/prepare-boundary-parks.d.ts +6 -3
  324. package/dist/core/runner/prepare-boundary-parks.js +4 -4
  325. package/dist/core/runner/prepare-caps-and-workflow.d.ts +6 -0
  326. package/dist/core/runner/prepare-caps-and-workflow.js +5 -3
  327. package/dist/core/runner/prepare-config-doors.d.ts +6 -1
  328. package/dist/core/runner/prepare-config-doors.js +30 -26
  329. package/dist/core/runner/prepare-context-lane.d.ts +6 -2
  330. package/dist/core/runner/prepare-context-lane.js +13 -13
  331. package/dist/core/runner/prepare-delegation-surface.d.ts +13 -11
  332. package/dist/core/runner/prepare-delegation-surface.js +7 -8
  333. package/dist/core/runner/prepare-execution-env.d.ts +5 -2
  334. package/dist/core/runner/prepare-execution-env.js +7 -4
  335. package/dist/core/runner/prepare-file-history.d.ts +10 -12
  336. package/dist/core/runner/prepare-file-history.js +3 -12
  337. package/dist/core/runner/prepare-gate-stations.d.ts +23 -17
  338. package/dist/core/runner/prepare-gate-stations.js +10 -7
  339. package/dist/core/runner/prepare-hands-readface.d.ts +8 -6
  340. package/dist/core/runner/prepare-hands-readface.js +19 -11
  341. package/dist/core/runner/prepare-inherited-gate.d.ts +11 -4
  342. package/dist/core/runner/prepare-inherited-gate.js +12 -5
  343. package/dist/core/runner/prepare-lsp.d.ts +3 -0
  344. package/dist/core/runner/prepare-lsp.js +2 -2
  345. package/dist/core/runner/prepare-memory-engine-session.js +1 -1
  346. package/dist/core/runner/prepare-memory.d.ts +2 -2
  347. package/dist/core/runner/prepare-memory.js +2 -2
  348. package/dist/core/runner/prepare-park-ask.d.ts +8 -7
  349. package/dist/core/runner/prepare-park-ask.js +6 -12
  350. package/dist/core/runner/prepare-policy-chain.d.ts +15 -25
  351. package/dist/core/runner/prepare-policy-chain.js +131 -128
  352. package/dist/core/runner/prepare-project-context.d.ts +2 -2
  353. package/dist/core/runner/prepare-project-context.js +8 -5
  354. package/dist/core/runner/prepare-prompt-inputs.d.ts +4 -0
  355. package/dist/core/runner/prepare-prompt-inputs.js +4 -2
  356. package/dist/core/runner/prepare-protocol-tools.d.ts +5 -3
  357. package/dist/core/runner/prepare-protocol-tools.js +9 -2
  358. package/dist/core/runner/prepare-question-face.d.ts +6 -4
  359. package/dist/core/runner/prepare-question-face.js +2 -2
  360. package/dist/core/runner/prepare-run-refs.d.ts +3 -0
  361. package/dist/core/runner/prepare-run-refs.js +2 -2
  362. package/dist/core/runner/prepare-suspend-saga.d.ts +11 -9
  363. package/dist/core/runner/prepare-suspend-saga.js +21 -13
  364. package/dist/core/runner/prepare-task.d.ts +1 -1
  365. package/dist/core/runner/prepare-task.js +84 -42
  366. package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +6 -0
  367. package/dist/core/runner/prepare-tool-disclosure-mount.js +3 -1
  368. package/dist/core/runner/prepare-turn-wiring.d.ts +2 -0
  369. package/dist/core/runner/prepare-turn-wiring.js +7 -2
  370. package/dist/core/runner/prepare-wiring-manifest.d.ts +7 -3
  371. package/dist/core/runner/prepare-wiring-manifest.js +34 -19
  372. package/dist/core/runner/prepare-workspace-restore.d.ts +5 -0
  373. package/dist/core/runner/prepare-workspace-restore.js +12 -8
  374. package/dist/core/runner/read-root-grant.d.ts +1 -1
  375. package/dist/core/runner/read-root-grant.js +2 -1
  376. package/dist/core/runner/resume-admission.d.ts +5 -3
  377. package/dist/core/runner/resume-admission.js +17 -3
  378. package/dist/core/runner/resume-apply.js +3 -1
  379. package/dist/core/runner/resume-checkpoint-screen.js +4 -4
  380. package/dist/core/runner/resume-claim.d.ts +8 -3
  381. package/dist/core/runner/resume-claim.js +28 -12
  382. package/dist/core/runner/resume-internals-and-config.d.ts +2 -2
  383. package/dist/core/runner/resume-internals-and-config.js +10 -1
  384. package/dist/core/runner/resume-preflight.d.ts +3 -2
  385. package/dist/core/runner/resume-preflight.js +13 -26
  386. package/dist/core/runner/retired-runner-deps.js +6 -1
  387. package/dist/core/runner/run-attachment-seats.js +3 -3
  388. package/dist/core/runner/run-brain-sinks.js +1 -0
  389. package/dist/core/runner/run-git-lane.d.ts +3 -1
  390. package/dist/core/runner/run-git-lane.js +3 -2
  391. package/dist/core/runner/run-harness-handlers.d.ts +3 -1
  392. package/dist/core/runner/run-harness-handlers.js +5 -3
  393. package/dist/core/runner/run-identity-wiring.d.ts +2 -2
  394. package/dist/core/runner/run-identity-wiring.js +15 -6
  395. package/dist/core/runner/run-leg.d.ts +3 -3
  396. package/dist/core/runner/run-leg.js +65 -56
  397. package/dist/core/runner/run-notification-lane.d.ts +3 -1
  398. package/dist/core/runner/run-notification-lane.js +36 -12
  399. package/dist/core/runner/run-recovery-lanes.js +3 -2
  400. package/dist/core/runner/run-settle-and-teardown.js +14 -8
  401. package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
  402. package/dist/core/runner/run-stop-and-final-verify.js +12 -4
  403. package/dist/core/runner/run-telemetry-and-budget-seats.d.ts +1 -1
  404. package/dist/core/runner/run-terminal-adoption.d.ts +1 -1
  405. package/dist/core/runner/run-terminal-adoption.js +26 -17
  406. package/dist/core/runner/run-turn-boundary.js +37 -19
  407. package/dist/core/runner/runtask.d.ts +25 -7
  408. package/dist/core/runner/runtask.js +46 -22
  409. package/dist/core/runner/session-rule-policy.d.ts +1 -1
  410. package/dist/core/runner/session-rule-policy.js +6 -1
  411. package/dist/core/runner/shell-env-withheld.d.ts +1 -1
  412. package/dist/core/runner/skills-seat.js +2 -2
  413. package/dist/core/runner/stream-halt-verbs.d.ts +1 -14
  414. package/dist/core/runner/stream-halt-verbs.js +4 -3
  415. package/dist/core/runner/stream-reap.d.ts +7 -6
  416. package/dist/core/runner/stream-reap.js +13 -16
  417. package/dist/core/runner/stream-settle-backstop.d.ts +3 -2
  418. package/dist/core/runner/stream-settle-backstop.js +5 -3
  419. package/dist/core/runner/stream-steer-verb.d.ts +5 -2
  420. package/dist/core/runner/stream-steer-verb.js +8 -7
  421. package/dist/core/runner/sub-agent-deny-lists.js +10 -7
  422. package/dist/core/runner/synthetic-tools.js +2 -2
  423. package/dist/core/runner/terminal-account.d.ts +11 -1
  424. package/dist/core/runner/terminal-account.js +20 -0
  425. package/dist/core/runner/terminal-projection.d.ts +8 -2
  426. package/dist/core/runner/terminal-projection.js +2 -2
  427. package/dist/core/runner/tool-disclosure.d.ts +3 -0
  428. package/dist/core/runner/tool-disclosure.js +5 -4
  429. package/dist/core/runner/tool-end-body.d.ts +3 -3
  430. package/dist/core/runner/tool-end-body.js +1 -1
  431. package/dist/core/runner/tool-face-overlay.d.ts +1 -1
  432. package/dist/core/runner/tool-face-overlay.js +26 -19
  433. package/dist/core/runner/tool-output-projection.d.ts +3 -3
  434. package/dist/core/runner/tool-output-projection.js +7 -6
  435. package/dist/core/runner/tool-result-media-seat.d.ts +9 -1
  436. package/dist/core/runner/tool-result-media-seat.js +17 -1
  437. package/dist/core/runner/tool-table-view.d.ts +56 -0
  438. package/dist/core/runner/tool-table-view.js +51 -0
  439. package/dist/core/runner/turn-attachments.d.ts +6 -7
  440. package/dist/core/runner/turn-attachments.js +4 -17
  441. package/dist/core/runner/void-verifier-pause.d.ts +33 -0
  442. package/dist/core/runner/void-verifier-pause.js +41 -0
  443. package/dist/core/runner-deps.d.ts +55 -43
  444. package/dist/core/secret-env.d.ts +14 -13
  445. package/dist/core/secret-env.js +8 -9
  446. package/dist/core/session-log-transfer.js +9 -10
  447. package/dist/core/session-policy-store.d.ts +10 -3
  448. package/dist/core/session-policy-store.js +21 -3
  449. package/dist/core/session-reconcile.d.ts +3 -2
  450. package/dist/core/session-reconcile.js +7 -4
  451. package/dist/core/session-store.d.ts +5 -2
  452. package/dist/core/session-store.js +53 -16
  453. package/dist/core/session.d.ts +2 -1
  454. package/dist/core/shell-confinement.d.ts +37 -0
  455. package/dist/core/shell-confinement.js +56 -0
  456. package/dist/core/skill-grant.d.ts +9 -0
  457. package/dist/core/skill-grant.js +18 -0
  458. package/dist/core/store-contracts/checkpoint-store-contract.d.ts +2 -2
  459. package/dist/core/store-contracts/checkpoint-store-contract.js +15 -2
  460. package/dist/core/store-contracts/file-history-store-contract.d.ts +5 -2
  461. package/dist/core/store-contracts/file-history-store-contract.js +25 -1
  462. package/dist/core/store-contracts/mailbox-store-contract.d.ts +12 -5
  463. package/dist/core/store-contracts/mailbox-store-contract.js +156 -9
  464. package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
  465. package/dist/core/store-contracts/tool-result-store-contract.js +67 -0
  466. package/dist/core/stub-env.d.ts +5 -5
  467. package/dist/core/stub-env.js +11 -1
  468. package/dist/core/swappable-deps.d.ts +17 -43
  469. package/dist/core/swappable-deps.js +15 -5
  470. package/dist/core/synthetic-read-verdict.d.ts +1 -1
  471. package/dist/core/task-event.d.ts +35 -10
  472. package/dist/core/task-limits.d.ts +5 -0
  473. package/dist/core/task-notification.d.ts +172 -12
  474. package/dist/core/task-notification.js +209 -12
  475. package/dist/core/task-registry-agent.d.ts +23 -55
  476. package/dist/core/task-registry-agent.js +41 -56
  477. package/dist/core/task-registry-monitor.d.ts +8 -1
  478. package/dist/core/task-registry-monitor.js +43 -61
  479. package/dist/core/task-registry-shared.d.ts +52 -114
  480. package/dist/core/task-registry-shared.js +24 -48
  481. package/dist/core/task-registry-workflow.js +5 -22
  482. package/dist/core/task-registry.d.ts +64 -90
  483. package/dist/core/task-registry.js +73 -119
  484. package/dist/core/task-result.d.ts +27 -19
  485. package/dist/core/task-spec-members.d.ts +39 -0
  486. package/dist/core/task-spec-members.js +92 -0
  487. package/dist/core/task-spec.d.ts +13 -16
  488. package/dist/core/task-stream.d.ts +1 -1
  489. package/dist/core/task-tool-shape.d.ts +7 -57
  490. package/dist/core/task-tool-shape.js +7 -66
  491. package/dist/core/terminal-cause.d.ts +30 -0
  492. package/dist/core/terminal-cause.js +1 -0
  493. package/dist/core/tool-catalog-entries.js +3 -6
  494. package/dist/core/tool-check-reading.js +16 -10
  495. package/dist/core/tool-conformance.js +1 -2
  496. package/dist/core/tool-errors.d.ts +6 -3
  497. package/dist/core/tool-errors.js +2 -0
  498. package/dist/core/tool-face-reader.d.ts +7 -6
  499. package/dist/core/tool-face-reader.js +6 -4
  500. package/dist/core/tool-face.d.ts +2 -3
  501. package/dist/core/tool-name-aliases.d.ts +23 -28
  502. package/dist/core/tool-name-aliases.js +63 -7
  503. package/dist/core/tool-name-readings.d.ts +14 -3
  504. package/dist/core/tool-name-readings.js +2 -0
  505. package/dist/core/tool-policy.d.ts +113 -22
  506. package/dist/core/tool-policy.js +85 -15
  507. package/dist/core/tool-registry.d.ts +5 -5
  508. package/dist/core/tool-registry.js +2 -2
  509. package/dist/core/tool-result-store.d.ts +111 -5
  510. package/dist/core/tool-result-store.js +52 -12
  511. package/dist/core/tool-spec.d.ts +39 -10
  512. package/dist/core/trace.d.ts +18 -2
  513. package/dist/core/types.d.ts +3 -3
  514. package/dist/core/types.js +1 -1
  515. package/dist/core/untrusted-text.js +1 -1
  516. package/dist/core/user-attachment.d.ts +10 -5
  517. package/dist/core/user-attachment.js +40 -27
  518. package/dist/core/workflow-journal-store.d.ts +1 -1
  519. package/dist/core/workflow-run-store.d.ts +2 -0
  520. package/dist/core/workflow-run-store.js +6 -5
  521. package/dist/core/workflow-settled-run.d.ts +5 -0
  522. package/dist/core/workflow-settled-run.js +7 -0
  523. package/dist/engine/execution-env/node-execution-env.d.ts +37 -7
  524. package/dist/engine/execution-env/node-execution-env.js +224 -21
  525. package/dist/engine/harness/agent-harness.d.ts +66 -19
  526. package/dist/engine/harness/agent-harness.js +98 -27
  527. package/dist/engine/harness/messages.d.ts +4 -3
  528. package/dist/engine/harness/messages.js +2 -2
  529. package/dist/engine/harness/types.d.ts +151 -34
  530. package/dist/engine/llm/media-removed.d.ts +14 -0
  531. package/dist/engine/llm/media-removed.js +9 -0
  532. package/dist/engine/llm/rejected-images.d.ts +35 -25
  533. package/dist/engine/llm/rejected-images.js +59 -10
  534. package/dist/engine/llm/types.d.ts +24 -3
  535. package/dist/engine/llm/types.js +7 -3
  536. package/dist/engine/loop/agent-loop.d.ts +18 -13
  537. package/dist/engine/loop/agent-loop.js +173 -32
  538. package/dist/engine/loop/types.d.ts +21 -5
  539. package/dist/engine/lsp/node-lsp-manager.d.ts +3 -3
  540. package/dist/engine/lsp/node-lsp-manager.js +32 -13
  541. package/dist/engine/session/import-validate.js +7 -0
  542. package/dist/fixtures/index.d.ts +7 -5
  543. package/dist/fixtures/index.js +5 -3
  544. package/dist/index.d.ts +41 -23
  545. package/dist/index.js +29 -16
  546. package/dist/internal/harness-types.d.ts +3 -1
  547. package/dist/internal/llm.d.ts +2 -1
  548. package/dist/internal/llm.js +1 -0
  549. package/dist/orchestration/goal.d.ts +6 -2
  550. package/dist/orchestration/goal.js +6 -3
  551. package/dist/orchestration/run-workflow-tool.d.ts +20 -20
  552. package/dist/orchestration/run-workflow-tool.js +63 -56
  553. package/dist/orchestration/workflow-governance.d.ts +1 -1
  554. package/dist/orchestration/workflow-governance.js +2 -1
  555. package/dist/orchestration/workflow-types.d.ts +2 -2
  556. package/dist/orchestration/workflow.d.ts +8 -0
  557. package/dist/orchestration/workflow.js +33 -9
  558. package/dist/prompts/default.d.ts +1 -10
  559. package/dist/prompts/default.js +0 -2
  560. package/dist/stores/file/background-agent-store.d.ts +1 -1
  561. package/dist/stores/file/background-agent-store.js +19 -14
  562. package/dist/stores/file/checkpoint-store.d.ts +127 -2
  563. package/dist/stores/file/checkpoint-store.js +24 -16
  564. package/dist/stores/file/file-history-store.d.ts +1 -1
  565. package/dist/stores/file/file-history-store.js +4 -1
  566. package/dist/stores/file/index.d.ts +9 -6
  567. package/dist/stores/file/index.js +33 -9
  568. package/dist/stores/file/ledger-tuning.d.ts +23 -0
  569. package/dist/stores/file/ledger-tuning.js +21 -0
  570. package/dist/stores/file/mailbox-store.d.ts +1 -1
  571. package/dist/stores/file/mailbox-store.js +43 -21
  572. package/dist/stores/file/memory-store.d.ts +1 -1
  573. package/dist/stores/file/memory-store.js +4 -1
  574. package/dist/stores/file/permission-rule-adopt.js +24 -21
  575. package/dist/stores/file/permission-rule-store.js +6 -3
  576. package/dist/stores/file/session-policy-store.d.ts +1 -1
  577. package/dist/stores/file/session-policy-store.js +4 -1
  578. package/dist/stores/file/session-store.d.ts +17 -4
  579. package/dist/stores/file/session-store.js +22 -19
  580. package/dist/stores/file/shared-ledger.d.ts +26 -0
  581. package/dist/stores/file/shared-ledger.js +38 -9
  582. package/dist/stores/file/tool-result-store.d.ts +31 -2
  583. package/dist/stores/file/tool-result-store.js +129 -7
  584. package/dist/stores/file/usage-window-store.d.ts +1 -1
  585. package/dist/stores/file/usage-window-store.js +4 -1
  586. package/dist/stores/file/workflow-journal-store.d.ts +1 -13
  587. package/dist/stores/file/workflow-journal-store.js +4 -18
  588. package/dist/stores/file/workflow-run-store.d.ts +1 -1
  589. package/dist/stores/file/workflow-run-store.js +15 -10
  590. package/dist/tools/fs/containment-face.d.ts +5 -0
  591. package/dist/tools/fs/dead-cwd.d.ts +5 -5
  592. package/dist/tools/fs/dead-cwd.js +4 -11
  593. package/dist/tools/fs/encoding.d.ts +13 -4
  594. package/dist/tools/fs/encoding.js +17 -2
  595. package/dist/tools/fs/fs-bash-background-text.d.ts +13 -0
  596. package/dist/tools/fs/fs-bash-background-text.js +7 -0
  597. package/dist/tools/fs/fs-bash.d.ts +11 -22
  598. package/dist/tools/fs/fs-bash.js +58 -154
  599. package/dist/tools/fs/fs-pdf.d.ts +2 -2
  600. package/dist/tools/fs/fs-pdf.js +34 -27
  601. package/dist/tools/fs/fs-read.d.ts +5 -4
  602. package/dist/tools/fs/fs-read.js +35 -18
  603. package/dist/tools/fs/fs-search-tools.js +4 -1
  604. package/dist/tools/fs/fs-shared.d.ts +39 -16
  605. package/dist/tools/fs/fs-shared.js +25 -6
  606. package/dist/tools/fs/fs-write.js +5 -5
  607. package/dist/tools/fs/index.d.ts +15 -9
  608. package/dist/tools/fs/index.js +12 -18
  609. package/dist/tools/fs/pdf.d.ts +4 -4
  610. package/dist/tools/fs/pdf.js +6 -6
  611. package/dist/tools/fs/read-deny-home.js +8 -1
  612. package/dist/tools/fs/read-deny.d.ts +26 -2
  613. package/dist/tools/fs/read-deny.js +9 -2
  614. package/dist/tools/fs/read-floor.d.ts +57 -6
  615. package/dist/tools/fs/read-floor.js +241 -2
  616. package/dist/tools/fs/removal-targets.d.ts +9 -4
  617. package/dist/tools/fs/removal-targets.js +17 -9
  618. package/dist/tools/fs/search.d.ts +6 -5
  619. package/dist/tools/fs/search.js +10 -10
  620. package/dist/tools/fs/shell-read-establish.js +3 -1
  621. package/dist/tools/fs/shell-read-identity.d.ts +3 -1
  622. package/dist/tools/fs/shell-read-identity.js +4 -2
  623. package/dist/tools/fs/shell-read-judge.d.ts +7 -1
  624. package/dist/tools/fs/shell-read-judge.js +1 -1
  625. package/dist/tools/monitor.d.ts +12 -10
  626. package/dist/tools/monitor.js +22 -13
  627. package/dist/tools/scheduler-tools.js +42 -4
  628. package/dist/tools/web.d.ts +0 -10
  629. package/dist/tools/web.js +1 -4
  630. package/dist/tools/worktree.d.ts +5 -1
  631. package/dist/tools/worktree.js +20 -17
  632. package/package.json +8 -3
  633. package/test/export-surface.snapshot.json +166 -30
  634. package/wire-changes/core-stores-sql@7.60.0.json +30 -0
  635. package/wire-changes/core-stores-sql@7.61.0.json +480 -0
  636. package/wire-changes/core@7.60.0.json +3274 -0
  637. package/wire-changes/core@7.61.0.json +4405 -0
  638. package/wire-changes/mods-kernel@7.60.0.json +62 -0
  639. package/wire-changes/mods-kernel@7.61.0.json +65 -0
  640. package/wire-changes/primitives@7.60.0.json +30 -0
  641. package/wire-changes/primitives@7.61.0.json +30 -0
  642. package/dist/core/runner/image-removed-seat.d.ts +0 -12
  643. package/dist/core/runner/image-removed-seat.js +0 -19
@@ -3,6 +3,12 @@ const statusSinkStore = new AsyncLocalStorage();
3
3
  export function runWithStatusSink(emit, fn) {
4
4
  return statusSinkStore.run({ emit }, fn);
5
5
  }
6
+ export function withStatusSeat(seat, fn) {
7
+ const outer = statusSinkStore.getStore();
8
+ if (outer === undefined)
9
+ return fn();
10
+ return statusSinkStore.run({ emit: (s) => outer.emit(s.seat === undefined ? { ...s, seat } : s) }, fn);
11
+ }
6
12
  export function bindBrainStatusEmitter() {
7
13
  const sink = statusSinkStore.getStore();
8
14
  if (sink === undefined)
@@ -116,6 +116,9 @@ export interface SSERequest {
116
116
  */
117
117
  declared: readonly string[];
118
118
  body: string;
119
+ /** The engine name of each tool the body's tool list carries, in its order: a tool-schema refusal located by position
120
+ * ({@link ProviderVerdict.toolSchemaAt}) names the tool at it (`BrainError.toolSchemaRefused`). Absent = no tool list. */
121
+ toolNames?: readonly string[];
119
122
  /**
120
123
  * The per-request output cap this request ACTUALLY carries on the wire, when the adapter sets one
121
124
  * (the adapters disagree on the body key, so the engine cannot read it off `body`). Absent means
@@ -337,6 +337,8 @@ export function runStreamingBrain(args) {
337
337
  if (failure.code !== undefined) {
338
338
  if (failure.errorKind !== undefined)
339
339
  errorMsg.errorKind = failure.errorKind;
340
+ if (failure.refusedTool !== undefined)
341
+ errorMsg.refusedTool = failure.refusedTool;
340
342
  if (failure.inputTooLongRuledOut === true)
341
343
  errorMsg.inputTooLongRuledOut = true;
342
344
  if (readMember(err, "errorBodyIncomplete") === true)
@@ -692,10 +694,12 @@ export function runStreamingBrain(args) {
692
694
  const status = r?.status ?? 0;
693
695
  const itl = terminalVerdict?.inputTooLong ?? "no";
694
696
  const providerCode = refusedTheRequest(status) ? readProviderErrorCode(errorBody) : undefined;
697
+ const refusedTool = terminalVerdict?.toolSchemaAt !== undefined ? req.toolNames?.[terminalVerdict.toolSchemaAt] : undefined;
695
698
  throw new BrainError(classifyHttp(status), `${httpLabel} HTTP ${status || "ERR"}: ${detail.slice(0, 500)}${overflowDeclineNote}`, status, {
696
699
  apiError: true,
697
700
  ...(itl === "yes" ? { inputTooLong: true } : itl === "no" ? { inputTooLongRuledOut: true } : {}),
698
701
  ...(terminalVerdict?.imageUnprocessable === true ? { imageUnprocessable: true } : {}),
702
+ ...(refusedTool !== undefined ? { toolSchemaRefused: refusedTool } : {}),
699
703
  ...(providerCode !== undefined ? { providerCode } : {}),
700
704
  ...(terminalVerdict !== undefined ? { verdict: { condition: terminalVerdict.condition, source: terminalVerdict.source, ...(terminalVerdict.resetAtMs !== undefined ? { resetAtMs: terminalVerdict.resetAtMs } : {}) } } : {}),
701
705
  ...(errorBody !== undefined && !errorBody.endedNormally ? { errorBodyIncomplete: true } : {}),
@@ -278,6 +278,8 @@ export interface BrainCallGuardrailRef {
278
278
  *
279
279
  * `return()` on the wrapped iterator forwards the inner cleanup WITHOUT awaiting it: the whole point
280
280
  * is that the engine stops waiting on a brain, so releasing the iterator must not re-introduce a wait
281
- * on the same hung code.
281
+ * on the same hung code. A `return()` before the brain's terminal event abandons the call: the signal the
282
+ * brain holds is aborted first, since a stream's own `return()` need not cancel its request and, once the
283
+ * gate is disarmed, no outer abort reaches the brain any more.
282
284
  */
283
285
  export declare function withBrainCallGuardrail(streamFn: StreamFn, limitMs: number, ref: BrainCallGuardrailRef): StreamFn;
@@ -224,6 +224,7 @@ function armCallGuardrail(limitMs, outerSignal, ref) {
224
224
  outerSignal.addEventListener("abort", forwardAbort, { once: true });
225
225
  }
226
226
  let expired;
227
+ let over = false;
227
228
  let rejectExpiry = () => undefined;
228
229
  const expiry = new Promise((_resolve, reject) => {
229
230
  rejectExpiry = reject;
@@ -246,12 +247,22 @@ function armCallGuardrail(limitMs, outerSignal, ref) {
246
247
  throw expired;
247
248
  return value;
248
249
  },
249
- disarm: () => {
250
- clearTimeout(timer);
251
- if (outerSignal !== undefined)
252
- outerSignal.removeEventListener("abort", forwardAbort);
250
+ disarm,
251
+ answered: () => {
252
+ over = true;
253
+ },
254
+ abandon: () => {
255
+ if (!over)
256
+ ac.abort();
257
+ disarm();
253
258
  },
254
259
  };
260
+ function disarm() {
261
+ over = true;
262
+ clearTimeout(timer);
263
+ if (outerSignal !== undefined)
264
+ outerSignal.removeEventListener("abort", forwardAbort);
265
+ }
255
266
  }
256
267
  export function withBrainCallGuardrail(streamFn, limitMs, ref) {
257
268
  return async (model, context, options) => {
@@ -279,10 +290,12 @@ export function withBrainCallGuardrail(streamFn, limitMs, ref) {
279
290
  }
280
291
  if (step.done === true)
281
292
  gate.disarm();
293
+ else if (step.value.type === "done" || step.value.type === "error")
294
+ gate.answered();
282
295
  return step;
283
296
  },
284
297
  return: async () => {
285
- gate.disarm();
298
+ gate.abandon();
286
299
  const release = it.return;
287
300
  if (release !== undefined) {
288
301
  Promise.resolve(release.call(it)).catch(() => undefined);
@@ -1,6 +1,8 @@
1
1
  import type { AgentTool } from "../internal/harness-types.js";
2
+ import { type CredentialEchoSite } from "./credential-echo.js";
2
3
  import { type PeerSeat } from "./peer-seat.js";
3
4
  import { type HostFloor } from "./host-floor.js";
5
+ import { type McpFailureFields } from "./mcp-failure.js";
4
6
  import type { A2aServerSpec, ToolEffect } from "./types.js";
5
7
  /** The hard per-skill description bound (ruled 2026-08-03: ~2KiB). */
6
8
  export declare const A2A_SKILL_DESCRIPTION_MAX_CHARS = 2048;
@@ -28,8 +30,15 @@ export interface A2aToolAxis {
28
30
  }
29
31
  /** design/99 §E9 equivalent for A2A — a per-peer projection of THIS materialization. A2A holds no
30
32
  * connection (every call is its own HTTPS request), so `ready` means "the card was fetched and its
31
- * skills were mounted at prepare time", never "the peer is alive right now". */
32
- export interface A2aPeerStatus {
33
+ * skills were mounted at prepare time", never "the peer is alive right now".
34
+ *
35
+ * A `failed` row carries the SAME failure record an MCP server's failed status carries ({@link McpFailureFields}: `errorCode`, one of
36
+ * `MCP_FAILURE_KINDS`; `delivered`; `authorization` for `unauthorized`), so a consumer keys on one vocabulary for both protocols. The
37
+ * members are present iff the row records a failure that was thrown. A peer seat that did not furnish a send reads
38
+ * `credential_unavailable` (`unauthorized` when it answered that the principal is not authorized); an error the A2A client itself raises
39
+ * for a non-2xx status or a JSON-RPC error carries no structure the classifier reads and reads `unknown` — `error` is the text to show,
40
+ * never the field to key on. */
41
+ export interface A2aPeerStatus extends Partial<McpFailureFields> {
33
42
  name: string;
34
43
  status: "ready" | "failed";
35
44
  /** The card's self-declared name, neutralized + bounded (it rides consumer-rendered lines). */
@@ -40,8 +49,9 @@ export interface A2aPeerStatus {
40
49
  toolNames?: string[];
41
50
  error?: string;
42
51
  }
43
- /** One per-peer entry of {@link MaterializedA2a.refresh}. */
44
- export interface A2aRefreshResult {
52
+ /** One per-peer entry of {@link MaterializedA2a.refresh}. A `failed` entry whose refresh threw carries the failure record
53
+ * ({@link A2aPeerStatus}); the entry for a name no peer is declared under (nothing was attempted) carries none. */
54
+ export interface A2aRefreshResult extends Partial<McpFailureFields> {
45
55
  peer: string;
46
56
  /** The peer's namespaced-name prefix — the consumer's SPLICE DOMAIN for a wholesale swap (the same
47
57
  * self-healing prefix domain the MCP refresh receipt hands out). Present on every entry. */
@@ -98,4 +108,4 @@ export declare class A2aRpcError extends Error {
98
108
  * `allSettled` keeps it fail-open: one unreachable peer is a skipped peer with a warning, never a task
99
109
  * that cannot start.
100
110
  */
101
- export declare function materializeA2aTools(specs: readonly A2aServerSpec[], principal?: string, signal?: AbortSignal, hostFloor?: HostFloor, peerSeat?: PeerSeat): Promise<MaterializedA2a>;
111
+ export declare function materializeA2aTools(specs: readonly A2aServerSpec[], principal?: string, signal?: AbortSignal, hostFloor?: HostFloor, given?: PeerSeat, onCredentialEchoed?: (peer: string, where: CredentialEchoSite) => void): Promise<MaterializedA2a>;
package/dist/core/a2a.js CHANGED
@@ -2,9 +2,10 @@ import { randomUUID } from "node:crypto";
2
2
  import { Type } from "typebox";
3
3
  import { A2A_TASK_STATES } from "./a2a-task-state.js";
4
4
  import { assertEndpointBound, carriesDeclaredHeaders, resolveProtocolHttpHeaders, underDeclaredHeaders } from "./protocol-http-auth.js";
5
- import { PeerCarrier, carriedHttpHeaders, peerSeatMissing } from "./peer-seat.js";
5
+ import { carrierEcho, echoAnnouncer, erasedEcho, nameEchoes } from "./credential-echo.js";
6
+ import { PeerCarrier, carriedHttpHeaders, peerSeatMissing, receivePeerSeat } from "./peer-seat.js";
6
7
  import { fetchFollowing, hopRefusal, HOST_FLOOR_REFUSED_CODE } from "./host-floor.js";
7
- import { describeHttpTransportFailure } from "./mcp-failure.js";
8
+ import { classifyMcpFailure, describeHttpTransportFailure, failureFields } from "./mcp-failure.js";
8
9
  import { findNamespacePrefixCollision, mintNamespacePrefix, mintNamespacedToolName } from "./protocol-naming.js";
9
10
  import { A2A_NAMESPACE } from "./protocol-table.js";
10
11
  import { judgeEntryToolAxes, refusedDeclarer, snapshotDeclaredEntry } from "./locked-config.js";
@@ -49,6 +50,9 @@ const A2A_ERROR_CODE_NAMES = new Map([
49
50
  const A2A_TERMINAL_STATES = new Set(["completed", "canceled", "failed", "rejected"]);
50
51
  const A2A_CALLER_TURN_STATES = new Set(["input-required", "auth-required"]);
51
52
  const A2A_STATE_SET = new Set(A2A_TASK_STATES);
53
+ function peerFailureFields(err) {
54
+ return failureFields(classifyMcpFailure(err, { phase: "connect", transport: "http" }));
55
+ }
52
56
  export class A2aRpcError extends Error {
53
57
  code;
54
58
  constructor(peer, method, code, message) {
@@ -250,7 +254,7 @@ async function discoverCardBody(spec, t, signal) {
250
254
  }
251
255
  throw new Error(`a2a: peer "${peerLabel}" published no agent card — none of ${tried.join(", ")} answered`);
252
256
  }
253
- function negotiateEndpoint(peer, card, fallbackUrl) {
257
+ function negotiateEndpoint(peer, card, fallbackUrl, echo) {
254
258
  const offered = [];
255
259
  const primaryUrl = asString(card["url"]) ?? fallbackUrl;
256
260
  offered.push({ url: primaryUrl, transport: asString(card["preferredTransport"]) ?? A2A_JSONRPC_TRANSPORT });
@@ -266,6 +270,8 @@ function negotiateEndpoint(peer, card, fallbackUrl) {
266
270
  for (const candidate of offered) {
267
271
  if (candidate.transport.toUpperCase() !== A2A_JSONRPC_TRANSPORT)
268
272
  continue;
273
+ if (candidate.url !== fallbackUrl && nameEchoes(candidate.url, echo, "agent_card"))
274
+ continue;
269
275
  let absolute;
270
276
  try {
271
277
  absolute = new URL(candidate.url, fallbackUrl);
@@ -277,36 +283,42 @@ function negotiateEndpoint(peer, card, fallbackUrl) {
277
283
  continue;
278
284
  return absolute.toString();
279
285
  }
280
- const names = offered.map((o) => inlineUntrusted(o.transport, 40)).join(", ");
286
+ const names = offered.map((o) => inlineUntrusted(erasedEcho(o.transport, echo, "agent_card"), 40)).join(", ");
281
287
  throw new Error(`a2a: peer "${inlineUntrusted(peer, A2A_ID_MAX_CHARS)}" advertises no ${A2A_JSONRPC_TRANSPORT} interface (offered: ${names || "none"}) — this client speaks ${A2A_JSONRPC_TRANSPORT} only`);
282
288
  }
283
- function readCard(peer, body, fallbackUrl) {
289
+ function readCard(peer, body, fallbackUrl, echo) {
284
290
  const card = asRecord(body);
285
291
  if (card === undefined) {
286
292
  throw new Error(`a2a: peer "${inlineUntrusted(peer, A2A_ID_MAX_CHARS)}" served an agent card that is not a JSON object`);
287
293
  }
294
+ const text = (raw) => erasedEcho(raw, echo, "agent_card");
288
295
  const skills = [];
289
296
  for (const entry of asArray(card["skills"]) ?? []) {
290
297
  const rec = asRecord(entry);
291
298
  if (rec === undefined)
292
299
  continue;
293
300
  const id = asString(rec["id"]);
294
- if (id === undefined || id === "")
301
+ if (id === undefined || id === "" || nameEchoes(id, echo, "agent_card"))
295
302
  continue;
296
- const tags = (asArray(rec["tags"]) ?? []).filter((v) => typeof v === "string");
297
- const examples = (asArray(rec["examples"]) ?? []).filter((v) => typeof v === "string");
303
+ const tags = (asArray(rec["tags"]) ?? []).filter((v) => typeof v === "string").map((v) => text(v));
304
+ const examples = (asArray(rec["examples"]) ?? []).filter((v) => typeof v === "string").map((v) => text(v));
305
+ const name = text(asString(rec["name"]));
306
+ const description = text(asString(rec["description"]));
298
307
  skills.push({
299
308
  id,
300
- ...(asString(rec["name"]) !== undefined ? { name: asString(rec["name"]) } : {}),
301
- ...(asString(rec["description"]) !== undefined ? { description: asString(rec["description"]) } : {}),
309
+ ...(name !== undefined ? { name } : {}),
310
+ ...(description !== undefined ? { description } : {}),
302
311
  ...(tags.length > 0 ? { tags } : {}),
303
312
  ...(examples.length > 0 ? { examples } : {}),
304
313
  });
305
314
  }
315
+ const name = asString(card["name"]);
316
+ const nameHolds = name !== undefined && nameEchoes(name, echo, "agent_card");
317
+ const description = text(asString(card["description"]));
306
318
  return {
307
- ...(asString(card["name"]) !== undefined ? { name: inlineUntrusted(asString(card["name"]), A2A_CARD_NAME_MAX_CHARS) } : {}),
308
- ...(asString(card["description"]) !== undefined ? { description: inlineUntrusted(asString(card["description"]), A2A_CARD_DESCRIPTION_MAX_CHARS) } : {}),
309
- endpoint: negotiateEndpoint(peer, card, fallbackUrl),
319
+ ...(name !== undefined && !nameHolds ? { name: inlineUntrusted(name, A2A_CARD_NAME_MAX_CHARS) } : {}),
320
+ ...(description !== undefined ? { description: inlineUntrusted(description, A2A_CARD_DESCRIPTION_MAX_CHARS) } : {}),
321
+ endpoint: negotiateEndpoint(peer, card, fallbackUrl, echo),
310
322
  skills,
311
323
  };
312
324
  }
@@ -565,7 +577,7 @@ function declaredPeerOf(declared, index) {
565
577
  const judged = judgeEntryToolAxes(snapshot, "a2a");
566
578
  return judged.ok ? { spec: judged.entry } : { spec: snapshot, refusal: judged.error };
567
579
  }
568
- async function materializePeer(peer, principal, lifecycle, signal, floor, seat) {
580
+ async function materializePeer(peer, principal, lifecycle, signal, floor, seat, announceEcho) {
569
581
  if ("refusal" in peer)
570
582
  throw peer.refusal;
571
583
  const { spec } = peer;
@@ -579,7 +591,7 @@ async function materializePeer(peer, principal, lifecycle, signal, floor, seat)
579
591
  const carrier = new PeerCarrier(seat, identity, principal, "a2a", spec.principalHeader !== undefined);
580
592
  const asks = { carrier, principalHeader: spec.principalHeader, principal, declared, floor };
581
593
  const discovery = { peer: spec.name, endpoint: spec.url, ...asks };
582
- const card = readCard(spec.name, await discoverCardBody(spec, discovery, signal), spec.url);
594
+ const card = readCard(spec.name, await discoverCardBody(spec, discovery, signal), spec.url, carrierEcho(carrier, (where) => announceEcho(spec.name, where)));
583
595
  assertEndpointBound(A2A_NAMESPACE.id, spec.name, card.endpoint, declared, carrier.last?.headers === undefined ? undefined : { ...carrier.last.headers });
584
596
  const transport = { peer: spec.name, endpoint: card.endpoint, ...asks };
585
597
  const tools = [];
@@ -611,7 +623,8 @@ function asPeerWarning(spec, err) {
611
623
  warning.code = "a2a.peer_unavailable";
612
624
  return warning;
613
625
  }
614
- export async function materializeA2aTools(specs, principal, signal, hostFloor, peerSeat) {
626
+ export async function materializeA2aTools(specs, principal, signal, hostFloor, given, onCredentialEchoed) {
627
+ const peerSeat = receivePeerSeat(given, "materializeA2aTools peerSeat");
615
628
  const peers = specs.map((spec, index) => declaredPeerOf(spec, index));
616
629
  if (peers.length > 0) {
617
630
  const collision = findNamespacePrefixCollision(A2A_NAMESPACE, peers.map((p) => p.spec.name));
@@ -629,7 +642,8 @@ export async function materializeA2aTools(specs, principal, signal, hostFloor, p
629
642
  const toolAxes = [];
630
643
  const warnings = [];
631
644
  const statuses = [];
632
- const settled = await Promise.allSettled(peers.map((peer) => materializePeer(peer, principal, lifecycle, signal, hostFloor, peerSeat)));
645
+ const announceEcho = echoAnnouncer(onCredentialEchoed);
646
+ const settled = await Promise.allSettled(peers.map((peer) => materializePeer(peer, principal, lifecycle, signal, hostFloor, peerSeat, announceEcho)));
633
647
  for (let i = 0; i < peers.length; i++) {
634
648
  const spec = peers[i].spec;
635
649
  const outcome = settled[i];
@@ -640,7 +654,7 @@ export async function materializeA2aTools(specs, principal, signal, hostFloor, p
640
654
  }
641
655
  else {
642
656
  warnings.push(asPeerWarning(spec, outcome.reason));
643
- statuses.push({ name: spec.name, status: "failed", error: inlineUntrusted(thrownText(outcome.reason), A2A_ERROR_TEXT_MAX_CHARS) });
657
+ statuses.push({ name: spec.name, status: "failed", ...peerFailureFields(outcome.reason), error: inlineUntrusted(thrownText(outcome.reason), A2A_ERROR_TEXT_MAX_CHARS) });
644
658
  }
645
659
  }
646
660
  return {
@@ -664,7 +678,7 @@ export async function materializeA2aTools(specs, principal, signal, hostFloor, p
664
678
  }
665
679
  const previous = statuses.find((s) => s.name === spec.name)?.toolNames ?? [];
666
680
  try {
667
- const fresh = await materializePeer(target, principal, lifecycle, signal, hostFloor, peerSeat);
681
+ const fresh = await materializePeer(target, principal, lifecycle, signal, hostFloor, peerSeat, announceEcho);
668
682
  const names = fresh.tools.map((t) => t.name);
669
683
  results.push({
670
684
  peer: spec.name,
@@ -688,6 +702,7 @@ export async function materializeA2aTools(specs, principal, signal, hostFloor, p
688
702
  toolCount: previous.length,
689
703
  added: [],
690
704
  removed: [],
705
+ ...peerFailureFields(err),
691
706
  error: inlineUntrusted(thrownText(err), A2A_ERROR_TEXT_MAX_CHARS),
692
707
  });
693
708
  }
@@ -6,6 +6,7 @@
6
6
  import type { ThinkingLevel } from "../internal/harness.js";
7
7
  import type { ModelRef } from "./model-seat.js";
8
8
  import type { TaskSpec } from "./task-spec.js";
9
+ import type { McpServerSpec } from "./mcp-server-spec.js";
9
10
  /**
10
11
  * A declarative, reusable named sub-agent (design/38 1B). Hand a set to {@link createSubagentTool} and the
11
12
  * model picks one (by `whenToUse`) to delegate to; the chosen definition's config builds the child task.
@@ -42,6 +43,25 @@ export interface AgentDefinition {
42
43
  * invocable via the `skill` tool. Deployment-trusted, same trust tier as `systemPrompt`.
43
44
  */
44
45
  skills?: SkillSpec[];
46
+ /**
47
+ * The MCP servers this agent connects to when it runs — declarations in exactly the {@link TaskSpec.mcp} form, judged by the
48
+ * door that judges a task's own list (the same refusal, code and sentence) where the definition is received — the delegation
49
+ * tool's assembly, the {@link TaskSpec.agents} door, a workflow's `agentType` fold — and again at the leg's own prepare (an
50
+ * `mcp` configuration lock or a compliance deny of MCP servers refuses the leg there). They are declared on the leg spawned as
51
+ * this agent alone: its children inherit them as they inherit any server their spawner declares, and the spawning run never
52
+ * mounts them. Three rules decide what the leg holds:
53
+ * - the leg is declared the servers it inherits from the spawning run first (none when the delegation tool has a pool of its
54
+ * own), then each of these whose tool namespace (`mcp__<server>__`) none of those holds — a name the spawning run already
55
+ * declares for the leg names the spawning run's server; two of these under one namespace refuse the leg's mount, as a task's pair does;
56
+ * - this definition's own {@link allowTools}, when it has one, admits every tool of each server declared here (its own
57
+ * {@link denyTools} still wins), so an agent restricted to a few tools still holds the servers it brought;
58
+ * - every layer above the leg (the spawning run's tool lists and the ones it inherits) still decides, as for any tool of the
59
+ * leg: a server the leg's valve leaves nothing of — no tool of its namespace, no cross-server resource reader — is not dialled
60
+ * (the leg's wiring manifest reads it `skipped`).
61
+ * A server reference by name alone (another configuration's server) has no form here: a definition that should hold a server
62
+ * its spawning run declares names it in {@link allowTools} (`mcp__<server>`). Deployment-trusted, like {@link systemPrompt}.
63
+ */
64
+ mcp?: McpServerSpec[];
45
65
  /**
46
66
  * F7 (per-agent `background`, OR-ed into
47
67
  * the background predicate, GA/ungated): `true` = this agent ALWAYS launches on the background lane
@@ -2,7 +2,7 @@
2
2
  * A background agent's CURRENT state — the one reading every read face renders.
3
3
  *
4
4
  * A parent model answers "how far along is it?" from what its read faces show. Three faces read a
5
- * background agent: AgentTranscript (its recent steps), ListAgents (the roster) and TaskOutput (the poll).
5
+ * background agent: AgentTranscript (its recent steps), ListAgents (the roster) and the host task poll.
6
6
  * Each one projects {@link readAgentState}'s result and renders it with {@link agentStateSummary} /
7
7
  * {@link agentActivityClause} / {@link agentApprovalClause}; none derives status, activity time or approval
8
8
  * facts on its own, so the three cannot disagree about one agent at one instant.
@@ -1,6 +1,6 @@
1
1
  import type { EditRewritten } from "./rewrite-rejudge.js";
2
2
  import { type RuleToolNameVerdict } from "./tool-name-aliases.js";
3
- import type { ToolCallRequest } from "./tool-policy.js";
3
+ import type { ToolCallRequest, ToolIdentity } from "./tool-policy.js";
4
4
  import { type AllowRuleMember, type AllowRuleShadow } from "./allow-rule-shadow.js";
5
5
  import { type AdmissionPosture, type PathRuleBases, type PersistedRule } from "./permission-rule-model.js";
6
6
  import { type AskClass, type AssertAllKeysHandled, type PermissionMode, type PersistedRuleMandate } from "./ask-origin.js";
@@ -22,6 +22,8 @@ export interface AllowEntryInertDetail {
22
22
  readonly verdict?: Exclude<RuleToolNameVerdict["kind"], "current">;
23
23
  readonly guidance?: string;
24
24
  readonly currentName?: string;
25
+ /** `tool_name` / `unmintable_segment` only: the refusal is the ALLOW-side ambiguity of an MCP name ({@link peerReadingsOf}), not a segment the mint never produces. */
26
+ readonly ambiguous?: true;
25
27
  readonly valueType?: string;
26
28
  /** Where the spelling of a `near_miss` comes from, when the station that read it reads more than the run's roster
27
29
  * ({@link NearMissCarrier}); absent ⇒ the roster the run mounts. A sentence only — never a field of a wire detail. */
@@ -140,15 +142,18 @@ export declare function autoStrippedRule(rule: PersistedRule, call: ToolCallRequ
140
142
  export declare function classifiesAllShell(spec: {
141
143
  readonly classifyAllShell?: boolean;
142
144
  }): boolean;
143
- /** One row a list matcher reads. */
145
+ /** One row a list matcher reads. `pathBases`: the anchors the row's RULE SET declares ({@link AllowListEntry}) — absent, the set
146
+ * declares none and its path rule reads at the list's installation ({@link AllowEntryJudgeContext.anchors}). */
144
147
  export interface AllowEntryRow {
145
148
  readonly behavior: "allow" | "deny";
146
149
  readonly entry: string;
147
150
  readonly compiled: CompiledAllowEntry;
151
+ readonly pathBases?: PathRuleBases;
148
152
  }
149
153
  /** The facts a list's content row is judged under: the leg's root and session (which rows apply), the live working
150
154
  * directory (where a command's `cd` lands), and the ANCHORS of the list's path rows — the leg the list was installed
151
- * on (its root and environment home): a path row of a list never moves with a `cd`. `classifyAllShell`: the leg's
155
+ * on (its root and environment home), which a row's own set declaration overrides word by word (`policyAnchors`, the one
156
+ * reading a deny / ask rule set's `pathBases` takes): a path row of a list never moves with a `cd`. `classifyAllShell`: the leg's
152
157
  * declaration ({@link classifiesAllShell}) the auto strip reads ({@link strippedInAuto}); absent ⇒ the leg declared nothing. */
153
158
  export interface AllowEntryJudgeContext {
154
159
  readonly root: string | undefined;
@@ -157,10 +162,19 @@ export interface AllowEntryJudgeContext {
157
162
  readonly anchors: PathRuleBases;
158
163
  readonly classifyAllShell?: boolean;
159
164
  }
165
+ /** Which of the call's names a list's NAME rows (a whole tool, a covering spelling) read: every name it answers to — a person's,
166
+ * a skill's or a session's list (the name written reaches the tool that answers to it, the reference's proxy expansion) — or the
167
+ * wire name alone: a list handed in at launch ({@link AllowEntryTable}, the reference's CLI-argument source, which it does not
168
+ * expand through an alias). */
169
+ export type ListNameReach = "every_name" | "wire_name";
160
170
  /** For a list whose allow rows admitted no call ({@link judgeAllowEntries}): the first segment of the call's command no command
161
171
  * row covers under `posture` — the word a refusal names; `undefined` when the call carries no command or no single segment is
162
172
  * to blame (a line the matcher cannot read at all). The same walk the matcher took. */
163
173
  export declare function uncoveredCommandSegment(rows: readonly AllowEntryRow[], req: ToolCallRequest, ctx: AllowEntryJudgeContext, posture: AdmissionPosture): string | undefined;
174
+ /** The list's first `behavior` row that names the tool WHOLE (a tool name, a covering spelling) and so speaks for every call of
175
+ * it, whatever the call carries — the list matcher's first step ({@link judgeAllowEntries}), and the whole-tool reading of a
176
+ * deny list (the model's tool table leaves such a tool out). */
177
+ export declare function wholeToolEntryOf<R extends AllowEntryRow>(rows: readonly R[], tool: ToolIdentity, behavior: "allow" | "deny", names?: ListNameReach): R | undefined;
164
178
  /**
165
179
  * The ONE list matcher, both directions — the rows that speak for the call, or undefined. A tool-name row first (the first
166
180
  * that reaches the call); then the content rows, each family by the predicate the stored rows of that grammar meet:
@@ -173,13 +187,29 @@ export declare function uncoveredCommandSegment(rows: readonly AllowEntryRow[],
173
187
  * face carries, `nameRuleReach`); a closed-set tool's call naming no value is refused by a deny list's row of the tool and granted
174
188
  * by no allow row (the persisted walk's reading, `nameValueAbsentReason`), a mounted tool's call whose face carries no values is
175
189
  * refused by a deny list's row of the tool and granted by no allow row, and a call whose host cannot be read is refused by a deny
176
- * list's host row and granted by no allow row (`adjudicatePersistedDomainRules`).
190
+ * list's host row and granted by no allow row (`adjudicatePersistedDomainRules`). A content row reaches the call under the words
191
+ * of its direction ({@link ruleWordsOf}: a deny under every name the call answers to, an allow under its wire name); a name row
192
+ * under the list's `names` ({@link ListNameReach}).
177
193
  */
178
- export declare function judgeAllowEntries<R extends AllowEntryRow>(rows: readonly R[], req: ToolCallRequest, behavior: "allow" | "deny", ctx: AllowEntryJudgeContext, posture?: AdmissionPosture): readonly R[] | undefined;
194
+ export declare function judgeAllowEntries<R extends AllowEntryRow>(rows: readonly R[], req: ToolCallRequest, behavior: "allow" | "deny", ctx: AllowEntryJudgeContext, posture?: AdmissionPosture, names?: ListNameReach): readonly R[] | undefined;
179
195
  /** The allow rows of a list, as the allow layer reads them in `mode`: the strip applied BEFORE the match (in `auto`). */
180
196
  export declare function allowingRows<R extends AllowEntryRow>(rows: readonly R[], req: ToolCallRequest, mode: PermissionMode | undefined, allShell: boolean): readonly R[];
181
197
  /** The two sources {@link AllowEntryTable} holds (a skill's list is the skill table's). */
182
198
  export type AllowEntrySource = "request" | "deployment";
199
+ /**
200
+ * One member of an allow list handed in at launch (`TaskSpec.allowedTools`, `RunnerDeps.allowedTools`): a rule — or a rule with
201
+ * the ANCHORS of the rule SET it belongs to, `pathBases`, the seat a deny / ask rule set declares
202
+ * (`PermissionRulePolicyOptions.pathBases`), read the same one way: each word the set declares, else the leg the list is installed
203
+ * on (`policyAnchors`). The members that declare the same anchors are one set — one settings layer's rules: `root` = that layer's
204
+ * root (the configuration directory for a user layer, the task root for a project or local layer) and `cwd` = the task root, so
205
+ * a user layer's `Read(/x)` allow reaches `<config>/x` and not `<task>/x`. A string declares nothing: its path rule reads at the
206
+ * anchors the list is installed with, as handed, as it always did — and a member that declares nothing is written as that
207
+ * string (an empty `pathBases` is refused). The anchors speak to a path rule only (a rule that names no path reads none of them).
208
+ */
209
+ export type AllowListEntry = string | {
210
+ readonly rule: string;
211
+ readonly pathBases: PathRuleBases;
212
+ };
183
213
  /** What spoke for a call: the entries it stands on, as the list spells them, and — for entries of the list the run received —
184
214
  * the index of every element of that list that is one of them (a string listed twice has both). */
185
215
  export interface AllowEntryHit {
@@ -218,22 +248,27 @@ export interface AllowEntryGateSeats {
218
248
  */
219
249
  export declare class AllowEntryTable {
220
250
  private held;
221
- private readonly heldEntries;
222
- /** Each entry of the list the run RECEIVED for this source, with its indices in that list — what a hit's `positions` read. */
251
+ /** The member key of every held row ({@link allowListMemberKey}: a rule and the anchors of its set). */
252
+ private readonly heldKeys;
253
+ /** Each member of the list the run RECEIVED for this source, by member key, with its indices in that list — what a hit's
254
+ * `positions` read. */
223
255
  private receivedAt;
224
- /** Write a list's rows (a row already held is not held twice). Returns the entries that read as nothing. `roster` as in
225
- * {@link readRuleEntry}: a list the leg itself wrote is read against it, a carried one (a delegating parent's capture) is not.
226
- * `received`: this list is the one the run received for the source (the request's `TaskSpec.allowedTools`, the deployment's
227
- * `RunnerDeps.allowedTools`), the list a hit's positions are read in; a carried capture is not. */
228
- seed(entries: readonly string[], reading?: {
256
+ /** Write a list's rows (a member already held — the same rule in the same set — is not held twice). Returns the entries that
257
+ * read as nothing. `roster` as in {@link readRuleEntry}: a list the leg itself wrote is read against it, a carried one (a
258
+ * delegating parent's capture) is not. `received`: this list is the one the run received for the source (the request's
259
+ * `TaskSpec.allowedTools`, the deployment's `RunnerDeps.allowedTools`), the list a hit's positions are read in; a carried
260
+ * capture is not. */
261
+ seed(entries: readonly AllowListEntry[], reading?: {
229
262
  readonly roster?: ReadonlySet<string>;
230
263
  readonly received?: true;
231
264
  }): readonly AllowEntryInert[];
232
- /** The entries held, as written (a copy) — what a delegated child is handed. */
233
- entries(): readonly string[];
265
+ /** The members held, as written (a copy) — what a delegated child is handed: a rule, with its set's anchors where the set
266
+ * declared them (the child reads its path rule at the same anchors). */
267
+ entries(): readonly AllowListEntry[];
234
268
  /** Does the table hold a path row — must the leg read each call's target views for it? */
235
269
  holdsPathRows(): boolean;
236
- /** The lane over this table, bound to the leg's call facts. */
270
+ /** The lane over this table, bound to the leg's call facts. Both sources are lists handed in at launch: every row reaches the
271
+ * call under its wire name ({@link ListNameReach} `wire_name`). */
237
272
  lane(ctx: AllowEntryJudgeContext): AllowEntryLane;
238
273
  }
239
274
  /**
@@ -251,14 +286,14 @@ export declare function seedAllowEntryTables(tables: {
251
286
  skill: string;
252
287
  list: "allowed-tools" | "disallowed-tools";
253
288
  } & AllowEntryInert>;
254
- inherited: readonly string[] | undefined;
255
- request: readonly string[] | undefined;
256
- deployment: readonly string[] | undefined;
289
+ inherited: readonly AllowListEntry[] | undefined;
290
+ request: readonly AllowListEntry[] | undefined;
291
+ deployment: readonly AllowListEntry[] | undefined;
257
292
  }, roster: ReadonlySet<string>): AllowEntryInertNote[];
258
293
  /** The deployment's allow rules, read ONCE at construction: screened (a value that is not a list of strings refuses), frozen,
259
294
  * and its dead entries announced once (no session). Returns the deps with the snapshot in place of the caller's list. */
260
295
  export declare function withDeploymentAllowedTools<D extends {
261
- readonly allowedTools?: readonly string[];
296
+ readonly allowedTools?: readonly AllowListEntry[];
262
297
  readonly onNotice?: ((n: EngineNotice) => void) | undefined;
263
298
  }>(deps: D): D;
264
299
  /** The code a list value that is not a list of strings refuses with — the policy compiler's family, with its issues. */
@@ -272,11 +307,14 @@ declare const ALLOW_LIST_SEATS: {
272
307
  type AllowedToolsSeat = keyof typeof ALLOW_LIST_SEATS;
273
308
  /**
274
309
  * Screen and snapshot one `allowedTools` value (`seat` is the seat it was handed at; the sentence says it in words, the issues'
275
- * `libraryOption` names it): absent ⇒ undefined; a list of strings ⇒ a frozen copy (the one read every later reader takes);
276
- * anything else refuses loudly with {@link INVALID_PERMISSION_RULES_CODE} and an issue per defect — never dropped, never read
277
- * as "no entries".
310
+ * `libraryOption` names it): absent ⇒ undefined; a list of {@link AllowListEntry} members ⇒ a frozen copy (the one read every
311
+ * later reader takes). Refused loudly, never dropped and never read as "no entries": a value that is not a list, or a member that
312
+ * is neither a string nor an object, with {@link INVALID_PERMISSION_RULES_CODE} and an issue per defect; an anchored member that
313
+ * cannot be received ({@link receiveAnchoredMember}) with `config.invalid_argument`; an anchored path rule whose set declares a
314
+ * base it cannot be read at — a relative spelling, one of no tree's family — with the code and issue (`unsupported.path_base`) a
315
+ * deny / ask rule set's declaration meets (`unusableDeclaredBase`, the one judgment).
278
316
  */
279
- export declare function screenAllowedToolsValue(value: unknown, seat: AllowedToolsSeat): readonly string[] | undefined;
317
+ export declare function screenAllowedToolsValue(value: unknown, seat: AllowedToolsSeat): readonly AllowListEntry[] | undefined;
280
318
  /** The disclosure record for one member, minted from the entries it matched: each sanitized (deployment or model-authored
281
319
  * text on a human trust boundary) and capped, the rest counted. */
282
320
  export declare function allowRuleShadowOf(member: AllowRuleMember, entries: readonly string[]): AllowRuleShadow;