crewswarm 0.8.1-beta

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 (362) hide show
  1. package/.env.example +155 -0
  2. package/LICENSE +21 -0
  3. package/README.md +316 -0
  4. package/apps/dashboard/dist/assets/chat-core-BwSoInmZ.js +1 -0
  5. package/apps/dashboard/dist/assets/chat-core-BwSoInmZ.js.br +0 -0
  6. package/apps/dashboard/dist/assets/cli-process-COMRNPqr.js +1 -0
  7. package/apps/dashboard/dist/assets/cli-process-COMRNPqr.js.br +0 -0
  8. package/apps/dashboard/dist/assets/components-CSUb80ze.js +1 -0
  9. package/apps/dashboard/dist/assets/components-CSUb80ze.js.br +0 -0
  10. package/apps/dashboard/dist/assets/core-utils-CAVnDoe1.js +1 -0
  11. package/apps/dashboard/dist/assets/core-utils-CAVnDoe1.js.br +0 -0
  12. package/apps/dashboard/dist/assets/index-CF0aJRtC.css +1 -0
  13. package/apps/dashboard/dist/assets/index-CF0aJRtC.css.br +0 -0
  14. package/apps/dashboard/dist/assets/index-Px49zu76.js +2 -0
  15. package/apps/dashboard/dist/assets/index-Px49zu76.js.br +0 -0
  16. package/apps/dashboard/dist/assets/orchestration-Ca2DLWN-.js +1 -0
  17. package/apps/dashboard/dist/assets/orchestration-Ca2DLWN-.js.br +0 -0
  18. package/apps/dashboard/dist/assets/setup-wizard-i3eEixlo.js +1 -0
  19. package/apps/dashboard/dist/assets/setup-wizard-i3eEixlo.js.br +0 -0
  20. package/apps/dashboard/dist/assets/tab-agents-tab-BThdsdJY.js +1 -0
  21. package/apps/dashboard/dist/assets/tab-agents-tab-BThdsdJY.js.br +0 -0
  22. package/apps/dashboard/dist/assets/tab-benchmarks-tab-DfCuAClu.js +1 -0
  23. package/apps/dashboard/dist/assets/tab-comms-tab-eHpOSBhG.js +1 -0
  24. package/apps/dashboard/dist/assets/tab-comms-tab-eHpOSBhG.js.br +0 -0
  25. package/apps/dashboard/dist/assets/tab-contacts-tab-yEegNyO4.js +1 -0
  26. package/apps/dashboard/dist/assets/tab-contacts-tab-yEegNyO4.js.br +0 -0
  27. package/apps/dashboard/dist/assets/tab-engines-tab-C3DYxTwy.js +1 -0
  28. package/apps/dashboard/dist/assets/tab-engines-tab-C3DYxTwy.js.br +0 -0
  29. package/apps/dashboard/dist/assets/tab-memory-tab-C59BYFQD.js +1 -0
  30. package/apps/dashboard/dist/assets/tab-memory-tab-C59BYFQD.js.br +0 -0
  31. package/apps/dashboard/dist/assets/tab-models-tab-9Ur7pXWA.js +1 -0
  32. package/apps/dashboard/dist/assets/tab-models-tab-9Ur7pXWA.js.br +0 -0
  33. package/apps/dashboard/dist/assets/tab-pm-loop-tab-D7mnDelU.js +1 -0
  34. package/apps/dashboard/dist/assets/tab-pm-loop-tab-D7mnDelU.js.br +0 -0
  35. package/apps/dashboard/dist/assets/tab-projects-tab-C6h2Mv1K.js +1 -0
  36. package/apps/dashboard/dist/assets/tab-projects-tab-C6h2Mv1K.js.br +0 -0
  37. package/apps/dashboard/dist/assets/tab-prompts-tab-C0wZvWK3.js +1 -0
  38. package/apps/dashboard/dist/assets/tab-prompts-tab-C0wZvWK3.js.br +0 -0
  39. package/apps/dashboard/dist/assets/tab-services-tab-DBj_w3bc.js +1 -0
  40. package/apps/dashboard/dist/assets/tab-services-tab-DBj_w3bc.js.br +0 -0
  41. package/apps/dashboard/dist/assets/tab-settings-tab-ezeqAjZk.js +1 -0
  42. package/apps/dashboard/dist/assets/tab-settings-tab-ezeqAjZk.js.br +0 -0
  43. package/apps/dashboard/dist/assets/tab-skills-tab-BYdU2whk.js +1 -0
  44. package/apps/dashboard/dist/assets/tab-skills-tab-BYdU2whk.js.br +0 -0
  45. package/apps/dashboard/dist/assets/tab-spending-tab-Bg6w9t_p.js +1 -0
  46. package/apps/dashboard/dist/assets/tab-spending-tab-Bg6w9t_p.js.br +0 -0
  47. package/apps/dashboard/dist/assets/tab-swarm-chat-tab-BBV9HB2X.js +1 -0
  48. package/apps/dashboard/dist/assets/tab-swarm-chat-tab-BBV9HB2X.js.br +0 -0
  49. package/apps/dashboard/dist/assets/tab-swarm-tab-ChqLlEVs.js +1 -0
  50. package/apps/dashboard/dist/assets/tab-swarm-tab-ChqLlEVs.js.br +0 -0
  51. package/apps/dashboard/dist/assets/tab-usage-tab-B2UWXenJ.js +1 -0
  52. package/apps/dashboard/dist/assets/tab-usage-tab-B2UWXenJ.js.br +0 -0
  53. package/apps/dashboard/dist/assets/tab-waves-tab-SaJDkb4x.js +1 -0
  54. package/apps/dashboard/dist/assets/tab-waves-tab-SaJDkb4x.js.br +0 -0
  55. package/apps/dashboard/dist/assets/tab-workflows-tab-6QSXLJ0i.js +1 -0
  56. package/apps/dashboard/dist/assets/tab-workflows-tab-6QSXLJ0i.js.br +0 -0
  57. package/apps/dashboard/dist/favicon.png +0 -0
  58. package/apps/dashboard/dist/index.html +6466 -0
  59. package/apps/dashboard/dist/index.html.br +0 -0
  60. package/apps/dashboard/dist/index.html.gz +0 -0
  61. package/apps/dashboard/dist/signup.html +446 -0
  62. package/apps/dashboard/index.html +6442 -0
  63. package/apps/dashboard/package.json +15 -0
  64. package/apps/dashboard/src/app.js +2823 -0
  65. package/apps/dashboard/src/app.js.br +0 -0
  66. package/apps/dashboard/src/app.js.gz +0 -0
  67. package/apps/dashboard/src/chat/chat-actions.js +1847 -0
  68. package/apps/dashboard/src/chat/chat-actions.js.br +0 -0
  69. package/apps/dashboard/src/chat/unified-messages.js +327 -0
  70. package/apps/dashboard/src/chat/unified-messages.js.br +0 -0
  71. package/apps/dashboard/src/cli-process.js +208 -0
  72. package/apps/dashboard/src/cli-process.js.br +0 -0
  73. package/apps/dashboard/src/cli-process.js.gz +0 -0
  74. package/apps/dashboard/src/components/active-tasks-panel.js +175 -0
  75. package/apps/dashboard/src/components/active-tasks-panel.js.br +0 -0
  76. package/apps/dashboard/src/core/api.js +18 -0
  77. package/apps/dashboard/src/core/api.js.br +0 -0
  78. package/apps/dashboard/src/core/dom.js +220 -0
  79. package/apps/dashboard/src/core/dom.js.br +0 -0
  80. package/apps/dashboard/src/core/state.js +91 -0
  81. package/apps/dashboard/src/core/state.js.br +0 -0
  82. package/apps/dashboard/src/core/task-manager.js +134 -0
  83. package/apps/dashboard/src/core/task-manager.js.br +0 -0
  84. package/apps/dashboard/src/orchestration-status.js +127 -0
  85. package/apps/dashboard/src/orchestration-status.js.br +0 -0
  86. package/apps/dashboard/src/setup-wizard.js +555 -0
  87. package/apps/dashboard/src/setup-wizard.js.br +0 -0
  88. package/apps/dashboard/src/styles.css +2085 -0
  89. package/apps/dashboard/src/styles.css.br +0 -0
  90. package/apps/dashboard/src/styles.css.gz +0 -0
  91. package/apps/dashboard/src/tabs/agents-tab.js +2237 -0
  92. package/apps/dashboard/src/tabs/agents-tab.js.br +0 -0
  93. package/apps/dashboard/src/tabs/benchmarks-tab.js +229 -0
  94. package/apps/dashboard/src/tabs/benchmarks-tab.js.br +0 -0
  95. package/apps/dashboard/src/tabs/comms-tab.js +955 -0
  96. package/apps/dashboard/src/tabs/comms-tab.js.br +0 -0
  97. package/apps/dashboard/src/tabs/contacts-tab.js +654 -0
  98. package/apps/dashboard/src/tabs/contacts-tab.js.br +0 -0
  99. package/apps/dashboard/src/tabs/engines-tab.js +175 -0
  100. package/apps/dashboard/src/tabs/engines-tab.js.br +0 -0
  101. package/apps/dashboard/src/tabs/memory-tab.js +182 -0
  102. package/apps/dashboard/src/tabs/memory-tab.js.br +0 -0
  103. package/apps/dashboard/src/tabs/models-tab.js +441 -0
  104. package/apps/dashboard/src/tabs/models-tab.js.br +0 -0
  105. package/apps/dashboard/src/tabs/pm-loop-tab.js +185 -0
  106. package/apps/dashboard/src/tabs/pm-loop-tab.js.br +0 -0
  107. package/apps/dashboard/src/tabs/projects-tab.js +663 -0
  108. package/apps/dashboard/src/tabs/projects-tab.js.br +0 -0
  109. package/apps/dashboard/src/tabs/projects-tab.js.gz +0 -0
  110. package/apps/dashboard/src/tabs/prompts-tab.js +160 -0
  111. package/apps/dashboard/src/tabs/prompts-tab.js.br +0 -0
  112. package/apps/dashboard/src/tabs/services-tab.js +202 -0
  113. package/apps/dashboard/src/tabs/services-tab.js.br +0 -0
  114. package/apps/dashboard/src/tabs/settings-tab.js +803 -0
  115. package/apps/dashboard/src/tabs/settings-tab.js.br +0 -0
  116. package/apps/dashboard/src/tabs/skills-tab.js +284 -0
  117. package/apps/dashboard/src/tabs/skills-tab.js.br +0 -0
  118. package/apps/dashboard/src/tabs/spending-tab.js +173 -0
  119. package/apps/dashboard/src/tabs/spending-tab.js.br +0 -0
  120. package/apps/dashboard/src/tabs/swarm-chat-tab.js +660 -0
  121. package/apps/dashboard/src/tabs/swarm-chat-tab.js.br +0 -0
  122. package/apps/dashboard/src/tabs/swarm-tab.js +538 -0
  123. package/apps/dashboard/src/tabs/swarm-tab.js.br +0 -0
  124. package/apps/dashboard/src/tabs/usage-tab.js +390 -0
  125. package/apps/dashboard/src/tabs/usage-tab.js.br +0 -0
  126. package/apps/dashboard/src/tabs/waves-tab.js +238 -0
  127. package/apps/dashboard/src/tabs/waves-tab.js.br +0 -0
  128. package/apps/dashboard/src/tabs/workflows-tab.js +747 -0
  129. package/apps/dashboard/src/tabs/workflows-tab.js.br +0 -0
  130. package/apps/vibe/.crew/agent-memory/pipeline.json +249 -0
  131. package/apps/vibe/.crew/cost.json +17 -0
  132. package/apps/vibe/.crew/json-parse-metrics.jsonl +22 -0
  133. package/apps/vibe/.crew/pipeline-metrics.jsonl +22 -0
  134. package/apps/vibe/.crew/pipeline-runs/pipeline-0f90c392-2425-4ae5-850c-bd9d17b1d690.jsonl +5 -0
  135. package/apps/vibe/.crew/pipeline-runs/pipeline-1c269dd9-a63f-4fba-af81-5cf08048ef06.jsonl +5 -0
  136. package/apps/vibe/.crew/pipeline-runs/pipeline-288a7765-da24-4a22-89bc-1f3cc9b0562c.jsonl +1 -0
  137. package/apps/vibe/.crew/pipeline-runs/pipeline-2c78fd22-a657-4bd1-bc49-0679fb384409.jsonl +5 -0
  138. package/apps/vibe/.crew/pipeline-runs/pipeline-3e6fe08d-3264-404a-8df3-aab7efef10e7.jsonl +5 -0
  139. package/apps/vibe/.crew/pipeline-runs/pipeline-42eec610-57fe-4e09-9e7e-b315038495c2.jsonl +5 -0
  140. package/apps/vibe/.crew/pipeline-runs/pipeline-4438eb4c-ae13-42b1-90e2-b043d8983be8.jsonl +5 -0
  141. package/apps/vibe/.crew/pipeline-runs/pipeline-4740a9f5-86e7-44b6-a394-de433e291727.jsonl +5 -0
  142. package/apps/vibe/.crew/pipeline-runs/pipeline-49e1da6a-957e-48fd-9220-415019e4f8e2.jsonl +5 -0
  143. package/apps/vibe/.crew/pipeline-runs/pipeline-4c9251db-be68-427b-a3fc-a264f2b5778d.jsonl +5 -0
  144. package/apps/vibe/.crew/pipeline-runs/pipeline-65e29a57-664d-4196-8109-017e364f182e.jsonl +5 -0
  145. package/apps/vibe/.crew/pipeline-runs/pipeline-6aa04bc5-9593-4b1f-b58d-3bf2978cb602.jsonl +5 -0
  146. package/apps/vibe/.crew/pipeline-runs/pipeline-6e1cba53-9b70-457e-99e0-59199149dd21.jsonl +5 -0
  147. package/apps/vibe/.crew/pipeline-runs/pipeline-749f41cc-4dac-4204-be64-873a6080a0d2.jsonl +5 -0
  148. package/apps/vibe/.crew/pipeline-runs/pipeline-74d68121-e181-4864-bd9a-c3211341dfaf.jsonl +5 -0
  149. package/apps/vibe/.crew/pipeline-runs/pipeline-8509bc24-142d-4e07-b44a-a50bf99d1103.jsonl +5 -0
  150. package/apps/vibe/.crew/pipeline-runs/pipeline-960339c6-07ca-43ce-9900-f6e1702b39b9.jsonl +5 -0
  151. package/apps/vibe/.crew/pipeline-runs/pipeline-9c6480a9-7031-4146-b241-825b9a2d1de1.jsonl +5 -0
  152. package/apps/vibe/.crew/pipeline-runs/pipeline-9fd42426-8492-4157-9d5f-e1537c060489.jsonl +2 -0
  153. package/apps/vibe/.crew/pipeline-runs/pipeline-ad6d40a3-2f5e-46a9-a345-47caaccc51aa.jsonl +5 -0
  154. package/apps/vibe/.crew/pipeline-runs/pipeline-bc606133-8d5b-4535-8d85-f1a29cdaa981.jsonl +5 -0
  155. package/apps/vibe/.crew/pipeline-runs/pipeline-c1a13ccd-634a-4d01-a4a7-1177b8a752ff.jsonl +5 -0
  156. package/apps/vibe/.crew/pipeline-runs/pipeline-c7d27b42-249e-4bd4-8f26-6aa998110b8a.jsonl +5 -0
  157. package/apps/vibe/.crew/pipeline-runs/pipeline-cca2e9b9-4a34-4d25-a311-5c793fa7e91e.jsonl +5 -0
  158. package/apps/vibe/.crew/sandbox.json +7 -0
  159. package/apps/vibe/.crew/session.json +285 -0
  160. package/apps/vibe/.crew/training-data.jsonl +0 -0
  161. package/apps/vibe/.github/workflows/studio-quality.yml +37 -0
  162. package/apps/vibe/.studio-data/project-messages/chuck-norris.jsonl +12 -0
  163. package/apps/vibe/.studio-data/project-messages/general.jsonl +54 -0
  164. package/apps/vibe/.studio-data/project-messages/studio-local.jsonl +10 -0
  165. package/apps/vibe/ARCHITECTURE.md +3393 -0
  166. package/apps/vibe/QUICK-REFERENCE.md +211 -0
  167. package/apps/vibe/README.md +76 -0
  168. package/apps/vibe/ROADMAP.md +41 -0
  169. package/apps/vibe/STUDIO-SETUP-COMPLETE.md +35 -0
  170. package/apps/vibe/VISUAL-GUIDE.md +378 -0
  171. package/apps/vibe/capture-demo.mjs +160 -0
  172. package/apps/vibe/capture-vibe-assets.mjs +71 -0
  173. package/apps/vibe/capture-vibe-video.mjs +260 -0
  174. package/apps/vibe/check-buttons.js +41 -0
  175. package/apps/vibe/diagnose.html +106 -0
  176. package/apps/vibe/fix-buttons.js +103 -0
  177. package/apps/vibe/index.html +3401 -0
  178. package/apps/vibe/package-lock.json +920 -0
  179. package/apps/vibe/package.json +31 -0
  180. package/apps/vibe/public/favicon.png +0 -0
  181. package/apps/vibe/scripts/studio-pty-host.py +117 -0
  182. package/apps/vibe/server.mjs +1835 -0
  183. package/apps/vibe/src/main.js +2846 -0
  184. package/apps/vibe/src/register-all-languages.js +98 -0
  185. package/apps/vibe/start-studio.sh +11 -0
  186. package/apps/vibe/test/accessibility-tests.js +77 -0
  187. package/apps/vibe/test/browser-performance-audit.mjs +205 -0
  188. package/apps/vibe/test/performance-tests.js +120 -0
  189. package/apps/vibe/test/security-tests.js +213 -0
  190. package/apps/vibe/tests/e2e.local.mjs +54 -0
  191. package/apps/vibe/tests/server.smoke.mjs +106 -0
  192. package/apps/vibe/update_website.mjs +74 -0
  193. package/apps/vibe/vite.config.js +19 -0
  194. package/apps/vibe/watch-server.mjs +108 -0
  195. package/contrib/openclaw-plugin/README.md +199 -0
  196. package/contrib/openclaw-plugin/index.ts +306 -0
  197. package/contrib/openclaw-plugin/openclaw.plugin.json +41 -0
  198. package/contrib/openclaw-plugin/package.json +27 -0
  199. package/contrib/openclaw-plugin/skills/crewswarm/SKILL.md +88 -0
  200. package/crew-lead.mjs +649 -0
  201. package/engines/claude-code.json +36 -0
  202. package/engines/codex.json +37 -0
  203. package/engines/crew-cli.json +42 -0
  204. package/engines/cursor.json +40 -0
  205. package/engines/docker-sandbox.json +38 -0
  206. package/engines/gemini-cli.json +75 -0
  207. package/engines/opencode.json +31 -0
  208. package/gateway-bridge.mjs +1575 -0
  209. package/install.sh +738 -0
  210. package/lib/agent-registry.mjs +232 -0
  211. package/lib/agents/daemon.mjs +121 -0
  212. package/lib/agents/dispatch.mjs +225 -0
  213. package/lib/agents/permissions.mjs +90 -0
  214. package/lib/agents/platform-formatting.mjs +102 -0
  215. package/lib/agents/registry.mjs +81 -0
  216. package/lib/agents/tool-instructions.mjs +257 -0
  217. package/lib/agents/validation.mjs +75 -0
  218. package/lib/approval/policy-manager.mjs +221 -0
  219. package/lib/autoharness/index.mjs +391 -0
  220. package/lib/bridges/cli-executor.mjs +332 -0
  221. package/lib/bridges/gateway-ws.mjs +345 -0
  222. package/lib/bridges/integration.mjs +229 -0
  223. package/lib/bridges/rag-helper.mjs +90 -0
  224. package/lib/browser/opencode-passthrough-filter.js +44 -0
  225. package/lib/browser/passthrough-stderr.js +109 -0
  226. package/lib/chat/autonomous-mentions.mjs +373 -0
  227. package/lib/chat/history.mjs +82 -0
  228. package/lib/chat/mention-routing-intent.mjs +136 -0
  229. package/lib/chat/participants.mjs +95 -0
  230. package/lib/chat/project-messages-rag.mjs +265 -0
  231. package/lib/chat/project-messages.mjs +479 -0
  232. package/lib/chat/shared-chat-prompt-overlay.mjs +52 -0
  233. package/lib/chat/thread-binding.mjs +34 -0
  234. package/lib/chat/unified-history.mjs +223 -0
  235. package/lib/chat/unified-wrapper.mjs +41 -0
  236. package/lib/cli-process-tracker.mjs +228 -0
  237. package/lib/collections/index.mjs +433 -0
  238. package/lib/contacts/identity-linker.mjs +248 -0
  239. package/lib/contacts/index.mjs +341 -0
  240. package/lib/crew-judge/PROMPT.md +93 -0
  241. package/lib/crew-judge/judge.mjs +260 -0
  242. package/lib/crew-lead/agent-manager.mjs +125 -0
  243. package/lib/crew-lead/background.mjs +270 -0
  244. package/lib/crew-lead/brain.mjs +110 -0
  245. package/lib/crew-lead/chat-handler.mjs +2603 -0
  246. package/lib/crew-lead/chat-handler.mjs.bak +1274 -0
  247. package/lib/crew-lead/classifier.mjs +83 -0
  248. package/lib/crew-lead/http-server.mjs +4824 -0
  249. package/lib/crew-lead/intent.mjs +102 -0
  250. package/lib/crew-lead/interval-manager.mjs +41 -0
  251. package/lib/crew-lead/llm-caller.mjs +544 -0
  252. package/lib/crew-lead/prompts.mjs +392 -0
  253. package/lib/crew-lead/retry-manager.mjs +118 -0
  254. package/lib/crew-lead/tools.mjs +318 -0
  255. package/lib/crew-lead/wave-dispatcher.mjs +798 -0
  256. package/lib/crew-lead/waves-config.json +73 -0
  257. package/lib/crew-lead/waves-loader.mjs +110 -0
  258. package/lib/crew-lead/ws-router.mjs +428 -0
  259. package/lib/dispatch/parsers.mjs +299 -0
  260. package/lib/domain-planning/detector.mjs +196 -0
  261. package/lib/domain-planning/prompts/crew-pm-cli.md +96 -0
  262. package/lib/domain-planning/prompts/crew-pm-core.md +122 -0
  263. package/lib/domain-planning/prompts/crew-pm-frontend.md +111 -0
  264. package/lib/engines/crew-cli-sandbox.mjs +422 -0
  265. package/lib/engines/crew-cli.mjs +155 -0
  266. package/lib/engines/cursor-launcher.mjs +110 -0
  267. package/lib/engines/engine-registry.mjs +253 -0
  268. package/lib/engines/llm-direct.mjs +184 -0
  269. package/lib/engines/opencode.mjs +256 -0
  270. package/lib/engines/ouroboros.mjs +114 -0
  271. package/lib/engines/rt-envelope.mjs +1643 -0
  272. package/lib/engines/rt-envelope.mjs.backup-current +870 -0
  273. package/lib/engines/runners.mjs +1367 -0
  274. package/lib/gemini-cli-passthrough-noise.mjs +37 -0
  275. package/lib/integrations/code-search.mjs +259 -0
  276. package/lib/integrations/greptile.mjs +148 -0
  277. package/lib/integrations/multimodal.mjs +313 -0
  278. package/lib/integrations/telegram-streaming.mjs +153 -0
  279. package/lib/integrations/tts.mjs +312 -0
  280. package/lib/integrations/twitter-links.mjs +294 -0
  281. package/lib/memory/shared-adapter.mjs +296 -0
  282. package/lib/pipeline/manager.mjs +539 -0
  283. package/lib/preferences/extractor.mjs +347 -0
  284. package/lib/project-dir.mjs +20 -0
  285. package/lib/runtime/config.mjs +388 -0
  286. package/lib/runtime/dlq.mjs +170 -0
  287. package/lib/runtime/log-rotation.mjs +82 -0
  288. package/lib/runtime/logger.mjs +58 -0
  289. package/lib/runtime/memory.mjs +421 -0
  290. package/lib/runtime/paths.mjs +76 -0
  291. package/lib/runtime/project-dir.mjs +127 -0
  292. package/lib/runtime/spending.mjs +204 -0
  293. package/lib/runtime/startup-guard.mjs +291 -0
  294. package/lib/runtime/task-lease.mjs +234 -0
  295. package/lib/runtime/telemetry-schema.mjs +208 -0
  296. package/lib/runtime/telemetry.mjs +101 -0
  297. package/lib/runtime/utils.mjs +64 -0
  298. package/lib/skills/index.mjs +265 -0
  299. package/lib/tools/browser.mjs +135 -0
  300. package/lib/tools/executor.mjs +913 -0
  301. package/lib/types.d.ts +57 -0
  302. package/package.json +106 -0
  303. package/pm-loop.mjs +1626 -0
  304. package/prompts/coder-back.md +27 -0
  305. package/prompts/coder-front.md +27 -0
  306. package/prompts/coder.md +28 -0
  307. package/prompts/copywriter.md +17 -0
  308. package/prompts/fixer.md +39 -0
  309. package/prompts/frontend.md +23 -0
  310. package/prompts/github.md +24 -0
  311. package/prompts/main.md +39 -0
  312. package/prompts/pm-cli.md +95 -0
  313. package/prompts/pm-core.md +121 -0
  314. package/prompts/pm-frontend.md +110 -0
  315. package/prompts/pm.md +234 -0
  316. package/prompts/qa.md +44 -0
  317. package/prompts/security.md +19 -0
  318. package/scripts/build-crew-chat.sh +28 -0
  319. package/scripts/build-llms-full.mjs +52 -0
  320. package/scripts/chatmock-login.sh +16 -0
  321. package/scripts/chatmock-serve.sh +16 -0
  322. package/scripts/check-dashboard.mjs +88 -0
  323. package/scripts/crew-scribe.mjs +326 -0
  324. package/scripts/dashboard-helpers.mjs +391 -0
  325. package/scripts/dashboard-validation.mjs +198 -0
  326. package/scripts/dashboard.mjs +9717 -0
  327. package/scripts/dlq-replay.mjs +61 -0
  328. package/scripts/doctor.mjs +196 -0
  329. package/scripts/file-lock.mjs +186 -0
  330. package/scripts/fresh-machine-smoke.sh +323 -0
  331. package/scripts/generate-changelog.mjs +227 -0
  332. package/scripts/generate-openapi.mjs +334 -0
  333. package/scripts/health-check.mjs +229 -0
  334. package/scripts/install-docker.sh +213 -0
  335. package/scripts/mcp-server.mjs +1625 -0
  336. package/scripts/opencrew-rt-daemon.mjs +568 -0
  337. package/scripts/openswitchctl +646 -0
  338. package/scripts/refactor-configs.mjs +39 -0
  339. package/scripts/release-check.sh +46 -0
  340. package/scripts/resolve-node-bin.sh +25 -0
  341. package/scripts/restart-all-from-repo.sh +329 -0
  342. package/scripts/restart-crew-lead.sh +98 -0
  343. package/scripts/restart-dashboard.sh +104 -0
  344. package/scripts/restart-service.sh +274 -0
  345. package/scripts/run-accessibility-audit.mjs +356 -0
  346. package/scripts/run-integration-bounded.mjs +188 -0
  347. package/scripts/run-scheduled-pipeline.mjs +230 -0
  348. package/scripts/run.mjs +41 -0
  349. package/scripts/scan-skills.mjs +79 -0
  350. package/scripts/setup-firewall.sh +128 -0
  351. package/scripts/smoke-dispatch.mjs +149 -0
  352. package/scripts/smoke.sh +163 -0
  353. package/scripts/start-crew.mjs +328 -0
  354. package/scripts/start.mjs +146 -0
  355. package/scripts/swiftbar-restart-service.sh +19 -0
  356. package/scripts/sync-agents.mjs +152 -0
  357. package/scripts/sync-prompts.mjs +79 -0
  358. package/scripts/validate-config.mjs +337 -0
  359. package/scripts/wow.mjs +89 -0
  360. package/telegram-bridge.mjs +2421 -0
  361. package/unified-orchestrator.mjs +519 -0
  362. package/whatsapp-bridge.mjs +1481 -0
@@ -0,0 +1,539 @@
1
+ /**
2
+ * Pipeline / project manager — extracted from crew-lead.mjs
3
+ * Pending projects, roadmap phases, draft/confirm, auto-advance.
4
+ */
5
+
6
+ import fs from "node:fs";
7
+ import path from "node:path";
8
+ import os from "node:os";
9
+ import crypto from "node:crypto";
10
+
11
+ let _dashboard = "http://127.0.0.1:4319";
12
+ let _broadcastSSE = () => {};
13
+ let _appendHistory = () => {};
14
+ let _handleChat = async () => {};
15
+ let _loadConfig = () => ({});
16
+
17
+ function tryRead(p) {
18
+ try { return JSON.parse(fs.readFileSync(p, "utf8")); } catch { return null; }
19
+ }
20
+
21
+ export const pendingProjects = new Map();
22
+
23
+ export function initPipelineManager({ dashboard, broadcastSSE, appendHistory, handleChat, loadConfig }) {
24
+ if (dashboard !== undefined) _dashboard = dashboard;
25
+ if (broadcastSSE) _broadcastSSE = broadcastSSE;
26
+ if (appendHistory) _appendHistory = appendHistory;
27
+ if (handleChat) _handleChat = handleChat;
28
+ if (loadConfig) _loadConfig = loadConfig;
29
+ }
30
+
31
+ function getPMLLMProviders() {
32
+ const csSwarm = tryRead(path.join(os.homedir(), ".crewswarm", "crewswarm.json")) || {};
33
+ const p = csSwarm.providers || {};
34
+ const candidates = [
35
+ p.perplexity?.apiKey && { baseUrl: p.perplexity.baseUrl || "https://api.perplexity.ai", apiKey: p.perplexity.apiKey, model: "sonar-pro", name: "Perplexity" },
36
+ p.cerebras?.apiKey && { baseUrl: p.cerebras.baseUrl || "https://api.cerebras.ai/v1", apiKey: p.cerebras.apiKey, model: "llama-3.3-70b", name: "Cerebras" },
37
+ p.groq?.apiKey && { baseUrl: p.groq.baseUrl || "https://api.groq.com/openai/v1", apiKey: p.groq.apiKey, model: "llama-3.3-70b-versatile", name: "Groq" },
38
+ p.mistral?.apiKey && { baseUrl: p.mistral.baseUrl || "https://api.mistral.ai/v1", apiKey: p.mistral.apiKey, model: "mistral-large-latest", name: "Mistral" },
39
+ p.openai?.apiKey && { baseUrl: p.openai.baseUrl || "https://api.openai.com/v1", apiKey: p.openai.apiKey, model: "gpt-4o-mini", name: "OpenAI" },
40
+ ].filter(Boolean);
41
+
42
+ const cfg = _loadConfig();
43
+ if (cfg.provider?.apiKey && !candidates.find(c => c.apiKey === cfg.provider.apiKey)) {
44
+ candidates.push({ baseUrl: cfg.provider.baseUrl, apiKey: cfg.provider.apiKey, model: cfg.modelId, name: cfg.providerKey });
45
+ }
46
+ return candidates;
47
+ }
48
+
49
+ function templatePDD(name, description) {
50
+ const today = new Date().toISOString().slice(0, 10);
51
+ return `# ${name} — Product Design Document
52
+
53
+ > Generated by crewswarm on ${today}. Update this file as the project evolves.
54
+
55
+ ---
56
+
57
+ ## 1. Problem Statement
58
+
59
+ **What we're building:** ${description || name}
60
+
61
+ **Who it's for:** *(To be defined — describe the primary user persona here)*
62
+
63
+ **The problem:** *(What pain point does this solve? What does the user currently do instead?)*
64
+
65
+ **Why now:** *(What makes this worth building now?)*
66
+
67
+ ---
68
+
69
+ ## 2. Success Metrics
70
+
71
+ | Metric | Target | How to measure |
72
+ |---|---|---|
73
+ | *(e.g. Task completion rate)* | *(e.g. > 80%)* | *(e.g. User testing)* |
74
+
75
+ ---
76
+
77
+ ## 3. Scope
78
+
79
+ ### In scope
80
+ - ${description || name}
81
+
82
+ ### Out of scope
83
+ - *(Explicitly list what this project will NOT include)*
84
+
85
+ ---
86
+
87
+ ## 4. Constraints & Assumptions
88
+
89
+ - **Tech stack:** *(e.g. Node.js, React, SQLite)*
90
+ - **Timeline:** *(e.g. MVP in 2 weeks)*
91
+ - **Team:** crewswarm agents
92
+ - **Assumptions:** *(What must be true for this to succeed?)*
93
+
94
+ ---
95
+
96
+ ## 5. Key Decisions
97
+
98
+ | Decision | Choice | Rationale |
99
+ |---|---|---|
100
+ | *(e.g. Auth method)* | *(e.g. JWT)* | *(why)* |
101
+
102
+ ---
103
+
104
+ ## 6. Risks
105
+
106
+ | Risk | Likelihood | Mitigation |
107
+ |---|---|---|
108
+ | *(e.g. Scope creep)* | Medium | Strict phase gates in ROADMAP.md |
109
+
110
+ ---
111
+
112
+ ## 7. Related Files
113
+
114
+ - \`TECH-SPEC.md\` — technical architecture and implementation details
115
+ - \`ROADMAP.md\` — phased task breakdown
116
+ - \`qa-report.md\` — QA findings (written by crew-qa)
117
+ `;
118
+ }
119
+
120
+ function templateTechSpec(name, description) {
121
+ const today = new Date().toISOString().slice(0, 10);
122
+ return `# ${name} — Technical Specification
123
+
124
+ **Version:** 1.0
125
+ **Last Updated:** ${today}
126
+ **Status:** Design Phase
127
+
128
+ ---
129
+
130
+ ## 1. Architecture Overview
131
+
132
+ \`\`\`
133
+ [System diagram will be provided by crew-architect]
134
+
135
+ Example structure:
136
+ ┌──────────────┐
137
+ │ User │
138
+ └──────┬───────┘
139
+
140
+
141
+ ┌──────────────┐
142
+ │ Frontend │
143
+ └──────┬───────┘
144
+
145
+
146
+ ┌──────────────┐
147
+ │ Backend │
148
+ └──────┬───────┘
149
+
150
+
151
+ ┌──────────────┐
152
+ │ Database │
153
+ └──────────────┘
154
+ \`\`\`
155
+
156
+ **Architecture type:** *(e.g. Monolith, Microservices, Serverless, etc.)*
157
+
158
+ **Core components:**
159
+ - *(List main system components)*
160
+
161
+ ---
162
+
163
+ ## 2. Tech Stack
164
+
165
+ | Layer | Technology | Version | Why |
166
+ |---|---|---|---|
167
+ | **Frontend** | *(e.g. React)* | *(e.g. 18.x)* | *(rationale)* |
168
+ | **Backend** | *(e.g. Node.js)* | *(e.g. 20.x)* | *(rationale)* |
169
+ | **Database** | *(e.g. PostgreSQL)* | *(e.g. 15.x)* | *(rationale)* |
170
+ | **Hosting** | *(e.g. Fly.io)* | — | *(rationale)* |
171
+
172
+ **Dependencies:**
173
+ - *(Key npm/pip packages with versions)*
174
+
175
+ ---
176
+
177
+ ## 3. Data Models
178
+
179
+ ### Database Schema
180
+
181
+ \`\`\`sql
182
+ -- Example schema (replace with actual)
183
+ CREATE TABLE users (
184
+ id INTEGER PRIMARY KEY,
185
+ email TEXT UNIQUE NOT NULL,
186
+ created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
187
+ );
188
+ \`\`\`
189
+
190
+ **Entity relationships:**
191
+ - *(Describe key relationships)*
192
+
193
+ ---
194
+
195
+ ## 4. API Contracts
196
+
197
+ ### Endpoints
198
+
199
+ | Method | Path | Request | Response | Auth |
200
+ |---|---|---|---|---|
201
+ | \`GET\` | \`/api/users\` | — | \`User[]\` | Required |
202
+ | \`POST\` | \`/api/users\` | \`{email}\` | \`User\` | Required |
203
+
204
+ **Example requests:**
205
+
206
+ \`\`\`bash
207
+ curl -X POST http://localhost:3000/api/users \\
208
+ -H "Content-Type: application/json" \\
209
+ -d '{"email": "user@example.com"}'
210
+ \`\`\`
211
+
212
+ ---
213
+
214
+ ## 5. File Structure
215
+
216
+ \`\`\`
217
+ ${name}/
218
+ ├── src/
219
+ │ ├── index.js # Entry point
220
+ │ ├── routes/ # API routes
221
+ │ ├── models/ # Data models
222
+ │ └── utils/ # Helpers
223
+ ├── tests/ # Test files
224
+ ├── package.json
225
+ └── README.md
226
+ \`\`\`
227
+
228
+ **Key files:**
229
+ - *(Describe purpose of important files)*
230
+
231
+ ---
232
+
233
+ ## 6. Security
234
+
235
+ **Authentication:** *(e.g. JWT, OAuth, API keys)*
236
+
237
+ **Authorization:** *(e.g. Role-based access control)*
238
+
239
+ **Data protection:**
240
+ - *(How sensitive data is handled)*
241
+
242
+ **Secrets management:** *(e.g. .env, vault)*
243
+
244
+ ---
245
+
246
+ ## 7. Performance
247
+
248
+ **Targets:**
249
+ - Response time: < 200ms (p95)
250
+ - Throughput: > 100 req/s
251
+ - Memory: < 512MB
252
+
253
+ **Bottlenecks:** *(Identify potential performance issues)*
254
+
255
+ **Optimization strategy:** *(How to address bottlenecks)*
256
+
257
+ ---
258
+
259
+ ## 8. Deployment
260
+
261
+ **Build command:**
262
+ \`\`\`bash
263
+ npm install && npm run build
264
+ \`\`\`
265
+
266
+ **Start command:**
267
+ \`\`\`bash
268
+ npm start
269
+ \`\`\`
270
+
271
+ **Environment variables:**
272
+ - \`DATABASE_URL\` — PostgreSQL connection string
273
+ - \`API_KEY\` — External API key
274
+ - \`PORT\` — Server port (default: 3000)
275
+
276
+ **Deployment platform:** *(e.g. Fly.io, Vercel, Railway)*
277
+
278
+ **CI/CD:** *(If applicable)*
279
+
280
+ ---
281
+
282
+ ## 9. Testing Strategy
283
+
284
+ **Unit tests:** *(Coverage goal, framework)*
285
+
286
+ **Integration tests:** *(What to test)*
287
+
288
+ **E2E tests:** *(Critical user flows)*
289
+
290
+ ---
291
+
292
+ ## 10. Related Files
293
+
294
+ - \`PDD.md\` — product design and requirements
295
+ - \`ROADMAP.md\` — implementation plan
296
+ - \`README.md\` — setup instructions
297
+ `;
298
+ }
299
+
300
+ function templateRoadmap(name, description, outputDir) {
301
+ return `# ${name} — Living Roadmap
302
+
303
+ > Managed by crewswarm PM Loop. Add \`- [ ] items\` here at any time.
304
+
305
+ ---
306
+
307
+ ## Phase 1 — Foundation
308
+
309
+ - [ ] Set up project structure and entry point in ${outputDir}
310
+ - [ ] Create README.md with project overview and setup instructions
311
+ - [ ] Define core data models and types for: ${description || name}
312
+
313
+ ## Phase 2 — Core Features
314
+
315
+ - [ ] Implement primary feature: ${description || name}
316
+ - [ ] Build the main UI/frontend in ${outputDir}
317
+ - [ ] Add backend logic, API endpoints, and data persistence
318
+ - [ ] Add error handling and input validation throughout
319
+
320
+ ## Phase 3 — Polish & QA
321
+
322
+ - [ ] Write unit tests for core logic
323
+ - [ ] QA pass — check for edge cases and broken flows
324
+ - [ ] Performance review and optimisation
325
+ - [ ] Accessibility and UX improvements
326
+
327
+ ## Phase 4 — Ship
328
+
329
+ - [ ] Final QA pass
330
+ - [ ] Commit all changes to git with clear messages
331
+ - [ ] Write deployment/setup documentation
332
+ `;
333
+ }
334
+
335
+ async function generateRoadmarkWithAI(name, description, outputDir) {
336
+ const providers = getPMLLMProviders();
337
+
338
+ if (!providers.length) {
339
+ console.log("[crew-lead] No PM LLM providers configured — using template roadmap");
340
+ return templateRoadmap(name, description, outputDir);
341
+ }
342
+
343
+ const systemPrompt = `You are a senior technical product manager. Generate a detailed, phased ROADMAP.md for a software project.
344
+
345
+ Rules:
346
+ - Output ONLY the roadmap markdown — no preamble, no explanation
347
+ - Use EXACTLY this format:
348
+
349
+ # {Project Name} — Living Roadmap
350
+
351
+ > Managed by crewswarm PM Loop.
352
+
353
+ ---
354
+
355
+ ## Phase 1 — Foundation
356
+ - [ ] Task one
357
+ - [ ] Task two
358
+
359
+ ## Phase 2 — Core Features
360
+ - [ ] Task three
361
+
362
+ ## Phase 3 — Polish & Ship
363
+ - [ ] Task
364
+
365
+ - Include 12-18 total tasks across 3-4 phases
366
+ - Each task: specific, actionable, completable by ONE agent in ONE session
367
+ - Vary tasks: backend (API/DB/scripts), frontend (HTML/CSS/JS), copy, git, QA, security
368
+ - Reference the output directory: ${outputDir}`;
369
+
370
+ const userPrompt = `Project: "${name}"
371
+ Description: ${description || name}
372
+ Output directory: ${outputDir}
373
+
374
+ Generate the ROADMAP.md:`;
375
+
376
+ for (const pmCfg of providers) {
377
+ const isPerplexity = pmCfg.baseUrl.includes("perplexity");
378
+ console.log(`[crew-lead] Generating roadmap via ${pmCfg.name || pmCfg.model}...`);
379
+ try {
380
+ // Reasoning models (o1/o3/gpt-5 series) don't support max_tokens parameter
381
+ const isReasoningModel = /^(o1|o3|gpt-5)/i.test(pmCfg.model);
382
+ const payload = {
383
+ model: pmCfg.model,
384
+ messages: [{ role: "system", content: systemPrompt }, { role: "user", content: userPrompt }],
385
+ temperature: 0.4,
386
+ ...(isPerplexity ? { search_recency_filter: "month" } : {}),
387
+ };
388
+ if (!isReasoningModel) {
389
+ payload.max_tokens = 1200;
390
+ }
391
+ const resp = await fetch(`${pmCfg.baseUrl.replace(/\/$/, "")}/chat/completions`, {
392
+ method: "POST",
393
+ headers: { "content-type": "application/json", "authorization": `Bearer ${pmCfg.apiKey}` },
394
+ body: JSON.stringify(payload),
395
+ signal: AbortSignal.timeout(30000),
396
+ });
397
+
398
+ if (!resp.ok) {
399
+ const errText = await resp.text().catch(() => resp.statusText);
400
+ console.warn(`[crew-lead] ${pmCfg.name} returned ${resp.status} — trying next provider`);
401
+ continue;
402
+ }
403
+
404
+ const data = await resp.json();
405
+ const roadmap = data?.choices?.[0]?.message?.content?.trim();
406
+ if (!roadmap) { console.warn(`[crew-lead] ${pmCfg.name} returned empty — trying next`); continue; }
407
+
408
+ console.log(`[crew-lead] Roadmap generated via ${pmCfg.name} (${roadmap.length} chars)`);
409
+ return roadmap.startsWith("#") ? roadmap : `# ${name} — Living Roadmap\n\n${roadmap}`;
410
+ } catch (e) {
411
+ console.warn(`[crew-lead] ${pmCfg.name} failed: ${e.message} — trying next provider`);
412
+ }
413
+ }
414
+
415
+ console.warn("[crew-lead] All PM LLM providers failed — using template roadmap");
416
+ return templateRoadmap(name, description, outputDir);
417
+ }
418
+
419
+ export async function draftProject({ name, description, outputDir }, sessionId) {
420
+ if (!name || !outputDir) {
421
+ throw new Error("draftProject requires name and outputDir");
422
+ }
423
+ const roadmapMd = await generateRoadmarkWithAI(name, description, outputDir);
424
+ const draftId = crypto.randomUUID();
425
+ pendingProjects.set(draftId, { name, description, outputDir, roadmapMd, sessionId, ts: Date.now() });
426
+ console.log(`[crew-lead] Roadmap draft ready: ${name} (draftId=${draftId})`);
427
+ return { draftId, name, description, outputDir, roadmapMd };
428
+ }
429
+
430
+ export async function confirmProject({ draftId, roadmapMd: overrideMd }) {
431
+ const draft = pendingProjects.get(draftId);
432
+ if (!draft) throw new Error(`No pending project for draftId: ${draftId}`);
433
+ pendingProjects.delete(draftId);
434
+
435
+ const { name, description, outputDir, sessionId } = draft;
436
+ const finalRoadmap = overrideMd || draft.roadmapMd;
437
+
438
+ const createRes = await fetch(`${_dashboard}/api/projects`, {
439
+ method: "POST",
440
+ headers: { "content-type": "application/json" },
441
+ body: JSON.stringify({ name, description: description || "", outputDir }),
442
+ signal: AbortSignal.timeout(10000),
443
+ });
444
+ const proj = await createRes.json();
445
+ if (!proj.ok) throw new Error("Failed to create project: " + (proj.error || "unknown"));
446
+ const projectId = proj.project.id;
447
+
448
+ fs.mkdirSync(outputDir, { recursive: true });
449
+ fs.writeFileSync(path.join(outputDir, "ROADMAP.md"), finalRoadmap, "utf8");
450
+
451
+ // Write PDD.md if it doesn't already exist (crew-pm may write a richer version during planning)
452
+ const pddPath = path.join(outputDir, "PDD.md");
453
+ if (!fs.existsSync(pddPath)) {
454
+ fs.writeFileSync(pddPath, templatePDD(name, description), "utf8");
455
+ }
456
+
457
+ // Write TECH-SPEC.md template (crew-pm + crew-architect will fill it out during planning)
458
+ const techSpecPath = path.join(outputDir, "TECH-SPEC.md");
459
+ if (!fs.existsSync(techSpecPath)) {
460
+ fs.writeFileSync(techSpecPath, templateTechSpec(name, description), "utf8");
461
+ }
462
+
463
+ console.log(`[crew-lead] Project confirmed: ${name} (${projectId}) — roadmap + PDD + TECH-SPEC written`);
464
+
465
+ try {
466
+ const startRes = await fetch(`${_dashboard}/api/pm-loop/start`, {
467
+ method: "POST",
468
+ headers: { "content-type": "application/json" },
469
+ body: JSON.stringify({ projectId }),
470
+ signal: AbortSignal.timeout(10000),
471
+ });
472
+ const startData = await startRes.json();
473
+ console.log(`[crew-lead] PM loop started for ${name}:`, startData.pid || startData.message);
474
+ } catch (e) {
475
+ console.error(`[crew-lead] PM loop start failed: ${e.message}`);
476
+ }
477
+
478
+ _appendHistory("default", sessionId || "owner", "system", `Project "${name}" confirmed and launched. PM loop running.`);
479
+ _broadcastSSE({ type: "project_launched", project: { projectId, name, outputDir } });
480
+ return { projectId, name, outputDir };
481
+ }
482
+
483
+ export function parseRoadmapPhases(content) {
484
+ const phases = [];
485
+ let current = null;
486
+ for (const line of content.split("\n")) {
487
+ const phaseMatch = line.match(/^#{1,3}\s*(Phase\s[\w\d–\-]+.*)/i);
488
+ if (phaseMatch) {
489
+ if (current) phases.push(current);
490
+ current = { title: phaseMatch[1].trim(), items: [], raw: line };
491
+ } else if (current && line.match(/^\s*-\s*\[([ xX!])\]/)) {
492
+ // Recognize [ ], [x], [X], and [!] (failed) as valid checkbox states
493
+ current.items.push({
494
+ done: /\[x\]/i.test(line),
495
+ failed: /\[!\]/.test(line),
496
+ text: line.trim()
497
+ });
498
+ }
499
+ }
500
+ if (current) phases.push(current);
501
+ return phases;
502
+ }
503
+
504
+ export function findNextRoadmapPhase(projectDir) {
505
+ const roadmapPath = path.join(projectDir, "ROADMAP.md");
506
+ if (!fs.existsSync(roadmapPath)) return null;
507
+ try {
508
+ const content = fs.readFileSync(roadmapPath, "utf8");
509
+ const phases = parseRoadmapPhases(content);
510
+ return phases.find(p => p.items.length > 0 && p.items.some(i => !i.done)) || null;
511
+ } catch { return null; }
512
+ }
513
+
514
+ export async function autoAdvanceRoadmap(projectDir, sessionId) {
515
+ if (!projectDir) return;
516
+ const nextPhase = findNextRoadmapPhase(projectDir);
517
+ if (!nextPhase) {
518
+ console.log(`[roadmap] All phases complete in ${projectDir}`);
519
+ return;
520
+ }
521
+ const unchecked = nextPhase.items.filter(i => !i.done);
522
+ console.log(`[roadmap] Auto-advancing to "${nextPhase.title}" — ${unchecked.length} items pending in ${projectDir}`);
523
+
524
+ const task = `The previous pipeline phase just completed. Auto-advancing to the next phase.
525
+
526
+ Project: ${projectDir}
527
+ Next phase: ${nextPhase.title}
528
+ Unchecked items:
529
+ ${unchecked.map(i => i.text).join("\n")}
530
+
531
+ @@READ_FILE ${path.join(projectDir, "ROADMAP.md")}
532
+
533
+ Plan and execute this phase as a @@PIPELINE. Use the correct agents for each task. End with crew-qa → crew-fixer → crew-qa → crew-pm (ROADMAP update). All file paths must be absolute.`;
534
+
535
+ _appendHistory("default", sessionId, "system", `[Auto-advance] Starting "${nextPhase.title}" (${unchecked.length} items)`);
536
+ _broadcastSSE({ type: "roadmap_advance", phase: nextPhase.title, projectDir, ts: Date.now() });
537
+
538
+ await _handleChat({ message: task, sessionId, _autoAdvance: true });
539
+ }