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,519 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * UNIFIED ORCHESTRATOR - Best of Both Worlds
4
+ *
5
+ * Two-Agent Pattern:
6
+ * 1. PM Agent → Plans naturally with reasoning
7
+ * 2. Parser Agent → Converts natural language → structured JSON
8
+ * 3. Worker Agents → Execute tasks
9
+ * 4. Verification → Check actual results (files exist, tests pass, etc.)
10
+ *
11
+ * This is more reliable than:
12
+ * - Forcing PM to output pure JSON (brittle, models add formatting)
13
+ * - Using regex to parse natural language (fragile, misses edge cases)
14
+ *
15
+ * Version: 1.0.0
16
+ */
17
+
18
+ import { spawn } from 'node:child_process';
19
+ import { randomUUID } from 'node:crypto';
20
+ import { existsSync, statSync } from 'node:fs';
21
+ import { readFile, appendFile, mkdir } from 'node:fs/promises';
22
+ import { join, dirname } from 'node:path';
23
+ import os from 'node:os';
24
+ import { fileURLToPath } from 'node:url';
25
+
26
+ const __dirname = dirname(fileURLToPath(import.meta.url));
27
+ const CREWSWARM_DIR = process.env.CREWSWARM_DIR || process.env.OPENCLAW_DIR || __dirname;
28
+ const GATEWAY_BRIDGE_PATH = `${CREWSWARM_DIR}/gateway-bridge.mjs`;
29
+ const LOG_DIR = join(CREWSWARM_DIR, 'orchestrator-logs');
30
+ const DISPATCH_LOG = join(LOG_DIR, 'unified-dispatch.jsonl');
31
+
32
+ // Ensure log directory exists
33
+ if (!existsSync(LOG_DIR)) {
34
+ await mkdir(LOG_DIR, { recursive: true });
35
+ }
36
+
37
+ //=============================================================================
38
+ // STEP 1: Ask PM to create plan in natural language
39
+ //=============================================================================
40
+
41
+ async function askPMForPlan(requirement) {
42
+ console.log('📋 Step 1: Asking PM to create plan...\n');
43
+
44
+ const naturalPrompt = `You are the PM agent for crewswarm.
45
+
46
+ Requirement: "${requirement}"
47
+
48
+ Create a plan to accomplish this. Think through:
49
+ - What needs to be built/fixed/tested?
50
+ - Which agents should work on it?
51
+ - What order should tasks happen in?
52
+
53
+ IMPORTANT - Break into SMALL, FOCUSED tasks (like Cursor does):
54
+ - Each task = ONE action (e.g. "create package.json" OR "write CRUD routes", not both)
55
+ - Avoid compound tasks: split "write tests + run tests" into 2 separate tasks
56
+ - Target ~60–90 seconds per task to avoid timeouts
57
+ - More smaller tasks beats fewer huge tasks
58
+
59
+ Available agents:
60
+ - crew-coder: Implements features, writes code
61
+ - crew-qa: Writes tests, validates functionality
62
+ - crew-fixer: Debugs issues, fixes bugs
63
+ - security: Security audits, vulnerability checks
64
+
65
+ Explain your plan naturally. Examples:
66
+ - "crew-coder: create package.json. Then crew-coder: implement CRUD routes. Then crew-qa: write tests. Then crew-qa: run npm test."
67
+ - "First crew-fixer debug the timeout; then security audit the auth flow."
68
+ - Split QA into: (1) write tests, (2) run tests – as separate tasks.
69
+
70
+ Be specific. Prefer more small tasks over fewer large ones.`;
71
+
72
+ return callAgent('crew-pm', naturalPrompt, true); // Show output
73
+ }
74
+
75
+ //=============================================================================
76
+ // STEP 2: Ask Parser to convert natural language → JSON
77
+ //=============================================================================
78
+
79
+ async function parseIntoJSON(naturalPlan, requirement) {
80
+ console.log('\n📊 Step 2: Converting plan to structured JSON...\n');
81
+
82
+ const parserPrompt = `You are a plan parser. Convert this natural language plan into dispatch JSON.
83
+
84
+ ORIGINAL REQUIREMENT:
85
+ "${requirement}"
86
+
87
+ PM'S NATURAL LANGUAGE PLAN:
88
+ ${naturalPlan}
89
+
90
+ Output ONLY valid JSON in this exact format (no markdown, no explanation):
91
+ {
92
+ "op_id": "op-${randomUUID().split('-')[0]}",
93
+ "summary": "Brief summary of the plan",
94
+ "dispatch": [
95
+ {
96
+ "agent": "crew-coder",
97
+ "task": "Specific task description",
98
+ "acceptance": "How to verify success"
99
+ }
100
+ ]
101
+ }
102
+
103
+ Rules:
104
+ - agent must be one of: crew-coder, crew-qa, crew-fixer, security
105
+ - task should be ONE focused action (e.g. "Create package.json" or "Write CRUD tests" – not "create API + write tests + run tests")
106
+ - Split compound tasks into separate dispatch entries
107
+ - acceptance should describe success criteria
108
+ - Output ONLY the JSON object, nothing else
109
+
110
+ JSON:`;
111
+
112
+ const response = await callAgent('crew-pm', parserPrompt, false); // Don't show verbose output
113
+
114
+ // Extract JSON from response (handle markdown code blocks)
115
+ let jsonText = response.trim();
116
+
117
+ // Remove markdown code fences if present
118
+ jsonText = jsonText.replace(/^```(?:json)?\s*/gm, '').replace(/```\s*$/gm, '');
119
+
120
+ // Try to find JSON object
121
+ const jsonMatch = jsonText.match(/\{[\s\S]*\}/);
122
+ if (!jsonMatch) {
123
+ throw new Error(`Parser did not output valid JSON.\n\nParser response:\n${response}`);
124
+ }
125
+
126
+ try {
127
+ const plan = JSON.parse(jsonMatch[0]);
128
+
129
+ // Validate structure
130
+ if (!plan.dispatch || !Array.isArray(plan.dispatch)) {
131
+ throw new Error('Missing or invalid "dispatch" array');
132
+ }
133
+
134
+ if (plan.dispatch.length === 0) {
135
+ console.log('⚠️ Parser returned empty dispatch. Creating default plan...');
136
+ plan.dispatch = [{
137
+ agent: 'crew-coder',
138
+ task: requirement,
139
+ acceptance: 'Task completed successfully'
140
+ }];
141
+ }
142
+
143
+ // Validate each task
144
+ for (const [i, task] of plan.dispatch.entries()) {
145
+ if (!task.agent) throw new Error(`Task ${i + 1} missing "agent"`);
146
+ if (!task.task) throw new Error(`Task ${i + 1} missing "task"`);
147
+ task.acceptance = task.acceptance || 'Task completed';
148
+ }
149
+
150
+ return plan;
151
+
152
+ } catch (err) {
153
+ throw new Error(`Failed to parse JSON: ${err.message}\n\nExtracted:\n${jsonMatch[0].substring(0, 500)}`);
154
+ }
155
+ }
156
+
157
+ //=============================================================================
158
+ // STEP 3: Execute tasks with worker agents
159
+ //=============================================================================
160
+
161
+ async function executeTasks(plan) {
162
+ console.log(`\n🚀 Step 3: Executing ${plan.dispatch.length} task(s)...\n`);
163
+ console.log(`Operation: ${plan.op_id}`);
164
+ console.log(`Summary: ${plan.summary}\n`);
165
+
166
+ const results = [];
167
+
168
+ for (const [i, task] of plan.dispatch.entries()) {
169
+ console.log(`\n[${ i + 1}/${plan.dispatch.length}] 📤 Dispatching to ${task.agent}`);
170
+ console.log(` Task: ${task.task.substring(0, 100)}${task.task.length > 100 ? '...' : ''}`);
171
+
172
+ const startTime = Date.now();
173
+
174
+ try {
175
+ const output = await callAgent(task.agent, task.task, false, true); // useSend = targeted delegation
176
+ const duration = ((Date.now() - startTime) / 1000).toFixed(1);
177
+
178
+ console.log(` ✅ Completed in ${duration}s`);
179
+
180
+ // Log to file
181
+ await logDispatch({
182
+ timestamp: new Date().toISOString(),
183
+ op_id: plan.op_id,
184
+ task_num: i + 1,
185
+ agent: task.agent,
186
+ task: task.task,
187
+ status: 'completed',
188
+ duration_s: parseFloat(duration),
189
+ output_preview: output.substring(0, 200)
190
+ });
191
+
192
+ results.push({
193
+ success: true,
194
+ agent: task.agent,
195
+ task: task.task,
196
+ output,
197
+ duration
198
+ });
199
+
200
+ } catch (err) {
201
+ const duration = ((Date.now() - startTime) / 1000).toFixed(1);
202
+ console.log(` ❌ Failed in ${duration}s: ${err.message}`);
203
+
204
+ // Log failure
205
+ await logDispatch({
206
+ timestamp: new Date().toISOString(),
207
+ op_id: plan.op_id,
208
+ task_num: i + 1,
209
+ agent: task.agent,
210
+ task: task.task,
211
+ status: 'failed',
212
+ duration_s: parseFloat(duration),
213
+ error: err.message
214
+ });
215
+
216
+ results.push({
217
+ success: false,
218
+ agent: task.agent,
219
+ task: task.task,
220
+ error: err.message,
221
+ duration
222
+ });
223
+ }
224
+ }
225
+
226
+ return results;
227
+ }
228
+
229
+ //=============================================================================
230
+ // STEP 4: Verify results (check files exist, not just "agent said done")
231
+ //=============================================================================
232
+
233
+ async function verifyResults(plan, results) {
234
+ console.log(`\n🔍 Step 4: Verifying results...\n`);
235
+
236
+ const verifications = [];
237
+
238
+ for (const [i, task] of plan.dispatch.entries()) {
239
+ const result = results[i];
240
+
241
+ if (!result.success) {
242
+ verifications.push({
243
+ task_num: i + 1,
244
+ verified: false,
245
+ reason: 'Task failed during execution'
246
+ });
247
+ continue;
248
+ }
249
+
250
+ // Try to extract file paths from task description
251
+ const filePaths = extractFilePaths(task.task);
252
+
253
+ if (filePaths.length === 0) {
254
+ // No files to verify, trust agent's completion
255
+ verifications.push({
256
+ task_num: i + 1,
257
+ verified: true,
258
+ reason: 'No artifacts to verify, agent reported success'
259
+ });
260
+ continue;
261
+ }
262
+
263
+ // Check if files exist
264
+ const missingFiles = [];
265
+ const existingFiles = [];
266
+
267
+ for (const filepath of filePaths) {
268
+ if (existsSync(filepath)) {
269
+ const stats = statSync(filepath);
270
+ existingFiles.push({ path: filepath, size: stats.size });
271
+ } else {
272
+ missingFiles.push(filepath);
273
+ }
274
+ }
275
+
276
+ if (missingFiles.length > 0) {
277
+ console.log(` ⚠️ Task ${i + 1}: Missing files:`);
278
+ missingFiles.forEach(f => console.log(` - ${f}`));
279
+ verifications.push({
280
+ task_num: i + 1,
281
+ verified: false,
282
+ reason: `Missing files: ${missingFiles.join(', ')}`
283
+ });
284
+ } else {
285
+ console.log(` ✅ Task ${i + 1}: All artifacts verified`);
286
+ existingFiles.forEach(f => console.log(` - ${f.path} (${f.size} bytes)`));
287
+ verifications.push({
288
+ task_num: i + 1,
289
+ verified: true,
290
+ files: existingFiles
291
+ });
292
+ }
293
+ }
294
+
295
+ return verifications;
296
+ }
297
+
298
+ //=============================================================================
299
+ // UTILITIES
300
+ //=============================================================================
301
+
302
+ /**
303
+ * Call an agent via gateway-bridge.
304
+ * useSend: true = targeted RT send (only this agent gets task). Use for workers.
305
+ */
306
+ async function callAgent(agentId, prompt, showOutput = false, useSend = true) {
307
+ return new Promise((resolve, reject) => {
308
+ // Always use --send so RT daemons pick up tasks and reply via done.jsonl.
309
+ // Without --send, gateway-bridge chats Gateway directly then polls done.jsonl,
310
+ // but nothing writes to done.jsonl when the task never went through RT.
311
+ const argv = [GATEWAY_BRIDGE_PATH, '--send', agentId, prompt];
312
+ const env = { ...process.env };
313
+ const proc = spawn('node', argv, {
314
+ cwd: CREWSWARM_DIR,
315
+ stdio: ['ignore', 'pipe', 'pipe'],
316
+ env,
317
+ });
318
+
319
+ let stdout = '';
320
+ let stderr = '';
321
+
322
+ proc.stdout.on('data', (data) => {
323
+ const chunk = data.toString();
324
+ stdout += chunk;
325
+ if (showOutput) process.stdout.write(chunk);
326
+ });
327
+
328
+ proc.stderr.on('data', (data) => {
329
+ const chunk = data.toString();
330
+ stderr += chunk;
331
+ if (showOutput) process.stderr.write(chunk);
332
+ });
333
+
334
+ proc.on('close', (code) => {
335
+ if (code !== 0) {
336
+ reject(new Error(`${agentId} failed (exit ${code}): ${stderr || 'No error output'}`));
337
+ return;
338
+ }
339
+
340
+ let reply = '';
341
+ if (useSend) {
342
+ reply = stdout.trim();
343
+ } else {
344
+ const replyMatch = stdout.match(/✅ Reply received\s*\n([\s\S]*)/);
345
+ if (replyMatch) {
346
+ reply = replyMatch[1].trim();
347
+ } else {
348
+ const lines = stdout.split('\n');
349
+ const replyStart = lines.findIndex(l => l.includes('Reply received'));
350
+ reply = (replyStart !== -1 && replyStart < lines.length - 1)
351
+ ? lines.slice(replyStart + 1).join('\n').trim()
352
+ : stdout.trim();
353
+ }
354
+ }
355
+ if (!reply || reply.length < 2) {
356
+ reject(new Error(`${agentId} returned empty response`));
357
+ return;
358
+ }
359
+ resolve(reply);
360
+ });
361
+
362
+ proc.on('error', (err) => {
363
+ reject(new Error(`Failed to spawn ${agentId}: ${err.message}`));
364
+ });
365
+ });
366
+ }
367
+
368
+ /**
369
+ * Extract file paths from task description
370
+ */
371
+ function extractFilePaths(text) {
372
+ const paths = [];
373
+
374
+ // Pattern 1: /path/to/file.ext
375
+ const unixPaths = text.match(/\/[\w\-./]+\.\w+/g);
376
+ if (unixPaths) paths.push(...unixPaths);
377
+
378
+ // Pattern 2: ~/path/to/file
379
+ const homePaths = text.match(/~\/[\w\-./]+/g);
380
+ if (homePaths) {
381
+ const homeDir = process.env.HOME || os.homedir();
382
+ paths.push(...homePaths.map(p => p.replace('~', homeDir)));
383
+ }
384
+
385
+ // Pattern 3: Quoted paths
386
+ const quotedPaths = text.match(/["'`](\/[\w\-./]+\.\w+)["'`]/g);
387
+ if (quotedPaths) {
388
+ paths.push(...quotedPaths.map(p => p.replace(/["'`]/g, '')));
389
+ }
390
+
391
+ return [...new Set(paths)]; // Remove duplicates
392
+ }
393
+
394
+ /**
395
+ * Log dispatch to JSONL file
396
+ */
397
+ async function logDispatch(entry) {
398
+ try {
399
+ await appendFile(DISPATCH_LOG, JSON.stringify(entry) + '\n');
400
+ } catch (err) {
401
+ console.error(`⚠️ Failed to write log: ${err.message}`);
402
+ }
403
+ }
404
+
405
+ //=============================================================================
406
+ // MAIN ORCHESTRATION
407
+ //=============================================================================
408
+
409
+ async function orchestrate(requirement) {
410
+ const startTime = Date.now();
411
+ const opId = `op-${randomUUID().split('-')[0]}`;
412
+
413
+ console.log(`\n${'═'.repeat(70)}`);
414
+ console.log(`🎯 UNIFIED ORCHESTRATOR v1.0`);
415
+ console.log(` Operation: ${opId}`);
416
+ console.log(` Requirement: ${requirement}`);
417
+ console.log(`${'═'.repeat(70)}\n`);
418
+
419
+ try {
420
+ // Step 1: Get natural language plan from PM
421
+ const naturalPlan = await askPMForPlan(requirement);
422
+
423
+ // Step 2: Parse into structured JSON
424
+ const plan = await parseIntoJSON(naturalPlan, requirement);
425
+ plan.op_id = opId; // Ensure consistent op_id
426
+
427
+ console.log(`✅ Plan created: ${plan.dispatch.length} task(s)`);
428
+ plan.dispatch.forEach((t, i) => {
429
+ console.log(` ${i + 1}. ${t.agent}: ${t.task.substring(0, 60)}${t.task.length > 60 ? '...' : ''}`);
430
+ });
431
+
432
+ // Step 3: Execute tasks
433
+ const results = await executeTasks(plan);
434
+
435
+ // Step 4: Verify results
436
+ const verifications = await verifyResults(plan, results);
437
+
438
+ // Summary
439
+ const duration = ((Date.now() - startTime) / 1000).toFixed(1);
440
+ const succeeded = results.filter(r => r.success).length;
441
+ const failed = results.filter(r => !r.success).length;
442
+ const verified = verifications.filter(v => v.verified).length;
443
+
444
+ console.log(`\n${'═'.repeat(70)}`);
445
+ console.log(`📊 OPERATION COMPLETE: ${opId}`);
446
+ console.log(` ⏱️ Duration: ${duration}s`);
447
+ console.log(` ✅ Succeeded: ${succeeded}/${results.length}`);
448
+ console.log(` ❌ Failed: ${failed}/${results.length}`);
449
+ console.log(` 🔍 Verified: ${verified}/${verifications.length}`);
450
+ console.log(`${'═'.repeat(70)}\n`);
451
+
452
+ if (failed > 0) {
453
+ console.log('❌ Some tasks failed:\n');
454
+ results.filter(r => !r.success).forEach((r, i) => {
455
+ console.log(` ${i + 1}. ${r.agent}: ${r.error}`);
456
+ });
457
+ console.log();
458
+ process.exit(1);
459
+ }
460
+
461
+ if (verified < verifications.length) {
462
+ console.log('⚠️ Some tasks could not be verified:\n');
463
+ verifications.filter(v => !v.verified).forEach(v => {
464
+ console.log(` Task ${v.task_num}: ${v.reason}`);
465
+ });
466
+ console.log();
467
+ process.exit(1);
468
+ }
469
+
470
+ console.log('🎉 All tasks completed and verified!\n');
471
+ process.exit(0);
472
+
473
+ } catch (error) {
474
+ const duration = ((Date.now() - startTime) / 1000).toFixed(1);
475
+ console.error(`\n${'═'.repeat(70)}`);
476
+ console.error(`❌ ORCHESTRATION FAILED (${duration}s)`);
477
+ console.error(` ${error.message}`);
478
+ console.error(`${'═'.repeat(70)}\n`);
479
+
480
+ if (process.env.DEBUG) {
481
+ console.error('\nFull error:');
482
+ console.error(error);
483
+ }
484
+
485
+ process.exit(1);
486
+ }
487
+ }
488
+
489
+ //=============================================================================
490
+ // CLI
491
+ //=============================================================================
492
+
493
+ const requirement = process.argv.slice(2).join(' ');
494
+
495
+ if (!requirement) {
496
+ console.log(`
497
+ 🎯 Unified Orchestrator v1.0
498
+
499
+ Usage:
500
+ node unified-orchestrator.mjs "<requirement>"
501
+
502
+ Examples:
503
+ node unified-orchestrator.mjs "Create /tmp/test.txt with 'hello world'"
504
+ node unified-orchestrator.mjs "Build user authentication with JWT"
505
+ node unified-orchestrator.mjs "Fix the dashboard loading error and add tests"
506
+
507
+ How it works:
508
+ 1. PM agent creates plan in natural language
509
+ 2. Parser converts plan to structured JSON
510
+ 3. Worker agents execute tasks in parallel
511
+ 4. Verification checks artifacts were created
512
+
513
+ Logs: ${DISPATCH_LOG}
514
+ `);
515
+ process.exit(1);
516
+ }
517
+
518
+ orchestrate(requirement);
519
+