@hoknie/aip 0.1.0 → 0.2.1

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 (587) hide show
  1. package/dist/app/agents.js +2 -0
  2. package/dist/app/agents.js.map +1 -1
  3. package/dist/app/application.js +41 -3
  4. package/dist/app/application.js.map +1 -1
  5. package/dist/app/lifecycle.js +5 -1
  6. package/dist/app/lifecycle.js.map +1 -1
  7. package/dist/app/timings.js +1 -0
  8. package/dist/app/timings.js.map +1 -1
  9. package/dist/app/wiring.js +1 -0
  10. package/dist/app/wiring.js.map +1 -1
  11. package/dist/cli/main.js +0 -0
  12. package/dist/feature/agents/clients/agy/guard.js +26 -8
  13. package/dist/feature/agents/clients/agy/guard.js.map +1 -1
  14. package/dist/feature/agents/clients/agy/permissions.js +9 -1
  15. package/dist/feature/agents/clients/agy/permissions.js.map +1 -1
  16. package/dist/feature/agents/clients/agy/runtime.js +8 -1
  17. package/dist/feature/agents/clients/agy/runtime.js.map +1 -1
  18. package/dist/feature/agents/clients/claude/index.js +1 -0
  19. package/dist/feature/agents/clients/claude/index.js.map +1 -1
  20. package/dist/feature/agents/clients/claude/models.js +8 -0
  21. package/dist/feature/agents/clients/claude/models.js.map +1 -0
  22. package/dist/feature/agents/clients/claude/parser.js +8 -0
  23. package/dist/feature/agents/clients/claude/parser.js.map +1 -1
  24. package/dist/feature/agents/clients/claude/runtime.js +2 -0
  25. package/dist/feature/agents/clients/claude/runtime.js.map +1 -1
  26. package/dist/feature/agents/clients/opencode/index.js +1 -0
  27. package/dist/feature/agents/clients/opencode/index.js.map +1 -1
  28. package/dist/feature/agents/clients/opencode/models.js +38 -0
  29. package/dist/feature/agents/clients/opencode/models.js.map +1 -0
  30. package/dist/feature/agents/clients/opencode/runtime.js +14 -1
  31. package/dist/feature/agents/clients/opencode/runtime.js.map +1 -1
  32. package/dist/feature/agents/ports/command.js +2 -0
  33. package/dist/feature/agents/ports/command.js.map +1 -0
  34. package/dist/feature/agents/services/agents.js +42 -1
  35. package/dist/feature/agents/services/agents.js.map +1 -1
  36. package/dist/feature/agents/services/catalog.js +1 -1
  37. package/dist/feature/agents/services/catalog.js.map +1 -1
  38. package/dist/feature/agents/types/index.js +2 -0
  39. package/dist/feature/agents/types/index.js.map +1 -1
  40. package/dist/feature/agents/types/mcp/env.js +54 -0
  41. package/dist/feature/agents/types/mcp/env.js.map +1 -0
  42. package/dist/feature/agents/types/message.js +1 -0
  43. package/dist/feature/agents/types/message.js.map +1 -1
  44. package/dist/feature/agents/types/models.js +2 -0
  45. package/dist/feature/agents/types/models.js.map +1 -0
  46. package/dist/feature/agents/types/runtime.js.map +1 -1
  47. package/dist/feature/agents/types/worker-tools.js +2 -0
  48. package/dist/feature/agents/types/worker-tools.js.map +1 -1
  49. package/dist/feature/network/ports/changed.js +2 -0
  50. package/dist/feature/network/ports/changed.js.map +1 -0
  51. package/dist/feature/network/ports/index.js +2 -0
  52. package/dist/feature/network/ports/index.js.map +1 -0
  53. package/dist/feature/network/services/create.js +5 -0
  54. package/dist/feature/network/services/create.js.map +1 -0
  55. package/dist/feature/network/services/index.js +3 -0
  56. package/dist/feature/network/services/index.js.map +1 -0
  57. package/dist/feature/network/services/monitor.js +140 -0
  58. package/dist/feature/network/services/monitor.js.map +1 -0
  59. package/dist/feature/network/types/index.js +4 -0
  60. package/dist/feature/network/types/index.js.map +1 -0
  61. package/dist/feature/network/types/network.js +8 -0
  62. package/dist/feature/network/types/network.js.map +1 -0
  63. package/dist/feature/network/types/proxy.js +95 -0
  64. package/dist/feature/network/types/proxy.js.map +1 -0
  65. package/dist/feature/network/types/state.js +36 -0
  66. package/dist/feature/network/types/state.js.map +1 -0
  67. package/dist/feature/observers/repositories/observers.js +7 -1
  68. package/dist/feature/observers/repositories/observers.js.map +1 -1
  69. package/dist/feature/observers/services/observers.js +33 -5
  70. package/dist/feature/observers/services/observers.js.map +1 -1
  71. package/dist/feature/observers/services/settings-check.js +1 -7
  72. package/dist/feature/observers/services/settings-check.js.map +1 -1
  73. package/dist/feature/observers/types/plan-repairs.js +48 -16
  74. package/dist/feature/observers/types/plan-repairs.js.map +1 -1
  75. package/dist/feature/observers/types/settings.js +0 -1
  76. package/dist/feature/observers/types/settings.js.map +1 -1
  77. package/dist/feature/queue/repositories/queues.js +28 -4
  78. package/dist/feature/queue/repositories/queues.js.map +1 -1
  79. package/dist/feature/queue/services/control.js +46 -8
  80. package/dist/feature/queue/services/control.js.map +1 -1
  81. package/dist/feature/queue/services/store.js +4 -0
  82. package/dist/feature/queue/services/store.js.map +1 -1
  83. package/dist/feature/queue/services/task-tags.js +4 -1
  84. package/dist/feature/queue/services/task-tags.js.map +1 -1
  85. package/dist/feature/queue/types/advance.js +29 -12
  86. package/dist/feature/queue/types/advance.js.map +1 -1
  87. package/dist/feature/queue/types/filter.js +36 -0
  88. package/dist/feature/queue/types/filter.js.map +1 -0
  89. package/dist/feature/queue/types/index.js +1 -0
  90. package/dist/feature/queue/types/index.js.map +1 -1
  91. package/dist/feature/queue/types/items.js +1 -0
  92. package/dist/feature/queue/types/items.js.map +1 -1
  93. package/dist/feature/queue/types/returns.js +18 -3
  94. package/dist/feature/queue/types/returns.js.map +1 -1
  95. package/dist/feature/queue/types/settings.js +14 -3
  96. package/dist/feature/queue/types/settings.js.map +1 -1
  97. package/dist/feature/runs/machine/exits.js +23 -1
  98. package/dist/feature/runs/machine/exits.js.map +1 -1
  99. package/dist/feature/runs/machine/plan.js +38 -16
  100. package/dist/feature/runs/machine/plan.js.map +1 -1
  101. package/dist/feature/runs/machine/repair.js +10 -3
  102. package/dist/feature/runs/machine/repair.js.map +1 -1
  103. package/dist/feature/runs/machine/scheduler.js +10 -3
  104. package/dist/feature/runs/machine/scheduler.js.map +1 -1
  105. package/dist/feature/runs/machine/steps.js +11 -11
  106. package/dist/feature/runs/machine/steps.js.map +1 -1
  107. package/dist/feature/runs/machine/transition.js +16 -2
  108. package/dist/feature/runs/machine/transition.js.map +1 -1
  109. package/dist/feature/runs/repositories/finished-runs.js +14 -10
  110. package/dist/feature/runs/repositories/finished-runs.js.map +1 -1
  111. package/dist/feature/runs/repositories/write.js +1 -1
  112. package/dist/feature/runs/repositories/write.js.map +1 -1
  113. package/dist/feature/runs/services/create.js +1 -0
  114. package/dist/feature/runs/services/create.js.map +1 -1
  115. package/dist/feature/runs/services/effects/actions.js +3 -2
  116. package/dist/feature/runs/services/effects/actions.js.map +1 -1
  117. package/dist/feature/runs/services/effects/attempts.js +61 -13
  118. package/dist/feature/runs/services/effects/attempts.js.map +1 -1
  119. package/dist/feature/runs/services/effects/context.js.map +1 -1
  120. package/dist/feature/runs/services/effects/effects.js +5 -0
  121. package/dist/feature/runs/services/effects/effects.js.map +1 -1
  122. package/dist/feature/runs/services/effects/naming.js +4 -1
  123. package/dist/feature/runs/services/effects/naming.js.map +1 -1
  124. package/dist/feature/runs/services/effects/proxy.js +5 -0
  125. package/dist/feature/runs/services/effects/proxy.js.map +1 -0
  126. package/dist/feature/runs/services/effects/runtime-check.js +20 -0
  127. package/dist/feature/runs/services/effects/runtime-check.js.map +1 -0
  128. package/dist/feature/runs/services/engine.js +14 -5
  129. package/dist/feature/runs/services/engine.js.map +1 -1
  130. package/dist/feature/runs/services/index.js.map +1 -1
  131. package/dist/feature/runs/services/reads.js +40 -1
  132. package/dist/feature/runs/services/reads.js.map +1 -1
  133. package/dist/feature/runs/services/requests.js +7 -1
  134. package/dist/feature/runs/services/requests.js.map +1 -1
  135. package/dist/feature/runs/services/states.js +2 -2
  136. package/dist/feature/runs/services/states.js.map +1 -1
  137. package/dist/feature/runs/types/attempt.js +8 -0
  138. package/dist/feature/runs/types/attempt.js.map +1 -1
  139. package/dist/feature/runs/types/group.js.map +1 -1
  140. package/dist/feature/runs/types/input.js +33 -0
  141. package/dist/feature/runs/types/input.js.map +1 -1
  142. package/dist/feature/runs/types/limits.js +13 -1
  143. package/dist/feature/runs/types/limits.js.map +1 -1
  144. package/dist/feature/stats/repositories/index.js +4 -0
  145. package/dist/feature/stats/repositories/index.js.map +1 -0
  146. package/dist/feature/stats/repositories/meta.js +19 -0
  147. package/dist/feature/stats/repositories/meta.js.map +1 -0
  148. package/dist/feature/stats/repositories/records.js +46 -0
  149. package/dist/feature/stats/repositories/records.js.map +1 -0
  150. package/dist/feature/stats/repositories/report.js +105 -0
  151. package/dist/feature/stats/repositories/report.js.map +1 -0
  152. package/dist/feature/stats/services/create.js +44 -0
  153. package/dist/feature/stats/services/create.js.map +1 -0
  154. package/dist/feature/stats/services/index.js +4 -0
  155. package/dist/feature/stats/services/index.js.map +1 -0
  156. package/dist/feature/stats/services/ledger.js +137 -0
  157. package/dist/feature/stats/services/ledger.js.map +1 -0
  158. package/dist/feature/stats/services/report.js +56 -0
  159. package/dist/feature/stats/services/report.js.map +1 -0
  160. package/dist/feature/stats/types/aggregate.js +179 -0
  161. package/dist/feature/stats/types/aggregate.js.map +1 -0
  162. package/dist/feature/stats/types/capture.js +79 -0
  163. package/dist/feature/stats/types/capture.js.map +1 -0
  164. package/dist/feature/stats/types/index.js +6 -0
  165. package/dist/feature/stats/types/index.js.map +1 -0
  166. package/dist/feature/stats/types/records.js +5 -0
  167. package/dist/feature/stats/types/records.js.map +1 -0
  168. package/dist/feature/stats/types/report.js +25 -0
  169. package/dist/feature/stats/types/report.js.map +1 -0
  170. package/dist/feature/stats/types/settings.js +2 -0
  171. package/dist/feature/stats/types/settings.js.map +1 -0
  172. package/dist/feature/swarm-config/services/assemble.js +1 -1
  173. package/dist/feature/swarm-config/services/assemble.js.map +1 -1
  174. package/dist/feature/swarm-config/services/index.js +4 -2
  175. package/dist/feature/swarm-config/services/index.js.map +1 -1
  176. package/dist/feature/swarm-config/services/load.js +17 -2
  177. package/dist/feature/swarm-config/services/load.js.map +1 -1
  178. package/dist/feature/swarm-config/services/sections/mcp-servers.js +128 -0
  179. package/dist/feature/swarm-config/services/sections/mcp-servers.js.map +1 -0
  180. package/dist/feature/swarm-config/services/sections/stats.js +28 -0
  181. package/dist/feature/swarm-config/services/sections/stats.js.map +1 -0
  182. package/dist/feature/swarm-config/services/settings.js +23 -1
  183. package/dist/feature/swarm-config/services/settings.js.map +1 -1
  184. package/dist/feature/swarm-config/services/validate-actions.js +9 -1
  185. package/dist/feature/swarm-config/services/validate-actions.js.map +1 -1
  186. package/dist/feature/swarm-config/services/validate-runtimes.js +3 -51
  187. package/dist/feature/swarm-config/services/validate-runtimes.js.map +1 -1
  188. package/dist/feature/swarm-config/services/validate-settings.js +65 -0
  189. package/dist/feature/swarm-config/services/validate-settings.js.map +1 -1
  190. package/dist/feature/swarm-config/services/validate-specialists.js +5 -4
  191. package/dist/feature/swarm-config/services/validate-specialists.js.map +1 -1
  192. package/dist/feature/swarm-config/services/validate.js +24 -8
  193. package/dist/feature/swarm-config/services/validate.js.map +1 -1
  194. package/dist/feature/swarm-config/types/action.js +9 -0
  195. package/dist/feature/swarm-config/types/action.js.map +1 -1
  196. package/dist/feature/swarm-config/types/index.js +1 -0
  197. package/dist/feature/swarm-config/types/index.js.map +1 -1
  198. package/dist/feature/swarm-config/types/mcp/reference.js +40 -0
  199. package/dist/feature/swarm-config/types/mcp/reference.js.map +1 -0
  200. package/dist/feature/swarm-config/types/merge.js +1 -0
  201. package/dist/feature/swarm-config/types/merge.js.map +1 -1
  202. package/dist/feature/swarm-config/types/settings.js +37 -5
  203. package/dist/feature/swarm-config/types/settings.js.map +1 -1
  204. package/dist/feature/swarm-config/types/specialist.js.map +1 -1
  205. package/dist/feature/swarm-edit/services/config-edits.js +26 -1
  206. package/dist/feature/swarm-edit/services/config-edits.js.map +1 -1
  207. package/dist/feature/swarm-edit/services/editor-settings.js +36 -7
  208. package/dist/feature/swarm-edit/services/editor-settings.js.map +1 -1
  209. package/dist/feature/swarm-edit/services/editor-view.js +2 -0
  210. package/dist/feature/swarm-edit/services/editor-view.js.map +1 -1
  211. package/dist/feature/swarm-edit/services/index.js +1 -0
  212. package/dist/feature/swarm-edit/services/index.js.map +1 -1
  213. package/dist/feature/swarm-edit/services/mcp/editor-mcp.js +51 -0
  214. package/dist/feature/swarm-edit/services/mcp/editor-mcp.js.map +1 -0
  215. package/dist/feature/swarm-edit/services/mcp/plan-mcp-server.js +93 -0
  216. package/dist/feature/swarm-edit/services/mcp/plan-mcp-server.js.map +1 -0
  217. package/dist/feature/swarm-edit/services/plan-settings.js +3 -1
  218. package/dist/feature/swarm-edit/services/plan-settings.js.map +1 -1
  219. package/dist/feature/swarm-edit/types/editor.js.map +1 -1
  220. package/dist/feature/swarm-edit/types/setting-fields.js +12 -0
  221. package/dist/feature/swarm-edit/types/setting-fields.js.map +1 -1
  222. package/dist/platform/git/delivery.js +1 -1
  223. package/dist/platform/git/delivery.js.map +1 -1
  224. package/dist/platform/network/index.js +4 -0
  225. package/dist/platform/network/index.js.map +1 -0
  226. package/dist/platform/network/interfaces.js +7 -0
  227. package/dist/platform/network/interfaces.js.map +1 -0
  228. package/dist/platform/network/probe.js +128 -0
  229. package/dist/platform/network/probe.js.map +1 -0
  230. package/dist/platform/network/tunnel.js +87 -0
  231. package/dist/platform/network/tunnel.js.map +1 -0
  232. package/dist/platform/process/command.js +23 -0
  233. package/dist/platform/process/command.js.map +1 -0
  234. package/dist/platform/process/index.js +1 -0
  235. package/dist/platform/process/index.js.map +1 -1
  236. package/dist/platform/sqlite/migrations.js +3 -0
  237. package/dist/platform/sqlite/migrations.js.map +1 -1
  238. package/dist/platform/sqlite/stats-migration.js +42 -0
  239. package/dist/platform/sqlite/stats-migration.js.map +1 -0
  240. package/dist/presentation/cli/commands/queue-edit.js +23 -1
  241. package/dist/presentation/cli/commands/queue-edit.js.map +1 -1
  242. package/dist/presentation/cli/commands/stats.js +41 -0
  243. package/dist/presentation/cli/commands/stats.js.map +1 -0
  244. package/dist/presentation/cli/help.js +1 -1
  245. package/dist/presentation/cli/help.js.map +1 -1
  246. package/dist/presentation/cli/local/config-check.js +23 -5
  247. package/dist/presentation/cli/local/config-check.js.map +1 -1
  248. package/dist/presentation/cli/program.js +2 -0
  249. package/dist/presentation/cli/program.js.map +1 -1
  250. package/dist/presentation/format/index.js +1 -0
  251. package/dist/presentation/format/index.js.map +1 -1
  252. package/dist/presentation/format/queue.js +15 -2
  253. package/dist/presentation/format/queue.js.map +1 -1
  254. package/dist/presentation/format/runs.js +8 -1
  255. package/dist/presentation/format/runs.js.map +1 -1
  256. package/dist/presentation/format/stats.js +79 -0
  257. package/dist/presentation/format/stats.js.map +1 -0
  258. package/dist/presentation/ipc/contract/agents.js +18 -0
  259. package/dist/presentation/ipc/contract/agents.js.map +1 -1
  260. package/dist/presentation/ipc/contract/config.js +26 -0
  261. package/dist/presentation/ipc/contract/config.js.map +1 -1
  262. package/dist/presentation/ipc/contract/envelope.js +4 -1
  263. package/dist/presentation/ipc/contract/envelope.js.map +1 -1
  264. package/dist/presentation/ipc/contract/groups.js +9 -0
  265. package/dist/presentation/ipc/contract/groups.js.map +1 -1
  266. package/dist/presentation/ipc/contract/index.js +1 -0
  267. package/dist/presentation/ipc/contract/index.js.map +1 -1
  268. package/dist/presentation/ipc/contract/panel.js +11 -0
  269. package/dist/presentation/ipc/contract/panel.js.map +1 -1
  270. package/dist/presentation/ipc/contract/queue.js +11 -1
  271. package/dist/presentation/ipc/contract/queue.js.map +1 -1
  272. package/dist/presentation/ipc/contract/responses/index.js +1 -0
  273. package/dist/presentation/ipc/contract/responses/index.js.map +1 -1
  274. package/dist/presentation/ipc/contract/responses/stats.js +67 -0
  275. package/dist/presentation/ipc/contract/responses/stats.js.map +1 -0
  276. package/dist/presentation/ipc/contract/runs.js +10 -0
  277. package/dist/presentation/ipc/contract/runs.js.map +1 -1
  278. package/dist/presentation/ipc/contract/stats/stats.js +20 -0
  279. package/dist/presentation/ipc/contract/stats/stats.js.map +1 -0
  280. package/dist/presentation/ipc/handlers/config.js +7 -0
  281. package/dist/presentation/ipc/handlers/config.js.map +1 -1
  282. package/dist/presentation/ipc/handlers/groups.js +8 -0
  283. package/dist/presentation/ipc/handlers/groups.js.map +1 -1
  284. package/dist/presentation/ipc/handlers/runs.js +2 -1
  285. package/dist/presentation/ipc/handlers/runs.js.map +1 -1
  286. package/dist/presentation/ipc/handlers/stats.js +17 -0
  287. package/dist/presentation/ipc/handlers/stats.js.map +1 -0
  288. package/dist/presentation/ipc/handlers/system.js +2 -0
  289. package/dist/presentation/ipc/handlers/system.js.map +1 -1
  290. package/dist/presentation/ipc/handlers/table.js +2 -0
  291. package/dist/presentation/ipc/handlers/table.js.map +1 -1
  292. package/dist/presentation/ipc/publisher.js +1 -0
  293. package/dist/presentation/ipc/publisher.js.map +1 -1
  294. package/dist/presentation/ipc/snapshots.js +2 -2
  295. package/dist/presentation/ipc/snapshots.js.map +1 -1
  296. package/dist/presentation/ipc/views/catalog.js +3 -3
  297. package/dist/presentation/ipc/views/catalog.js.map +1 -1
  298. package/dist/presentation/ipc/views/index.js +1 -0
  299. package/dist/presentation/ipc/views/index.js.map +1 -1
  300. package/dist/presentation/ipc/views/observers.js +2 -2
  301. package/dist/presentation/ipc/views/observers.js.map +1 -1
  302. package/dist/presentation/ipc/views/queue.js +9 -2
  303. package/dist/presentation/ipc/views/queue.js.map +1 -1
  304. package/dist/presentation/ipc/views/runs.js +3 -4
  305. package/dist/presentation/ipc/views/runs.js.map +1 -1
  306. package/dist/presentation/ipc/views/stats.js +5 -0
  307. package/dist/presentation/ipc/views/stats.js.map +1 -0
  308. package/dist/presentation/mcp/host-queue-control.js +11 -2
  309. package/dist/presentation/mcp/host-queue-control.js.map +1 -1
  310. package/dist/presentation/mcp/worker-extra.js +2 -2
  311. package/dist/presentation/mcp/worker-extra.js.map +1 -1
  312. package/dist/presentation/mcp/worker-read.js +45 -0
  313. package/dist/presentation/mcp/worker-read.js.map +1 -0
  314. package/dist/presentation/mcp/worker.js +2 -0
  315. package/dist/presentation/mcp/worker.js.map +1 -1
  316. package/dist/presentation/web/hub.js +4 -0
  317. package/dist/presentation/web/hub.js.map +1 -1
  318. package/dist/presentation/web/panel/directories.js +1 -1
  319. package/dist/presentation/web/panel/directories.js.map +1 -1
  320. package/dist/presentation/web/panel/system.js +1 -0
  321. package/dist/presentation/web/panel/system.js.map +1 -1
  322. package/dist/presentation/web/request.js +28 -1
  323. package/dist/presentation/web/request.js.map +1 -1
  324. package/dist/presentation/web/routes/catalog/mcp-servers.js +50 -0
  325. package/dist/presentation/web/routes/catalog/mcp-servers.js.map +1 -0
  326. package/dist/presentation/web/routes/config.js +5 -0
  327. package/dist/presentation/web/routes/config.js.map +1 -1
  328. package/dist/presentation/web/routes/runs.js +5 -0
  329. package/dist/presentation/web/routes/runs.js.map +1 -1
  330. package/dist/presentation/web/routes/stats/stats.js +22 -0
  331. package/dist/presentation/web/routes/stats/stats.js.map +1 -0
  332. package/dist/presentation/web/server.js +5 -1
  333. package/dist/presentation/web/server.js.map +1 -1
  334. package/dist/web/assets/FilterColumn-BrQWIM5F.js +1 -0
  335. package/dist/web/assets/SharedPipelinesGroup-WFngQrqI.js +1 -0
  336. package/dist/web/assets/badge-B_khFsd6.js +1 -0
  337. package/dist/web/assets/{card-DkikoTxR.js → card-COXjnc-y.js} +1 -1
  338. package/dist/web/assets/empty-Eb-EZDPX.js +41 -0
  339. package/dist/web/assets/index-DEXoIe2a.js +21 -0
  340. package/dist/web/assets/index-DMlIe0VD.css +2 -0
  341. package/dist/web/assets/locales-BlBJo1PR.js +1 -0
  342. package/dist/web/assets/pipelines-B3cdeex_.js +10 -0
  343. package/dist/web/assets/queue-HMUImu0E.js +16 -0
  344. package/dist/web/assets/select-MHus_Unr.js +1 -0
  345. package/dist/web/assets/settingFields-DVg9TQK2.js +1 -0
  346. package/dist/web/assets/settings-CpeEsUXX.js +6 -0
  347. package/dist/web/assets/skeleton-CWY1nRvW.js +1 -0
  348. package/dist/web/assets/specialists-BkLXuqUd.js +1 -0
  349. package/dist/web/assets/stats-DRg_5vll.js +1 -0
  350. package/dist/web/assets/topology-DGTNdDHf.js +1 -0
  351. package/dist/web/assets/trash-CFJeuRuc.js +1 -0
  352. package/dist/web/assets/useListDrag-B7Wlt2u9.js +1 -0
  353. package/dist/web/index.html +7 -6
  354. package/integrations/claude-code/.claude-plugin/plugin.json +1 -1
  355. package/package.json +1 -1
  356. package/dist/cli/clean.js +0 -71
  357. package/dist/cli/clean.js.map +0 -1
  358. package/dist/cli/commands.js +0 -963
  359. package/dist/cli/commands.js.map +0 -1
  360. package/dist/cli/config-check.js +0 -173
  361. package/dist/cli/config-check.js.map +0 -1
  362. package/dist/cli/daemon.js +0 -199
  363. package/dist/cli/daemon.js.map +0 -1
  364. package/dist/cli/help.js +0 -50
  365. package/dist/cli/help.js.map +0 -1
  366. package/dist/cli/init.js +0 -43
  367. package/dist/cli/init.js.map +0 -1
  368. package/dist/cli/io.js +0 -13
  369. package/dist/cli/io.js.map +0 -1
  370. package/dist/cli/probe.js +0 -12
  371. package/dist/cli/probe.js.map +0 -1
  372. package/dist/cli/program.js +0 -48
  373. package/dist/cli/program.js.map +0 -1
  374. package/dist/cli/setup.js +0 -406
  375. package/dist/cli/setup.js.map +0 -1
  376. package/dist/cli/version.js +0 -6
  377. package/dist/cli/version.js.map +0 -1
  378. package/dist/cli/watch.js +0 -24
  379. package/dist/cli/watch.js.map +0 -1
  380. package/dist/cli/web/daemon-panel.js +0 -185
  381. package/dist/cli/web/daemon-panel.js.map +0 -1
  382. package/dist/cli/web/default-repository.js +0 -12
  383. package/dist/cli/web/default-repository.js.map +0 -1
  384. package/dist/cli/web/errors.js +0 -60
  385. package/dist/cli/web/errors.js.map +0 -1
  386. package/dist/cli/web/open.js +0 -12
  387. package/dist/cli/web/open.js.map +0 -1
  388. package/dist/cli/web/page.js +0 -465
  389. package/dist/cli/web/page.js.map +0 -1
  390. package/dist/cli/web/server.js +0 -1191
  391. package/dist/cli/web/server.js.map +0 -1
  392. package/dist/cli/web/standby.js +0 -119
  393. package/dist/cli/web/standby.js.map +0 -1
  394. package/dist/cli/web/state.js +0 -69
  395. package/dist/cli/web/state.js.map +0 -1
  396. package/dist/cli/web/system.js +0 -66
  397. package/dist/cli/web/system.js.map +0 -1
  398. package/dist/cli/web-control.js +0 -173
  399. package/dist/cli/web-control.js.map +0 -1
  400. package/dist/config/discover.js +0 -25
  401. package/dist/config/discover.js.map +0 -1
  402. package/dist/config/duration.js +0 -17
  403. package/dist/config/duration.js.map +0 -1
  404. package/dist/config/edit.js +0 -966
  405. package/dist/config/edit.js.map +0 -1
  406. package/dist/config/errors.js +0 -29
  407. package/dist/config/errors.js.map +0 -1
  408. package/dist/config/index.js +0 -14
  409. package/dist/config/index.js.map +0 -1
  410. package/dist/config/load.js +0 -412
  411. package/dist/config/load.js.map +0 -1
  412. package/dist/config/merge.js +0 -45
  413. package/dist/config/merge.js.map +0 -1
  414. package/dist/config/model.js +0 -171
  415. package/dist/config/model.js.map +0 -1
  416. package/dist/config/paths.js +0 -31
  417. package/dist/config/paths.js.map +0 -1
  418. package/dist/config/prompt.js +0 -33
  419. package/dist/config/prompt.js.map +0 -1
  420. package/dist/config/shared-pipelines.js +0 -71
  421. package/dist/config/shared-pipelines.js.map +0 -1
  422. package/dist/config/shared-specialists.js +0 -68
  423. package/dist/config/shared-specialists.js.map +0 -1
  424. package/dist/config/shared-workflows.js +0 -71
  425. package/dist/config/shared-workflows.js.map +0 -1
  426. package/dist/config/specialist-tags.js +0 -214
  427. package/dist/config/specialist-tags.js.map +0 -1
  428. package/dist/config/tag-names.js +0 -43
  429. package/dist/config/tag-names.js.map +0 -1
  430. package/dist/config/validate.js +0 -872
  431. package/dist/config/validate.js.map +0 -1
  432. package/dist/core/artifacts.js +0 -37
  433. package/dist/core/artifacts.js.map +0 -1
  434. package/dist/core/create.js +0 -75
  435. package/dist/core/create.js.map +0 -1
  436. package/dist/core/delivery.js +0 -366
  437. package/dist/core/delivery.js.map +0 -1
  438. package/dist/core/errors.js +0 -7
  439. package/dist/core/errors.js.map +0 -1
  440. package/dist/core/ids.js +0 -99
  441. package/dist/core/ids.js.map +0 -1
  442. package/dist/core/index.js +0 -21
  443. package/dist/core/index.js.map +0 -1
  444. package/dist/core/input.js +0 -45
  445. package/dist/core/input.js.map +0 -1
  446. package/dist/core/machine.js +0 -1021
  447. package/dist/core/machine.js.map +0 -1
  448. package/dist/core/model.js +0 -460
  449. package/dist/core/model.js.map +0 -1
  450. package/dist/core/observer.js +0 -193
  451. package/dist/core/observer.js.map +0 -1
  452. package/dist/core/occupancy.js +0 -63
  453. package/dist/core/occupancy.js.map +0 -1
  454. package/dist/core/permissions.js +0 -222
  455. package/dist/core/permissions.js.map +0 -1
  456. package/dist/core/plan.js +0 -99
  457. package/dist/core/plan.js.map +0 -1
  458. package/dist/core/progress.js +0 -43
  459. package/dist/core/progress.js.map +0 -1
  460. package/dist/core/questions.js +0 -19
  461. package/dist/core/questions.js.map +0 -1
  462. package/dist/core/queue.js +0 -859
  463. package/dist/core/queue.js.map +0 -1
  464. package/dist/core/retryable.js +0 -8
  465. package/dist/core/retryable.js.map +0 -1
  466. package/dist/core/scheduler.js +0 -160
  467. package/dist/core/scheduler.js.map +0 -1
  468. package/dist/core/skip.js +0 -109
  469. package/dist/core/skip.js.map +0 -1
  470. package/dist/core/stages.js +0 -304
  471. package/dist/core/stages.js.map +0 -1
  472. package/dist/core/summary.js +0 -35
  473. package/dist/core/summary.js.map +0 -1
  474. package/dist/core/tags.js +0 -184
  475. package/dist/core/tags.js.map +0 -1
  476. package/dist/core/topology.js +0 -162
  477. package/dist/core/topology.js.map +0 -1
  478. package/dist/daemon/artifacts.js +0 -84
  479. package/dist/daemon/artifacts.js.map +0 -1
  480. package/dist/daemon/daemon.js +0 -1442
  481. package/dist/daemon/daemon.js.map +0 -1
  482. package/dist/daemon/executor.js +0 -749
  483. package/dist/daemon/executor.js.map +0 -1
  484. package/dist/daemon/helpers.js +0 -38
  485. package/dist/daemon/helpers.js.map +0 -1
  486. package/dist/daemon/index.js +0 -4
  487. package/dist/daemon/index.js.map +0 -1
  488. package/dist/daemon/logs.js +0 -69
  489. package/dist/daemon/logs.js.map +0 -1
  490. package/dist/daemon/observers.js +0 -93
  491. package/dist/daemon/observers.js.map +0 -1
  492. package/dist/daemon/patches.js +0 -76
  493. package/dist/daemon/patches.js.map +0 -1
  494. package/dist/daemon/ports.js +0 -2
  495. package/dist/daemon/ports.js.map +0 -1
  496. package/dist/daemon/processes.js +0 -98
  497. package/dist/daemon/processes.js.map +0 -1
  498. package/dist/daemon/repositories.js +0 -2
  499. package/dist/daemon/repositories.js.map +0 -1
  500. package/dist/daemon/server.js +0 -164
  501. package/dist/daemon/server.js.map +0 -1
  502. package/dist/daemon/supervisor.js +0 -140
  503. package/dist/daemon/supervisor.js.map +0 -1
  504. package/dist/daemon/timings.js +0 -23
  505. package/dist/daemon/timings.js.map +0 -1
  506. package/dist/git/delivery.js +0 -284
  507. package/dist/git/delivery.js.map +0 -1
  508. package/dist/git/index.js +0 -4
  509. package/dist/git/index.js.map +0 -1
  510. package/dist/git/runner.js +0 -60
  511. package/dist/git/runner.js.map +0 -1
  512. package/dist/git/workspace.js +0 -366
  513. package/dist/git/workspace.js.map +0 -1
  514. package/dist/mcp/host.js +0 -401
  515. package/dist/mcp/host.js.map +0 -1
  516. package/dist/mcp/index.js +0 -3
  517. package/dist/mcp/index.js.map +0 -1
  518. package/dist/mcp/tools.js +0 -19
  519. package/dist/mcp/tools.js.map +0 -1
  520. package/dist/mcp/version.js +0 -5
  521. package/dist/mcp/version.js.map +0 -1
  522. package/dist/mcp/worker.js +0 -230
  523. package/dist/mcp/worker.js.map +0 -1
  524. package/dist/presentation/web/routes/directories.js +0 -60
  525. package/dist/presentation/web/routes/directories.js.map +0 -1
  526. package/dist/protocol/autostart.js +0 -171
  527. package/dist/protocol/autostart.js.map +0 -1
  528. package/dist/protocol/build.js +0 -38
  529. package/dist/protocol/build.js.map +0 -1
  530. package/dist/protocol/catalog.js +0 -18
  531. package/dist/protocol/catalog.js.map +0 -1
  532. package/dist/protocol/client.js +0 -83
  533. package/dist/protocol/client.js.map +0 -1
  534. package/dist/protocol/format.js +0 -477
  535. package/dist/protocol/format.js.map +0 -1
  536. package/dist/protocol/index.js +0 -11
  537. package/dist/protocol/index.js.map +0 -1
  538. package/dist/protocol/messages.js +0 -598
  539. package/dist/protocol/messages.js.map +0 -1
  540. package/dist/protocol/style.js +0 -81
  541. package/dist/protocol/style.js.map +0 -1
  542. package/dist/protocol/transcript.js +0 -49
  543. package/dist/protocol/transcript.js.map +0 -1
  544. package/dist/protocol/views.js +0 -696
  545. package/dist/protocol/views.js.map +0 -1
  546. package/dist/runtime/catalog.js +0 -117
  547. package/dist/runtime/catalog.js.map +0 -1
  548. package/dist/runtime/claude.js +0 -399
  549. package/dist/runtime/claude.js.map +0 -1
  550. package/dist/runtime/index.js +0 -34
  551. package/dist/runtime/index.js.map +0 -1
  552. package/dist/runtime/message.js +0 -48
  553. package/dist/runtime/message.js.map +0 -1
  554. package/dist/runtime/naming.js +0 -69
  555. package/dist/runtime/naming.js.map +0 -1
  556. package/dist/runtime/opencode.js +0 -189
  557. package/dist/runtime/opencode.js.map +0 -1
  558. package/dist/runtime/skills.js +0 -17
  559. package/dist/runtime/skills.js.map +0 -1
  560. package/dist/runtime/transcript.js +0 -227
  561. package/dist/runtime/transcript.js.map +0 -1
  562. package/dist/runtime/types.js +0 -12
  563. package/dist/runtime/types.js.map +0 -1
  564. package/dist/runtime/which.js +0 -21
  565. package/dist/runtime/which.js.map +0 -1
  566. package/dist/store/index.js +0 -3
  567. package/dist/store/index.js.map +0 -1
  568. package/dist/store/schema.js +0 -286
  569. package/dist/store/schema.js.map +0 -1
  570. package/dist/store/store.js +0 -491
  571. package/dist/store/store.js.map +0 -1
  572. package/dist/web/assets/EntryList-CnfGgjEY.js +0 -1
  573. package/dist/web/assets/FilePath-C0X8-keS.js +0 -1
  574. package/dist/web/assets/SettingsForm-BcyBWJbn.js +0 -1
  575. package/dist/web/assets/SharedPipelinesGroup-a368-IQ0.js +0 -1
  576. package/dist/web/assets/index-B-oJ93zH.js +0 -22
  577. package/dist/web/assets/index-BZE36gYR.css +0 -2
  578. package/dist/web/assets/locales-DtRrxYzg.js +0 -1
  579. package/dist/web/assets/pipelines-D48ggDNe.js +0 -1
  580. package/dist/web/assets/queue-D8_RY4IY.js +0 -16
  581. package/dist/web/assets/select-J4oIrmYh.js +0 -1
  582. package/dist/web/assets/settings-B0-0Vaia.js +0 -2
  583. package/dist/web/assets/skeleton-CCKCQF5n.js +0 -1
  584. package/dist/web/assets/specialists-DH8tyluO.js +0 -1
  585. package/dist/web/assets/switch-CWFAgxG1.js +0 -41
  586. package/dist/web/assets/topology-CNQ28AB2.js +0 -7
  587. /package/dist/web/assets/{topology-DLioOiRN.css → pipelines-DLioOiRN.css} +0 -0
@@ -1,963 +0,0 @@
1
- import { readFileSync } from 'node:fs';
2
- import { relative, resolve } from 'node:path';
3
- import { Option } from 'commander';
4
- import { parse as parseYaml } from 'yaml';
5
- import { DELIVERY_MODES } from '../feature/swarm-config/types/index.js';
6
- import { configPaths, loadWebSettings } from '../feature/swarm-config/services/index.js';
7
- import { socketPath, stateDirectoryFromEnvironment } from '../platform/paths/index.js';
8
- import { formatApply, formatGroup, formatQueue, formatRepositories, formatRun, formatRunCreated, formatRunQueued, formatRunList, formatTagLabels, formatTagList, filterByTags, TAG_COLORS, plainStyle, proposedGroupSchema, request, subscribe, } from '../protocol/index.js';
9
- import { examples as renderExamples, HELP_GROUPS } from './help.js';
10
- import { writeLine, failLine, usage } from './io.js';
11
- import { VERSION } from './version.js';
12
- import { latestRepository } from './web/default-repository.js';
13
- import { daemon, registerDaemon } from './daemon.js';
14
- import { openBrowser } from './web/open.js';
15
- import { readPanelState } from './web/state.js';
16
- import { registerWebControl } from './web-control.js';
17
- import { watch } from './watch.js';
18
- export function context(io, style) {
19
- const directory = stateDirectoryFromEnvironment(io.env);
20
- return {
21
- stateDirectory: directory,
22
- socket: socketPath(directory),
23
- entry: io.entry,
24
- style,
25
- io,
26
- };
27
- }
28
- export async function call(ctx, method, params) {
29
- await daemon(ctx);
30
- return request(ctx.socket, method, params);
31
- }
32
- /** The helpers of the commands, bound to the streams and the style of one call. */
33
- function bind(io, style) {
34
- const print = (value) => writeLine(io, value);
35
- return {
36
- print,
37
- output: (json, text, data) => print(json ? JSON.stringify(data, null, 2) : text),
38
- examples: (lines) => renderExamples(lines, style),
39
- context: () => context(io, style),
40
- activeStyle: style,
41
- };
42
- }
43
- function readGroups(file) {
44
- return proposedGroupSchema
45
- .array()
46
- .min(1)
47
- .parse(parseYaml(readFileSync(file, 'utf8')));
48
- }
49
- /** Collects a repeatable option into a list. */
50
- function collect(value, previous = []) {
51
- return [...previous, value];
52
- }
53
- function parseDeliveryMode(value) {
54
- if (value === undefined)
55
- return undefined;
56
- const mode = DELIVERY_MODES.find((candidate) => candidate === value);
57
- if (mode === undefined) {
58
- throw usage(`--delivery-mode must be one of: ${DELIVERY_MODES.join(', ')}`);
59
- }
60
- return mode;
61
- }
62
- function parseSwitch(flag, value) {
63
- if (value === undefined)
64
- return undefined;
65
- if (value === 'on')
66
- return true;
67
- if (value === 'off')
68
- return false;
69
- throw usage(`${flag} must be on or off`);
70
- }
71
- function registerQueue(program, io, style) {
72
- const { print, output, examples, context, activeStyle } = bind(io, style);
73
- const showQueue = (json, view) => output(json, formatQueue(view, activeStyle), view);
74
- const queue = program
75
- .command('queue')
76
- .description('Tasks waiting for a start: add, reorder and run them one by one or in parallel');
77
- const taskOptions = (command) => command
78
- .option('-t, --task <text>', 'one task; the pipeline may split it into groups')
79
- .option('-g, --groups <file>', 'YAML or JSON file with a list of { title, task }')
80
- .option('--title <text>', 'title of the run (at most 60 characters)')
81
- .option('--auto-deliver', 'deliver the merged groups automatically, whatever delivery.auto says')
82
- .option('--no-auto-deliver', 'leave the merged groups for `aip apply`')
83
- .option('--delivery-mode <mode>', `how the merged result is delivered: ${DELIVERY_MODES.join(', ')}; whatever delivery.mode says`)
84
- .option('--tag <name>', 'tag of the task; repeat for several', collect)
85
- .option('--parent <run>', 'run id or task number (161 or #161) whose linked task tag the task gets')
86
- .option('--skip <step>', 'step of the pipeline to skip; repeat for several', collect)
87
- .option('--after <id>', 'queue item or run that must be done first; repeat for several', collect);
88
- const common = (command) => command.option('-r, --repo <path>', 'repository path', '.').option('--json', 'print JSON');
89
- common(queue.command('list').description('Show the queue of the repository'))
90
- .addHelpText('after', examples(['aip queue list', 'aip queue list --json']))
91
- .action(async (options) => {
92
- showQueue(options.json, (await call(context(), 'queue', { repository: resolve(options.repo) })));
93
- });
94
- common(taskOptions(queue
95
- .command('add')
96
- .description('Add a task to the end of the queue; it does not start the queue')
97
- .argument('<pipeline>', 'pipeline id from swarm.yaml')
98
- .option('--postpone', 'postpone the task: a running queue does not take it')))
99
- .addHelpText('after', examples([
100
- 'aip queue add feature --task "Add a login form"',
101
- 'aip queue add feature -g g.yaml',
102
- 'aip queue add feature --task "Fix the typo" --skip review --skip qa',
103
- 'aip queue add feature --task "Add the API" --after q1',
104
- 'aip queue add feature --task "Follow-up" --parent 115',
105
- 'aip queue add feature --task "Later" --postpone',
106
- ]))
107
- .action(async (pipeline, options) => {
108
- if ((options.task === undefined) === (options.groups === undefined)) {
109
- throw usage('pass exactly one of --task and --groups');
110
- }
111
- const deliveryMode = parseDeliveryMode(options.deliveryMode);
112
- const view = (await call(context(), 'queue_add', {
113
- repository: resolve(options.repo),
114
- pipeline,
115
- ...(options.task !== undefined ? { task: options.task } : {}),
116
- ...(options.groups !== undefined ? { groups: readGroups(options.groups) } : {}),
117
- ...(options.title !== undefined ? { title: options.title } : {}),
118
- ...(options.autoDeliver !== undefined ? { autoDeliver: options.autoDeliver } : {}),
119
- ...(deliveryMode !== undefined ? { deliveryMode } : {}),
120
- ...(options.tag !== undefined ? { tags: options.tag } : {}),
121
- ...(typeof options.parent === 'string' ? { parent: options.parent } : {}),
122
- ...(options.skip !== undefined ? { skip: options.skip } : {}),
123
- ...(options.after !== undefined ? { after: options.after } : {}),
124
- ...(options.postpone ? { postponed: true } : {}),
125
- }));
126
- if (!options.json)
127
- print(`Added ${view.item}.`);
128
- showQueue(options.json, view);
129
- });
130
- let editAfter = false;
131
- let editNoAfter = false;
132
- let editParent = false;
133
- let editNoParent = false;
134
- common(taskOptions(queue
135
- .command('edit')
136
- .on('option:after', () => (editAfter = true))
137
- .on('option:no-after', () => (editNoAfter = true))
138
- .on('option:parent', () => (editParent = true))
139
- .on('option:no-parent', () => (editNoParent = true))
140
- .description('Change a waiting task')
141
- .argument('<item>', 'item id from `aip queue list`')
142
- .option('-p, --pipeline <id>', 'new pipeline id')
143
- .addOption(new Option('-w, --workflow <id>', 'old name of --pipeline').hideHelp())
144
- .option('--default-auto-deliver', 'follow delivery.auto of the configuration again')
145
- .option('--default-delivery-mode', 'follow delivery.mode of the configuration again')
146
- .option('--no-tags', 'remove all tags of the task')
147
- .option('--no-parent', 'remove the linked task tags of the task')
148
- .option('--no-skips', 'run every step of the pipeline again')
149
- .option('--no-after', 'remove all predecessors of the task')
150
- .option('--postpone', 'postpone the task: a running queue does not take it')
151
- .option('--no-postpone', 'take the task into work again')))
152
- .addHelpText('after', examples([
153
- 'aip queue edit 1 --task "New wording"',
154
- 'aip queue edit 1 --pipeline feature',
155
- 'aip queue edit 1 --skip qa',
156
- 'aip queue edit 1 --no-skips',
157
- 'aip queue edit 2 --after q1',
158
- 'aip queue edit 2 --no-after',
159
- 'aip queue edit 2 --parent 115',
160
- 'aip queue edit 2 --no-parent',
161
- 'aip queue edit 3 --postpone',
162
- 'aip queue edit 3 --no-postpone',
163
- ]))
164
- .action(async (item, options) => {
165
- if (options.pipeline !== undefined && options.workflow !== undefined) {
166
- throw usage('--workflow is the old name of --pipeline; pass only --pipeline');
167
- }
168
- const pipeline = options.pipeline ?? options.workflow;
169
- if (editAfter && editNoAfter) {
170
- throw usage('--no-after cannot be combined with --after');
171
- }
172
- if (editParent && editNoParent) {
173
- throw usage('--no-parent cannot be combined with --parent');
174
- }
175
- if (options.tags === false && options.tag !== undefined) {
176
- throw usage('--no-tags cannot be combined with --tag');
177
- }
178
- if (options.skips === false && options.skip !== undefined) {
179
- throw usage('--no-skips cannot be combined with --skip');
180
- }
181
- if (options.task !== undefined && options.groups !== undefined) {
182
- throw usage('pass at most one of --task and --groups');
183
- }
184
- if (options.defaultAutoDeliver && options.autoDeliver !== undefined) {
185
- throw usage('--default-auto-deliver cannot be combined with --auto-deliver');
186
- }
187
- if (options.defaultDeliveryMode && options.deliveryMode !== undefined) {
188
- throw usage('--default-delivery-mode cannot be combined with --delivery-mode');
189
- }
190
- const deliveryMode = parseDeliveryMode(options.deliveryMode);
191
- showQueue(options.json, (await call(context(), 'queue_edit', {
192
- repository: resolve(options.repo),
193
- item,
194
- ...(pipeline !== undefined ? { pipeline } : {}),
195
- ...(options.task !== undefined ? { task: options.task } : {}),
196
- ...(options.groups !== undefined ? { groups: readGroups(options.groups) } : {}),
197
- ...(options.title !== undefined ? { title: options.title } : {}),
198
- ...(options.defaultAutoDeliver
199
- ? { autoDeliver: null }
200
- : options.autoDeliver !== undefined
201
- ? { autoDeliver: options.autoDeliver }
202
- : {}),
203
- ...(options.defaultDeliveryMode
204
- ? { deliveryMode: null }
205
- : deliveryMode !== undefined
206
- ? { deliveryMode }
207
- : {}),
208
- ...(options.tags === false ? { tags: [] } : {}),
209
- ...(options.tag !== undefined ? { tags: options.tag } : {}),
210
- ...(editNoParent ? { parent: null } : {}),
211
- ...(editParent && typeof options.parent === 'string' ? { parent: options.parent } : {}),
212
- ...(options.skips === false ? { skip: [] } : {}),
213
- ...(options.skip !== undefined ? { skip: options.skip } : {}),
214
- ...(editNoAfter ? { after: [] } : {}),
215
- ...(editAfter && options.after !== undefined ? { after: options.after } : {}),
216
- ...(options.postpone !== undefined ? { postponed: options.postpone } : {}),
217
- })));
218
- });
219
- common(queue
220
- .command('remove')
221
- .description('Remove a waiting task')
222
- .argument('<item>', 'item id from `aip queue list`'))
223
- .addHelpText('after', examples(['aip queue remove 1']))
224
- .action(async (item, options) => {
225
- showQueue(options.json, (await call(context(), 'queue_remove', {
226
- repository: resolve(options.repo),
227
- item,
228
- })));
229
- });
230
- common(queue
231
- .command('move')
232
- .description('Move a waiting task to a position (1 is the first to start)')
233
- .argument('<item>', 'item id')
234
- .argument('<position>', 'new position, from 1'))
235
- .addHelpText('after', examples(['aip queue move 3 1']))
236
- .action(async (item, position, options) => {
237
- showQueue(options.json, (await call(context(), 'queue_edit', {
238
- repository: resolve(options.repo),
239
- item,
240
- position: Number(position),
241
- })));
242
- });
243
- common(queue
244
- .command('start')
245
- .description('Start the queue: take tasks from the beginning, `parallel` at a time')
246
- .option('-p, --parallel <n>', 'runs at the same time (1-20)'))
247
- .addHelpText('after', examples(['aip queue start', 'aip queue start --parallel 2']))
248
- .action(async (options) => {
249
- showQueue(options.json, (await call(context(), 'queue_start', {
250
- repository: resolve(options.repo),
251
- ...(options.parallel !== undefined ? { parallel: Number(options.parallel) } : {}),
252
- })));
253
- });
254
- common(queue
255
- .command('parallel')
256
- .description('Change how many runs the queue holds at the same time; takes effect at once')
257
- .argument('<n>', 'runs at the same time (1-20)'))
258
- .addHelpText('after', examples(['aip queue parallel 3']))
259
- .action(async (n, options) => {
260
- showQueue(options.json, (await call(context(), 'queue_settings', {
261
- repository: resolve(options.repo),
262
- parallel: Number(n),
263
- })));
264
- });
265
- common(queue
266
- .command('settings')
267
- .description('Change queue settings; only the passed ones change, takes effect at once')
268
- .option('-p, --parallel <n>', 'runs at the same time (1-20)')
269
- .option('--autopilot <on|off>', 'a running queue does not stop when it becomes empty')
270
- .option('--auto-answer <on|off>', 'a running queue answers specialists questions')
271
- .option('--skip-failed <on|off>', 'a failed or conflicting run leaves its place')
272
- .option('--on-limit <wait|stop>', 'on a usage limit: wait for the reset, or stop')
273
- .option('--autopilot-answer <text>', 'text the queue answers specialists questions with when auto answer is on')
274
- .option('--default-autopilot-answer', 'answer with the default text again'))
275
- .addHelpText('after', examples([
276
- 'aip queue settings --autopilot on',
277
- 'aip queue settings --auto-answer on',
278
- 'aip queue settings --skip-failed on --parallel 2',
279
- 'aip queue settings --on-limit stop',
280
- 'aip queue settings --autopilot-answer "Agree; pick the simplest option"',
281
- ]))
282
- .action(async (options) => {
283
- if (options.onLimit !== undefined && !['wait', 'stop'].includes(options.onLimit)) {
284
- throw usage('--on-limit must be wait or stop');
285
- }
286
- if (options.defaultAutopilotAnswer && options.autopilotAnswer !== undefined) {
287
- throw usage('--default-autopilot-answer cannot be combined with --autopilot-answer');
288
- }
289
- const autopilot = parseSwitch('--autopilot', options.autopilot);
290
- const autoAnswer = parseSwitch('--auto-answer', options.autoAnswer);
291
- const skipFailed = parseSwitch('--skip-failed', options.skipFailed);
292
- showQueue(options.json, (await call(context(), 'queue_settings', {
293
- repository: resolve(options.repo),
294
- ...(options.parallel !== undefined ? { parallel: Number(options.parallel) } : {}),
295
- ...(autopilot !== undefined ? { autopilot } : {}),
296
- ...(autoAnswer !== undefined ? { autoAnswer } : {}),
297
- ...(skipFailed !== undefined ? { skipFailed } : {}),
298
- ...(options.onLimit !== undefined ? { onLimit: options.onLimit } : {}),
299
- ...(options.defaultAutopilotAnswer
300
- ? { autopilotAnswer: null }
301
- : options.autopilotAnswer !== undefined
302
- ? { autopilotAnswer: options.autopilotAnswer }
303
- : {}),
304
- })));
305
- });
306
- common(queue.command('pause').description('Stop taking tasks; runs already started keep going'))
307
- .addHelpText('after', examples(['aip queue pause']))
308
- .action(async (options) => {
309
- showQueue(options.json, (await call(context(), 'queue_pause', { repository: resolve(options.repo) })));
310
- });
311
- queue
312
- .command('return')
313
- .description('Put a run with failed or cancelled groups back into its queue as the first task; when taken, it continues where it stopped')
314
- .argument('<run-id>', 'run id')
315
- .option('-r, --repo <path>', 'repository path; defaults to the repository of the run')
316
- .option('--json', 'print JSON')
317
- .addHelpText('after', examples(['aip queue return mvzh40j56lht']))
318
- .action(async (run, options) => {
319
- const view = (await call(context(), 'queue_return', {
320
- runId: run,
321
- ...(options.repo !== undefined ? { repository: resolve(options.repo) } : {}),
322
- }));
323
- showQueue(options.json, view);
324
- });
325
- queue
326
- .command('dismiss')
327
- .description('Remove a skipped run from the skipped list of its queue; the run itself does not change')
328
- .argument('<run-id>', 'run id')
329
- .option('-r, --repo <path>', 'repository path; defaults to the repository of the run')
330
- .option('--json', 'print JSON')
331
- .addHelpText('after', examples(['aip queue dismiss mvzh40j56lht']))
332
- .action(async (run, options) => {
333
- const view = (await call(context(), 'queue_dismiss', {
334
- runId: run,
335
- ...(options.repo !== undefined ? { repository: resolve(options.repo) } : {}),
336
- }));
337
- showQueue(options.json, view);
338
- });
339
- common(queue
340
- .command('run')
341
- .description('Turn a waiting task into a run right now, over the parallel limit; the run holds a place')
342
- .argument('<item>', 'item id'))
343
- .addHelpText('after', examples(['aip queue run 2']))
344
- .action(async (item, options) => {
345
- const repository = resolve(options.repo);
346
- const created = (await call(context(), 'queue_run_now', {
347
- repository,
348
- item,
349
- }));
350
- if (options.json) {
351
- output(true, '', created);
352
- return;
353
- }
354
- const queue = (await call(context(), 'queue', { repository }));
355
- output(false, `${formatRunCreated(created, activeStyle)}\nQueue: ${queue.runs.length} of ${queue.parallel} places taken.`, created);
356
- });
357
- }
358
- function registerRepositories(program, io, style) {
359
- const { print, output, examples, context, activeStyle } = bind(io, style);
360
- const repo = program
361
- .command('repo')
362
- .description('Repositories the daemon knows: list, add and remove them');
363
- const show = (json, views) => {
364
- output(json, formatRepositories(views, activeStyle), views);
365
- };
366
- repo
367
- .command('list')
368
- .description('Show known repositories with their unfinished runs, waiting runs and queued tasks')
369
- .option('--json', 'print JSON')
370
- .addHelpText('after', examples(['aip repo list', 'aip repo list --json']))
371
- .action(async (options) => {
372
- show(options.json, (await call(context(), 'repositories', {})));
373
- });
374
- repo
375
- .command('add')
376
- .description('Add a git repository to the list; a subdirectory resolves to its root')
377
- .argument('<path>', 'path inside a git repository')
378
- .option('--json', 'print JSON')
379
- .addHelpText('after', examples(['aip repo add ~/projects/app']))
380
- .action(async (path, options) => {
381
- show(options.json, (await call(context(), 'repository_add', { path: resolve(path) })));
382
- });
383
- repo
384
- .command('remove')
385
- .description('Remove a repository from the list; refused while it has unfinished runs or queued tasks. ' +
386
- 'It returns on the next request that names it')
387
- .argument('<path>', 'repository path')
388
- .option('--json', 'print JSON')
389
- .addHelpText('after', examples(['aip repo remove ~/projects/old-app']))
390
- .action(async (path, options) => {
391
- show(options.json, (await call(context(), 'repository_remove', { path: resolve(path) })));
392
- });
393
- }
394
- function registerTag(program, io, style) {
395
- const { print, output, examples, context, activeStyle } = bind(io, style);
396
- const tag = program
397
- .command('tag')
398
- .description(`Tags of tasks and runs; every repository has its own catalog. Colors: ${TAG_COLORS.join(', ')}`);
399
- const show = (json, tags) => {
400
- output(json, formatTagList(tags, activeStyle), tags);
401
- };
402
- tag
403
- .command('list')
404
- .description('Show the tags of the repository')
405
- .option('-r, --repo <path>', 'repository path', '.')
406
- .option('--json', 'print JSON')
407
- .addHelpText('after', examples(['aip tag list']))
408
- .action(async (options) => {
409
- show(options.json, (await call(context(), 'tags', { repository: resolve(options.repo) })));
410
- });
411
- tag
412
- .command('add')
413
- .description('Create a tag (name up to 30 characters, unique ignoring case)')
414
- .argument('<name>', 'tag name')
415
- .option('--color <color>', `one of: ${TAG_COLORS.join(', ')}`)
416
- .option('-r, --repo <path>', 'repository path', '.')
417
- .option('--json', 'print JSON')
418
- .addHelpText('after', examples(['aip tag add auth --color blue']))
419
- .action(async (name, options) => {
420
- show(options.json, (await call(context(), 'tag_add', {
421
- repository: resolve(options.repo),
422
- name,
423
- ...(options.color !== undefined ? { color: options.color } : {}),
424
- })));
425
- });
426
- tag
427
- .command('edit')
428
- .description('Rename a tag or change its color; tasks and runs keep the tag')
429
- .argument('<name>', 'tag name')
430
- .option('--name <new>', 'new name')
431
- .option('--color <color>', `one of: ${TAG_COLORS.join(', ')}`)
432
- .option('-r, --repo <path>', 'repository path', '.')
433
- .option('--json', 'print JSON')
434
- .addHelpText('after', examples(['aip tag edit auth --name login --color teal']))
435
- .action(async (name, options) => {
436
- if (options.name === undefined && options.color === undefined) {
437
- throw usage('pass --name or --color');
438
- }
439
- show(options.json, (await call(context(), 'tag_edit', {
440
- repository: resolve(options.repo),
441
- tag: name,
442
- ...(options.name !== undefined ? { name: options.name } : {}),
443
- ...(options.color !== undefined ? { color: options.color } : {}),
444
- })));
445
- });
446
- tag
447
- .command('remove')
448
- .description('Delete a tag and take it off every task and run of the repository')
449
- .argument('<name>', 'tag name')
450
- .option('-r, --repo <path>', 'repository path', '.')
451
- .option('--json', 'print JSON')
452
- .addHelpText('after', examples(['aip tag remove auth']))
453
- .action(async (name, options) => {
454
- show(options.json, (await call(context(), 'tag_remove', {
455
- repository: resolve(options.repo),
456
- tag: name,
457
- })));
458
- });
459
- }
460
- function registerRun(program, io, style) {
461
- const { print, output, examples, context, activeStyle } = bind(io, style);
462
- const run = program
463
- .command('run')
464
- .description('Start, follow, deliver and clean up runs of a pipeline');
465
- run
466
- .command('start')
467
- .description('Queue a pipeline task of the aip/ configuration: it goes to the end of the repository queue, a stopped queue is started')
468
- .argument('<pipeline>', 'pipeline id from the aip/ configuration')
469
- .option('-t, --task <text>', 'one task; the pipeline may split it into groups')
470
- .option('-g, --groups <file>', 'YAML or JSON file with a list of { title, task }')
471
- .option('-r, --repo <path>', 'repository path', '.')
472
- .option('--title <text>', 'title of the run (at most 60 characters); otherwise a model names it')
473
- .option('--auto-deliver', 'deliver the merged groups automatically, whatever delivery.auto says')
474
- .option('--no-auto-deliver', 'leave the merged groups for `aip apply`')
475
- .option('--delivery-mode <mode>', `how the merged result is delivered: ${DELIVERY_MODES.join(', ')}; whatever delivery.mode says`)
476
- .option('--tag <name>', 'tag of the task; repeat for several', collect)
477
- .option('--parent <run>', 'run id or task number (161 or #161) whose linked task tag the task gets')
478
- .option('--skip <step>', 'step of the pipeline to skip; repeat for several', collect)
479
- .option('--after <id>', 'queue item or run that must be done first; repeat for several', collect)
480
- .option('--json', 'print JSON')
481
- .addHelpText('after', examples([
482
- 'aip run start feature --no-auto-deliver --task "Add a login form"',
483
- 'aip run start feature --task "Add a login form"',
484
- 'aip run start feature --title "Login form" --task "Add a login form with OAuth"',
485
- 'aip run start feature --groups groups.yaml --repo ~/projects/app',
486
- 'aip run start feature --task "Add the API" --after q1',
487
- 'aip run start feature --task "Follow-up" --parent 115',
488
- ]))
489
- .action(async (pipeline, options) => {
490
- if ((options.task === undefined) === (options.groups === undefined)) {
491
- throw usage('pass exactly one of --task and --groups');
492
- }
493
- const groups = options.groups ? readGroups(options.groups) : undefined;
494
- const deliveryMode = parseDeliveryMode(options.deliveryMode);
495
- const queued = (await call(context(), 'run', {
496
- repository: resolve(options.repo),
497
- pipeline,
498
- ...(options.task !== undefined ? { task: options.task } : {}),
499
- ...(groups ? { groups } : {}),
500
- ...(options.title !== undefined ? { title: options.title } : {}),
501
- ...(options.autoDeliver !== undefined ? { autoDeliver: options.autoDeliver } : {}),
502
- ...(deliveryMode !== undefined ? { deliveryMode } : {}),
503
- ...(options.tag !== undefined ? { tags: options.tag } : {}),
504
- ...(options.parent !== undefined ? { parent: options.parent } : {}),
505
- ...(options.skip !== undefined ? { skip: options.skip } : {}),
506
- ...(options.after !== undefined ? { after: options.after } : {}),
507
- }));
508
- output(options.json, formatRunQueued(queued, activeStyle), queued);
509
- });
510
- run
511
- .command('list')
512
- .description('Show active and recent runs')
513
- .option('--tag <name>', 'only runs with this tag; repeat for any of several', collect)
514
- .option('--json', 'print JSON')
515
- .addHelpText('after', examples(['aip run list', 'aip run list --json', 'aip run list --tag auth --tag v2']))
516
- .action(async (options) => {
517
- const all = (await call(context(), 'status', {}));
518
- const runs = options.tag === undefined ? all : filterByTags(all, options.tag);
519
- const empty = options.tag !== undefined && runs.length === 0;
520
- output(options.json, empty ? 'No runs with these tags.' : formatRunList(runs, activeStyle), runs);
521
- });
522
- const showTags = (view, json) => {
523
- const labels = formatTagLabels(view.tags, activeStyle);
524
- output(json, `Tags of run ${view.id}: ${labels || 'none'}`, view);
525
- };
526
- run
527
- .command('tag')
528
- .description('Add tags to a run in any state (create a tag with `aip tag add`)')
529
- .argument('<run-id>', 'run id')
530
- .argument('<name...>', 'tag names')
531
- .option('--json', 'print JSON')
532
- .addHelpText('after', examples(['aip run tag 0mh3k2ab1x9z auth v2']))
533
- .action(async (runId, names, options) => {
534
- showTags((await call(context(), 'run_tags', { runId, add: names })), options.json);
535
- });
536
- run
537
- .command('untag')
538
- .description('Remove tags from a run in any state')
539
- .argument('<run-id>', 'run id')
540
- .argument('<name...>', 'tag names')
541
- .option('--json', 'print JSON')
542
- .addHelpText('after', examples(['aip run untag 0mh3k2ab1x9z v2']))
543
- .action(async (runId, names, options) => {
544
- showTags((await call(context(), 'run_tags', { runId, remove: names })), options.json);
545
- });
546
- run
547
- .command('show')
548
- .description('Show the groups of one run')
549
- .argument('<run-id>', 'run id')
550
- .option('--json', 'print JSON')
551
- .addHelpText('after', examples(['aip run show 0mh3k2ab1x9z']))
552
- .action(async (runId, options) => {
553
- const view = (await call(context(), 'status', { runId }));
554
- output(options.json, formatRun(view, Date.now(), activeStyle), view);
555
- });
556
- run
557
- .command('watch')
558
- .description('Follow a run until it finishes')
559
- .argument('[run-id]', 'run id; defaults to the latest active run')
560
- .addHelpText('after', examples(['aip run watch', 'aip run watch 0mh3k2ab1x9z']))
561
- .action(async (runId) => {
562
- await watch(context(), runId, io.watchIntervalMs);
563
- });
564
- run
565
- .command('cancel')
566
- .description('Cancel a whole run')
567
- .argument('<run-id>', 'run id')
568
- .addHelpText('after', examples(['aip run cancel 0mh3k2ab1x9z']))
569
- .action(async (runId) => {
570
- const view = (await call(context(), 'cancel', { runId }));
571
- print(formatRun(view, Date.now(), activeStyle));
572
- });
573
- run
574
- .command('pause')
575
- .description('Pause a run: the running agents stop, nothing new starts, and the run goes to the end of the queue; "aip queue run <item>" continues the interrupted step in the same session')
576
- .argument('<run-id>', 'run id')
577
- .option('-r, --repo <path>', 'repository path; defaults to the repository of the run')
578
- .option('--json', 'print JSON')
579
- .addHelpText('after', examples(['aip run pause 0mh3k2ab1x9z']))
580
- .action(async (runId, options) => {
581
- const view = (await call(context(), 'run_pause', {
582
- runId,
583
- ...(options.repo !== undefined ? { repository: resolve(options.repo) } : {}),
584
- }));
585
- output(options.json, formatQueue(view, activeStyle), view);
586
- });
587
- run
588
- .command('apply')
589
- .description('Deliver merged groups of a run into your working tree (or as delivery.mode says)')
590
- .argument('<run-id>', 'run id')
591
- .argument('[groups...]', 'groups to deliver; all merged ones by default')
592
- .option('--force', 'apply even with conflicts, leaving conflict markers')
593
- .option('--json', 'print JSON')
594
- .addHelpText('after', examples([
595
- 'aip run apply 0mh3k2ab1x9z',
596
- 'aip run apply 0mh3k2ab1x9z login signup',
597
- 'aip run apply 0mh3k2ab1x9z --force',
598
- ]))
599
- .action(async (runId, groups, options) => {
600
- const result = (await call(context(), 'apply', {
601
- runId,
602
- ...(groups.length > 0 ? { groups } : {}),
603
- ...(options.force ? { force: true } : {}),
604
- }));
605
- output(options.json, formatApply(result, activeStyle), result);
606
- if (result.groups.some((group) => group.delivery.state === 'apply_failed'))
607
- io.setExitCode(1);
608
- });
609
- run
610
- .command('mark-delivered')
611
- .description('Mark merged groups delivered after you merged them by hand')
612
- .argument('<run-id>', 'run id')
613
- .option('--group <slug...>', 'groups to mark; all merged ones that are not delivered by default')
614
- .option('--json', 'print JSON')
615
- .addHelpText('after', examples([
616
- 'aip run mark-delivered 0mh3k2ab1x9z',
617
- 'aip run mark-delivered 0mh3k2ab1x9z --group login signup',
618
- ]))
619
- .action(async (runId, options) => {
620
- const result = (await call(context(), 'run_mark_delivered', {
621
- runId,
622
- ...(options.group && options.group.length > 0 ? { groups: options.group } : {}),
623
- }));
624
- output(options.json, formatApply(result, activeStyle), result);
625
- });
626
- run
627
- .command('skip')
628
- .description('Skip a step of a run that is not finished yet, or bring it back with --off; a running step is stopped without a commit')
629
- .argument('<run-id>', 'run id')
630
- .argument('<step>', 'step id')
631
- .option('--off', 'do not skip the step any more')
632
- .option('--json', 'print JSON')
633
- .addHelpText('after', examples(['aip run skip 0mh3k2ab1x9z review', 'aip run skip 0mh3k2ab1x9z review --off']))
634
- .action(async (runId, step, options) => {
635
- const view = (await call(context(), 'run_skip', {
636
- runId,
637
- step,
638
- skip: options.off !== true,
639
- }));
640
- output(options.json, formatRun(view, Date.now(), activeStyle), view);
641
- });
642
- run
643
- .command('clean')
644
- .description('List finished runs that can be cleaned, or remove the worktrees and group branches of one')
645
- .argument('[run-id]', 'run id; without it the cleanable runs are listed')
646
- .option('--all', 'also delete the run branch aip/<run-id>')
647
- .option('--json', 'print the list of cleanable runs as JSON')
648
- .addHelpText('after', examples([
649
- 'aip run clean',
650
- 'aip run clean --json',
651
- 'aip run clean 0mh3k2ab1x9z',
652
- 'aip run clean 0mh3k2ab1x9z --all',
653
- ]))
654
- .action(async (runId, options) => {
655
- if (runId === undefined) {
656
- if (options.all)
657
- throw usage('--all needs a <run-id>');
658
- const { cleanableRuns, formatCleanable } = await import('./clean.js');
659
- const runs = await cleanableRuns(context());
660
- output(options.json, formatCleanable(runs, activeStyle), runs);
661
- return;
662
- }
663
- if (options.json)
664
- throw usage('--json lists runs and cannot be used with a <run-id>');
665
- const { cleanRun } = await import('./clean.js');
666
- for (const removed of await cleanRun(context(), runId, options.all ?? false))
667
- print(`removed ${removed}`);
668
- });
669
- }
670
- function registerGroup(program, io, style) {
671
- const { print, output, examples, context, activeStyle } = bind(io, style);
672
- const group = program
673
- .command('group')
674
- .description('Inspect and steer one group of a run: attempts, retry, cancel, answer');
675
- group
676
- .command('show')
677
- .description('Show every attempt of a group and the tail of its latest log')
678
- .argument('<run-id>', 'run id')
679
- .argument('<group>', 'group slug, or _split for the split step')
680
- .option('-n, --tail <lines>', 'log lines to show (1-500)', '40')
681
- .option('--json', 'print JSON')
682
- .addHelpText('after', examples([
683
- 'aip group show 0mh3k2ab1x9z login',
684
- 'aip group show 0mh3k2ab1x9z login --tail 200',
685
- ]))
686
- .action(async (runId, name, options) => {
687
- const view = (await call(context(), 'group', {
688
- runId,
689
- group: name,
690
- tailLines: Number(options.tail),
691
- }));
692
- output(options.json, formatGroup(view, activeStyle), view);
693
- });
694
- group
695
- .command('retry')
696
- .description('Retry a failed or cancelled group from where it stopped, or its merge after a conflict')
697
- .argument('<run-id>', 'run id')
698
- .argument('<group>', 'group slug')
699
- .option('--refresh-config', 'take the specialists (model, runtime, prompt, permissions) of the current configuration first')
700
- .addHelpText('after', examples([
701
- 'aip group retry 0mh3k2ab1x9z login',
702
- 'aip group retry 0mh3k2ab1x9z login --refresh-config',
703
- ]))
704
- .action(async (runId, name, options) => {
705
- print(formatRun((await call(context(), 'retry', {
706
- runId,
707
- group: name,
708
- ...(options.refreshConfig ? { refreshConfig: true } : {}),
709
- })), Date.now(), activeStyle));
710
- });
711
- group
712
- .command('cancel')
713
- .description('Cancel one group of a run')
714
- .argument('<run-id>', 'run id')
715
- .argument('<group>', 'group slug')
716
- .addHelpText('after', examples(['aip group cancel 0mh3k2ab1x9z login']))
717
- .action(async (runId, name) => {
718
- const view = (await call(context(), 'cancel', { runId, group: name }));
719
- print(formatRun(view, Date.now(), activeStyle));
720
- });
721
- group
722
- .command('answer')
723
- .description('Answer the question of a group in needs_human')
724
- .argument('<run-id>', 'run id')
725
- .argument('<group>', 'group slug')
726
- .argument('<answer...>', 'the answer')
727
- .addHelpText('after', examples(['aip group answer 0mh3k2ab1x9z login "Use OAuth with GitHub"']))
728
- .action(async (runId, name, words) => {
729
- const view = (await call(context(), 'answer', {
730
- runId,
731
- group: name,
732
- answer: words.join(' '),
733
- }));
734
- print(formatRun(view, Date.now(), activeStyle));
735
- });
736
- }
737
- export function registerCommands(program, style = plainStyle, io) {
738
- const { print, output, examples, context, activeStyle } = bind(io, style);
739
- const [runs, queueGroup, dashboards, setup, plumbing] = HELP_GROUPS;
740
- program.commandsGroup(runs.heading);
741
- registerRun(program, io, style);
742
- registerGroup(program, io, style);
743
- program.commandsGroup(queueGroup.heading);
744
- registerQueue(program, io, style);
745
- registerRepositories(program, io, style);
746
- registerTag(program, io, style);
747
- program.commandsGroup(dashboards.heading);
748
- const web = program
749
- .command('web')
750
- .description('Serve a local web dashboard for runs (bound to 127.0.0.1, protected by a token unless web.auth is none)')
751
- .option('-p, --port <port>', 'port to listen on (default: web.port, 7341)')
752
- .option('--host <host>', 'loopback address: 127.0.0.1, localhost or ::1 (default: web.host)')
753
- .option('--open', 'open the dashboard in the default browser')
754
- .addHelpText('after', '\nThe daemon serves the dashboard itself (web.autostart); then `aip web` prints its link and exits. ' +
755
- '`aip web start|stop|restart|status` control that panel without stopping the daemon.')
756
- .addHelpText('after', examples(['aip web', 'aip web --port 8080 --open', 'aip web start', 'aip web status']))
757
- .action(async (options) => {
758
- const settings = loadWebSettings(configPaths(io.cwd, io.env.XDG_CONFIG_HOME, io.env.HOME));
759
- const host = options.host ?? settings.host;
760
- const port = options.port === undefined ? settings.port : Number(options.port);
761
- if (!Number.isInteger(port) || port < 0 || port > 65535)
762
- throw usage('--port must be an integer from 0 to 65535');
763
- const { assertLoopbackHost, startWebServer, webTokenFromEnv } = await import('./web/server.js');
764
- assertLoopbackHost(host);
765
- let token;
766
- if (settings.auth === 'none') {
767
- if (io.env.AIP_WEB_TOKEN)
768
- io.stderr('aip web: AIP_WEB_TOKEN is ignored: web.auth is none\n');
769
- }
770
- else {
771
- token = webTokenFromEnv(io.env);
772
- }
773
- const ctx = context();
774
- await daemon(ctx, 'aip web');
775
- const autostart = settings.autostart &&
776
- io.env.AIP_WEB_AUTOSTART !== '0' &&
777
- io.env.AIP_WEB_AUTOSTART !== 'false';
778
- let url;
779
- if (autostart && host === settings.host && port === settings.port) {
780
- // A panel stopped by `aip web stop` is not coming back: do not wait for it.
781
- const stopped = await request(ctx.socket, 'web_status', {}).then((result) => result.stopped === true, () => false);
782
- const deadline = Date.now() + (stopped ? 0 : (io.panelWaitMs ?? 5000));
783
- for (;;) {
784
- const state = readPanelState(ctx.stateDirectory);
785
- // A stand-in panel hands the port to the daemon started above: wait for the daemon's.
786
- if (state !== null && !state.standby && state.host === host && state.port === port) {
787
- print(`aip web: ${state.url}`);
788
- print(`aip web: served by the aip daemon (pid ${state.pid})`);
789
- url = state.url;
790
- break;
791
- }
792
- if (Date.now() >= deadline)
793
- break;
794
- await new Promise((done) => setTimeout(done, io.panelPollMs ?? 100));
795
- }
796
- }
797
- if (url !== undefined) {
798
- if (options.open)
799
- openBrowser(url, io.stderr);
800
- return;
801
- }
802
- let web;
803
- try {
804
- web = await startWebServer({
805
- socket: ctx.socket,
806
- ensureDaemon: () => daemon(ctx, 'aip web'),
807
- host,
808
- port,
809
- auth: settings.auth,
810
- ...(token === undefined ? {} : { token }),
811
- // The panel works with the daemon's registry only, never with the launch directory.
812
- defaultRepository: () => latestRepository(ctx.socket),
813
- });
814
- }
815
- catch (error) {
816
- if (error.code === 'EADDRINUSE')
817
- throw usage(`port ${host}:${port} is already in use, maybe by another aip web: open that panel and choose the repository there, or pass --port <n>`);
818
- throw error;
819
- }
820
- // Before the link: whoever reads it may stop this process at once.
821
- const stopped = new Promise((resolve) => {
822
- io.onSignal('SIGINT', resolve);
823
- io.onSignal('SIGTERM', resolve);
824
- });
825
- print(`aip web: ${web.url}`);
826
- print('Press Ctrl+C to stop.');
827
- if (options.open)
828
- openBrowser(web.url, io.stderr);
829
- await stopped;
830
- await web.close();
831
- });
832
- registerWebControl(web, activeStyle, io);
833
- program
834
- .command('events')
835
- .description('Stream changes of runs as JSON lines: a snapshot first, then one line per change')
836
- .option('--json', 'print JSON lines (the only format)')
837
- .addHelpText('after', examples(['aip events --json']))
838
- .action(async () => {
839
- const ctx = context();
840
- await daemon(ctx);
841
- let interrupted = false;
842
- io.onSignal('SIGINT', () => {
843
- interrupted = true;
844
- io.exit(0);
845
- });
846
- await subscribe(ctx.socket, (line) => print(line));
847
- if (!interrupted)
848
- failLine(io, 'aip events', 'the daemon closed the stream');
849
- });
850
- program.commandsGroup(setup.heading);
851
- program
852
- .command('setup')
853
- .description('Connect aip to Claude Code and OpenCode on this machine')
854
- .option('-y, --yes', 'do not ask questions')
855
- .option('--dry-run', 'print what would be done and change nothing')
856
- .option('--force', 'replace an existing aip setting that differs')
857
- .option('--no-claude', 'skip Claude Code')
858
- .option('--no-opencode', 'skip OpenCode')
859
- .option('--no-plugin', 'do not install the Claude Code plugin')
860
- .addHelpText('after', examples(['aip setup', 'aip setup --dry-run', 'aip setup --yes --no-opencode']))
861
- .action(async (options) => {
862
- const { setupCommand, systemDeps } = await import('./setup.js');
863
- io.setExitCode(await setupCommand({
864
- yes: options.yes ?? false,
865
- dryRun: options.dryRun ?? false,
866
- force: options.force ?? false,
867
- claude: options.claude,
868
- opencode: options.opencode,
869
- plugin: options.plugin,
870
- }, activeStyle, systemDeps(io.env), print, io.ask));
871
- });
872
- program
873
- .command('init')
874
- .description('Create a starter aip/ configuration in the current repository')
875
- .option('--shared', 'write to the shared configuration (~/.config/aip) instead')
876
- .addHelpText('after', examples(['aip init', 'aip init --shared']))
877
- .action(async (options) => {
878
- try {
879
- const { initConfig } = await import('./init.js');
880
- const result = await initConfig({
881
- cwd: io.cwd,
882
- shared: options.shared ?? false,
883
- env: io.env,
884
- });
885
- const show = (file) => relative(io.cwd, file) || file;
886
- if (result.repository !== null) {
887
- // The web panel lists the daemon's registry only, so the initialized repository joins it.
888
- try {
889
- await call(context(), 'repository_add', { path: result.repository });
890
- }
891
- catch (error) {
892
- io.stderr(`aip: warning: could not add the repository to the list: ${error.message}\n`);
893
- }
894
- }
895
- for (const file of result.created)
896
- print(`${activeStyle.success('created')} ${show(file)}`);
897
- for (const file of result.kept)
898
- print(`${activeStyle.muted('kept ')} ${show(file)} (already exists)`);
899
- print(`\nNext: ${activeStyle.command('aip config check')}, then ${activeStyle.command('aip run start feature --task "Describe the task"')}`);
900
- }
901
- catch (error) {
902
- failLine(io, 'aip init', error.message);
903
- }
904
- });
905
- const config = program.command('config').description('Inspect the aip/ configuration');
906
- config
907
- .command('check')
908
- .description('Validate the aip/ configuration and print the merged configuration and agent CLI versions')
909
- .option('-r, --repo <path>', 'repository path', '.')
910
- .addHelpText('after', examples(['aip config check', 'aip config check --repo ~/projects/app']))
911
- .action(async (options) => {
912
- const { checkConfig } = await import('./config-check.js');
913
- io.setExitCode(await checkConfig(resolve(io.cwd, options.repo), io));
914
- });
915
- program
916
- .command('version')
917
- .description('Print the aip version (same as --version)')
918
- .option('--json', 'print JSON on one line')
919
- .addHelpText('after', examples(['aip version', 'aip version --json']))
920
- .action((options) => {
921
- print(options.json ? JSON.stringify({ version: VERSION }) : VERSION);
922
- });
923
- program.helpCommand('help [command]', 'Show help for a command');
924
- program.commandsGroup(plumbing.heading);
925
- registerDaemon(program, activeStyle, io);
926
- program
927
- .command('mcp')
928
- .description('Run the MCP server for Claude Code or OpenCode over stdio')
929
- .option('--worker <token>', 'serve swarm_report for one attempt (started by the daemon)')
930
- .option('--socket <path>', 'daemon socket (worker mode)')
931
- .option('--split', 'also serve swarm_split (split step)')
932
- .option('--queue', 'also serve swarm_queue_add (specialist with queue: true)')
933
- .option('--repair', 'also serve swarm_repair_* (observer of an incident)')
934
- .addHelpText('after', examples(['aip mcp', 'aip mcp --queue']))
935
- .action(async (options) => {
936
- // Imported on demand: every attempt of a specialist starts a worker server.
937
- const [{ createHostServer, createWorkerServer }, { StdioServerTransport }] = await Promise.all([
938
- import('../mcp/index.js'),
939
- import('@modelcontextprotocol/sdk/server/stdio.js'),
940
- ]);
941
- if (options.worker) {
942
- const socket = options.socket;
943
- if (!socket)
944
- throw usage('--worker needs --socket');
945
- const server = createWorkerServer({
946
- token: options.worker,
947
- split: options.split ?? false,
948
- queue: options.queue ?? false,
949
- repair: options.repair ?? false,
950
- send: (method, params) => request(socket, method, params),
951
- });
952
- await server.connect(new StdioServerTransport());
953
- return;
954
- }
955
- const ctx = context();
956
- const server = createHostServer({
957
- cwd: io.cwd,
958
- send: (method, params) => call(ctx, method, params),
959
- });
960
- await server.connect(new StdioServerTransport());
961
- });
962
- }
963
- //# sourceMappingURL=commands.js.map