@nodetool-ai/cli 0.8.8 → 0.8.9-bootstrap.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 (721) hide show
  1. package/README.md +61 -109
  2. package/dist/.nodetool-build-stamp +1 -1
  3. package/dist/chat.d.ts +3 -0
  4. package/dist/chat.d.ts.map +1 -0
  5. package/dist/chat.js +8 -0
  6. package/dist/chat.js.map +1 -0
  7. package/dist/index.d.ts +1 -12
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +1 -231
  10. package/dist/index.js.map +1 -1
  11. package/dist/lean/commandFeatures.d.ts +3 -0
  12. package/dist/lean/commandFeatures.d.ts.map +1 -0
  13. package/dist/lean/commandFeatures.js +21 -0
  14. package/dist/lean/commandFeatures.js.map +1 -0
  15. package/dist/lean/errors.d.ts +19 -0
  16. package/dist/lean/errors.d.ts.map +1 -0
  17. package/dist/lean/errors.js +20 -0
  18. package/dist/lean/errors.js.map +1 -0
  19. package/dist/lean/program.d.ts +12 -0
  20. package/dist/lean/program.d.ts.map +1 -0
  21. package/dist/lean/program.js +398 -0
  22. package/dist/lean/program.js.map +1 -0
  23. package/dist/nodetool.js +6 -29
  24. package/dist/nodetool.js.map +1 -1
  25. package/package.json +14 -67
  26. package/dist/ExecutionTree.d.ts +0 -20
  27. package/dist/ExecutionTree.d.ts.map +0 -1
  28. package/dist/ExecutionTree.js +0 -100
  29. package/dist/ExecutionTree.js.map +0 -1
  30. package/dist/affected/affected.d.ts +0 -48
  31. package/dist/affected/affected.d.ts.map +0 -1
  32. package/dist/affected/affected.js +0 -167
  33. package/dist/affected/affected.js.map +0 -1
  34. package/dist/agent-toolbelt.d.ts +0 -15
  35. package/dist/agent-toolbelt.d.ts.map +0 -1
  36. package/dist/agent-toolbelt.js +0 -28
  37. package/dist/agent-toolbelt.js.map +0 -1
  38. package/dist/api-client.d.ts +0 -12
  39. package/dist/api-client.d.ts.map +0 -1
  40. package/dist/api-client.js +0 -21
  41. package/dist/api-client.js.map +0 -1
  42. package/dist/app-build/bundle.d.ts +0 -15
  43. package/dist/app-build/bundle.d.ts.map +0 -1
  44. package/dist/app-build/bundle.js +0 -45
  45. package/dist/app-build/bundle.js.map +0 -1
  46. package/dist/app-build/watch.d.ts +0 -13
  47. package/dist/app-build/watch.d.ts.map +0 -1
  48. package/dist/app-build/watch.js +0 -25
  49. package/dist/app-build/watch.js.map +0 -1
  50. package/dist/app-debug/app-target.d.ts +0 -14
  51. package/dist/app-debug/app-target.d.ts.map +0 -1
  52. package/dist/app-debug/app-target.js +0 -120
  53. package/dist/app-debug/app-target.js.map +0 -1
  54. package/dist/app-debug/harness.d.ts +0 -29
  55. package/dist/app-debug/harness.d.ts.map +0 -1
  56. package/dist/app-debug/harness.js +0 -116
  57. package/dist/app-debug/harness.js.map +0 -1
  58. package/dist/app-debug/index.d.ts +0 -12
  59. package/dist/app-debug/index.d.ts.map +0 -1
  60. package/dist/app-debug/index.js +0 -9
  61. package/dist/app-debug/index.js.map +0 -1
  62. package/dist/app.d.ts +0 -40
  63. package/dist/app.d.ts.map +0 -1
  64. package/dist/app.js +0 -1070
  65. package/dist/app.js.map +0 -1
  66. package/dist/bash-tool.d.ts +0 -13
  67. package/dist/bash-tool.d.ts.map +0 -1
  68. package/dist/bash-tool.js +0 -85
  69. package/dist/bash-tool.js.map +0 -1
  70. package/dist/chat-codeact.d.ts +0 -93
  71. package/dist/chat-codeact.d.ts.map +0 -1
  72. package/dist/chat-codeact.js +0 -179
  73. package/dist/chat-codeact.js.map +0 -1
  74. package/dist/chat-context.d.ts +0 -18
  75. package/dist/chat-context.d.ts.map +0 -1
  76. package/dist/chat-context.js +0 -32
  77. package/dist/chat-context.js.map +0 -1
  78. package/dist/chat-media.d.ts +0 -3
  79. package/dist/chat-media.d.ts.map +0 -1
  80. package/dist/chat-media.js +0 -46
  81. package/dist/chat-media.js.map +0 -1
  82. package/dist/chat-prompts.d.ts +0 -20
  83. package/dist/chat-prompts.d.ts.map +0 -1
  84. package/dist/chat-prompts.js +0 -42
  85. package/dist/chat-prompts.js.map +0 -1
  86. package/dist/chat-sessions.d.ts +0 -25
  87. package/dist/chat-sessions.d.ts.map +0 -1
  88. package/dist/chat-sessions.js +0 -153
  89. package/dist/chat-sessions.js.map +0 -1
  90. package/dist/child-exit.d.ts +0 -3
  91. package/dist/child-exit.d.ts.map +0 -1
  92. package/dist/child-exit.js +0 -17
  93. package/dist/child-exit.js.map +0 -1
  94. package/dist/command-errors.d.ts +0 -8
  95. package/dist/command-errors.d.ts.map +0 -1
  96. package/dist/command-errors.js +0 -49
  97. package/dist/command-errors.js.map +0 -1
  98. package/dist/commands/__tests__/jtbd.test.d.ts +0 -2
  99. package/dist/commands/__tests__/jtbd.test.d.ts.map +0 -1
  100. package/dist/commands/__tests__/jtbd.test.js +0 -120
  101. package/dist/commands/__tests__/jtbd.test.js.map +0 -1
  102. package/dist/commands/__tests__/runtime.test.d.ts +0 -2
  103. package/dist/commands/__tests__/runtime.test.d.ts.map +0 -1
  104. package/dist/commands/__tests__/runtime.test.js +0 -129
  105. package/dist/commands/__tests__/runtime.test.js.map +0 -1
  106. package/dist/commands/__tests__/timeline-render-audio.test.d.ts +0 -2
  107. package/dist/commands/__tests__/timeline-render-audio.test.d.ts.map +0 -1
  108. package/dist/commands/__tests__/timeline-render-audio.test.js +0 -53
  109. package/dist/commands/__tests__/timeline-render-audio.test.js.map +0 -1
  110. package/dist/commands/__tests__/timeline-render-completeness.test.d.ts +0 -2
  111. package/dist/commands/__tests__/timeline-render-completeness.test.d.ts.map +0 -1
  112. package/dist/commands/__tests__/timeline-render-completeness.test.js +0 -117
  113. package/dist/commands/__tests__/timeline-render-completeness.test.js.map +0 -1
  114. package/dist/commands/__tests__/timeline-render.test.d.ts +0 -2
  115. package/dist/commands/__tests__/timeline-render.test.d.ts.map +0 -1
  116. package/dist/commands/__tests__/timeline-render.test.js +0 -115
  117. package/dist/commands/__tests__/timeline-render.test.js.map +0 -1
  118. package/dist/commands/__tests__/timeline-score.test.d.ts +0 -2
  119. package/dist/commands/__tests__/timeline-score.test.d.ts.map +0 -1
  120. package/dist/commands/__tests__/timeline-score.test.js +0 -100
  121. package/dist/commands/__tests__/timeline-score.test.js.map +0 -1
  122. package/dist/commands/affected.d.ts +0 -9
  123. package/dist/commands/affected.d.ts.map +0 -1
  124. package/dist/commands/affected.js +0 -127
  125. package/dist/commands/affected.js.map +0 -1
  126. package/dist/commands/agent.d.ts +0 -33
  127. package/dist/commands/agent.d.ts.map +0 -1
  128. package/dist/commands/agent.js +0 -514
  129. package/dist/commands/agent.js.map +0 -1
  130. package/dist/commands/app.d.ts +0 -3
  131. package/dist/commands/app.d.ts.map +0 -1
  132. package/dist/commands/app.js +0 -406
  133. package/dist/commands/app.js.map +0 -1
  134. package/dist/commands/apps.d.ts +0 -15
  135. package/dist/commands/apps.d.ts.map +0 -1
  136. package/dist/commands/apps.js +0 -274
  137. package/dist/commands/apps.js.map +0 -1
  138. package/dist/commands/auth.d.ts +0 -12
  139. package/dist/commands/auth.d.ts.map +0 -1
  140. package/dist/commands/auth.js +0 -154
  141. package/dist/commands/auth.js.map +0 -1
  142. package/dist/commands/authorized-pack-install.d.ts +0 -7
  143. package/dist/commands/authorized-pack-install.d.ts.map +0 -1
  144. package/dist/commands/authorized-pack-install.js +0 -20
  145. package/dist/commands/authorized-pack-install.js.map +0 -1
  146. package/dist/commands/collections.d.ts +0 -10
  147. package/dist/commands/collections.d.ts.map +0 -1
  148. package/dist/commands/collections.js +0 -257
  149. package/dist/commands/collections.js.map +0 -1
  150. package/dist/commands/costs.d.ts +0 -15
  151. package/dist/commands/costs.d.ts.map +0 -1
  152. package/dist/commands/costs.js +0 -201
  153. package/dist/commands/costs.js.map +0 -1
  154. package/dist/commands/db.d.ts +0 -3
  155. package/dist/commands/db.d.ts.map +0 -1
  156. package/dist/commands/db.js +0 -176
  157. package/dist/commands/db.js.map +0 -1
  158. package/dist/commands/debug-summary-output.d.ts +0 -22
  159. package/dist/commands/debug-summary-output.d.ts.map +0 -1
  160. package/dist/commands/debug-summary-output.js +0 -28
  161. package/dist/commands/debug-summary-output.js.map +0 -1
  162. package/dist/commands/debug.d.ts +0 -13
  163. package/dist/commands/debug.d.ts.map +0 -1
  164. package/dist/commands/debug.js +0 -150
  165. package/dist/commands/debug.js.map +0 -1
  166. package/dist/commands/deploy-helpers.d.ts +0 -85
  167. package/dist/commands/deploy-helpers.d.ts.map +0 -1
  168. package/dist/commands/deploy-helpers.js +0 -217
  169. package/dist/commands/deploy-helpers.js.map +0 -1
  170. package/dist/commands/deploy.d.ts +0 -7
  171. package/dist/commands/deploy.d.ts.map +0 -1
  172. package/dist/commands/deploy.js +0 -449
  173. package/dist/commands/deploy.js.map +0 -1
  174. package/dist/commands/errors.d.ts +0 -11
  175. package/dist/commands/errors.d.ts.map +0 -1
  176. package/dist/commands/errors.js +0 -177
  177. package/dist/commands/errors.js.map +0 -1
  178. package/dist/commands/eval.d.ts +0 -152
  179. package/dist/commands/eval.d.ts.map +0 -1
  180. package/dist/commands/eval.js +0 -693
  181. package/dist/commands/eval.js.map +0 -1
  182. package/dist/commands/extension.d.ts +0 -12
  183. package/dist/commands/extension.d.ts.map +0 -1
  184. package/dist/commands/extension.js +0 -30
  185. package/dist/commands/extension.js.map +0 -1
  186. package/dist/commands/game-benchmark.d.ts +0 -48
  187. package/dist/commands/game-benchmark.d.ts.map +0 -1
  188. package/dist/commands/game-benchmark.js +0 -108
  189. package/dist/commands/game-benchmark.js.map +0 -1
  190. package/dist/commands/game-smoke.d.ts +0 -3
  191. package/dist/commands/game-smoke.d.ts.map +0 -1
  192. package/dist/commands/game-smoke.js +0 -23
  193. package/dist/commands/game-smoke.js.map +0 -1
  194. package/dist/commands/game.d.ts +0 -4
  195. package/dist/commands/game.d.ts.map +0 -1
  196. package/dist/commands/game.js +0 -856
  197. package/dist/commands/game.js.map +0 -1
  198. package/dist/commands/generate.d.ts +0 -17
  199. package/dist/commands/generate.d.ts.map +0 -1
  200. package/dist/commands/generate.js +0 -326
  201. package/dist/commands/generate.js.map +0 -1
  202. package/dist/commands/generations.d.ts +0 -17
  203. package/dist/commands/generations.d.ts.map +0 -1
  204. package/dist/commands/generations.js +0 -408
  205. package/dist/commands/generations.js.map +0 -1
  206. package/dist/commands/harness.d.ts +0 -90
  207. package/dist/commands/harness.d.ts.map +0 -1
  208. package/dist/commands/harness.js +0 -892
  209. package/dist/commands/harness.js.map +0 -1
  210. package/dist/commands/install-missing-packs.d.ts +0 -21
  211. package/dist/commands/install-missing-packs.d.ts.map +0 -1
  212. package/dist/commands/install-missing-packs.js +0 -48
  213. package/dist/commands/install-missing-packs.js.map +0 -1
  214. package/dist/commands/js-script-validation-output.d.ts +0 -7
  215. package/dist/commands/js-script-validation-output.d.ts.map +0 -1
  216. package/dist/commands/js-script-validation-output.js +0 -5
  217. package/dist/commands/js-script-validation-output.js.map +0 -1
  218. package/dist/commands/js-script-versions.d.ts +0 -53
  219. package/dist/commands/js-script-versions.d.ts.map +0 -1
  220. package/dist/commands/js-script-versions.js +0 -89
  221. package/dist/commands/js-script-versions.js.map +0 -1
  222. package/dist/commands/js-script.d.ts +0 -29
  223. package/dist/commands/js-script.d.ts.map +0 -1
  224. package/dist/commands/js-script.js +0 -240
  225. package/dist/commands/js-script.js.map +0 -1
  226. package/dist/commands/jtbd.d.ts +0 -38
  227. package/dist/commands/jtbd.d.ts.map +0 -1
  228. package/dist/commands/jtbd.js +0 -261
  229. package/dist/commands/jtbd.js.map +0 -1
  230. package/dist/commands/local-db.d.ts +0 -16
  231. package/dist/commands/local-db.d.ts.map +0 -1
  232. package/dist/commands/local-db.js +0 -33
  233. package/dist/commands/local-db.js.map +0 -1
  234. package/dist/commands/mcp.d.ts +0 -21
  235. package/dist/commands/mcp.d.ts.map +0 -1
  236. package/dist/commands/mcp.js +0 -166
  237. package/dist/commands/mcp.js.map +0 -1
  238. package/dist/commands/migrate-code-inputs.d.ts +0 -24
  239. package/dist/commands/migrate-code-inputs.d.ts.map +0 -1
  240. package/dist/commands/migrate-code-inputs.js +0 -120
  241. package/dist/commands/migrate-code-inputs.js.map +0 -1
  242. package/dist/commands/models-hf.d.ts +0 -9
  243. package/dist/commands/models-hf.d.ts.map +0 -1
  244. package/dist/commands/models-hf.js +0 -235
  245. package/dist/commands/models-hf.js.map +0 -1
  246. package/dist/commands/models-recommended.d.ts +0 -10
  247. package/dist/commands/models-recommended.d.ts.map +0 -1
  248. package/dist/commands/models-recommended.js +0 -120
  249. package/dist/commands/models-recommended.js.map +0 -1
  250. package/dist/commands/node.d.ts +0 -10
  251. package/dist/commands/node.d.ts.map +0 -1
  252. package/dist/commands/node.js +0 -130
  253. package/dist/commands/node.js.map +0 -1
  254. package/dist/commands/output.d.ts +0 -32
  255. package/dist/commands/output.d.ts.map +0 -1
  256. package/dist/commands/output.js +0 -150
  257. package/dist/commands/output.js.map +0 -1
  258. package/dist/commands/pack-install-authorization.d.ts +0 -40
  259. package/dist/commands/pack-install-authorization.d.ts.map +0 -1
  260. package/dist/commands/pack-install-authorization.js +0 -131
  261. package/dist/commands/pack-install-authorization.js.map +0 -1
  262. package/dist/commands/pack-management.d.ts +0 -26
  263. package/dist/commands/pack-management.d.ts.map +0 -1
  264. package/dist/commands/pack-management.js +0 -74
  265. package/dist/commands/pack-management.js.map +0 -1
  266. package/dist/commands/package-helpers.d.ts +0 -8
  267. package/dist/commands/package-helpers.d.ts.map +0 -1
  268. package/dist/commands/package-helpers.js +0 -53
  269. package/dist/commands/package-helpers.js.map +0 -1
  270. package/dist/commands/package.d.ts +0 -3
  271. package/dist/commands/package.d.ts.map +0 -1
  272. package/dist/commands/package.js +0 -258
  273. package/dist/commands/package.js.map +0 -1
  274. package/dist/commands/packs.d.ts +0 -14
  275. package/dist/commands/packs.d.ts.map +0 -1
  276. package/dist/commands/packs.js +0 -65
  277. package/dist/commands/packs.js.map +0 -1
  278. package/dist/commands/projects.d.ts +0 -11
  279. package/dist/commands/projects.d.ts.map +0 -1
  280. package/dist/commands/projects.js +0 -145
  281. package/dist/commands/projects.js.map +0 -1
  282. package/dist/commands/reliability.d.ts +0 -14
  283. package/dist/commands/reliability.d.ts.map +0 -1
  284. package/dist/commands/reliability.js +0 -81
  285. package/dist/commands/reliability.js.map +0 -1
  286. package/dist/commands/resource-read.d.ts +0 -28
  287. package/dist/commands/resource-read.d.ts.map +0 -1
  288. package/dist/commands/resource-read.js +0 -314
  289. package/dist/commands/resource-read.js.map +0 -1
  290. package/dist/commands/runs.d.ts +0 -7
  291. package/dist/commands/runs.d.ts.map +0 -1
  292. package/dist/commands/runs.js +0 -302
  293. package/dist/commands/runs.js.map +0 -1
  294. package/dist/commands/runtime.d.ts +0 -3
  295. package/dist/commands/runtime.d.ts.map +0 -1
  296. package/dist/commands/runtime.js +0 -169
  297. package/dist/commands/runtime.js.map +0 -1
  298. package/dist/commands/sketch-render.d.ts +0 -46
  299. package/dist/commands/sketch-render.d.ts.map +0 -1
  300. package/dist/commands/sketch-render.js +0 -131
  301. package/dist/commands/sketch-render.js.map +0 -1
  302. package/dist/commands/sketch-validation-output.d.ts +0 -7
  303. package/dist/commands/sketch-validation-output.d.ts.map +0 -1
  304. package/dist/commands/sketch-validation-output.js +0 -5
  305. package/dist/commands/sketch-validation-output.js.map +0 -1
  306. package/dist/commands/sketch-versions.d.ts +0 -66
  307. package/dist/commands/sketch-versions.d.ts.map +0 -1
  308. package/dist/commands/sketch-versions.js +0 -108
  309. package/dist/commands/sketch-versions.js.map +0 -1
  310. package/dist/commands/sketch.d.ts +0 -22
  311. package/dist/commands/sketch.d.ts.map +0 -1
  312. package/dist/commands/sketch.js +0 -101
  313. package/dist/commands/sketch.js.map +0 -1
  314. package/dist/commands/storage.d.ts +0 -24
  315. package/dist/commands/storage.d.ts.map +0 -1
  316. package/dist/commands/storage.js +0 -112
  317. package/dist/commands/storage.js.map +0 -1
  318. package/dist/commands/telegram.d.ts +0 -11
  319. package/dist/commands/telegram.d.ts.map +0 -1
  320. package/dist/commands/telegram.js +0 -66
  321. package/dist/commands/telegram.js.map +0 -1
  322. package/dist/commands/telemetry.d.ts +0 -24
  323. package/dist/commands/telemetry.d.ts.map +0 -1
  324. package/dist/commands/telemetry.js +0 -116
  325. package/dist/commands/telemetry.js.map +0 -1
  326. package/dist/commands/timeline-render.d.ts +0 -75
  327. package/dist/commands/timeline-render.d.ts.map +0 -1
  328. package/dist/commands/timeline-render.js +0 -465
  329. package/dist/commands/timeline-render.js.map +0 -1
  330. package/dist/commands/timeline-score.d.ts +0 -16
  331. package/dist/commands/timeline-score.d.ts.map +0 -1
  332. package/dist/commands/timeline-score.js +0 -89
  333. package/dist/commands/timeline-score.js.map +0 -1
  334. package/dist/commands/timeline-validation-output.d.ts +0 -7
  335. package/dist/commands/timeline-validation-output.d.ts.map +0 -1
  336. package/dist/commands/timeline-validation-output.js +0 -9
  337. package/dist/commands/timeline-validation-output.js.map +0 -1
  338. package/dist/commands/timeline-versions.d.ts +0 -72
  339. package/dist/commands/timeline-versions.d.ts.map +0 -1
  340. package/dist/commands/timeline-versions.js +0 -108
  341. package/dist/commands/timeline-versions.js.map +0 -1
  342. package/dist/commands/timeline.d.ts +0 -22
  343. package/dist/commands/timeline.d.ts.map +0 -1
  344. package/dist/commands/timeline.js +0 -103
  345. package/dist/commands/timeline.js.map +0 -1
  346. package/dist/commands/tools.d.ts +0 -11
  347. package/dist/commands/tools.d.ts.map +0 -1
  348. package/dist/commands/tools.js +0 -206
  349. package/dist/commands/tools.js.map +0 -1
  350. package/dist/commands/validate.d.ts +0 -24
  351. package/dist/commands/validate.d.ts.map +0 -1
  352. package/dist/commands/validate.js +0 -132
  353. package/dist/commands/validate.js.map +0 -1
  354. package/dist/commands/validation-output.d.ts +0 -25
  355. package/dist/commands/validation-output.d.ts.map +0 -1
  356. package/dist/commands/validation-output.js +0 -29
  357. package/dist/commands/validation-output.js.map +0 -1
  358. package/dist/commands/version-commands.d.ts +0 -91
  359. package/dist/commands/version-commands.d.ts.map +0 -1
  360. package/dist/commands/version-commands.js +0 -222
  361. package/dist/commands/version-commands.js.map +0 -1
  362. package/dist/commands/worker-models.d.ts +0 -13
  363. package/dist/commands/worker-models.d.ts.map +0 -1
  364. package/dist/commands/worker-models.js +0 -207
  365. package/dist/commands/worker-models.js.map +0 -1
  366. package/dist/commands/worker.d.ts +0 -23
  367. package/dist/commands/worker.d.ts.map +0 -1
  368. package/dist/commands/worker.js +0 -374
  369. package/dist/commands/worker.js.map +0 -1
  370. package/dist/debug/browser-runner.d.ts +0 -21
  371. package/dist/debug/browser-runner.d.ts.map +0 -1
  372. package/dist/debug/browser-runner.js +0 -196
  373. package/dist/debug/browser-runner.js.map +0 -1
  374. package/dist/debug/collector.d.ts +0 -9
  375. package/dist/debug/collector.d.ts.map +0 -1
  376. package/dist/debug/collector.js +0 -9
  377. package/dist/debug/collector.js.map +0 -1
  378. package/dist/debug/diff.d.ts +0 -48
  379. package/dist/debug/diff.d.ts.map +0 -1
  380. package/dist/debug/diff.js +0 -68
  381. package/dist/debug/diff.js.map +0 -1
  382. package/dist/debug/harness.d.ts +0 -11
  383. package/dist/debug/harness.d.ts.map +0 -1
  384. package/dist/debug/harness.js +0 -103
  385. package/dist/debug/harness.js.map +0 -1
  386. package/dist/debug/index.d.ts +0 -17
  387. package/dist/debug/index.d.ts.map +0 -1
  388. package/dist/debug/index.js +0 -16
  389. package/dist/debug/index.js.map +0 -1
  390. package/dist/debug/markdown.d.ts +0 -3
  391. package/dist/debug/markdown.d.ts.map +0 -1
  392. package/dist/debug/markdown.js +0 -127
  393. package/dist/debug/markdown.js.map +0 -1
  394. package/dist/debug/server-runner.d.ts +0 -24
  395. package/dist/debug/server-runner.d.ts.map +0 -1
  396. package/dist/debug/server-runner.js +0 -211
  397. package/dist/debug/server-runner.js.map +0 -1
  398. package/dist/debug/target.d.ts +0 -34
  399. package/dist/debug/target.d.ts.map +0 -1
  400. package/dist/debug/target.js +0 -95
  401. package/dist/debug/target.js.map +0 -1
  402. package/dist/debug/trace.d.ts +0 -30
  403. package/dist/debug/trace.d.ts.map +0 -1
  404. package/dist/debug/trace.js +0 -87
  405. package/dist/debug/trace.js.map +0 -1
  406. package/dist/debug/types.d.ts +0 -82
  407. package/dist/debug/types.d.ts.map +0 -1
  408. package/dist/debug/types.js +0 -13
  409. package/dist/debug/types.js.map +0 -1
  410. package/dist/debug/verdict.d.ts +0 -3
  411. package/dist/debug/verdict.d.ts.map +0 -1
  412. package/dist/debug/verdict.js +0 -78
  413. package/dist/debug/verdict.js.map +0 -1
  414. package/dist/debug/watch.d.ts +0 -23
  415. package/dist/debug/watch.d.ts.map +0 -1
  416. package/dist/debug/watch.js +0 -68
  417. package/dist/debug/watch.js.map +0 -1
  418. package/dist/debug-bundle.d.ts +0 -12
  419. package/dist/debug-bundle.d.ts.map +0 -1
  420. package/dist/debug-bundle.js +0 -23
  421. package/dist/debug-bundle.js.map +0 -1
  422. package/dist/diagnose.d.ts +0 -139
  423. package/dist/diagnose.d.ts.map +0 -1
  424. package/dist/diagnose.js +0 -418
  425. package/dist/diagnose.js.map +0 -1
  426. package/dist/document-json.d.ts +0 -11
  427. package/dist/document-json.d.ts.map +0 -1
  428. package/dist/document-json.js +0 -27
  429. package/dist/document-json.js.map +0 -1
  430. package/dist/evals/graph-runner.d.ts +0 -8
  431. package/dist/evals/graph-runner.d.ts.map +0 -1
  432. package/dist/evals/graph-runner.js +0 -136
  433. package/dist/evals/graph-runner.js.map +0 -1
  434. package/dist/harness/capability-coverage.d.ts +0 -163
  435. package/dist/harness/capability-coverage.d.ts.map +0 -1
  436. package/dist/harness/capability-coverage.js +0 -295
  437. package/dist/harness/capability-coverage.js.map +0 -1
  438. package/dist/harness/capability-table.d.ts +0 -17
  439. package/dist/harness/capability-table.d.ts.map +0 -1
  440. package/dist/harness/capability-table.js +0 -3925
  441. package/dist/harness/capability-table.js.map +0 -1
  442. package/dist/harness/changed-files.d.ts +0 -20
  443. package/dist/harness/changed-files.d.ts.map +0 -1
  444. package/dist/harness/changed-files.js +0 -90
  445. package/dist/harness/changed-files.js.map +0 -1
  446. package/dist/harness/declared-capabilities.d.ts +0 -12
  447. package/dist/harness/declared-capabilities.d.ts.map +0 -1
  448. package/dist/harness/declared-capabilities.js +0 -21
  449. package/dist/harness/declared-capabilities.js.map +0 -1
  450. package/dist/harness/registry.d.ts +0 -190
  451. package/dist/harness/registry.d.ts.map +0 -1
  452. package/dist/harness/registry.js +0 -2341
  453. package/dist/harness/registry.js.map +0 -1
  454. package/dist/install-lock.d.ts +0 -12
  455. package/dist/install-lock.d.ts.map +0 -1
  456. package/dist/install-lock.js +0 -139
  457. package/dist/install-lock.js.map +0 -1
  458. package/dist/interaction-script.d.ts +0 -40
  459. package/dist/interaction-script.d.ts.map +0 -1
  460. package/dist/interaction-script.js +0 -104
  461. package/dist/interaction-script.js.map +0 -1
  462. package/dist/js-script-debug/harness.d.ts +0 -146
  463. package/dist/js-script-debug/harness.d.ts.map +0 -1
  464. package/dist/js-script-debug/harness.js +0 -220
  465. package/dist/js-script-debug/harness.js.map +0 -1
  466. package/dist/js-script-debug/index.d.ts +0 -9
  467. package/dist/js-script-debug/index.d.ts.map +0 -1
  468. package/dist/js-script-debug/index.js +0 -9
  469. package/dist/js-script-debug/index.js.map +0 -1
  470. package/dist/js-script-debug/interactions.d.ts +0 -19
  471. package/dist/js-script-debug/interactions.d.ts.map +0 -1
  472. package/dist/js-script-debug/interactions.js +0 -17
  473. package/dist/js-script-debug/interactions.js.map +0 -1
  474. package/dist/js-script-debug/target.d.ts +0 -20
  475. package/dist/js-script-debug/target.d.ts.map +0 -1
  476. package/dist/js-script-debug/target.js +0 -55
  477. package/dist/js-script-debug/target.js.map +0 -1
  478. package/dist/local-model-interfaces.d.ts +0 -20
  479. package/dist/local-model-interfaces.d.ts.map +0 -1
  480. package/dist/local-model-interfaces.js +0 -41
  481. package/dist/local-model-interfaces.js.map +0 -1
  482. package/dist/local-secrets.d.ts +0 -3
  483. package/dist/local-secrets.d.ts.map +0 -1
  484. package/dist/local-secrets.js +0 -16
  485. package/dist/local-secrets.js.map +0 -1
  486. package/dist/markdown.d.ts +0 -9
  487. package/dist/markdown.d.ts.map +0 -1
  488. package/dist/markdown.js +0 -53
  489. package/dist/markdown.js.map +0 -1
  490. package/dist/node/run-node.d.ts +0 -31
  491. package/dist/node/run-node.d.ts.map +0 -1
  492. package/dist/node/run-node.js +0 -92
  493. package/dist/node/run-node.js.map +0 -1
  494. package/dist/node-registry.d.ts +0 -29
  495. package/dist/node-registry.d.ts.map +0 -1
  496. package/dist/node-registry.js +0 -38
  497. package/dist/node-registry.js.map +0 -1
  498. package/dist/nodetool-main.d.ts +0 -15
  499. package/dist/nodetool-main.d.ts.map +0 -1
  500. package/dist/nodetool-main.js +0 -1456
  501. package/dist/nodetool-main.js.map +0 -1
  502. package/dist/npm-runner.d.ts +0 -23
  503. package/dist/npm-runner.d.ts.map +0 -1
  504. package/dist/npm-runner.js +0 -160
  505. package/dist/npm-runner.js.map +0 -1
  506. package/dist/numeric-options.d.ts +0 -22
  507. package/dist/numeric-options.d.ts.map +0 -1
  508. package/dist/numeric-options.js +0 -45
  509. package/dist/numeric-options.js.map +0 -1
  510. package/dist/optional-node-root.d.ts +0 -10
  511. package/dist/optional-node-root.d.ts.map +0 -1
  512. package/dist/optional-node-root.js +0 -26
  513. package/dist/optional-node-root.js.map +0 -1
  514. package/dist/package-assets.d.ts +0 -8
  515. package/dist/package-assets.d.ts.map +0 -1
  516. package/dist/package-assets.js +0 -21
  517. package/dist/package-assets.js.map +0 -1
  518. package/dist/packs/command-service.d.ts +0 -14
  519. package/dist/packs/command-service.d.ts.map +0 -1
  520. package/dist/packs/command-service.js +0 -195
  521. package/dist/packs/command-service.js.map +0 -1
  522. package/dist/packs/doctor-lock.d.ts +0 -8
  523. package/dist/packs/doctor-lock.d.ts.map +0 -1
  524. package/dist/packs/doctor-lock.js +0 -50
  525. package/dist/packs/doctor-lock.js.map +0 -1
  526. package/dist/packs/doctor.d.ts +0 -25
  527. package/dist/packs/doctor.d.ts.map +0 -1
  528. package/dist/packs/doctor.js +0 -12
  529. package/dist/packs/doctor.js.map +0 -1
  530. package/dist/packs/global-bootstrap.d.ts +0 -11
  531. package/dist/packs/global-bootstrap.d.ts.map +0 -1
  532. package/dist/packs/global-bootstrap.js +0 -72
  533. package/dist/packs/global-bootstrap.js.map +0 -1
  534. package/dist/packs/host.d.ts +0 -17
  535. package/dist/packs/host.d.ts.map +0 -1
  536. package/dist/packs/host.js +0 -79
  537. package/dist/packs/host.js.map +0 -1
  538. package/dist/packs/install-manifests.d.ts +0 -2
  539. package/dist/packs/install-manifests.d.ts.map +0 -1
  540. package/dist/packs/install-manifests.js +0 -30
  541. package/dist/packs/install-manifests.js.map +0 -1
  542. package/dist/packs/install-process.d.ts +0 -4
  543. package/dist/packs/install-process.d.ts.map +0 -1
  544. package/dist/packs/install-process.js +0 -11
  545. package/dist/packs/install-process.js.map +0 -1
  546. package/dist/packs/install-selection.d.ts +0 -39
  547. package/dist/packs/install-selection.d.ts.map +0 -1
  548. package/dist/packs/install-selection.js +0 -67
  549. package/dist/packs/install-selection.js.map +0 -1
  550. package/dist/packs/install-state.d.ts +0 -21
  551. package/dist/packs/install-state.d.ts.map +0 -1
  552. package/dist/packs/install-state.js +0 -44
  553. package/dist/packs/install-state.js.map +0 -1
  554. package/dist/packs/install-tree.d.ts +0 -35
  555. package/dist/packs/install-tree.d.ts.map +0 -1
  556. package/dist/packs/install-tree.js +0 -253
  557. package/dist/packs/install-tree.js.map +0 -1
  558. package/dist/packs/install-verification.d.ts +0 -12
  559. package/dist/packs/install-verification.d.ts.map +0 -1
  560. package/dist/packs/install-verification.js +0 -76
  561. package/dist/packs/install-verification.js.map +0 -1
  562. package/dist/packs/installed.d.ts +0 -36
  563. package/dist/packs/installed.d.ts.map +0 -1
  564. package/dist/packs/installed.js +0 -87
  565. package/dist/packs/installed.js.map +0 -1
  566. package/dist/packs/installer-load-check.d.ts +0 -4
  567. package/dist/packs/installer-load-check.d.ts.map +0 -1
  568. package/dist/packs/installer-load-check.js +0 -52
  569. package/dist/packs/installer-load-check.js.map +0 -1
  570. package/dist/packs/installer.d.ts +0 -16
  571. package/dist/packs/installer.d.ts.map +0 -1
  572. package/dist/packs/installer.js +0 -142
  573. package/dist/packs/installer.js.map +0 -1
  574. package/dist/packs/management.d.ts +0 -51
  575. package/dist/packs/management.d.ts.map +0 -1
  576. package/dist/packs/management.js +0 -81
  577. package/dist/packs/management.js.map +0 -1
  578. package/dist/packs/mode.d.ts +0 -42
  579. package/dist/packs/mode.d.ts.map +0 -1
  580. package/dist/packs/mode.js +0 -215
  581. package/dist/packs/mode.js.map +0 -1
  582. package/dist/packs/owned-replay-plan.d.ts +0 -5
  583. package/dist/packs/owned-replay-plan.d.ts.map +0 -1
  584. package/dist/packs/owned-replay-plan.js +0 -68
  585. package/dist/packs/owned-replay-plan.js.map +0 -1
  586. package/dist/packs/removal-selection.d.ts +0 -12
  587. package/dist/packs/removal-selection.d.ts.map +0 -1
  588. package/dist/packs/removal-selection.js +0 -169
  589. package/dist/packs/removal-selection.js.map +0 -1
  590. package/dist/packs/removal.d.ts +0 -12
  591. package/dist/packs/removal.d.ts.map +0 -1
  592. package/dist/packs/removal.js +0 -138
  593. package/dist/packs/removal.js.map +0 -1
  594. package/dist/packs/repair.d.ts +0 -2
  595. package/dist/packs/repair.d.ts.map +0 -1
  596. package/dist/packs/repair.js +0 -2
  597. package/dist/packs/repair.js.map +0 -1
  598. package/dist/packs/serve.d.ts +0 -2
  599. package/dist/packs/serve.d.ts.map +0 -1
  600. package/dist/packs/serve.js +0 -14
  601. package/dist/packs/serve.js.map +0 -1
  602. package/dist/permission-gate.d.ts +0 -55
  603. package/dist/permission-gate.d.ts.map +0 -1
  604. package/dist/permission-gate.js +0 -118
  605. package/dist/permission-gate.js.map +0 -1
  606. package/dist/predicates.d.ts +0 -6
  607. package/dist/predicates.d.ts.map +0 -1
  608. package/dist/predicates.js +0 -6
  609. package/dist/predicates.js.map +0 -1
  610. package/dist/providers.d.ts +0 -117
  611. package/dist/providers.d.ts.map +0 -1
  612. package/dist/providers.js +0 -491
  613. package/dist/providers.js.map +0 -1
  614. package/dist/readline-input.d.ts +0 -23
  615. package/dist/readline-input.d.ts.map +0 -1
  616. package/dist/readline-input.js +0 -210
  617. package/dist/readline-input.js.map +0 -1
  618. package/dist/run-budget.d.ts +0 -40
  619. package/dist/run-budget.d.ts.map +0 -1
  620. package/dist/run-budget.js +0 -119
  621. package/dist/run-budget.js.map +0 -1
  622. package/dist/run-dsl-supervised.d.ts +0 -11
  623. package/dist/run-dsl-supervised.d.ts.map +0 -1
  624. package/dist/run-dsl-supervised.js +0 -89
  625. package/dist/run-dsl-supervised.js.map +0 -1
  626. package/dist/run-dsl.d.ts +0 -40
  627. package/dist/run-dsl.d.ts.map +0 -1
  628. package/dist/run-dsl.js +0 -65
  629. package/dist/run-dsl.js.map +0 -1
  630. package/dist/run-json.d.ts +0 -24
  631. package/dist/run-json.d.ts.map +0 -1
  632. package/dist/run-json.js +0 -132
  633. package/dist/run-json.js.map +0 -1
  634. package/dist/runtime-env.d.ts +0 -4
  635. package/dist/runtime-env.d.ts.map +0 -1
  636. package/dist/runtime-env.js +0 -31
  637. package/dist/runtime-env.js.map +0 -1
  638. package/dist/sandbox-catalog.d.ts +0 -26
  639. package/dist/sandbox-catalog.d.ts.map +0 -1
  640. package/dist/sandbox-catalog.js +0 -83
  641. package/dist/sandbox-catalog.js.map +0 -1
  642. package/dist/settings.d.ts +0 -19
  643. package/dist/settings.d.ts.map +0 -1
  644. package/dist/settings.js +0 -146
  645. package/dist/settings.js.map +0 -1
  646. package/dist/sketch-debug/harness.d.ts +0 -101
  647. package/dist/sketch-debug/harness.d.ts.map +0 -1
  648. package/dist/sketch-debug/harness.js +0 -118
  649. package/dist/sketch-debug/harness.js.map +0 -1
  650. package/dist/sketch-debug/index.d.ts +0 -9
  651. package/dist/sketch-debug/index.d.ts.map +0 -1
  652. package/dist/sketch-debug/index.js +0 -9
  653. package/dist/sketch-debug/index.js.map +0 -1
  654. package/dist/sketch-debug/interactions.d.ts +0 -19
  655. package/dist/sketch-debug/interactions.d.ts.map +0 -1
  656. package/dist/sketch-debug/interactions.js +0 -17
  657. package/dist/sketch-debug/interactions.js.map +0 -1
  658. package/dist/sketch-debug/target.d.ts +0 -48
  659. package/dist/sketch-debug/target.d.ts.map +0 -1
  660. package/dist/sketch-debug/target.js +0 -115
  661. package/dist/sketch-debug/target.js.map +0 -1
  662. package/dist/stdin.d.ts +0 -52
  663. package/dist/stdin.d.ts.map +0 -1
  664. package/dist/stdin.js +0 -363
  665. package/dist/stdin.js.map +0 -1
  666. package/dist/supervisor.d.ts +0 -97
  667. package/dist/supervisor.d.ts.map +0 -1
  668. package/dist/supervisor.js +0 -194
  669. package/dist/supervisor.js.map +0 -1
  670. package/dist/telemetry.d.ts +0 -38
  671. package/dist/telemetry.d.ts.map +0 -1
  672. package/dist/telemetry.js +0 -158
  673. package/dist/telemetry.js.map +0 -1
  674. package/dist/terminal-clipboard.d.ts +0 -3
  675. package/dist/terminal-clipboard.d.ts.map +0 -1
  676. package/dist/terminal-clipboard.js +0 -24
  677. package/dist/terminal-clipboard.js.map +0 -1
  678. package/dist/terminal-mouse.d.ts +0 -24
  679. package/dist/terminal-mouse.d.ts.map +0 -1
  680. package/dist/terminal-mouse.js +0 -84
  681. package/dist/terminal-mouse.js.map +0 -1
  682. package/dist/terminal-screen.d.ts +0 -41
  683. package/dist/terminal-screen.d.ts.map +0 -1
  684. package/dist/terminal-screen.js +0 -228
  685. package/dist/terminal-screen.js.map +0 -1
  686. package/dist/timeline-debug/harness.d.ts +0 -93
  687. package/dist/timeline-debug/harness.d.ts.map +0 -1
  688. package/dist/timeline-debug/harness.js +0 -100
  689. package/dist/timeline-debug/harness.js.map +0 -1
  690. package/dist/timeline-debug/index.d.ts +0 -9
  691. package/dist/timeline-debug/index.d.ts.map +0 -1
  692. package/dist/timeline-debug/index.js +0 -9
  693. package/dist/timeline-debug/index.js.map +0 -1
  694. package/dist/timeline-debug/interactions.d.ts +0 -19
  695. package/dist/timeline-debug/interactions.d.ts.map +0 -1
  696. package/dist/timeline-debug/interactions.js +0 -17
  697. package/dist/timeline-debug/interactions.js.map +0 -1
  698. package/dist/timeline-debug/target.d.ts +0 -34
  699. package/dist/timeline-debug/target.d.ts.map +0 -1
  700. package/dist/timeline-debug/target.js +0 -109
  701. package/dist/timeline-debug/target.js.map +0 -1
  702. package/dist/tool-format.d.ts +0 -54
  703. package/dist/tool-format.d.ts.map +0 -1
  704. package/dist/tool-format.js +0 -360
  705. package/dist/tool-format.js.map +0 -1
  706. package/dist/useExecutionState.d.ts +0 -44
  707. package/dist/useExecutionState.d.ts.map +0 -1
  708. package/dist/useExecutionState.js +0 -285
  709. package/dist/useExecutionState.js.map +0 -1
  710. package/dist/validate/index.d.ts +0 -29
  711. package/dist/validate/index.d.ts.map +0 -1
  712. package/dist/validate/index.js +0 -79
  713. package/dist/validate/index.js.map +0 -1
  714. package/dist/websocket-client.d.ts +0 -163
  715. package/dist/websocket-client.d.ts.map +0 -1
  716. package/dist/websocket-client.js +0 -677
  717. package/dist/websocket-client.js.map +0 -1
  718. package/dist/workflow-file.d.ts +0 -3
  719. package/dist/workflow-file.d.ts.map +0 -1
  720. package/dist/workflow-file.js +0 -176
  721. package/dist/workflow-file.js.map +0 -1
@@ -1,1456 +0,0 @@
1
- /**
2
- * nodetool — Top-level CLI mirroring the Python nodetool CLI.
3
- *
4
- * Usage:
5
- * nodetool info # system/env info
6
- * nodetool serve [--host] [--port] # start TS server
7
- * nodetool chat [--url] [--provider] # interactive chat
8
- * nodetool workflows list/get/run
9
- * nodetool jobs list/get
10
- * nodetool assets list/get
11
- * nodetool secrets list/store <key>
12
- * nodetool settings show
13
- */
14
- import { program } from "commander";
15
- import { createRequire } from "node:module";
16
- import { fileURLToPath } from "node:url";
17
- import { dirname, resolve } from "node:path";
18
- import { spawnSync } from "node:child_process";
19
- import { workflowToDsl, workflowToScript } from "@nodetool-ai/dsl";
20
- import { initDb, migrateSqliteDb, Workflow, Asset, Secret, getSecret } from "@nodetool-ai/models";
21
- import { readCachedHfModels, searchCachedHfModels } from "@nodetool-ai/huggingface";
22
- import { initMasterKey } from "@nodetool-ai/security";
23
- import { installLocalModelInterfaces } from "./local-model-interfaces.js";
24
- import { getDefaultDbPath, getDefaultAssetsPath } from "@nodetool-ai/config";
25
- import { ExecutionSession } from "@nodetool-ai/execution";
26
- import { NodeRegistry, createGraphNodeTypeResolver } from "@nodetool-ai/node-sdk";
27
- import { registerCliPacks } from "./packs/host.js";
28
- import { refusePackInstallsInProcess } from "./packs/install-process.js";
29
- import { CLI_LOCAL_BUILTIN_PACK_POLICY, CLI_DSL_BUILTIN_PACK_POLICY } from "./node-registry.js";
30
- import { ProcessingContext, createLocalWorkspace, initTelemetry, onPythonBridgeCreated } from "@nodetool-ai/runtime";
31
- import { FileStorageAdapter } from "@nodetool-ai/storage";
32
- import { mkdirSync } from "node:fs";
33
- import { addSupervisorOptions, createSupervisorHandle, parseSupervisorFlags, printSupervisedSummary, recordSupervisorCost, streamInterventionLines } from "./supervisor.js";
34
- import { registerPackageCommands } from "./commands/package.js";
35
- import { registerPackCommands } from "./commands/packs.js";
36
- import { installMissingPacksAndReexec } from "./commands/install-missing-packs.js";
37
- import { registerRuntimeCommands } from "./commands/runtime.js";
38
- import { registerDeployCommands } from "./commands/deploy.js";
39
- import { registerHfCommands } from "./commands/models-hf.js";
40
- import { registerWorkerCommands } from "./commands/worker.js";
41
- import { installWorkerActivityHeartbeat } from "@nodetool-ai/compute";
42
- import { registerRecommendedCommand } from "./commands/models-recommended.js";
43
- import { registerAgentCommands } from "./commands/agent.js";
44
- import { registerDbCommands } from "./commands/db.js";
45
- import { registerDebugCommands } from "./commands/debug.js";
46
- import { registerAppCommands } from "./commands/app.js";
47
- import { registerAppsCommands } from "./commands/apps.js";
48
- import { registerValidateCommand } from "./commands/validate.js";
49
- import { registerTimelineCommands } from "./commands/timeline.js";
50
- import { registerSketchCommands } from "./commands/sketch.js";
51
- import { registerJsScriptCommands } from "./commands/js-script.js";
52
- import { registerReliabilityCommands } from "./commands/reliability.js";
53
- import { registerNodeCommands } from "./commands/node.js";
54
- import { registerGenerateCommand } from "./commands/generate.js";
55
- import { registerExtensionCommands } from "./commands/extension.js";
56
- import { registerEvalCommand } from "./commands/eval.js";
57
- import { registerJtbdCommand } from "./commands/jtbd.js";
58
- import { registerAffectedCommand } from "./commands/affected.js";
59
- import { registerMcpClientCommands } from "./commands/mcp.js";
60
- import { registerHarnessCommands } from "./commands/harness.js";
61
- import { registerCollectionCommands } from "./commands/collections.js";
62
- import { registerCostsCommands } from "./commands/costs.js";
63
- import { registerErrorsCommands } from "./commands/errors.js";
64
- import { registerGenerationsCommands } from "./commands/generations.js";
65
- import { registerRunsCommands } from "./commands/runs.js";
66
- import { registerProjectCommands } from "./commands/projects.js";
67
- import { registerGameCommands } from "./commands/game.js";
68
- import { registerAuthCommands } from "./commands/auth.js";
69
- import { registerTelegramCommands } from "./commands/telegram.js";
70
- import { registerAuthoringCommands } from "./commands/tools.js";
71
- import { registerTelemetryCommands } from "./commands/telemetry.js";
72
- import { finishCliTelemetry, startCliTelemetry, trackCliEvent } from "./telemetry.js";
73
- import { bucketDuration, bucketNodeCount, categorizeError } from "@nodetool-ai/analytics";
74
- import { registerResourceReadCommands } from "./commands/resource-read.js";
75
- import { createApiClient } from "./api-client.js";
76
- import { listAllModels, closePythonProviders, listConfiguredProviderInfo, listOllamaModels, listProviderModels } from "./providers.js";
77
- import { isString } from "./predicates.js";
78
- import { printTable, asJson, readSecretValue } from "./commands/output.js";
79
- import { printCommandError, commandMissingRuntime, commandMissingPack } from "./command-errors.js";
80
- import { childExitCode } from "./child-exit.js";
81
- const __filename = fileURLToPath(import.meta.url);
82
- const __dirname = dirname(__filename);
83
- /**
84
- * The CLI's own version, read from its package.json rather than repeated here.
85
- * A literal drifts silently: it sat at "0.1.0" across every 0.7.0-rc release,
86
- * so `nodetool --version` told users nothing about what they had installed.
87
- */
88
- const CLI_VERSION = createRequire(import.meta.url)("../package.json").version;
89
- // ---------------------------------------------------------------------------
90
- // DB setup (for secrets commands)
91
- // ---------------------------------------------------------------------------
92
- // The local single-user id every direct-DB command runs as, matching the
93
- // `workflows run` / `secrets` commands and the stdio MCP server.
94
- import { resolveLocalSecret } from "./local-secrets.js";
95
- const LOCAL_USER_ID = "1";
96
- // Open the local SQLite database for a read-only command. Unlike setupDb() this
97
- // skips master-key unlocking (no secret decryption needed to list/read rows),
98
- // so it never emits a keychain warning. Idempotent — initDb() is a no-op once
99
- // a connection is open.
100
- function ensureDb() {
101
- initDb(getDefaultDbPath());
102
- }
103
- async function setupDb() {
104
- const dbPath = getDefaultDbPath();
105
- await migrateSqliteDb(dbPath);
106
- initDb(dbPath);
107
- // Resolve the master encryption key from keychain / env / AWS so that
108
- // both encryption (Secret.upsert) and decryption (Secret.getDecryptedValue)
109
- // use the same persistent key. Without this, a fresh process would
110
- // auto-generate a one-shot key inside `getMasterKey()`, encrypt with it,
111
- // then lose it on exit — and the next launch could not decrypt.
112
- try {
113
- await initMasterKey();
114
- }
115
- catch (err) {
116
- const msg = err instanceof Error ? err.message : String(err);
117
- process.stderr.write(`Could not unlock the secret store: ${msg}\n` +
118
- `Tip: set SECRETS_MASTER_KEY or grant keychain access.\n`);
119
- }
120
- }
121
- // ---------------------------------------------------------------------------
122
- // API clients
123
- // ---------------------------------------------------------------------------
124
- // REST GET (text) — used for the DSL export endpoint which stays REST
125
- // because it returns a TypeScript source string rather than JSON.
126
- async function apiGetText(apiUrl, path) {
127
- const res = await fetch(`${apiUrl}${path}`);
128
- if (!res.ok)
129
- throw new Error(`HTTP ${res.status}: ${await res.text()}`);
130
- return res.text();
131
- }
132
- // This CLI's package version, stamped into exported bundle manifests.
133
- function cliVersion() {
134
- try {
135
- const req = createRequire(import.meta.url);
136
- return req("../package.json").version;
137
- }
138
- catch {
139
- // Version is best-effort metadata; omit it if the file can't be read.
140
- return undefined;
141
- }
142
- }
143
- // Download asset bytes from a running server, used by the export commands to
144
- // resolve `asset://` / `/api/storage/` (and optionally http) refs into bytes.
145
- function makeAssetFetcher(apiUrl) {
146
- return async (ref) => {
147
- let url = null;
148
- if (ref.startsWith("asset://")) {
149
- const id = ref.slice("asset://".length);
150
- const bareId = id.replace(/\.[^.]+$/, "");
151
- try {
152
- const meta = await fetch(`${apiUrl}/api/assets/${encodeURIComponent(bareId)}`);
153
- if (meta.ok) {
154
- const j = (await meta.json());
155
- if (j.get_url) {
156
- url = j.get_url.startsWith("/")
157
- ? `${apiUrl}${j.get_url}`
158
- : j.get_url;
159
- }
160
- }
161
- }
162
- catch {
163
- // Metadata lookup failed — fall back to the storage route below.
164
- }
165
- url ??= `${apiUrl}/api/storage/${encodeURIComponent(id)}`;
166
- }
167
- else if (ref.includes("/api/storage/")) {
168
- url = /^https?:\/\//.test(ref)
169
- ? ref
170
- : `${apiUrl}${ref.startsWith("/") ? ref : `/${ref}`}`;
171
- }
172
- else if (/^https?:\/\//.test(ref)) {
173
- url = ref;
174
- }
175
- if (!url)
176
- return null;
177
- const res = await fetch(url);
178
- if (!res.ok)
179
- return null;
180
- return new Uint8Array(await res.arrayBuffer());
181
- };
182
- }
183
- // Resolve asset bytes from the local assets directory, so the export commands
184
- // work by id without a running server. `asset://<key>` is tried verbatim as a
185
- // storage key first (that's how import-bundle writes refs), then via the DB
186
- // record to derive `<id>.<ext>` from the content type. Remote http(s) refs
187
- // still fetch over the network.
188
- async function makeLocalAssetFetcher() {
189
- const { getAssetFileName } = await import("@nodetool-ai/websocket");
190
- const storage = new FileStorageAdapter(getDefaultAssetsPath());
191
- return async (ref) => {
192
- if (ref.startsWith("asset://")) {
193
- const raw = ref.slice("asset://".length);
194
- const direct = await storage.retrieve(`/api/storage/${raw}`);
195
- if (direct)
196
- return direct;
197
- const bareId = raw.replace(/\.[^.]+$/, "");
198
- const asset = await Asset.find(LOCAL_USER_ID, bareId);
199
- if (!asset)
200
- return null;
201
- const key = getAssetFileName(asset.id, asset.content_type);
202
- return storage.retrieve(`/api/storage/${key}`);
203
- }
204
- if (ref.includes("/api/storage/")) {
205
- const local = await storage.retrieve(ref);
206
- if (local)
207
- return local;
208
- }
209
- if (/^https?:\/\//.test(ref)) {
210
- const res = await fetch(ref);
211
- if (!res.ok)
212
- return null;
213
- return new Uint8Array(await res.arrayBuffer());
214
- }
215
- return null;
216
- };
217
- }
218
- // Asset and timeline persistence for every context any command builds, here
219
- // rather than per-entrance: `debug` wired none while `workflows run` wired
220
- // four, so one workflow saved an image under one command and threw under the
221
- // other. The interfaces touch the database only when a node calls them, so
222
- // installing them before `setupDb()` is safe.
223
- await installLocalModelInterfaces();
224
- // ---------------------------------------------------------------------------
225
- // info
226
- // ---------------------------------------------------------------------------
227
- program
228
- .name("nodetool")
229
- .description("NodeTool CLI")
230
- .version(CLI_VERSION)
231
- .option("--trace-file <path>", "Append every LLM/agent/workflow span as JSONL to <path>")
232
- .option("--trace-stdout [format]", "Stream spans to stdout: 'pretty' (default) or 'json' (JSONL)")
233
- .option("--no-trace-stdout", "Disable stdout span output (overrides NODETOOL_TRACE_STDOUT)")
234
- // A command that started the Python worker must stop it, or the worker
235
- // child process keeps the CLI alive after the output.
236
- .hook("postAction", async () => {
237
- closePythonProviders();
238
- await finishCliTelemetry();
239
- })
240
- .hook("preAction", async (thisCommand, actionCommand) => {
241
- // Anonymous usage analytics, off unless `nodetool telemetry enable` ran.
242
- // Only the matched top-level command name is used, never argv.
243
- startCliTelemetry(topLevelCommandName(actionCommand));
244
- // With `--trace`, the `debug` command owns telemetry: it routes spans into
245
- // its bundle's trace.jsonl via its own initTelemetry call. Initializing here
246
- // first would win the one-shot init and drop that file sink, so skip it.
247
- // Without `--trace`, fall through so the global --trace-file/--trace-stdout
248
- // flags still work for a debug run.
249
- if (actionCommand?.name() === "debug" && actionCommand.opts()["trace"])
250
- return;
251
- const opts = thisCommand.opts();
252
- await initTelemetry({
253
- ...(opts.traceFile && { traceFile: opts.traceFile }),
254
- ...(opts.traceStdout !== undefined && {
255
- stdout: parseTraceStdout(opts.traceStdout)
256
- })
257
- });
258
- });
259
- /** The name of the top-level command an action belongs to. */
260
- function topLevelCommandName(command) {
261
- let current = command;
262
- while (current?.parent && current.parent.parent) {
263
- current = current.parent;
264
- }
265
- return current?.name();
266
- }
267
- function parseTraceStdout(v) {
268
- if (v === false)
269
- return false;
270
- if (v === true)
271
- return "pretty";
272
- if (isString(v)) {
273
- const lower = v.toLowerCase();
274
- if (lower === "false" || lower === "0" || lower === "no")
275
- return false;
276
- if (lower === "json")
277
- return "json";
278
- if (lower === "pretty" || lower === "true" || lower === "1")
279
- return "pretty";
280
- }
281
- throw new Error(`--trace-stdout must be 'pretty' or 'json' (got ${JSON.stringify(v)})`);
282
- }
283
- // ---------------------------------------------------------------------------
284
- // run — execute a TypeScript/JavaScript DSL workflow file
285
- // ---------------------------------------------------------------------------
286
- addSupervisorOptions(program
287
- .command("run <dsl-file>")
288
- .description("Run a TypeScript/JavaScript DSL workflow file")
289
- .option("--json", "Output results as JSON (default: pretty-print)")
290
- .option("--install-missing", "Authorize missing node pack installation, then re-execute once")).action(async (dslFile, opts) => {
291
- try {
292
- const { resolve } = await import("node:path");
293
- const { runDslFile } = await import("./run-dsl.js");
294
- const { NodeRegistry } = await import("@nodetool-ai/node-sdk");
295
- await registerCliPacks(NodeRegistry.global, CLI_DSL_BUILTIN_PACK_POLICY);
296
- const supervisorConfig = parseSupervisorFlags(opts);
297
- const absolutePath = resolve(dslFile);
298
- let results;
299
- let interventions = [];
300
- if (supervisorConfig) {
301
- // The supervisor's provider key comes from the secret store, and its
302
- // spend is written to the local ledger — both need the DB.
303
- await setupDb();
304
- const { runDslFileSupervised } = await import("./run-dsl-supervised.js");
305
- const run = await runDslFileSupervised(absolutePath, supervisorConfig, opts.json === true);
306
- results = run.results;
307
- interventions = run.interventions;
308
- }
309
- else {
310
- results = await runDslFile(absolutePath);
311
- }
312
- const { printRunJson, previewJson } = await import("./run-json.js");
313
- if (opts.json) {
314
- // A supervised run reports what the supervisor did alongside the
315
- // outputs; an unsupervised one keeps the bare results shape.
316
- await printRunJson(supervisorConfig ? { results, interventions } : results);
317
- }
318
- else {
319
- for (const [workflowName, outputs] of Object.entries(results)) {
320
- console.log(`\n${workflowName}:`);
321
- for (const [key, value] of Object.entries(outputs)) {
322
- console.log(` ${key}: ${previewJson(value)}`);
323
- }
324
- }
325
- }
326
- }
327
- catch (e) {
328
- const exit = await installMissingPacksAndReexec(e, { command: "run", installMissing: opts.installMissing });
329
- if (exit !== null) {
330
- process.exit(exit);
331
- }
332
- process.exit(printCommandError(e, opts.json));
333
- }
334
- });
335
- program
336
- .command("info")
337
- .description("Display system and environment information")
338
- .option("--json", "Output as JSON")
339
- .action((opts) => {
340
- const apiKeys = [
341
- "ANTHROPIC_API_KEY",
342
- "OPENAI_API_KEY",
343
- "GEMINI_API_KEY",
344
- "MISTRAL_API_KEY",
345
- "GROQ_API_KEY",
346
- "OLLAMA_API_URL",
347
- "SERPAPI_API_KEY",
348
- "HF_TOKEN"
349
- ];
350
- const data = {
351
- version: CLI_VERSION,
352
- node_version: process.version,
353
- platform: process.platform,
354
- arch: process.arch,
355
- api_keys: Object.fromEntries(apiKeys.map((k) => [k, process.env[k] ? "configured" : "not set"])),
356
- environment: {
357
- ENV: process.env["ENV"] ?? "development",
358
- LOG_LEVEL: process.env["LOG_LEVEL"] ?? "INFO",
359
- PORT: process.env["PORT"] ?? "7777"
360
- }
361
- };
362
- if (opts.json) {
363
- asJson(data);
364
- return;
365
- }
366
- console.log("\nNodeTool System Information\n");
367
- printTable([
368
- { property: "Version", value: data.version },
369
- { property: "Node.js", value: data.node_version },
370
- { property: "Platform", value: `${data.platform}/${data.arch}` }
371
- ]);
372
- console.log("\nAPI Keys:");
373
- printTable(Object.entries(data.api_keys).map(([k, v]) => ({ key: k, status: v })));
374
- console.log("\nEnvironment:");
375
- printTable(Object.entries(data.environment).map(([k, v]) => ({
376
- variable: k,
377
- value: v
378
- })));
379
- console.log();
380
- });
381
- // ---------------------------------------------------------------------------
382
- // serve
383
- // ---------------------------------------------------------------------------
384
- program
385
- .command("serve")
386
- .description("Start the NodeTool WebSocket + HTTP server")
387
- .option("--host <host>", "Host to bind", "127.0.0.1")
388
- .option("--port <port>", "Port to listen on", "7777")
389
- .action((opts) => {
390
- refusePackInstallsInProcess("serve");
391
- const serverPath = resolve(__dirname, "../dist/packs/serve.js");
392
- process.env["HOST"] = opts.host;
393
- process.env["PORT"] = opts.port;
394
- const result = spawnSync(process.execPath, [serverPath], {
395
- stdio: "inherit",
396
- env: { ...process.env }
397
- });
398
- if (result.error)
399
- console.error(`Could not start the server: ${result.error.message}`);
400
- process.exit(childExitCode(result));
401
- });
402
- // ---------------------------------------------------------------------------
403
- // chat
404
- // ---------------------------------------------------------------------------
405
- program
406
- .command("chat")
407
- .description("Start fullscreen chat")
408
- .helpOption(false)
409
- .option("-p, --provider <provider>", "LLM provider")
410
- .option("-m, --model <model>", "Model ID")
411
- .option("-a, --agent", "Agent mode")
412
- .option("-u, --url <url>", "WebSocket server URL")
413
- .option("-w, --workspace <path>", "Workspace directory")
414
- .option("--tools <tools>", "Comma-separated enabled tools")
415
- .allowUnknownOption()
416
- .action((_opts, cmd) => {
417
- const chatPath = resolve(__dirname, import.meta.url.endsWith(".ts") ? "index.ts" : "index.js");
418
- const args = cmd.args;
419
- const rawArgs = process.argv;
420
- // Re-run with the chat entry point, forwarding all flags after "chat"
421
- const chatIdx = rawArgs.indexOf("chat");
422
- const forwarded = chatIdx >= 0 ? rawArgs.slice(chatIdx + 1) : args;
423
- const result = spawnSync(process.execPath, [...process.execArgv, chatPath, ...forwarded], {
424
- stdio: "inherit",
425
- env: { ...process.env }
426
- });
427
- process.exit(childExitCode(result));
428
- });
429
- // ---------------------------------------------------------------------------
430
- // workflows
431
- // ---------------------------------------------------------------------------
432
- const workflows = program
433
- .command("workflows")
434
- .description("Workflow management");
435
- addSupervisorOptions(workflows
436
- .command("run <workflow_id_or_file>")
437
- .description("Run a workflow by ID, JSON file, or TypeScript DSL file")
438
- .option("--params <json>", "JSON params string")
439
- .option("--json", "Output as JSON")
440
- .option("--install-missing", "Authorize missing node pack installation, then re-execute once")
441
- .option("--asset-output-mode <mode>", "How media outputs are materialized: native | raw | data_uri | workspace | storage_url | temp_url", "native")
442
- .option("--workspace <dir>", "Workspace directory for workspace-mode asset output (default: ./nodetool-output)")
443
- .option("--trigger-event <json>", 'Wake a trigger node as the scheduler/webhook adapter would: \'{"node_id":"watch","payload":{"path":"/tmp/a.csv","event":"created"}}\'. ' +
444
- "Without it a webhook, file-watch or manual trigger has no event to " +
445
- "emit and the run stalls until its timeout — so this is the only way " +
446
- "to exercise a trigger-driven workflow from the CLI.")).action(async (idOrFile, opts) => {
447
- try {
448
- const supervisorConfig = parseSupervisorFlags(opts);
449
- await setupDb();
450
- let graph;
451
- let workflowId = null;
452
- const params = opts.params
453
- ? JSON.parse(opts.params)
454
- : {};
455
- // A trigger node emits from `emitTriggerEvent`, not `genProcess`, and
456
- // only when the run carries an event addressed to it. The kernel has
457
- // always accepted one (`RunJobRequest.trigger_event`); nothing on the
458
- // CLI could supply it, so a webhook or file-watch workflow could be
459
- // validated but never executed. `input_id` defaults because every
460
- // caller would otherwise invent the same throwaway id.
461
- const triggerEvent = opts.triggerEvent
462
- ? (() => {
463
- const parsed = JSON.parse(opts.triggerEvent);
464
- if (!parsed.node_id) {
465
- throw new Error('--trigger-event needs a "node_id" naming the trigger node to wake.');
466
- }
467
- return {
468
- node_id: parsed.node_id,
469
- payload: parsed.payload ?? {},
470
- input_id: parsed.input_id ?? `cli-${Date.now()}`
471
- };
472
- })()
473
- : null;
474
- // Determine if argument is a file path or workflow ID
475
- if (idOrFile.endsWith(".json") ||
476
- idOrFile.endsWith(".ts") ||
477
- idOrFile.endsWith(".tsx") ||
478
- idOrFile.includes("/") ||
479
- idOrFile.includes("\\")) {
480
- /** A DSL/JSON workflow file: the graph, optionally wrapped. */
481
- let raw;
482
- if (idOrFile.endsWith(".ts") || idOrFile.endsWith(".tsx")) {
483
- const { readFileTarget } = await import("./debug/target.js");
484
- raw = (await readFileTarget(idOrFile)).raw;
485
- }
486
- else {
487
- const { readFileSync } = await import("node:fs");
488
- raw = JSON.parse(readFileSync(idOrFile, "utf8"));
489
- }
490
- graph = raw.graph ?? raw;
491
- workflowId = raw.workflow_id ?? raw.id ?? null;
492
- if (raw.params)
493
- Object.assign(params, raw.params);
494
- }
495
- else {
496
- const wf = await Workflow.get(idOrFile);
497
- if (!wf)
498
- throw new Error(`Workflow not found: ${idOrFile}`);
499
- graph = wf.graph;
500
- workflowId = idOrFile;
501
- }
502
- if (!graph?.nodes || !graph?.edges) {
503
- throw new Error("Invalid workflow: missing nodes or edges");
504
- }
505
- // Editor-only nodes (Comment, Group, Reroute) and the data→properties
506
- // rename are handled by `ExecutionSession.create` below, which runs
507
- // the graph through `normalizeGraph` (@nodetool-ai/execution) — no
508
- // need to duplicate that here.
509
- const registry = new NodeRegistry();
510
- await registerCliPacks(registry, CLI_LOCAL_BUILTIN_PACK_POLICY);
511
- const jobId = `job-${Date.now()}`;
512
- // Resolve asset URIs (e.g. /api/storage/<key>) against the local
513
- // assets directory, so workflows referencing stored assets run the
514
- // same decode path the server does.
515
- // Apply the workflow's assigned workspace (if any) so file ops and
516
- // workspace-driving nodes land in the same directory as a server run.
517
- const { resolveWorkflowWorkspace } = await import("@nodetool-ai/websocket");
518
- const assignedWorkspace = workflowId
519
- ? await resolveWorkflowWorkspace(workflowId, "1")
520
- : null;
521
- const ASSET_OUTPUT_MODES = [
522
- "native",
523
- "raw",
524
- "data_uri",
525
- "workspace",
526
- "storage_url",
527
- "temp_url"
528
- ];
529
- const assetOutputMode = (opts.assetOutputMode ??
530
- "native");
531
- if (!ASSET_OUTPUT_MODES.includes(assetOutputMode)) {
532
- throw new Error(`Unknown --asset-output-mode "${assetOutputMode}". ` +
533
- `Expected one of: ${ASSET_OUTPUT_MODES.join(", ")}`);
534
- }
535
- // `--workspace <dir>` wins, then whatever the workflow is assigned.
536
- // `workspace` asset mode writes each output into <workspace>/assets, so
537
- // it needs somewhere to write even when the run has no saved workflow (a
538
- // JSON or DSL file target). Fall back to ./nodetool-output so a bare
539
- // `workflows run file.json --asset-output-mode workspace` produces files
540
- // in the current directory rather than failing.
541
- const overrideWorkspaceDir = opts.workspace ??
542
- (assignedWorkspace
543
- ? null
544
- : assetOutputMode === "workspace"
545
- ? resolve(process.cwd(), "nodetool-output")
546
- : null);
547
- if (overrideWorkspaceDir) {
548
- mkdirSync(overrideWorkspaceDir, { recursive: true });
549
- }
550
- const runWorkspace = overrideWorkspaceDir
551
- ? createLocalWorkspace(overrideWorkspaceDir)
552
- : assignedWorkspace;
553
- const assetStorage = new FileStorageAdapter(getDefaultAssetsPath());
554
- const context = new ProcessingContext({
555
- jobId,
556
- workflowId,
557
- userId: "1",
558
- secretResolver: resolveLocalSecret,
559
- storage: assetStorage,
560
- assetOutputMode,
561
- workspace: runWorkspace
562
- });
563
- const supervisor = supervisorConfig
564
- ? await createSupervisorHandle({
565
- config: supervisorConfig,
566
- context
567
- })
568
- : null;
569
- console.error(`Running workflow${workflowId ? ` ${workflowId}` : ""}` +
570
- (supervisor
571
- ? ` supervised by ${supervisor.providerId}/${supervisor.model}`
572
- : "") +
573
- "...");
574
- // ExecutionSession owns graph hydration, Python-bridge connection
575
- // (NODETOOL_WORKER_URL/NODETOOL_WORKER_TOKEN → remote worker; unset →
576
- // local stdio worker; pure-TS graphs get none), and executor
577
- // resolution (registry → Python bridge → throw).
578
- const sessionOptions = {
579
- graph,
580
- registry,
581
- // Registry alone hydrates node flags but not `propertyTypes`, and
582
- // correlation analysis reads list-ness only from that map — so a
583
- // saved workflow (which never carries it) had every list handle
584
- // read as non-list, and legal fan-in into one was rejected before
585
- // any node ran. The resolver fills it from node metadata.
586
- resolveNodeType: createGraphNodeTypeResolver(registry).resolveNodeType,
587
- jobId,
588
- workflowId,
589
- params,
590
- context
591
- };
592
- if (triggerEvent) {
593
- sessionOptions.triggerEvent = triggerEvent;
594
- }
595
- // Message capture is retention, so it stays off unless a supervised
596
- // run needs the stream to print its `⛨` lines as they happen.
597
- if (supervisor) {
598
- sessionOptions.supervisor = supervisor.handle;
599
- sessionOptions.captureMessages = true;
600
- }
601
- const nodeCountBucket = bucketNodeCount(graph.nodes.length);
602
- trackCliEvent({
603
- event: "workflow_run",
604
- properties: { executionMode: "local", nodeCountBucket }
605
- });
606
- const runStartedAt = Date.now();
607
- const session = await ExecutionSession.create(sessionOptions);
608
- const interventionLines = supervisor
609
- ? streamInterventionLines(session.messages)
610
- : Promise.resolve();
611
- const result = await session.result;
612
- const durationBucket = bucketDuration(Date.now() - runStartedAt);
613
- if (result.status === "completed") {
614
- trackCliEvent({
615
- event: "workflow_run_succeeded",
616
- properties: { executionMode: "local", nodeCountBucket, durationBucket }
617
- });
618
- }
619
- else {
620
- trackCliEvent({
621
- event: "workflow_run_failed",
622
- properties: {
623
- executionMode: "local",
624
- nodeCountBucket,
625
- durationBucket,
626
- errorCategory: result.status === "cancelled" ? "cancelled" : categorizeError(result.error)
627
- }
628
- });
629
- }
630
- if (result.status === "failed" && (commandMissingRuntime(result) || commandMissingPack(result))) {
631
- const exit = await installMissingPacksAndReexec(result, { command: "workflows-run", installMissing: opts.installMissing });
632
- if (exit !== null) {
633
- process.exit(exit);
634
- }
635
- process.exit(printCommandError(result, opts.json));
636
- }
637
- await interventionLines;
638
- supervisor?.handle.close();
639
- const interventions = result.interventions ?? [];
640
- if (supervisor && interventions.length > 0) {
641
- await recordSupervisorCost({
642
- interventions,
643
- jobId,
644
- workflowId,
645
- userId: "1",
646
- providerId: supervisor.providerId,
647
- model: supervisor.model
648
- });
649
- }
650
- const { printRunJson, previewJson } = await import("./run-json.js");
651
- if (opts.json) {
652
- await printRunJson(result, {
653
- outputDir: resolve(process.cwd(), "nodetool-output", jobId)
654
- });
655
- }
656
- else {
657
- console.log(`Status: ${result.status}`);
658
- if (result.error)
659
- console.error(`Error: ${result.error}`);
660
- for (const [nodeId, outputs] of Object.entries(result.outputs ?? {})) {
661
- if (Array.isArray(outputs) && outputs.length > 0) {
662
- console.log(`\nNode ${nodeId}:`);
663
- for (const out of outputs) {
664
- console.log(` ${previewJson(out, 200)}`);
665
- }
666
- }
667
- }
668
- printSupervisedSummary(interventions);
669
- }
670
- await finishCliTelemetry();
671
- process.exit(result.status === "completed" ? 0 : 1);
672
- }
673
- catch (e) {
674
- const exit = await installMissingPacksAndReexec(e, { command: "workflows-run", installMissing: opts.installMissing });
675
- if (exit !== null) {
676
- process.exit(exit);
677
- }
678
- process.exit(printCommandError(e, opts.json));
679
- }
680
- });
681
- workflows
682
- .command("export-script <workflow_id_or_file>")
683
- .description("Convert a workflow into a JavaScript script that calls each node in order (local DB by id, or a JSON file)")
684
- .option("-t, --target <target>", "sandbox (a JS script document or Code node body) or node (a standalone Node.js .mjs)", "sandbox")
685
- .option("-o, --output <file>", "Write the script to a file")
686
- .action(async (idOrFile, opts) => {
687
- try {
688
- if (opts.target !== "sandbox" && opts.target !== "node") {
689
- throw new Error(`Unknown target "${opts.target}": use "sandbox" or "node"`);
690
- }
691
- let graph;
692
- let name;
693
- if (idOrFile.endsWith(".json") ||
694
- idOrFile.includes("/") ||
695
- idOrFile.includes("\\")) {
696
- const { readFileSync } = await import("node:fs");
697
- const raw = JSON.parse(readFileSync(idOrFile, "utf8"));
698
- graph = (raw.graph ?? raw);
699
- name = isString(raw.name) ? raw.name : null;
700
- }
701
- else {
702
- ensureDb();
703
- const wf = await Workflow.find(LOCAL_USER_ID, idOrFile);
704
- if (!wf)
705
- throw new Error(`Workflow not found: ${idOrFile}`);
706
- graph = wf.getGraph();
707
- name = isString(wf.name) ? wf.name : null;
708
- }
709
- const script = workflowToScript(graph, {
710
- target: opts.target,
711
- workflowName: name
712
- });
713
- for (const issue of script.unsupported) {
714
- console.error(`warning: ${issue.node_type} (${issue.node_id}) ${issue.message}`);
715
- }
716
- if (opts.output) {
717
- const { writeFile } = await import("node:fs/promises");
718
- await writeFile(opts.output, script.code, "utf8");
719
- console.log(opts.output);
720
- return;
721
- }
722
- console.log(script.code);
723
- }
724
- catch (e) {
725
- process.exit(printCommandError(e));
726
- }
727
- });
728
- workflows
729
- .command("export-dsl <workflow_id_or_file>")
730
- .description("Export a workflow as TypeScript DSL code (local DB by id; --api-url for remote)")
731
- .option("--api-url <url>", "Fetch the workflow from a remote server instead of the local database", process.env["NODETOOL_API_URL"])
732
- .option("-o, --output <file>", "Write the exported DSL to a file")
733
- .action(async (idOrFile, opts) => {
734
- try {
735
- let source;
736
- if (idOrFile.endsWith(".json") ||
737
- idOrFile.includes("/") ||
738
- idOrFile.includes("\\")) {
739
- const { readFileSync } = await import("node:fs");
740
- const raw = JSON.parse(readFileSync(idOrFile, "utf8"));
741
- const graph = (raw.graph ?? raw);
742
- source = workflowToDsl(graph, {
743
- workflowName: isString(raw.name) ? raw.name : null
744
- });
745
- }
746
- else if (opts.apiUrl) {
747
- source = await apiGetText(opts.apiUrl, `/api/workflows/${idOrFile}/dsl-export`);
748
- }
749
- else {
750
- ensureDb();
751
- const wf = await Workflow.find(LOCAL_USER_ID, idOrFile);
752
- if (!wf)
753
- throw new Error(`Workflow not found: ${idOrFile}`);
754
- const graph = wf.getGraph();
755
- source = workflowToDsl(graph, {
756
- workflowName: isString(wf.name) ? wf.name : null
757
- });
758
- }
759
- if (opts.output) {
760
- const { writeFile } = await import("node:fs/promises");
761
- await writeFile(opts.output, source, "utf8");
762
- console.log(opts.output);
763
- return;
764
- }
765
- console.log(source);
766
- }
767
- catch (e) {
768
- process.exit(printCommandError(e));
769
- }
770
- });
771
- workflows
772
- .command("export-example <workflow_id_or_file>")
773
- .description("Export a workflow as a shipped template: materialize its assets into the " +
774
- "package's constant asset dir (package:// refs) and write the example JSON")
775
- .option("--api-url <url>", "Fetch the workflow and asset bytes from a remote server instead of the local DB/assets", process.env["NODETOOL_API_URL"])
776
- .option("--package <name>", "Owning package", "nodetool-base")
777
- .option("--assets-dir <dir>", "Root holding <package>/<file> constant assets (defaults to the monorepo base-nodes assets dir)")
778
- .option("--examples-dir <dir>", "Directory the example JSON is written under, as <dir>/<package>/<name>.json")
779
- .option("-o, --output <file>", "Write the example JSON to this exact path")
780
- .option("--include-remote", "Also materialize http(s) and local-file refs (off by default)")
781
- .action(async (idOrFile, opts) => {
782
- try {
783
- const { readFileSync } = await import("node:fs");
784
- const { mkdir, writeFile } = await import("node:fs/promises");
785
- const { join } = await import("node:path");
786
- const { materializeWorkflowConstantAssets } = await import("@nodetool-ai/websocket");
787
- let name = "";
788
- let description = "";
789
- let tags = [];
790
- let graph;
791
- const isFile = idOrFile.endsWith(".json") ||
792
- idOrFile.includes("/") ||
793
- idOrFile.includes("\\");
794
- if (isFile) {
795
- const raw = JSON.parse(readFileSync(idOrFile, "utf8"));
796
- name = isString(raw.name) ? raw.name : "workflow";
797
- description =
798
- isString(raw.description) ? raw.description : "";
799
- tags = Array.isArray(raw.tags)
800
- ? raw.tags.filter((t) => typeof t === "string")
801
- : [];
802
- graph = (raw.graph ?? raw);
803
- }
804
- else if (opts.apiUrl) {
805
- const client = createApiClient(opts.apiUrl);
806
- const wf = (await client.workflows.get.query({
807
- id: idOrFile
808
- }));
809
- name = isString(wf.name) ? wf.name : "workflow";
810
- description =
811
- isString(wf.description) ? wf.description : "";
812
- tags = Array.isArray(wf.tags)
813
- ? wf.tags.filter((t) => typeof t === "string")
814
- : [];
815
- graph = wf.graph;
816
- }
817
- else {
818
- ensureDb();
819
- const wf = await Workflow.find(LOCAL_USER_ID, idOrFile);
820
- if (!wf)
821
- throw new Error(`Workflow not found: ${idOrFile}`);
822
- name = isString(wf.name) ? wf.name : "workflow";
823
- description =
824
- isString(wf.description) ? wf.description : "";
825
- tags = Array.isArray(wf.tags)
826
- ? wf.tags.filter((t) => typeof t === "string")
827
- : [];
828
- graph = wf.getGraph();
829
- }
830
- if (!graph?.nodes) {
831
- throw new Error("Workflow has no graph to export");
832
- }
833
- const repoRoot = resolve(__dirname, "..", "..", "..");
834
- const baseNodesDir = join(repoRoot, "packages", "base-nodes", "nodetool");
835
- const assetsRoot = opts.assetsDir ?? join(baseNodesDir, "assets");
836
- const examplesDir = opts.examplesDir ?? join(baseNodesDir, "examples");
837
- const fetchAssetBytes = opts.apiUrl
838
- ? makeAssetFetcher(opts.apiUrl.replace(/\/+$/, ""))
839
- : await makeLocalAssetFetcher();
840
- const materializeOptions = {
841
- packageName: opts.package,
842
- assetsRoot,
843
- fetchAssetBytes
844
- };
845
- if (opts.includeRemote) {
846
- materializeOptions.includeRemote = true;
847
- }
848
- const result = await materializeWorkflowConstantAssets(graph, materializeOptions);
849
- const slug = name
850
- .toLowerCase()
851
- .replace(/[^a-z0-9]+/g, "-")
852
- .replace(/^-+|-+$/g, "");
853
- const example = {
854
- id: slug || "workflow",
855
- access: "public",
856
- name,
857
- description,
858
- tags,
859
- package_name: opts.package,
860
- graph: result.graph
861
- };
862
- // Sanitize the on-disk filename separately from the display name so
863
- // names with path separators can't escape the examples directory.
864
- const safeFileName = name.replace(/[^A-Za-z0-9._-]+/g, "_").replace(/^[._]+/, "") ||
865
- "workflow";
866
- const outPath = opts.output ??
867
- join(examplesDir, opts.package, `${safeFileName}.json`);
868
- await mkdir(dirname(outPath), { recursive: true });
869
- await writeFile(outPath, JSON.stringify(example, null, 2) + "\n", "utf8");
870
- for (const a of result.exported) {
871
- console.error(` asset ${a.source} → ${a.packageUri} (${a.byteLength} bytes)`);
872
- }
873
- for (const s of result.skipped) {
874
- console.error(` warning: could not resolve asset ${s} (left as-is)`);
875
- }
876
- console.log(outPath);
877
- }
878
- catch (e) {
879
- process.exit(printCommandError(e));
880
- }
881
- });
882
- workflows
883
- .command("export-bundle <workflow_id_or_file...>")
884
- .description("Export one or more workflows as a portable .nodetool bundle (zip): the " +
885
- "graphs plus the bytes of every asset they reference, in a single file")
886
- .option("--api-url <url>", "Fetch the workflow and asset bytes from a remote server instead of the local DB/assets", process.env["NODETOOL_API_URL"])
887
- .option("-o, --output <file>", "Output path (default: <name>.nodetool)")
888
- .option("--include-remote", "Also embed http(s) and local-file refs (off by default)")
889
- .action(async (idsOrFiles, opts) => {
890
- try {
891
- const { readFileSync } = await import("node:fs");
892
- const { writeFile } = await import("node:fs/promises");
893
- const { packWorkflowsBundle } = await import("@nodetool-ai/websocket");
894
- const toBundleWf = (raw) => ({
895
- name: isString(raw.name) ? raw.name : "workflow",
896
- description: isString(raw.description) ? raw.description : "",
897
- tags: Array.isArray(raw.tags)
898
- ? raw.tags.filter((t) => typeof t === "string")
899
- : [],
900
- run_mode: raw.run_mode ?? null,
901
- settings: raw.settings ?? null,
902
- graph: (raw.graph ?? raw)
903
- });
904
- const useServer = Boolean(opts.apiUrl);
905
- const apiUrl = opts.apiUrl?.replace(/\/+$/, "") ?? "";
906
- if (!useServer)
907
- ensureDb();
908
- const workflowsToPack = [];
909
- for (const idOrFile of idsOrFiles) {
910
- const isFile = idOrFile.endsWith(".json") ||
911
- idOrFile.includes("/") ||
912
- idOrFile.includes("\\");
913
- let raw;
914
- if (isFile) {
915
- raw = JSON.parse(readFileSync(idOrFile, "utf8"));
916
- }
917
- else if (useServer) {
918
- raw = (await createApiClient(apiUrl).workflows.get.query({
919
- id: idOrFile
920
- }));
921
- }
922
- else {
923
- const found = await Workflow.find(LOCAL_USER_ID, idOrFile);
924
- if (!found)
925
- throw new Error(`Workflow not found: ${idOrFile}`);
926
- raw = { ...found, graph: found.getGraph() };
927
- }
928
- const wf = toBundleWf(raw);
929
- if (!wf.graph?.nodes) {
930
- throw new Error(`Workflow '${idOrFile}' has no graph to export`);
931
- }
932
- workflowsToPack.push(wf);
933
- }
934
- const packOptions = {
935
- workflows: workflowsToPack,
936
- fetchAssetBytes: useServer
937
- ? makeAssetFetcher(apiUrl)
938
- : await makeLocalAssetFetcher(),
939
- nodetoolVersion: cliVersion()
940
- };
941
- if (opts.includeRemote) {
942
- packOptions.includeRemote = true;
943
- }
944
- const { bytes, manifest, skipped } = await packWorkflowsBundle(packOptions);
945
- const defaultBase = workflowsToPack.length === 1
946
- ? workflowsToPack[0].name.replace(/[^A-Za-z0-9._-]+/g, "_")
947
- : `${workflowsToPack.length}-workflows`;
948
- const outPath = opts.output ?? `${defaultBase}.nodetool`;
949
- await writeFile(outPath, bytes);
950
- for (const a of manifest.assets) {
951
- console.error(` embedded ${a.file} (${a.bytes} bytes)`);
952
- }
953
- for (const s of skipped) {
954
- console.error(` warning: could not resolve asset ${s} (left as-is)`);
955
- }
956
- console.error(` bundled ${manifest.workflows.length} workflow(s), ${manifest.assets.length} asset(s)`);
957
- console.log(outPath);
958
- }
959
- catch (e) {
960
- process.exit(printCommandError(e));
961
- }
962
- });
963
- workflows
964
- .command("import-bundle <bundle_file>")
965
- .description("Import a .nodetool bundle into the local library: store its assets and " +
966
- "create the workflows with refs rewritten to the imported assets")
967
- .option("--json", "Output the created workflows as JSON")
968
- .action(async (bundleFile, opts) => {
969
- try {
970
- const { readFileSync } = await import("node:fs");
971
- const { randomUUID } = await import("node:crypto");
972
- const { extname } = await import("node:path");
973
- const { importWorkflowBundle } = await import("@nodetool-ai/websocket");
974
- await setupDb();
975
- const storage = new FileStorageAdapter(getDefaultAssetsPath());
976
- const zip = new Uint8Array(readFileSync(bundleFile));
977
- const result = await importWorkflowBundle(zip, {
978
- storeAsset: async ({ bytes, fileName, contentType }) => {
979
- const id = randomUUID();
980
- const key = `${id}${extname(fileName)}`;
981
- await storage.store(key, bytes, contentType);
982
- return { uri: `asset://${key}`, assetId: id };
983
- }
984
- });
985
- const created = [];
986
- for (const wf of result.workflows) {
987
- created.push(await Workflow.create({
988
- user_id: "1",
989
- name: wf.name,
990
- description: wf.description ?? "",
991
- tags: wf.tags ?? [],
992
- access: "private",
993
- graph: wf.graph,
994
- run_mode: wf.run_mode ?? "workflow",
995
- settings: wf.settings ?? null
996
- }));
997
- }
998
- for (const s of result.missing) {
999
- console.error(` warning: bundle asset ${s} was missing from the archive`);
1000
- }
1001
- for (const m of result.checksumMismatches) {
1002
- console.error(` warning: ${m}`);
1003
- }
1004
- console.error(` imported ${created.length} workflow(s) and ${result.imported.length} asset(s) into local storage`);
1005
- if (opts.json) {
1006
- asJson(created);
1007
- }
1008
- else {
1009
- for (const c of created) {
1010
- console.log(String(c.id));
1011
- }
1012
- }
1013
- }
1014
- catch (e) {
1015
- process.exit(printCommandError(e, opts.json));
1016
- }
1017
- });
1018
- // ---------------------------------------------------------------------------
1019
- // jobs / assets — the read commands are registered from commands/resource-read.ts
1020
- // ---------------------------------------------------------------------------
1021
- const jobs = program.command("jobs").description("Job management");
1022
- const assets = program.command("assets").description("Asset management");
1023
- registerResourceReadCommands({ workflows, jobs, assets }, { ensureDb, localUserId: LOCAL_USER_ID });
1024
- const models = program.command("models").description("Model management");
1025
- const modelKinds = [
1026
- "llm",
1027
- "image",
1028
- "tts",
1029
- "asr",
1030
- "video",
1031
- "embedding"
1032
- ];
1033
- function modelRow(m) {
1034
- return {
1035
- id: m["id"],
1036
- name: m["name"],
1037
- provider: m["provider"] ?? "",
1038
- type: m["type"] ?? "",
1039
- repo_id: m["repo_id"] ?? ""
1040
- };
1041
- }
1042
- models
1043
- .command("list")
1044
- .description("List all models (recommended + provider + HF cached); local by default, --api-url for remote")
1045
- .option("--api-url <url>", "Query a remote server instead of local providers/cache", process.env["NODETOOL_API_URL"])
1046
- .option("--json", "Output as JSON")
1047
- .action(async (opts) => {
1048
- try {
1049
- let rows;
1050
- if (opts.apiUrl) {
1051
- const client = createApiClient(opts.apiUrl);
1052
- rows = await client.models.all.query();
1053
- }
1054
- else {
1055
- await setupDb();
1056
- rows = await listAllModels();
1057
- }
1058
- if (opts.json) {
1059
- asJson(rows);
1060
- return;
1061
- }
1062
- printTable(rows.map(modelRow));
1063
- }
1064
- catch (e) {
1065
- process.exit(printCommandError(e, opts.json));
1066
- }
1067
- });
1068
- models
1069
- .command("providers")
1070
- .description("List configured providers and their capabilities")
1071
- .option("--json", "Output as JSON")
1072
- .action(async (opts) => {
1073
- await setupDb();
1074
- try {
1075
- const data = await listConfiguredProviderInfo();
1076
- if (opts.json) {
1077
- asJson(data);
1078
- return;
1079
- }
1080
- printTable(data.map((p) => ({
1081
- provider: p.provider,
1082
- capabilities: p.capabilities.join(", ")
1083
- })));
1084
- }
1085
- catch (e) {
1086
- process.exit(printCommandError(e, opts.json));
1087
- }
1088
- });
1089
- registerRecommendedCommand(models);
1090
- registerHfCommands(models);
1091
- models
1092
- .command("ollama")
1093
- .description("List Ollama models (queries the local daemon; --api-url for remote)")
1094
- .option("--api-url <url>", "Query a remote server instead of the local Ollama daemon", process.env["NODETOOL_API_URL"])
1095
- .option("--json", "Output as JSON")
1096
- .action(async (opts) => {
1097
- try {
1098
- let rows;
1099
- if (opts.apiUrl) {
1100
- const client = createApiClient(opts.apiUrl);
1101
- rows = await client.models.ollama.query();
1102
- }
1103
- else {
1104
- await setupDb();
1105
- rows = await listOllamaModels();
1106
- }
1107
- if (opts.json) {
1108
- asJson(rows);
1109
- return;
1110
- }
1111
- printTable(rows.map(modelRow));
1112
- }
1113
- catch (e) {
1114
- process.exit(printCommandError(e, opts.json));
1115
- }
1116
- });
1117
- models
1118
- .command("huggingface")
1119
- .description("List HuggingFace cached models (scans the local cache; --api-url for remote)")
1120
- .option("--api-url <url>", "Query a remote server instead of the local HuggingFace cache", process.env["NODETOOL_API_URL"])
1121
- .option("--query <q>", "Search query")
1122
- .option("--type <t>", "Filter by HF model type")
1123
- .option("--json", "Output as JSON")
1124
- .action(async (opts) => {
1125
- try {
1126
- let rows;
1127
- if (opts.apiUrl) {
1128
- const client = createApiClient(opts.apiUrl);
1129
- if (opts.query || opts.type) {
1130
- const search = {};
1131
- if (opts.query) {
1132
- search.query = String(opts.query);
1133
- }
1134
- if (opts.type) {
1135
- search.type = String(opts.type);
1136
- }
1137
- rows = await client.models.huggingfaceSearch.query(search);
1138
- }
1139
- else {
1140
- rows = await client.models.huggingfaceList.query();
1141
- }
1142
- }
1143
- else if (opts.query || opts.type) {
1144
- // Wrap a bare query in wildcards so it matches as a substring, the same
1145
- // normalization the server's huggingfaceSearch applies.
1146
- const rawQuery = opts.query ? String(opts.query) : undefined;
1147
- const query = rawQuery && !rawQuery.includes("*") ? `*${rawQuery}*` : rawQuery;
1148
- rows = await searchCachedHfModels(query ? [query] : undefined, opts.type ? [String(opts.type)] : undefined);
1149
- }
1150
- else {
1151
- rows = await readCachedHfModels();
1152
- }
1153
- if (opts.json) {
1154
- asJson(rows);
1155
- return;
1156
- }
1157
- printTable(rows.map(modelRow));
1158
- }
1159
- catch (e) {
1160
- process.exit(printCommandError(e, opts.json));
1161
- }
1162
- });
1163
- models
1164
- .command("by-provider <provider>")
1165
- .description(`List models for a provider. --kind one of: ${modelKinds.join(", ")}`)
1166
- .option("--kind <kind>", "Model kind", "llm")
1167
- .option("--json", "Output as JSON")
1168
- .action(async (provider, opts) => {
1169
- const kind = opts.kind;
1170
- if (!modelKinds.includes(kind)) {
1171
- console.error(`Invalid --kind '${opts.kind}'. Must be one of: ${modelKinds.join(", ")}`);
1172
- process.exit(1);
1173
- }
1174
- await setupDb();
1175
- try {
1176
- const rows = await listProviderModels(provider, kind);
1177
- if (opts.json) {
1178
- asJson(rows);
1179
- return;
1180
- }
1181
- printTable(rows.map(modelRow));
1182
- }
1183
- catch (e) {
1184
- process.exit(printCommandError(e, opts.json));
1185
- }
1186
- });
1187
- // ---------------------------------------------------------------------------
1188
- // storage
1189
- // ---------------------------------------------------------------------------
1190
- const storage = program
1191
- .command("storage")
1192
- .description("Maintain the asset storage backend");
1193
- storage
1194
- .command("migrate-keys")
1195
- .description("Move asset objects under their owner's prefix (<userId>/<assetId>.<ext>)")
1196
- .option("--dry-run", "Report what would move without writing anything")
1197
- .option("--user-id <id>", "Migrate only this user's objects")
1198
- .option("--json", "Output the report as JSON")
1199
- .action(async (opts) => {
1200
- await setupDb();
1201
- const { migrateStorageKeys, formatMigrateKeysReport } = await import("./commands/storage.js");
1202
- try {
1203
- const migrateOptions = {
1204
- dryRun: Boolean(opts.dryRun)
1205
- };
1206
- if (opts.userId) {
1207
- migrateOptions.userId = opts.userId;
1208
- }
1209
- const report = await migrateStorageKeys(migrateOptions);
1210
- if (opts.json) {
1211
- console.log(JSON.stringify(report, null, 2));
1212
- }
1213
- else {
1214
- console.log(formatMigrateKeysReport(report, Boolean(opts.dryRun)));
1215
- }
1216
- if (report.failed > 0)
1217
- process.exit(1);
1218
- }
1219
- catch (e) {
1220
- process.exit(printCommandError(e, opts.json));
1221
- }
1222
- });
1223
- workflows
1224
- .command("migrate-code-inputs")
1225
- .description("Rewrite saved Code node bodies to read declared inputs off `inputs`")
1226
- .option("--dry-run", "Report what would change without writing anything")
1227
- .option("--user-id <id>", "Migrate only this user's workflows")
1228
- .option("--json", "Output the report as JSON")
1229
- .action(async (opts) => {
1230
- await setupDb();
1231
- const { migrateCodeInputs, formatMigrateCodeInputsReport } = await import("./commands/migrate-code-inputs.js");
1232
- try {
1233
- const migrateOptions = {
1234
- dryRun: Boolean(opts.dryRun)
1235
- };
1236
- if (opts.userId) {
1237
- migrateOptions.userId = opts.userId;
1238
- }
1239
- const report = await migrateCodeInputs(migrateOptions);
1240
- if (opts.json) {
1241
- console.log(JSON.stringify(report, null, 2));
1242
- }
1243
- else {
1244
- console.log(formatMigrateCodeInputsReport(report, Boolean(opts.dryRun)));
1245
- }
1246
- if (report.failed > 0)
1247
- process.exit(1);
1248
- }
1249
- catch (e) {
1250
- process.exit(printCommandError(e, opts.json));
1251
- }
1252
- });
1253
- // ---------------------------------------------------------------------------
1254
- // secrets
1255
- // ---------------------------------------------------------------------------
1256
- const secrets = program
1257
- .command("secrets")
1258
- .description("Manage encrypted secrets");
1259
- secrets
1260
- .command("list")
1261
- .description("List stored secret keys (values are never shown)")
1262
- .option("--user-id <id>", "User ID", "1")
1263
- .action(async (opts) => {
1264
- await setupDb();
1265
- try {
1266
- const [items] = await Secret.listForUser(opts.userId, 100);
1267
- if (items.length === 0) {
1268
- console.log("No secrets stored.");
1269
- return;
1270
- }
1271
- printTable(items.map((s) => ({ key: s.key, updated_at: s.updated_at ?? "" })));
1272
- }
1273
- catch (e) {
1274
- process.exit(printCommandError(e));
1275
- }
1276
- });
1277
- secrets
1278
- .command("store <key>")
1279
- .description("Store or update a secret (prompts for value)")
1280
- .option("--user-id <id>", "User ID", "1")
1281
- .option("--description <desc>", "Optional description")
1282
- .action(async (key, opts) => {
1283
- await setupDb();
1284
- try {
1285
- // Hidden on a TTY: an echoed value stays in the terminal scrollback.
1286
- const value = await readSecretValue(`Enter value for '${key}': `);
1287
- if (!value)
1288
- throw new Error(`No value given for '${key}'; nothing stored.`);
1289
- await Secret.upsert({
1290
- userId: opts.userId,
1291
- key,
1292
- value,
1293
- description: opts.description
1294
- });
1295
- console.log(`Secret '${key}' stored.`);
1296
- }
1297
- catch (e) {
1298
- process.exit(printCommandError(e));
1299
- }
1300
- });
1301
- secrets
1302
- .command("get <key>")
1303
- .description("Retrieve and print a secret value")
1304
- .option("--user-id <id>", "User ID", "1")
1305
- .action(async (key, opts) => {
1306
- await setupDb();
1307
- try {
1308
- const value = await getSecret(key, opts.userId);
1309
- if (value == null) {
1310
- console.error(`Secret '${key}' not found.`);
1311
- process.exit(1);
1312
- }
1313
- console.log(value);
1314
- }
1315
- catch (e) {
1316
- process.exit(printCommandError(e));
1317
- }
1318
- });
1319
- // ---------------------------------------------------------------------------
1320
- // settings
1321
- // ---------------------------------------------------------------------------
1322
- const settings = program
1323
- .command("settings")
1324
- .description("View configuration settings");
1325
- settings
1326
- .command("show")
1327
- .description("Show current settings from environment")
1328
- .option("--json", "Output as JSON")
1329
- .action((opts) => {
1330
- const vars = [
1331
- "ENV",
1332
- "LOG_LEVEL",
1333
- "PORT",
1334
- "HOST",
1335
- "DB_PATH",
1336
- "NODETOOL_API_URL",
1337
- "ANTHROPIC_API_KEY",
1338
- "OPENAI_API_KEY",
1339
- "GEMINI_API_KEY",
1340
- "MISTRAL_API_KEY",
1341
- "GROQ_API_KEY",
1342
- "OLLAMA_API_URL",
1343
- "SERPAPI_API_KEY",
1344
- "HF_TOKEN",
1345
- "VECTORSTORE_DB_PATH",
1346
- "ASSET_BUCKET",
1347
- "S3_ENDPOINT_URL"
1348
- ];
1349
- const data = Object.fromEntries(vars.map((k) => [
1350
- k,
1351
- process.env[k]
1352
- ? k.endsWith("KEY") || k.endsWith("TOKEN")
1353
- ? "***"
1354
- : process.env[k]
1355
- : ""
1356
- ]));
1357
- if (opts.json) {
1358
- asJson(data);
1359
- return;
1360
- }
1361
- printTable(Object.entries(data).map(([variable, value]) => ({ variable, value })));
1362
- });
1363
- // ---------------------------------------------------------------------------
1364
- // mcp
1365
- // ---------------------------------------------------------------------------
1366
- const mcp = program
1367
- .command("mcp")
1368
- .description("Use NodeTool as an MCP server from Claude Code, Codex, OpenCode, or any MCP client");
1369
- registerMcpClientCommands(mcp);
1370
- mcp
1371
- .command("serve")
1372
- .description("Run the NodeTool MCP server over stdio for an external agent " +
1373
- "(Claude Code, Codex, …). All logging goes to stderr; stdout is the " +
1374
- "MCP protocol channel.")
1375
- .action(async () => {
1376
- try {
1377
- refusePackInstallsInProcess("mcp serve");
1378
- const { createMcpServer, createMcpStdioTransport, forwardMcpStdioToLocalServer } = await import("@nodetool-ai/websocket");
1379
- if (await forwardMcpStdioToLocalServer()) {
1380
- process.stderr.write("NodeTool MCP forwarding to the local API server.\n");
1381
- return;
1382
- }
1383
- await setupDb();
1384
- // A local TS-node registry powers list_nodes / search_nodes /
1385
- // validate_workflow without spinning up a Python worker.
1386
- const registry = new NodeRegistry();
1387
- await registerCliPacks(registry, CLI_LOCAL_BUILTIN_PACK_POLICY);
1388
- const { installSandboxCatalog } = await import("./sandbox-catalog.js");
1389
- installSandboxCatalog();
1390
- // stdio serves exactly one local user; "1" is the local single-user id.
1391
- const server = createMcpServer({
1392
- registry,
1393
- agentToolsScope: { userId: "1", source: "stdio-local" }
1394
- });
1395
- const transport = createMcpStdioTransport();
1396
- await server.connect(transport);
1397
- process.stderr.write("NodeTool MCP server ready on stdio.\n");
1398
- // The stdio transport keeps the event loop alive until the client
1399
- // closes the connection.
1400
- }
1401
- catch (e) {
1402
- process.exit(printCommandError(e));
1403
- }
1404
- });
1405
- // ---------------------------------------------------------------------------
1406
- // package
1407
- // ---------------------------------------------------------------------------
1408
- registerProjectCommands(program);
1409
- registerPackageCommands(program);
1410
- registerPackCommands(program);
1411
- registerRuntimeCommands(program);
1412
- registerWorkerCommands(program);
1413
- // Any command that opens a remote Python bridge keeps the attached worker's
1414
- // idle clock fresh, so the reaper doesn't pause a GPU that is mid-job.
1415
- installWorkerActivityHeartbeat(onPythonBridgeCreated);
1416
- // ---------------------------------------------------------------------------
1417
- // deploy — registered from commands/deploy.ts
1418
- // ---------------------------------------------------------------------------
1419
- registerDeployCommands(program);
1420
- registerAgentCommands(program);
1421
- registerDbCommands(program);
1422
- registerDebugCommands(program);
1423
- registerAppCommands(program);
1424
- registerAppsCommands(program);
1425
- registerValidateCommand(program);
1426
- registerTimelineCommands(program);
1427
- registerSketchCommands(program);
1428
- registerGameCommands(program);
1429
- registerJsScriptCommands(program);
1430
- registerReliabilityCommands(program);
1431
- registerNodeCommands(program);
1432
- registerGenerateCommand(program);
1433
- registerExtensionCommands(program);
1434
- registerEvalCommand(program);
1435
- registerJtbdCommand(program, setupDb);
1436
- registerAffectedCommand(program);
1437
- registerHarnessCommands(program);
1438
- registerCollectionCommands(program);
1439
- registerCostsCommands(program);
1440
- registerErrorsCommands(program);
1441
- registerGenerationsCommands(program);
1442
- registerRunsCommands(program, {
1443
- ensureDb: async () => {
1444
- const dbPath = getDefaultDbPath();
1445
- await migrateSqliteDb(dbPath);
1446
- initDb(dbPath);
1447
- },
1448
- localUserId: LOCAL_USER_ID
1449
- });
1450
- registerAuthCommands(program);
1451
- registerTelegramCommands(program);
1452
- registerAuthoringCommands(program);
1453
- registerTelemetryCommands(program);
1454
- // ---------------------------------------------------------------------------
1455
- program.parse();
1456
- //# sourceMappingURL=nodetool-main.js.map