@namzu/cli 26.3.0 → 28.0.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 (376) hide show
  1. package/CHANGELOG.md +271 -0
  2. package/README.md +67 -46
  3. package/dist/bin.js +7 -0
  4. package/dist/bin.js.map +1 -1
  5. package/dist/checkpoints/store.d.ts +17 -4
  6. package/dist/checkpoints/store.d.ts.map +1 -1
  7. package/dist/checkpoints/store.js +20 -5
  8. package/dist/checkpoints/store.js.map +1 -1
  9. package/dist/cli.d.ts +2 -0
  10. package/dist/cli.d.ts.map +1 -1
  11. package/dist/cli.js +124 -14
  12. package/dist/cli.js.map +1 -1
  13. package/dist/commands/acp.d.ts +23 -1
  14. package/dist/commands/acp.d.ts.map +1 -1
  15. package/dist/commands/acp.js +41 -2
  16. package/dist/commands/acp.js.map +1 -1
  17. package/dist/commands/drain.d.ts +69 -2
  18. package/dist/commands/drain.d.ts.map +1 -1
  19. package/dist/commands/drain.js +216 -136
  20. package/dist/commands/drain.js.map +1 -1
  21. package/dist/commands/eval.js +1 -1
  22. package/dist/commands/eval.js.map +1 -1
  23. package/dist/commands/{run-flags.d.ts → exec-flags.d.ts} +36 -28
  24. package/dist/commands/exec-flags.d.ts.map +1 -0
  25. package/dist/commands/{run-flags.js → exec-flags.js} +35 -27
  26. package/dist/commands/exec-flags.js.map +1 -0
  27. package/dist/commands/exec-json.d.ts +75 -0
  28. package/dist/commands/exec-json.d.ts.map +1 -0
  29. package/dist/commands/exec-json.js +473 -0
  30. package/dist/commands/exec-json.js.map +1 -0
  31. package/dist/commands/exec.d.ts +42 -0
  32. package/dist/commands/exec.d.ts.map +1 -0
  33. package/dist/commands/exec.js +683 -0
  34. package/dist/commands/exec.js.map +1 -0
  35. package/dist/commands/host-queries.d.ts +12 -0
  36. package/dist/commands/host-queries.d.ts.map +1 -0
  37. package/dist/commands/host-queries.js +149 -0
  38. package/dist/commands/host-queries.js.map +1 -0
  39. package/dist/commands/prior-messages.js +1 -1
  40. package/dist/commands/prior-messages.js.map +1 -1
  41. package/dist/commands/provider-wait.d.ts +5 -5
  42. package/dist/commands/provider-wait.d.ts.map +1 -1
  43. package/dist/commands/provider-wait.js +2 -2
  44. package/dist/commands/registry.d.ts.map +1 -1
  45. package/dist/commands/registry.js +2 -0
  46. package/dist/commands/registry.js.map +1 -1
  47. package/dist/commands/resident-flags.d.ts +2 -2
  48. package/dist/commands/resident-flags.d.ts.map +1 -1
  49. package/dist/commands/resident-flags.js +4 -2
  50. package/dist/commands/resident-flags.js.map +1 -1
  51. package/dist/commands/resident-learning.js +1 -1
  52. package/dist/commands/resident-learning.js.map +1 -1
  53. package/dist/commands/resident.d.ts.map +1 -1
  54. package/dist/commands/resident.js +3 -2
  55. package/dist/commands/resident.js.map +1 -1
  56. package/dist/commands/serve.js +2 -2
  57. package/dist/commands/serve.js.map +1 -1
  58. package/dist/commands/skills.js +1 -1
  59. package/dist/commands/skills.js.map +1 -1
  60. package/dist/commands/state.js +8 -8
  61. package/dist/commands/state.js.map +1 -1
  62. package/dist/commands/stdin.d.ts +5 -5
  63. package/dist/commands/stdin.js +5 -5
  64. package/dist/commands/types.d.ts +2 -0
  65. package/dist/commands/types.d.ts.map +1 -1
  66. package/dist/config/load.d.ts +1 -1
  67. package/dist/config/load.d.ts.map +1 -1
  68. package/dist/config/load.js +36 -5
  69. package/dist/config/load.js.map +1 -1
  70. package/dist/config/schema.d.ts +59 -20
  71. package/dist/config/schema.d.ts.map +1 -1
  72. package/dist/config/schema.js.map +1 -1
  73. package/dist/config/tool-result-screens.js +1 -1
  74. package/dist/config/turn-guards.d.ts +23 -0
  75. package/dist/config/turn-guards.d.ts.map +1 -0
  76. package/dist/config/turn-guards.js +46 -0
  77. package/dist/config/turn-guards.js.map +1 -0
  78. package/dist/context/directories.d.ts +37 -0
  79. package/dist/context/directories.d.ts.map +1 -0
  80. package/dist/context/directories.js +69 -0
  81. package/dist/context/directories.js.map +1 -0
  82. package/dist/context/environment.d.ts +55 -0
  83. package/dist/context/environment.d.ts.map +1 -1
  84. package/dist/context/environment.js +96 -0
  85. package/dist/context/environment.js.map +1 -1
  86. package/dist/context/project-tracker.d.ts +3 -3
  87. package/dist/context/project-tracker.d.ts.map +1 -1
  88. package/dist/context/project-tracker.js +3 -3
  89. package/dist/context/project-tracker.js.map +1 -1
  90. package/dist/context/project.d.ts +2 -2
  91. package/dist/context/project.js +2 -2
  92. package/dist/context/sandbox.d.ts +22 -3
  93. package/dist/context/sandbox.d.ts.map +1 -1
  94. package/dist/context/sandbox.js +42 -4
  95. package/dist/context/sandbox.js.map +1 -1
  96. package/dist/doctor/checks/chain.d.ts +1 -1
  97. package/dist/doctor/checks/chain.js +7 -7
  98. package/dist/doctor/checks/chain.js.map +1 -1
  99. package/dist/doctor/checks/invariants.d.ts +2 -2
  100. package/dist/doctor/checks/invariants.js +5 -5
  101. package/dist/doctor/checks/invariants.js.map +1 -1
  102. package/dist/doctor/checks/logging.js +1 -1
  103. package/dist/doctor/checks/logging.js.map +1 -1
  104. package/dist/doctor/checks/sandbox.js +1 -1
  105. package/dist/doctor/checks/sandbox.js.map +1 -1
  106. package/dist/doctor/checks/session-export.d.ts +1 -1
  107. package/dist/doctor/checks/session-export.js +2 -2
  108. package/dist/doctor/checks/session-export.js.map +1 -1
  109. package/dist/doctor/checks/telemetry.d.ts +1 -1
  110. package/dist/doctor/checks/telemetry.js +1 -1
  111. package/dist/doctor/registry.js +2 -2
  112. package/dist/doctor/registry.js.map +1 -1
  113. package/dist/exit-codes.d.ts +2 -2
  114. package/dist/exit-codes.js +2 -2
  115. package/dist/integrations/mcp/servers.d.ts +1 -1
  116. package/dist/integrations/providers/access.d.ts +4 -1
  117. package/dist/integrations/providers/access.d.ts.map +1 -1
  118. package/dist/integrations/providers/access.js +6 -3
  119. package/dist/integrations/providers/access.js.map +1 -1
  120. package/dist/integrations/providers/chain-capabilities.d.ts +6 -6
  121. package/dist/integrations/providers/chain-capabilities.js +8 -8
  122. package/dist/integrations/providers/chain-capabilities.js.map +1 -1
  123. package/dist/integrations/providers/register.d.ts +1 -1
  124. package/dist/integrations/providers/register.js +1 -1
  125. package/dist/integrations/providers/registry.d.ts +1 -1
  126. package/dist/integrations/providers/zen-catalogue.d.ts +100 -0
  127. package/dist/integrations/providers/zen-catalogue.d.ts.map +1 -0
  128. package/dist/integrations/providers/zen-catalogue.js +196 -0
  129. package/dist/integrations/providers/zen-catalogue.js.map +1 -0
  130. package/dist/integrations/resident/inspection.d.ts +4 -1
  131. package/dist/integrations/resident/inspection.d.ts.map +1 -1
  132. package/dist/integrations/resident/inspection.js +53 -34
  133. package/dist/integrations/resident/inspection.js.map +1 -1
  134. package/dist/integrations/resident/learning-storage.d.ts +7 -2
  135. package/dist/integrations/resident/learning-storage.d.ts.map +1 -1
  136. package/dist/integrations/resident/learning-storage.js +12 -8
  137. package/dist/integrations/resident/learning-storage.js.map +1 -1
  138. package/dist/integrations/resident/runner-launch.d.ts +3 -3
  139. package/dist/integrations/resident/runner-launch.d.ts.map +1 -1
  140. package/dist/integrations/resident/runner-store.d.ts +1 -1
  141. package/dist/integrations/resident/runner-store.d.ts.map +1 -1
  142. package/dist/integrations/resident/runner-store.js +5 -2
  143. package/dist/integrations/resident/runner-store.js.map +1 -1
  144. package/dist/integrations/resident/runner-worker.js +23 -0
  145. package/dist/integrations/resident/runner-worker.js.map +1 -1
  146. package/dist/integrations/resident/session-log-reads.d.ts +37 -0
  147. package/dist/integrations/resident/session-log-reads.d.ts.map +1 -0
  148. package/dist/integrations/resident/session-log-reads.js +125 -0
  149. package/dist/integrations/resident/session-log-reads.js.map +1 -0
  150. package/dist/integrations/resident/session-step.d.ts +4 -2
  151. package/dist/integrations/resident/session-step.d.ts.map +1 -1
  152. package/dist/integrations/resident/session-step.js +16 -14
  153. package/dist/integrations/resident/session-step.js.map +1 -1
  154. package/dist/integrations/resident/storage.d.ts +23 -1
  155. package/dist/integrations/resident/storage.d.ts.map +1 -1
  156. package/dist/integrations/resident/storage.js +60 -17
  157. package/dist/integrations/resident/storage.js.map +1 -1
  158. package/dist/integrations/resident/tool-evidence.d.ts +4 -2
  159. package/dist/integrations/resident/tool-evidence.d.ts.map +1 -1
  160. package/dist/integrations/resident/tool-evidence.js +36 -30
  161. package/dist/integrations/resident/tool-evidence.js.map +1 -1
  162. package/dist/integrations/resident/verification.d.ts +2 -2
  163. package/dist/integrations/resident/verification.d.ts.map +1 -1
  164. package/dist/integrations/resident/verification.js +4 -4
  165. package/dist/integrations/resident/verification.js.map +1 -1
  166. package/dist/integrations/sessions/checkpoint-view.d.ts +13 -0
  167. package/dist/integrations/sessions/checkpoint-view.d.ts.map +1 -0
  168. package/dist/integrations/sessions/checkpoint-view.js +48 -0
  169. package/dist/integrations/sessions/checkpoint-view.js.map +1 -0
  170. package/dist/integrations/sessions/context-inventory.js +1 -1
  171. package/dist/integrations/sessions/context-inventory.js.map +1 -1
  172. package/dist/integrations/sessions/conversation-search.d.ts +16 -20
  173. package/dist/integrations/sessions/conversation-search.d.ts.map +1 -1
  174. package/dist/integrations/sessions/conversation-search.js +305 -731
  175. package/dist/integrations/sessions/conversation-search.js.map +1 -1
  176. package/dist/integrations/sessions/evidence-page-validation.d.ts +4 -4
  177. package/dist/integrations/sessions/evidence-page-validation.d.ts.map +1 -1
  178. package/dist/integrations/sessions/evidence-page-validation.js +1 -1
  179. package/dist/integrations/sessions/evidence-page-validation.js.map +1 -1
  180. package/dist/integrations/sessions/evidence-recall.d.ts +40 -2
  181. package/dist/integrations/sessions/evidence-recall.d.ts.map +1 -1
  182. package/dist/integrations/sessions/evidence-recall.js +41 -97
  183. package/dist/integrations/sessions/evidence-recall.js.map +1 -1
  184. package/dist/integrations/sessions/store.d.ts +153 -85
  185. package/dist/integrations/sessions/store.d.ts.map +1 -1
  186. package/dist/integrations/sessions/store.js +414 -484
  187. package/dist/integrations/sessions/store.js.map +1 -1
  188. package/dist/integrations/sessions/task-context.d.ts +15 -2
  189. package/dist/integrations/sessions/task-context.d.ts.map +1 -1
  190. package/dist/integrations/sessions/task-context.js +34 -11
  191. package/dist/integrations/sessions/task-context.js.map +1 -1
  192. package/dist/integrations/sessions/transcript-export.d.ts +13 -6
  193. package/dist/integrations/sessions/transcript-export.d.ts.map +1 -1
  194. package/dist/integrations/sessions/transcript-export.js +148 -263
  195. package/dist/integrations/sessions/transcript-export.js.map +1 -1
  196. package/dist/integrations/state/home.d.ts +4 -16
  197. package/dist/integrations/state/home.d.ts.map +1 -1
  198. package/dist/integrations/state/home.js +6 -42
  199. package/dist/integrations/state/home.js.map +1 -1
  200. package/dist/integrations/state/project.d.ts +6 -7
  201. package/dist/integrations/state/project.d.ts.map +1 -1
  202. package/dist/integrations/state/project.js +7 -9
  203. package/dist/integrations/state/project.js.map +1 -1
  204. package/dist/integrations/state/report.d.ts +27 -41
  205. package/dist/integrations/state/report.d.ts.map +1 -1
  206. package/dist/integrations/state/report.js +172 -464
  207. package/dist/integrations/state/report.js.map +1 -1
  208. package/dist/integrations/state/retention.d.ts +18 -0
  209. package/dist/integrations/state/retention.d.ts.map +1 -0
  210. package/dist/integrations/state/retention.js +18 -0
  211. package/dist/integrations/state/retention.js.map +1 -0
  212. package/dist/integrations/subagents/activity.d.ts +36 -31
  213. package/dist/integrations/subagents/activity.d.ts.map +1 -1
  214. package/dist/integrations/subagents/activity.js +27 -23
  215. package/dist/integrations/subagents/activity.js.map +1 -1
  216. package/dist/integrations/subagents/batches.d.ts +91 -0
  217. package/dist/integrations/subagents/batches.d.ts.map +1 -0
  218. package/dist/integrations/subagents/batches.js +172 -0
  219. package/dist/integrations/subagents/batches.js.map +1 -0
  220. package/dist/integrations/subagents/parent.d.ts +26 -11
  221. package/dist/integrations/subagents/parent.d.ts.map +1 -1
  222. package/dist/integrations/subagents/parent.js +13 -28
  223. package/dist/integrations/subagents/parent.js.map +1 -1
  224. package/dist/integrations/subagents/policy.d.ts +2 -2
  225. package/dist/integrations/subagents/policy.d.ts.map +1 -1
  226. package/dist/integrations/subagents/policy.js +2 -2
  227. package/dist/integrations/subagents/policy.js.map +1 -1
  228. package/dist/integrations/subagents/replay.d.ts +91 -26
  229. package/dist/integrations/subagents/replay.d.ts.map +1 -1
  230. package/dist/integrations/subagents/replay.js +216 -114
  231. package/dist/integrations/subagents/replay.js.map +1 -1
  232. package/dist/integrations/subagents/runtime.d.ts +50 -26
  233. package/dist/integrations/subagents/runtime.d.ts.map +1 -1
  234. package/dist/integrations/subagents/runtime.js +132 -126
  235. package/dist/integrations/subagents/runtime.js.map +1 -1
  236. package/dist/integrations/subagents/saved-agents.d.ts +57 -0
  237. package/dist/integrations/subagents/saved-agents.d.ts.map +1 -0
  238. package/dist/integrations/subagents/saved-agents.js +102 -0
  239. package/dist/integrations/subagents/saved-agents.js.map +1 -0
  240. package/dist/integrations/subagents/slash.d.ts +55 -0
  241. package/dist/integrations/subagents/slash.d.ts.map +1 -0
  242. package/dist/integrations/subagents/slash.js +45 -0
  243. package/dist/integrations/subagents/slash.js.map +1 -0
  244. package/dist/integrations/telemetry/session-export.d.ts +6 -6
  245. package/dist/integrations/telemetry/session-export.d.ts.map +1 -1
  246. package/dist/integrations/telemetry/session-export.js +2 -2
  247. package/dist/integrations/web/search.d.ts +1 -1
  248. package/dist/logging.d.ts +5 -5
  249. package/dist/logging.js +6 -6
  250. package/dist/memory/presentation.d.ts +11 -0
  251. package/dist/memory/presentation.d.ts.map +1 -1
  252. package/dist/memory/presentation.js +25 -0
  253. package/dist/memory/presentation.js.map +1 -1
  254. package/dist/memory/store.d.ts +13 -7
  255. package/dist/memory/store.d.ts.map +1 -1
  256. package/dist/memory/store.js +37 -11
  257. package/dist/memory/store.js.map +1 -1
  258. package/dist/memory/typed.d.ts +116 -0
  259. package/dist/memory/typed.d.ts.map +1 -0
  260. package/dist/memory/typed.js +336 -0
  261. package/dist/memory/typed.js.map +1 -0
  262. package/dist/permissions/checks.d.ts +1 -1
  263. package/dist/permissions/checks.js +1 -1
  264. package/dist/permissions/headless-trust.d.ts +4 -4
  265. package/dist/permissions/headless-trust.d.ts.map +1 -1
  266. package/dist/permissions/headless-trust.js +6 -6
  267. package/dist/permissions/headless-trust.js.map +1 -1
  268. package/dist/permissions/mode.d.ts +4 -4
  269. package/dist/permissions/mode.js +1 -1
  270. package/dist/permissions/rules.d.ts +1 -1
  271. package/dist/permissions/rules.js +1 -1
  272. package/dist/termination.d.ts +75 -0
  273. package/dist/termination.d.ts.map +1 -0
  274. package/dist/termination.js +143 -0
  275. package/dist/termination.js.map +1 -0
  276. package/dist/tui/AgentExplorer.d.ts +2 -2
  277. package/dist/tui/AgentExplorer.js +4 -4
  278. package/dist/tui/AgentExplorer.js.map +1 -1
  279. package/dist/tui/App.d.ts +9 -1
  280. package/dist/tui/App.d.ts.map +1 -1
  281. package/dist/tui/App.js +456 -307
  282. package/dist/tui/App.js.map +1 -1
  283. package/dist/tui/LiveActivity.d.ts +1 -1
  284. package/dist/tui/LiveActivity.d.ts.map +1 -1
  285. package/dist/tui/PermissionOverlay.d.ts +8 -0
  286. package/dist/tui/PermissionOverlay.d.ts.map +1 -1
  287. package/dist/tui/PermissionOverlay.js +25 -2
  288. package/dist/tui/PermissionOverlay.js.map +1 -1
  289. package/dist/tui/Picker.js +1 -1
  290. package/dist/tui/agent.d.ts +211 -135
  291. package/dist/tui/agent.d.ts.map +1 -1
  292. package/dist/tui/agent.js +535 -316
  293. package/dist/tui/agent.js.map +1 -1
  294. package/dist/tui/conversation-evidence-view.js +3 -3
  295. package/dist/tui/conversation-evidence-view.js.map +1 -1
  296. package/dist/tui/conversation-history.d.ts +4 -21
  297. package/dist/tui/conversation-history.d.ts.map +1 -1
  298. package/dist/tui/conversation-history.js +4 -28
  299. package/dist/tui/conversation-history.js.map +1 -1
  300. package/dist/tui/index.d.ts.map +1 -1
  301. package/dist/tui/index.js +27 -1
  302. package/dist/tui/index.js.map +1 -1
  303. package/dist/tui/log-pane.js +1 -1
  304. package/dist/tui/markdownParser.d.ts +1 -1
  305. package/dist/tui/markdownParser.js +1 -1
  306. package/dist/tui/permission-review.d.ts +16 -0
  307. package/dist/tui/permission-review.d.ts.map +1 -1
  308. package/dist/tui/permission-review.js +25 -2
  309. package/dist/tui/permission-review.js.map +1 -1
  310. package/dist/tui/slashCommands.d.ts +30 -41
  311. package/dist/tui/slashCommands.d.ts.map +1 -1
  312. package/dist/tui/slashCommands.js +75 -66
  313. package/dist/tui/slashCommands.js.map +1 -1
  314. package/dist/tui/status-panel-layout.js +1 -1
  315. package/dist/tui/status-panel-layout.js.map +1 -1
  316. package/dist/tui/{run-interruption.d.ts → turn-interruption.d.ts} +4 -4
  317. package/dist/tui/turn-interruption.d.ts.map +1 -0
  318. package/dist/tui/{run-interruption.js → turn-interruption.js} +20 -20
  319. package/dist/tui/turn-interruption.js.map +1 -0
  320. package/dist/tui/turn-limits-settings.d.ts +39 -0
  321. package/dist/tui/turn-limits-settings.d.ts.map +1 -0
  322. package/dist/tui/{run-limits-settings.js → turn-limits-settings.js} +18 -18
  323. package/dist/tui/turn-limits-settings.js.map +1 -0
  324. package/dist/tui/types.d.ts +3 -3
  325. package/dist/tui/types.d.ts.map +1 -1
  326. package/dist/user-commands/store.d.ts +4 -4
  327. package/dist/user-commands/store.js +5 -5
  328. package/dist/user-commands/store.js.map +1 -1
  329. package/package.json +6 -6
  330. package/dist/commands/run-flags.d.ts.map +0 -1
  331. package/dist/commands/run-flags.js.map +0 -1
  332. package/dist/commands/run-stream.d.ts +0 -65
  333. package/dist/commands/run-stream.d.ts.map +0 -1
  334. package/dist/commands/run-stream.js +0 -603
  335. package/dist/commands/run-stream.js.map +0 -1
  336. package/dist/commands/run.d.ts +0 -39
  337. package/dist/commands/run.d.ts.map +0 -1
  338. package/dist/commands/run.js +0 -533
  339. package/dist/commands/run.js.map +0 -1
  340. package/dist/config/run-limits.d.ts +0 -11
  341. package/dist/config/run-limits.d.ts.map +0 -1
  342. package/dist/config/run-limits.js +0 -64
  343. package/dist/config/run-limits.js.map +0 -1
  344. package/dist/integrations/sessions/compaction-evidence.d.ts +0 -5
  345. package/dist/integrations/sessions/compaction-evidence.d.ts.map +0 -1
  346. package/dist/integrations/sessions/compaction-evidence.js +0 -59
  347. package/dist/integrations/sessions/compaction-evidence.js.map +0 -1
  348. package/dist/integrations/sessions/database.d.ts +0 -5
  349. package/dist/integrations/sessions/database.d.ts.map +0 -1
  350. package/dist/integrations/sessions/database.js +0 -34
  351. package/dist/integrations/sessions/database.js.map +0 -1
  352. package/dist/integrations/sessions/paths.d.ts +0 -7
  353. package/dist/integrations/sessions/paths.d.ts.map +0 -1
  354. package/dist/integrations/sessions/paths.js +0 -14
  355. package/dist/integrations/sessions/paths.js.map +0 -1
  356. package/dist/integrations/sessions/run-discovery.d.ts +0 -24
  357. package/dist/integrations/sessions/run-discovery.d.ts.map +0 -1
  358. package/dist/integrations/sessions/run-discovery.js +0 -142
  359. package/dist/integrations/sessions/run-discovery.js.map +0 -1
  360. package/dist/integrations/sessions/turn-evidence.d.ts +0 -129
  361. package/dist/integrations/sessions/turn-evidence.d.ts.map +0 -1
  362. package/dist/integrations/sessions/turn-evidence.js +0 -517
  363. package/dist/integrations/sessions/turn-evidence.js.map +0 -1
  364. package/dist/integrations/subagents/history.d.ts +0 -26
  365. package/dist/integrations/subagents/history.d.ts.map +0 -1
  366. package/dist/integrations/subagents/history.js +0 -76
  367. package/dist/integrations/subagents/history.js.map +0 -1
  368. package/dist/integrations/subagents/runs.d.ts +0 -72
  369. package/dist/integrations/subagents/runs.d.ts.map +0 -1
  370. package/dist/integrations/subagents/runs.js +0 -155
  371. package/dist/integrations/subagents/runs.js.map +0 -1
  372. package/dist/tui/run-interruption.d.ts.map +0 -1
  373. package/dist/tui/run-interruption.js.map +0 -1
  374. package/dist/tui/run-limits-settings.d.ts +0 -39
  375. package/dist/tui/run-limits-settings.d.ts.map +0 -1
  376. package/dist/tui/run-limits-settings.js.map +0 -1
@@ -1,603 +0,0 @@
1
- /**
2
- * `namzu run-stream [--session <key>] "<prompt>"` — headless STREAMING
3
- * one-shot. Same engine as `run`, but instead of buffering the final text it
4
- * emits one compact NDJSON line per `AgentEvent` to stdout
5
- * (`{"kind":"delta","text":…}`, `{"kind":"tool-start",…}`,
6
- * `{"kind":"error","message":…}`, `{"kind":"done"}`). A host process — a
7
- * desktop app embedding namzu, say — line-scans stdout and renders the turn
8
- * live: the equivalent of the TUI, driven from another runtime.
9
- *
10
- * History: with `--session <key>` the turn is bound to a persisted
11
- * conversation in the central application-home Project associated with the
12
- * canonical cwd (keyed by the embedder's own session id), so prior turns are
13
- * loaded as context and the kernel's exact
14
- * settled conversation projection is published — including opaque reasoning
15
- * and complete tool turns, excluding its fresh per-run system floor. That's
16
- * what lets a reopened session show and replay its past messages (`namzu
17
- * history --session <key>`). Without `--session`,
18
- * prior history may be supplied on stdin as a JSON `Message[]` and nothing is
19
- * persisted (stateless one-shot).
20
- *
21
- * Status lines go to stderr as NDJSON (LOG-05), never stdout, so every
22
- * stdout line is a valid JSON event, and EVERY failure is reported in band,
23
- * including the ones that also carry an exit code.
24
- *
25
- * ## What the exit code means
26
- *
27
- * It used to be explained as "a run that STARTED and failed exits 0; a refusal
28
- * to start exits non-zero", and that rule did not sort the cases it was applied
29
- * to. An unknown option, a missing prompt, a `--cwd` that is not there and a
30
- * tool server that will not connect are all refusals to start, and all four
31
- * exited 0 while an untrusted folder exited 77. Neither does the retry argument
32
- * the old comment appealed to: retrying an unknown option is exactly as
33
- * pointless as retrying an untrusted folder.
34
- *
35
- * The axis that does sort them:
36
- *
37
- * CAN THE CALLER REACH THE RUN IT ASKED FOR BY CHANGING WHAT IT SENDS?
38
- *
39
- * - **Yes → `0`.** The host reads the `error` event and fixes its own
40
- * invocation. An unknown option, no prompt, a `--cwd` that does not exist, a
41
- * `--permission-mode` that is not a mode, an interactive command named
42
- * headlessly, a provider id that is not a provider.
43
- * - **A run that started and failed → `0`.** Unchanged: that is an outcome to
44
- * render, and possibly to retry.
45
- * - **No → non-zero, because a person has to go and do something.** `77` when
46
- * the folder is untrusted — kept to that one condition, because being
47
- * unambiguous is its entire justification. `1` for everything else in this
48
- * group: a conversation that cannot be opened, no provider available, a
49
- * credential or driver the session needs, a declared tool server that is not
50
- * there, a command file that will not parse.
51
- *
52
- * `1` rather than a new code because `namzu run` — the same one-shot, differing
53
- * only in how it prints — already exits `1` for these conditions and `77` for
54
- * trust. A host that shells to one for a script and the other for a UI must not
55
- * be handed two tables for one fact.
56
- *
57
- * Dropping `--session` is NOT "the caller fixing it": it abandons what was
58
- * asked for rather than achieving it.
59
- */
60
- import { asSessionId, generateSessionId, isEntityId, jsonLinesSink, } from '@namzu/sdk';
61
- import { resolveTrustedProjectContext } from '../config/trusted-project-context.js';
62
- import { EXIT_FAIL, EXIT_OK, EXIT_UNTRUSTED } from '../exit-codes.js';
63
- import { appendMessages, findMappedConversation, listRecent, loadConversation, openSessions, replaceConversation, resolveConversation, } from '../integrations/sessions/store.js';
64
- import { contextLogging, installCliLogging } from '../logging.js';
65
- import { decideHeadlessTrust } from '../permissions/headless-trust.js';
66
- import { resolvePermissionMode } from '../permissions/mode.js';
67
- import { compilePermissions } from '../permissions/rules.js';
68
- import { planTurnPublication } from '../tui/conversation-history.js';
69
- import { hostCommandNames } from '../tui/slashCommands.js';
70
- import { expandHeadlessCommand } from '../user-commands/store.js';
71
- import { parsePriorMessages } from './prior-messages.js';
72
- import { applyProviderFlags, buildGate, loadSkillsContext, parseRunFlags, resolveWorkingDirectory, unknownOptionMessage, } from './run-flags.js';
73
- import { readStdin } from './stdin.js';
74
- function defaultPrefs(detected) {
75
- const first = detected[0];
76
- return first
77
- ? {
78
- version: 3,
79
- providers: [{ id: first.entry.id }],
80
- subagents: { active: [] },
81
- }
82
- : null;
83
- }
84
- export const runStreamCommand = {
85
- name: 'run-stream',
86
- description: 'Run a single prompt and stream AgentEvents as NDJSON (for host UIs)',
87
- passThrough: true,
88
- help: [
89
- 'Usage: namzu run-stream <prompt...> [--session <id>] [--cwd <path>]',
90
- '',
91
- 'Run a single prompt and stream one JSON event per line as the turn',
92
- 'unfolds — text deltas, tool starts and ends, usage, then a terminal',
93
- 'event. Built for a host UI that renders progress rather than waiting',
94
- 'for a final string.',
95
- 'The terminal done.text is the settled answer. Earlier deltas may include',
96
- 'progress or answers later rejected by verification.',
97
- '',
98
- 'Takes the same options as `namzu run`, including --effort, --permission-mode and',
99
- 'the [permissions] table from the config file.',
100
- '',
101
- 'History is bound with --session <id>. --continue and --resume are `run`',
102
- 'options and are refused here rather than ignored.',
103
- 'Without --session, optional stdin must be one complete JSON Message[];',
104
- 'invalid or provider-incomplete tool history is refused before a run.',
105
- '',
106
- 'The folder has to be trusted: run `namzu` here once and accept the',
107
- 'prompt, or pass --trust for one run. An untrusted folder emits an error',
108
- 'event and exits 77 without running anything.',
109
- '',
110
- 'Needs a provider. Set a credential in the environment, or run namzu',
111
- 'once to pick one interactively.',
112
- '',
113
- 'Every failure is an event on stdout. The exit code says whether YOU can',
114
- 'do anything about it: 0 when changing what you send would reach the run',
115
- '(a wrong option, no prompt, a bad --cwd) and when a run started and',
116
- 'failed; 1 when it would not (no provider, a tool server that is not',
117
- 'there, a conversation that cannot be opened); 77 when the folder has not',
118
- 'been trusted, which only a person can change.',
119
- ].join('\n'),
120
- handler: async ({ ctx: bootstrapCtx, rawArgs }) => {
121
- let ctx = bootstrapCtx;
122
- const write = (o) => {
123
- process.stdout.write(`${JSON.stringify(o)}\n`);
124
- };
125
- /**
126
- * Report and stop.
127
- *
128
- * Always in band, always terminated with `done`, and the code says only
129
- * whether the caller can reach the run by sending something else. The
130
- * argument for each case is in this file's header; the two spellings exist
131
- * so that every call site below has to state which side it is on rather
132
- * than inheriting a default nobody re-reads.
133
- */
134
- const fail = (message) => {
135
- write({ kind: 'error', message });
136
- write({ kind: 'done' });
137
- return EXIT_OK;
138
- };
139
- const refuse = (message) => {
140
- write({ kind: 'error', message });
141
- write({ kind: 'done' });
142
- return EXIT_FAIL;
143
- };
144
- const flags = parseRunFlags(rawArgs);
145
- // The run's leash: the config file's limits, with a flag overriding each.
146
- const limitsFromFlags = {
147
- ...(flags.maxIterations !== null ? { maxIterations: flags.maxIterations } : {}),
148
- ...(flags.tokenBudget !== null ? { tokenBudget: flags.tokenBudget } : {}),
149
- };
150
- if (flags.unknown.length > 0)
151
- return fail(unknownOptionMessage(flags.unknown));
152
- // `--continue` and `--resume` parse here because the two commands share one
153
- // parser, and this command reads neither. Accepting a flag and doing
154
- // nothing with it is the failure mode the shared parser was introduced to
155
- // end: a host that asked to reopen a conversation was given a stateless
156
- // run, reported as an ordinary success, and the next turn had no history
157
- // with nothing anywhere connecting the two. Refused instead, and named,
158
- // because a host CAN fix this — `--session` is the flag it wanted.
159
- if (flags.continueLast || flags.resume !== null) {
160
- return fail('run-stream does not take --continue or --resume; they are `namzu run` options. Bind history with --session <id>, which keys a persisted conversation in this folder.');
161
- }
162
- // Same reasoning for the wait budget: this command streams a pause to its
163
- // host as an event and the host decides when to resume; a flag it accepted
164
- // and ignored would promise a wait that never happens.
165
- if (flags.waitForProviderMs !== null) {
166
- return fail('run-stream does not take --wait-for-provider; it is a `namzu run` option. A host reads the paused event and resumes when it chooses.');
167
- }
168
- const sessionKey = flags.session;
169
- const prompt = flags.rest.join(' ').trim();
170
- if (!prompt)
171
- return fail('no prompt — pass it as an argument');
172
- const resolved = resolveWorkingDirectory(flags.cwd);
173
- if ('error' in resolved)
174
- return fail(resolved.error);
175
- const requestedCwd = resolved.cwd;
176
- // Before the session store is opened, before anything is read or run in
177
- // that directory.
178
- //
179
- // Reported BOTH ways, which is the one place this command departs from
180
- // its "every failure is an in-band event and the exit code is 0" rule.
181
- // That rule is about a run that STARTED and failed, which a host should
182
- // render and may sensibly retry. This is a refusal to start at all, and
183
- // a host that cannot tell the two apart will retry the one that must not
184
- // be retried — so the event carries the explanation and the exit code
185
- // carries the fact that nothing ran.
186
- const trust = decideHeadlessTrust({
187
- cwd: requestedCwd,
188
- trustFlag: flags.trust,
189
- });
190
- if (!trust.allowed) {
191
- write({ kind: 'error', message: trust.message ?? 'folder not trusted' });
192
- write({ kind: 'done' });
193
- return EXIT_UNTRUSTED;
194
- }
195
- const cwd = trust.cwd;
196
- ctx = resolveTrustedProjectContext(bootstrapCtx, cwd);
197
- // Project command discovery belongs behind the target folder's trust
198
- // gate, alongside project config and instructions.
199
- const expansion = expandHeadlessCommand(prompt, {
200
- cwd,
201
- builtins: hostCommandNames(),
202
- });
203
- if (expansion.kind === 'refused') {
204
- return expansion.fixable ? fail(expansion.reason) : refuse(expansion.reason);
205
- }
206
- const finalPrompt = expansion.kind === 'expanded' ? expansion.prompt : prompt;
207
- // Resolve the workspace's central Project for every run. A session key
208
- // additionally binds a durable conversation; without one, stdin history
209
- // remains stateless and no Session record is created.
210
- let cli;
211
- let conversationId = null;
212
- let prior = [];
213
- if (!sessionKey) {
214
- const parsed = parsePriorMessages(await readStdin({ deadline: true }));
215
- if (!parsed.ok)
216
- return fail(`invalid stdin history: ${parsed.error}`);
217
- prior = [...parsed.messages];
218
- }
219
- try {
220
- cli = await openSessions(cwd);
221
- if (sessionKey) {
222
- conversationId = await resolveConversation(cli, sessionKey);
223
- prior = await loadConversation(cli, conversationId);
224
- }
225
- }
226
- catch (err) {
227
- if (sessionKey) {
228
- // Refused, not run stateless.
229
- //
230
- // This used to set `cli = null` and fall through to the branch
231
- // below, which reads prior turns from STDIN — so a caller who named
232
- // a conversation got a turn answered against a different history,
233
- // or none, reported as an ordinary success. `run.ts` already
234
- // refuses the equivalent, in those words: someone who asked for a
235
- // specific conversation and got a new one that looks the same finds
236
- // out several turns later, having already acted on it.
237
- //
238
- // It cannot be softened into a warning, because we cannot say what
239
- // was lost. `resolveConversation` creates the key on first use, so
240
- // a fresh key legitimately has no prior turns — and the failure is
241
- // exactly what stopped us finding out which case this is. "Could
242
- // not look" is not "there was nothing there."
243
- //
244
- // In band, like every other failure here, because that is what the
245
- // host reads. No session has been built at this point in the flow,
246
- // so there is nothing to close on the way out.
247
- //
248
- // Non-zero, which is the correction #321 is about. `resolveConversation`
249
- // CREATES the key on first use, so this cannot be a key the host got
250
- // wrong — the only way here is the store itself: an unwritable
251
- // `.namzu`, a corrupt map file. Nothing the host sends changes that,
252
- // so a host treating 0 as "render the error and move on" would loop
253
- // on an environment fault it could have raised to a person. Dropping
254
- // `--session` is not a fix; it abandons what was asked for.
255
- return refuse(`could not open conversation "${sessionKey}": ${err instanceof Error ? err.message : String(err)}. Nothing ran, because continuing the wrong history is worse than not continuing. Drop --session to run this turn stateless.`);
256
- }
257
- return refuse(`could not open workspace state: ${err instanceof Error ? err.message : String(err)}. Nothing ran, because generated state could not be bound to this working directory.`);
258
- }
259
- // Always NDJSON on stderr, regardless of --log-format/NAMZU_LOG_FORMAT
260
- // — this is the machine-read channel §6.6 of the logging design
261
- // describes, and stdout's own protocol is unaffected by anything the
262
- // operator passes, so stderr here stays that way too. `{ replace:
263
- // true }`: see `run.ts`'s identical comment.
264
- const logging = contextLogging(ctx);
265
- installCliLogging(jsonLinesSink(process.stderr), logging.level);
266
- const { probeAgentSession, createAgentSession } = await import('../tui/agent.js');
267
- const probe = await probeAgentSession();
268
- let prefs = probe.preferences ?? defaultPrefs(probe.detected);
269
- if (!prefs) {
270
- // Nothing detected and nothing configured. `--provider` cannot conjure a
271
- // credential, so no argument the host changes gets past this line.
272
- return refuse('no LLM provider available — set a credential (e.g. ANTHROPIC_API_KEY) or run `namzu` to pick one');
273
- }
274
- // --provider/--model override the persona's configured provider+model for
275
- // this run, so the Namzu tab's picks win over ~/.namzu/preferences.json.
276
- prefs = applyProviderFlags(prefs, flags);
277
- // The operator's rules and mode reach this command too. They did not:
278
- // `[permissions]` was compiled for `run` and never for `run-stream`, so a
279
- // host UI ran with an empty rule list whatever the config said — the same
280
- // shape as a flag that parses and does nothing, one level larger, and
281
- // silent in exactly the same way.
282
- const modeResult = resolvePermissionMode({
283
- flag: flags.permissionMode,
284
- skipPermissions: flags.skipPermissions,
285
- interactive: false,
286
- });
287
- if ('error' in modeResult)
288
- return fail(modeResult.error);
289
- const permissions = compilePermissions(ctx.config.permissions, ctx.config.permissionChecks);
290
- for (const d of permissions.diagnostics) {
291
- const where = d.pattern ? `permissions.${d.tool}."${d.pattern}"` : `permissions.${d.tool}`;
292
- // In band, because a host line-scanning stdout has no other channel —
293
- // and a permission the operator believes is in force must never be
294
- // dropped without saying so.
295
- write({ kind: 'error', message: `${where}: ${d.message}` });
296
- }
297
- // The resolved `--cwd` is what the agent's tools resolve against, not just
298
- // where the session store lives — a run told to work in another checkout
299
- // has to glob, read and edit files there.
300
- const gate = buildGate(flags, cwd);
301
- const session = await createAgentSession(prefs, probe.detected, {
302
- cwd,
303
- scope: {
304
- sessionId: conversationId ?? generateSessionId(),
305
- topicId: cli.topicId,
306
- projectId: cli.projectId,
307
- tenantId: cli.tenantId,
308
- },
309
- stateRoot: cli.root,
310
- ...(conversationId ? { conversationSessions: cli } : {}),
311
- rules: permissions.rules,
312
- // The operator's --gate commands, as a standing condition on the
313
- // answer. Spread rather than passed as undefined so a run without
314
- // gates is byte-identical to the one that shipped before them.
315
- ...(gate ?? {}),
316
- permissionMode: modeResult.mode,
317
- ...(ctx.config.mcpServers ? { mcpServers: ctx.config.mcpServers } : {}),
318
- ...(ctx.config.plugins ? { plugins: ctx.config.plugins } : {}),
319
- ...(ctx.config.web ? { web: ctx.config.web } : {}),
320
- ...(ctx.config.hooks ? { hooks: ctx.config.hooks } : {}),
321
- ...(ctx.config.compaction ? { compaction: ctx.config.compaction } : {}),
322
- ...(ctx.config.memory ? { memory: ctx.config.memory } : {}),
323
- ...(Object.keys({ ...ctx.config.limits, ...limitsFromFlags }).length > 0
324
- ? { limits: { ...ctx.config.limits, ...limitsFromFlags } }
325
- : {}),
326
- ...(ctx.config.sandbox ? { sandbox: ctx.config.sandbox } : {}),
327
- // `!== undefined`, not truthiness: an empty list is the operator
328
- // turning the default screen OFF, and a falsy check would drop it.
329
- ...(ctx.config.toolResultScreens !== undefined
330
- ? { toolResultScreens: ctx.config.toolResultScreens }
331
- : {}),
332
- });
333
- if (!session.hasProvider) {
334
- await session.close();
335
- // The one branch here that is genuinely BOTH. `createAgentSession`
336
- // refuses an id that is not a provider — which `--provider` put there,
337
- // so the host fixes it — and, with the same result object, a missing
338
- // credential, a driver package that would not load, a chain that
339
- // contradicts itself, a client that would not construct. None of those
340
- // four move for any argument.
341
- //
342
- // The session says which, in a field. Deciding it here by reading its
343
- // `errorHint` would be the message-matching that `exit-codes.ts` exists
344
- // to prevent, and would make that sentence unrewordable.
345
- const message = session.errorHint ?? 'agent is not ready';
346
- return session.errorKind === 'invocation' ? fail(message) : refuse(message);
347
- }
348
- // A configured tool server that is not here means the turn cannot do what
349
- // the operator set it up to do, and this command answers a host, not a
350
- // person who might notice. Refused rather than run short — in band, like
351
- // every other failure here, because that is what the host reads.
352
- if (session.mcpFailed.length > 0) {
353
- const said = session.mcpFailed
354
- .map((f) => `tool server "${f.name}" is not available: ${f.reason}`)
355
- .join('; ');
356
- await session.close();
357
- // The servers come from `namzu.config.json`, not from the invocation, so
358
- // there is no argument the host can change to bring one up. `run`
359
- // already exits 1 here.
360
- return refuse(said);
361
- }
362
- // "Printed on every launch" has to reach a host UI too, or the one caller
363
- // with no human watching is the one that never hears it. Its own event
364
- // kind rather than an `error`: the run is proceeding, and a host that
365
- // treats this as a failure would be wrong.
366
- for (const notice of session.configNotices) {
367
- write({ kind: 'notice', message: notice });
368
- }
369
- // --skills <a,b,c>: load the named skills' bodies and inject them as the
370
- // turn's extra system context (the same channel the TUI's /skill uses).
371
- const extraSystem = await loadSkillsContext(cwd, flags.skills);
372
- const userMessage = {
373
- role: 'user',
374
- content: finalPrompt,
375
- timestamp: Date.now(),
376
- };
377
- const messages = [...prior, userMessage];
378
- let assistantText = '';
379
- let conversationMessages;
380
- let terminalEvent;
381
- let budget;
382
- try {
383
- for await (const event of session.send(messages, {
384
- ...(extraSystem ? { extraSystem } : {}),
385
- ...(flags.effort !== null ? { effort: flags.effort } : {}),
386
- onConversationMessages: (settled) => {
387
- conversationMessages = settled;
388
- },
389
- })) {
390
- if (event.kind === 'delta')
391
- assistantText += event.text;
392
- if ('budget' in event && event.budget)
393
- budget = event.budget;
394
- if (event.kind === 'done') {
395
- terminalEvent = event;
396
- // Only used by fallback persistence when the full conversation
397
- // callback is unavailable. Keep the settled answer here too.
398
- if (event.text !== undefined)
399
- assistantText = event.text;
400
- }
401
- else
402
- write(event);
403
- }
404
- }
405
- catch (err) {
406
- await session.close();
407
- return fail(err instanceof Error ? err.message : String(err));
408
- }
409
- // A stdio tool server is a child process; a command that returns without
410
- // closing leaves it running.
411
- await session.close();
412
- // Persist the turn so a later `history --session <key>` (and the next
413
- // turn's context) sees it. Best-effort — a store failure must not lose
414
- // the reply the user already saw stream.
415
- //
416
- // Best-effort is about not FAILING, not about staying quiet. This used to
417
- // swallow the error entirely, and it is the one failure here that makes a
418
- // LATER command wrong: the stream ends `done`, the process exits 0, and a
419
- // host has every reason to believe the turn is stored. Then
420
- // `history --session` comes back missing a turn the user watched arrive,
421
- // and the next turn's context silently lacks it — with nothing, anywhere,
422
- // connecting that to a write that failed minutes earlier.
423
- //
424
- // So it is said, on the same channel and in the same shape as the config
425
- // notices forty lines above, and for the reason written there: a host UI
426
- // is the caller with no human watching, and its own event kind rather
427
- // than an `error` because the run did succeed and a host treating this as
428
- // a failure would be wrong. The consequence is named, not just the fault,
429
- // because "could not persist" alone does not tell a host that its own
430
- // later reads are now incomplete.
431
- if (conversationId) {
432
- try {
433
- if (conversationMessages) {
434
- const publication = planTurnPublication(prior, userMessage, conversationMessages);
435
- if (publication.kind === 'replace') {
436
- await replaceConversation(cli, conversationId, publication.messages);
437
- }
438
- else {
439
- await appendMessages(cli, conversationId, publication.messages);
440
- }
441
- }
442
- else {
443
- const assistant = {
444
- role: 'assistant',
445
- content: assistantText,
446
- timestamp: Date.now(),
447
- };
448
- await appendMessages(cli, conversationId, [userMessage, assistant]);
449
- }
450
- }
451
- catch (err) {
452
- write({
453
- kind: 'notice',
454
- message: `this turn was not saved: ${err instanceof Error ? err.message : String(err)}. The reply above is complete, but history for this session will not include it and the next turn will not have it as context.`,
455
- });
456
- }
457
- }
458
- write({
459
- ...(terminalEvent ?? { kind: 'done' }),
460
- ...(budget ? { budget } : {}),
461
- });
462
- return 0;
463
- },
464
- };
465
- export const historyCommand = {
466
- name: 'history',
467
- description: "Print a session's persisted messages as JSON (for host UIs)",
468
- passThrough: true,
469
- help: [
470
- 'Usage: namzu history [--session <id>] [--cwd <path>]',
471
- '',
472
- "Print a session's persisted messages as JSON. With no session id the",
473
- 'most recent session for the working directory is used.',
474
- '',
475
- 'An empty array means the session exists and has no messages yet — it',
476
- 'is not an error.',
477
- ].join('\n'),
478
- handler: async ({ rawArgs }) => {
479
- const flags = parseRunFlags(rawArgs);
480
- const key = flags.session;
481
- try {
482
- // `--cwd` is in this command's help too, and picks the central Project
483
- // the session is read from. Reading the process's own directory
484
- // instead means a host asking about a session in another checkout is
485
- // told `[]` — indistinguishable from a session with no messages.
486
- const resolved = resolveWorkingDirectory(flags.cwd);
487
- if ('error' in resolved) {
488
- process.stdout.write('[]\n');
489
- return 0;
490
- }
491
- const cli = await openSessions(resolved.cwd);
492
- // Host keys and CLI conversation UUIDs are distinct entry points. Both
493
- // must pass the same workspace membership check before reading content.
494
- const existing = key
495
- ? ((await findMappedConversation(cli, key)) ??
496
- (isEntityId(key, 'session') ? asSessionId(key) : null))
497
- : (await listRecent(cli, 1))[0]?.id;
498
- if (!existing) {
499
- process.stdout.write('[]\n');
500
- return 0;
501
- }
502
- const messages = await loadConversation(cli, existing);
503
- const out = messages
504
- .filter((m) => (m.role === 'user' || m.role === 'assistant') && m.content)
505
- .map((m) => ({ role: m.role, content: m.content }));
506
- process.stdout.write(`${JSON.stringify(out)}\n`);
507
- return 0;
508
- }
509
- catch {
510
- process.stdout.write('[]\n');
511
- return 0;
512
- }
513
- },
514
- };
515
- // skills-json — read-only skill discovery for a host UI (the Namzu tab's skill
516
- // chips). Prints the cwd-resolved skills as a JSON array of {name, description,
517
- // source}. Distinct from the milestone-owned `skills` management command; this
518
- // is the thin enumeration the desktop polls. Empty array on any failure.
519
- export const skillsJSONCommand = {
520
- name: 'skills-json',
521
- description: 'Print discovered skills as JSON (for host UIs)',
522
- passThrough: true,
523
- help: [
524
- 'Usage: namzu skills-json [--cwd <path>]',
525
- '',
526
- 'Print the skills discovered for a working directory as JSON. Project',
527
- 'skills come from that directory; user skills come from the home',
528
- 'directory either way.',
529
- '',
530
- 'An empty array means no skills were found — it is not an error.',
531
- ].join('\n'),
532
- handler: async ({ rawArgs }) => {
533
- // Project skills live under the working directory, so a host listing the
534
- // skills for one checkout while the process sits in another was shown
535
- // the wrong project's chips — and then `run-stream --cwd <that
536
- // checkout> --skills <name>` could not find the skill it had just
537
- // offered. Same flag, same directory, both ends.
538
- const resolved = resolveWorkingDirectory(parseRunFlags(rawArgs).cwd);
539
- if ('error' in resolved) {
540
- process.stdout.write('[]\n');
541
- return 0;
542
- }
543
- try {
544
- const { discoverSkills } = await import('../skills/store.js');
545
- const skills = discoverSkills({ cwd: resolved.cwd }).map((s) => ({
546
- name: s.name,
547
- description: s.description,
548
- source: s.source,
549
- }));
550
- process.stdout.write(`${JSON.stringify(skills)}\n`);
551
- }
552
- catch {
553
- process.stdout.write('[]\n');
554
- }
555
- return 0;
556
- },
557
- };
558
- // providers-json — read-only provider+model discovery for a host UI (the Namzu
559
- // tab's provider/model pickers). Emits every PROVIDER_REGISTRY entry with
560
- // detection state + a best-effort live model list. Distinct from the `providers`
561
- // profile-management command. Empty models[] → the host falls back to a
562
- // free-text model field seeded with `default`. Never throws.
563
- export const providersJSONCommand = {
564
- name: 'providers-json',
565
- description: 'Print providers + per-provider models as JSON (for host UIs)',
566
- passThrough: true,
567
- handler: async ({ ctx }) => {
568
- try {
569
- // Always NDJSON on stderr — same reasoning as run-stream's own sink
570
- // above; this command answers a host UI polling for a picker list,
571
- // not a person reading a terminal. installProcessSink/jsonLinesSink
572
- // are already statically imported at the top of this file, so the
573
- // dynamic import('@namzu/sdk') this replaced bought nothing — it
574
- // re-fetched a module already loaded for `Message`.
575
- const logging = contextLogging(ctx);
576
- installCliLogging(jsonLinesSink(process.stderr), logging.level);
577
- const { PROVIDER_REGISTRY, ALL_PROVIDER_IDS, findDetected } = await import('../integrations/providers/index.js');
578
- const { probeAgentSession, listProviderModels } = await import('../tui/agent.js');
579
- const probe = await probeAgentSession();
580
- const out = [];
581
- for (const id of ALL_PROVIDER_IDS) {
582
- const entry = PROVIDER_REGISTRY[id];
583
- const det = findDetected(probe.detected, id) ?? null;
584
- const models = det ? await listProviderModels(id, det).catch(() => []) : [];
585
- out.push({
586
- provider: id,
587
- label: entry.label,
588
- detected: Boolean(det),
589
- default: entry.defaultModel,
590
- models,
591
- });
592
- }
593
- // Detected providers first, so the picker defaults to a usable one.
594
- out.sort((a, b) => Number(b.detected) - Number(a.detected));
595
- process.stdout.write(`${JSON.stringify(out)}\n`);
596
- }
597
- catch {
598
- process.stdout.write('[]\n');
599
- }
600
- return 0;
601
- },
602
- };
603
- //# sourceMappingURL=run-stream.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run-stream.js","sourceRoot":"","sources":["../../src/commands/run-stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAEH,OAAO,EAGN,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,aAAa,GACb,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAA;AACnF,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAErE,OAAO,EACN,cAAc,EACd,sBAAsB,EACtB,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,GACnB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjE,OA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