@namzu/sdk 0.6.0 → 1.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 (429) hide show
  1. package/CHANGELOG.md +529 -0
  2. package/dist/advisory/executor.d.ts.map +1 -1
  3. package/dist/advisory/executor.js +9 -2
  4. package/dist/advisory/executor.js.map +1 -1
  5. package/dist/advisory/executor.test.d.ts +2 -1
  6. package/dist/advisory/executor.test.d.ts.map +1 -1
  7. package/dist/advisory/executor.test.js +7 -4
  8. package/dist/advisory/executor.test.js.map +1 -1
  9. package/dist/agents/ReactiveAgent.d.ts.map +1 -1
  10. package/dist/agents/ReactiveAgent.js +7 -0
  11. package/dist/agents/ReactiveAgent.js.map +1 -1
  12. package/dist/agents/SupervisorAgent.d.ts +22 -1
  13. package/dist/agents/SupervisorAgent.d.ts.map +1 -1
  14. package/dist/agents/SupervisorAgent.js +54 -14
  15. package/dist/agents/SupervisorAgent.js.map +1 -1
  16. package/dist/agents/__tests__/supervisor-ledger.test.d.ts +2 -0
  17. package/dist/agents/__tests__/supervisor-ledger.test.d.ts.map +1 -0
  18. package/dist/agents/__tests__/supervisor-ledger.test.js +131 -0
  19. package/dist/agents/__tests__/supervisor-ledger.test.js.map +1 -0
  20. package/dist/bridge/sse/mapper.test.js +2 -2
  21. package/dist/config/runtime.d.ts +24 -0
  22. package/dist/config/runtime.d.ts.map +1 -1
  23. package/dist/config/runtime.js +9 -0
  24. package/dist/config/runtime.js.map +1 -1
  25. package/dist/connector/builtins/webhook.test.js +17 -0
  26. package/dist/connector/builtins/webhook.test.js.map +1 -1
  27. package/dist/connector/index.d.ts +1 -0
  28. package/dist/connector/index.d.ts.map +1 -1
  29. package/dist/connector/index.js +1 -0
  30. package/dist/connector/index.js.map +1 -1
  31. package/dist/connector/mcp/client.d.ts.map +1 -1
  32. package/dist/connector/mcp/client.js +4 -0
  33. package/dist/connector/mcp/client.js.map +1 -1
  34. package/dist/connector/mcp/index.d.ts +1 -0
  35. package/dist/connector/mcp/index.d.ts.map +1 -1
  36. package/dist/connector/mcp/index.js +1 -0
  37. package/dist/connector/mcp/index.js.map +1 -1
  38. package/dist/connector/mcp/streamable-http.d.ts +22 -0
  39. package/dist/connector/mcp/streamable-http.d.ts.map +1 -0
  40. package/dist/connector/mcp/streamable-http.js +128 -0
  41. package/dist/connector/mcp/streamable-http.js.map +1 -0
  42. package/dist/connector/mcp/streamable-http.test.d.ts +2 -0
  43. package/dist/connector/mcp/streamable-http.test.d.ts.map +1 -0
  44. package/dist/connector/mcp/streamable-http.test.js +132 -0
  45. package/dist/connector/mcp/streamable-http.test.js.map +1 -0
  46. package/dist/constants/compaction/index.d.ts.map +1 -1
  47. package/dist/constants/compaction/index.js +8 -3
  48. package/dist/constants/compaction/index.js.map +1 -1
  49. package/dist/constants/sandbox/index.d.ts +21 -0
  50. package/dist/constants/sandbox/index.d.ts.map +1 -1
  51. package/dist/constants/sandbox/index.js +30 -0
  52. package/dist/constants/sandbox/index.js.map +1 -1
  53. package/dist/constants/tools/index.d.ts.map +1 -1
  54. package/dist/constants/tools/index.js +33 -2
  55. package/dist/constants/tools/index.js.map +1 -1
  56. package/dist/manager/run/persistence.d.ts.map +1 -1
  57. package/dist/manager/run/persistence.js +35 -5
  58. package/dist/manager/run/persistence.js.map +1 -1
  59. package/dist/persona/assembler.d.ts +1 -0
  60. package/dist/persona/assembler.d.ts.map +1 -1
  61. package/dist/persona/assembler.js +37 -6
  62. package/dist/persona/assembler.js.map +1 -1
  63. package/dist/provider/collect.d.ts.map +1 -1
  64. package/dist/provider/collect.js +4 -1
  65. package/dist/provider/collect.js.map +1 -1
  66. package/dist/provider/collect.test.js +2 -2
  67. package/dist/public-runtime.d.ts +6 -5
  68. package/dist/public-runtime.d.ts.map +1 -1
  69. package/dist/public-runtime.js +6 -5
  70. package/dist/public-runtime.js.map +1 -1
  71. package/dist/public-tools.d.ts +2 -0
  72. package/dist/public-tools.d.ts.map +1 -1
  73. package/dist/public-tools.js +2 -0
  74. package/dist/public-tools.js.map +1 -1
  75. package/dist/public-types.d.ts +3 -0
  76. package/dist/public-types.d.ts.map +1 -1
  77. package/dist/registry/index.d.ts +2 -0
  78. package/dist/registry/index.d.ts.map +1 -1
  79. package/dist/registry/index.js +1 -0
  80. package/dist/registry/index.js.map +1 -1
  81. package/dist/registry/tool/execute.d.ts +27 -0
  82. package/dist/registry/tool/execute.d.ts.map +1 -1
  83. package/dist/registry/tool/execute.js +192 -7
  84. package/dist/registry/tool/execute.js.map +1 -1
  85. package/dist/registry/tool/execute.test.d.ts +9 -4
  86. package/dist/registry/tool/execute.test.d.ts.map +1 -1
  87. package/dist/registry/tool/execute.test.js +178 -7
  88. package/dist/registry/tool/execute.test.js.map +1 -1
  89. package/dist/registry/toolset/catalog.d.ts +42 -0
  90. package/dist/registry/toolset/catalog.d.ts.map +1 -0
  91. package/dist/registry/toolset/catalog.js +217 -0
  92. package/dist/registry/toolset/catalog.js.map +1 -0
  93. package/dist/registry/toolset/catalog.test.d.ts +2 -0
  94. package/dist/registry/toolset/catalog.test.d.ts.map +1 -0
  95. package/dist/registry/toolset/catalog.test.js +147 -0
  96. package/dist/registry/toolset/catalog.test.js.map +1 -0
  97. package/dist/runtime/query/__tests__/deferred-tools.test.d.ts +2 -0
  98. package/dist/runtime/query/__tests__/deferred-tools.test.d.ts.map +1 -0
  99. package/dist/runtime/query/__tests__/deferred-tools.test.js +185 -0
  100. package/dist/runtime/query/__tests__/deferred-tools.test.js.map +1 -0
  101. package/dist/runtime/query/__tests__/executor-concurrency.test.d.ts +2 -0
  102. package/dist/runtime/query/__tests__/executor-concurrency.test.d.ts.map +1 -0
  103. package/dist/runtime/query/__tests__/executor-concurrency.test.js +98 -0
  104. package/dist/runtime/query/__tests__/executor-concurrency.test.js.map +1 -0
  105. package/dist/runtime/query/__tests__/executor-plugin-hooks.test.js +38 -3
  106. package/dist/runtime/query/__tests__/executor-plugin-hooks.test.js.map +1 -1
  107. package/dist/runtime/query/__tests__/long-document-flow.test.d.ts +2 -0
  108. package/dist/runtime/query/__tests__/long-document-flow.test.d.ts.map +1 -0
  109. package/dist/runtime/query/__tests__/long-document-flow.test.js +154 -0
  110. package/dist/runtime/query/__tests__/long-document-flow.test.js.map +1 -0
  111. package/dist/runtime/query/__tests__/prompt.test.js +51 -2
  112. package/dist/runtime/query/__tests__/prompt.test.js.map +1 -1
  113. package/dist/runtime/query/__tests__/stream-recovery.test.d.ts +2 -0
  114. package/dist/runtime/query/__tests__/stream-recovery.test.d.ts.map +1 -0
  115. package/dist/runtime/query/__tests__/stream-recovery.test.js +126 -0
  116. package/dist/runtime/query/__tests__/stream-recovery.test.js.map +1 -0
  117. package/dist/runtime/query/continuation.d.ts +16 -0
  118. package/dist/runtime/query/continuation.d.ts.map +1 -0
  119. package/dist/runtime/query/continuation.js +16 -0
  120. package/dist/runtime/query/continuation.js.map +1 -0
  121. package/dist/runtime/query/executor.d.ts +3 -0
  122. package/dist/runtime/query/executor.d.ts.map +1 -1
  123. package/dist/runtime/query/executor.js +71 -3
  124. package/dist/runtime/query/executor.js.map +1 -1
  125. package/dist/runtime/query/index.d.ts +9 -0
  126. package/dist/runtime/query/index.d.ts.map +1 -1
  127. package/dist/runtime/query/index.js +42 -5
  128. package/dist/runtime/query/index.js.map +1 -1
  129. package/dist/runtime/query/iteration/index.d.ts +24 -0
  130. package/dist/runtime/query/iteration/index.d.ts.map +1 -1
  131. package/dist/runtime/query/iteration/index.js +326 -66
  132. package/dist/runtime/query/iteration/index.js.map +1 -1
  133. package/dist/runtime/query/iteration/phases/checkpoint.d.ts.map +1 -1
  134. package/dist/runtime/query/iteration/phases/checkpoint.js +2 -2
  135. package/dist/runtime/query/iteration/phases/checkpoint.js.map +1 -1
  136. package/dist/runtime/query/iteration/phases/compaction.d.ts +8 -0
  137. package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
  138. package/dist/runtime/query/iteration/phases/compaction.js +84 -3
  139. package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
  140. package/dist/runtime/query/iteration/phases/context.d.ts +22 -0
  141. package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
  142. package/dist/runtime/query/iteration/phases/context.js +53 -0
  143. package/dist/runtime/query/iteration/phases/context.js.map +1 -1
  144. package/dist/runtime/query/iteration/phases/hitl-abort-race.test.d.ts +2 -0
  145. package/dist/runtime/query/iteration/phases/hitl-abort-race.test.d.ts.map +1 -0
  146. package/dist/runtime/query/iteration/phases/hitl-abort-race.test.js +73 -0
  147. package/dist/runtime/query/iteration/phases/hitl-abort-race.test.js.map +1 -0
  148. package/dist/runtime/query/iteration/phases/hitl-answer-question.test.d.ts +2 -0
  149. package/dist/runtime/query/iteration/phases/hitl-answer-question.test.d.ts.map +1 -0
  150. package/dist/runtime/query/iteration/phases/hitl-answer-question.test.js +120 -0
  151. package/dist/runtime/query/iteration/phases/hitl-answer-question.test.js.map +1 -0
  152. package/dist/runtime/query/iteration/phases/tool-review.d.ts +1 -1
  153. package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
  154. package/dist/runtime/query/iteration/phases/tool-review.js +7 -2
  155. package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
  156. package/dist/runtime/query/iteration/phases/working-memory-compaction.test.d.ts +19 -0
  157. package/dist/runtime/query/iteration/phases/working-memory-compaction.test.d.ts.map +1 -0
  158. package/dist/runtime/query/iteration/phases/working-memory-compaction.test.js +177 -0
  159. package/dist/runtime/query/iteration/phases/working-memory-compaction.test.js.map +1 -0
  160. package/dist/runtime/query/iteration/phases/working-memory.d.ts +31 -0
  161. package/dist/runtime/query/iteration/phases/working-memory.d.ts.map +1 -0
  162. package/dist/runtime/query/iteration/phases/working-memory.js +81 -0
  163. package/dist/runtime/query/iteration/phases/working-memory.js.map +1 -0
  164. package/dist/runtime/query/prompt.d.ts.map +1 -1
  165. package/dist/runtime/query/prompt.js +21 -1
  166. package/dist/runtime/query/prompt.js.map +1 -1
  167. package/dist/runtime/query/tooling.d.ts +1 -0
  168. package/dist/runtime/query/tooling.d.ts.map +1 -1
  169. package/dist/runtime/query/tooling.js +1 -0
  170. package/dist/runtime/query/tooling.js.map +1 -1
  171. package/dist/sandbox/provider/local.d.ts.map +1 -1
  172. package/dist/sandbox/provider/local.js +32 -1
  173. package/dist/sandbox/provider/local.js.map +1 -1
  174. package/dist/session/workspace/__tests__/shared-run.test.d.ts +2 -0
  175. package/dist/session/workspace/__tests__/shared-run.test.d.ts.map +1 -0
  176. package/dist/session/workspace/__tests__/shared-run.test.js +147 -0
  177. package/dist/session/workspace/__tests__/shared-run.test.js.map +1 -0
  178. package/dist/session/workspace/index.d.ts +2 -0
  179. package/dist/session/workspace/index.d.ts.map +1 -1
  180. package/dist/session/workspace/index.js +1 -0
  181. package/dist/session/workspace/index.js.map +1 -1
  182. package/dist/session/workspace/shared-run.d.ts +81 -0
  183. package/dist/session/workspace/shared-run.d.ts.map +1 -0
  184. package/dist/session/workspace/shared-run.js +252 -0
  185. package/dist/session/workspace/shared-run.js.map +1 -0
  186. package/dist/skills/loader.d.ts.map +1 -1
  187. package/dist/skills/loader.js +36 -6
  188. package/dist/skills/loader.js.map +1 -1
  189. package/dist/skills/loader.test.d.ts +2 -0
  190. package/dist/skills/loader.test.d.ts.map +1 -0
  191. package/dist/skills/loader.test.js +65 -0
  192. package/dist/skills/loader.test.js.map +1 -0
  193. package/dist/streaming/coalesce.test.js +1 -1
  194. package/dist/streaming/coalesce.test.js.map +1 -1
  195. package/dist/tools/builtins/__tests__/edit.test.d.ts +2 -0
  196. package/dist/tools/builtins/__tests__/edit.test.d.ts.map +1 -0
  197. package/dist/tools/builtins/__tests__/edit.test.js +38 -0
  198. package/dist/tools/builtins/__tests__/edit.test.js.map +1 -0
  199. package/dist/tools/builtins/__tests__/payload-budget.test.d.ts +2 -0
  200. package/dist/tools/builtins/__tests__/payload-budget.test.d.ts.map +1 -0
  201. package/dist/tools/builtins/__tests__/payload-budget.test.js +70 -0
  202. package/dist/tools/builtins/__tests__/payload-budget.test.js.map +1 -0
  203. package/dist/tools/builtins/__tests__/read-file.test.d.ts +2 -0
  204. package/dist/tools/builtins/__tests__/read-file.test.d.ts.map +1 -0
  205. package/dist/tools/builtins/__tests__/read-file.test.js +33 -0
  206. package/dist/tools/builtins/__tests__/read-file.test.js.map +1 -0
  207. package/dist/tools/builtins/__tests__/verify-outputs.test.d.ts +2 -0
  208. package/dist/tools/builtins/__tests__/verify-outputs.test.d.ts.map +1 -0
  209. package/dist/tools/builtins/__tests__/verify-outputs.test.js +52 -0
  210. package/dist/tools/builtins/__tests__/verify-outputs.test.js.map +1 -0
  211. package/dist/tools/builtins/__tests__/write-file.test.d.ts +2 -0
  212. package/dist/tools/builtins/__tests__/write-file.test.d.ts.map +1 -0
  213. package/dist/tools/builtins/__tests__/write-file.test.js +74 -0
  214. package/dist/tools/builtins/__tests__/write-file.test.js.map +1 -0
  215. package/dist/tools/builtins/bash.d.ts.map +1 -1
  216. package/dist/tools/builtins/bash.js +40 -7
  217. package/dist/tools/builtins/bash.js.map +1 -1
  218. package/dist/tools/builtins/edit.d.ts +5 -2
  219. package/dist/tools/builtins/edit.d.ts.map +1 -1
  220. package/dist/tools/builtins/edit.js +114 -18
  221. package/dist/tools/builtins/edit.js.map +1 -1
  222. package/dist/tools/builtins/index.d.ts +1 -0
  223. package/dist/tools/builtins/index.d.ts.map +1 -1
  224. package/dist/tools/builtins/index.js +13 -13
  225. package/dist/tools/builtins/index.js.map +1 -1
  226. package/dist/tools/builtins/read-file.d.ts +1 -0
  227. package/dist/tools/builtins/read-file.d.ts.map +1 -1
  228. package/dist/tools/builtins/read-file.js +73 -10
  229. package/dist/tools/builtins/read-file.js.map +1 -1
  230. package/dist/tools/builtins/search-tools.d.ts.map +1 -1
  231. package/dist/tools/builtins/search-tools.js +35 -7
  232. package/dist/tools/builtins/search-tools.js.map +1 -1
  233. package/dist/tools/builtins/verify-outputs.d.ts +5 -0
  234. package/dist/tools/builtins/verify-outputs.d.ts.map +1 -0
  235. package/dist/tools/builtins/verify-outputs.js +103 -0
  236. package/dist/tools/builtins/verify-outputs.js.map +1 -0
  237. package/dist/tools/builtins/write-file.d.ts +3 -2
  238. package/dist/tools/builtins/write-file.d.ts.map +1 -1
  239. package/dist/tools/builtins/write-file.js +72 -12
  240. package/dist/tools/builtins/write-file.js.map +1 -1
  241. package/dist/tools/coordinator/__tests__/agent.test.d.ts +15 -0
  242. package/dist/tools/coordinator/__tests__/agent.test.d.ts.map +1 -0
  243. package/dist/tools/coordinator/__tests__/agent.test.js +142 -0
  244. package/dist/tools/coordinator/__tests__/agent.test.js.map +1 -0
  245. package/dist/tools/coordinator/__tests__/approve-plan.test.d.ts +2 -0
  246. package/dist/tools/coordinator/__tests__/approve-plan.test.d.ts.map +1 -0
  247. package/dist/tools/coordinator/__tests__/approve-plan.test.js +114 -0
  248. package/dist/tools/coordinator/__tests__/approve-plan.test.js.map +1 -0
  249. package/dist/tools/coordinator/__tests__/ask-user-question.test.d.ts +2 -0
  250. package/dist/tools/coordinator/__tests__/ask-user-question.test.d.ts.map +1 -0
  251. package/dist/tools/coordinator/__tests__/ask-user-question.test.js +309 -0
  252. package/dist/tools/coordinator/__tests__/ask-user-question.test.js.map +1 -0
  253. package/dist/tools/coordinator/__tests__/task-list.test.d.ts +13 -0
  254. package/dist/tools/coordinator/__tests__/task-list.test.d.ts.map +1 -0
  255. package/dist/tools/coordinator/__tests__/task-list.test.js +162 -0
  256. package/dist/tools/coordinator/__tests__/task-list.test.js.map +1 -0
  257. package/dist/tools/coordinator/agent.d.ts +34 -0
  258. package/dist/tools/coordinator/agent.d.ts.map +1 -0
  259. package/dist/tools/coordinator/agent.js +107 -0
  260. package/dist/tools/coordinator/agent.js.map +1 -0
  261. package/dist/tools/coordinator/index.d.ts +15 -0
  262. package/dist/tools/coordinator/index.d.ts.map +1 -1
  263. package/dist/tools/coordinator/index.js +305 -35
  264. package/dist/tools/coordinator/index.js.map +1 -1
  265. package/dist/types/agent/base.d.ts +8 -0
  266. package/dist/types/agent/base.d.ts.map +1 -1
  267. package/dist/types/agent/index.d.ts +1 -0
  268. package/dist/types/agent/index.d.ts.map +1 -1
  269. package/dist/types/agent/index.js +1 -0
  270. package/dist/types/agent/index.js.map +1 -1
  271. package/dist/types/agent/reactive.d.ts +38 -0
  272. package/dist/types/agent/reactive.d.ts.map +1 -1
  273. package/dist/types/agent/supervisor.d.ts +32 -0
  274. package/dist/types/agent/supervisor.d.ts.map +1 -1
  275. package/dist/types/agent/working-memory.d.ts +29 -0
  276. package/dist/types/agent/working-memory.d.ts.map +1 -0
  277. package/dist/types/agent/working-memory.js +2 -0
  278. package/dist/types/agent/working-memory.js.map +1 -0
  279. package/dist/types/common/index.d.ts +10 -0
  280. package/dist/types/common/index.d.ts.map +1 -1
  281. package/dist/types/common/index.js +18 -0
  282. package/dist/types/common/index.js.map +1 -1
  283. package/dist/types/common/usage-merge.test.d.ts +2 -0
  284. package/dist/types/common/usage-merge.test.d.ts.map +1 -0
  285. package/dist/types/common/usage-merge.test.js +48 -0
  286. package/dist/types/common/usage-merge.test.js.map +1 -0
  287. package/dist/types/connector/mcp.d.ts +9 -2
  288. package/dist/types/connector/mcp.d.ts.map +1 -1
  289. package/dist/types/hitl/index.d.ts +42 -0
  290. package/dist/types/hitl/index.d.ts.map +1 -1
  291. package/dist/types/hitl/index.js +11 -0
  292. package/dist/types/hitl/index.js.map +1 -1
  293. package/dist/types/message/index.d.ts +22 -1
  294. package/dist/types/message/index.d.ts.map +1 -1
  295. package/dist/types/message/index.js +7 -2
  296. package/dist/types/message/index.js.map +1 -1
  297. package/dist/types/provider/chat.d.ts +11 -9
  298. package/dist/types/provider/chat.d.ts.map +1 -1
  299. package/dist/types/run/events.d.ts +6 -0
  300. package/dist/types/run/events.d.ts.map +1 -1
  301. package/dist/types/run/events.js.map +1 -1
  302. package/dist/types/sandbox/index.d.ts +193 -0
  303. package/dist/types/sandbox/index.d.ts.map +1 -1
  304. package/dist/types/sandbox/index.js.map +1 -1
  305. package/dist/types/skills/index.d.ts +2 -0
  306. package/dist/types/skills/index.d.ts.map +1 -1
  307. package/dist/types/tool/index.d.ts +22 -0
  308. package/dist/types/tool/index.d.ts.map +1 -1
  309. package/dist/types/toolset/index.d.ts +71 -0
  310. package/dist/types/toolset/index.d.ts.map +1 -0
  311. package/dist/types/toolset/index.js +2 -0
  312. package/dist/types/toolset/index.js.map +1 -0
  313. package/dist/types/workspace/index.d.ts +1 -0
  314. package/dist/types/workspace/index.d.ts.map +1 -1
  315. package/dist/types/workspace/shared-run.d.ts +61 -0
  316. package/dist/types/workspace/shared-run.d.ts.map +1 -0
  317. package/dist/types/workspace/shared-run.js +2 -0
  318. package/dist/types/workspace/shared-run.js.map +1 -0
  319. package/dist/verification/index.d.ts +1 -0
  320. package/dist/verification/index.d.ts.map +1 -1
  321. package/dist/verification/index.js +1 -0
  322. package/dist/verification/index.js.map +1 -1
  323. package/dist/verification/presets.d.ts +53 -0
  324. package/dist/verification/presets.d.ts.map +1 -0
  325. package/dist/verification/presets.js +70 -0
  326. package/dist/verification/presets.js.map +1 -0
  327. package/dist/verification/presets.test.d.ts +16 -0
  328. package/dist/verification/presets.test.d.ts.map +1 -0
  329. package/dist/verification/presets.test.js +79 -0
  330. package/dist/verification/presets.test.js.map +1 -0
  331. package/dist/version.d.ts.map +1 -1
  332. package/dist/version.js +25 -4
  333. package/dist/version.js.map +1 -1
  334. package/package.json +3 -2
  335. package/src/advisory/executor.test.ts +7 -4
  336. package/src/advisory/executor.ts +11 -2
  337. package/src/agents/ReactiveAgent.ts +7 -0
  338. package/src/agents/SupervisorAgent.ts +63 -16
  339. package/src/agents/__tests__/supervisor-ledger.test.ts +185 -0
  340. package/src/bridge/sse/mapper.test.ts +2 -2
  341. package/src/config/runtime.ts +9 -0
  342. package/src/connector/builtins/webhook.test.ts +21 -0
  343. package/src/connector/index.ts +1 -0
  344. package/src/connector/mcp/client.ts +4 -0
  345. package/src/connector/mcp/index.ts +1 -0
  346. package/src/connector/mcp/streamable-http.test.ts +169 -0
  347. package/src/connector/mcp/streamable-http.ts +152 -0
  348. package/src/constants/compaction/index.ts +8 -3
  349. package/src/constants/sandbox/index.ts +37 -0
  350. package/src/constants/tools/index.ts +33 -2
  351. package/src/manager/run/persistence.ts +34 -6
  352. package/src/persona/assembler.ts +43 -8
  353. package/src/provider/collect.test.ts +2 -2
  354. package/src/provider/collect.ts +4 -1
  355. package/src/public-runtime.ts +15 -1
  356. package/src/public-tools.ts +2 -0
  357. package/src/public-types.ts +7 -0
  358. package/src/registry/index.ts +7 -0
  359. package/src/registry/tool/execute.test.ts +211 -7
  360. package/src/registry/tool/execute.ts +199 -11
  361. package/src/registry/toolset/catalog.test.ts +165 -0
  362. package/src/registry/toolset/catalog.ts +283 -0
  363. package/src/runtime/query/__tests__/deferred-tools.test.ts +230 -0
  364. package/src/runtime/query/__tests__/executor-concurrency.test.ts +122 -0
  365. package/src/runtime/query/__tests__/executor-plugin-hooks.test.ts +48 -3
  366. package/src/runtime/query/__tests__/long-document-flow.test.ts +180 -0
  367. package/src/runtime/query/__tests__/prompt.test.ts +55 -2
  368. package/src/runtime/query/__tests__/stream-recovery.test.ts +156 -0
  369. package/src/runtime/query/continuation.ts +16 -0
  370. package/src/runtime/query/executor.ts +82 -13
  371. package/src/runtime/query/index.ts +58 -5
  372. package/src/runtime/query/iteration/index.ts +361 -74
  373. package/src/runtime/query/iteration/phases/checkpoint.ts +7 -2
  374. package/src/runtime/query/iteration/phases/compaction.ts +89 -3
  375. package/src/runtime/query/iteration/phases/context.ts +68 -0
  376. package/src/runtime/query/iteration/phases/hitl-abort-race.test.ts +86 -0
  377. package/src/runtime/query/iteration/phases/hitl-answer-question.test.ts +139 -0
  378. package/src/runtime/query/iteration/phases/tool-review.ts +7 -3
  379. package/src/runtime/query/iteration/phases/working-memory-compaction.test.ts +215 -0
  380. package/src/runtime/query/iteration/phases/working-memory.ts +86 -0
  381. package/src/runtime/query/prompt.ts +17 -1
  382. package/src/runtime/query/tooling.ts +2 -0
  383. package/src/sandbox/provider/local.ts +33 -0
  384. package/src/session/workspace/__tests__/shared-run.test.ts +181 -0
  385. package/src/session/workspace/index.ts +6 -0
  386. package/src/session/workspace/shared-run.ts +317 -0
  387. package/src/skills/loader.test.ts +89 -0
  388. package/src/skills/loader.ts +37 -6
  389. package/src/streaming/coalesce.test.ts +4 -4
  390. package/src/tools/builtins/__tests__/edit.test.ts +57 -0
  391. package/src/tools/builtins/__tests__/payload-budget.test.ts +92 -0
  392. package/src/tools/builtins/__tests__/read-file.test.ts +43 -0
  393. package/src/tools/builtins/__tests__/verify-outputs.test.ts +71 -0
  394. package/src/tools/builtins/__tests__/write-file.test.ts +97 -0
  395. package/src/tools/builtins/bash.ts +48 -7
  396. package/src/tools/builtins/edit.ts +162 -27
  397. package/src/tools/builtins/index.ts +13 -13
  398. package/src/tools/builtins/read-file.ts +81 -10
  399. package/src/tools/builtins/search-tools.ts +42 -7
  400. package/src/tools/builtins/verify-outputs.ts +126 -0
  401. package/src/tools/builtins/write-file.ts +83 -14
  402. package/src/tools/coordinator/__tests__/agent.test.ts +172 -0
  403. package/src/tools/coordinator/__tests__/approve-plan.test.ts +139 -0
  404. package/src/tools/coordinator/__tests__/ask-user-question.test.ts +370 -0
  405. package/src/tools/coordinator/__tests__/task-list.test.ts +182 -0
  406. package/src/tools/coordinator/agent.ts +157 -0
  407. package/src/tools/coordinator/index.ts +355 -39
  408. package/src/types/agent/base.ts +8 -0
  409. package/src/types/agent/index.ts +1 -0
  410. package/src/types/agent/reactive.ts +42 -0
  411. package/src/types/agent/supervisor.ts +36 -0
  412. package/src/types/agent/working-memory.ts +29 -0
  413. package/src/types/common/index.ts +19 -0
  414. package/src/types/common/usage-merge.test.ts +53 -0
  415. package/src/types/connector/mcp.ts +14 -2
  416. package/src/types/hitl/index.ts +52 -1
  417. package/src/types/message/index.ts +32 -2
  418. package/src/types/provider/chat.ts +12 -9
  419. package/src/types/run/events.ts +6 -0
  420. package/src/types/sandbox/index.ts +219 -0
  421. package/src/types/skills/index.ts +4 -0
  422. package/src/types/tool/index.ts +24 -0
  423. package/src/types/toolset/index.ts +86 -0
  424. package/src/types/workspace/index.ts +9 -0
  425. package/src/types/workspace/shared-run.ts +65 -0
  426. package/src/verification/index.ts +1 -0
  427. package/src/verification/presets.test.ts +112 -0
  428. package/src/verification/presets.ts +72 -0
  429. package/src/version.ts +26 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,534 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ac85934: Add a model-authored `ask_user_question` HITL surface to the coordinator
8
+ toolset. `HITLDecisionRequest` gains a `user_question` variant carrying
9
+ `UserQuestionData` (questionId = the asking `tool_use_id`, question text,
10
+ optional header, 2-4 model-authored options, multiSelect, allowFreeText),
11
+ and `HITLResumeDecision` gains `answer_question` (selectedOptionIds,
12
+ optional freeText, optional questionId echo as a misdirection guard).
13
+ The tool registers only when `buildCoordinatorTools` receives BOTH a
14
+ `resumeHandler` and a `runId` (SupervisorAgent threads its configured
15
+ `resumeHandler` through automatically), parks the run through the same
16
+ ResumeHandler channel as plan approvals, and returns the user's answer
17
+ verbatim as the tool result — selections quote question and labels,
18
+ free text is rendered "in their own words", and an empty/misdirected/
19
+ mismatched answer yields an explicit "the user did not answer" sentinel
20
+ instead of fabricated consent. The tool is deliberately NOT
21
+ concurrency-safe so multiple questions in one assistant turn park
22
+ strictly one at a time against host run-keyed park registries.
23
+ Headless callers degrade safely: `autoApproveHandler` answers
24
+ `user_question` with the no-selection sentinel ("No user is available
25
+ to answer. Proceed using your best judgment."), so runs without an
26
+ interactive ResumeHandler never deadlock and never invent a choice.
27
+ Existing ResumeHandler implementations compile unchanged (additive
28
+ union widening); bare plan-approval and tool-review flows are
29
+ byte-identical.
30
+ - 9df35d1: Make a Stop abort the IN-FLIGHT model turn, not only between turns.
31
+
32
+ `ChatCompletionParams` gains an optional `signal?: AbortSignal`. The query
33
+ runtime threads the run's abort signal into every provider call (the streaming
34
+ turn and the forced-final summary) and now drives the provider stream through a
35
+ MANUAL iterator that RACES each `next()` against the abort — so a cancellation
36
+ tears the turn down within a tick even if a transport buffers or ignores the
37
+ signal, with the abort propagating out of the generator so the run settles as
38
+ `cancelled`. The stream consumer cleans up on every exit (removes the abort
39
+ listener, calls `iterator.return()`), and the natural-completion break
40
+ re-checks the signal so a Stop that lands exactly as the turn finishes is
41
+ recorded as cancelled rather than a normal end-of-turn.
42
+
43
+ Every provider now honours the signal at the transport: Anthropic
44
+ (`messages.create({ signal })`), OpenAI (`create(..., { signal })`), Bedrock
45
+ (`send(..., { abortSignal })`), OpenRouter + HTTP (compose with the request
46
+ timeout via `AbortSignal.any`), Ollama (the returned iterator's `.abort()`),
47
+ and LM Studio (`respond(..., { signal })` → the SDK's websocket cancel) — each
48
+ plus a cheap per-chunk `signal.throwIfAborted()` for promptness.
49
+
50
+ Fully additive and inert when unset: a never-aborted signal is behaviourally
51
+ identical to omitting it, so existing callers and uncancelled runs are
52
+ byte-identical.
53
+
54
+ - 6c09394: Add an optional feedback channel to plan approvals: `HITLResumeDecision`'s
55
+ `approve_plan` variant now carries `feedback?: string`, the plan-approval
56
+ resume handler forwards it as `PlanApprovalResponse.feedback`, and the
57
+ coordinator `approve_plan` tool embeds approve-with-edits feedback in the
58
+ model-visible tool result so the supervisor applies the user's edits
59
+ atomically with the approval. Bare approvals are byte-identical to before;
60
+ existing resume handlers compile and behave unchanged.
61
+ - 8c07556: Tool-loading economics: honor prompt caching in the Anthropic provider and
62
+ make deferred-tool discovery ranked and bounded.
63
+
64
+ `@namzu/anthropic`:
65
+
66
+ - `cacheControl` on `ChatCompletionParams` is now honored (it was silently
67
+ dropped; `cache_read_input_tokens` was always 0). The provider emits up to
68
+ three `cache_control: {type:'ephemeral'}` breakpoints per request: the
69
+ tools-array tail, the last `'cache'`-tagged system block, and the last
70
+ message block (render order tools → system → messages).
71
+ - System messages are sent as a block array preserving `SystemMessage.cacheHint`
72
+ segment boundaries instead of being joined into one string. The OAuth
73
+ Claude Code identity block stays first.
74
+ - `toolChoice: 'none'` now maps to Anthropic's first-class
75
+ `tool_choice: {type:'none'}` instead of `{type:'auto'}`, and `tool_choice`
76
+ is only sent alongside a `tools` param.
77
+ - `parallelToolCalls: false` now maps to `disable_parallel_tool_use: true`
78
+ on the `tool_choice` (previously unmapped).
79
+
80
+ `@namzu/sdk`:
81
+
82
+ - The runtime keeps the tools param byte-stable on forced-final iterations
83
+ (resource-limit finalization) and forbids tool use via `toolChoice: 'none'`
84
+ instead of omitting `tools` — omitting busted the whole prompt-cache prefix
85
+ and risked a 400 with `tool_use`/`tool_result` blocks in history.
86
+ - `ToolRegistry.toPromptSection()` lists active tools name-only (their
87
+ descriptions and schemas already ride the runtime tools param every
88
+ request) and gives deferred tools a first-sentence hint (≤100 chars) so the
89
+ model can discover what a deferred name does before searching.
90
+ - `ToolRegistry.searchDeferred()` is now a ranked weighted search (exact
91
+ name 12, name substring 8, description 5, argument names 3 — the
92
+ `ToolCatalog.searchTools` weights) with generic CRUD verbs (`list`,
93
+ `read`, `create`, `update`, `get`, `find`, `delete`, `search`) added to the
94
+ stop-token set. `search_tools` activates only the top-5 ranked matches and
95
+ reports up to 5 near-misses as name+hint WITHOUT activating them, so a
96
+ retrieval miss becomes a cheap re-query instead of a dead end. The
97
+ `search_tools` input wire shape (`{query}`) is unchanged.
98
+
99
+ ### Patch Changes
100
+
101
+ - 999e4be: Context-management correctness fixes (Vandal round-3 architecture audit).
102
+
103
+ - **Compaction no longer orphans tool pairs.** `runCompactionCheck` now snaps
104
+ the recent-window boundary through `findSafeTrimIndex` (previously wired only
105
+ to the unused `ConversationManager` strategy classes), so a compaction cut can
106
+ never leave a `tool_result` at the head of the recent window whose `tool_use`
107
+ was summarized away. That orphan otherwise makes the provider reject the very
108
+ next turn with a 400 — compaction killing the long run it exists to keep alive.
109
+ - **Resume preserves the compaction summary + working-memory slot.** The
110
+ checkpoint-restore path used to drop EVERY system message, silently losing the
111
+ `[COMPACTED CONTEXT]` block (the only record of the older history a pass
112
+ deleted) on `resumeFromCheckpoint`. It now re-pushes the fresh static/dynamic
113
+ floor but preserves the compaction summary and the pinned working-memory slot.
114
+ - **Within-turn usage is merged, not last-write-wins.** `mergeTokenUsage`
115
+ (per-field high-water mark) replaces `usage = chunk.usage` in `collect()` and
116
+ the iteration stream reducer, so a late usage frame that omits input/cache
117
+ tokens no longer zeroes the counts captured earlier in the stream.
118
+ - **HITL parks are cancellable.** `awaitDecisionOrAbort` races the tool-review
119
+ and iteration-checkpoint `resumeHandler` parks against the run's abort signal,
120
+ so a Stop that arrives while parked resolves the park as `abort` instead of
121
+ hanging until the host answers. Degrades to a plain await when no controller
122
+ is wired; fails closed to `abort` if the handler rejects.
123
+
124
+ All changes are internal correctness fixes; the provider/message wire contract
125
+ is unchanged and existing consumers stay behaviourally identical outside the
126
+ buggy edge cases above.
127
+
128
+ - 42f577e: Recreate shared run workspace manifest directories before atomic writes.
129
+ - 9a0c5ee: Plan-rejection guidance now follows the user's feedback instead of baking in
130
+ an unconditional revise loop. The old output told the supervisor to "revise
131
+ your plan ... and call approve_plan again" even when the feedback explicitly
132
+ asked it to stop, so a rejection meant to halt kept generating new plans.
133
+ The output now instructs: follow the feedback — revise and re-submit only if
134
+ changes were requested; acknowledge and end the turn if asked to stop; ask
135
+ the user how to proceed when no feedback was given.
136
+ - 0d1fb7b: Harden file intake and ACI readiness failure handling.
137
+
138
+ The built-in read tool now guides Office and PDF packages through
139
+ extractor tooling instead of treating binary document containers as
140
+ UTF-8 text. The ACI Standby Pool backend now deletes a claimed
141
+ container group when IP or worker readiness polling fails before a
142
+ Sandbox handle is returned.
143
+
144
+ - 2c5dd7a: The supervisor's task ledger no longer fabricates success for workers that
145
+ produced no result. Previously, when a task handle had no `result`, the
146
+ synthesized entry took its status from `handle.state` (cast to a terminal
147
+ type) — so a handle reporting `state: 'completed'` but carrying no result was
148
+ counted toward `completedTasks`. The supervisor then reported "workers done"
149
+ with empty outputs when the workers never actually produced anything.
150
+
151
+ An absent result is now always synthesized as a terminal `'failed'`, so it can
152
+ never count as a completed task. Handles that carry a real `result` are
153
+ preserved verbatim, so genuine workers are unaffected. The synthesis and tally
154
+ are extracted into `synthesizeTaskResults` / `countCompletedTasks` and covered
155
+ by unit tests.
156
+
157
+ - 271e6cf: Accept plain-text `approve_plan` step lists and normalize them into canonical
158
+ step objects before execution. This keeps plan approval cards resilient when a
159
+ provider emits numbered prose instead of an array-shaped argument.
160
+ - b776acf: Make the package-version read bundle-safe. `version.ts` read `../package.json`
161
+ via `createRequire(import.meta.url)` at module-init with no guard. esbuild leaves
162
+ `createRequire` calls as runtime requires and collapses the dist tree into a
163
+ single file, so in a bundle `../package.json` no longer resolves and the read
164
+ threw at import time — crashing the whole process on any code path that touches
165
+ the SDK runtime (`Cannot find module '../package.json'`). Wrap the read in
166
+ try/catch with a `0.0.0` fallback, mirroring the CLI's existing
167
+ `readPackageVersion`. Unbundled behaviour is unchanged (real version is read);
168
+ a bundled build degrades the cosmetic version string instead of crashing.
169
+
170
+ ## 1.0.0
171
+
172
+ ### Major Changes
173
+
174
+ - df09910: fix(sdk)!: drop plan-task lifecycle from `buildAgentTool`
175
+
176
+ `buildAgentTool` used to auto-create a plan task in the supplied
177
+ `taskStore` and flip it to `'in_progress'` before invoking the
178
+ subagent. On success it flipped to `'completed'`, but on failure
179
+ the plan task was left stuck in `'in_progress'` forever — the
180
+ `TaskStatus` enum has no `'failed'` value to transition to, so
181
+ there was no honest way to close it from inside the tool.
182
+
183
+ Removed `taskStore` and `runId` from `AgentToolOptions` entirely.
184
+ The `Agent` tool's job is "invoke a subagent and return the
185
+ result"; plan-task tracking is the parent's responsibility via
186
+ `TaskCreate` / `TaskUpdate`, where the host owns the status
187
+ semantics. This avoids the leak class entirely instead of
188
+ patching it.
189
+
190
+ Breaking change for any consumer that was relying on the auto-
191
+ plan-task behaviour. Migrate by creating the plan task on the
192
+ host side before calling `Agent`, and updating it on the host
193
+ side once the tool result is in hand.
194
+
195
+ - ea21863: feat(sdk)!: rename builtin tools to Claude Code canonical names
196
+
197
+ **Breaking change.** Builtin tool names now mirror Claude Code's canonical
198
+ tool table verbatim (per `code.claude.com/docs/en/tools-reference`):
199
+
200
+ - `bash` → `Bash`
201
+ - `edit` → `Edit`
202
+ - `glob` → `Glob`
203
+ - `grep` → `Grep`
204
+ - `read_file` → `Read`
205
+ - `write_file` → `Write`
206
+
207
+ `LsTool` and `SearchToolsTool` are still exported but **removed from the
208
+ default `getBuiltinTools()` set**. Claude Code's training distribution
209
+ does not include `LS` (directory listing is `Bash` + `Glob`) and has no
210
+ `search_tools` analogue at all. Including them in the defaults gave the
211
+ model two tools that looked right but degraded alignment. Hosts that
212
+ genuinely want either can register them explicitly.
213
+
214
+ Why this is breaking and worth it: Namzu is a peer to Claude Code's
215
+ native agentic surface, not a wrapper around the Anthropic Beta Agents
216
+ API. Mirroring the canonical names verbatim means Claude's pretrained
217
+ agentic instincts apply for free — no system-prompt argument needed to
218
+ explain what `Read` or `Bash` does. Idiosyncratic snake_case names threw
219
+ that alignment away on every call.
220
+
221
+ **Migration:** consumers that hard-code tool-name strings in their
222
+ prompt overlays, friendly-label maps, or per-tool deny rules need to
223
+ update them to the new PascalCase names. The runtime registry contracts
224
+ (register / get / has) are unchanged; only the literal string names of
225
+ the builtin tools moved.
226
+
227
+ - 8fd9349: feat(sandbox)!: Anthropic-style multi-mount container sandbox layout
228
+
229
+ Adds a declarative `ContainerSandboxLayout` shape that maps onto
230
+ Anthropic's container architecture (Claude container blueprint,
231
+ Code Interpreter, "skills"). The `Container` prefix is load-bearing
232
+ — this layout is specific to the container tier; future microVM /
233
+ process tiers will carry their own layout types when their adapters
234
+ land. Layout is supplied at provider construction — not per
235
+ `provider.create()` call — so the type system catches missing-layout
236
+ mistakes at compile time:
237
+
238
+ ```ts
239
+ import {
240
+ createSandboxProvider,
241
+ SANDBOX_DEFAULT_OUTPUTS_PATH, // re-exported from @namzu/sdk
242
+ } from "@namzu/sandbox";
243
+
244
+ const provider = createSandboxProvider({
245
+ backend: { tier: "container", image: "namzu-worker:latest" },
246
+ layout: {
247
+ outputs: {
248
+ source: {
249
+ type: "hostDir",
250
+ hostPath: "/var/lib/vandal/sessions/<task>/outputs",
251
+ },
252
+ },
253
+ uploads: {
254
+ source: {
255
+ type: "hostDir",
256
+ hostPath: "/var/lib/vandal/sessions/<task>/uploads",
257
+ },
258
+ },
259
+ skills: [
260
+ {
261
+ id: "pdf-tools",
262
+ source: { type: "hostDir", hostPath: "/opt/skills/pdf-tools" },
263
+ },
264
+ ],
265
+ },
266
+ });
267
+ ```
268
+
269
+ Each mount carries a discriminated `ContainerSandboxMountSource`.
270
+ The single variant today is `{ type: 'hostDir'; hostPath: string }`;
271
+ future variants (squashfs skill bundles, managed volumes attached
272
+ to a container backend) land additively as minor bumps without
273
+ reshaping the consumer call site.
274
+
275
+ Layout fields and their defaults:
276
+
277
+ - `outputs` — RW. Default `/mnt/user-data/outputs`. **Required**.
278
+ - `uploads` — RO. Default `/mnt/user-data/uploads`.
279
+ - `toolResults` — RO. Default `/mnt/user-data/tool_results`.
280
+ - `skills` — RO list, default `/mnt/skills/<id>` per entry.
281
+ - `transcripts` — RO. Default `/mnt/transcripts`.
282
+
283
+ The defaults are exported as constants from `@namzu/sdk`'s root
284
+ barrel (`SANDBOX_DEFAULT_OUTPUTS_PATH`,
285
+ `SANDBOX_DEFAULT_UPLOADS_PATH`, `SANDBOX_DEFAULT_TOOL_RESULTS_PATH`,
286
+ `SANDBOX_DEFAULT_TRANSCRIPTS_PATH`, `SANDBOX_DEFAULT_SKILLS_PARENT`)
287
+ and re-exported from `@namzu/sandbox`, so prompt-template generators
288
+ and the backend agree on a single source of truth. Both import
289
+ paths (`@namzu/sdk` and `@namzu/sandbox`) are pinned by tests.
290
+
291
+ There is intentionally **no `scratchpad` field**: the
292
+ container-internal RW area (`/home/<imageUser>`) is image-bake
293
+ responsibility, not a runtime knob.
294
+
295
+ **Validation** runs synchronously inside `createSandboxProvider` and
296
+ collects every violation in one
297
+ `ContainerSandboxLayoutValidationError.reasons[]`:
298
+
299
+ - `outputs` must be present.
300
+ - Skill IDs match `/^[a-zA-Z0-9_.-]+$/`, and `id.includes('..')` is
301
+ rejected (path-traversal guard — covers `..`, `foo..bar`,
302
+ `..foo`, `foo..`). Isolated dots (`pdf-tools.v2`) pass.
303
+ - Skill IDs are unique.
304
+ - Resolved `containerPath`s are unique across every mount slot.
305
+
306
+ **Error transport.** `ContainerSandboxLayoutValidationError`
307
+ carries a `cause` field (Error native), `toJSON()` keeps `reasons`
308
+ (and `cause` when set), and a new helper
309
+ `serializeSandboxError(err: unknown): SerializedSandboxError`
310
+ returns a plain object that survives `structuredClone`,
311
+ `postMessage`, and `JSON.stringify` round-trips uniformly. The
312
+ helper is **cycle-safe** — a `WeakSet`-threaded recursion detects
313
+ self-cycles (`a.cause = a`), two-node cycles (`a.cause = b;
314
+ b.cause = a`), and longer loops, replacing the offending node with
315
+ a `{ name: 'CircularReference', message: '[circular]' }` sentinel
316
+ rather than overflowing the stack. The helper is also
317
+ **transport-safe** — non-Error causes (Function, Symbol, BigInt,
318
+ NaN, ±Infinity, undefined, null, primitives, plain objects) are
319
+ converted to a typed envelope by `serializeNonErrorCause` BEFORE
320
+ they enter the wire shape, so values that `JSON.stringify` drops
321
+ silently or `structuredClone` throws on never appear.
322
+ `SerializedSandboxError.cause` is strictly typed
323
+ `SerializedSandboxError | undefined`. Use the helper at any
324
+ worker / IPC / log-shipper boundary; cloning the Error subclass
325
+ itself is not supported.
326
+
327
+ **Breaking changes** — the legacy single-mount paradigm is removed:
328
+
329
+ - `SandboxCreateConfig.hostWorkspaceDir` is removed. Pass the host
330
+ path on `layout.outputs.source.hostPath` at provider construction.
331
+ - `ContainerBackendConfig.workspaceMount` is removed. Pass the
332
+ in-container path on `layout.outputs.containerPath`.
333
+ - `SandboxProviderConfig` is now a discriminated union: the
334
+ container variant requires `layout: ContainerSandboxLayout`, the
335
+ other variants do not carry the field. Constructing a docker
336
+ provider without a layout fails at compile time.
337
+ - `SandboxCreateConfig.layout` does NOT exist; layout is
338
+ factory-baked. The SDK runtime cannot accidentally call a
339
+ container provider without a layout.
340
+ - The docker backend no longer allocates host directories
341
+ (`mkdtemp`) or removes them on `destroy()`. Every bind source is
342
+ consumer-owned. This also fixes an `EACCES: permission denied,
343
+ mkdir '/Users'` crash that hit sibling-container deployments
344
+ (Vandal Cowork).
345
+ - The worker no longer reads `NAMZU_SANDBOX_LAYOUT` (it never
346
+ branched on the env, only logged it; size grew with the skill
347
+ list). Only `NAMZU_SANDBOX_WORKSPACE` is forwarded today.
348
+
349
+ The reference Dockerfile pre-creates **only the parent directories**
350
+ `/mnt`, `/mnt/user-data`, `/mnt/skills` — root-owned, mode 0555.
351
+ Leaf paths (`outputs/`, `uploads/`, `tool_results/`, `transcripts/`,
352
+ `<skill-id>/`) are intentionally NOT pre-created. When a bind is
353
+ attached the docker daemon creates the leaf as the bind target;
354
+ when not attached, the leaf does not exist — the model gets ENOENT
355
+ instead of an empty writable dir that looks "mounted but uploaded
356
+ nothing".
357
+
358
+ `pnpm sandbox:smoke` (alias for `pnpm --filter @namzu/sandbox
359
+ test:smoke`) runs an opt-in docker integration test exercising the
360
+ leaf-permission contract against a real docker daemon. Excluded
361
+ from the default `pnpm test`; gated by a dedicated
362
+ `.github/workflows/sandbox-smoke.yml` workflow that builds the
363
+ reference image and runs the smoke test on PR / push when the
364
+ sandbox surface changes. On CI (`process.env.CI === 'true'`), the
365
+ smoke test fails fast if docker / the image are absent rather than
366
+ silently skipping.
367
+
368
+ `@namzu/sdk` exports `ContainerSandboxLayout`,
369
+ `ContainerSandboxLayoutMount`, `ContainerSandboxMountSource`,
370
+ `ContainerSandboxSkillMount`, `ResolvedContainerSandboxLayout`,
371
+ and the five `SANDBOX_DEFAULT_*_PATH` constants from its root
372
+ barrel. `@namzu/sandbox` re-exports those names plus
373
+ `ContainerSandboxLayoutValidationError`, `serializeSandboxError`,
374
+ and the `SerializedSandboxError` shape. The packed-tarball shape
375
+ is verified by `.github/scripts/verify-consumer-install.sh`'s
376
+ `@namzu/sandbox public-surface fixture`, which installs the
377
+ package from a tarball into a clean project and asserts every
378
+ documented constant + runtime export comes back via both
379
+ `@namzu/sandbox` and `@namzu/sdk` import paths. `@namzu/sandbox`
380
+ is also added to `ci.yml`'s `publint` and ATTW (Are The Types
381
+ Wrong) gates.
382
+
383
+ ### Minor Changes
384
+
385
+ - 542f057: feat(sdk): canonical `Agent` tool for synchronous subagent delegation
386
+
387
+ Adds `buildAgentTool({ gateway, workingDirectory, allowedAgentIds, ... })`
388
+ that builds a single tool named `Agent` with the input shape
389
+ `{ description, prompt, subagent_type }`. This mirrors Claude Code's
390
+ training distribution verbatim (per `code.claude.com/docs/en/sub-agents`):
391
+ the parent's tool call BLOCKS on `gateway.waitForTask(handle.taskId)`,
392
+ the subagent runs in its own context window, and the subagent's final
393
+ text comes back as the tool result.
394
+
395
+ Why this matters: the existing `buildCoordinatorTools` shipped a
396
+ non-blocking `create_task` / `continue_task` / `cancel_task` trio that
397
+ returned immediately and surfaced subagent completion via a
398
+ `<task-notification>` callback. That pattern is useful for fire-and-
399
+ forget multi-task fan-out but is **not** what Claude was trained on.
400
+ Models calling the async coordinator tools waste tokens reasoning
401
+ about whether the task completed yet; with the canonical `Agent`
402
+ tool, the model just receives the result and continues. Free
403
+ alignment, no system-prompt argument needed.
404
+
405
+ Both surfaces remain available — the coordinator trio is the right
406
+ choice for genuine work-queue surfaces, the `Agent` tool is the
407
+ right choice when the host wants Claude Code parity.
408
+
409
+ - 265150b: feat(sdk): default sandboxed verification gate preset + expanded brick-pattern denylist
410
+
411
+ Ship `defaultSandboxedGateConfig()` and `defaultSandboxedShellGateConfig()` from `@namzu/sdk` so
412
+ hosts running an agent inside an isolated workspace don't have to hand-roll a `VerificationRule[]`
413
+ just to keep in-sandbox file mutation from triggering a review prompt on every call. The first
414
+ preset auto-allows read-only tools and `category: 'filesystem' | 'analysis' | 'custom'`; the
415
+ second extends auto-allow to `category: 'shell'` for hosts with real OS-level isolation. Both
416
+ keep the dangerous-patterns hard-deny in place.
417
+
418
+ `DANGEROUS_PATTERNS` (consumed by the `deny_dangerous_patterns` rule) gains entries for `sudo`,
419
+ `su -`, world-writable `chmod 777 /`, `curl|sh` / `wget|sh` exfil-then-exec pipes, outbound
420
+ `ssh user@host`, and raw dynamic `eval`. The list is still high-signal, not exhaustive — the
421
+ README in `verification/presets.ts` is explicit that the sandbox itself is the safety boundary
422
+ and the patterns only catch blatant attempts.
423
+
424
+ - 52af97e: **Paste images into the conversation (vision input).**
425
+
426
+ A user message can now carry image attachments. `@namzu/sdk` adds an optional `attachments` field to user messages (`ImageAttachment { data, mediaType }`, additive — text messages are unchanged), and the Anthropic provider sends them as image content blocks so the model can see them. In the CLI, press `Ctrl+V` to paste an image from the clipboard — it shows as an `⎘ Image #N` chip in the composer and is sent to the model as vision input when you submit.
427
+
428
+ - a71422a: feat(sdk): ReactiveAgent forwards verificationGate to drainQuery
429
+
430
+ Adds an optional `verificationGate?: VerificationGateConfig` field on
431
+ `ReactiveAgentConfig` and forwards it through `ReactiveAgent.run()` into
432
+ `drainQuery`, mirroring the existing `SupervisorAgentConfig.verificationGate`
433
+ plumbing. Without this, child agents running under `ReactiveAgent` could not
434
+ opt into the same capability-aware deny/allow rules the supervisor already
435
+ uses — the only path was `drainQuery`'s `autoApproveHandler` default, which
436
+ approves every tool call silently. Hosts that want defense-in-depth at the
437
+ child level (deny dangerous shell patterns, restrict by category) can now
438
+ pass the same preset they pass to the supervisor.
439
+
440
+ - d6b5bc1: **Remove the legacy `append` file tool.** `AppendFileTool` is gone — it was already excluded from `getBuiltinTools()` (Claude Code's tool distribution has no `Append`), and appending is canonical `edit` with `insertLine: "end"`. The export is removed from the public surface; hosts that relied on it should switch to `edit`. namzu's CLI no longer needs to filter `append` out of its tool set.
441
+ - 63b4885: feat(sdk): forward sandboxProvider through reactive/supervisor agents
442
+
443
+ `ReactiveAgentConfig` and `SupervisorAgentConfig` gain an optional
444
+ `sandboxProvider?: SandboxProvider` field. When set, the agent's
445
+ `runConfig` builder forwards the provider into `drainQuery`'s
446
+ `sandboxProvider` slot, so the supervisor — and every child
447
+ specialist run that inherits the supervisor's run config — gets
448
+ the same per-task ephemeral container.
449
+
450
+ Without this plumbing, a host that wires `sandboxProvider` only on
451
+ the supervisor sees the field silently dropped before child
452
+ specialists are spawned, and each child runs without a sandbox.
453
+ The forwarding closes that gap so multi-agent hosts can pass a
454
+ single per-task provider instance and have supervisor + every
455
+ child share one container.
456
+
457
+ Pure additive change — `SupervisorAgent` / `ReactiveAgent`
458
+ constructors that don't pass `sandboxProvider` behave exactly as
459
+ before.
460
+
461
+ - d86b161: **namzu can now delegate to sub-agents.**
462
+
463
+ The CLI wires the SDK's native delegation: the model gets the canonical `Agent({ description, prompt, subagent_type })` tool and can hand a self-contained task to a fresh `general-purpose` sub-agent that runs in its own context window with its own tools, then returns its result. Delegations show in the transcript as a normal `Agent(...)` tool call with a live spinner and result.
464
+
465
+ To support this from a host, `@namzu/sdk` now exports `ThreadManager` and `InMemoryThreadStore` from its public runtime surface (alongside the already-public `AgentManager`, `AgentRegistry`, `ReactiveAgent`, `LocalTaskGateway`, `buildAgentTool`, and the session/summary/capacity/workspace primitives) so a consumer can stand up an `AgentManager` end to end.
466
+
467
+ ### Patch Changes
468
+
469
+ - 140bcc0: fix(sdk): Agent tool no longer reports failed subagents as successful
470
+
471
+ `buildAgentTool` was treating `gateway.waitForTask(handle.taskId)`'s
472
+ returned `state === 'completed'` as proof of success and ignoring
473
+ the underlying `BaseAgentResult.status`. That was wrong: some
474
+ gateways (the SDK's `LocalTaskGateway` for one) forward
475
+ `task.state` directly from the agent manager without re-deriving it
476
+ from the run's `status`, so a subagent run with `status: 'failed'`
477
+ plus a non-empty `lastError` could surface as `state: 'completed'`
478
+ and fool the parent into receiving `success: true` with garbage
479
+ output.
480
+
481
+ The check now requires BOTH layers to agree before reporting
482
+ success: gateway state must be `'completed'` AND the run's
483
+ `BaseAgentResult.status` (when present) must be `'completed'`. On
484
+ failure the tool surfaces `lastError` and the disagreement state in
485
+ both `error` and `data` so the parent can debug.
486
+
487
+ Adds three pinned cases in
488
+ `packages/sdk/src/tools/coordinator/__tests__/agent.test.ts`
489
+ covering: both-agree-success, run-status-failed-but-state-completed
490
+ (the regression case), and gateway-state-failed.
491
+
492
+ - 38c4b62: Harden two paths flagged by an adversarial review: `ToolRegistry.searchDeferred` no longer over-activates deferred tools — batched-query tokens match the tool name only (not descriptions) and short/generic tokens like `clawtool` are ignored, so a common word can't activate the whole catalog. The dynamic `Agent` sub-agent now unregisters its per-call `dyn-N` definition in a `finally`, so long sessions don't leak persona registrations on success, failure, or throw.
493
+ - a1c6694: **Fix a race when multiple file-mutating tools run in one turn.**
494
+
495
+ The tool executor ran every tool call in a batch with `Promise.all`, ignoring each tool's `concurrencySafe` flag. Several `edit`/`write` calls to the same file in one assistant turn therefore raced on read→modify→write — each read the same starting content and the last writer clobbered the others, even though every call reported success. The executor now honors `concurrencySafe`: read-only tools (ls/grep/glob/…) still run in parallel, but concurrency-unsafe tools (edit/write/append/bash) are serialized within the batch, so same-file edits apply one-after-another.
496
+
497
+ - 63e44f7: Worker `handleExecute` no longer crashes the per-task container when a
498
+ single request body is rejected by `resolveWithinWorkspace` (e.g. a host
499
+ path forwarded as `cwd`) or by the workspace `mkdir`. Each fallible step
500
+ now returns a typed `400` (or a terminal NDJSON `error` event for
501
+ post-headers failures) and the worker stays alive for the next call —
502
+ prior behaviour was an unhandled rejection on the `http.createServer`
503
+ callback, which on Node ≥ 15 exits the process and gives every
504
+ subsequent SDK call the bare `fetch failed` from `UND_ERR_SOCKET`.
505
+
506
+ The docker backend's host-side `execViaWorker` and `writeFile` fetches
507
+ now surface `error.cause.code` / `cause.message` instead of the
508
+ stripped `fetch failed`. The bash builtin no longer forwards
509
+ `context.workingDirectory` (a host-side path that has no meaning
510
+ inside the sandbox container) as `cwd`; tools that need a sub-cwd
511
+ inside the sandbox can be added later via an explicit
512
+ `SandboxExecOptions` field.
513
+
514
+ The SDK's iteration aggregator now derives
515
+ `ChatCompletionResponse.toolCalls[i].function.arguments` from each
516
+ bucket's parsed input rather than the raw `argsBuf` buffer. When a
517
+ provider stream truncates with `stop_reason: "max_tokens"` mid-
518
+ `input_json_delta`, downstream `JSON.parse` in
519
+ `runtime/query/executor.ts:executeSingle` no longer rejects with the
520
+ generic "Invalid JSON in tool arguments" — the tool runs against the
521
+ empty parsed object and the input zod schema produces a readable
522
+ "<field> is required" error instead.
523
+
524
+ - 38c4b62: Fix `search_tools` failing to load deferred tools when the model names several at once. `ToolRegistry.searchDeferred` matched the entire query as a single substring, so a batched query like `"A2aCard PeerRegister PeerList"` matched no tool and activated nothing — the subsequent call then failed with "deferred and cannot be executed". The query is now tokenized: a tool matches if its name or description contains the whole phrase OR any single term, so a batch activates each named tool.
525
+ - 6b74cd0: **Sub-agents do real work, and tool tracking is keyed on the SDK's tool-use id.**
526
+
527
+ - Sub-agents now get the same tool set as the parent — builtins, memory, and clawtool's catalog (deferred, incl. web search/fetch and peer dispatch) — so a delegated research/work task can actually use tools instead of answering from memory alone.
528
+ - The transcript's live tool tracking now matches each call by the SDK's stable `toolUseId` rather than by name/order, so parallel tool calls (even same-named) are attributed correctly.
529
+ - Stronger anti-fabrication instruction for both the main agent and sub-agents: never claim to have run a tool, written a file, or produced a result without actually doing it; if a capability is unavailable, say so instead of inventing output.
530
+ - `@namzu/sdk`: the `Agent` tool's `subagent_type` is now optional when only one sub-agent is registered (defaults to it), so the model can't trip a "subagent_type required" validation error on the common single-sub-agent setup.
531
+
3
532
  ## 0.6.0
4
533
 
5
534
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../src/advisory/executor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,cAA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\n${callCtx.workingStateSummary}`);
73
73
  }
74
74
  if (callCtx.toolCatalog && callCtx.toolCatalog.length > 0) {
75
- const toolNames = callCtx.toolCatalog.map((t) => t.function.name);
76
- contextParts.push(`## Available Tools\n${toolNames.join(', ')}`);
75
+ const toolLines = callCtx.toolCatalog.map((tool) => {
76
+ const description = tool.function.description?.trim();
77
+ return description ? `- ${tool.function.name}: ${description}` : `- ${tool.function.name}`;
78
+ });
79
+ contextParts.push([
80
+ '## Runtime Tool Summary',
81
+ 'These tools are available to the executor. Their executable schemas remain owned by the runtime tool catalogue; use this as advisory context only.',
82
+ toolLines.join('\n'),
83
+ ].join('\n'));
77
84
  }
78
85
  const messagesToInclude = this.truncateMessages(callCtx.messages, advisor.maxContextTokens);
79
86
  if (messagesToInclude.length > 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../src/advisory/executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAIhD,OAAO,EAAgB,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAEhG,OAAO,EAAe,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAgB/D,MAAM,OAAO,gBAAgB;IACX,MAAM,CAAQ;IAE/B,YAAY,MAAe;QAC1B,IAAI,CAAC,MAAM,GAAG,CAAC,MAAM,IAAI,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC,CAAA;IACnF,CAAC;IAED,KAAK,CAAC,OAAO,CACZ,OAA0B,EAC1B,OAAwB,EACxB,OAA4B;QAE5B,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QAE1B,MAAM,YAAY,GAAG,IAAI,CAAC,iBAAiB,CAAC,OA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AAG,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM,CAAA;YAC3C,IAAI,UAAU,GAAG,QAAQ,GAAG,UAAU;gBAAE,MAAK;YAC7C,UAAU,IAAI,QAAQ,CAAA;YACtB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QACpB,CAAC;QAED,OAAO,MAAM,CAAA;IACd,CAAC;IAED;;;;OAIG;IACK,WAAW,CAAC,UAAkB;QACrC,OAAO;YACN,MAAM,EAAE,UAAU;SAClB,CAAA;IACF,CAAC;IAED;;;;;OAKG;IACK,WAAW,CAAC,MAAkB;QACrC,OAAO;YACN,cAAc,EAAE,CAAC;YACjB,eAAe,EAAE,CAAC;YAClB,SAAS,EAAE,CAAC;YACZ,aAAa,EAAE,CAAC;SAChB,CAAA;IACF,CAAC;CACD"}
@@ -21,7 +21,8 @@
21
21
  * - `buildContext`:
22
22
  * - Returns [] when `request.includeContext === false`.
23
23
  * - Includes workingStateSummary when present.
24
- * - Includes toolCatalog names when present + non-empty.
24
+ * - Includes a runtime tool summary when a toolCatalog is present
25
+ * + non-empty; executable schemas remain runtime-owned.
25
26
  * - Includes truncated conversation context (most-recent-first
26
27
  * walk, bounded by `advisor.maxContextTokens * CHARS_PER_TOKEN`).
27
28
  * - Returns [] when no context parts were assembled.
@@ -1 +1 @@
1
- {"version":3,"file":"executor.test.d.ts","sourceRoot":"","sources":["../../src/advisory/executor.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG"}
1
+ {"version":3,"file":"executor.test.d.ts","sourceRoot":"","sources":["../../src/advisory/executor.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG"}
@@ -21,7 +21,8 @@
21
21
  * - `buildContext`:
22
22
  * - Returns [] when `request.includeContext === false`.
23
23
  * - Includes workingStateSummary when present.
24
- * - Includes toolCatalog names when present + non-empty.
24
+ * - Includes a runtime tool summary when a toolCatalog is present
25
+ * + non-empty; executable schemas remain runtime-owned.
25
26
  * - Includes truncated conversation context (most-recent-first
26
27
  * walk, bounded by `advisor.maxContextTokens * CHARS_PER_TOKEN`).
27
28
  * - Returns [] when no context parts were assembled.
@@ -173,7 +174,7 @@ describe('AdvisoryExecutor — buildContext', () => {
173
174
  // Only system + user(question)
174
175
  expect(call.messages).toHaveLength(2);
175
176
  });
176
- it('includes workingStateSummary + toolCatalog names when present', async () => {
177
+ it('includes workingStateSummary + runtime tool summary when present', async () => {
177
178
  const provider = mockProvider();
178
179
  const e = new AdvisoryExecutor();
179
180
  await e.consult(advisor({ provider }), req, {
@@ -195,8 +196,10 @@ describe('AdvisoryExecutor — buildContext', () => {
195
196
  const contextMsg = call.messages[1]?.content ?? '';
196
197
  expect(contextMsg).toContain('Working State');
197
198
  expect(contextMsg).toContain('state summary here');
198
- expect(contextMsg).toContain('Available Tools');
199
- expect(contextMsg).toContain('read_file, write_file');
199
+ expect(contextMsg).toContain('Runtime Tool Summary');
200
+ expect(contextMsg).toContain('executable schemas remain owned by the runtime tool catalogue');
201
+ expect(contextMsg).toContain('- read_file: read');
202
+ expect(contextMsg).toContain('- write_file: write');
200
203
  });
201
204
  it('includes conversation context (no truncation when no maxContextTokens)', async () => {
202
205
  const provider = mockProvider();