@namzu/sdk 68.0.1 → 69.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 (492) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/dist/agents/QueryAgent.d.ts.map +1 -1
  3. package/dist/agents/QueryAgent.js +2 -0
  4. package/dist/agents/QueryAgent.js.map +1 -1
  5. package/dist/authorization/skill-grant.d.ts.map +1 -1
  6. package/dist/authorization/skill-grant.js +1 -0
  7. package/dist/authorization/skill-grant.js.map +1 -1
  8. package/dist/bridge/acp/permission.d.ts +10 -0
  9. package/dist/bridge/acp/permission.d.ts.map +1 -1
  10. package/dist/bridge/acp/permission.js.map +1 -1
  11. package/dist/bridge/acp/server.d.ts +12 -0
  12. package/dist/bridge/acp/server.d.ts.map +1 -1
  13. package/dist/bridge/acp/server.js +21 -0
  14. package/dist/bridge/acp/server.js.map +1 -1
  15. package/dist/compaction/context-window.d.ts +8 -0
  16. package/dist/compaction/context-window.d.ts.map +1 -1
  17. package/dist/compaction/context-window.js +14 -0
  18. package/dist/compaction/context-window.js.map +1 -1
  19. package/dist/compaction/loaded-skills.d.ts +10 -0
  20. package/dist/compaction/loaded-skills.d.ts.map +1 -1
  21. package/dist/compaction/loaded-skills.js +45 -1
  22. package/dist/compaction/loaded-skills.js.map +1 -1
  23. package/dist/compaction/manager.d.ts +8 -0
  24. package/dist/compaction/manager.d.ts.map +1 -1
  25. package/dist/compaction/manager.js +31 -0
  26. package/dist/compaction/manager.js.map +1 -1
  27. package/dist/compaction/manual.d.ts.map +1 -1
  28. package/dist/compaction/manual.js +7 -1
  29. package/dist/compaction/manual.js.map +1 -1
  30. package/dist/compaction/model-summary.js +2 -2
  31. package/dist/compaction/model-summary.js.map +1 -1
  32. package/dist/compaction/restore.d.ts +8 -0
  33. package/dist/compaction/restore.d.ts.map +1 -1
  34. package/dist/compaction/restore.js +65 -0
  35. package/dist/compaction/restore.js.map +1 -1
  36. package/dist/compaction/salience/working-set.d.ts.map +1 -1
  37. package/dist/compaction/salience/working-set.js +2 -2
  38. package/dist/compaction/salience/working-set.js.map +1 -1
  39. package/dist/compaction/tool-result-editing.d.ts +6 -0
  40. package/dist/compaction/tool-result-editing.d.ts.map +1 -1
  41. package/dist/compaction/tool-result-editing.js +7 -1
  42. package/dist/compaction/tool-result-editing.js.map +1 -1
  43. package/dist/compaction/types.d.ts +2 -0
  44. package/dist/compaction/types.d.ts.map +1 -1
  45. package/dist/compaction/wire.d.ts.map +1 -1
  46. package/dist/compaction/wire.js +4 -0
  47. package/dist/compaction/wire.js.map +1 -1
  48. package/dist/connector/index.d.ts +2 -2
  49. package/dist/connector/index.d.ts.map +1 -1
  50. package/dist/connector/index.js +1 -1
  51. package/dist/connector/index.js.map +1 -1
  52. package/dist/connector/mcp/client.d.ts +29 -0
  53. package/dist/connector/mcp/client.d.ts.map +1 -1
  54. package/dist/connector/mcp/client.js +59 -2
  55. package/dist/connector/mcp/client.js.map +1 -1
  56. package/dist/connector/mcp/errors.d.ts +7 -0
  57. package/dist/connector/mcp/errors.d.ts.map +1 -1
  58. package/dist/connector/mcp/errors.js +14 -0
  59. package/dist/connector/mcp/errors.js.map +1 -1
  60. package/dist/connector/mcp/index.d.ts +5 -1
  61. package/dist/connector/mcp/index.d.ts.map +1 -1
  62. package/dist/connector/mcp/index.js +3 -1
  63. package/dist/connector/mcp/index.js.map +1 -1
  64. package/dist/connector/mcp/skill-source.d.ts +144 -0
  65. package/dist/connector/mcp/skill-source.d.ts.map +1 -0
  66. package/dist/connector/mcp/skill-source.js +375 -0
  67. package/dist/connector/mcp/skill-source.js.map +1 -0
  68. package/dist/connector/mcp/skills.d.ts +137 -0
  69. package/dist/connector/mcp/skills.d.ts.map +1 -0
  70. package/dist/connector/mcp/skills.js +303 -0
  71. package/dist/connector/mcp/skills.js.map +1 -0
  72. package/dist/manager/session/turn-recorder.d.ts.map +1 -1
  73. package/dist/manager/session/turn-recorder.js +23 -1
  74. package/dist/manager/session/turn-recorder.js.map +1 -1
  75. package/dist/network/audit.d.ts +1 -1
  76. package/dist/network/audit.d.ts.map +1 -1
  77. package/dist/network/audit.js +2 -0
  78. package/dist/network/audit.js.map +1 -1
  79. package/dist/network/computer.d.ts +107 -0
  80. package/dist/network/computer.d.ts.map +1 -0
  81. package/dist/network/computer.js +250 -0
  82. package/dist/network/computer.js.map +1 -0
  83. package/dist/network/index.d.ts +2 -0
  84. package/dist/network/index.d.ts.map +1 -1
  85. package/dist/network/index.js +1 -0
  86. package/dist/network/index.js.map +1 -1
  87. package/dist/network/join.d.ts +13 -1
  88. package/dist/network/join.d.ts.map +1 -1
  89. package/dist/network/join.js +21 -3
  90. package/dist/network/join.js.map +1 -1
  91. package/dist/network/roster.d.ts +5 -0
  92. package/dist/network/roster.d.ts.map +1 -1
  93. package/dist/network/roster.js.map +1 -1
  94. package/dist/network/service.d.ts +12 -2
  95. package/dist/network/service.d.ts.map +1 -1
  96. package/dist/network/service.js +539 -60
  97. package/dist/network/service.js.map +1 -1
  98. package/dist/network/store.d.ts +33 -1
  99. package/dist/network/store.d.ts.map +1 -1
  100. package/dist/network/store.js +48 -4
  101. package/dist/network/store.js.map +1 -1
  102. package/dist/network/transport.d.ts +1 -1
  103. package/dist/network/transport.js +1 -1
  104. package/dist/network/wire.d.ts +14 -0
  105. package/dist/network/wire.d.ts.map +1 -1
  106. package/dist/network/wire.js +17 -1
  107. package/dist/network/wire.js.map +1 -1
  108. package/dist/plugin/shell-hook-tool-names.d.ts.map +1 -1
  109. package/dist/plugin/shell-hook-tool-names.js +1 -0
  110. package/dist/plugin/shell-hook-tool-names.js.map +1 -1
  111. package/dist/plugin/shell-hook.d.ts +8 -3
  112. package/dist/plugin/shell-hook.d.ts.map +1 -1
  113. package/dist/plugin/shell-hook.js +132 -7
  114. package/dist/plugin/shell-hook.js.map +1 -1
  115. package/dist/prompt/coding-agent-doctrine.d.ts +4 -4
  116. package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
  117. package/dist/prompt/coding-agent-doctrine.js +7 -2
  118. package/dist/prompt/coding-agent-doctrine.js.map +1 -1
  119. package/dist/provider/fallback.d.ts.map +1 -1
  120. package/dist/provider/fallback.js +9 -0
  121. package/dist/provider/fallback.js.map +1 -1
  122. package/dist/provider/idle-timeout.d.ts.map +1 -1
  123. package/dist/provider/idle-timeout.js +8 -0
  124. package/dist/provider/idle-timeout.js.map +1 -1
  125. package/dist/provider/instrumentation.d.ts.map +1 -1
  126. package/dist/provider/instrumentation.js +10 -0
  127. package/dist/provider/instrumentation.js.map +1 -1
  128. package/dist/provider/model-window-suffix.d.ts.map +1 -1
  129. package/dist/provider/model-window-suffix.js +2 -0
  130. package/dist/provider/model-window-suffix.js.map +1 -1
  131. package/dist/provider/retry.d.ts.map +1 -1
  132. package/dist/provider/retry.js +8 -0
  133. package/dist/provider/retry.js.map +1 -1
  134. package/dist/public-runtime.d.ts +10 -7
  135. package/dist/public-runtime.d.ts.map +1 -1
  136. package/dist/public-runtime.js +12 -5
  137. package/dist/public-runtime.js.map +1 -1
  138. package/dist/public-tools.d.ts +7 -4
  139. package/dist/public-tools.d.ts.map +1 -1
  140. package/dist/public-tools.js +9 -3
  141. package/dist/public-tools.js.map +1 -1
  142. package/dist/public-types.d.ts +4 -1
  143. package/dist/public-types.d.ts.map +1 -1
  144. package/dist/registry/tool/presentation.d.ts +8 -1
  145. package/dist/registry/tool/presentation.d.ts.map +1 -1
  146. package/dist/registry/tool/presentation.js +14 -5
  147. package/dist/registry/tool/presentation.js.map +1 -1
  148. package/dist/runtime/jobs/registry.d.ts.map +1 -1
  149. package/dist/runtime/jobs/registry.js +2 -1
  150. package/dist/runtime/jobs/registry.js.map +1 -1
  151. package/dist/runtime/query/auto-review/classifier.d.ts.map +1 -1
  152. package/dist/runtime/query/auto-review/classifier.js +19 -3
  153. package/dist/runtime/query/auto-review/classifier.js.map +1 -1
  154. package/dist/runtime/query/auto-review/failure.d.ts +12 -0
  155. package/dist/runtime/query/auto-review/failure.d.ts.map +1 -0
  156. package/dist/runtime/query/auto-review/failure.js +46 -0
  157. package/dist/runtime/query/auto-review/failure.js.map +1 -0
  158. package/dist/runtime/query/auto-review/index.d.ts +1 -0
  159. package/dist/runtime/query/auto-review/index.d.ts.map +1 -1
  160. package/dist/runtime/query/auto-review/index.js +1 -0
  161. package/dist/runtime/query/auto-review/index.js.map +1 -1
  162. package/dist/runtime/query/executor/tool-call-admission.d.ts.map +1 -1
  163. package/dist/runtime/query/executor/tool-call-admission.js +10 -1
  164. package/dist/runtime/query/executor/tool-call-admission.js.map +1 -1
  165. package/dist/runtime/query/executor.d.ts +12 -0
  166. package/dist/runtime/query/executor.d.ts.map +1 -1
  167. package/dist/runtime/query/executor.js +43 -9
  168. package/dist/runtime/query/executor.js.map +1 -1
  169. package/dist/runtime/query/file-evidence-replay.d.ts.map +1 -1
  170. package/dist/runtime/query/file-evidence-replay.js +6 -6
  171. package/dist/runtime/query/file-evidence-replay.js.map +1 -1
  172. package/dist/runtime/query/index.d.ts +4 -0
  173. package/dist/runtime/query/index.d.ts.map +1 -1
  174. package/dist/runtime/query/index.js +40 -1
  175. package/dist/runtime/query/index.js.map +1 -1
  176. package/dist/runtime/query/iteration/index.d.ts.map +1 -1
  177. package/dist/runtime/query/iteration/index.js +2 -0
  178. package/dist/runtime/query/iteration/index.js.map +1 -1
  179. package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
  180. package/dist/runtime/query/iteration/phases/compaction.js +21 -3
  181. package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
  182. package/dist/runtime/query/iteration/phases/context.d.ts +4 -0
  183. package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
  184. package/dist/runtime/query/iteration/phases/context.js.map +1 -1
  185. package/dist/runtime/query/iteration/phases/per-call-review.d.ts +6 -2
  186. package/dist/runtime/query/iteration/phases/per-call-review.d.ts.map +1 -1
  187. package/dist/runtime/query/iteration/phases/per-call-review.js +24 -9
  188. package/dist/runtime/query/iteration/phases/per-call-review.js.map +1 -1
  189. package/dist/runtime/query/iteration/step-shaping.d.ts.map +1 -1
  190. package/dist/runtime/query/iteration/step-shaping.js +4 -0
  191. package/dist/runtime/query/iteration/step-shaping.js.map +1 -1
  192. package/dist/runtime/query/prepare-turn.d.ts +5 -1
  193. package/dist/runtime/query/prepare-turn.d.ts.map +1 -1
  194. package/dist/runtime/query/prepare-turn.js +13 -3
  195. package/dist/runtime/query/prepare-turn.js.map +1 -1
  196. package/dist/runtime/query/review-policy.d.ts +15 -4
  197. package/dist/runtime/query/review-policy.d.ts.map +1 -1
  198. package/dist/runtime/query/review-policy.js +15 -4
  199. package/dist/runtime/query/review-policy.js.map +1 -1
  200. package/dist/runtime/query/shell-line-escalation.d.ts +24 -0
  201. package/dist/runtime/query/shell-line-escalation.d.ts.map +1 -0
  202. package/dist/runtime/query/shell-line-escalation.js +38 -0
  203. package/dist/runtime/query/shell-line-escalation.js.map +1 -0
  204. package/dist/runtime/query/tooling.d.ts +7 -0
  205. package/dist/runtime/query/tooling.d.ts.map +1 -1
  206. package/dist/runtime/query/tooling.js +2 -0
  207. package/dist/runtime/query/tooling.js.map +1 -1
  208. package/dist/runtime/query/turn/outcome-ledger.d.ts +4 -0
  209. package/dist/runtime/query/turn/outcome-ledger.d.ts.map +1 -1
  210. package/dist/runtime/query/turn/outcome-ledger.js +47 -1
  211. package/dist/runtime/query/turn/outcome-ledger.js.map +1 -1
  212. package/dist/sandbox/provider/local.d.ts.map +1 -1
  213. package/dist/sandbox/provider/local.js +3 -1
  214. package/dist/sandbox/provider/local.js.map +1 -1
  215. package/dist/scheduler/local.d.ts.map +1 -1
  216. package/dist/scheduler/local.js +3 -1
  217. package/dist/scheduler/local.js.map +1 -1
  218. package/dist/skills/index.d.ts +4 -0
  219. package/dist/skills/index.d.ts.map +1 -1
  220. package/dist/skills/index.js +2 -0
  221. package/dist/skills/index.js.map +1 -1
  222. package/dist/skills/inline-shell-host.d.ts +103 -0
  223. package/dist/skills/inline-shell-host.d.ts.map +1 -0
  224. package/dist/skills/inline-shell-host.js +238 -0
  225. package/dist/skills/inline-shell-host.js.map +1 -0
  226. package/dist/skills/inline-shell.d.ts +176 -0
  227. package/dist/skills/inline-shell.d.ts.map +1 -0
  228. package/dist/skills/inline-shell.js +646 -0
  229. package/dist/skills/inline-shell.js.map +1 -0
  230. package/dist/store/index.d.ts +2 -0
  231. package/dist/store/index.d.ts.map +1 -1
  232. package/dist/store/index.js +1 -0
  233. package/dist/store/index.js.map +1 -1
  234. package/dist/store/task/file.d.ts +124 -0
  235. package/dist/store/task/file.d.ts.map +1 -0
  236. package/dist/store/task/file.js +498 -0
  237. package/dist/store/task/file.js.map +1 -0
  238. package/dist/teams/backend.d.ts +28 -0
  239. package/dist/teams/backend.d.ts.map +1 -0
  240. package/dist/teams/backend.js +2 -0
  241. package/dist/teams/backend.js.map +1 -0
  242. package/dist/teams/fs-sync.d.ts +19 -0
  243. package/dist/teams/fs-sync.d.ts.map +1 -0
  244. package/dist/teams/fs-sync.js +81 -0
  245. package/dist/teams/fs-sync.js.map +1 -0
  246. package/dist/teams/index.d.ts +14 -0
  247. package/dist/teams/index.d.ts.map +1 -0
  248. package/dist/teams/index.js +11 -0
  249. package/dist/teams/index.js.map +1 -0
  250. package/dist/teams/names.d.ts +15 -0
  251. package/dist/teams/names.d.ts.map +1 -0
  252. package/dist/teams/names.js +43 -0
  253. package/dist/teams/names.js.map +1 -0
  254. package/dist/teams/store.d.ts +133 -0
  255. package/dist/teams/store.d.ts.map +1 -0
  256. package/dist/teams/store.js +536 -0
  257. package/dist/teams/store.js.map +1 -0
  258. package/dist/teams/types.d.ts +97 -0
  259. package/dist/teams/types.d.ts.map +1 -0
  260. package/dist/teams/types.js +70 -0
  261. package/dist/teams/types.js.map +1 -0
  262. package/dist/tools/admit-facts.d.ts.map +1 -1
  263. package/dist/tools/admit-facts.js +28 -0
  264. package/dist/tools/admit-facts.js.map +1 -1
  265. package/dist/tools/builtins/bash.d.ts.map +1 -1
  266. package/dist/tools/builtins/bash.js +5 -2
  267. package/dist/tools/builtins/bash.js.map +1 -1
  268. package/dist/tools/builtins/browser.js +1 -1
  269. package/dist/tools/builtins/browser.js.map +1 -1
  270. package/dist/tools/builtins/computer-use.d.ts +60 -2
  271. package/dist/tools/builtins/computer-use.d.ts.map +1 -1
  272. package/dist/tools/builtins/computer-use.js +695 -80
  273. package/dist/tools/builtins/computer-use.js.map +1 -1
  274. package/dist/tools/builtins/content-fingerprint.d.ts.map +1 -1
  275. package/dist/tools/builtins/content-fingerprint.js +2 -1
  276. package/dist/tools/builtins/content-fingerprint.js.map +1 -1
  277. package/dist/tools/builtins/edit-apply.d.ts +1 -0
  278. package/dist/tools/builtins/edit-apply.d.ts.map +1 -1
  279. package/dist/tools/builtins/edit-apply.js +108 -21
  280. package/dist/tools/builtins/edit-apply.js.map +1 -1
  281. package/dist/tools/builtins/edit-match.d.ts +37 -0
  282. package/dist/tools/builtins/edit-match.d.ts.map +1 -1
  283. package/dist/tools/builtins/edit-match.js +193 -0
  284. package/dist/tools/builtins/edit-match.js.map +1 -1
  285. package/dist/tools/builtins/edit.d.ts.map +1 -1
  286. package/dist/tools/builtins/edit.js +14 -7
  287. package/dist/tools/builtins/edit.js.map +1 -1
  288. package/dist/tools/builtins/exit-semantics.d.ts +8 -0
  289. package/dist/tools/builtins/exit-semantics.d.ts.map +1 -1
  290. package/dist/tools/builtins/exit-semantics.js +19 -0
  291. package/dist/tools/builtins/exit-semantics.js.map +1 -1
  292. package/dist/tools/builtins/index.d.ts +3 -1
  293. package/dist/tools/builtins/index.d.ts.map +1 -1
  294. package/dist/tools/builtins/index.js +1 -0
  295. package/dist/tools/builtins/index.js.map +1 -1
  296. package/dist/tools/builtins/present-file.d.ts +24 -0
  297. package/dist/tools/builtins/present-file.d.ts.map +1 -0
  298. package/dist/tools/builtins/present-file.js +116 -0
  299. package/dist/tools/builtins/present-file.js.map +1 -0
  300. package/dist/tools/builtins/read-file.js +1 -1
  301. package/dist/tools/builtins/read-file.js.map +1 -1
  302. package/dist/tools/builtins/read-render.d.ts +12 -1
  303. package/dist/tools/builtins/read-render.d.ts.map +1 -1
  304. package/dist/tools/builtins/read-render.js +16 -3
  305. package/dist/tools/builtins/read-render.js.map +1 -1
  306. package/dist/tools/builtins/search-tools.d.ts +10 -0
  307. package/dist/tools/builtins/search-tools.d.ts.map +1 -1
  308. package/dist/tools/builtins/search-tools.js +36 -2
  309. package/dist/tools/builtins/search-tools.js.map +1 -1
  310. package/dist/tools/builtins/skill.d.ts +31 -0
  311. package/dist/tools/builtins/skill.d.ts.map +1 -1
  312. package/dist/tools/builtins/skill.js +232 -88
  313. package/dist/tools/builtins/skill.js.map +1 -1
  314. package/dist/tools/builtins/wait-for-job.d.ts.map +1 -1
  315. package/dist/tools/builtins/wait-for-job.js +5 -0
  316. package/dist/tools/builtins/wait-for-job.js.map +1 -1
  317. package/dist/tools/builtins/web.d.ts.map +1 -1
  318. package/dist/tools/builtins/web.js +13 -2
  319. package/dist/tools/builtins/web.js.map +1 -1
  320. package/dist/tools/task/create.d.ts.map +1 -1
  321. package/dist/tools/task/create.js +13 -4
  322. package/dist/tools/task/create.js.map +1 -1
  323. package/dist/tools/task/get.d.ts +8 -0
  324. package/dist/tools/task/get.d.ts.map +1 -0
  325. package/dist/tools/task/get.js +51 -0
  326. package/dist/tools/task/get.js.map +1 -0
  327. package/dist/tools/task/index.d.ts +7 -0
  328. package/dist/tools/task/index.d.ts.map +1 -1
  329. package/dist/tools/task/index.js +10 -2
  330. package/dist/tools/task/index.js.map +1 -1
  331. package/dist/tools/task/list.d.ts.map +1 -1
  332. package/dist/tools/task/list.js +10 -2
  333. package/dist/tools/task/list.js.map +1 -1
  334. package/dist/tools/task/number.d.ts +13 -0
  335. package/dist/tools/task/number.d.ts.map +1 -0
  336. package/dist/tools/task/number.js +30 -0
  337. package/dist/tools/task/number.js.map +1 -0
  338. package/dist/tools/task/present.d.ts.map +1 -1
  339. package/dist/tools/task/present.js +17 -3
  340. package/dist/tools/task/present.js.map +1 -1
  341. package/dist/tools/task/update.d.ts +2 -1
  342. package/dist/tools/task/update.d.ts.map +1 -1
  343. package/dist/tools/task/update.js +87 -20
  344. package/dist/tools/task/update.js.map +1 -1
  345. package/dist/types/acp/index.d.ts +10 -0
  346. package/dist/types/acp/index.d.ts.map +1 -1
  347. package/dist/types/agent/base.d.ts +4 -0
  348. package/dist/types/agent/base.d.ts.map +1 -1
  349. package/dist/types/agent/scheduler.d.ts +9 -0
  350. package/dist/types/agent/scheduler.d.ts.map +1 -1
  351. package/dist/types/computer-use/index.d.ts +7 -0
  352. package/dist/types/computer-use/index.d.ts.map +1 -1
  353. package/dist/types/computer-use/index.js.map +1 -1
  354. package/dist/types/connector/mcp.d.ts +10 -0
  355. package/dist/types/connector/mcp.d.ts.map +1 -1
  356. package/dist/types/permission/index.d.ts +20 -0
  357. package/dist/types/permission/index.d.ts.map +1 -1
  358. package/dist/types/permission/index.js +25 -0
  359. package/dist/types/permission/index.js.map +1 -1
  360. package/dist/types/plugin/index.d.ts +47 -3
  361. package/dist/types/plugin/index.d.ts.map +1 -1
  362. package/dist/types/plugin/index.js +4 -0
  363. package/dist/types/plugin/index.js.map +1 -1
  364. package/dist/types/provider/chat.d.ts +8 -0
  365. package/dist/types/provider/chat.d.ts.map +1 -1
  366. package/dist/types/provider/interface.d.ts +16 -0
  367. package/dist/types/provider/interface.d.ts.map +1 -1
  368. package/dist/types/provider/model.d.ts +6 -0
  369. package/dist/types/provider/model.d.ts.map +1 -1
  370. package/dist/types/provider/stream.d.ts +2 -0
  371. package/dist/types/provider/stream.d.ts.map +1 -1
  372. package/dist/types/tool/index.d.ts +28 -2
  373. package/dist/types/tool/index.d.ts.map +1 -1
  374. package/dist/types/tool/index.js.map +1 -1
  375. package/dist/types/tool/presentation.d.ts +15 -0
  376. package/dist/types/tool/presentation.d.ts.map +1 -1
  377. package/dist/utils/node-on-path.d.ts +27 -0
  378. package/dist/utils/node-on-path.d.ts.map +1 -0
  379. package/dist/utils/node-on-path.js +70 -0
  380. package/dist/utils/node-on-path.js.map +1 -0
  381. package/package.json +1 -1
  382. package/src/agents/QueryAgent.ts +2 -0
  383. package/src/authorization/skill-grant.ts +1 -0
  384. package/src/bridge/acp/permission.ts +11 -1
  385. package/src/bridge/acp/server.ts +26 -0
  386. package/src/compaction/context-window.ts +18 -0
  387. package/src/compaction/loaded-skills.ts +42 -1
  388. package/src/compaction/manager.ts +28 -0
  389. package/src/compaction/manual.ts +9 -1
  390. package/src/compaction/model-summary.ts +2 -2
  391. package/src/compaction/restore.ts +69 -0
  392. package/src/compaction/salience/working-set.ts +6 -2
  393. package/src/compaction/tool-result-editing.ts +8 -1
  394. package/src/compaction/types.ts +2 -0
  395. package/src/compaction/wire.ts +4 -0
  396. package/src/connector/index.ts +27 -0
  397. package/src/connector/mcp/client.ts +71 -2
  398. package/src/connector/mcp/errors.ts +14 -0
  399. package/src/connector/mcp/index.ts +36 -0
  400. package/src/connector/mcp/skill-source.ts +499 -0
  401. package/src/connector/mcp/skills.ts +367 -0
  402. package/src/manager/session/turn-recorder.ts +24 -1
  403. package/src/network/audit.ts +2 -0
  404. package/src/network/computer.ts +347 -0
  405. package/src/network/index.ts +20 -0
  406. package/src/network/join.ts +21 -2
  407. package/src/network/roster.ts +5 -0
  408. package/src/network/service.ts +674 -84
  409. package/src/network/store.ts +57 -4
  410. package/src/network/transport.ts +1 -1
  411. package/src/network/wire.ts +18 -1
  412. package/src/plugin/shell-hook-tool-names.ts +1 -0
  413. package/src/plugin/shell-hook.ts +144 -7
  414. package/src/prompt/coding-agent-doctrine.ts +7 -2
  415. package/src/provider/fallback.ts +10 -0
  416. package/src/provider/idle-timeout.ts +9 -0
  417. package/src/provider/instrumentation.ts +12 -0
  418. package/src/provider/model-window-suffix.ts +2 -0
  419. package/src/provider/retry.ts +9 -0
  420. package/src/public-runtime.ts +100 -0
  421. package/src/public-tools.ts +18 -0
  422. package/src/public-types.ts +29 -0
  423. package/src/registry/tool/presentation.ts +14 -4
  424. package/src/runtime/jobs/registry.ts +2 -1
  425. package/src/runtime/query/auto-review/classifier.ts +19 -3
  426. package/src/runtime/query/auto-review/failure.ts +50 -0
  427. package/src/runtime/query/auto-review/index.ts +1 -0
  428. package/src/runtime/query/executor/tool-call-admission.ts +10 -1
  429. package/src/runtime/query/executor.ts +57 -8
  430. package/src/runtime/query/file-evidence-replay.ts +6 -5
  431. package/src/runtime/query/index.ts +62 -0
  432. package/src/runtime/query/iteration/index.ts +2 -0
  433. package/src/runtime/query/iteration/phases/compaction.ts +25 -2
  434. package/src/runtime/query/iteration/phases/context.ts +4 -0
  435. package/src/runtime/query/iteration/phases/per-call-review.ts +24 -7
  436. package/src/runtime/query/iteration/step-shaping.ts +4 -0
  437. package/src/runtime/query/prepare-turn.ts +20 -2
  438. package/src/runtime/query/review-policy.ts +31 -5
  439. package/src/runtime/query/shell-line-escalation.ts +49 -0
  440. package/src/runtime/query/tooling.ts +6 -0
  441. package/src/runtime/query/turn/outcome-ledger.ts +56 -1
  442. package/src/sandbox/provider/local.ts +3 -1
  443. package/src/scheduler/local.ts +3 -1
  444. package/src/skills/index.ts +43 -0
  445. package/src/skills/inline-shell-host.ts +303 -0
  446. package/src/skills/inline-shell.ts +765 -0
  447. package/src/store/index.ts +8 -0
  448. package/src/store/task/file.ts +641 -0
  449. package/src/teams/backend.ts +29 -0
  450. package/src/teams/fs-sync.ts +91 -0
  451. package/src/teams/index.ts +47 -0
  452. package/src/teams/names.ts +49 -0
  453. package/src/teams/store.ts +607 -0
  454. package/src/teams/types.ts +102 -0
  455. package/src/tools/admit-facts.ts +26 -0
  456. package/src/tools/builtins/bash.ts +5 -2
  457. package/src/tools/builtins/browser.ts +1 -1
  458. package/src/tools/builtins/computer-use.ts +799 -86
  459. package/src/tools/builtins/content-fingerprint.ts +2 -1
  460. package/src/tools/builtins/edit-apply.ts +124 -24
  461. package/src/tools/builtins/edit-match.ts +200 -0
  462. package/src/tools/builtins/edit.ts +16 -7
  463. package/src/tools/builtins/exit-semantics.ts +23 -0
  464. package/src/tools/builtins/index.ts +3 -0
  465. package/src/tools/builtins/present-file.ts +127 -0
  466. package/src/tools/builtins/read-file.ts +1 -1
  467. package/src/tools/builtins/read-render.ts +18 -3
  468. package/src/tools/builtins/search-tools.ts +36 -2
  469. package/src/tools/builtins/skill.ts +291 -95
  470. package/src/tools/builtins/wait-for-job.ts +5 -0
  471. package/src/tools/builtins/web.ts +15 -2
  472. package/src/tools/task/create.ts +13 -4
  473. package/src/tools/task/get.ts +53 -0
  474. package/src/tools/task/index.ts +14 -2
  475. package/src/tools/task/list.ts +10 -2
  476. package/src/tools/task/number.ts +32 -0
  477. package/src/tools/task/present.ts +18 -3
  478. package/src/tools/task/update.ts +94 -20
  479. package/src/types/acp/index.ts +11 -1
  480. package/src/types/agent/base.ts +6 -0
  481. package/src/types/agent/scheduler.ts +9 -0
  482. package/src/types/computer-use/index.ts +7 -0
  483. package/src/types/connector/mcp.ts +10 -0
  484. package/src/types/permission/index.ts +29 -0
  485. package/src/types/plugin/index.ts +95 -39
  486. package/src/types/provider/chat.ts +9 -0
  487. package/src/types/provider/interface.ts +18 -0
  488. package/src/types/provider/model.ts +6 -0
  489. package/src/types/provider/stream.ts +2 -0
  490. package/src/types/tool/index.ts +23 -2
  491. package/src/types/tool/presentation.ts +14 -0
  492. package/src/utils/node-on-path.ts +81 -0
@@ -573,6 +573,43 @@ export {
573
573
  SKILL_FRONTMATTER_TOLERATED_KEYS,
574
574
  SkillCollisionError,
575
575
  SkillRegistry,
576
+ INLINE_SHELL_COMMAND_SHOWN_CHARS,
577
+ INLINE_SHELL_MAX_COMMANDS,
578
+ INLINE_SHELL_MAX_COMMAND_CHARS,
579
+ INLINE_SHELL_MAX_OUTPUT_CHARS,
580
+ INLINE_SHELL_REASON_CHARS,
581
+ InlineShellError,
582
+ SHELL_OFF_PLACEHOLDER,
583
+ SHELL_PRELOAD_PLACEHOLDER,
584
+ SHELL_REMOTE_PLACEHOLDER,
585
+ SHELL_UNTRUSTED_PLACEHOLDER,
586
+ escapeInlineShell,
587
+ expandInlineShell,
588
+ findInlineShell,
589
+ normalizeInlineShellText,
590
+ shapeShellOutput,
591
+ splitShellToolOutput,
592
+ substituteEscaped,
593
+ PRE_SKILL_SHELL_COMMAND_EVENT,
594
+ SKILL_SHELL_TOOL_NAME,
595
+ createPreToolUseShellHook,
596
+ createSkillShellHook,
597
+ createToolSkillShellHost,
598
+ skillShellOutcomeOf,
599
+ skillShellAllow,
600
+ skillShellHookVerdict,
601
+ } from './skills/index.js'
602
+ export type {
603
+ InlineShellBlock,
604
+ InlineShellHookVerdict,
605
+ InlineShellHost,
606
+ InlineShellKind,
607
+ InlineShellMarker,
608
+ InlineShellOptions,
609
+ InlineShellOutcome,
610
+ PreToolUseShellHookOptions,
611
+ SkillShellHookOptions,
612
+ ToolSkillShellHostOptions,
576
613
  } from './skills/index.js'
577
614
  // The one frontmatter reader. `loadSkill` is built on it, and a host reading
578
615
  // its own markdown — a command file, a prompt template — uses the same one
@@ -667,6 +704,8 @@ export {
667
704
  // closed), and the refusal of a task store bound to another session.
668
705
  export { selectTaskContext } from './store/task/context.js'
669
706
  export { TaskSessionMismatchError } from './store/task/disk.js'
707
+ // The task list several sessions share (teams): lock files, claim result codes, both-way dependencies.
708
+ export { FileTaskStore, TaskListError, isClaimableTaskStore } from './store/task/file.js'
670
709
  // Cross-process possession of a session: its `lease.json`. Listing what is
671
710
  // waiting (pending decisions, turns, children) is `SessionIndex`'s job, which
672
711
  // comes through `./store/session-index/index.js` at the end of this file.
@@ -1008,6 +1047,21 @@ export {
1008
1047
  isResourceNotFoundError,
1009
1048
  isUnsupportedProtocolVersionError,
1010
1049
  MCP_TASKS_EXTENSION,
1050
+ MCP_SKILLS_EXTENSION,
1051
+ MCP_SKILL_FILE,
1052
+ MCP_SKILL_LIMITS,
1053
+ MCP_SKILL_STRIPPED_KEYS,
1054
+ McpSkillLoadError,
1055
+ McpSkillSource,
1056
+ admitMcpSkillEntries,
1057
+ isMethodNotFoundError,
1058
+ loadMcpSkillBody,
1059
+ mcpSkillMetadata,
1060
+ mcpSkillServerNameProblem,
1061
+ mcpSkillStrippedKeys,
1062
+ nameMcpSkills,
1063
+ summarizeMcpSkillRefusals,
1064
+ validateMcpSkillEntry,
1011
1065
  LocalExecutionContext,
1012
1066
  mcpEraCacheKey,
1013
1067
  MCPHttpStatusError,
@@ -1046,6 +1100,18 @@ export {
1046
1100
  zodToMCPJsonSchema,
1047
1101
  } from './connector/index.js'
1048
1102
  export type {
1103
+ McpListedSkill,
1104
+ McpNamedSkill,
1105
+ McpSkillAdmission,
1106
+ McpSkillEntry,
1107
+ McpSkillEntryVerdict,
1108
+ McpSkillFile,
1109
+ McpSkillLoadFailure,
1110
+ McpSkillRefusal,
1111
+ McpSkillSourceOptions,
1112
+ McpSkillsClient,
1113
+ McpSkillsRefresh,
1114
+ McpSkillsRefreshStatus,
1049
1115
  McpEnvelope,
1050
1116
  McpEnvelopeInput,
1051
1117
  McpEraProbe,
@@ -1708,6 +1774,7 @@ export {
1708
1774
  isReviewMode,
1709
1775
  modeReviewsAllowedCalls,
1710
1776
  mustAskPerson,
1777
+ nestedCallModeRefusal,
1711
1778
  } from './runtime/query/review-policy.js'
1712
1779
  // The model that decides, in the `classify` review mode, what a person would
1713
1780
  // otherwise be asked. See `runtime/query/auto-review/`.
@@ -1724,6 +1791,7 @@ export {
1724
1791
  autoReviewStoppedFeedback,
1725
1792
  autoReviewUnavailableFeedback,
1726
1793
  createAutoReviewClassifier,
1794
+ describeCheckFailure,
1727
1795
  resolveAutoReviewRules,
1728
1796
  } from './runtime/query/auto-review/index.js'
1729
1797
  // What the model is told when a person declines a call without words of their own.
@@ -1885,6 +1953,9 @@ export type { SingleHandoffDeps } from './session/handoff/single.js'
1885
1953
  export type { InterventionChainLoader } from './session/intervention/prev-artifact.js'
1886
1954
  export type {
1887
1955
  ActionInput,
1956
+ BrowserWindowAnswer,
1957
+ BrowserWindowQuestion,
1958
+ BrowserWindowsSetting,
1888
1959
  ComputerUseAdvice,
1889
1960
  ComputerUseAdvisor,
1890
1961
  ComputerUseAdvisorCandidate,
@@ -2110,6 +2181,30 @@ export {
2110
2181
  udsPeerAddress,
2111
2182
  writePeerRecord,
2112
2183
  } from './peers/index.js'
2184
+ // ─── teams (@experimental) ──────────────────────────────────────────────
2185
+ //
2186
+ // Named helpers beside the main conversation: the membership file with its lock, a mailbox each, and
2187
+ // the seam a teammate runner plugs into. See `teams/index.ts`.
2188
+
2189
+ export {
2190
+ MAIL_KINDS,
2191
+ MAX_MAIL_ENTRIES,
2192
+ MAX_MAIL_TEXT_BYTES,
2193
+ MailEntrySchema,
2194
+ MailKindSchema,
2195
+ normalizeTeamName,
2196
+ TEAM_COLORS,
2197
+ TEAM_CONFIG_VERSION,
2198
+ TEAM_CREATE_GRACE_MS,
2199
+ TEAM_LEAD_NAME,
2200
+ TeamBackendKindSchema,
2201
+ TeamConfigSchema,
2202
+ TeamMemberSchema,
2203
+ TeamStore,
2204
+ TeamStoreError,
2205
+ teamNameProblem,
2206
+ teammateNameProblem,
2207
+ } from './teams/index.js'
2113
2208
  // ─── your Namzu network (@experimental) ───────────────────────────────────
2114
2209
  //
2115
2210
  // Machines of one person find each other, share a roster of sessions and
@@ -2119,6 +2214,7 @@ export {
2119
2214
  export {
2120
2215
  AUDIT_EVENTS,
2121
2216
  BROWSE_WINDOW_MS,
2217
+ COMPUTER_SECRET_FILE,
2122
2218
  DEFAULT_LISTEN_PORT,
2123
2219
  HOLD_EXPIRY_MS,
2124
2220
  HoldQueue,
@@ -2142,10 +2238,12 @@ export {
2142
2238
  createNetworkStore,
2143
2239
  createSystemGatewayReader,
2144
2240
  decideMail,
2241
+ ensureComputerSecret,
2145
2242
  evaluateMembership,
2146
2243
  formatJoinCode,
2147
2244
  generateMachineKey,
2148
2245
  generateSessionName,
2246
+ homeQualifies,
2149
2247
  isPrivateNetworkAddress,
2150
2248
  joinCode,
2151
2249
  machineLabel,
@@ -2153,6 +2251,8 @@ export {
2153
2251
  networkFingerprint,
2154
2252
  parseHostPort,
2155
2253
  privateInterfaces,
2254
+ readComputerSecret,
2255
+ resolveComputerSecret,
2156
2256
  resolveSessionTarget,
2157
2257
  sanitizeName,
2158
2258
  sanitizeRole,
@@ -84,6 +84,11 @@ export {
84
84
  } from './tools/builtins/bash.js'
85
85
  // Authorization and execution must agree after a session carries its shell cwd.
86
86
  export { effectiveBashWorkingDirectory } from './tools/builtins/bash-cwd.js'
87
+ // The same reach questions the executor asks of a nested shell call, for a host that runs one without a turn.
88
+ export {
89
+ type ShellLineEscalationContext,
90
+ shellLineEscalation,
91
+ } from './runtime/query/shell-line-escalation.js'
87
92
  export {
88
93
  CODE_ANALYSIS_TOOL_NAME,
89
94
  CodeAnalysisTool,
@@ -135,6 +140,7 @@ export type {
135
140
  SkillDirectoryRequest,
136
141
  SkillDirectoryResolver,
137
142
  SkillToolOptions,
143
+ SkillToolShellOptions,
138
144
  } from './tools/builtins/skill.js'
139
145
  // Both declare `category: 'network'`, which is what the authorization
140
146
  // presets branch on. NOT in the default builtin set: a turn with no web
@@ -167,10 +173,12 @@ export {
167
173
  export type { RunCodeToolOptions } from './tools/builtins/run-code.js'
168
174
  export { LsTool } from './tools/builtins/ls.js'
169
175
  export { SearchToolsTool } from './tools/builtins/search-tools.js'
176
+ export { PresentFileTool } from './tools/builtins/present-file.js'
170
177
  export { VerifyOutputsTool } from './tools/builtins/verify-outputs.js'
171
178
  export {
172
179
  ViewImageTool,
173
180
  createViewImageTool,
181
+ inspectImageBytes,
174
182
  } from './tools/builtins/view-image.js'
175
183
  export { createPalReferenceImageTool } from './pals/reference-images.js'
176
184
  export {
@@ -183,6 +191,7 @@ export {
183
191
  STANDARD_SCREENSHOT_LIMITS,
184
192
  computerUseUnavailableReason,
185
193
  createComputerUseTool,
194
+ screenshotLimitsForModel,
186
195
  screenshotTargetSize,
187
196
  } from './tools/builtins/computer-use.js'
188
197
  // The browser contract: the two tools over a host a separate package
@@ -218,6 +227,7 @@ export {
218
227
  buildTaskListTool,
219
228
  buildTaskTools,
220
229
  buildTaskUpdateTool,
230
+ plainTaskReceipt,
221
231
  } from './tools/task/index.js'
222
232
  export { buildAdvisoryTools } from './tools/advisory/index.js'
223
233
  export {
@@ -288,3 +298,11 @@ export {
288
298
 
289
299
  export { createPalMessagingTools } from './pals/communication/tools.js'
290
300
  export { createPalOperatorMessagingTools } from './pals/communication/operator.js'
301
+
302
+ // Where the shell finds `node`: the runtime's own directory is appended to a
303
+ // command's PATH only when the user's PATH has none.
304
+ export {
305
+ nodeDirectoryToAppend,
306
+ withNodeOnPath,
307
+ type NodeOnPathOptions,
308
+ } from './utils/node-on-path.js'
@@ -23,6 +23,7 @@ export type {
23
23
  PalReferenceImageImportOptions,
24
24
  PalReferenceImageToolOptions,
25
25
  } from './pals/reference-images.js'
26
+ export type { PresentedFile } from './tools/builtins/present-file.js'
26
27
  export type { ViewImageToolOptions } from './tools/builtins/view-image.js'
27
28
  export type * from './types/message/index.js'
28
29
  export type * from './types/message/inbound-delivery.js'
@@ -324,6 +325,13 @@ export type {
324
325
  export type { TaskContextScope } from './store/task/context.js'
325
326
 
326
327
  export type { TaskToolScope } from './tools/task/index.js'
328
+ export type {
329
+ ClaimableTaskStore,
330
+ FileTaskStoreConfig,
331
+ TaskClaimFailure,
332
+ TaskClaimResult,
333
+ TaskListErrorCode,
334
+ } from './store/task/file.js'
327
335
 
328
336
  export type { MappedStreamEvent } from './bridge/sse/index.js'
329
337
 
@@ -776,6 +784,9 @@ export type {
776
784
  HeldMail,
777
785
  HostPort,
778
786
  ListenAddress,
787
+ ComputerSecretRead,
788
+ ComputerSecretSource,
789
+ ReadSecretOptions,
779
790
  LocalSession,
780
791
  MailDecision,
781
792
  MailDecisionInput,
@@ -802,6 +813,8 @@ export type {
802
813
  PendingJoin,
803
814
  PrivateInterfaceOptions,
804
815
  RemoteMail,
816
+ ResolveSecretDeps,
817
+ ResolveSecretInput,
805
818
  Revocation,
806
819
  RosterMachineView,
807
820
  RosterSession,
@@ -880,3 +893,19 @@ export type {
880
893
  } from './pals/activity/subscription-policy.js'
881
894
  export type { PalActivitySubscriptionRunnerOptions } from './pals/activity/subscriptions.js'
882
895
  export type { PalActivityCausalityOptions } from './pals/activity/causality.js'
896
+
897
+ export type {
898
+ CreateTeamInput,
899
+ MailDraft,
900
+ MailEntry,
901
+ MailKind,
902
+ MailReadOptions,
903
+ ReserveMemberInput,
904
+ TeamBackendKind,
905
+ TeamConfig,
906
+ TeamMember,
907
+ TeamStoreErrorCode,
908
+ TeamStoreOptions,
909
+ TeammateBackend,
910
+ TeammateStartSpec,
911
+ } from './teams/index.js'
@@ -33,7 +33,9 @@ function truncate(value: string, max = MAX_LABEL): string {
33
33
  * is LAST so it only speaks for a tool none of the others describe — those
34
34
  * tools were falling through to a truncated `JSON.stringify`, which is how
35
35
  * a delegation tool came to show a blob of its own arguments while
36
- * requiring the model to write a label nothing then read.
36
+ * requiring the model to write a label nothing then read. `url`, `name`,
37
+ * `title` and `select` come after it: they only speak for a tool that has
38
+ * no other readable field.
37
39
  */
38
40
  export function genericPrimary(input: unknown): string | undefined {
39
41
  if (input && typeof input === 'object') {
@@ -46,16 +48,24 @@ export function genericPrimary(input: unknown): string | undefined {
46
48
  pick('file_path') ??
47
49
  pick('pattern') ??
48
50
  pick('query') ??
49
- pick('description')
51
+ pick('description') ??
52
+ pick('url') ??
53
+ pick('name') ??
54
+ pick('title') ??
55
+ pick('select')
50
56
  )
51
57
  }
52
58
  return typeof input === 'string' ? input : undefined
53
59
  }
54
60
 
61
+ /**
62
+ * The label is empty, never a dump of the arguments, when no field reads as
63
+ * a name: a host headlines the row with the tool's own name and has nothing
64
+ * to add after it. An id or a flag is not something a person reads.
65
+ */
55
66
  export function genericLabel(input: unknown): string {
56
67
  const primary = genericPrimary(input)
57
- if (primary) return truncate(primary)
58
- return truncate(JSON.stringify(input ?? {}))
68
+ return primary ? truncate(primary) : ''
59
69
  }
60
70
 
61
71
  /**
@@ -13,6 +13,7 @@ import type {
13
13
  } from '../../types/job/index.js'
14
14
  import type { MonitorWebSocketTarget } from '../../types/tool/index.js'
15
15
  import { subscribeToAbort } from '../../utils/abort.js'
16
+ import { withNodeOnPath } from '../../utils/node-on-path.js'
16
17
  import { oneMetadataLine } from '../system-events.js'
17
18
  import { stopAtHostExit } from './host-exit-finalizer.js'
18
19
  import { createBackgroundJobId } from './job-id.js'
@@ -731,7 +732,7 @@ export class BackgroundJobRegistry {
731
732
  : {
732
733
  child: spawnHostShell(params.command, {
733
734
  cwd: params.workingDirectory,
734
- env: { ...inherited.env, ...params.env },
735
+ env: withNodeOnPath({ ...inherited.env, ...params.env }),
735
736
  // `detached` makes the child the leader of its own process group
736
737
  // off Windows, which is what `killTree` needs to reach the command
737
738
  // and everything it forks rather than only the wrapping shell. See
@@ -45,6 +45,7 @@ import {
45
45
  import { SCOPE_ATTRIBUTE } from '../../../utils/log/types.js'
46
46
  import { type Logger, resolveLogger } from '../../../utils/logger.js'
47
47
  import { chatStreamWithSamplingRepair } from '../iteration/side-call.js'
48
+ import { describeCheckFailure } from './failure.js'
48
49
  import { renderGitStatus } from './git-status.js'
49
50
  import {
50
51
  STAGE_ONE_INSTRUCTION,
@@ -303,7 +304,10 @@ export function createAutoReviewClassifier(
303
304
  ): AutoReviewDecision {
304
305
  let limitReached: 'consecutive' | 'total' | undefined
305
306
  let noVerdictLimitReached = false
306
- if (cause !== 'aborted') {
307
+ // A check that could not be completed says nothing about the action, so it
308
+ // does not count toward the blocks that take auto mode away; the no-verdict
309
+ // counter below is its own limit.
310
+ if (cause !== 'aborted' && cause !== 'unavailable' && cause !== 'unreadable') {
307
311
  consecutive += 1
308
312
  total += 1
309
313
  if (consecutive >= limits.consecutive) limitReached = 'consecutive'
@@ -426,11 +430,17 @@ export function createAutoReviewClassifier(
426
430
  if (request.signal?.aborted) {
427
431
  return blocked(started, 0, 'aborted', 'the review was cancelled before it finished')
428
432
  }
433
+ const why = describeCheckFailure(error, options.quickDeadlineMs ?? 60_000)
434
+ log.warn('auto review could not complete', {
435
+ 'namzu.auto_review.stage': 1,
436
+ 'namzu.auto_review.failure': why,
437
+ 'namzu.auto_review.error': error instanceof Error ? error.message : String(error),
438
+ })
429
439
  return blocked(
430
440
  started,
431
441
  0,
432
442
  'unavailable',
433
- 'the safety check could not be completed, so the action was not run',
443
+ `the safety check could not be completed (${why}), so the action was not run`,
434
444
  )
435
445
  }
436
446
  const first = parseVerdict(quick)
@@ -447,11 +457,17 @@ export function createAutoReviewClassifier(
447
457
  if (request.signal?.aborted) {
448
458
  return blocked(started, 1, 'aborted', 'the review was cancelled before it finished')
449
459
  }
460
+ const why = describeCheckFailure(error, options.reasonedDeadlineMs ?? 120_000)
461
+ log.warn('auto review could not complete', {
462
+ 'namzu.auto_review.stage': 2,
463
+ 'namzu.auto_review.failure': why,
464
+ 'namzu.auto_review.error': error instanceof Error ? error.message : String(error),
465
+ })
450
466
  return blocked(
451
467
  started,
452
468
  1,
453
469
  'unavailable',
454
- 'a first look flagged this action and the closer look could not be completed',
470
+ `a first look flagged this action and the closer look could not be completed (${why})`,
455
471
  )
456
472
  }
457
473
  const second = parseVerdict(careful)
@@ -0,0 +1,50 @@
1
+ import { classifyProviderError } from '../../../types/provider/errors.js'
2
+
3
+ /**
4
+ * The class of a failure to complete the safety check, in a few plain words:
5
+ * `no credential for the check model`, `provider returned 400`,
6
+ * `timed out after 60 s`. It is a class, never the provider's own text: that
7
+ * text can carry a request body or a key fragment, so it goes to the log, not
8
+ * to the person or the model.
9
+ *
10
+ * `deadlineMs` is the deadline the pass ran under, when the failure was the
11
+ * deadline expiring.
12
+ */
13
+ export function describeCheckFailure(error: unknown, deadlineMs?: number): string {
14
+ if (error instanceof Error && error.name === 'DeadlineError') {
15
+ return deadlineMs !== undefined
16
+ ? `timed out after ${Math.round(deadlineMs / 1000)} s`
17
+ : 'timed out'
18
+ }
19
+ const classified = classifyProviderError(error)
20
+ // An HTTP status names the failure better than any word in the message: a
21
+ // 401 that says "invalid credentials" is a refused credential, not a missing one.
22
+ // The words are read only when there is no status.
23
+ if (classified.status === undefined) {
24
+ const message = error instanceof Error ? error.message : String(error)
25
+ if (
26
+ /no (api )?(key|credential)s?|missing (api )?(key|credential)s?|credentials? (is |are )?(not (set|configured|found)|missing)|not signed in|not logged in|api key (is )?(required|missing|not set)/i.test(
27
+ message,
28
+ )
29
+ ) {
30
+ return 'no credential for the check model'
31
+ }
32
+ }
33
+ const status = classified.status
34
+ switch (classified.code) {
35
+ case 'auth':
36
+ return status !== undefined
37
+ ? `provider returned ${status}: the credential was refused`
38
+ : 'the credential was refused'
39
+ case 'rate_limit':
40
+ return 'provider rate limit'
41
+ case 'usage_limit':
42
+ return 'provider usage limit reached'
43
+ case 'network':
44
+ return 'could not reach the provider'
45
+ case 'not_found':
46
+ return 'the check model was not found'
47
+ default:
48
+ return status !== undefined ? `provider returned ${status}` : 'provider error'
49
+ }
50
+ }
@@ -16,6 +16,7 @@ export type {
16
16
  AutoReviewRequest,
17
17
  AutoReviewStage,
18
18
  } from './classifier.js'
19
+ export { describeCheckFailure } from './failure.js'
19
20
  export {
20
21
  AUTO_REVIEW_DEFAULTS_MARKER,
21
22
  DEFAULT_ALLOW,
@@ -135,7 +135,16 @@ async function runTaskHook(
135
135
  const results = await awaitWithAbort(
136
136
  manager.executeHooks(
137
137
  event,
138
- { sessionId: host.config.sessionId, turnId: host.config.turnId, task, signal },
138
+ {
139
+ sessionId: host.config.sessionId,
140
+ turnId: host.config.turnId,
141
+ task,
142
+ // A task a teammate makes or completes names the teammate and its team.
143
+ ...(host.config.teammate
144
+ ? { teammateName: host.config.teammate.name, teamName: host.config.teammate.team }
145
+ : {}),
146
+ signal,
147
+ },
139
148
  host.emitEvent,
140
149
  ),
141
150
  signal,
@@ -26,6 +26,7 @@ import { isAlwaysDestructive } from '../../tools/defineTool.js'
26
26
  import { createFileReadTracker } from '../../tools/file-read-tracker.js'
27
27
  import { pathOutsideRoots, resolveWithinAnyReal, toolRoots } from '../../tools/paths.js'
28
28
  import { resolveRetainedOutput } from '../../tools/retained-output.js'
29
+ import { isTrustedReadOnly } from '../../tools/trusted-read-only.js'
29
30
  import type { ToolManager } from '../../toolsets/manager.js'
30
31
  import type { ToolSourceRef } from '../../toolsets/types.js'
31
32
  import type { ToolResultGuardrailSpec } from '../../types/guardrail/index.js'
@@ -50,6 +51,7 @@ import {
50
51
  PLAN_MODE_REFUSAL_WITH_PLAN_FILE,
51
52
  type PermissionMode,
52
53
  STRICT_MODE_REFUSAL,
54
+ nestedCallModeRefusal,
53
55
  } from '../../types/permission/index.js'
54
56
  import type { PluginHookPermission, PluginHookResult } from '../../types/plugin/index.js'
55
57
  import type { ChatCompletionResponse } from '../../types/provider/index.js'
@@ -485,6 +487,8 @@ export interface ToolExecutorConfig {
485
487
  web?: ToolContext['web']
486
488
  invocationState?: InvocationState
487
489
  pluginManager?: PluginLifecycleManager
490
+ /** Set for a teammate's turn: the task hooks name it. */
491
+ teammate?: { readonly name: string; readonly team: string }
488
492
  /** Turn-level default deadline; per-tool `timeoutMs` overrides it. */
489
493
  toolTimeoutMs?: number
490
494
  /**
@@ -578,6 +582,13 @@ export interface ToolExecutorConfig {
578
582
  * grants nothing, and its tool says so.
579
583
  */
580
584
  skillGrants?: SkillGrantSet
585
+ /**
586
+ * The review mode this turn is decided under right now (`plan`, `strict`, …),
587
+ * read at each nested call. A call a tool makes from inside itself never goes
588
+ * to the review policy, so the mode's refusals are applied to it here. Absent
589
+ * or not a mode name: the mode has nothing to say about nested calls.
590
+ */
591
+ reviewMode?: () => string | undefined
581
592
  }
582
593
 
583
594
  /**
@@ -2357,14 +2368,42 @@ export class ToolExecutor {
2357
2368
  }
2358
2369
  this.admitScratchpad(preparedCall)
2359
2370
  const nestedEscalation = await this.escalationOrUnfinished(preparedCall)
2360
- if (nestedEscalation || needsApproval || (gateResult && gateResult.decision !== 'allow')) {
2361
- const reason = nestedEscalation
2362
- ? 'Blocked: this nested call reaches a protected path, removal floor, outside-root boundary or another safety escalation. Call it directly so it can be reviewed.'
2363
- : needsApproval
2364
- ? `Blocked: "${name}" requires the person's approval for every call, and an approval cannot be requested from inside another tool. Call it directly.`
2365
- : gateResult?.decision === 'deny'
2366
- ? `Blocked by the authorization gate: ${gateResult.reason}`
2367
- : `Blocked by the authorization gate: this nested call requires an explicit allow rule because an operator review cannot be opened from inside another tool. ${gateResult?.reason}`
2371
+ // A host-owned pre-approval for this one dispatch (a skill's `allowed-tools`
2372
+ // while its text loads) answers only what no rule decided: a call a rule
2373
+ // denied, or sent to review on purpose, or that the dangerous-command floor
2374
+ // stopped, stays stopped.
2375
+ // The mode the turn is decided under answers a nested call as it answers the same
2376
+ // call made directly: the tool that made this one reads, so the policy never saw it.
2377
+ // Asked only when there is a mode to answer to: with none, the call is decided as before.
2378
+ const reviewMode = this.config.reviewMode?.()
2379
+ const modeRefusal =
2380
+ reviewMode === undefined
2381
+ ? undefined
2382
+ : nestedCallModeRefusal(reviewMode, {
2383
+ readOnly: isTrustedReadOnly(nestedTool, preparedInput, this.toolSource(name)),
2384
+ allowedByRule: gateResult?.decision === 'allow' && gateResult.matchedRule !== null,
2385
+ })
2386
+ const runGranted =
2387
+ modeRefusal === undefined &&
2388
+ gateResult?.decision === 'review' &&
2389
+ gateResult.matchedRule === null &&
2390
+ options?.allow?.({ name, input: preparedInput }) === true
2391
+ if (
2392
+ nestedEscalation ||
2393
+ needsApproval ||
2394
+ modeRefusal !== undefined ||
2395
+ (gateResult && gateResult.decision !== 'allow' && !runGranted)
2396
+ ) {
2397
+ const reason =
2398
+ modeRefusal !== undefined
2399
+ ? `Blocked: ${modeRefusal}.`
2400
+ : nestedEscalation
2401
+ ? 'Blocked: this nested call reaches a protected path, removal floor, outside-root boundary or another safety escalation. Call it directly so it can be reviewed.'
2402
+ : needsApproval
2403
+ ? `Blocked: "${name}" requires the person's approval for every call, and an approval cannot be requested from inside another tool. Call it directly.`
2404
+ : gateResult?.decision === 'deny'
2405
+ ? `Blocked by the authorization gate: ${gateResult.reason}`
2406
+ : `Blocked by the authorization gate: this nested call requires an explicit allow rule because an operator review cannot be opened from inside another tool. ${gateResult?.reason}`
2368
2407
  const output = deniedToolOutput(name, reason)
2369
2408
  // Same fail-closed durability rule as a direct gate denial: if the
2370
2409
  // configured session log cannot record the refusal, do not quietly carry
@@ -2440,6 +2479,16 @@ export class ToolExecutor {
2440
2479
 
2441
2480
  const nestedCwd = this.preparedBashDirectories.get(preparedCall)
2442
2481
  if (nestedCwd !== undefined) pinBashWorkingDirectory(childContext, nestedCwd)
2482
+ // The caller's last word, after every rule has allowed the call and before
2483
+ // anything starts: a refusal here is an answer, not a failure of the tool.
2484
+ if (options?.beforeRun) {
2485
+ const refusal = await options.beforeRun({ name, input: preparedInput, toolUseId: nestedId })
2486
+ signal.throwIfAborted()
2487
+ if (refusal !== undefined) {
2488
+ await progress.close()
2489
+ return { success: false, output: '', error: refusal }
2490
+ }
2491
+ }
2443
2492
  await this.emitEvent({
2444
2493
  type: 'tool_executing',
2445
2494
  turnId: this.config.turnId,
@@ -4,6 +4,7 @@ import { replayEditCallWithin } from '../../tools/builtins/edit-apply.js'
4
4
  import { EditTool } from '../../tools/builtins/edit.js'
5
5
  import { ReadFileTool } from '../../tools/builtins/read-file.js'
6
6
  import {
7
+ LINE_NUMBER_WIDTH,
7
8
  type ReadWindowRequest,
8
9
  renderNumberedRead,
9
10
  resolveReadWindow,
@@ -659,7 +660,7 @@ function mutate(
659
660
  * compared whole.
660
661
  *
661
662
  * Equality is conclusive because of the numbering. Every line of a rendering
662
- * goes out behind its own `${n}\t`, so one rendering belongs to exactly one
663
+ * goes out behind its own `linePrefix(n)`, so one rendering belongs to exactly one
663
664
  * body and window; and the partial-view notice carries no such prefix on its
664
665
  * lines, so a rendering that covers a whole file cannot be equal to one that
665
666
  * was cut short. A read this cannot match leaves the path known and its body
@@ -708,9 +709,9 @@ function observeRead(
708
709
  * What `read` would return for this whole body, in UTF-16 units, without
709
710
  * building it — and `undefined` for a window that would leave a line out.
710
711
  *
711
- * The rendering puts `${n}\t` in front of every line and joins them back with
712
- * the newlines the body already carries, so its length is the body's, plus one
713
- * tab per line, plus the digits of the numbers `1..lines`. A windowed read
712
+ * The rendering puts `linePrefix(n)` in front of every line and joins them back with
713
+ * the newlines the body already carries, so its length is the body's, plus the
714
+ * prefix of every line: the arrow and the number padded to its column. A windowed read
714
715
  * renumbers from its offset and carries the PARTIAL notice, and can never equal
715
716
  * a whole body's rendering — so it is refused here rather than built and
716
717
  * compared, which is also what makes the figure above exact.
@@ -736,7 +737,7 @@ function countLines(body: string): number {
736
737
  function lineNumberUnits(lines: number): number {
737
738
  let units = 0
738
739
  for (let width = 1, first = 1; first <= lines; width++, first *= 10)
739
- units += (Math.min(lines, first * 10 - 1) - first + 1) * width
740
+ units += (Math.min(lines, first * 10 - 1) - first + 1) * Math.max(width, LINE_NUMBER_WIDTH)
740
741
  return units
741
742
  }
742
743