@namzu/sdk 46.0.0 → 48.1.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 (768) hide show
  1. package/CHANGELOG.md +351 -8
  2. package/README.md +7 -8
  3. package/dist/advisory/history.d.ts.map +1 -1
  4. package/dist/advisory/history.js +21 -1
  5. package/dist/advisory/history.js.map +1 -1
  6. package/dist/advisory/index.d.ts +1 -1
  7. package/dist/advisory/index.d.ts.map +1 -1
  8. package/dist/advisory/index.js +1 -1
  9. package/dist/advisory/index.js.map +1 -1
  10. package/dist/advisory/registry.d.ts +17 -0
  11. package/dist/advisory/registry.d.ts.map +1 -1
  12. package/dist/advisory/registry.js +26 -0
  13. package/dist/advisory/registry.js.map +1 -1
  14. package/dist/agents/PipelineAgent.d.ts +2 -46
  15. package/dist/agents/PipelineAgent.d.ts.map +1 -1
  16. package/dist/agents/PipelineAgent.js +2 -242
  17. package/dist/agents/PipelineAgent.js.map +1 -1
  18. package/dist/agents/QueryAgent.d.ts +21 -0
  19. package/dist/agents/QueryAgent.d.ts.map +1 -0
  20. package/dist/agents/QueryAgent.js +214 -0
  21. package/dist/agents/QueryAgent.js.map +1 -0
  22. package/dist/agents/ReactiveAgent.d.ts +4 -16
  23. package/dist/agents/ReactiveAgent.d.ts.map +1 -1
  24. package/dist/agents/ReactiveAgent.js +4 -183
  25. package/dist/agents/ReactiveAgent.js.map +1 -1
  26. package/dist/agents/RouterAgent.d.ts +2 -20
  27. package/dist/agents/RouterAgent.d.ts.map +1 -1
  28. package/dist/agents/RouterAgent.js +2 -266
  29. package/dist/agents/RouterAgent.js.map +1 -1
  30. package/dist/agents/SupervisorAgent.d.ts +3 -43
  31. package/dist/agents/SupervisorAgent.d.ts.map +1 -1
  32. package/dist/agents/SupervisorAgent.js +3 -418
  33. package/dist/agents/SupervisorAgent.js.map +1 -1
  34. package/dist/agents/defineAgent.d.ts +2 -1
  35. package/dist/agents/defineAgent.d.ts.map +1 -1
  36. package/dist/agents/defineAgent.js +6 -1
  37. package/dist/agents/defineAgent.js.map +1 -1
  38. package/dist/agents/examples/PipelineAgent.d.ts +46 -0
  39. package/dist/agents/examples/PipelineAgent.d.ts.map +1 -0
  40. package/dist/agents/examples/PipelineAgent.js +242 -0
  41. package/dist/agents/examples/PipelineAgent.js.map +1 -0
  42. package/dist/agents/examples/RouterAgent.d.ts +22 -0
  43. package/dist/agents/examples/RouterAgent.d.ts.map +1 -0
  44. package/dist/agents/examples/RouterAgent.js +268 -0
  45. package/dist/agents/examples/RouterAgent.js.map +1 -0
  46. package/dist/agents/examples/SupervisorAgent.d.ts +45 -0
  47. package/dist/agents/examples/SupervisorAgent.d.ts.map +1 -0
  48. package/dist/agents/examples/SupervisorAgent.js +406 -0
  49. package/dist/agents/examples/SupervisorAgent.js.map +1 -0
  50. package/dist/agents/explore.d.ts +6 -3
  51. package/dist/agents/explore.d.ts.map +1 -1
  52. package/dist/agents/explore.js +6 -3
  53. package/dist/agents/explore.js.map +1 -1
  54. package/dist/agents/forward-options.d.ts +11 -0
  55. package/dist/agents/forward-options.d.ts.map +1 -0
  56. package/dist/agents/forward-options.js +15 -0
  57. package/dist/agents/forward-options.js.map +1 -0
  58. package/dist/agents/index.d.ts +1 -0
  59. package/dist/agents/index.d.ts.map +1 -1
  60. package/dist/agents/index.js +2 -0
  61. package/dist/agents/index.js.map +1 -1
  62. package/dist/agents/runAgent.d.ts +19 -8
  63. package/dist/agents/runAgent.d.ts.map +1 -1
  64. package/dist/agents/runAgent.js +99 -29
  65. package/dist/agents/runAgent.js.map +1 -1
  66. package/dist/authorization/command-line.d.ts +2 -0
  67. package/dist/authorization/command-line.d.ts.map +1 -1
  68. package/dist/authorization/command-line.js +2 -2
  69. package/dist/authorization/command-line.js.map +1 -1
  70. package/dist/authorization/gate.d.ts +8 -0
  71. package/dist/authorization/gate.d.ts.map +1 -1
  72. package/dist/authorization/gate.js +12 -1
  73. package/dist/authorization/gate.js.map +1 -1
  74. package/dist/authorization/program.d.ts +151 -0
  75. package/dist/authorization/program.d.ts.map +1 -0
  76. package/dist/authorization/program.js +713 -0
  77. package/dist/authorization/program.js.map +1 -0
  78. package/dist/authorization/reexec-wrapper.d.ts +106 -0
  79. package/dist/authorization/reexec-wrapper.d.ts.map +1 -0
  80. package/dist/authorization/reexec-wrapper.js +532 -0
  81. package/dist/authorization/reexec-wrapper.js.map +1 -0
  82. package/dist/authorization/rules.d.ts +9 -0
  83. package/dist/authorization/rules.d.ts.map +1 -1
  84. package/dist/authorization/rules.js +8 -1
  85. package/dist/authorization/rules.js.map +1 -1
  86. package/dist/authorization/shell-lexer.d.ts +19 -4
  87. package/dist/authorization/shell-lexer.d.ts.map +1 -1
  88. package/dist/authorization/shell-lexer.js +91 -65
  89. package/dist/authorization/shell-lexer.js.map +1 -1
  90. package/dist/bridge/sse/mapper.d.ts.map +1 -1
  91. package/dist/bridge/sse/mapper.js +6 -0
  92. package/dist/bridge/sse/mapper.js.map +1 -1
  93. package/dist/capabilities/index.d.ts +54 -0
  94. package/dist/capabilities/index.d.ts.map +1 -0
  95. package/dist/capabilities/index.js +92 -0
  96. package/dist/capabilities/index.js.map +1 -0
  97. package/dist/config/registry.d.ts +2 -1
  98. package/dist/config/registry.d.ts.map +1 -1
  99. package/dist/config/registry.js +3 -2
  100. package/dist/config/registry.js.map +1 -1
  101. package/dist/connector/index.d.ts +4 -4
  102. package/dist/connector/index.d.ts.map +1 -1
  103. package/dist/connector/index.js +3 -3
  104. package/dist/connector/index.js.map +1 -1
  105. package/dist/connector/mcp/adapter.d.ts +16 -1
  106. package/dist/connector/mcp/adapter.d.ts.map +1 -1
  107. package/dist/connector/mcp/adapter.js +71 -4
  108. package/dist/connector/mcp/adapter.js.map +1 -1
  109. package/dist/connector/mcp/client.d.ts +32 -4
  110. package/dist/connector/mcp/client.d.ts.map +1 -1
  111. package/dist/connector/mcp/client.js +383 -5
  112. package/dist/connector/mcp/client.js.map +1 -1
  113. package/dist/connector/mcp/discovery.d.ts +24 -1
  114. package/dist/connector/mcp/discovery.d.ts.map +1 -1
  115. package/dist/connector/mcp/discovery.js +44 -0
  116. package/dist/connector/mcp/discovery.js.map +1 -1
  117. package/dist/connector/mcp/era.d.ts.map +1 -1
  118. package/dist/connector/mcp/era.js +7 -0
  119. package/dist/connector/mcp/era.js.map +1 -1
  120. package/dist/connector/mcp/index.d.ts +2 -0
  121. package/dist/connector/mcp/index.d.ts.map +1 -1
  122. package/dist/connector/mcp/index.js +11 -0
  123. package/dist/connector/mcp/index.js.map +1 -1
  124. package/dist/connector/mcp/mcp-toolset.d.ts +133 -0
  125. package/dist/connector/mcp/mcp-toolset.d.ts.map +1 -0
  126. package/dist/connector/mcp/mcp-toolset.js +399 -0
  127. package/dist/connector/mcp/mcp-toolset.js.map +1 -0
  128. package/dist/connector/mcp/streamable-http.d.ts +15 -0
  129. package/dist/connector/mcp/streamable-http.d.ts.map +1 -1
  130. package/dist/connector/mcp/streamable-http.js +281 -6
  131. package/dist/connector/mcp/streamable-http.js.map +1 -1
  132. package/dist/connector/tools/index.d.ts +2 -2
  133. package/dist/connector/tools/index.d.ts.map +1 -1
  134. package/dist/connector/tools/index.js +1 -1
  135. package/dist/connector/tools/index.js.map +1 -1
  136. package/dist/connector/tools/router.d.ts +15 -13
  137. package/dist/connector/tools/router.d.ts.map +1 -1
  138. package/dist/connector/tools/router.js +30 -51
  139. package/dist/connector/tools/router.js.map +1 -1
  140. package/dist/contracts/a2a.d.ts +2 -2
  141. package/dist/directory/derive-supervisor.d.ts +2 -2
  142. package/dist/directory/derive-supervisor.d.ts.map +1 -1
  143. package/dist/directory/derive-supervisor.js +6 -7
  144. package/dist/directory/derive-supervisor.js.map +1 -1
  145. package/dist/directory/derive.d.ts.map +1 -1
  146. package/dist/directory/derive.js +5 -5
  147. package/dist/directory/derive.js.map +1 -1
  148. package/dist/execution/code-runtime/types.d.ts +2 -2
  149. package/dist/execution/code-runtime/types.js +1 -1
  150. package/dist/invariants/index.d.ts +2 -1
  151. package/dist/invariants/index.d.ts.map +1 -1
  152. package/dist/invariants/index.js +3 -2
  153. package/dist/invariants/index.js.map +1 -1
  154. package/dist/manager/agent/lifecycle.d.ts +1 -0
  155. package/dist/manager/agent/lifecycle.d.ts.map +1 -1
  156. package/dist/manager/agent/lifecycle.js +146 -18
  157. package/dist/manager/agent/lifecycle.js.map +1 -1
  158. package/dist/manager/connector/environment.d.ts +6 -0
  159. package/dist/manager/connector/environment.d.ts.map +1 -1
  160. package/dist/manager/connector/environment.js +11 -4
  161. package/dist/manager/connector/environment.js.map +1 -1
  162. package/dist/manager/connector/index.d.ts +2 -2
  163. package/dist/manager/connector/index.d.ts.map +1 -1
  164. package/dist/manager/connector/index.js +2 -2
  165. package/dist/manager/connector/index.js.map +1 -1
  166. package/dist/manager/connector/tenant.d.ts +6 -0
  167. package/dist/manager/connector/tenant.d.ts.map +1 -1
  168. package/dist/manager/connector/tenant.js +11 -4
  169. package/dist/manager/connector/tenant.js.map +1 -1
  170. package/dist/manager/index.d.ts +2 -2
  171. package/dist/manager/index.d.ts.map +1 -1
  172. package/dist/manager/index.js +2 -2
  173. package/dist/manager/index.js.map +1 -1
  174. package/dist/manager/resident/initiative.d.ts +6 -6
  175. package/dist/manager/resident/learning-observation.d.ts +4 -4
  176. package/dist/manager/resident/learning.d.ts +36 -36
  177. package/dist/manager/resident/outbox.d.ts +4 -4
  178. package/dist/manager/session/attribution.d.ts +22 -0
  179. package/dist/manager/session/attribution.d.ts.map +1 -0
  180. package/dist/manager/session/attribution.js +64 -0
  181. package/dist/manager/session/attribution.js.map +1 -0
  182. package/dist/manager/session/turn-recorder.d.ts +14 -0
  183. package/dist/manager/session/turn-recorder.d.ts.map +1 -1
  184. package/dist/manager/session/turn-recorder.js +208 -55
  185. package/dist/manager/session/turn-recorder.js.map +1 -1
  186. package/dist/peers/address.d.ts +36 -0
  187. package/dist/peers/address.d.ts.map +1 -0
  188. package/dist/peers/address.js +52 -0
  189. package/dist/peers/address.js.map +1 -0
  190. package/dist/peers/client.d.ts +47 -0
  191. package/dist/peers/client.d.ts.map +1 -0
  192. package/dist/peers/client.js +132 -0
  193. package/dist/peers/client.js.map +1 -0
  194. package/dist/peers/dir.d.ts +88 -0
  195. package/dist/peers/dir.d.ts.map +1 -0
  196. package/dist/peers/dir.js +139 -0
  197. package/dist/peers/dir.js.map +1 -0
  198. package/dist/peers/endpoint.d.ts +144 -0
  199. package/dist/peers/endpoint.d.ts.map +1 -0
  200. package/dist/peers/endpoint.js +420 -0
  201. package/dist/peers/endpoint.js.map +1 -0
  202. package/dist/peers/envelope.d.ts +42 -0
  203. package/dist/peers/envelope.d.ts.map +1 -0
  204. package/dist/peers/envelope.js +110 -0
  205. package/dist/peers/envelope.js.map +1 -0
  206. package/dist/peers/index.d.ts +30 -0
  207. package/dist/peers/index.d.ts.map +1 -0
  208. package/dist/peers/index.js +22 -0
  209. package/dist/peers/index.js.map +1 -0
  210. package/dist/peers/protocol.d.ts +645 -0
  211. package/dist/peers/protocol.d.ts.map +1 -0
  212. package/dist/peers/protocol.js +151 -0
  213. package/dist/peers/protocol.js.map +1 -0
  214. package/dist/peers/record.d.ts +71 -0
  215. package/dist/peers/record.d.ts.map +1 -0
  216. package/dist/peers/record.js +45 -0
  217. package/dist/peers/record.js.map +1 -0
  218. package/dist/peers/registry.d.ts +54 -0
  219. package/dist/peers/registry.d.ts.map +1 -0
  220. package/dist/peers/registry.js +213 -0
  221. package/dist/peers/registry.js.map +1 -0
  222. package/dist/plugin/define.d.ts +24 -0
  223. package/dist/plugin/define.d.ts.map +1 -0
  224. package/dist/plugin/define.js +42 -0
  225. package/dist/plugin/define.js.map +1 -0
  226. package/dist/plugin/index.d.ts +2 -0
  227. package/dist/plugin/index.d.ts.map +1 -1
  228. package/dist/plugin/index.js +1 -0
  229. package/dist/plugin/index.js.map +1 -1
  230. package/dist/plugin/lifecycle.d.ts +27 -3
  231. package/dist/plugin/lifecycle.d.ts.map +1 -1
  232. package/dist/plugin/lifecycle.js +242 -92
  233. package/dist/plugin/lifecycle.js.map +1 -1
  234. package/dist/plugin/resolver.d.ts +2 -2
  235. package/dist/plugin/resolver.d.ts.map +1 -1
  236. package/dist/plugin/resolver.js.map +1 -1
  237. package/dist/plugin/shell-hook.d.ts.map +1 -1
  238. package/dist/plugin/shell-hook.js +17 -3
  239. package/dist/plugin/shell-hook.js.map +1 -1
  240. package/dist/probe/errors.d.ts +2 -1
  241. package/dist/probe/errors.d.ts.map +1 -1
  242. package/dist/probe/errors.js +3 -2
  243. package/dist/probe/errors.js.map +1 -1
  244. package/dist/prompt/coding-agent-doctrine.d.ts +18 -7
  245. package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
  246. package/dist/prompt/coding-agent-doctrine.js +11 -6
  247. package/dist/prompt/coding-agent-doctrine.js.map +1 -1
  248. package/dist/prompt/contributions.d.ts +4 -1
  249. package/dist/prompt/contributions.d.ts.map +1 -1
  250. package/dist/prompt/contributions.js +7 -2
  251. package/dist/prompt/contributions.js.map +1 -1
  252. package/dist/prompt/index.d.ts +1 -1
  253. package/dist/prompt/index.d.ts.map +1 -1
  254. package/dist/prompt/index.js +1 -1
  255. package/dist/prompt/index.js.map +1 -1
  256. package/dist/provider/collect-chat-completion.d.ts +6 -1
  257. package/dist/provider/collect-chat-completion.d.ts.map +1 -1
  258. package/dist/provider/collect-chat-completion.js +88 -10
  259. package/dist/provider/collect-chat-completion.js.map +1 -1
  260. package/dist/provider/mock.d.ts.map +1 -1
  261. package/dist/provider/mock.js +23 -6
  262. package/dist/provider/mock.js.map +1 -1
  263. package/dist/provider/registry.d.ts +2 -1
  264. package/dist/provider/registry.d.ts.map +1 -1
  265. package/dist/provider/registry.js +3 -2
  266. package/dist/provider/registry.js.map +1 -1
  267. package/dist/provider/tool-call-framing.d.ts +164 -0
  268. package/dist/provider/tool-call-framing.d.ts.map +1 -0
  269. package/dist/provider/tool-call-framing.js +163 -0
  270. package/dist/provider/tool-call-framing.js.map +1 -0
  271. package/dist/public-runtime.d.ts +24 -11
  272. package/dist/public-runtime.d.ts.map +1 -1
  273. package/dist/public-runtime.js +45 -9
  274. package/dist/public-runtime.js.map +1 -1
  275. package/dist/public-tools.d.ts +6 -4
  276. package/dist/public-tools.d.ts.map +1 -1
  277. package/dist/public-tools.js +8 -3
  278. package/dist/public-tools.js.map +1 -1
  279. package/dist/public-types.d.ts +13 -2
  280. package/dist/public-types.d.ts.map +1 -1
  281. package/dist/read-model/registry.d.ts +2 -1
  282. package/dist/read-model/registry.d.ts.map +1 -1
  283. package/dist/read-model/registry.js +3 -2
  284. package/dist/read-model/registry.js.map +1 -1
  285. package/dist/registry/ManagedRegistry.d.ts +30 -0
  286. package/dist/registry/ManagedRegistry.d.ts.map +1 -1
  287. package/dist/registry/ManagedRegistry.js +45 -6
  288. package/dist/registry/ManagedRegistry.js.map +1 -1
  289. package/dist/registry/collision.d.ts +57 -0
  290. package/dist/registry/collision.d.ts.map +1 -0
  291. package/dist/registry/collision.js +41 -0
  292. package/dist/registry/collision.js.map +1 -0
  293. package/dist/registry/command/index.d.ts +5 -3
  294. package/dist/registry/command/index.d.ts.map +1 -1
  295. package/dist/registry/command/index.js +6 -4
  296. package/dist/registry/command/index.js.map +1 -1
  297. package/dist/registry/index.d.ts +3 -4
  298. package/dist/registry/index.d.ts.map +1 -1
  299. package/dist/registry/index.js +2 -2
  300. package/dist/registry/index.js.map +1 -1
  301. package/dist/registry/plugin/index.d.ts.map +1 -1
  302. package/dist/registry/plugin/index.js +14 -1
  303. package/dist/registry/plugin/index.js.map +1 -1
  304. package/dist/registry/tool/callable.d.ts +7 -7
  305. package/dist/registry/tool/callable.d.ts.map +1 -1
  306. package/dist/registry/tool/callable.js +6 -7
  307. package/dist/registry/tool/callable.js.map +1 -1
  308. package/dist/registry/tool/execute.d.ts +14 -77
  309. package/dist/registry/tool/execute.d.ts.map +1 -1
  310. package/dist/registry/tool/execute.js +15 -727
  311. package/dist/registry/tool/execute.js.map +1 -1
  312. package/dist/registry/tool/portable.d.ts +25 -0
  313. package/dist/registry/tool/portable.d.ts.map +1 -1
  314. package/dist/registry/tool/portable.js +50 -0
  315. package/dist/registry/tool/portable.js.map +1 -1
  316. package/dist/registry/tool/presentation.d.ts +6 -5
  317. package/dist/registry/tool/presentation.d.ts.map +1 -1
  318. package/dist/registry/tool/presentation.js +3 -3
  319. package/dist/registry/tool/presentation.js.map +1 -1
  320. package/dist/runtime/bidi/session.d.ts +5 -4
  321. package/dist/runtime/bidi/session.d.ts.map +1 -1
  322. package/dist/runtime/bidi/session.js +18 -1
  323. package/dist/runtime/bidi/session.js.map +1 -1
  324. package/dist/runtime/query/executor/tool-call-admission.d.ts +45 -2
  325. package/dist/runtime/query/executor/tool-call-admission.d.ts.map +1 -1
  326. package/dist/runtime/query/executor/tool-call-admission.js +189 -5
  327. package/dist/runtime/query/executor/tool-call-admission.js.map +1 -1
  328. package/dist/runtime/query/executor.d.ts +33 -3
  329. package/dist/runtime/query/executor.d.ts.map +1 -1
  330. package/dist/runtime/query/executor.js +86 -10
  331. package/dist/runtime/query/executor.js.map +1 -1
  332. package/dist/runtime/query/file-evidence-replay.d.ts +1 -1
  333. package/dist/runtime/query/file-evidence-replay.d.ts.map +1 -1
  334. package/dist/runtime/query/file-evidence-replay.js +8 -7
  335. package/dist/runtime/query/file-evidence-replay.js.map +1 -1
  336. package/dist/runtime/query/fork/prepare.d.ts +4 -1
  337. package/dist/runtime/query/fork/prepare.d.ts.map +1 -1
  338. package/dist/runtime/query/fork/prepare.js +4 -0
  339. package/dist/runtime/query/fork/prepare.js.map +1 -1
  340. package/dist/runtime/query/guardrail-presets.d.ts +4 -3
  341. package/dist/runtime/query/guardrail-presets.d.ts.map +1 -1
  342. package/dist/runtime/query/guardrail-presets.js +4 -3
  343. package/dist/runtime/query/guardrail-presets.js.map +1 -1
  344. package/dist/runtime/query/index.d.ts +23 -10
  345. package/dist/runtime/query/index.d.ts.map +1 -1
  346. package/dist/runtime/query/index.js +149 -70
  347. package/dist/runtime/query/index.js.map +1 -1
  348. package/dist/runtime/query/iteration/index.d.ts.map +1 -1
  349. package/dist/runtime/query/iteration/index.js +8 -1
  350. package/dist/runtime/query/iteration/index.js.map +1 -1
  351. package/dist/runtime/query/iteration/phases/compaction.js +1 -1
  352. package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
  353. package/dist/runtime/query/iteration/phases/context.d.ts +2 -2
  354. package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
  355. package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
  356. package/dist/runtime/query/iteration/phases/tool-review.js +55 -2
  357. package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
  358. package/dist/runtime/query/iteration/stream-turn.d.ts.map +1 -1
  359. package/dist/runtime/query/iteration/stream-turn.js +342 -116
  360. package/dist/runtime/query/iteration/stream-turn.js.map +1 -1
  361. package/dist/runtime/query/iteration/tool-input.d.ts +79 -0
  362. package/dist/runtime/query/iteration/tool-input.d.ts.map +1 -0
  363. package/dist/runtime/query/iteration/tool-input.js +291 -0
  364. package/dist/runtime/query/iteration/tool-input.js.map +1 -0
  365. package/dist/runtime/query/observation-context.d.ts +2 -2
  366. package/dist/runtime/query/observation-context.d.ts.map +1 -1
  367. package/dist/runtime/query/observation-context.js.map +1 -1
  368. package/dist/runtime/query/prelude-lease.d.ts +18 -0
  369. package/dist/runtime/query/prelude-lease.d.ts.map +1 -0
  370. package/dist/runtime/query/prelude-lease.js +121 -0
  371. package/dist/runtime/query/prelude-lease.js.map +1 -0
  372. package/dist/runtime/query/prepare-turn.d.ts.map +1 -1
  373. package/dist/runtime/query/prepare-turn.js +386 -187
  374. package/dist/runtime/query/prepare-turn.js.map +1 -1
  375. package/dist/runtime/query/prompt-cache.d.ts +2 -2
  376. package/dist/runtime/query/prompt-cache.d.ts.map +1 -1
  377. package/dist/runtime/query/prompt.d.ts +2 -2
  378. package/dist/runtime/query/prompt.d.ts.map +1 -1
  379. package/dist/runtime/query/prompt.js +1 -1
  380. package/dist/runtime/query/prompt.js.map +1 -1
  381. package/dist/runtime/query/resume-session.d.ts.map +1 -1
  382. package/dist/runtime/query/resume-session.js +37 -2
  383. package/dist/runtime/query/resume-session.js.map +1 -1
  384. package/dist/runtime/query/review-policy.d.ts +22 -3
  385. package/dist/runtime/query/review-policy.d.ts.map +1 -1
  386. package/dist/runtime/query/review-policy.js +84 -6
  387. package/dist/runtime/query/review-policy.js.map +1 -1
  388. package/dist/runtime/query/tooling.d.ts +3 -2
  389. package/dist/runtime/query/tooling.d.ts.map +1 -1
  390. package/dist/runtime/query/tooling.js.map +1 -1
  391. package/dist/runtime/query/turn-state.d.ts.map +1 -1
  392. package/dist/runtime/query/turn-state.js +5 -0
  393. package/dist/runtime/query/turn-state.js.map +1 -1
  394. package/dist/runtime/system-events.d.ts +112 -0
  395. package/dist/runtime/system-events.d.ts.map +1 -0
  396. package/dist/runtime/system-events.js +183 -0
  397. package/dist/runtime/system-events.js.map +1 -0
  398. package/dist/scheduler/delegating.d.ts +2 -1
  399. package/dist/scheduler/delegating.d.ts.map +1 -1
  400. package/dist/scheduler/delegating.js +3 -2
  401. package/dist/scheduler/delegating.js.map +1 -1
  402. package/dist/scheduler/local.d.ts.map +1 -1
  403. package/dist/scheduler/local.js +2 -0
  404. package/dist/scheduler/local.js.map +1 -1
  405. package/dist/session/retention/archive.js +1 -1
  406. package/dist/session/retention/archive.js.map +1 -1
  407. package/dist/skills/index.d.ts +1 -1
  408. package/dist/skills/index.d.ts.map +1 -1
  409. package/dist/skills/index.js +1 -1
  410. package/dist/skills/index.js.map +1 -1
  411. package/dist/skills/registry.d.ts +12 -0
  412. package/dist/skills/registry.d.ts.map +1 -1
  413. package/dist/skills/registry.js +19 -0
  414. package/dist/skills/registry.js.map +1 -1
  415. package/dist/store/evidence/index-page.d.ts +2 -2
  416. package/dist/store/session/disk.d.ts.map +1 -1
  417. package/dist/store/session/disk.js +2 -0
  418. package/dist/store/session/disk.js.map +1 -1
  419. package/dist/store/session-log/conformance.d.ts +1 -1
  420. package/dist/store/session-log/conformance.d.ts.map +1 -1
  421. package/dist/store/session-log/conformance.js +49 -8
  422. package/dist/store/session-log/conformance.js.map +1 -1
  423. package/dist/store/session-log/core.d.ts +8 -3
  424. package/dist/store/session-log/core.d.ts.map +1 -1
  425. package/dist/store/session-log/core.js +2 -1
  426. package/dist/store/session-log/core.js.map +1 -1
  427. package/dist/store/session-log/fold.d.ts +12 -0
  428. package/dist/store/session-log/fold.d.ts.map +1 -1
  429. package/dist/store/session-log/fold.js +57 -7
  430. package/dist/store/session-log/fold.js.map +1 -1
  431. package/dist/store/session-log/index.d.ts +2 -2
  432. package/dist/store/session-log/index.d.ts.map +1 -1
  433. package/dist/store/session-log/index.js +1 -1
  434. package/dist/store/session-log/index.js.map +1 -1
  435. package/dist/test-support/toolset.d.ts +19 -0
  436. package/dist/test-support/toolset.d.ts.map +1 -0
  437. package/dist/test-support/toolset.js +20 -0
  438. package/dist/test-support/toolset.js.map +1 -0
  439. package/dist/tools/builtins/bash.d.ts +29 -0
  440. package/dist/tools/builtins/bash.d.ts.map +1 -1
  441. package/dist/tools/builtins/bash.js +19 -9
  442. package/dist/tools/builtins/bash.js.map +1 -1
  443. package/dist/tools/builtins/browser-url.d.ts +1 -1
  444. package/dist/tools/builtins/browser-url.js +1 -1
  445. package/dist/tools/builtins/browser.d.ts +6 -6
  446. package/dist/tools/builtins/browser.js +2 -2
  447. package/dist/tools/builtins/browser.js.map +1 -1
  448. package/dist/tools/builtins/computer-use.d.ts.map +1 -1
  449. package/dist/tools/builtins/computer-use.js +19 -11
  450. package/dist/tools/builtins/computer-use.js.map +1 -1
  451. package/dist/tools/builtins/edit.d.ts.map +1 -1
  452. package/dist/tools/builtins/edit.js +9 -1
  453. package/dist/tools/builtins/edit.js.map +1 -1
  454. package/dist/tools/builtins/json-string-hint.d.ts +15 -0
  455. package/dist/tools/builtins/json-string-hint.d.ts.map +1 -0
  456. package/dist/tools/builtins/json-string-hint.js +17 -0
  457. package/dist/tools/builtins/json-string-hint.js.map +1 -0
  458. package/dist/tools/builtins/search-tools.d.ts.map +1 -1
  459. package/dist/tools/builtins/search-tools.js +7 -15
  460. package/dist/tools/builtins/search-tools.js.map +1 -1
  461. package/dist/tools/builtins/write-file.d.ts.map +1 -1
  462. package/dist/tools/builtins/write-file.js +11 -0
  463. package/dist/tools/builtins/write-file.js.map +1 -1
  464. package/dist/tools/command-shell.d.ts +10 -0
  465. package/dist/tools/command-shell.d.ts.map +1 -1
  466. package/dist/tools/command-shell.js +45 -1
  467. package/dist/tools/command-shell.js.map +1 -1
  468. package/dist/tools/coordinator/agent.d.ts.map +1 -1
  469. package/dist/tools/coordinator/agent.js +5 -0
  470. package/dist/tools/coordinator/agent.js.map +1 -1
  471. package/dist/tools/coordinator/ask-user-question.d.ts.map +1 -1
  472. package/dist/tools/coordinator/ask-user-question.js +26 -13
  473. package/dist/tools/coordinator/ask-user-question.js.map +1 -1
  474. package/dist/tools/coordinator/index.d.ts.map +1 -1
  475. package/dist/tools/coordinator/index.js +5 -0
  476. package/dist/tools/coordinator/index.js.map +1 -1
  477. package/dist/tools/coordinator/question-options.d.ts +78 -0
  478. package/dist/tools/coordinator/question-options.d.ts.map +1 -0
  479. package/dist/tools/coordinator/question-options.js +153 -0
  480. package/dist/tools/coordinator/question-options.js.map +1 -0
  481. package/dist/tools/defineTool.d.ts +10 -0
  482. package/dist/tools/defineTool.d.ts.map +1 -1
  483. package/dist/tools/defineTool.js +17 -0
  484. package/dist/tools/defineTool.js.map +1 -1
  485. package/dist/tools/memory/search.d.ts.map +1 -1
  486. package/dist/tools/memory/search.js +4 -1
  487. package/dist/tools/memory/search.js.map +1 -1
  488. package/dist/tools/memory/update.d.ts.map +1 -1
  489. package/dist/tools/memory/update.js +8 -5
  490. package/dist/tools/memory/update.js.map +1 -1
  491. package/dist/tools/render-nonce.d.ts +47 -0
  492. package/dist/tools/render-nonce.d.ts.map +1 -0
  493. package/dist/tools/render-nonce.js +63 -0
  494. package/dist/tools/render-nonce.js.map +1 -0
  495. package/dist/tools/roster.d.ts +46 -19
  496. package/dist/tools/roster.d.ts.map +1 -1
  497. package/dist/tools/roster.js +63 -33
  498. package/dist/tools/roster.js.map +1 -1
  499. package/dist/tools/schedules/schedule-tool.d.ts.map +1 -1
  500. package/dist/tools/schedules/schedule-tool.js +94 -14
  501. package/dist/tools/schedules/schedule-tool.js.map +1 -1
  502. package/dist/tools/schedules/types.d.ts +52 -6
  503. package/dist/tools/schedules/types.d.ts.map +1 -1
  504. package/dist/tools/trusted-read-only.d.ts +9 -5
  505. package/dist/tools/trusted-read-only.d.ts.map +1 -1
  506. package/dist/tools/trusted-read-only.js +14 -10
  507. package/dist/tools/trusted-read-only.js.map +1 -1
  508. package/dist/tools/untrusted-envelope.d.ts +67 -28
  509. package/dist/tools/untrusted-envelope.d.ts.map +1 -1
  510. package/dist/tools/untrusted-envelope.js +108 -59
  511. package/dist/tools/untrusted-envelope.js.map +1 -1
  512. package/dist/toolsets/combine.d.ts +44 -0
  513. package/dist/toolsets/combine.d.ts.map +1 -0
  514. package/dist/toolsets/combine.js +153 -0
  515. package/dist/toolsets/combine.js.map +1 -0
  516. package/dist/toolsets/manager.d.ts +201 -0
  517. package/dist/toolsets/manager.d.ts.map +1 -0
  518. package/dist/toolsets/manager.js +837 -0
  519. package/dist/toolsets/manager.js.map +1 -0
  520. package/dist/toolsets/source-glob.d.ts +15 -0
  521. package/dist/toolsets/source-glob.d.ts.map +1 -0
  522. package/dist/toolsets/source-glob.js +23 -0
  523. package/dist/toolsets/source-glob.js.map +1 -0
  524. package/dist/toolsets/toolset.d.ts +20 -0
  525. package/dist/toolsets/toolset.d.ts.map +1 -0
  526. package/dist/toolsets/toolset.js +28 -0
  527. package/dist/toolsets/toolset.js.map +1 -0
  528. package/dist/toolsets/types.d.ts +128 -0
  529. package/dist/toolsets/types.d.ts.map +1 -0
  530. package/dist/toolsets/types.js +33 -0
  531. package/dist/toolsets/types.js.map +1 -0
  532. package/dist/toolsets/wrappers.d.ts +59 -0
  533. package/dist/toolsets/wrappers.d.ts.map +1 -0
  534. package/dist/toolsets/wrappers.js +165 -0
  535. package/dist/toolsets/wrappers.js.map +1 -0
  536. package/dist/types/agent/base.d.ts +27 -16
  537. package/dist/types/agent/base.d.ts.map +1 -1
  538. package/dist/types/agent/index.d.ts +1 -0
  539. package/dist/types/agent/index.d.ts.map +1 -1
  540. package/dist/types/agent/index.js +1 -0
  541. package/dist/types/agent/index.js.map +1 -1
  542. package/dist/types/agent/pipeline.d.ts +2 -0
  543. package/dist/types/agent/pipeline.d.ts.map +1 -1
  544. package/dist/types/agent/query.d.ts +117 -0
  545. package/dist/types/agent/query.d.ts.map +1 -0
  546. package/dist/types/agent/query.js +2 -0
  547. package/dist/types/agent/query.js.map +1 -0
  548. package/dist/types/agent/reactive.d.ts +2 -129
  549. package/dist/types/agent/reactive.d.ts.map +1 -1
  550. package/dist/types/agent/router.d.ts +2 -0
  551. package/dist/types/agent/router.d.ts.map +1 -1
  552. package/dist/types/agent/scheduler.d.ts +6 -1
  553. package/dist/types/agent/scheduler.d.ts.map +1 -1
  554. package/dist/types/agent/supervisor.d.ts +5 -2
  555. package/dist/types/agent/supervisor.d.ts.map +1 -1
  556. package/dist/types/agent/task.d.ts +19 -1
  557. package/dist/types/agent/task.d.ts.map +1 -1
  558. package/dist/types/agent/task.js.map +1 -1
  559. package/dist/types/authorization/index.d.ts +49 -12
  560. package/dist/types/authorization/index.d.ts.map +1 -1
  561. package/dist/types/authorization/index.js +6 -0
  562. package/dist/types/authorization/index.js.map +1 -1
  563. package/dist/types/connector/mcp.d.ts +45 -0
  564. package/dist/types/connector/mcp.d.ts.map +1 -1
  565. package/dist/types/errors/index.d.ts +15 -0
  566. package/dist/types/errors/index.d.ts.map +1 -1
  567. package/dist/types/errors/index.js.map +1 -1
  568. package/dist/types/hitl/index.d.ts +57 -0
  569. package/dist/types/hitl/index.d.ts.map +1 -1
  570. package/dist/types/hitl/index.js.map +1 -1
  571. package/dist/types/message/index.d.ts +130 -9
  572. package/dist/types/message/index.d.ts.map +1 -1
  573. package/dist/types/message/index.js +4 -1
  574. package/dist/types/message/index.js.map +1 -1
  575. package/dist/types/plugin/index.d.ts +22 -4
  576. package/dist/types/plugin/index.d.ts.map +1 -1
  577. package/dist/types/plugin/index.js +1 -0
  578. package/dist/types/plugin/index.js.map +1 -1
  579. package/dist/types/provider/chat.d.ts +5 -0
  580. package/dist/types/provider/chat.d.ts.map +1 -1
  581. package/dist/types/provider/config.d.ts +8 -3
  582. package/dist/types/provider/config.d.ts.map +1 -1
  583. package/dist/types/provider/stream.d.ts +39 -0
  584. package/dist/types/provider/stream.d.ts.map +1 -1
  585. package/dist/types/sandbox/index.d.ts +1 -1
  586. package/dist/types/session/events.d.ts +14 -3
  587. package/dist/types/session/events.d.ts.map +1 -1
  588. package/dist/types/session/events.js.map +1 -1
  589. package/dist/types/session/sub-session.d.ts +2 -0
  590. package/dist/types/session/sub-session.d.ts.map +1 -1
  591. package/dist/types/tool/index.d.ts +152 -91
  592. package/dist/types/tool/index.d.ts.map +1 -1
  593. package/dist/types/tool/index.js.map +1 -1
  594. package/dist/types/toolset/index.d.ts +10 -40
  595. package/dist/types/toolset/index.d.ts.map +1 -1
  596. package/package.json +1 -1
  597. package/src/advisory/history.ts +27 -2
  598. package/src/advisory/index.ts +1 -1
  599. package/src/advisory/registry.ts +33 -0
  600. package/src/agents/AGENTS.md +14 -7
  601. package/src/agents/PipelineAgent.ts +2 -303
  602. package/src/agents/QueryAgent.ts +269 -0
  603. package/src/agents/ReactiveAgent.ts +6 -216
  604. package/src/agents/RouterAgent.ts +2 -337
  605. package/src/agents/SupervisorAgent.ts +3 -476
  606. package/src/agents/defineAgent.ts +13 -2
  607. package/src/agents/examples/PipelineAgent.ts +302 -0
  608. package/src/agents/examples/RouterAgent.ts +338 -0
  609. package/src/agents/examples/SupervisorAgent.ts +472 -0
  610. package/src/agents/explore.ts +6 -3
  611. package/src/agents/forward-options.ts +37 -0
  612. package/src/agents/index.ts +2 -0
  613. package/src/agents/runAgent.ts +144 -37
  614. package/src/authorization/command-line.ts +2 -2
  615. package/src/authorization/gate.ts +21 -1
  616. package/src/authorization/program.ts +773 -0
  617. package/src/authorization/reexec-wrapper.ts +589 -0
  618. package/src/authorization/rules.ts +18 -1
  619. package/src/authorization/shell-lexer.ts +104 -59
  620. package/src/bridge/sse/mapper.ts +6 -0
  621. package/src/capabilities/index.ts +157 -0
  622. package/src/config/registry.ts +4 -1
  623. package/src/connector/index.ts +9 -2
  624. package/src/connector/mcp/adapter.ts +73 -3
  625. package/src/connector/mcp/client.ts +425 -6
  626. package/src/connector/mcp/discovery.ts +60 -0
  627. package/src/connector/mcp/era.ts +7 -0
  628. package/src/connector/mcp/index.ts +13 -0
  629. package/src/connector/mcp/mcp-toolset.ts +515 -0
  630. package/src/connector/mcp/streamable-http.ts +302 -5
  631. package/src/connector/tools/index.ts +2 -2
  632. package/src/connector/tools/router.ts +35 -58
  633. package/src/directory/derive-supervisor.ts +12 -8
  634. package/src/directory/derive.ts +8 -5
  635. package/src/execution/code-runtime/types.ts +2 -2
  636. package/src/invariants/index.ts +4 -1
  637. package/src/manager/agent/lifecycle.ts +167 -19
  638. package/src/manager/connector/environment.ts +17 -4
  639. package/src/manager/connector/index.ts +2 -2
  640. package/src/manager/connector/tenant.ts +17 -4
  641. package/src/manager/index.ts +2 -2
  642. package/src/manager/session/attribution.ts +79 -0
  643. package/src/manager/session/turn-recorder.ts +211 -55
  644. package/src/peers/address.ts +58 -0
  645. package/src/peers/client.ts +202 -0
  646. package/src/peers/dir.ts +176 -0
  647. package/src/peers/endpoint.ts +564 -0
  648. package/src/peers/envelope.ts +121 -0
  649. package/src/peers/index.ts +96 -0
  650. package/src/peers/protocol.ts +196 -0
  651. package/src/peers/record.ts +56 -0
  652. package/src/peers/registry.ts +241 -0
  653. package/src/plugin/define.ts +68 -0
  654. package/src/plugin/index.ts +2 -0
  655. package/src/plugin/lifecycle.ts +286 -106
  656. package/src/plugin/resolver.ts +6 -3
  657. package/src/plugin/shell-hook.ts +21 -5
  658. package/src/probe/errors.ts +4 -1
  659. package/src/prompt/coding-agent-doctrine.ts +22 -10
  660. package/src/prompt/contributions.ts +12 -2
  661. package/src/prompt/index.ts +1 -0
  662. package/src/provider/collect-chat-completion.ts +96 -11
  663. package/src/provider/mock.ts +24 -6
  664. package/src/provider/registry.ts +4 -1
  665. package/src/provider/tool-call-framing.ts +226 -0
  666. package/src/public-runtime.ts +136 -7
  667. package/src/public-tools.ts +24 -4
  668. package/src/public-types.ts +60 -6
  669. package/src/read-model/registry.ts +7 -2
  670. package/src/registry/ManagedRegistry.ts +57 -6
  671. package/src/registry/collision.ts +64 -0
  672. package/src/registry/command/index.ts +7 -3
  673. package/src/registry/index.ts +3 -9
  674. package/src/registry/plugin/index.ts +14 -1
  675. package/src/registry/tool/callable.ts +8 -9
  676. package/src/registry/tool/execute.ts +16 -846
  677. package/src/registry/tool/portable.ts +59 -0
  678. package/src/registry/tool/presentation.ts +6 -5
  679. package/src/runtime/bidi/session.ts +24 -5
  680. package/src/runtime/query/executor/tool-call-admission.ts +228 -6
  681. package/src/runtime/query/executor.ts +110 -12
  682. package/src/runtime/query/file-evidence-replay.ts +8 -7
  683. package/src/runtime/query/fork/prepare.ts +6 -1
  684. package/src/runtime/query/guardrail-presets.ts +4 -3
  685. package/src/runtime/query/index.ts +199 -101
  686. package/src/runtime/query/iteration/index.ts +13 -3
  687. package/src/runtime/query/iteration/phases/compaction.ts +1 -1
  688. package/src/runtime/query/iteration/phases/context.ts +2 -2
  689. package/src/runtime/query/iteration/phases/tool-review.ts +59 -2
  690. package/src/runtime/query/iteration/stream-turn.ts +390 -136
  691. package/src/runtime/query/iteration/tool-input.ts +284 -0
  692. package/src/runtime/query/observation-context.ts +2 -2
  693. package/src/runtime/query/prelude-lease.ts +132 -0
  694. package/src/runtime/query/prepare-turn.ts +477 -198
  695. package/src/runtime/query/prompt-cache.ts +2 -2
  696. package/src/runtime/query/prompt.ts +4 -4
  697. package/src/runtime/query/resume-session.ts +42 -3
  698. package/src/runtime/query/review-policy.ts +87 -9
  699. package/src/runtime/query/tooling.ts +3 -6
  700. package/src/runtime/query/turn-state.ts +4 -0
  701. package/src/runtime/system-events.ts +246 -0
  702. package/src/scheduler/delegating.ts +7 -2
  703. package/src/scheduler/local.ts +2 -0
  704. package/src/session/retention/archive.ts +1 -1
  705. package/src/skills/index.ts +1 -1
  706. package/src/skills/registry.ts +25 -0
  707. package/src/store/session/disk.ts +3 -0
  708. package/src/store/session-log/conformance.ts +51 -8
  709. package/src/store/session-log/core.ts +10 -4
  710. package/src/store/session-log/fold.ts +33 -7
  711. package/src/store/session-log/index.ts +2 -0
  712. package/src/test-support/toolset.ts +23 -0
  713. package/src/tools/builtins/bash.ts +27 -10
  714. package/src/tools/builtins/browser-url.ts +1 -1
  715. package/src/tools/builtins/browser.ts +2 -2
  716. package/src/tools/builtins/computer-use.ts +21 -11
  717. package/src/tools/builtins/edit.ts +12 -2
  718. package/src/tools/builtins/json-string-hint.ts +16 -0
  719. package/src/tools/builtins/search-tools.ts +7 -20
  720. package/src/tools/builtins/write-file.ts +12 -0
  721. package/src/tools/command-shell.ts +46 -1
  722. package/src/tools/coordinator/agent.ts +6 -0
  723. package/src/tools/coordinator/ask-user-question.ts +29 -15
  724. package/src/tools/coordinator/index.ts +6 -0
  725. package/src/tools/coordinator/question-options.ts +195 -0
  726. package/src/tools/defineTool.ts +28 -0
  727. package/src/tools/memory/search.ts +4 -1
  728. package/src/tools/memory/update.ts +8 -5
  729. package/src/tools/render-nonce.ts +69 -0
  730. package/src/tools/roster.ts +84 -33
  731. package/src/tools/schedules/schedule-tool.ts +107 -14
  732. package/src/tools/schedules/types.ts +52 -6
  733. package/src/tools/trusted-read-only.ts +19 -10
  734. package/src/tools/untrusted-envelope.ts +121 -57
  735. package/src/toolsets/combine.ts +181 -0
  736. package/src/toolsets/manager.ts +996 -0
  737. package/src/toolsets/source-glob.ts +22 -0
  738. package/src/toolsets/toolset.ts +31 -0
  739. package/src/toolsets/types.ts +154 -0
  740. package/src/toolsets/wrappers.ts +191 -0
  741. package/src/types/agent/base.ts +29 -16
  742. package/src/types/agent/index.ts +1 -0
  743. package/src/types/agent/pipeline.ts +2 -0
  744. package/src/types/agent/query.ts +129 -0
  745. package/src/types/agent/reactive.ts +5 -142
  746. package/src/types/agent/router.ts +2 -0
  747. package/src/types/agent/scheduler.ts +6 -1
  748. package/src/types/agent/supervisor.ts +5 -2
  749. package/src/types/agent/task.ts +21 -1
  750. package/src/types/authorization/index.ts +12 -0
  751. package/src/types/connector/mcp.ts +46 -0
  752. package/src/types/errors/index.ts +15 -0
  753. package/src/types/hitl/index.ts +57 -0
  754. package/src/types/message/index.ts +135 -7
  755. package/src/types/plugin/index.ts +44 -21
  756. package/src/types/provider/chat.ts +5 -0
  757. package/src/types/provider/config.ts +8 -3
  758. package/src/types/provider/stream.ts +39 -0
  759. package/src/types/sandbox/index.ts +1 -1
  760. package/src/types/session/events.ts +14 -3
  761. package/src/types/session/sub-session.ts +2 -0
  762. package/src/types/tool/index.ts +154 -105
  763. package/src/types/toolset/index.ts +10 -47
  764. package/dist/registry/toolset/catalog.d.ts +0 -42
  765. package/dist/registry/toolset/catalog.d.ts.map +0 -1
  766. package/dist/registry/toolset/catalog.js +0 -234
  767. package/dist/registry/toolset/catalog.js.map +0 -1
  768. package/src/registry/toolset/catalog.ts +0 -308
@@ -1,17 +1,16 @@
1
1
  import { DEFAULT_TIMEOUT_MS, DEFAULT_TOKEN_BUDGET } from '../agents/runAgent.js';
2
- import { ToolRegistry } from '../registry/tool/execute.js';
2
+ import { toolset } from '../toolsets/toolset.js';
3
3
  function toolsOf(manifest) {
4
- const tools = new ToolRegistry();
5
- for (const entry of manifest.tools)
6
- tools.register(entry.definition);
7
- return tools;
4
+ return [
5
+ toolset('directory', manifest.tools.map((entry) => entry.definition)),
6
+ ];
8
7
  }
9
8
  function delegatePlan(entry, fallbackModel) {
10
9
  return {
11
10
  id: entry.id,
12
11
  manifest: entry.manifest,
13
12
  systemPrompt: entry.manifest.instructions,
14
- tools: toolsOf(entry.manifest),
13
+ toolsets: toolsOf(entry.manifest),
15
14
  // A delegate may name its own model — a cheap one for a narrow job is
16
15
  // the common case — and inherits the supervisor's only when it does
17
16
  // not. Inheriting unconditionally would silently bill every specialist
@@ -53,7 +52,7 @@ export function deriveSupervisorOptions(manifest, input) {
53
52
  agentManager: input.agentManager,
54
53
  agentIds: delegates.map((d) => d.id),
55
54
  systemPrompt: manifest.instructions,
56
- tools: toolsOf(manifest),
55
+ toolsets: toolsOf(manifest),
57
56
  // Skills were loaded and then dropped. The manifest reads a whole
58
57
  // `skills/` directory and `SupervisorAgentConfig` takes them, and the
59
58
  // cast that used to close this object meant nobody was told the field
@@ -1 +1 @@
1
- {"version":3,"file":"derive-supervisor.js","sourceRoot":"","sources":["../../src/directory/derive-supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAgD1D,SAAS,OAAO,CAAC,QAA2B;IAC3C,MAAM,KAAK,GAAG,IAAI,YAAY,EAAE,CAAA;IAChC,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,KAAK;QAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;IACpE,OAAO,KAAK,CAAA;AACb,CAAC;AAED,SAAS,YAAY,CAAC,KAAoB,EAAE,aAAqB;IAChE,OAAO;QACN,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,YAAY,EAAE,KAAK,CAAC,QAAQ,CAAC,YAAY;QACzC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC;QAC9B,sEAAsE;QACtE,oEAAoE;QACpE,uEAAuE;QACvE,6BAA6B;QAC7B,KAAK,EAAE,KAAK,CAAC,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E,CAAA;AAC7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../src/directory/derive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAG5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAE3E;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,iBAAiB,EAC3B,KAAK,EAAE,sBAAsB,GAC3B,eAAe,CAkEjB"}
1
+ {"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../src/directory/derive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAE3E;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,iBAAiB,EAC3B,KAAK,EAAE,sBAAsB,GAC3B,eAAe,CAsEjB"}
@@ -1,4 +1,4 @@
1
- import { ToolRegistry } from '../registry/tool/execute.js';
1
+ import { toolset } from '../toolsets/toolset.js';
2
2
  /**
3
3
  * Turn a loaded project into the options `runAgent` takes.
4
4
  *
@@ -19,14 +19,14 @@ export function deriveTurnOptions(manifest, input) {
19
19
  if (!model) {
20
20
  throw new Error(`No model. Declare one in ${manifest.root}/agent.ts as \`export default { model: "…" }\`, or pass \`model\` here.`);
21
21
  }
22
- const tools = new ToolRegistry();
23
- for (const entry of manifest.tools)
24
- tools.register(entry.definition);
22
+ const toolsets = [
23
+ toolset('directory', manifest.tools.map((entry) => entry.definition)),
24
+ ];
25
25
  return {
26
26
  provider: input.provider,
27
27
  prompt: input.prompt,
28
28
  model,
29
- tools,
29
+ toolsets,
30
30
  // The one value the project knows and `runAgent` cannot infer. Left
31
31
  // unset it would default to the host's own cwd, pointing the file
32
32
  // tools' containment at the host's source tree rather than at the
@@ -1 +1 @@
1
- {"version":3,"file":"derive.js","sourceRoot":"","sources":["../../src/directory/derive.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAI1D;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAChC,QAA2B,EAC3B,KAA6B;IAE7B,IAAI,QAAQ,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;QACjC,iEAAiE;QACjE,uEAAuE;QACvE,oEAAoE;QACpE,sCAAsC;QACtC,MAAM,IAAI,KAAK,CACd,oKAAoK,CACpK,CAAA;IACF,CAAC;IAED,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAA;IAClD,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACd,4BAA4B,QAAQ,CAAC,IAAI,yEAAyE,CAClH,CAAA;IACF,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,YAAY,EAAE,CAAA;IAChC,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,KAAK;QAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;IAEpE,OAAO;QACN,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,KAAK;QACL,KAAK;QACL,oEAAoE;QACpE,kEAAkE;QAClE,kEAAkE;QAClE,qEAAqE;QACrE,oEAAoE;QACpE,uBAAuB;QACvB,gBAAgB,EAAE,QAAQ,CAAC,IAAI;QAC/B,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzE,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CA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Q,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5F,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,mBAAmB,KAAK,SAAS;YACpD,CAAC,CAAC,EAAE,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,mBAAmB,EAAE;YAC9D,CAAC,CAAC,EAAE,CAAC;QACN,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,0BAA0B,KAAK,SAAS;YAC3D,CAAC,CAAC;gBACA,0BAA0B,EAAE,QAAQ,CAAC,MAAM,CAAC,0BAA0B;aACtE;YACF,CAAC,CAAC,EAAE,CAAC;QACN,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,0BAA0B,KAAK,SAAS;YAC3D,CAAC,CAAC;gBACA,0BAA0B,EAAE,QAAQ,CAAC,MAAM,CAAC,0BAA0B;aACtE;YACF,CAAC,CAAC,EAAE,CAAC;QACN,GAAG,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC;QACzB,GAAG,CAAC,KAAK,CAAC,SAAS,IAAI,EAAE,CAAC;KAC1B,CAAA;AACF,CAAC"}
@@ -18,7 +18,7 @@
18
18
  * backend that cannot withhold those is not a backend for this.
19
19
  * - **Everything it can do, it does by asking.** The only channel out is a
20
20
  * call back into the host, which is what makes NZ-EXEC-06's dispatch
21
- * through the turn's own `ToolRegistry` possible — the program cannot
21
+ * through the turn's own `ToolManager` possible — the program cannot
22
22
  * reach a tool the turn did not grant, because it cannot reach anything.
23
23
  * - **Bounded.** Wall clock and output, both enforced by the backend
24
24
  * rather than requested of the program.
@@ -53,7 +53,7 @@ export interface HostCallContext {
53
53
  * What the host will answer.
54
54
  *
55
55
  * A function rather than a table, so the host decides per call. NZ-EXEC-06
56
- * makes this the turn's `ToolRegistry` and its permission gate, which is
56
+ * makes this the turn's `ToolManager` and its permission gate, which is
57
57
  * exactly the point: the program's reach is the turn's reach, resolved at
58
58
  * the moment of the call rather than frozen when the program started.
59
59
  */
@@ -18,7 +18,7 @@
18
18
  * backend that cannot withhold those is not a backend for this.
19
19
  * - **Everything it can do, it does by asking.** The only channel out is a
20
20
  * call back into the host, which is what makes NZ-EXEC-06's dispatch
21
- * through the turn's own `ToolRegistry` possible — the program cannot
21
+ * through the turn's own `ToolManager` possible — the program cannot
22
22
  * reach a tool the turn did not grant, because it cannot reach anything.
23
23
  * - **Bounded.** Wall clock and output, both enforced by the backend
24
24
  * rather than requested of the program.
@@ -1,3 +1,4 @@
1
+ import { RegistryCollisionError } from '../registry/collision.js';
1
2
  /**
2
3
  * What a module's check said about its own claim, the moment it was asked.
3
4
  *
@@ -39,7 +40,7 @@ export type InvariantCheck<TContext = unknown> = (ctx: TContext) => InvariantOut
39
40
  * every reference to the other's `id` kept resolving as if it still existed.
40
41
  * Mirrors `ProbeNameCollisionError`.
41
42
  */
42
- export declare class InvariantNameCollisionError extends Error {
43
+ export declare class InvariantNameCollisionError extends RegistryCollisionError {
43
44
  readonly moduleName: string;
44
45
  readonly invariantName: string;
45
46
  constructor(moduleName: string, invariantName: string);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/invariants/index.ts"],"names":[],"mappings":"AAYA;;;;;;;;;GASG;AACH,MAAM,MAAM,gBAAgB,GACzB;IAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAC3B;IAAE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACvD;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAEzD;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,CAAC,QAAQ,GAAG,OAAO,IAAI,CAChD,GAAG,EAAE,QA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,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,GAAG,IAAI;IAc3F,kDAAkD;IAClD,OAAO,IAAI,MAAM,EAAE;IAInB;;;;;OAKG;IACG,QAAQ,CAAC,QAAQ,GAAG,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAOtF;;;;OAIG;IACG,MAAM,CAAC,QAAQ,GAAG,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAQxE,oEAAoE;IACpE,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;CAGlC;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,iBAA2C,CAAA;AAEpE,kEAAkE;AAClE,wBAAgB,uBAAuB,IAAI,iBAAiB,CAE3D"}
@@ -8,6 +8,7 @@
8
8
  // module named for deciding whether a tool call is permitted, which is a
9
9
  // worse home than the one it started in.
10
10
  import { ManagedRegistry } from '../registry/ManagedRegistry.js';
11
+ import { RegistryCollisionError } from '../registry/collision.js';
11
12
  /**
12
13
  * Thrown by {@link InvariantRegistry.register} when `<moduleName>:<name>` is
13
14
  * already taken.
@@ -21,11 +22,11 @@ import { ManagedRegistry } from '../registry/ManagedRegistry.js';
21
22
  * every reference to the other's `id` kept resolving as if it still existed.
22
23
  * Mirrors `ProbeNameCollisionError`.
23
24
  */
24
- export class InvariantNameCollisionError extends Error {
25
+ export class InvariantNameCollisionError extends RegistryCollisionError {
25
26
  moduleName;
26
27
  invariantName;
27
28
  constructor(moduleName, invariantName) {
28
- super(`Invariant "${moduleName}:${invariantName}" is already registered. Two modules picked the same name, or this module registered itself twice — pick a different name, or find the second registration.`);
29
+ super('InvariantRegistry', `${moduleName}:${invariantName}`, `Invariant "${moduleName}:${invariantName}" is already registered. Two modules picked the same name, or this module registered itself twice — pick a different name, or find the second registration.`);
29
30
  this.name = 'InvariantNameCollisionError';
30
31
  this.moduleName = moduleName;
31
32
  this.invariantName = invariantName;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/invariants/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,0EAA0E;AAC1E,2EAA2E;AAC3E,yEAAyE;AACzE,yCAAyC;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AA6BhE;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,2BAA4B,SAAQ,KAAK;IAC5C,UAAU,CAAQ;IAClB,aAAa,CAAQ;IAE9B,YAAY,UAAkB,EAAE,aAAqB;QACpD,KAAK,CACJ,cAAc,UAAU,IAAI,aAAa,6JAA6J,CACtM,CAAA;QACD,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAA;QACzC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;IACnC,CAAC;CACD;AAED;;;;;;GAMG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACrC,UAAU,CAAQ;IAClB,aAAa,CAAQ;IACrB,MAAM,CAAQ;IAEvB,YAAY,UAAkB,EAAE,aAAqB,EAAE,MAAc;QACpE,KAAK,CAAC,GAAG,UAAU,gBAAgB,aAAa,gBAAgB,MAAM,EAAE,CAAC,CAAA;QACzE,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAA;QAClC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACrB,CAAC;CACD;AAwBD;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,iBAAiB;IACZ,WAAW,CAAsC;IAElE;QACC,IAAI,CAA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AU,CAAC,KAAK,CAAC,GAAY,CAAC,CAAA;QACpD,IAAI,OAAO,CAAC,KAAK,KAAK,UAAU;YAAE,UAAU,CAAC,UAAU,IAAI,CAAC,CAAA;QAC5D,OAAO,OAAO,CAAA;IACf,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAmB,EAAU,EAAE,GAAa;QACvD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,CAAA;QAC5C,IAAI,OAAO,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;YAClC,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;YAClD,MAAM,IAAI,oBAAoB,CAAC,UAAU,CAAC,UAAU,EAAE,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;QACvF,CAAC;IACF,CAAC;IAED,oEAAoE;IACpE,cAAc,CAAC,EAAU;QACxB,OAAO,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,UAAU,CAAA;IAClD,CAAC;CACD;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAsB,IAAI,iBAAiB,EAAE,CAAA;AAEpE,kEAAkE;AAClE,MAAM,UAAU,uBAAuB;IACtC,OAAO,IAAI,iBAAiB,EAAE,CAAA;AAC/B,CAAC"}
@@ -97,6 +97,7 @@ interface ChildSpawnRecord {
97
97
  /** Removes the child's log from the process-local lookup. */
98
98
  releaseLog?: () => void;
99
99
  workspaceRef?: WorkspaceRef;
100
+ workspaceRetention?: 'retain';
100
101
  /**
101
102
  * What this child was actually granted, after the ancestor union.
102
103
  *
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../src/manager/agent/lifecycle.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACxE,OAAO,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kBAAkB;IAQ1B,OAAO,CAAC,IAAI;IAaZ,OAAO,CAAC,gBAAgB;CAiBxB;AA6GD,OAAO,EAAE,0BAA0B,EAAE,CAAA"}
@@ -1,4 +1,5 @@
1
- import { rm } from 'node:fs/promises';
1
+ import { realpath, rm, stat } from 'node:fs/promises';
2
+ import { isAbsolute, relative, resolve, sep } from 'node:path';
2
3
  import { AGENT_MANAGER_DEFAULTS } from '../../constants/agent/index.js';
3
4
  import { EMPTY_TOKEN_USAGE } from '../../constants/limits.js';
4
5
  import { GENAI } from '../../constants/telemetry/index.js';
@@ -35,6 +36,73 @@ function mergeEnv(base, override) {
35
36
  return undefined;
36
37
  return { ...base, ...override };
37
38
  }
39
+ /** A requested isolated child must never resolve to its caller's directory. */
40
+ async function requireIsolatedWorktreePath(ref, callerCwd, subdirectory) {
41
+ const meta = ref?.meta;
42
+ if (typeof ref?.id !== 'string' ||
43
+ ref.id.length === 0 ||
44
+ meta?.backend !== 'git-worktree' ||
45
+ typeof meta.repoRoot !== 'string' ||
46
+ !isAbsolute(meta.repoRoot) ||
47
+ typeof meta.branch !== 'string' ||
48
+ meta.branch.length === 0 ||
49
+ typeof meta.worktreePath !== 'string' ||
50
+ !isAbsolute(meta.worktreePath) ||
51
+ resolve(meta.worktreePath) === resolve(callerCwd ?? process.cwd())) {
52
+ throw new Error('Isolated git-worktree driver returned an invalid workspace ref or path');
53
+ }
54
+ // A custom driver can return a different absolute spelling of the same
55
+ // directory (for example, a symlink to the caller). Both paths must exist
56
+ // before the child is admitted, and their physical roots must differ.
57
+ let physicalPaths;
58
+ try {
59
+ physicalPaths = await Promise.all([
60
+ realpath(meta.worktreePath),
61
+ realpath(resolve(callerCwd ?? process.cwd())),
62
+ ]);
63
+ if (!(await stat(physicalPaths[0])).isDirectory()) {
64
+ throw new Error('The worktree path is not a directory');
65
+ }
66
+ }
67
+ catch (cause) {
68
+ throw new Error('Isolated git-worktree driver returned an invalid workspace ref or path', {
69
+ cause,
70
+ });
71
+ }
72
+ if (physicalPaths[0] === physicalPaths[1]) {
73
+ throw new Error('Isolated git-worktree driver returned an invalid workspace ref or path');
74
+ }
75
+ if (subdirectory === undefined)
76
+ return meta.worktreePath;
77
+ if (typeof subdirectory !== 'string' || subdirectory.length === 0 || isAbsolute(subdirectory)) {
78
+ throw new Error('Isolated workspace subdirectory must be a nonempty relative path');
79
+ }
80
+ const lexicalChild = resolve(meta.worktreePath, subdirectory);
81
+ const lexicalRelative = relative(resolve(meta.worktreePath), lexicalChild);
82
+ if (isAbsolute(lexicalRelative) ||
83
+ lexicalRelative === '..' ||
84
+ lexicalRelative.startsWith(`..${sep}`)) {
85
+ throw new Error('Isolated workspace subdirectory escapes the worktree');
86
+ }
87
+ let physicalChild;
88
+ try {
89
+ physicalChild = await realpath(lexicalChild);
90
+ if (!(await stat(physicalChild)).isDirectory()) {
91
+ throw new Error('The selected worktree path is not a directory');
92
+ }
93
+ }
94
+ catch (cause) {
95
+ throw new Error('Isolated workspace subdirectory is missing or not a directory', { cause });
96
+ }
97
+ const physicalRelative = relative(physicalPaths[0], physicalChild);
98
+ if (physicalRelative === '' ||
99
+ isAbsolute(physicalRelative) ||
100
+ physicalRelative === '..' ||
101
+ physicalRelative.startsWith(`..${sep}`)) {
102
+ throw new Error('Isolated workspace subdirectory resolves outside its worktree');
103
+ }
104
+ return physicalChild;
105
+ }
38
106
  /**
39
107
  * One `reviewAllowedCalls` that answers `true` when any of `sources` does.
40
108
  *
@@ -121,7 +189,9 @@ export class AgentManager {
121
189
  if (task.context === context || context.parentAbortController.signal.aborted)
122
190
  this.cancel(task.taskId, 'parent');
123
191
  };
124
- task.childAbortController.signal.addEventListener('abort', onAbort, { once: true });
192
+ task.childAbortController.signal.addEventListener('abort', onAbort, {
193
+ once: true,
194
+ });
125
195
  const entry = {
126
196
  ready: false,
127
197
  task,
@@ -331,9 +401,21 @@ export class AgentManager {
331
401
  await childBudget.flush();
332
402
  throw error;
333
403
  }
404
+ let childOptions = options;
334
405
  let childAbortController;
335
406
  let agentTask;
336
407
  try {
408
+ // Explicit isolation is the child's execution root, not a side
409
+ // resource. Keep validation in this rollback envelope too.
410
+ if (options.workspace?.mode === 'isolated') {
411
+ childOptions = {
412
+ ...options,
413
+ input: {
414
+ ...options.input,
415
+ workingDirectory: await requireIsolatedWorktreePath(spawnRecord.workspaceRef, options.input.workingDirectory, options.workspace.subdirectory),
416
+ },
417
+ };
418
+ }
337
419
  childAbortController =
338
420
  queuedTask?.childAbortController ??
339
421
  createChildAbortController(context.parentAbortController);
@@ -399,6 +481,7 @@ export class AgentManager {
399
481
  state: 'pending',
400
482
  pendingMessages: queuedTask?.pendingMessages ?? [],
401
483
  createdAt: queuedTask?.createdAt ?? Date.now(),
484
+ workspace: options.workspace?.mode === 'isolated' ? spawnRecord.workspaceRef : undefined,
402
485
  sessionEventListener: listener,
403
486
  });
404
487
  childAbortController.signal.throwIfAborted();
@@ -473,6 +556,7 @@ export class AgentManager {
473
556
  ...(context.factoryOptions ?? {}),
474
557
  tokenBudget: allocatedTokens,
475
558
  timeoutMs: options.budgetAllocation?.timeoutMs ?? this.config.childTimeoutMs,
559
+ workingDirectory: childOptions.input.workingDirectory,
476
560
  sessionId: spawnRecord.childSessionId,
477
561
  parentSessionId: spawnRecord.parentSessionId,
478
562
  parentTurnId: spawnRecord.parentTurnId,
@@ -661,9 +745,9 @@ export class AgentManager {
661
745
  // under its parent (`<parent>/subagents/<child-id>.jsonl`) with its
662
746
  // meta document beside it. A child config that names a session log
663
747
  // or paths of its own chose where it goes, and keeps it.
664
- const childLog = await this.placeChildSession(spawnRecord, childConfig, context, options, taskId);
748
+ const childLog = await this.placeChildSession(spawnRecord, childConfig, context, childOptions, taskId);
665
749
  if (childLog) {
666
- await this.startChildSessionLog(childLog, spawnRecord, context, options, taskId, {
750
+ await this.startChildSessionLog(childLog, spawnRecord, context, childOptions, taskId, {
667
751
  id: agent.metadata.id,
668
752
  name: agent.metadata.name,
669
753
  });
@@ -688,7 +772,7 @@ export class AgentManager {
688
772
  childAbortController.signal.throwIfAborted();
689
773
  this.executingTasks.add(taskId);
690
774
  const runningTask = agentTask;
691
- this.runChild(runningTask, options, childConfig, listener)
775
+ this.runChild(runningTask, childOptions, childConfig, listener)
692
776
  .catch(async (err) => {
693
777
  // A thrown invocation supplied no final usage receipt. Keep its
694
778
  // reservation, including when its task handle was canceled or evicted.
@@ -780,6 +864,9 @@ export class AgentManager {
780
864
  else
781
865
  this.instances.delete(agentTask.taskId);
782
866
  this.dropSpawnRecord(agentTask.taskId);
867
+ // Admission never completed. The checkout is rollback-owned, not a
868
+ // retained result that a terminal handle may advertise.
869
+ agentTask.workspace = undefined;
783
870
  this.resolveCompletionCallbacks(agentTask.taskId);
784
871
  await this.rollbackSpawnResources(spawnRecord);
785
872
  }
@@ -793,7 +880,7 @@ export class AgentManager {
793
880
  'exception.message': toErrorMessage(err),
794
881
  }));
795
882
  }
796
- await this.disposeChildWorkspace(spawnRecord);
883
+ await this.disposeChildWorkspace({ ...spawnRecord, workspaceRetention: undefined });
797
884
  try {
798
885
  // The edge must be removed before its child: stores reject deletion
799
886
  // of a session that still has a subsession reference.
@@ -898,7 +985,10 @@ export class AgentManager {
898
985
  * and appends after it. A log that already has records is left alone.
899
986
  */
900
987
  async startChildSessionLog(log, spawnRecord, context, options, taskId, agent) {
901
- const lease = await log.claim({ holder: `namzu:agent-manager:${taskId}`, ttlMs: 30_000 });
988
+ const lease = await log.claim({
989
+ holder: `namzu:agent-manager:${taskId}`,
990
+ ttlMs: 30_000,
991
+ });
902
992
  if (lease === null) {
903
993
  throw new Error(`Child session ${spawnRecord.childSessionId} is already leased`);
904
994
  }
@@ -1170,6 +1260,7 @@ export class AgentManager {
1170
1260
  // parent but counted against `maxDelegationWidth`.
1171
1261
  let subSession;
1172
1262
  let workspaceRef;
1263
+ let workspaceDriver;
1173
1264
  try {
1174
1265
  // Flip to 'active' so the materializer's atomic write + status flip
1175
1266
  // lands on terminal — §5.3: pending→active→idle.
@@ -1189,10 +1280,25 @@ export class AgentManager {
1189
1280
  // provisioning: an unregistered backend leaves `workspaceRef:
1190
1281
  // undefined` on the spawn record, not a hard error — the registry
1191
1282
  // is the capability surface.
1192
- const backend = options.workspaceBackend ?? 'git-worktree';
1193
- if (this.deps.workspaceRegistry.has(backend)) {
1283
+ const request = options.workspace;
1284
+ const backend = request?.mode === 'shared'
1285
+ ? undefined
1286
+ : request?.mode === 'isolated'
1287
+ ? request.backend
1288
+ : (options.workspaceBackend ??
1289
+ (this.config.workspaceDefault === 'shared' ? undefined : 'git-worktree'));
1290
+ if (request?.mode === 'isolated' && !this.deps.workspaceRegistry.has(request.backend)) {
1291
+ throw new Error(`Isolated workspace backend ${request.backend} is unavailable`);
1292
+ }
1293
+ if (backend && this.deps.workspaceRegistry.has(backend)) {
1194
1294
  const driver = this.deps.workspaceRegistry.get(backend);
1195
- workspaceRef = await driver.create({ label: subSession.id });
1295
+ workspaceDriver = driver;
1296
+ workspaceRef = await driver.create({
1297
+ label: subSession.id,
1298
+ ...(request?.mode === 'isolated' && request.baseRef ? { baseRef: request.baseRef } : {}),
1299
+ });
1300
+ if (request?.mode === 'isolated')
1301
+ await requireIsolatedWorktreePath(workspaceRef, options.input.workingDirectory, request.subdirectory);
1196
1302
  // Write the workspace onto the record that outlives this process.
1197
1303
  //
1198
1304
  // The ref was kept only on the in-memory `ChildSpawnRecord`, so
@@ -1208,17 +1314,22 @@ export class AgentManager {
1208
1314
  // exist before the record it is named after. Inside the try, so
1209
1315
  // the compensating rollback below covers it like every other
1210
1316
  // mutation here.
1211
- subSession = { ...subSession, workspaceId: workspaceRef.id };
1317
+ subSession = {
1318
+ ...subSession,
1319
+ workspaceId: workspaceRef.id,
1320
+ ...(request?.mode === 'isolated' && request.retention === 'retain'
1321
+ ? { workspaceRetention: 'retain' }
1322
+ : {}),
1323
+ };
1212
1324
  await store.updateSubSession(subSession, context.tenantId);
1213
1325
  }
1214
1326
  }
1215
1327
  catch (err) {
1216
- if (workspaceRef && subSession) {
1217
- await this.disposeChildWorkspace({
1218
- workspaceRef,
1219
- subSessionId: subSession.id,
1220
- });
1221
- }
1328
+ if (workspaceRef && workspaceDriver)
1329
+ await workspaceDriver.dispose(workspaceRef).catch((disposeErr) => this.log.warn('Unstarted workspace dispose failed', {
1330
+ 'namzu.sub_session.id': subSession?.id,
1331
+ 'exception.message': toErrorMessage(disposeErr),
1332
+ }));
1222
1333
  // Compensating rollback order is mandated by the store's
1223
1334
  // deny-by-default cascade policy (Convention #5): `deleteSession`
1224
1335
  // throws when any subsession still references it, so the subsession
@@ -1245,6 +1356,9 @@ export class AgentManager {
1245
1356
  ancestry: parentAncestry,
1246
1357
  childDepth,
1247
1358
  workspaceRef,
1359
+ ...(options.workspace?.mode === 'isolated' && options.workspace.retention === 'retain'
1360
+ ? { workspaceRetention: 'retain' }
1361
+ : {}),
1248
1362
  };
1249
1363
  }
1250
1364
  async runChild(agentTask, options, childConfig, listener) {
@@ -1253,6 +1367,15 @@ export class AgentManager {
1253
1367
  const input = {
1254
1368
  ...options.input,
1255
1369
  signal: agentTask.childAbortController.signal,
1370
+ // The admitted child session is the authority. A caller-supplied input
1371
+ // cannot redirect its turn to another tenant, project, topic or session.
1372
+ managedScope: {
1373
+ kind: 'managed',
1374
+ sessionId: agentTask.context.sessionId,
1375
+ topicId: agentTask.context.topicId,
1376
+ projectId: agentTask.context.projectId,
1377
+ tenantId: agentTask.context.tenantId,
1378
+ },
1256
1379
  };
1257
1380
  const spawnRecord = this.spawnRecords.get(agentTask.taskId);
1258
1381
  const childListener = this.wrapChildListener(listener, spawnRecord);
@@ -1430,7 +1553,10 @@ export class AgentManager {
1430
1553
  status: 'failed',
1431
1554
  usage: agentTask.context.budget.ownUsage,
1432
1555
  budget: agentTask.context.budget.summary(),
1433
- cost: { ...ZERO_COST, unpricedTokens: agentTask.context.budget.ownTokens },
1556
+ cost: {
1557
+ ...ZERO_COST,
1558
+ unpricedTokens: agentTask.context.budget.ownTokens,
1559
+ },
1434
1560
  iterations: 0,
1435
1561
  durationMs: Date.now() - agentTask.createdAt,
1436
1562
  messages: [],
@@ -1486,6 +1612,8 @@ export class AgentManager {
1486
1612
  * removed is an operator's problem and silence is how it stays one.
1487
1613
  */
1488
1614
  async disposeChildWorkspace(spawnRecord) {
1615
+ if (spawnRecord.workspaceRetention === 'retain')
1616
+ return;
1489
1617
  if (!spawnRecord.workspaceRef)
1490
1618
  return;
1491
1619
  const backend = spawnRecord.workspaceRef.meta.backend;