kynjal-cli 3.1.3 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (566) hide show
  1. package/.claude/agents/core/coder.md +1 -1
  2. package/.claude/agents/core/planner.md +2 -2
  3. package/.claude/agents/core/researcher.md +1 -1
  4. package/.claude/agents/core/reviewer.md +1 -1
  5. package/.claude/agents/core/tester.md +1 -1
  6. package/.claude/agents/data/data-ml-model.md +4 -4
  7. package/.claude/agents/development/dev-backend-api.md +4 -4
  8. package/.claude/agents/documentation/docs-api-openapi.md +4 -4
  9. package/.claude/agents/github/code-review-swarm.md +2 -2
  10. package/.claude/agents/github/issue-tracker.md +2 -2
  11. package/.claude/agents/github/pr-manager.md +2 -2
  12. package/.claude/agents/github/release-manager.md +2 -2
  13. package/.claude/agents/github/workflow-automation.md +2 -2
  14. package/.claude/agents/sparc/architecture.md +3 -3
  15. package/.claude/agents/sparc/pseudocode.md +2 -2
  16. package/.claude/agents/sparc/refinement.md +3 -3
  17. package/.claude/agents/sparc/specification.md +2 -2
  18. package/.claude/agents/swarm/adaptive-coordinator.md +1 -1
  19. package/.claude/agents/swarm/hierarchical-coordinator.md +1 -1
  20. package/.claude/agents/swarm/mesh-coordinator.md +1 -1
  21. package/.claude/agents/templates/base-template-generator.md +25 -4
  22. package/.claude/agents/templates/sparc-coordinator.md +3 -3
  23. package/.claude/helpers/auto-commit.sh +1 -1
  24. package/.claude/helpers/auto-memory-hook.mjs +27 -9
  25. package/.claude/helpers/hook-handler.cjs +58 -18
  26. package/.claude/helpers/statusline.cjs +14 -33
  27. package/.claude/helpers/statusline.js +3 -3
  28. package/.claude/settings.json +9 -9
  29. package/.claude/skills/reasoningbank-intelligence/SKILL.md +2 -2
  30. package/.claude/skills/swarm-orchestration/SKILL.md +1 -1
  31. package/README.md +383 -170
  32. package/bin/cli.js +6 -6
  33. package/bin/mcp-server.js +1 -1
  34. package/bin/preinstall.cjs +2 -0
  35. package/dist/src/appliance/gguf-engine.js +664 -0
  36. package/dist/src/appliance/gguf-engine.js.map +1 -0
  37. package/dist/src/appliance/ruvllm-bridge.js +492 -0
  38. package/dist/src/appliance/ruvllm-bridge.js.map +1 -0
  39. package/dist/src/appliance/rvfa-builder.js +383 -0
  40. package/dist/src/appliance/rvfa-builder.js.map +1 -0
  41. package/dist/src/appliance/rvfa-distribution.js +533 -0
  42. package/dist/src/appliance/rvfa-distribution.js.map +1 -0
  43. package/dist/src/appliance/rvfa-format.js +465 -0
  44. package/dist/src/appliance/rvfa-format.js.map +1 -0
  45. package/dist/src/appliance/rvfa-runner.js +373 -0
  46. package/dist/src/appliance/rvfa-runner.js.map +1 -0
  47. package/dist/src/appliance/rvfa-signing.js +469 -0
  48. package/dist/src/appliance/rvfa-signing.js.map +1 -0
  49. package/dist/src/benchmarks/pretrain/index.js +542 -331
  50. package/dist/src/benchmarks/pretrain/index.js.map +1 -1
  51. package/dist/src/commands/agent.d.ts.map +1 -1
  52. package/dist/src/commands/agent.js +725 -502
  53. package/dist/src/commands/agent.js.map +1 -1
  54. package/dist/src/commands/analyze.js +1548 -1218
  55. package/dist/src/commands/analyze.js.map +1 -1
  56. package/dist/src/commands/appliance-advanced.d.ts +9 -0
  57. package/dist/src/commands/appliance-advanced.d.ts.map +1 -0
  58. package/dist/src/commands/appliance-advanced.js +324 -0
  59. package/dist/src/commands/appliance-advanced.js.map +1 -0
  60. package/dist/src/commands/appliance.d.ts +8 -0
  61. package/dist/src/commands/appliance.d.ts.map +1 -0
  62. package/dist/src/commands/appliance.js +581 -0
  63. package/dist/src/commands/appliance.js.map +1 -0
  64. package/dist/src/commands/benchmark.js +523 -372
  65. package/dist/src/commands/benchmark.js.map +1 -1
  66. package/dist/src/commands/claims.js +364 -274
  67. package/dist/src/commands/claims.js.map +1 -1
  68. package/dist/src/commands/cleanup.d.ts +13 -0
  69. package/dist/src/commands/cleanup.d.ts.map +1 -0
  70. package/dist/src/commands/cleanup.js +262 -0
  71. package/dist/src/commands/cleanup.js.map +1 -0
  72. package/dist/src/commands/completions.js +118 -477
  73. package/dist/src/commands/completions.js.map +1 -1
  74. package/dist/src/commands/config.js +303 -237
  75. package/dist/src/commands/config.js.map +1 -1
  76. package/dist/src/commands/daemon.d.ts.map +1 -1
  77. package/dist/src/commands/daemon.js +597 -425
  78. package/dist/src/commands/daemon.js.map +1 -1
  79. package/dist/src/commands/deployment.js +275 -194
  80. package/dist/src/commands/deployment.js.map +1 -1
  81. package/dist/src/commands/doctor.d.ts.map +1 -1
  82. package/dist/src/commands/doctor.js +690 -460
  83. package/dist/src/commands/doctor.js.map +1 -1
  84. package/dist/src/commands/embeddings.js +1543 -1293
  85. package/dist/src/commands/embeddings.js.map +1 -1
  86. package/dist/src/commands/guidance.js +596 -449
  87. package/dist/src/commands/guidance.js.map +1 -1
  88. package/dist/src/commands/hive-mind.js +938 -854
  89. package/dist/src/commands/hive-mind.js.map +1 -1
  90. package/dist/src/commands/hooks.d.ts.map +1 -1
  91. package/dist/src/commands/hooks.js +3677 -2570
  92. package/dist/src/commands/hooks.js.map +1 -1
  93. package/dist/src/commands/index.js +322 -122
  94. package/dist/src/commands/index.js.map +1 -1
  95. package/dist/src/commands/init.d.ts +1 -1
  96. package/dist/src/commands/init.d.ts.map +1 -1
  97. package/dist/src/commands/init.js +943 -787
  98. package/dist/src/commands/init.js.map +1 -1
  99. package/dist/src/commands/issues.js +558 -383
  100. package/dist/src/commands/issues.js.map +1 -1
  101. package/dist/src/commands/mcp.d.ts.map +1 -1
  102. package/dist/src/commands/mcp.js +605 -475
  103. package/dist/src/commands/mcp.js.map +1 -1
  104. package/dist/src/commands/memory.d.ts.map +1 -1
  105. package/dist/src/commands/memory.js +1031 -814
  106. package/dist/src/commands/memory.js.map +1 -1
  107. package/dist/src/commands/migrate.js +347 -282
  108. package/dist/src/commands/migrate.js.map +1 -1
  109. package/dist/src/commands/neural.d.ts.map +1 -1
  110. package/dist/src/commands/neural.js +1563 -1283
  111. package/dist/src/commands/neural.js.map +1 -1
  112. package/dist/src/commands/performance.js +643 -497
  113. package/dist/src/commands/performance.js.map +1 -1
  114. package/dist/src/commands/plugins.js +841 -668
  115. package/dist/src/commands/plugins.js.map +1 -1
  116. package/dist/src/commands/process.js +447 -392
  117. package/dist/src/commands/process.js.map +1 -1
  118. package/dist/src/commands/progress.js +256 -162
  119. package/dist/src/commands/progress.js.map +1 -1
  120. package/dist/src/commands/providers.js +220 -150
  121. package/dist/src/commands/providers.js.map +1 -1
  122. package/dist/src/commands/route.js +665 -520
  123. package/dist/src/commands/route.js.map +1 -1
  124. package/dist/src/commands/ruvector/backup.js +651 -505
  125. package/dist/src/commands/ruvector/backup.js.map +1 -1
  126. package/dist/src/commands/ruvector/benchmark.js +401 -349
  127. package/dist/src/commands/ruvector/benchmark.js.map +1 -1
  128. package/dist/src/commands/ruvector/import.js +267 -225
  129. package/dist/src/commands/ruvector/import.js.map +1 -1
  130. package/dist/src/commands/ruvector/index.js +75 -37
  131. package/dist/src/commands/ruvector/index.js.map +1 -1
  132. package/dist/src/commands/ruvector/init.js +359 -336
  133. package/dist/src/commands/ruvector/init.js.map +1 -1
  134. package/dist/src/commands/ruvector/migrate.js +322 -335
  135. package/dist/src/commands/ruvector/migrate.js.map +1 -1
  136. package/dist/src/commands/ruvector/optimize.js +431 -375
  137. package/dist/src/commands/ruvector/optimize.js.map +1 -1
  138. package/dist/src/commands/ruvector/setup.js +117 -703
  139. package/dist/src/commands/ruvector/setup.js.map +1 -1
  140. package/dist/src/commands/ruvector/status.js +419 -364
  141. package/dist/src/commands/ruvector/status.js.map +1 -1
  142. package/dist/src/commands/security.d.ts.map +1 -1
  143. package/dist/src/commands/security.js +610 -456
  144. package/dist/src/commands/security.js.map +1 -1
  145. package/dist/src/commands/session.d.ts +1 -1
  146. package/dist/src/commands/session.js +627 -505
  147. package/dist/src/commands/session.js.map +1 -1
  148. package/dist/src/commands/start.d.ts +1 -1
  149. package/dist/src/commands/start.js +368 -271
  150. package/dist/src/commands/start.js.map +1 -1
  151. package/dist/src/commands/status.d.ts +1 -1
  152. package/dist/src/commands/status.d.ts.map +1 -1
  153. package/dist/src/commands/status.js +492 -379
  154. package/dist/src/commands/status.js.map +1 -1
  155. package/dist/src/commands/swarm.js +488 -408
  156. package/dist/src/commands/swarm.js.map +1 -1
  157. package/dist/src/commands/task.d.ts +1 -1
  158. package/dist/src/commands/task.js +539 -424
  159. package/dist/src/commands/task.js.map +1 -1
  160. package/dist/src/commands/transfer-store.js +412 -322
  161. package/dist/src/commands/transfer-store.js.map +1 -1
  162. package/dist/src/commands/update.js +291 -196
  163. package/dist/src/commands/update.js.map +1 -1
  164. package/dist/src/commands/workflow.js +486 -386
  165. package/dist/src/commands/workflow.js.map +1 -1
  166. package/dist/src/config-adapter.js +40 -39
  167. package/dist/src/config-adapter.js.map +1 -1
  168. package/dist/src/index.js +416 -312
  169. package/dist/src/index.js.map +1 -1
  170. package/dist/src/infrastructure/in-memory-repositories.js +507 -246
  171. package/dist/src/infrastructure/in-memory-repositories.js.map +1 -1
  172. package/dist/src/init/claudemd-generator.js +78 -368
  173. package/dist/src/init/claudemd-generator.js.map +1 -1
  174. package/dist/src/init/executor.js +1019 -1345
  175. package/dist/src/init/executor.js.map +1 -1
  176. package/dist/src/init/helpers-generator.js +60 -635
  177. package/dist/src/init/helpers-generator.js.map +1 -1
  178. package/dist/src/init/index.d.ts +1 -1
  179. package/dist/src/init/index.d.ts.map +1 -1
  180. package/dist/src/init/index.js +1 -1
  181. package/dist/src/init/index.js.map +1 -1
  182. package/dist/src/init/mcp-generator.d.ts +0 -1
  183. package/dist/src/init/mcp-generator.d.ts.map +1 -1
  184. package/dist/src/init/mcp-generator.js +62 -42
  185. package/dist/src/init/mcp-generator.js.map +1 -1
  186. package/dist/src/init/settings-generator.d.ts.map +1 -1
  187. package/dist/src/init/settings-generator.js +167 -100
  188. package/dist/src/init/settings-generator.js.map +1 -1
  189. package/dist/src/init/statusline-generator.d.ts +16 -8
  190. package/dist/src/init/statusline-generator.d.ts.map +1 -1
  191. package/dist/src/init/statusline-generator.js +20 -1300
  192. package/dist/src/init/statusline-generator.js.map +1 -1
  193. package/dist/src/init/types.d.ts +15 -5
  194. package/dist/src/init/types.d.ts.map +1 -1
  195. package/dist/src/init/types.js +66 -76
  196. package/dist/src/init/types.js.map +1 -1
  197. package/dist/src/mcp-client.js +130 -76
  198. package/dist/src/mcp-client.js.map +1 -1
  199. package/dist/src/mcp-server.js +758 -445
  200. package/dist/src/mcp-server.js.map +1 -1
  201. package/dist/src/mcp-tools/agent-tools.js +492 -391
  202. package/dist/src/mcp-tools/agent-tools.js.map +1 -1
  203. package/dist/src/mcp-tools/agentdb-tools.d.ts +30 -0
  204. package/dist/src/mcp-tools/agentdb-tools.d.ts.map +1 -0
  205. package/dist/src/mcp-tools/agentdb-tools.js +758 -0
  206. package/dist/src/mcp-tools/agentdb-tools.js.map +1 -0
  207. package/dist/src/mcp-tools/analyze-tools.js +236 -172
  208. package/dist/src/mcp-tools/analyze-tools.js.map +1 -1
  209. package/dist/src/mcp-tools/auto-install.js +142 -80
  210. package/dist/src/mcp-tools/auto-install.js.map +1 -1
  211. package/dist/src/mcp-tools/browser-tools.js +375 -252
  212. package/dist/src/mcp-tools/browser-tools.js.map +1 -1
  213. package/dist/src/mcp-tools/claims-tools.js +565 -473
  214. package/dist/src/mcp-tools/claims-tools.js.map +1 -1
  215. package/dist/src/mcp-tools/config-tools.d.ts.map +1 -1
  216. package/dist/src/mcp-tools/config-tools.js +284 -190
  217. package/dist/src/mcp-tools/config-tools.js.map +1 -1
  218. package/dist/src/mcp-tools/coordination-tools.d.ts.map +1 -1
  219. package/dist/src/mcp-tools/coordination-tools.js +600 -349
  220. package/dist/src/mcp-tools/coordination-tools.js.map +1 -1
  221. package/dist/src/mcp-tools/daa-tools.js +367 -289
  222. package/dist/src/mcp-tools/daa-tools.js.map +1 -1
  223. package/dist/src/mcp-tools/embeddings-tools.js +693 -582
  224. package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
  225. package/dist/src/mcp-tools/github-tools.js +312 -261
  226. package/dist/src/mcp-tools/github-tools.js.map +1 -1
  227. package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -1
  228. package/dist/src/mcp-tools/hive-mind-tools.js +718 -423
  229. package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
  230. package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
  231. package/dist/src/mcp-tools/hooks-tools.js +2726 -1978
  232. package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
  233. package/dist/src/mcp-tools/index.d.ts +2 -0
  234. package/dist/src/mcp-tools/index.d.ts.map +1 -1
  235. package/dist/src/mcp-tools/index.js +2 -0
  236. package/dist/src/mcp-tools/index.js.map +1 -1
  237. package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -1
  238. package/dist/src/mcp-tools/memory-tools.js +514 -329
  239. package/dist/src/mcp-tools/memory-tools.js.map +1 -1
  240. package/dist/src/mcp-tools/neural-tools.d.ts.map +1 -1
  241. package/dist/src/mcp-tools/neural-tools.js +428 -326
  242. package/dist/src/mcp-tools/neural-tools.js.map +1 -1
  243. package/dist/src/mcp-tools/performance-tools.js +480 -420
  244. package/dist/src/mcp-tools/performance-tools.js.map +1 -1
  245. package/dist/src/mcp-tools/progress-tools.js +278 -204
  246. package/dist/src/mcp-tools/progress-tools.js.map +1 -1
  247. package/dist/src/mcp-tools/ruvllm-tools.d.ts +9 -0
  248. package/dist/src/mcp-tools/ruvllm-tools.d.ts.map +1 -0
  249. package/dist/src/mcp-tools/ruvllm-tools.js +399 -0
  250. package/dist/src/mcp-tools/ruvllm-tools.js.map +1 -0
  251. package/dist/src/mcp-tools/security-tools.js +429 -297
  252. package/dist/src/mcp-tools/security-tools.js.map +1 -1
  253. package/dist/src/mcp-tools/session-tools.js +234 -185
  254. package/dist/src/mcp-tools/session-tools.js.map +1 -1
  255. package/dist/src/mcp-tools/swarm-tools.d.ts +2 -1
  256. package/dist/src/mcp-tools/swarm-tools.d.ts.map +1 -1
  257. package/dist/src/mcp-tools/swarm-tools.js +303 -64
  258. package/dist/src/mcp-tools/swarm-tools.js.map +1 -1
  259. package/dist/src/mcp-tools/system-tools.d.ts.map +1 -1
  260. package/dist/src/mcp-tools/system-tools.js +352 -200
  261. package/dist/src/mcp-tools/system-tools.js.map +1 -1
  262. package/dist/src/mcp-tools/task-tools.d.ts.map +1 -1
  263. package/dist/src/mcp-tools/task-tools.js +357 -189
  264. package/dist/src/mcp-tools/task-tools.js.map +1 -1
  265. package/dist/src/mcp-tools/terminal-tools.js +196 -148
  266. package/dist/src/mcp-tools/terminal-tools.js.map +1 -1
  267. package/dist/src/mcp-tools/transfer-tools.js +333 -186
  268. package/dist/src/mcp-tools/transfer-tools.js.map +1 -1
  269. package/dist/src/mcp-tools/wasm-agent-tools.d.ts +9 -0
  270. package/dist/src/mcp-tools/wasm-agent-tools.d.ts.map +1 -0
  271. package/dist/src/mcp-tools/wasm-agent-tools.js +377 -0
  272. package/dist/src/mcp-tools/wasm-agent-tools.js.map +1 -0
  273. package/dist/src/mcp-tools/workflow-tools.d.ts.map +1 -1
  274. package/dist/src/mcp-tools/workflow-tools.js +471 -335
  275. package/dist/src/mcp-tools/workflow-tools.js.map +1 -1
  276. package/dist/src/memory/ewc-consolidation.js +345 -173
  277. package/dist/src/memory/ewc-consolidation.js.map +1 -1
  278. package/dist/src/memory/intelligence.js +841 -359
  279. package/dist/src/memory/intelligence.js.map +1 -1
  280. package/dist/src/memory/memory-bridge.js +1964 -0
  281. package/dist/src/memory/memory-bridge.js.map +1 -0
  282. package/dist/src/memory/memory-initializer.js +1895 -1602
  283. package/dist/src/memory/memory-initializer.js.map +1 -1
  284. package/dist/src/memory/sona-optimizer.js +329 -199
  285. package/dist/src/memory/sona-optimizer.js.map +1 -1
  286. package/dist/src/output.d.ts +2 -2
  287. package/dist/src/output.d.ts.map +1 -1
  288. package/dist/src/output.js +273 -242
  289. package/dist/src/output.js.map +1 -1
  290. package/dist/src/parser.js +217 -124
  291. package/dist/src/parser.js.map +1 -1
  292. package/dist/src/plugins/manager.js +531 -278
  293. package/dist/src/plugins/manager.js.map +1 -1
  294. package/dist/src/plugins/store/discovery.js +362 -275
  295. package/dist/src/plugins/store/discovery.js.map +1 -1
  296. package/dist/src/plugins/store/index.js +105 -48
  297. package/dist/src/plugins/store/index.js.map +1 -1
  298. package/dist/src/plugins/store/search.js +107 -69
  299. package/dist/src/plugins/store/search.js.map +1 -1
  300. package/dist/src/plugins/tests/demo-plugin-store.js +160 -113
  301. package/dist/src/plugins/tests/demo-plugin-store.js.map +1 -1
  302. package/dist/src/plugins/tests/standalone-test.js +223 -172
  303. package/dist/src/plugins/tests/standalone-test.js.map +1 -1
  304. package/dist/src/plugins/tests/test-plugin-store.js +228 -190
  305. package/dist/src/plugins/tests/test-plugin-store.js.map +1 -1
  306. package/dist/src/production/circuit-breaker.js +126 -62
  307. package/dist/src/production/circuit-breaker.js.map +1 -1
  308. package/dist/src/production/error-handler.js +156 -86
  309. package/dist/src/production/error-handler.js.map +1 -1
  310. package/dist/src/production/monitoring.js +220 -139
  311. package/dist/src/production/monitoring.js.map +1 -1
  312. package/dist/src/production/rate-limiter.js +93 -74
  313. package/dist/src/production/rate-limiter.js.map +1 -1
  314. package/dist/src/production/retry.js +167 -75
  315. package/dist/src/production/retry.js.map +1 -1
  316. package/dist/src/prompt.js +560 -436
  317. package/dist/src/prompt.js.map +1 -1
  318. package/dist/src/runtime/headless.js +289 -200
  319. package/dist/src/runtime/headless.js.map +1 -1
  320. package/dist/src/ruvector/agent-wasm.js +511 -0
  321. package/dist/src/ruvector/agent-wasm.js.map +1 -0
  322. package/dist/src/ruvector/ast-analyzer.js +232 -145
  323. package/dist/src/ruvector/ast-analyzer.js.map +1 -1
  324. package/dist/src/ruvector/coverage-router.js +419 -287
  325. package/dist/src/ruvector/coverage-router.js.map +1 -1
  326. package/dist/src/ruvector/coverage-tools.js +101 -56
  327. package/dist/src/ruvector/coverage-tools.js.map +1 -1
  328. package/dist/src/ruvector/diff-classifier.js +451 -324
  329. package/dist/src/ruvector/diff-classifier.js.map +1 -1
  330. package/dist/src/ruvector/enhanced-model-router.js +337 -251
  331. package/dist/src/ruvector/enhanced-model-router.js.map +1 -1
  332. package/dist/src/ruvector/flash-attention.js +254 -223
  333. package/dist/src/ruvector/flash-attention.js.map +1 -1
  334. package/dist/src/ruvector/graph-analyzer.js +680 -486
  335. package/dist/src/ruvector/graph-analyzer.js.map +1 -1
  336. package/dist/src/ruvector/index.js +113 -27
  337. package/dist/src/ruvector/index.js.map +1 -1
  338. package/dist/src/ruvector/lora-adapter.js +248 -155
  339. package/dist/src/ruvector/lora-adapter.js.map +1 -1
  340. package/dist/src/ruvector/model-router.js +248 -175
  341. package/dist/src/ruvector/model-router.js.map +1 -1
  342. package/dist/src/ruvector/moe-router.js +286 -228
  343. package/dist/src/ruvector/moe-router.js.map +1 -1
  344. package/dist/src/ruvector/q-learning-router.js +338 -257
  345. package/dist/src/ruvector/q-learning-router.js.map +1 -1
  346. package/dist/src/ruvector/ruvllm-wasm.js +527 -0
  347. package/dist/src/ruvector/ruvllm-wasm.js.map +1 -0
  348. package/dist/src/ruvector/semantic-router.js +67 -60
  349. package/dist/src/ruvector/semantic-router.js.map +1 -1
  350. package/dist/src/ruvector/vector-db.js +205 -119
  351. package/dist/src/ruvector/vector-db.js.map +1 -1
  352. package/dist/src/services/agentic-flow-bridge.js +168 -0
  353. package/dist/src/services/agentic-flow-bridge.js.map +1 -0
  354. package/dist/src/services/claim-service.js +940 -615
  355. package/dist/src/services/claim-service.js.map +1 -1
  356. package/dist/src/services/container-worker-pool.js +669 -399
  357. package/dist/src/services/container-worker-pool.js.map +1 -1
  358. package/dist/src/services/headless-worker-executor.js +467 -441
  359. package/dist/src/services/headless-worker-executor.js.map +1 -1
  360. package/dist/src/services/index.d.ts +5 -5
  361. package/dist/src/services/index.d.ts.map +1 -1
  362. package/dist/src/services/index.js +4 -4
  363. package/dist/src/services/index.js.map +1 -1
  364. package/dist/src/services/registry-api.js +201 -93
  365. package/dist/src/services/registry-api.js.map +1 -1
  366. package/dist/src/services/ruvector-training.js +414 -144
  367. package/dist/src/services/ruvector-training.js.map +1 -1
  368. package/dist/src/services/worker-daemon.js +928 -531
  369. package/dist/src/services/worker-daemon.js.map +1 -1
  370. package/dist/src/services/worker-queue.js +550 -331
  371. package/dist/src/services/worker-queue.js.map +1 -1
  372. package/dist/src/suggest.js +55 -45
  373. package/dist/src/suggest.js.map +1 -1
  374. package/dist/src/transfer/anonymization/index.js +37 -29
  375. package/dist/src/transfer/anonymization/index.js.map +1 -1
  376. package/dist/src/transfer/deploy-seraphine.d.ts +1 -1
  377. package/dist/src/transfer/deploy-seraphine.js +156 -129
  378. package/dist/src/transfer/deploy-seraphine.js.map +1 -1
  379. package/dist/src/transfer/export.js +142 -84
  380. package/dist/src/transfer/export.js.map +1 -1
  381. package/dist/src/transfer/index.d.ts +1 -1
  382. package/dist/src/transfer/index.d.ts.map +1 -1
  383. package/dist/src/transfer/index.js +2 -0
  384. package/dist/src/transfer/index.js.map +1 -1
  385. package/dist/src/transfer/ipfs/client.js +337 -179
  386. package/dist/src/transfer/ipfs/client.js.map +1 -1
  387. package/dist/src/transfer/ipfs/upload.js +434 -290
  388. package/dist/src/transfer/ipfs/upload.js.map +1 -1
  389. package/dist/src/transfer/models/seraphine.js +58 -58
  390. package/dist/src/transfer/models/seraphine.js.map +1 -1
  391. package/dist/src/transfer/serialization/cfp.js +37 -33
  392. package/dist/src/transfer/serialization/cfp.js.map +1 -1
  393. package/dist/src/transfer/storage/gcs.js +248 -139
  394. package/dist/src/transfer/storage/gcs.js.map +1 -1
  395. package/dist/src/transfer/store/discovery.js +353 -243
  396. package/dist/src/transfer/store/discovery.js.map +1 -1
  397. package/dist/src/transfer/store/download.js +365 -243
  398. package/dist/src/transfer/store/download.js.map +1 -1
  399. package/dist/src/transfer/store/index.js +130 -63
  400. package/dist/src/transfer/store/index.js.map +1 -1
  401. package/dist/src/transfer/store/publish.js +258 -184
  402. package/dist/src/transfer/store/publish.js.map +1 -1
  403. package/dist/src/transfer/store/registry.js +73 -51
  404. package/dist/src/transfer/store/registry.js.map +1 -1
  405. package/dist/src/transfer/store/search.js +96 -64
  406. package/dist/src/transfer/store/search.js.map +1 -1
  407. package/dist/src/transfer/store/tests/standalone-test.js +231 -174
  408. package/dist/src/transfer/store/tests/standalone-test.js.map +1 -1
  409. package/dist/src/transfer/test-seraphine.js +130 -95
  410. package/dist/src/transfer/test-seraphine.js.map +1 -1
  411. package/dist/src/transfer/tests/test-store.js +239 -194
  412. package/dist/src/transfer/tests/test-store.js.map +1 -1
  413. package/dist/src/types.js +56 -27
  414. package/dist/src/types.js.map +1 -1
  415. package/dist/src/update/checker.js +183 -106
  416. package/dist/src/update/checker.js.map +1 -1
  417. package/dist/src/update/executor.js +198 -135
  418. package/dist/src/update/executor.js.map +1 -1
  419. package/dist/src/update/index.js +85 -38
  420. package/dist/src/update/index.js.map +1 -1
  421. package/dist/src/update/rate-limiter.js +31 -19
  422. package/dist/src/update/rate-limiter.js.map +1 -1
  423. package/dist/src/update/validator.js +64 -38
  424. package/dist/src/update/validator.js.map +1 -1
  425. package/dist/tsconfig.tsbuildinfo +1 -1
  426. package/package.json +13 -10
  427. package/.claude/agents/custom/accessibility-auditor.yaml +0 -56
  428. package/.claude/agents/custom/design-architect.yaml +0 -48
  429. package/.claude/agents/custom/ui-developer.yaml +0 -46
  430. package/.claude/agents/custom/ux-researcher.yaml +0 -60
  431. package/dist/src/benchmarks/pretrain/index.d.ts +0 -58
  432. package/dist/src/benchmarks/pretrain/index.d.ts.map +0 -1
  433. package/dist/src/commands/index.d.ts +0 -108
  434. package/dist/src/commands/index.d.ts.map +0 -1
  435. package/dist/src/config-adapter.d.ts +0 -15
  436. package/dist/src/config-adapter.d.ts.map +0 -1
  437. package/dist/src/index.d.ts +0 -76
  438. package/dist/src/index.d.ts.map +0 -1
  439. package/dist/src/infrastructure/in-memory-repositories.d.ts +0 -68
  440. package/dist/src/infrastructure/in-memory-repositories.d.ts.map +0 -1
  441. package/dist/src/init/claudemd-generator.d.ts +0 -25
  442. package/dist/src/init/claudemd-generator.d.ts.map +0 -1
  443. package/dist/src/init/executor.d.ts +0 -41
  444. package/dist/src/init/executor.d.ts.map +0 -1
  445. package/dist/src/init/helpers-generator.d.ts +0 -60
  446. package/dist/src/init/helpers-generator.d.ts.map +0 -1
  447. package/dist/src/mcp-client.d.ts +0 -92
  448. package/dist/src/mcp-client.d.ts.map +0 -1
  449. package/dist/src/mcp-server.d.ts +0 -161
  450. package/dist/src/mcp-server.d.ts.map +0 -1
  451. package/dist/src/mcp-tools/auto-install.d.ts +0 -83
  452. package/dist/src/mcp-tools/auto-install.d.ts.map +0 -1
  453. package/dist/src/mcp-tools/types.d.ts +0 -31
  454. package/dist/src/mcp-tools/types.d.ts.map +0 -1
  455. package/dist/src/memory/ewc-consolidation.d.ts +0 -271
  456. package/dist/src/memory/ewc-consolidation.d.ts.map +0 -1
  457. package/dist/src/memory/intelligence.d.ts +0 -285
  458. package/dist/src/memory/intelligence.d.ts.map +0 -1
  459. package/dist/src/memory/memory-initializer.d.ts +0 -396
  460. package/dist/src/memory/memory-initializer.d.ts.map +0 -1
  461. package/dist/src/memory/sona-optimizer.d.ts +0 -227
  462. package/dist/src/memory/sona-optimizer.d.ts.map +0 -1
  463. package/dist/src/parser.d.ts +0 -41
  464. package/dist/src/parser.d.ts.map +0 -1
  465. package/dist/src/plugins/manager.d.ts +0 -133
  466. package/dist/src/plugins/manager.d.ts.map +0 -1
  467. package/dist/src/plugins/store/discovery.d.ts +0 -88
  468. package/dist/src/plugins/store/discovery.d.ts.map +0 -1
  469. package/dist/src/plugins/store/index.d.ts +0 -76
  470. package/dist/src/plugins/store/index.d.ts.map +0 -1
  471. package/dist/src/plugins/store/search.d.ts +0 -46
  472. package/dist/src/plugins/store/search.d.ts.map +0 -1
  473. package/dist/src/plugins/store/types.d.ts +0 -274
  474. package/dist/src/plugins/store/types.d.ts.map +0 -1
  475. package/dist/src/production/circuit-breaker.d.ts +0 -101
  476. package/dist/src/production/circuit-breaker.d.ts.map +0 -1
  477. package/dist/src/production/error-handler.d.ts +0 -92
  478. package/dist/src/production/error-handler.d.ts.map +0 -1
  479. package/dist/src/production/monitoring.d.ts +0 -161
  480. package/dist/src/production/monitoring.d.ts.map +0 -1
  481. package/dist/src/production/rate-limiter.d.ts +0 -80
  482. package/dist/src/production/rate-limiter.d.ts.map +0 -1
  483. package/dist/src/production/retry.d.ts +0 -48
  484. package/dist/src/production/retry.d.ts.map +0 -1
  485. package/dist/src/prompt.d.ts +0 -44
  486. package/dist/src/prompt.d.ts.map +0 -1
  487. package/dist/src/runtime/headless.d.ts +0 -60
  488. package/dist/src/runtime/headless.d.ts.map +0 -1
  489. package/dist/src/ruvector/ast-analyzer.d.ts +0 -67
  490. package/dist/src/ruvector/ast-analyzer.d.ts.map +0 -1
  491. package/dist/src/ruvector/coverage-router.d.ts +0 -160
  492. package/dist/src/ruvector/coverage-router.d.ts.map +0 -1
  493. package/dist/src/ruvector/diff-classifier.d.ts +0 -175
  494. package/dist/src/ruvector/diff-classifier.d.ts.map +0 -1
  495. package/dist/src/ruvector/enhanced-model-router.d.ts +0 -146
  496. package/dist/src/ruvector/enhanced-model-router.d.ts.map +0 -1
  497. package/dist/src/ruvector/flash-attention.d.ts +0 -195
  498. package/dist/src/ruvector/flash-attention.d.ts.map +0 -1
  499. package/dist/src/ruvector/graph-analyzer.d.ts +0 -187
  500. package/dist/src/ruvector/graph-analyzer.d.ts.map +0 -1
  501. package/dist/src/ruvector/index.d.ts +0 -34
  502. package/dist/src/ruvector/index.d.ts.map +0 -1
  503. package/dist/src/ruvector/lora-adapter.d.ts +0 -218
  504. package/dist/src/ruvector/lora-adapter.d.ts.map +0 -1
  505. package/dist/src/ruvector/model-router.d.ts +0 -220
  506. package/dist/src/ruvector/model-router.d.ts.map +0 -1
  507. package/dist/src/ruvector/moe-router.d.ts +0 -206
  508. package/dist/src/ruvector/moe-router.d.ts.map +0 -1
  509. package/dist/src/ruvector/q-learning-router.d.ts +0 -211
  510. package/dist/src/ruvector/q-learning-router.d.ts.map +0 -1
  511. package/dist/src/ruvector/semantic-router.d.ts +0 -77
  512. package/dist/src/ruvector/semantic-router.d.ts.map +0 -1
  513. package/dist/src/ruvector/vector-db.d.ts +0 -69
  514. package/dist/src/ruvector/vector-db.d.ts.map +0 -1
  515. package/dist/src/services/claim-service.d.ts +0 -204
  516. package/dist/src/services/claim-service.d.ts.map +0 -1
  517. package/dist/src/services/container-worker-pool.d.ts +0 -197
  518. package/dist/src/services/container-worker-pool.d.ts.map +0 -1
  519. package/dist/src/services/headless-worker-executor.d.ts +0 -304
  520. package/dist/src/services/headless-worker-executor.d.ts.map +0 -1
  521. package/dist/src/services/registry-api.d.ts +0 -58
  522. package/dist/src/services/registry-api.d.ts.map +0 -1
  523. package/dist/src/services/ruvector-training.d.ts +0 -213
  524. package/dist/src/services/ruvector-training.d.ts.map +0 -1
  525. package/dist/src/services/worker-daemon.d.ts +0 -203
  526. package/dist/src/services/worker-daemon.d.ts.map +0 -1
  527. package/dist/src/services/worker-queue.d.ts +0 -194
  528. package/dist/src/services/worker-queue.d.ts.map +0 -1
  529. package/dist/src/suggest.d.ts +0 -53
  530. package/dist/src/suggest.d.ts.map +0 -1
  531. package/dist/src/transfer/export.d.ts +0 -25
  532. package/dist/src/transfer/export.d.ts.map +0 -1
  533. package/dist/src/transfer/ipfs/client.d.ts +0 -109
  534. package/dist/src/transfer/ipfs/client.d.ts.map +0 -1
  535. package/dist/src/transfer/ipfs/upload.d.ts +0 -95
  536. package/dist/src/transfer/ipfs/upload.d.ts.map +0 -1
  537. package/dist/src/transfer/models/seraphine.d.ts +0 -72
  538. package/dist/src/transfer/models/seraphine.d.ts.map +0 -1
  539. package/dist/src/transfer/serialization/cfp.d.ts +0 -49
  540. package/dist/src/transfer/serialization/cfp.d.ts.map +0 -1
  541. package/dist/src/transfer/storage/gcs.d.ts +0 -82
  542. package/dist/src/transfer/storage/gcs.d.ts.map +0 -1
  543. package/dist/src/transfer/store/discovery.d.ts +0 -84
  544. package/dist/src/transfer/store/discovery.d.ts.map +0 -1
  545. package/dist/src/transfer/store/download.d.ts +0 -70
  546. package/dist/src/transfer/store/download.d.ts.map +0 -1
  547. package/dist/src/transfer/store/index.d.ts +0 -84
  548. package/dist/src/transfer/store/index.d.ts.map +0 -1
  549. package/dist/src/transfer/store/publish.d.ts +0 -76
  550. package/dist/src/transfer/store/publish.d.ts.map +0 -1
  551. package/dist/src/transfer/store/search.d.ts +0 -54
  552. package/dist/src/transfer/store/search.d.ts.map +0 -1
  553. package/dist/src/transfer/types.d.ts +0 -245
  554. package/dist/src/transfer/types.d.ts.map +0 -1
  555. package/dist/src/types.d.ts +0 -198
  556. package/dist/src/types.d.ts.map +0 -1
  557. package/dist/src/update/checker.d.ts +0 -34
  558. package/dist/src/update/checker.d.ts.map +0 -1
  559. package/dist/src/update/executor.d.ts +0 -32
  560. package/dist/src/update/executor.d.ts.map +0 -1
  561. package/dist/src/update/index.d.ts +0 -33
  562. package/dist/src/update/index.d.ts.map +0 -1
  563. package/dist/src/update/rate-limiter.d.ts +0 -20
  564. package/dist/src/update/rate-limiter.d.ts.map +0 -1
  565. package/dist/src/update/validator.d.ts +0 -17
  566. package/dist/src/update/validator.d.ts.map +0 -1
@@ -5,6 +5,42 @@
5
5
  * Updated to support --claude flag for launching interactive Claude Code sessions
6
6
  * PR: Fix #955 - Implement --claude flag for hive-mind spawn command
7
7
  */
8
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
9
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10
+ return new (P || (P = Promise))(function (resolve, reject) {
11
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
12
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
13
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
14
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
15
+ });
16
+ };
17
+ var __generator = (this && this.__generator) || function (thisArg, body) {
18
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
19
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
20
+ function verb(n) { return function (v) { return step([n, v]); }; }
21
+ function step(op) {
22
+ if (f) throw new TypeError("Generator is already executing.");
23
+ while (_) try {
24
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
25
+ if (y = 0, t) op = [op[0] & 2, t.value];
26
+ switch (op[0]) {
27
+ case 0: case 1: t = op; break;
28
+ case 4: _.label++; return { value: op[1], done: false };
29
+ case 5: _.label++; y = op[1]; op = [0]; continue;
30
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
31
+ default:
32
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
33
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
34
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
35
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
36
+ if (t[2]) _.ops.pop();
37
+ _.trys.pop(); continue;
38
+ }
39
+ op = body.call(thisArg, _);
40
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
41
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
42
+ }
43
+ };
8
44
  import { output } from '../output.js';
9
45
  import { select, confirm, input } from '../prompt.js';
10
46
  import { callMCPTool, MCPClientError } from '../mcp-client.js';
@@ -12,14 +48,14 @@ import { spawn as childSpawn, execSync } from 'child_process';
12
48
  import { mkdir, writeFile } from 'fs/promises';
13
49
  import { join } from 'path';
14
50
  // Hive topologies
15
- const TOPOLOGIES = [
51
+ var TOPOLOGIES = [
16
52
  { value: 'hierarchical', label: 'Hierarchical', hint: 'Queen-led with worker agents' },
17
53
  { value: 'mesh', label: 'Mesh', hint: 'Peer-to-peer coordination' },
18
54
  { value: 'hierarchical-mesh', label: 'Hierarchical Mesh', hint: 'Queen + peer communication (recommended)' },
19
55
  { value: 'adaptive', label: 'Adaptive', hint: 'Dynamic topology based on task' }
20
56
  ];
21
57
  // Consensus strategies
22
- const CONSENSUS_STRATEGIES = [
58
+ var CONSENSUS_STRATEGIES = [
23
59
  { value: 'byzantine', label: 'Byzantine Fault Tolerant', hint: '2/3 majority, handles malicious actors' },
24
60
  { value: 'raft', label: 'Raft', hint: 'Leader-based consensus' },
25
61
  { value: 'gossip', label: 'Gossip', hint: 'Eventually consistent, scalable' },
@@ -30,9 +66,10 @@ const CONSENSUS_STRATEGIES = [
30
66
  * Group workers by their type for prompt generation
31
67
  */
32
68
  function groupWorkersByType(workers) {
33
- const groups = {};
34
- for (const worker of workers) {
35
- const type = worker.type || worker.role || 'worker';
69
+ var groups = {};
70
+ for (var _i = 0, workers_1 = workers; _i < workers_1.length; _i++) {
71
+ var worker = workers_1[_i];
72
+ var type = worker.type || worker.role || 'worker';
36
73
  if (!groups[type]) {
37
74
  groups[type] = [];
38
75
  }
@@ -45,267 +82,187 @@ function groupWorkersByType(workers) {
45
82
  * Ported from v2.7.47 with enhancements for v3
46
83
  */
47
84
  function generateHiveMindPrompt(swarmId, swarmName, objective, workers, workerGroups, flags) {
48
- const currentTime = new Date().toISOString();
49
- const workerTypes = Object.keys(workerGroups);
50
- const queenType = flags.queenType || 'strategic';
51
- const consensusAlgorithm = flags.consensus || 'byzantine';
52
- const topology = flags.topology || 'hierarchical-mesh';
53
- return `🧠 HIVE MIND COLLECTIVE INTELLIGENCE SYSTEM
54
- ═══════════════════════════════════════════════
55
-
56
- You are the Queen coordinator of a Hive Mind swarm with collective intelligence capabilities.
57
-
58
- HIVE MIND CONFIGURATION:
59
- 📌 Swarm ID: ${swarmId}
60
- 📌 Swarm Name: ${swarmName}
61
- 🎯 Objective: ${objective}
62
- 👑 Queen Type: ${queenType}
63
- 🐝 Worker Count: ${workers.length}
64
- 🔗 Topology: ${topology}
65
- 🤝 Consensus Algorithm: ${consensusAlgorithm}
66
- ⏰ Initialized: ${currentTime}
67
-
68
- WORKER DISTRIBUTION:
69
- ${workerTypes.map(type => `• ${type}: ${workerGroups[type].length} agents`).join('\n')}
70
-
71
- 🔧 AVAILABLE MCP TOOLS FOR HIVE MIND COORDINATION:
72
-
73
- 1️⃣ **COLLECTIVE INTELLIGENCE**
74
- mcp__claude-flow__hive-mind_consensus - Democratic decision making
75
- mcp__claude-flow__hive-mind_memory - Share knowledge across the hive
76
- mcp__claude-flow__hive-mind_broadcast - Broadcast to all workers
77
- mcp__claude-flow__neural_patterns - Neural pattern recognition
78
-
79
- 2️⃣ **QUEEN COORDINATION**
80
- mcp__claude-flow__hive-mind_status - Monitor swarm health
81
- mcp__claude-flow__task_create - Create and delegate tasks
82
- mcp__claude-flow__task_orchestrate - Orchestrate task distribution
83
- mcp__claude-flow__agent_spawn - Spawn additional workers
84
-
85
- 3️⃣ **WORKER MANAGEMENT**
86
- mcp__claude-flow__agent_list - List all active agents
87
- mcp__claude-flow__agent_status - Check agent status
88
- mcp__claude-flow__agent_metrics - Track worker performance
89
- mcp__claude-flow__hive-mind_join - Add agent to hive
90
- mcp__claude-flow__hive-mind_leave - Remove agent from hive
91
-
92
- 4️⃣ **TASK ORCHESTRATION**
93
- mcp__claude-flow__task_create - Create hierarchical tasks
94
- mcp__claude-flow__task_status - Track task progress
95
- mcp__claude-flow__task_complete - Mark tasks complete
96
- mcp__claude-flow__workflow_create - Create workflows
97
-
98
- 5️⃣ **MEMORY & LEARNING**
99
- mcp__claude-flow__memory_store - Store collective knowledge
100
- mcp__claude-flow__memory_retrieve - Access shared memory
101
- mcp__claude-flow__memory_search - Search memory patterns
102
- mcp__claude-flow__neural_train - Learn from experiences
103
- mcp__claude-flow__hooks_intelligence_pattern-store - Store patterns
104
-
105
- 📋 HIVE MIND EXECUTION PROTOCOL:
106
-
107
- 1. **INITIALIZATION PHASE**
108
- - Verify all workers are online and responsive
109
- - Establish communication channels
110
- - Load previous session state if available
111
- - Initialize shared memory space
112
-
113
- 2. **TASK DISTRIBUTION PHASE**
114
- - Analyze the objective and decompose into subtasks
115
- - Assign tasks based on worker specializations
116
- - Set up task dependencies and ordering
117
- - Monitor parallel execution
118
-
119
- 3. **COORDINATION PHASE**
120
- - Use consensus for critical decisions
121
- - Aggregate results from workers
122
- - Resolve conflicts using ${consensusAlgorithm} consensus
123
- - Share learnings across the hive
124
-
125
- 4. **COMPLETION PHASE**
126
- - Verify all subtasks are complete
127
- - Consolidate results
128
- - Store learnings in collective memory
129
- - Report final status
130
-
131
- 🎯 YOUR OBJECTIVE:
132
- ${objective}
133
-
134
- 💡 COORDINATION TIPS:
135
- • Use mcp__claude-flow__hive-mind_broadcast for swarm-wide announcements
136
- • Check worker status regularly with mcp__claude-flow__hive-mind_status
137
- • Store important decisions in shared memory for persistence
138
- • Use consensus for any decisions affecting multiple workers
139
- • Monitor task progress and reassign if workers are blocked
140
-
141
- 🚀 BEGIN HIVE MIND COORDINATION NOW!
142
- Start by checking the current hive status and then proceed with the objective.
143
- `;
85
+ var currentTime = new Date().toISOString();
86
+ var workerTypes = Object.keys(workerGroups);
87
+ var queenType = flags.queenType || 'strategic';
88
+ var consensusAlgorithm = flags.consensus || 'byzantine';
89
+ var topology = flags.topology || 'hierarchical-mesh';
90
+ return "\uD83E\uDDE0 HIVE MIND COLLECTIVE INTELLIGENCE SYSTEM\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\nYou are the Queen coordinator of a Hive Mind swarm with collective intelligence capabilities.\n\nHIVE MIND CONFIGURATION:\n\uD83D\uDCCC Swarm ID: " + swarmId + "\n\uD83D\uDCCC Swarm Name: " + swarmName + "\n\uD83C\uDFAF Objective: " + objective + "\n\uD83D\uDC51 Queen Type: " + queenType + "\n\uD83D\uDC1D Worker Count: " + workers.length + "\n\uD83D\uDD17 Topology: " + topology + "\n\uD83E\uDD1D Consensus Algorithm: " + consensusAlgorithm + "\n\u23F0 Initialized: " + currentTime + "\n\nWORKER DISTRIBUTION:\n" + workerTypes.map(function (type) { return "\u2022 " + type + ": " + workerGroups[type].length + " agents"; }).join('\n') + "\n\n\uD83D\uDD27 AVAILABLE MCP TOOLS FOR HIVE MIND COORDINATION:\n\n1\uFE0F\u20E3 **COLLECTIVE INTELLIGENCE**\n mcp__ruflo__hive-mind_consensus - Democratic decision making\n mcp__ruflo__hive-mind_memory - Share knowledge across the hive\n mcp__ruflo__hive-mind_broadcast - Broadcast to all workers\n mcp__ruflo__neural_patterns - Neural pattern recognition\n\n2\uFE0F\u20E3 **QUEEN COORDINATION**\n mcp__ruflo__hive-mind_status - Monitor swarm health\n mcp__ruflo__task_create - Create and delegate tasks\n mcp__ruflo__coordination_orchestrate - Orchestrate task distribution\n mcp__ruflo__agent_spawn - Spawn additional workers\n\n3\uFE0F\u20E3 **WORKER MANAGEMENT**\n mcp__ruflo__agent_list - List all active agents\n mcp__ruflo__agent_status - Check agent status\n mcp__ruflo__agent_health - Check worker health\n mcp__ruflo__hive-mind_join - Add agent to hive\n mcp__ruflo__hive-mind_leave - Remove agent from hive\n\n4\uFE0F\u20E3 **TASK ORCHESTRATION**\n mcp__ruflo__task_assign - Assign tasks to workers\n mcp__ruflo__task_status - Track task progress\n mcp__ruflo__task_complete - Mark tasks complete\n mcp__ruflo__workflow_create - Create workflows\n\n5\uFE0F\u20E3 **MEMORY & LEARNING**\n mcp__ruflo__memory_store - Store collective knowledge\n mcp__ruflo__memory_retrieve - Access shared memory\n mcp__ruflo__memory_search - Search memory patterns\n mcp__ruflo__neural_train - Learn from experiences\n mcp__ruflo__hooks_intelligence_pattern-store - Store patterns\n\n\uD83D\uDCCB HIVE MIND EXECUTION PROTOCOL:\n\n1. **INITIALIZATION PHASE**\n - Verify all workers are online and responsive\n - Establish communication channels\n - Load previous session state if available\n - Initialize shared memory space\n\n2. **TASK DISTRIBUTION PHASE**\n - Analyze the objective and decompose into subtasks\n - Assign tasks based on worker specializations\n - Set up task dependencies and ordering\n - Monitor parallel execution\n\n3. **COORDINATION PHASE**\n - Use consensus for critical decisions\n - Aggregate results from workers\n - Resolve conflicts using " + consensusAlgorithm + " consensus\n - Share learnings across the hive\n\n4. **COMPLETION PHASE**\n - Verify all subtasks are complete\n - Consolidate results\n - Store learnings in collective memory\n - Report final status\n\n\uD83C\uDFAF YOUR OBJECTIVE:\n" + objective + "\n\n\uD83D\uDCA1 COORDINATION TIPS:\n\u2022 Use mcp__ruflo__hive-mind_broadcast for swarm-wide announcements\n\u2022 Check worker status regularly with mcp__ruflo__hive-mind_status\n\u2022 Store important decisions in shared memory for persistence\n\u2022 Use consensus for any decisions affecting multiple workers\n\u2022 Use mcp__ruflo__task_assign to assign tasks to workers, then mcp__ruflo__task_complete when done\n\n\uD83D\uDE80 BEGIN HIVE MIND COORDINATION NOW!\nStart by checking the current hive status and then proceed with the objective.\n";
144
91
  }
145
92
  /**
146
93
  * Spawn Claude Code with Hive Mind coordination instructions
147
94
  * Ported from v2.7.47 spawnClaudeCodeInstances function
148
95
  */
149
- async function spawnClaudeCodeInstance(swarmId, swarmName, objective, workers, flags) {
150
- output.writeln();
151
- output.writeln(output.bold('🚀 Launching Claude Code with Hive Mind Coordination'));
152
- output.writeln(output.dim('─'.repeat(60)));
153
- const spinner = output.createSpinner({ text: 'Preparing Hive Mind coordination prompt...', spinner: 'dots' });
154
- spinner.start();
155
- try {
156
- // Generate comprehensive Hive Mind prompt
157
- const workerGroups = groupWorkersByType(workers);
158
- const hiveMindPrompt = generateHiveMindPrompt(swarmId, swarmName, objective, workers, workerGroups, flags);
159
- spinner.succeed('Hive Mind coordination prompt ready!');
160
- // Display coordination summary
161
- output.writeln();
162
- output.writeln(output.bold('🧠 Hive Mind Configuration'));
163
- output.writeln(output.dim('─'.repeat(60)));
164
- output.printList([
165
- `Swarm ID: ${output.highlight(swarmId)}`,
166
- `Objective: ${output.highlight(objective)}`,
167
- `Queen Type: ${output.highlight(flags.queenType || 'strategic')}`,
168
- `Worker Count: ${output.highlight(String(workers.length))}`,
169
- `Worker Types: ${output.highlight(Object.keys(workerGroups).join(', '))}`,
170
- `Consensus: ${output.highlight(flags.consensus || 'byzantine')}`,
171
- `MCP Tools: ${output.success('Full KynjalFlow integration enabled')}`
172
- ]);
173
- // Ensure sessions directory exists
174
- const sessionsDir = join('.hive-mind', 'sessions');
175
- await mkdir(sessionsDir, { recursive: true });
176
- const promptFile = join(sessionsDir, `hive-mind-prompt-${swarmId}.txt`);
177
- await writeFile(promptFile, hiveMindPrompt, 'utf8');
178
- output.writeln();
179
- output.printSuccess(`Hive Mind prompt saved to: ${promptFile}`);
180
- // Check if claude command exists
181
- let claudeAvailable = false;
182
- try {
183
- execSync('which claude', { stdio: 'ignore' });
184
- claudeAvailable = true;
185
- }
186
- catch {
187
- output.writeln();
188
- output.printWarning('Claude Code CLI not found in PATH');
189
- output.writeln(output.dim('Install it with: npm install -g @anthropic-ai/claude-code'));
190
- output.writeln(output.dim('Falling back to displaying instructions...'));
191
- }
192
- const dryRun = flags.dryRun || flags['dry-run'];
193
- if (claudeAvailable && !dryRun) {
194
- // Build arguments - flags first, then prompt
195
- const claudeArgs = [];
196
- // Check for non-interactive mode
197
- const isNonInteractive = flags['non-interactive'] || flags.nonInteractive;
198
- if (isNonInteractive) {
199
- claudeArgs.push('-p'); // Print mode
200
- claudeArgs.push('--output-format', 'stream-json');
201
- claudeArgs.push('--verbose');
202
- output.printInfo('Running in non-interactive mode');
203
- }
204
- // Add auto-permission flag unless explicitly disabled
205
- const skipPermissions = flags['dangerously-skip-permissions'] !== false && !flags['no-auto-permissions'];
206
- if (skipPermissions) {
207
- claudeArgs.push('--dangerously-skip-permissions');
208
- if (!isNonInteractive) {
209
- output.printWarning('Using --dangerously-skip-permissions for seamless hive-mind execution');
210
- }
211
- }
212
- // Add the prompt as the LAST argument
213
- claudeArgs.push(hiveMindPrompt);
214
- output.writeln();
215
- output.printInfo('Launching Claude Code...');
216
- output.writeln(output.dim('Press Ctrl+C to pause the session'));
217
- // Spawn claude with properly ordered arguments
218
- const claudeProcess = childSpawn('claude', claudeArgs, {
219
- stdio: 'inherit',
220
- shell: false,
221
- });
222
- // Set up SIGINT handler for session management
223
- let isExiting = false;
224
- const sigintHandler = () => {
225
- if (isExiting)
226
- return;
227
- isExiting = true;
228
- output.writeln();
229
- output.writeln();
230
- output.printWarning('Pausing session and terminating Claude Code...');
231
- if (claudeProcess && !claudeProcess.killed) {
232
- claudeProcess.kill('SIGTERM');
233
- }
234
- output.writeln();
235
- output.printSuccess('Session paused');
236
- output.writeln(output.dim(`Prompt file saved at: ${promptFile}`));
237
- output.writeln(output.dim('To resume, run claude with the saved prompt file'));
238
- process.exit(0);
239
- };
240
- process.on('SIGINT', sigintHandler);
241
- process.on('SIGTERM', sigintHandler);
242
- // Handle process exit
243
- claudeProcess.on('exit', (code) => {
244
- // Clean up signal handlers
245
- process.removeListener('SIGINT', sigintHandler);
246
- process.removeListener('SIGTERM', sigintHandler);
247
- if (code === 0) {
96
+ function spawnClaudeCodeInstance(swarmId, swarmName, objective, workers, flags) {
97
+ return __awaiter(this, void 0, Promise, function () {
98
+ var spinner, workerGroups, hiveMindPrompt, sessionsDir, promptFile_1, claudeAvailable, dryRun, claudeArgs, isNonInteractive, skipPermissions, claudeProcess_1, isExiting_1, sigintHandler_1, error_1, errorMessage, promptFile, workerGroups, hiveMindPrompt, _a;
99
+ return __generator(this, function (_b) {
100
+ switch (_b.label) {
101
+ case 0:
248
102
  output.writeln();
249
- output.printSuccess('Claude Code completed successfully');
250
- }
251
- else if (code !== null) {
103
+ output.writeln(output.bold('🚀 Launching Claude Code with Hive Mind Coordination'));
104
+ output.writeln(output.dim('─'.repeat(60)));
105
+ spinner = output.createSpinner({ text: 'Preparing Hive Mind coordination prompt...', spinner: 'dots' });
106
+ spinner.start();
107
+ _b.label = 1;
108
+ case 1:
109
+ _b.trys.push([1, 4, , 9]);
110
+ workerGroups = groupWorkersByType(workers);
111
+ hiveMindPrompt = generateHiveMindPrompt(swarmId, swarmName, objective, workers, workerGroups, flags);
112
+ spinner.succeed('Hive Mind coordination prompt ready!');
113
+ // Display coordination summary
252
114
  output.writeln();
253
- output.printError(`Claude Code exited with code ${code}`);
254
- }
255
- });
256
- output.writeln();
257
- output.printSuccess('Claude Code launched with Hive Mind coordination');
258
- output.printInfo('The Queen coordinator will orchestrate all worker agents');
259
- output.writeln(output.dim(`Prompt file saved at: ${promptFile}`));
260
- return { success: true, promptFile };
261
- }
262
- else if (dryRun) {
263
- output.writeln();
264
- output.printInfo('Dry run - would execute Claude Code with prompt:');
265
- output.writeln(output.dim(`Prompt length: ${hiveMindPrompt.length} characters`));
266
- output.writeln();
267
- output.writeln(output.dim('First 500 characters of prompt:'));
268
- output.writeln(output.highlight(hiveMindPrompt.substring(0, 500) + '...'));
269
- output.writeln();
270
- output.writeln(output.dim(`Full prompt saved to: ${promptFile}`));
271
- return { success: true, promptFile };
272
- }
273
- else {
274
- // Claude not available - show instructions
275
- output.writeln();
276
- output.writeln(output.bold('📋 Manual Execution Instructions:'));
277
- output.writeln(output.dim('─'.repeat(50)));
278
- output.printList([
279
- 'Install Claude Code: npm install -g @anthropic-ai/claude-code',
280
- `Run with saved prompt: claude < ${promptFile}`,
281
- `Or copy manually: cat ${promptFile} | claude`,
282
- `With auto-permissions: claude --dangerously-skip-permissions < ${promptFile}`
283
- ]);
284
- return { success: true, promptFile };
285
- }
286
- }
287
- catch (error) {
288
- spinner.fail('Failed to prepare Claude Code coordination');
289
- const errorMessage = error instanceof Error ? error.message : String(error);
290
- output.printError(`Error: ${errorMessage}`);
291
- // Try to save prompt as fallback
292
- try {
293
- const promptFile = `hive-mind-prompt-${swarmId}-fallback.txt`;
294
- const workerGroups = groupWorkersByType(workers);
295
- const hiveMindPrompt = generateHiveMindPrompt(swarmId, swarmName, objective, workers, workerGroups, flags);
296
- await writeFile(promptFile, hiveMindPrompt, 'utf8');
297
- output.writeln();
298
- output.printSuccess(`Prompt saved to: ${promptFile}`);
299
- output.writeln(output.dim('You can run Claude Code manually with the saved prompt'));
300
- return { success: false, promptFile, error: errorMessage };
301
- }
302
- catch {
303
- return { success: false, error: errorMessage };
304
- }
305
- }
115
+ output.writeln(output.bold('🧠 Hive Mind Configuration'));
116
+ output.writeln(output.dim('─'.repeat(60)));
117
+ output.printList([
118
+ "Swarm ID: " + output.highlight(swarmId),
119
+ "Objective: " + output.highlight(objective),
120
+ "Queen Type: " + output.highlight(flags.queenType || 'strategic'),
121
+ "Worker Count: " + output.highlight(String(workers.length)),
122
+ "Worker Types: " + output.highlight(Object.keys(workerGroups).join(', ')),
123
+ "Consensus: " + output.highlight(flags.consensus || 'byzantine'),
124
+ "MCP Tools: " + output.success('Full Claude-Flow integration enabled')
125
+ ]);
126
+ sessionsDir = join('.hive-mind', 'sessions');
127
+ return [4 /*yield*/, mkdir(sessionsDir, { recursive: true })];
128
+ case 2:
129
+ _b.sent();
130
+ promptFile_1 = join(sessionsDir, "hive-mind-prompt-" + swarmId + ".txt");
131
+ return [4 /*yield*/, writeFile(promptFile_1, hiveMindPrompt, 'utf8')];
132
+ case 3:
133
+ _b.sent();
134
+ output.writeln();
135
+ output.printSuccess("Hive Mind prompt saved to: " + promptFile_1);
136
+ claudeAvailable = false;
137
+ try {
138
+ execSync('which claude', { stdio: 'ignore' });
139
+ claudeAvailable = true;
140
+ }
141
+ catch (_c) {
142
+ output.writeln();
143
+ output.printWarning('Claude Code CLI not found in PATH');
144
+ output.writeln(output.dim('Install it with: npm install -g @anthropic-ai/claude-code'));
145
+ output.writeln(output.dim('Falling back to displaying instructions...'));
146
+ }
147
+ dryRun = flags.dryRun || flags['dry-run'];
148
+ if (claudeAvailable && !dryRun) {
149
+ claudeArgs = [];
150
+ isNonInteractive = flags['non-interactive'] || flags.nonInteractive;
151
+ if (isNonInteractive) {
152
+ claudeArgs.push('-p'); // Print mode
153
+ claudeArgs.push('--output-format', 'stream-json');
154
+ claudeArgs.push('--verbose');
155
+ output.printInfo('Running in non-interactive mode');
156
+ }
157
+ skipPermissions = flags['dangerously-skip-permissions'] !== false && !flags['no-auto-permissions'];
158
+ if (skipPermissions) {
159
+ claudeArgs.push('--dangerously-skip-permissions');
160
+ if (!isNonInteractive) {
161
+ output.printWarning('Using --dangerously-skip-permissions for seamless hive-mind execution');
162
+ }
163
+ }
164
+ // Add the prompt as the LAST argument
165
+ claudeArgs.push(hiveMindPrompt);
166
+ output.writeln();
167
+ output.printInfo('Launching Claude Code...');
168
+ output.writeln(output.dim('Press Ctrl+C to pause the session'));
169
+ claudeProcess_1 = childSpawn('claude', claudeArgs, {
170
+ stdio: 'inherit',
171
+ shell: false
172
+ });
173
+ isExiting_1 = false;
174
+ sigintHandler_1 = function () {
175
+ if (isExiting_1)
176
+ return;
177
+ isExiting_1 = true;
178
+ output.writeln();
179
+ output.writeln();
180
+ output.printWarning('Pausing session and terminating Claude Code...');
181
+ if (claudeProcess_1 && !claudeProcess_1.killed) {
182
+ claudeProcess_1.kill('SIGTERM');
183
+ }
184
+ output.writeln();
185
+ output.printSuccess('Session paused');
186
+ output.writeln(output.dim("Prompt file saved at: " + promptFile_1));
187
+ output.writeln(output.dim('To resume, run claude with the saved prompt file'));
188
+ process.exit(0);
189
+ };
190
+ process.on('SIGINT', sigintHandler_1);
191
+ process.on('SIGTERM', sigintHandler_1);
192
+ // Handle process exit
193
+ claudeProcess_1.on('exit', function (code) {
194
+ // Clean up signal handlers
195
+ process.removeListener('SIGINT', sigintHandler_1);
196
+ process.removeListener('SIGTERM', sigintHandler_1);
197
+ if (code === 0) {
198
+ output.writeln();
199
+ output.printSuccess('Claude Code completed successfully');
200
+ }
201
+ else if (code !== null) {
202
+ output.writeln();
203
+ output.printError("Claude Code exited with code " + code);
204
+ }
205
+ });
206
+ output.writeln();
207
+ output.printSuccess('Claude Code launched with Hive Mind coordination');
208
+ output.printInfo('The Queen coordinator will orchestrate all worker agents');
209
+ output.writeln(output.dim("Prompt file saved at: " + promptFile_1));
210
+ return [2 /*return*/, { success: true, promptFile: promptFile_1 }];
211
+ }
212
+ else if (dryRun) {
213
+ output.writeln();
214
+ output.printInfo('Dry run - would execute Claude Code with prompt:');
215
+ output.writeln(output.dim("Prompt length: " + hiveMindPrompt.length + " characters"));
216
+ output.writeln();
217
+ output.writeln(output.dim('First 500 characters of prompt:'));
218
+ output.writeln(output.highlight(hiveMindPrompt.substring(0, 500) + '...'));
219
+ output.writeln();
220
+ output.writeln(output.dim("Full prompt saved to: " + promptFile_1));
221
+ return [2 /*return*/, { success: true, promptFile: promptFile_1 }];
222
+ }
223
+ else {
224
+ // Claude not available - show instructions
225
+ output.writeln();
226
+ output.writeln(output.bold('📋 Manual Execution Instructions:'));
227
+ output.writeln(output.dim('─'.repeat(50)));
228
+ output.printList([
229
+ 'Install Claude Code: npm install -g @anthropic-ai/claude-code',
230
+ "Run with saved prompt: claude < " + promptFile_1,
231
+ "Or copy manually: cat " + promptFile_1 + " | claude",
232
+ "With auto-permissions: claude --dangerously-skip-permissions < " + promptFile_1
233
+ ]);
234
+ return [2 /*return*/, { success: true, promptFile: promptFile_1 }];
235
+ }
236
+ return [3 /*break*/, 9];
237
+ case 4:
238
+ error_1 = _b.sent();
239
+ spinner.fail('Failed to prepare Claude Code coordination');
240
+ errorMessage = error_1 instanceof Error ? error_1.message : String(error_1);
241
+ output.printError("Error: " + errorMessage);
242
+ _b.label = 5;
243
+ case 5:
244
+ _b.trys.push([5, 7, , 8]);
245
+ promptFile = "hive-mind-prompt-" + swarmId + "-fallback.txt";
246
+ workerGroups = groupWorkersByType(workers);
247
+ hiveMindPrompt = generateHiveMindPrompt(swarmId, swarmName, objective, workers, workerGroups, flags);
248
+ return [4 /*yield*/, writeFile(promptFile, hiveMindPrompt, 'utf8')];
249
+ case 6:
250
+ _b.sent();
251
+ output.writeln();
252
+ output.printSuccess("Prompt saved to: " + promptFile);
253
+ output.writeln(output.dim('You can run Claude Code manually with the saved prompt'));
254
+ return [2 /*return*/, { success: false, promptFile: promptFile, error: errorMessage }];
255
+ case 7:
256
+ _a = _b.sent();
257
+ return [2 /*return*/, { success: false, error: errorMessage }];
258
+ case 8: return [3 /*break*/, 9];
259
+ case 9: return [2 /*return*/];
260
+ }
261
+ });
262
+ });
306
263
  }
307
264
  // Init subcommand
308
- const initCommand = {
265
+ var initCommand = {
309
266
  name: 'init',
310
267
  description: 'Initialize a hive mind',
311
268
  options: [
@@ -314,107 +271,124 @@ const initCommand = {
314
271
  short: 't',
315
272
  description: 'Hive topology',
316
273
  type: 'string',
317
- choices: TOPOLOGIES.map(t => t.value),
318
- default: 'hierarchical-mesh'
274
+ choices: TOPOLOGIES.map(function (t) { return t.value; }),
275
+ "default": 'hierarchical-mesh'
319
276
  },
320
277
  {
321
278
  name: 'consensus',
322
279
  short: 'c',
323
280
  description: 'Consensus strategy',
324
281
  type: 'string',
325
- choices: CONSENSUS_STRATEGIES.map(s => s.value),
326
- default: 'byzantine'
282
+ choices: CONSENSUS_STRATEGIES.map(function (s) { return s.value; }),
283
+ "default": 'byzantine'
327
284
  },
328
285
  {
329
286
  name: 'max-agents',
330
287
  short: 'm',
331
288
  description: 'Maximum agents',
332
289
  type: 'number',
333
- default: 15
290
+ "default": 15
334
291
  },
335
292
  {
336
293
  name: 'persist',
337
294
  short: 'p',
338
295
  description: 'Enable persistent state',
339
296
  type: 'boolean',
340
- default: true
297
+ "default": true
341
298
  },
342
299
  {
343
300
  name: 'memory-backend',
344
301
  description: 'Memory backend (agentdb, sqlite, hybrid)',
345
302
  type: 'string',
346
- default: 'hybrid'
303
+ "default": 'hybrid'
347
304
  }
348
305
  ],
349
306
  examples: [
350
307
  { command: 'claude-flow hive-mind init -t hierarchical-mesh', description: 'Init hierarchical mesh' },
351
308
  { command: 'claude-flow hive-mind init -c byzantine -m 20', description: 'Init with Byzantine consensus' }
352
309
  ],
353
- action: async (ctx) => {
354
- let topology = ctx.flags.topology;
355
- let consensus = ctx.flags.consensus;
356
- if (ctx.interactive && !ctx.flags.topology) {
357
- topology = await select({
358
- message: 'Select hive topology:',
359
- options: TOPOLOGIES,
360
- default: 'hierarchical-mesh'
361
- });
362
- }
363
- if (ctx.interactive && !ctx.flags.consensus) {
364
- consensus = await select({
365
- message: 'Select consensus strategy:',
366
- options: CONSENSUS_STRATEGIES,
367
- default: 'byzantine'
368
- });
369
- }
370
- const config = {
371
- topology: topology || 'hierarchical-mesh',
372
- consensus: consensus || 'byzantine',
373
- maxAgents: ctx.flags.maxAgents || 15,
374
- persist: ctx.flags.persist,
375
- memoryBackend: ctx.flags.memoryBackend || 'hybrid'
376
- };
377
- output.writeln();
378
- output.writeln(output.bold('Initializing Hive Mind'));
379
- const spinner = output.createSpinner({ text: 'Setting up hive infrastructure...', spinner: 'dots' });
380
- spinner.start();
381
- try {
382
- const result = await callMCPTool('hive-mind_init', config);
383
- spinner.succeed('Hive Mind initialized');
384
- if (ctx.flags.format === 'json') {
385
- output.printJson(result);
386
- return { success: true, data: result };
387
- }
388
- output.writeln();
389
- output.printBox([
390
- `Hive ID: ${result.hiveId ?? 'default'}`,
391
- `Queen ID: ${result.queenId ?? 'N/A'}`,
392
- `Topology: ${result.topology ?? config.topology}`,
393
- `Consensus: ${result.consensus ?? config.consensus}`,
394
- `Max Agents: ${config.maxAgents}`,
395
- `Memory: ${config.memoryBackend}`,
396
- `Status: ${output.success(result.status ?? 'initialized')}`
397
- ].join('\n'), 'Hive Mind Configuration');
398
- output.writeln();
399
- output.printInfo('Queen agent is ready to coordinate worker agents');
400
- output.writeln(output.dim(' Use "claude-flow hive-mind spawn" to add workers'));
401
- output.writeln(output.dim(' Use "claude-flow hive-mind spawn --claude" to launch Claude Code'));
402
- return { success: true, data: result };
403
- }
404
- catch (error) {
405
- spinner.fail('Failed to initialize');
406
- if (error instanceof MCPClientError) {
407
- output.printError(`Init error: ${error.message}`);
408
- }
409
- else {
410
- output.printError(`Unexpected error: ${String(error)}`);
310
+ action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
311
+ var topology, consensus, config, spinner, result, error_2;
312
+ var _a, _b, _c, _d, _e;
313
+ return __generator(this, function (_f) {
314
+ switch (_f.label) {
315
+ case 0:
316
+ topology = ctx.flags.topology;
317
+ consensus = ctx.flags.consensus;
318
+ if (!(ctx.interactive && !ctx.flags.topology)) return [3 /*break*/, 2];
319
+ return [4 /*yield*/, select({
320
+ message: 'Select hive topology:',
321
+ options: TOPOLOGIES,
322
+ "default": 'hierarchical-mesh'
323
+ })];
324
+ case 1:
325
+ topology = _f.sent();
326
+ _f.label = 2;
327
+ case 2:
328
+ if (!(ctx.interactive && !ctx.flags.consensus)) return [3 /*break*/, 4];
329
+ return [4 /*yield*/, select({
330
+ message: 'Select consensus strategy:',
331
+ options: CONSENSUS_STRATEGIES,
332
+ "default": 'byzantine'
333
+ })];
334
+ case 3:
335
+ consensus = _f.sent();
336
+ _f.label = 4;
337
+ case 4:
338
+ config = {
339
+ topology: topology || 'hierarchical-mesh',
340
+ consensus: consensus || 'byzantine',
341
+ maxAgents: ctx.flags.maxAgents || 15,
342
+ persist: ctx.flags.persist,
343
+ memoryBackend: ctx.flags.memoryBackend || 'hybrid'
344
+ };
345
+ output.writeln();
346
+ output.writeln(output.bold('Initializing Hive Mind'));
347
+ spinner = output.createSpinner({ text: 'Setting up hive infrastructure...', spinner: 'dots' });
348
+ spinner.start();
349
+ _f.label = 5;
350
+ case 5:
351
+ _f.trys.push([5, 7, , 8]);
352
+ return [4 /*yield*/, callMCPTool('hive-mind_init', config)];
353
+ case 6:
354
+ result = _f.sent();
355
+ spinner.succeed('Hive Mind initialized');
356
+ if (ctx.flags.format === 'json') {
357
+ output.printJson(result);
358
+ return [2 /*return*/, { success: true, data: result }];
359
+ }
360
+ output.writeln();
361
+ output.printBox([
362
+ "Hive ID: " + ((_a = result.hiveId) !== null && _a !== void 0 ? _a : 'default'),
363
+ "Queen ID: " + ((_b = result.queenId) !== null && _b !== void 0 ? _b : 'N/A'),
364
+ "Topology: " + ((_c = result.topology) !== null && _c !== void 0 ? _c : config.topology),
365
+ "Consensus: " + ((_d = result.consensus) !== null && _d !== void 0 ? _d : config.consensus),
366
+ "Max Agents: " + config.maxAgents,
367
+ "Memory: " + config.memoryBackend,
368
+ "Status: " + output.success((_e = result.status) !== null && _e !== void 0 ? _e : 'initialized')
369
+ ].join('\n'), 'Hive Mind Configuration');
370
+ output.writeln();
371
+ output.printInfo('Queen agent is ready to coordinate worker agents');
372
+ output.writeln(output.dim(' Use "claude-flow hive-mind spawn" to add workers'));
373
+ output.writeln(output.dim(' Use "claude-flow hive-mind spawn --claude" to launch Claude Code'));
374
+ return [2 /*return*/, { success: true, data: result }];
375
+ case 7:
376
+ error_2 = _f.sent();
377
+ spinner.fail('Failed to initialize');
378
+ if (error_2 instanceof MCPClientError) {
379
+ output.printError("Init error: " + error_2.message);
380
+ }
381
+ else {
382
+ output.printError("Unexpected error: " + String(error_2));
383
+ }
384
+ return [2 /*return*/, { success: false, exitCode: 1 }];
385
+ case 8: return [2 /*return*/];
411
386
  }
412
- return { success: false, exitCode: 1 };
413
- }
414
- }
387
+ });
388
+ }); }
415
389
  };
416
390
  // Spawn subcommand - UPDATED with --claude flag
417
- const spawnCommand = {
391
+ var spawnCommand = {
418
392
  name: 'spawn',
419
393
  description: 'Spawn worker agents into the hive (use --claude to launch Claude Code)',
420
394
  options: [
@@ -423,7 +397,7 @@ const spawnCommand = {
423
397
  short: 'n',
424
398
  description: 'Number of workers to spawn',
425
399
  type: 'number',
426
- default: 1
400
+ "default": 1
427
401
  },
428
402
  {
429
403
  name: 'role',
@@ -431,28 +405,28 @@ const spawnCommand = {
431
405
  description: 'Worker role (worker, specialist, scout)',
432
406
  type: 'string',
433
407
  choices: ['worker', 'specialist', 'scout'],
434
- default: 'worker'
408
+ "default": 'worker'
435
409
  },
436
410
  {
437
411
  name: 'type',
438
412
  short: 't',
439
413
  description: 'Agent type',
440
414
  type: 'string',
441
- default: 'worker'
415
+ "default": 'worker'
442
416
  },
443
417
  {
444
418
  name: 'prefix',
445
419
  short: 'p',
446
420
  description: 'Prefix for worker IDs',
447
421
  type: 'string',
448
- default: 'hive-worker'
422
+ "default": 'hive-worker'
449
423
  },
450
424
  // NEW: --claude flag for launching Claude Code
451
425
  {
452
426
  name: 'claude',
453
427
  description: 'Launch Claude Code with hive-mind coordination prompt',
454
428
  type: 'boolean',
455
- default: false
429
+ "default": false
456
430
  },
457
431
  {
458
432
  name: 'objective',
@@ -464,25 +438,25 @@ const spawnCommand = {
464
438
  name: 'dangerously-skip-permissions',
465
439
  description: 'Skip permission prompts in Claude Code (use with caution)',
466
440
  type: 'boolean',
467
- default: true
441
+ "default": true
468
442
  },
469
443
  {
470
444
  name: 'no-auto-permissions',
471
445
  description: 'Disable automatic permission skipping',
472
446
  type: 'boolean',
473
- default: false
447
+ "default": false
474
448
  },
475
449
  {
476
450
  name: 'dry-run',
477
451
  description: 'Show what would be done without launching Claude Code',
478
452
  type: 'boolean',
479
- default: false
453
+ "default": false
480
454
  },
481
455
  {
482
456
  name: 'non-interactive',
483
457
  description: 'Run Claude Code in non-interactive mode',
484
458
  type: 'boolean',
485
- default: false
459
+ "default": false
486
460
  }
487
461
  ],
488
462
  examples: [
@@ -492,104 +466,116 @@ const spawnCommand = {
492
466
  { command: 'claude-flow hive-mind spawn --claude -o "Build a REST API"', description: 'Launch Claude Code with objective' },
493
467
  { command: 'claude-flow hive-mind spawn -n 5 --claude -o "Research AI patterns"', description: 'Spawn workers and launch Claude Code' }
494
468
  ],
495
- action: async (ctx) => {
496
- // Parse count with fallback to default
497
- const count = ctx.flags.count || 1;
498
- const role = ctx.flags.role || 'worker';
499
- const agentType = ctx.flags.type || 'worker';
500
- const prefix = ctx.flags.prefix || 'hive-worker';
501
- const launchClaude = ctx.flags.claude;
502
- let objective = ctx.flags.objective || ctx.args.join(' ');
503
- output.printInfo(`Spawning ${count} ${role} agent(s)...`);
504
- try {
505
- const result = await callMCPTool('hive-mind_spawn', {
506
- count,
507
- role,
508
- agentType,
509
- prefix,
510
- });
511
- // Check for errors from MCP tool
512
- if (!result.success) {
513
- output.printError(result.error || 'Failed to spawn workers');
514
- return { success: false, exitCode: 1 };
515
- }
516
- if (ctx.flags.format === 'json' && !launchClaude) {
517
- output.printJson(result);
518
- return { success: true, data: result };
519
- }
520
- output.writeln();
521
- // Transform workers array to display format
522
- const displayData = (result.workers || []).map(w => ({
523
- id: w.agentId,
524
- role: w.role,
525
- status: 'idle',
526
- joinedAt: new Date(w.joinedAt).toLocaleTimeString()
527
- }));
528
- output.printTable({
529
- columns: [
530
- { key: 'id', header: 'Agent ID', width: 30 },
531
- { key: 'role', header: 'Role', width: 12 },
532
- { key: 'status', header: 'Status', width: 10, format: formatAgentStatus },
533
- { key: 'joinedAt', header: 'Joined', width: 12 }
534
- ],
535
- data: displayData
536
- });
537
- output.writeln();
538
- output.printSuccess(`Spawned ${result.spawned} agent(s)`);
539
- output.writeln(output.dim(` Total workers in hive: ${result.totalWorkers}`));
540
- // NEW: Handle --claude flag
541
- if (launchClaude) {
542
- // Get objective if not provided
543
- if (!objective && ctx.interactive) {
544
- objective = await input({
545
- message: 'Enter the objective for the hive mind:',
546
- validate: (v) => v.length > 0 || 'Objective is required when using --claude'
469
+ action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
470
+ var count, role, agentType, prefix, launchClaude, objective, result, displayData, swarmId, swarmName, statusResult, _a, workers, claudeResult, error_3;
471
+ return __generator(this, function (_b) {
472
+ switch (_b.label) {
473
+ case 0:
474
+ count = ctx.flags.count || 1;
475
+ role = ctx.flags.role || 'worker';
476
+ agentType = ctx.flags.type || 'worker';
477
+ prefix = ctx.flags.prefix || 'hive-worker';
478
+ launchClaude = ctx.flags.claude;
479
+ objective = ctx.flags.objective || ctx.args.join(' ');
480
+ output.printInfo("Spawning " + count + " " + role + " agent(s)...");
481
+ _b.label = 1;
482
+ case 1:
483
+ _b.trys.push([1, 11, , 12]);
484
+ return [4 /*yield*/, callMCPTool('hive-mind_spawn', {
485
+ count: count,
486
+ role: role,
487
+ agentType: agentType,
488
+ prefix: prefix
489
+ })];
490
+ case 2:
491
+ result = _b.sent();
492
+ // Check for errors from MCP tool
493
+ if (!result.success) {
494
+ output.printError(result.error || 'Failed to spawn workers');
495
+ return [2 /*return*/, { success: false, exitCode: 1 }];
496
+ }
497
+ if (ctx.flags.format === 'json' && !launchClaude) {
498
+ output.printJson(result);
499
+ return [2 /*return*/, { success: true, data: result }];
500
+ }
501
+ output.writeln();
502
+ displayData = (result.workers || []).map(function (w) { return ({
503
+ id: w.agentId,
504
+ role: w.role,
505
+ status: 'idle',
506
+ joinedAt: new Date(w.joinedAt).toLocaleTimeString()
507
+ }); });
508
+ output.printTable({
509
+ columns: [
510
+ { key: 'id', header: 'Agent ID', width: 30 },
511
+ { key: 'role', header: 'Role', width: 12 },
512
+ { key: 'status', header: 'Status', width: 10, format: formatAgentStatus },
513
+ { key: 'joinedAt', header: 'Joined', width: 12 }
514
+ ],
515
+ data: displayData
547
516
  });
548
- }
549
- if (!objective) {
550
517
  output.writeln();
551
- output.printWarning('No objective provided. Using default objective.');
552
- objective = 'Coordinate the hive mind workers to complete tasks efficiently.';
553
- }
554
- // Get hive status for swarm info
555
- let swarmId = result.hiveId || 'default';
556
- let swarmName = 'Hive Mind Swarm';
557
- try {
558
- const statusResult = await callMCPTool('hive-mind_status', { includeWorkers: false });
518
+ output.printSuccess("Spawned " + result.spawned + " agent(s)");
519
+ output.writeln(output.dim(" Total workers in hive: " + result.totalWorkers));
520
+ if (!launchClaude) return [3 /*break*/, 10];
521
+ if (!(!objective && ctx.interactive)) return [3 /*break*/, 4];
522
+ return [4 /*yield*/, input({
523
+ message: 'Enter the objective for the hive mind:',
524
+ validate: function (v) { return v.length > 0 || 'Objective is required when using --claude'; }
525
+ })];
526
+ case 3:
527
+ objective = _b.sent();
528
+ _b.label = 4;
529
+ case 4:
530
+ if (!objective) {
531
+ output.writeln();
532
+ output.printWarning('No objective provided. Using default objective.');
533
+ objective = 'Coordinate the hive mind workers to complete tasks efficiently.';
534
+ }
535
+ swarmId = result.hiveId || 'default';
536
+ swarmName = 'Hive Mind Swarm';
537
+ _b.label = 5;
538
+ case 5:
539
+ _b.trys.push([5, 7, , 8]);
540
+ return [4 /*yield*/, callMCPTool('hive-mind_status', { includeWorkers: false })];
541
+ case 6:
542
+ statusResult = _b.sent();
559
543
  swarmId = statusResult.hiveId || swarmId;
560
- }
561
- catch {
562
- // Use defaults if status call fails
563
- }
564
- // Convert workers to expected format
565
- const workers = (result.workers || []).map(w => ({
566
- agentId: w.agentId,
567
- role: w.role,
568
- type: agentType,
569
- joinedAt: w.joinedAt
570
- }));
571
- // Launch Claude Code with hive mind prompt
572
- const claudeResult = await spawnClaudeCodeInstance(swarmId, swarmName, objective, workers, ctx.flags);
573
- if (!claudeResult.success) {
574
- return { success: false, exitCode: 1, data: { spawn: result, claude: claudeResult } };
575
- }
576
- return { success: true, data: { spawn: result, claude: claudeResult } };
577
- }
578
- return { success: true, data: result };
579
- }
580
- catch (error) {
581
- if (error instanceof MCPClientError) {
582
- output.printError(`Spawn error: ${error.message}`);
583
- }
584
- else {
585
- output.printError(`Unexpected error: ${String(error)}`);
544
+ return [3 /*break*/, 8];
545
+ case 7:
546
+ _a = _b.sent();
547
+ return [3 /*break*/, 8];
548
+ case 8:
549
+ workers = (result.workers || []).map(function (w) { return ({
550
+ agentId: w.agentId,
551
+ role: w.role,
552
+ type: agentType,
553
+ joinedAt: w.joinedAt
554
+ }); });
555
+ return [4 /*yield*/, spawnClaudeCodeInstance(swarmId, swarmName, objective, workers, ctx.flags)];
556
+ case 9:
557
+ claudeResult = _b.sent();
558
+ if (!claudeResult.success) {
559
+ return [2 /*return*/, { success: false, exitCode: 1, data: { spawn: result, claude: claudeResult } }];
560
+ }
561
+ return [2 /*return*/, { success: true, data: { spawn: result, claude: claudeResult } }];
562
+ case 10: return [2 /*return*/, { success: true, data: result }];
563
+ case 11:
564
+ error_3 = _b.sent();
565
+ if (error_3 instanceof MCPClientError) {
566
+ output.printError("Spawn error: " + error_3.message);
567
+ }
568
+ else {
569
+ output.printError("Unexpected error: " + String(error_3));
570
+ }
571
+ return [2 /*return*/, { success: false, exitCode: 1 }];
572
+ case 12: return [2 /*return*/];
586
573
  }
587
- return { success: false, exitCode: 1 };
588
- }
589
- }
574
+ });
575
+ }); }
590
576
  };
591
577
  // Status subcommand
592
- const statusCommand = {
578
+ var statusCommand = {
593
579
  name: 'status',
594
580
  description: 'Show hive mind status',
595
581
  options: [
@@ -598,125 +584,135 @@ const statusCommand = {
598
584
  short: 'd',
599
585
  description: 'Show detailed metrics',
600
586
  type: 'boolean',
601
- default: false
587
+ "default": false
602
588
  },
603
589
  {
604
590
  name: 'watch',
605
591
  short: 'w',
606
592
  description: 'Watch for changes',
607
593
  type: 'boolean',
608
- default: false
594
+ "default": false
609
595
  }
610
596
  ],
611
- action: async (ctx) => {
612
- const detailed = ctx.flags.detailed;
613
- try {
614
- const result = await callMCPTool('hive-mind_status', {
615
- includeMetrics: detailed,
616
- includeWorkers: true,
617
- });
618
- if (ctx.flags.format === 'json') {
619
- output.printJson(result);
620
- return { success: true, data: result };
621
- }
622
- // Handle both simple and complex response formats - cast to flexible type
623
- const flexResult = result;
624
- const hiveId = result.hiveId ?? flexResult.id ?? 'default';
625
- const status = result.status ?? (flexResult.initialized ? 'running' : 'stopped');
626
- const queen = result.queen ?? { id: 'N/A', status: 'unknown', load: 0, tasksQueued: 0 };
627
- const flexQueen = queen;
628
- const queenId = typeof queen === 'object' ? (queen.id ?? flexQueen.agentId ?? 'N/A') : String(queen);
629
- const queenLoad = typeof queen === 'object' ? (queen.load ?? 0) : 0;
630
- const queenTasks = typeof queen === 'object' ? (queen.tasksQueued ?? 0) : 0;
631
- const queenStatus = typeof queen === 'object' ? (queen.status ?? 'active') : 'active';
632
- output.writeln();
633
- output.printBox([
634
- `Hive ID: ${hiveId}`,
635
- `Status: ${formatHiveStatus(String(status))}`,
636
- `Topology: ${result.topology ?? 'mesh'}`,
637
- `Consensus: ${result.consensus ?? 'byzantine'}`,
638
- '',
639
- `Queen: ${queenId}`,
640
- ` Status: ${formatAgentStatus(queenStatus)}`,
641
- ` Load: ${(queenLoad * 100).toFixed(1)}%`,
642
- ` Queued Tasks: ${queenTasks}`
643
- ].join('\n'), 'Hive Mind Status');
644
- // Handle workers array - could be worker objects or just IDs
645
- const workers = result.workers ?? [];
646
- const workerData = Array.isArray(workers) ? workers.map(w => {
647
- if (typeof w === 'string') {
648
- return { id: w, type: 'worker', status: 'idle', currentTask: '-', tasksCompleted: 0 };
649
- }
650
- const flexWorker = w;
651
- return {
652
- id: w.id ?? flexWorker.agentId ?? 'unknown',
653
- type: w.type ?? flexWorker.agentType ?? 'worker',
654
- status: w.status ?? 'idle',
655
- currentTask: w.currentTask ?? '-',
656
- tasksCompleted: w.tasksCompleted ?? 0
657
- };
658
- }) : [];
659
- output.writeln();
660
- output.writeln(output.bold('Worker Agents'));
661
- if (workerData.length === 0) {
662
- output.printInfo('No workers in hive. Use "claude-flow hive-mind spawn" to add workers.');
663
- }
664
- else {
665
- output.printTable({
666
- columns: [
667
- { key: 'id', header: 'ID', width: 20 },
668
- { key: 'type', header: 'Type', width: 12 },
669
- { key: 'status', header: 'Status', width: 10, format: formatAgentStatus },
670
- { key: 'currentTask', header: 'Current Task', width: 20, format: (v) => String(v || '-') },
671
- { key: 'tasksCompleted', header: 'Completed', width: 10, align: 'right' }
672
- ],
673
- data: workerData
674
- });
675
- }
676
- if (detailed) {
677
- const metrics = result.metrics ?? { totalTasks: 0, completedTasks: 0, failedTasks: 0, avgTaskTime: 0, consensusRounds: 0, memoryUsage: '0 MB' };
678
- output.writeln();
679
- output.writeln(output.bold('Metrics'));
680
- output.printTable({
681
- columns: [
682
- { key: 'metric', header: 'Metric', width: 20 },
683
- { key: 'value', header: 'Value', width: 15, align: 'right' }
684
- ],
685
- data: [
686
- { metric: 'Total Tasks', value: metrics.totalTasks ?? 0 },
687
- { metric: 'Completed', value: metrics.completedTasks ?? 0 },
688
- { metric: 'Failed', value: metrics.failedTasks ?? 0 },
689
- { metric: 'Avg Task Time', value: `${(metrics.avgTaskTime ?? 0).toFixed(1)}ms` },
690
- { metric: 'Consensus Rounds', value: metrics.consensusRounds ?? 0 },
691
- { metric: 'Memory Usage', value: metrics.memoryUsage ?? '0 MB' }
692
- ]
693
- });
694
- const health = result.health ?? { overall: 'healthy', queen: 'healthy', workers: 'healthy', consensus: 'healthy', memory: 'healthy' };
695
- output.writeln();
696
- output.writeln(output.bold('Health'));
697
- output.printList([
698
- `Overall: ${formatHealth(health.overall ?? 'healthy')}`,
699
- `Queen: ${formatHealth(health.queen ?? 'healthy')}`,
700
- `Workers: ${formatHealth(health.workers ?? 'healthy')}`,
701
- `Consensus: ${formatHealth(health.consensus ?? 'healthy')}`,
702
- `Memory: ${formatHealth(health.memory ?? 'healthy')}`
703
- ]);
704
- }
705
- return { success: true, data: result };
706
- }
707
- catch (error) {
708
- if (error instanceof MCPClientError) {
709
- output.printError(`Status error: ${error.message}`);
710
- }
711
- else {
712
- output.printError(`Unexpected error: ${String(error)}`);
597
+ action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
598
+ var detailed, result, flexResult, hiveId, status, queen, flexQueen, queenId, queenLoad, queenTasks, queenStatus, workers, workerData, metrics, health, error_4;
599
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
600
+ return __generator(this, function (_1) {
601
+ switch (_1.label) {
602
+ case 0:
603
+ detailed = ctx.flags.detailed;
604
+ _1.label = 1;
605
+ case 1:
606
+ _1.trys.push([1, 3, , 4]);
607
+ return [4 /*yield*/, callMCPTool('hive-mind_status', {
608
+ includeMetrics: detailed,
609
+ includeWorkers: true
610
+ })];
611
+ case 2:
612
+ result = _1.sent();
613
+ if (ctx.flags.format === 'json') {
614
+ output.printJson(result);
615
+ return [2 /*return*/, { success: true, data: result }];
616
+ }
617
+ flexResult = result;
618
+ hiveId = (_b = (_a = result.hiveId) !== null && _a !== void 0 ? _a : flexResult.id) !== null && _b !== void 0 ? _b : 'default';
619
+ status = (_c = result.status) !== null && _c !== void 0 ? _c : (flexResult.initialized ? 'running' : 'stopped');
620
+ queen = (_d = result.queen) !== null && _d !== void 0 ? _d : { id: 'N/A', status: 'unknown', load: 0, tasksQueued: 0 };
621
+ flexQueen = queen;
622
+ queenId = typeof queen === 'object' ? ((_f = (_e = queen.id) !== null && _e !== void 0 ? _e : flexQueen.agentId) !== null && _f !== void 0 ? _f : 'N/A') : String(queen);
623
+ queenLoad = typeof queen === 'object' ? ((_g = queen.load) !== null && _g !== void 0 ? _g : 0) : 0;
624
+ queenTasks = typeof queen === 'object' ? ((_h = queen.tasksQueued) !== null && _h !== void 0 ? _h : 0) : 0;
625
+ queenStatus = typeof queen === 'object' ? ((_j = queen.status) !== null && _j !== void 0 ? _j : 'active') : 'active';
626
+ output.writeln();
627
+ output.printBox([
628
+ "Hive ID: " + hiveId,
629
+ "Status: " + formatHiveStatus(String(status)),
630
+ "Topology: " + ((_k = result.topology) !== null && _k !== void 0 ? _k : 'mesh'),
631
+ "Consensus: " + ((_l = result.consensus) !== null && _l !== void 0 ? _l : 'byzantine'),
632
+ '',
633
+ "Queen: " + queenId,
634
+ " Status: " + formatAgentStatus(queenStatus),
635
+ " Load: " + (queenLoad * 100).toFixed(1) + "%",
636
+ " Queued Tasks: " + queenTasks
637
+ ].join('\n'), 'Hive Mind Status');
638
+ workers = (_m = result.workers) !== null && _m !== void 0 ? _m : [];
639
+ workerData = Array.isArray(workers) ? workers.map(function (w) {
640
+ var _a, _b, _c, _d, _e, _f, _g;
641
+ if (typeof w === 'string') {
642
+ return { id: w, type: 'worker', status: 'idle', currentTask: '-', tasksCompleted: 0 };
643
+ }
644
+ var flexWorker = w;
645
+ return {
646
+ id: (_b = (_a = w.id) !== null && _a !== void 0 ? _a : flexWorker.agentId) !== null && _b !== void 0 ? _b : 'unknown',
647
+ type: (_d = (_c = w.type) !== null && _c !== void 0 ? _c : flexWorker.agentType) !== null && _d !== void 0 ? _d : 'worker',
648
+ status: (_e = w.status) !== null && _e !== void 0 ? _e : 'idle',
649
+ currentTask: (_f = w.currentTask) !== null && _f !== void 0 ? _f : '-',
650
+ tasksCompleted: (_g = w.tasksCompleted) !== null && _g !== void 0 ? _g : 0
651
+ };
652
+ }) : [];
653
+ output.writeln();
654
+ output.writeln(output.bold('Worker Agents'));
655
+ if (workerData.length === 0) {
656
+ output.printInfo('No workers in hive. Use "claude-flow hive-mind spawn" to add workers.');
657
+ }
658
+ else {
659
+ output.printTable({
660
+ columns: [
661
+ { key: 'id', header: 'ID', width: 20 },
662
+ { key: 'type', header: 'Type', width: 12 },
663
+ { key: 'status', header: 'Status', width: 10, format: formatAgentStatus },
664
+ { key: 'currentTask', header: 'Current Task', width: 20, format: function (v) { return String(v || '-'); } },
665
+ { key: 'tasksCompleted', header: 'Completed', width: 10, align: 'right' }
666
+ ],
667
+ data: workerData
668
+ });
669
+ }
670
+ if (detailed) {
671
+ metrics = (_o = result.metrics) !== null && _o !== void 0 ? _o : { totalTasks: 0, completedTasks: 0, failedTasks: 0, avgTaskTime: 0, consensusRounds: 0, memoryUsage: '0 MB' };
672
+ output.writeln();
673
+ output.writeln(output.bold('Metrics'));
674
+ output.printTable({
675
+ columns: [
676
+ { key: 'metric', header: 'Metric', width: 20 },
677
+ { key: 'value', header: 'Value', width: 15, align: 'right' }
678
+ ],
679
+ data: [
680
+ { metric: 'Total Tasks', value: (_p = metrics.totalTasks) !== null && _p !== void 0 ? _p : 0 },
681
+ { metric: 'Completed', value: (_q = metrics.completedTasks) !== null && _q !== void 0 ? _q : 0 },
682
+ { metric: 'Failed', value: (_r = metrics.failedTasks) !== null && _r !== void 0 ? _r : 0 },
683
+ { metric: 'Avg Task Time', value: ((_s = metrics.avgTaskTime) !== null && _s !== void 0 ? _s : 0).toFixed(1) + "ms" },
684
+ { metric: 'Consensus Rounds', value: (_t = metrics.consensusRounds) !== null && _t !== void 0 ? _t : 0 },
685
+ { metric: 'Memory Usage', value: (_u = metrics.memoryUsage) !== null && _u !== void 0 ? _u : '0 MB' }
686
+ ]
687
+ });
688
+ health = (_v = result.health) !== null && _v !== void 0 ? _v : { overall: 'healthy', queen: 'healthy', workers: 'healthy', consensus: 'healthy', memory: 'healthy' };
689
+ output.writeln();
690
+ output.writeln(output.bold('Health'));
691
+ output.printList([
692
+ "Overall: " + formatHealth((_w = health.overall) !== null && _w !== void 0 ? _w : 'healthy'),
693
+ "Queen: " + formatHealth((_x = health.queen) !== null && _x !== void 0 ? _x : 'healthy'),
694
+ "Workers: " + formatHealth((_y = health.workers) !== null && _y !== void 0 ? _y : 'healthy'),
695
+ "Consensus: " + formatHealth((_z = health.consensus) !== null && _z !== void 0 ? _z : 'healthy'),
696
+ "Memory: " + formatHealth((_0 = health.memory) !== null && _0 !== void 0 ? _0 : 'healthy')
697
+ ]);
698
+ }
699
+ return [2 /*return*/, { success: true, data: result }];
700
+ case 3:
701
+ error_4 = _1.sent();
702
+ if (error_4 instanceof MCPClientError) {
703
+ output.printError("Status error: " + error_4.message);
704
+ }
705
+ else {
706
+ output.printError("Unexpected error: " + String(error_4));
707
+ }
708
+ return [2 /*return*/, { success: false, exitCode: 1 }];
709
+ case 4: return [2 /*return*/];
713
710
  }
714
- return { success: false, exitCode: 1 };
715
- }
716
- }
711
+ });
712
+ }); }
717
713
  };
718
714
  // Task subcommand
719
- const taskCommand = {
715
+ var taskCommand = {
720
716
  name: 'task',
721
717
  description: 'Submit tasks to the hive',
722
718
  options: [
@@ -732,80 +728,93 @@ const taskCommand = {
732
728
  description: 'Task priority',
733
729
  type: 'string',
734
730
  choices: ['low', 'normal', 'high', 'critical'],
735
- default: 'normal'
731
+ "default": 'normal'
736
732
  },
737
733
  {
738
734
  name: 'require-consensus',
739
735
  short: 'c',
740
736
  description: 'Require consensus for completion',
741
737
  type: 'boolean',
742
- default: false
738
+ "default": false
743
739
  },
744
740
  {
745
741
  name: 'timeout',
746
742
  description: 'Task timeout in seconds',
747
743
  type: 'number',
748
- default: 300
744
+ "default": 300
749
745
  }
750
746
  ],
751
747
  examples: [
752
748
  { command: 'claude-flow hive-mind task -d "Implement auth module"', description: 'Submit task' },
753
749
  { command: 'claude-flow hive-mind task -d "Security review" -p critical -c', description: 'Critical task with consensus' }
754
750
  ],
755
- action: async (ctx) => {
756
- let description = ctx.flags.description || ctx.args.join(' ');
757
- if (!description && ctx.interactive) {
758
- description = await input({
759
- message: 'Task description:',
760
- validate: (v) => v.length > 0 || 'Description is required'
761
- });
762
- }
763
- if (!description) {
764
- output.printError('Task description is required');
765
- return { success: false, exitCode: 1 };
766
- }
767
- const priority = ctx.flags.priority;
768
- const requireConsensus = ctx.flags.requireConsensus;
769
- const timeout = ctx.flags.timeout;
770
- output.printInfo('Submitting task to hive...');
771
- try {
772
- const result = await callMCPTool('hive-mind_task', {
773
- description,
774
- priority,
775
- requireConsensus,
776
- timeout,
777
- });
778
- if (ctx.flags.format === 'json') {
779
- output.printJson(result);
780
- return { success: true, data: result };
781
- }
782
- output.writeln();
783
- output.printBox([
784
- `Task ID: ${result.taskId}`,
785
- `Status: ${formatAgentStatus(result.status)}`,
786
- `Priority: ${formatPriority(priority)}`,
787
- `Assigned: ${result.assignedTo.join(', ')}`,
788
- `Consensus: ${result.requiresConsensus ? 'Yes' : 'No'}`,
789
- `Est. Time: ${result.estimatedTime}`
790
- ].join('\n'), 'Task Submitted');
791
- output.writeln();
792
- output.printSuccess('Task submitted to hive');
793
- output.writeln(output.dim(` Track with: claude-flow hive-mind task-status ${result.taskId}`));
794
- return { success: true, data: result };
795
- }
796
- catch (error) {
797
- if (error instanceof MCPClientError) {
798
- output.printError(`Task submission error: ${error.message}`);
799
- }
800
- else {
801
- output.printError(`Unexpected error: ${String(error)}`);
751
+ action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
752
+ var description, priority, requireConsensus, timeout, result, error_5;
753
+ return __generator(this, function (_a) {
754
+ switch (_a.label) {
755
+ case 0:
756
+ description = ctx.flags.description || ctx.args.join(' ');
757
+ if (!(!description && ctx.interactive)) return [3 /*break*/, 2];
758
+ return [4 /*yield*/, input({
759
+ message: 'Task description:',
760
+ validate: function (v) { return v.length > 0 || 'Description is required'; }
761
+ })];
762
+ case 1:
763
+ description = _a.sent();
764
+ _a.label = 2;
765
+ case 2:
766
+ if (!description) {
767
+ output.printError('Task description is required');
768
+ return [2 /*return*/, { success: false, exitCode: 1 }];
769
+ }
770
+ priority = ctx.flags.priority;
771
+ requireConsensus = ctx.flags.requireConsensus;
772
+ timeout = ctx.flags.timeout;
773
+ output.printInfo('Submitting task to hive...');
774
+ _a.label = 3;
775
+ case 3:
776
+ _a.trys.push([3, 5, , 6]);
777
+ return [4 /*yield*/, callMCPTool('hive-mind_task', {
778
+ description: description,
779
+ priority: priority,
780
+ requireConsensus: requireConsensus,
781
+ timeout: timeout
782
+ })];
783
+ case 4:
784
+ result = _a.sent();
785
+ if (ctx.flags.format === 'json') {
786
+ output.printJson(result);
787
+ return [2 /*return*/, { success: true, data: result }];
788
+ }
789
+ output.writeln();
790
+ output.printBox([
791
+ "Task ID: " + result.taskId,
792
+ "Status: " + formatAgentStatus(result.status),
793
+ "Priority: " + formatPriority(priority),
794
+ "Assigned: " + result.assignedTo.join(', '),
795
+ "Consensus: " + (result.requiresConsensus ? 'Yes' : 'No'),
796
+ "Est. Time: " + result.estimatedTime
797
+ ].join('\n'), 'Task Submitted');
798
+ output.writeln();
799
+ output.printSuccess('Task submitted to hive');
800
+ output.writeln(output.dim(" Track with: claude-flow hive-mind task-status " + result.taskId));
801
+ return [2 /*return*/, { success: true, data: result }];
802
+ case 5:
803
+ error_5 = _a.sent();
804
+ if (error_5 instanceof MCPClientError) {
805
+ output.printError("Task submission error: " + error_5.message);
806
+ }
807
+ else {
808
+ output.printError("Unexpected error: " + String(error_5));
809
+ }
810
+ return [2 /*return*/, { success: false, exitCode: 1 }];
811
+ case 6: return [2 /*return*/];
802
812
  }
803
- return { success: false, exitCode: 1 };
804
- }
805
- }
813
+ });
814
+ }); }
806
815
  };
807
816
  // Optimize memory subcommand
808
- const optimizeMemoryCommand = {
817
+ var optimizeMemoryCommand = {
809
818
  name: 'optimize-memory',
810
819
  description: 'Optimize hive memory and patterns',
811
820
  options: [
@@ -814,245 +823,305 @@ const optimizeMemoryCommand = {
814
823
  short: 'a',
815
824
  description: 'Aggressive optimization',
816
825
  type: 'boolean',
817
- default: false
826
+ "default": false
818
827
  },
819
828
  {
820
829
  name: 'threshold',
821
830
  description: 'Quality threshold for pattern retention',
822
831
  type: 'number',
823
- default: 0.7
832
+ "default": 0.7
824
833
  }
825
834
  ],
826
- action: async (ctx) => {
827
- const aggressive = ctx.flags.aggressive;
828
- const threshold = ctx.flags.threshold;
829
- output.printInfo('Optimizing hive memory...');
830
- const spinner = output.createSpinner({ text: 'Analyzing patterns...', spinner: 'dots' });
831
- spinner.start();
832
- try {
833
- const result = await callMCPTool('hive-mind_optimize-memory', {
834
- aggressive,
835
- qualityThreshold: threshold,
836
- });
837
- spinner.succeed('Memory optimized');
838
- if (ctx.flags.format === 'json') {
839
- output.printJson(result);
840
- return { success: true, data: result };
841
- }
842
- output.writeln();
843
- output.printTable({
844
- columns: [
845
- { key: 'metric', header: 'Metric', width: 20 },
846
- { key: 'before', header: 'Before', width: 15, align: 'right' },
847
- { key: 'after', header: 'After', width: 15, align: 'right' }
848
- ],
849
- data: [
850
- { metric: 'Patterns', before: result.before.patterns, after: result.after.patterns },
851
- { metric: 'Memory', before: result.before.memory, after: result.after.memory }
852
- ]
853
- });
854
- output.writeln();
855
- output.printList([
856
- `Patterns removed: ${result.removed}`,
857
- `Patterns consolidated: ${result.consolidated}`,
858
- `Optimization time: ${result.timeMs}ms`
859
- ]);
860
- return { success: true, data: result };
861
- }
862
- catch (error) {
863
- spinner.fail('Optimization failed');
864
- if (error instanceof MCPClientError) {
865
- output.printError(`Optimization error: ${error.message}`);
866
- }
867
- else {
868
- output.printError(`Unexpected error: ${String(error)}`);
835
+ action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
836
+ var aggressive, threshold, spinner, result, error_6;
837
+ return __generator(this, function (_a) {
838
+ switch (_a.label) {
839
+ case 0:
840
+ aggressive = ctx.flags.aggressive;
841
+ threshold = ctx.flags.threshold;
842
+ output.printInfo('Optimizing hive memory...');
843
+ spinner = output.createSpinner({ text: 'Analyzing patterns...', spinner: 'dots' });
844
+ spinner.start();
845
+ _a.label = 1;
846
+ case 1:
847
+ _a.trys.push([1, 3, , 4]);
848
+ return [4 /*yield*/, callMCPTool('hive-mind_optimize-memory', {
849
+ aggressive: aggressive,
850
+ qualityThreshold: threshold
851
+ })];
852
+ case 2:
853
+ result = _a.sent();
854
+ spinner.succeed('Memory optimized');
855
+ if (ctx.flags.format === 'json') {
856
+ output.printJson(result);
857
+ return [2 /*return*/, { success: true, data: result }];
858
+ }
859
+ output.writeln();
860
+ output.printTable({
861
+ columns: [
862
+ { key: 'metric', header: 'Metric', width: 20 },
863
+ { key: 'before', header: 'Before', width: 15, align: 'right' },
864
+ { key: 'after', header: 'After', width: 15, align: 'right' }
865
+ ],
866
+ data: [
867
+ { metric: 'Patterns', before: result.before.patterns, after: result.after.patterns },
868
+ { metric: 'Memory', before: result.before.memory, after: result.after.memory }
869
+ ]
870
+ });
871
+ output.writeln();
872
+ output.printList([
873
+ "Patterns removed: " + result.removed,
874
+ "Patterns consolidated: " + result.consolidated,
875
+ "Optimization time: " + result.timeMs + "ms"
876
+ ]);
877
+ return [2 /*return*/, { success: true, data: result }];
878
+ case 3:
879
+ error_6 = _a.sent();
880
+ spinner.fail('Optimization failed');
881
+ if (error_6 instanceof MCPClientError) {
882
+ output.printError("Optimization error: " + error_6.message);
883
+ }
884
+ else {
885
+ output.printError("Unexpected error: " + String(error_6));
886
+ }
887
+ return [2 /*return*/, { success: false, exitCode: 1 }];
888
+ case 4: return [2 /*return*/];
869
889
  }
870
- return { success: false, exitCode: 1 };
871
- }
872
- }
890
+ });
891
+ }); }
873
892
  };
874
893
  // Join subcommand
875
- const joinCommand = {
894
+ var joinCommand = {
876
895
  name: 'join',
877
896
  description: 'Join an agent to the hive mind',
878
897
  options: [
879
898
  { name: 'agent-id', short: 'a', description: 'Agent ID to join', type: 'string' },
880
- { name: 'role', short: 'r', description: 'Agent role (worker, specialist, scout)', type: 'string', default: 'worker' }
899
+ { name: 'role', short: 'r', description: 'Agent role (worker, specialist, scout)', type: 'string', "default": 'worker' }
881
900
  ],
882
- action: async (ctx) => {
883
- const agentId = ctx.args[0] || ctx.flags['agent-id'] || ctx.flags.agentId;
884
- if (!agentId) {
885
- output.printError('Agent ID is required. Use --agent-id or -a flag, or provide as argument.');
886
- return { success: false, exitCode: 1 };
887
- }
888
- try {
889
- const result = await callMCPTool('hive-mind_join', { agentId, role: ctx.flags.role });
890
- if (!result.success) {
891
- output.printError(result.error || 'Failed');
892
- return { success: false, exitCode: 1 };
901
+ action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
902
+ var agentId, result, error_7;
903
+ return __generator(this, function (_a) {
904
+ switch (_a.label) {
905
+ case 0:
906
+ agentId = ctx.args[0] || ctx.flags['agent-id'] || ctx.flags.agentId;
907
+ if (!agentId) {
908
+ output.printError('Agent ID is required. Use --agent-id or -a flag, or provide as argument.');
909
+ return [2 /*return*/, { success: false, exitCode: 1 }];
910
+ }
911
+ _a.label = 1;
912
+ case 1:
913
+ _a.trys.push([1, 3, , 4]);
914
+ return [4 /*yield*/, callMCPTool('hive-mind_join', { agentId: agentId, role: ctx.flags.role })];
915
+ case 2:
916
+ result = _a.sent();
917
+ if (!result.success) {
918
+ output.printError(result.error || 'Failed');
919
+ return [2 /*return*/, { success: false, exitCode: 1 }];
920
+ }
921
+ output.printSuccess("Agent " + agentId + " joined hive (" + result.totalWorkers + " workers)");
922
+ return [2 /*return*/, { success: true, data: result }];
923
+ case 3:
924
+ error_7 = _a.sent();
925
+ output.printError("Join error: " + (error_7 instanceof MCPClientError ? error_7.message : String(error_7)));
926
+ return [2 /*return*/, { success: false, exitCode: 1 }];
927
+ case 4: return [2 /*return*/];
893
928
  }
894
- output.printSuccess(`Agent ${agentId} joined hive (${result.totalWorkers} workers)`);
895
- return { success: true, data: result };
896
- }
897
- catch (error) {
898
- output.printError(`Join error: ${error instanceof MCPClientError ? error.message : String(error)}`);
899
- return { success: false, exitCode: 1 };
900
- }
901
- }
929
+ });
930
+ }); }
902
931
  };
903
932
  // Leave subcommand
904
- const leaveCommand = {
933
+ var leaveCommand = {
905
934
  name: 'leave',
906
935
  description: 'Remove an agent from the hive mind',
907
936
  options: [{ name: 'agent-id', short: 'a', description: 'Agent ID to remove', type: 'string' }],
908
- action: async (ctx) => {
909
- const agentId = ctx.args[0] || ctx.flags['agent-id'] || ctx.flags.agentId;
910
- if (!agentId) {
911
- output.printError('Agent ID required.');
912
- return { success: false, exitCode: 1 };
913
- }
914
- try {
915
- const result = await callMCPTool('hive-mind_leave', { agentId });
916
- if (!result.success) {
917
- output.printError(result.error || 'Failed');
918
- return { success: false, exitCode: 1 };
937
+ action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
938
+ var agentId, result, error_8;
939
+ return __generator(this, function (_a) {
940
+ switch (_a.label) {
941
+ case 0:
942
+ agentId = ctx.args[0] || ctx.flags['agent-id'] || ctx.flags.agentId;
943
+ if (!agentId) {
944
+ output.printError('Agent ID required.');
945
+ return [2 /*return*/, { success: false, exitCode: 1 }];
946
+ }
947
+ _a.label = 1;
948
+ case 1:
949
+ _a.trys.push([1, 3, , 4]);
950
+ return [4 /*yield*/, callMCPTool('hive-mind_leave', { agentId: agentId })];
951
+ case 2:
952
+ result = _a.sent();
953
+ if (!result.success) {
954
+ output.printError(result.error || 'Failed');
955
+ return [2 /*return*/, { success: false, exitCode: 1 }];
956
+ }
957
+ output.printSuccess("Agent " + agentId + " left hive (" + result.remainingWorkers + " remaining)");
958
+ return [2 /*return*/, { success: true, data: result }];
959
+ case 3:
960
+ error_8 = _a.sent();
961
+ output.printError("Leave error: " + (error_8 instanceof MCPClientError ? error_8.message : String(error_8)));
962
+ return [2 /*return*/, { success: false, exitCode: 1 }];
963
+ case 4: return [2 /*return*/];
919
964
  }
920
- output.printSuccess(`Agent ${agentId} left hive (${result.remainingWorkers} remaining)`);
921
- return { success: true, data: result };
922
- }
923
- catch (error) {
924
- output.printError(`Leave error: ${error instanceof MCPClientError ? error.message : String(error)}`);
925
- return { success: false, exitCode: 1 };
926
- }
927
- }
965
+ });
966
+ }); }
928
967
  };
929
968
  // Consensus subcommand
930
- const consensusCommand = {
969
+ var consensusCommand = {
931
970
  name: 'consensus',
932
971
  description: 'Manage consensus proposals and voting',
933
972
  options: [
934
- { name: 'action', short: 'a', description: 'Consensus action', type: 'string', choices: ['propose', 'vote', 'status', 'list'], default: 'list' },
973
+ { name: 'action', short: 'a', description: 'Consensus action', type: 'string', choices: ['propose', 'vote', 'status', 'list'], "default": 'list' },
935
974
  { name: 'proposal-id', short: 'p', description: 'Proposal ID', type: 'string' },
936
975
  { name: 'type', short: 't', description: 'Proposal type', type: 'string' },
937
976
  { name: 'value', description: 'Proposal value', type: 'string' },
938
977
  { name: 'vote', short: 'v', description: 'Vote (yes/no)', type: 'string' },
939
978
  { name: 'voter-id', description: 'Voter agent ID', type: 'string' }
940
979
  ],
941
- action: async (ctx) => {
942
- const action = ctx.flags.action || 'list';
943
- try {
944
- const result = await callMCPTool('hive-mind_consensus', { action, proposalId: ctx.flags.proposalId, type: ctx.flags.type, value: ctx.flags.value, vote: ctx.flags.vote === 'yes', voterId: ctx.flags.voterId });
945
- if (ctx.flags.format === 'json') {
946
- output.printJson(result);
947
- return { success: true, data: result };
948
- }
949
- if (action === 'list') {
950
- output.writeln(output.bold('\nPending Proposals'));
951
- const pending = result.pending || [];
952
- if (pending.length === 0)
953
- output.printInfo('No pending proposals');
954
- else
955
- output.printTable({ columns: [{ key: 'proposalId', header: 'ID', width: 30 }, { key: 'type', header: 'Type', width: 12 }], data: pending });
956
- }
957
- else if (action === 'propose') {
958
- output.printSuccess(`Proposal created: ${result.proposalId}`);
980
+ action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
981
+ var action, result, pending, error_9;
982
+ return __generator(this, function (_a) {
983
+ switch (_a.label) {
984
+ case 0:
985
+ action = ctx.flags.action || 'list';
986
+ _a.label = 1;
987
+ case 1:
988
+ _a.trys.push([1, 3, , 4]);
989
+ return [4 /*yield*/, callMCPTool('hive-mind_consensus', { action: action, proposalId: ctx.flags.proposalId, type: ctx.flags.type, value: ctx.flags.value, vote: ctx.flags.vote === 'yes', voterId: ctx.flags.voterId })];
990
+ case 2:
991
+ result = _a.sent();
992
+ if (ctx.flags.format === 'json') {
993
+ output.printJson(result);
994
+ return [2 /*return*/, { success: true, data: result }];
995
+ }
996
+ if (action === 'list') {
997
+ output.writeln(output.bold('\nPending Proposals'));
998
+ pending = result.pending || [];
999
+ if (pending.length === 0)
1000
+ output.printInfo('No pending proposals');
1001
+ else
1002
+ output.printTable({ columns: [{ key: 'proposalId', header: 'ID', width: 30 }, { key: 'type', header: 'Type', width: 12 }], data: pending });
1003
+ }
1004
+ else if (action === 'propose') {
1005
+ output.printSuccess("Proposal created: " + result.proposalId);
1006
+ }
1007
+ else if (action === 'vote') {
1008
+ output.printSuccess("Vote recorded (For: " + result.votesFor + ", Against: " + result.votesAgainst + ")");
1009
+ }
1010
+ return [2 /*return*/, { success: true, data: result }];
1011
+ case 3:
1012
+ error_9 = _a.sent();
1013
+ output.printError("Consensus error: " + (error_9 instanceof MCPClientError ? error_9.message : String(error_9)));
1014
+ return [2 /*return*/, { success: false, exitCode: 1 }];
1015
+ case 4: return [2 /*return*/];
959
1016
  }
960
- else if (action === 'vote') {
961
- output.printSuccess(`Vote recorded (For: ${result.votesFor}, Against: ${result.votesAgainst})`);
962
- }
963
- return { success: true, data: result };
964
- }
965
- catch (error) {
966
- output.printError(`Consensus error: ${error instanceof MCPClientError ? error.message : String(error)}`);
967
- return { success: false, exitCode: 1 };
968
- }
969
- }
1017
+ });
1018
+ }); }
970
1019
  };
971
1020
  // Broadcast subcommand
972
- const broadcastCommand = {
1021
+ var broadcastCommand = {
973
1022
  name: 'broadcast',
974
1023
  description: 'Broadcast a message to all workers in the hive',
975
1024
  options: [
976
1025
  { name: 'message', short: 'm', description: 'Message to broadcast', type: 'string', required: true },
977
- { name: 'priority', short: 'p', description: 'Message priority', type: 'string', choices: ['low', 'normal', 'high', 'critical'], default: 'normal' },
1026
+ { name: 'priority', short: 'p', description: 'Message priority', type: 'string', choices: ['low', 'normal', 'high', 'critical'], "default": 'normal' },
978
1027
  { name: 'from', short: 'f', description: 'Sender agent ID', type: 'string' }
979
1028
  ],
980
- action: async (ctx) => {
981
- const message = ctx.args.join(' ') || ctx.flags.message;
982
- if (!message) {
983
- output.printError('Message required. Use --message or -m flag.');
984
- return { success: false, exitCode: 1 };
985
- }
986
- try {
987
- const result = await callMCPTool('hive-mind_broadcast', { message, priority: ctx.flags.priority, fromId: ctx.flags.from });
988
- if (!result.success) {
989
- output.printError(result.error || 'Failed');
990
- return { success: false, exitCode: 1 };
1029
+ action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
1030
+ var message, result, error_10;
1031
+ return __generator(this, function (_a) {
1032
+ switch (_a.label) {
1033
+ case 0:
1034
+ message = ctx.args.join(' ') || ctx.flags.message;
1035
+ if (!message) {
1036
+ output.printError('Message required. Use --message or -m flag.');
1037
+ return [2 /*return*/, { success: false, exitCode: 1 }];
1038
+ }
1039
+ _a.label = 1;
1040
+ case 1:
1041
+ _a.trys.push([1, 3, , 4]);
1042
+ return [4 /*yield*/, callMCPTool('hive-mind_broadcast', { message: message, priority: ctx.flags.priority, fromId: ctx.flags.from })];
1043
+ case 2:
1044
+ result = _a.sent();
1045
+ if (!result.success) {
1046
+ output.printError(result.error || 'Failed');
1047
+ return [2 /*return*/, { success: false, exitCode: 1 }];
1048
+ }
1049
+ output.printSuccess("Message broadcast to " + result.recipients + " workers (ID: " + result.messageId + ")");
1050
+ return [2 /*return*/, { success: true, data: result }];
1051
+ case 3:
1052
+ error_10 = _a.sent();
1053
+ output.printError("Broadcast error: " + (error_10 instanceof MCPClientError ? error_10.message : String(error_10)));
1054
+ return [2 /*return*/, { success: false, exitCode: 1 }];
1055
+ case 4: return [2 /*return*/];
991
1056
  }
992
- output.printSuccess(`Message broadcast to ${result.recipients} workers (ID: ${result.messageId})`);
993
- return { success: true, data: result };
994
- }
995
- catch (error) {
996
- output.printError(`Broadcast error: ${error instanceof MCPClientError ? error.message : String(error)}`);
997
- return { success: false, exitCode: 1 };
998
- }
999
- }
1057
+ });
1058
+ }); }
1000
1059
  };
1001
1060
  // Memory subcommand
1002
- const memorySubCommand = {
1061
+ var memorySubCommand = {
1003
1062
  name: 'memory',
1004
1063
  description: 'Access hive shared memory',
1005
1064
  options: [
1006
- { name: 'action', short: 'a', description: 'Memory action', type: 'string', choices: ['get', 'set', 'delete', 'list'], default: 'list' },
1065
+ { name: 'action', short: 'a', description: 'Memory action', type: 'string', choices: ['get', 'set', 'delete', 'list'], "default": 'list' },
1007
1066
  { name: 'key', short: 'k', description: 'Memory key', type: 'string' },
1008
1067
  { name: 'value', short: 'v', description: 'Value to store', type: 'string' }
1009
1068
  ],
1010
- action: async (ctx) => {
1011
- const action = ctx.flags.action || 'list';
1012
- const key = ctx.flags.key;
1013
- const value = ctx.flags.value;
1014
- if ((action === 'get' || action === 'delete') && !key) {
1015
- output.printError('Key required for get/delete.');
1016
- return { success: false, exitCode: 1 };
1017
- }
1018
- if (action === 'set' && (!key || value === undefined)) {
1019
- output.printError('Key and value required for set.');
1020
- return { success: false, exitCode: 1 };
1021
- }
1022
- try {
1023
- const result = await callMCPTool('hive-mind_memory', { action, key, value });
1024
- if (ctx.flags.format === 'json') {
1025
- output.printJson(result);
1026
- return { success: true, data: result };
1027
- }
1028
- if (action === 'list') {
1029
- const keys = result.keys || [];
1030
- output.writeln(output.bold(`\nShared Memory (${result.count} keys)`));
1031
- if (keys.length === 0)
1032
- output.printInfo('No keys in shared memory');
1033
- else
1034
- output.printList(keys.map(k => output.highlight(k)));
1035
- }
1036
- else if (action === 'get') {
1037
- output.writeln(output.bold(`\nKey: ${key}`));
1038
- output.writeln(result.exists ? `Value: ${JSON.stringify(result.value, null, 2)}` : 'Key not found');
1039
- }
1040
- else if (action === 'set') {
1041
- output.printSuccess(`Set ${key} in shared memory`);
1069
+ action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
1070
+ var action, key, value, result, keys, error_11;
1071
+ return __generator(this, function (_a) {
1072
+ switch (_a.label) {
1073
+ case 0:
1074
+ action = ctx.flags.action || 'list';
1075
+ key = ctx.flags.key;
1076
+ value = ctx.flags.value;
1077
+ if ((action === 'get' || action === 'delete') && !key) {
1078
+ output.printError('Key required for get/delete.');
1079
+ return [2 /*return*/, { success: false, exitCode: 1 }];
1080
+ }
1081
+ if (action === 'set' && (!key || value === undefined)) {
1082
+ output.printError('Key and value required for set.');
1083
+ return [2 /*return*/, { success: false, exitCode: 1 }];
1084
+ }
1085
+ _a.label = 1;
1086
+ case 1:
1087
+ _a.trys.push([1, 3, , 4]);
1088
+ return [4 /*yield*/, callMCPTool('hive-mind_memory', { action: action, key: key, value: value })];
1089
+ case 2:
1090
+ result = _a.sent();
1091
+ if (ctx.flags.format === 'json') {
1092
+ output.printJson(result);
1093
+ return [2 /*return*/, { success: true, data: result }];
1094
+ }
1095
+ if (action === 'list') {
1096
+ keys = result.keys || [];
1097
+ output.writeln(output.bold("\nShared Memory (" + result.count + " keys)"));
1098
+ if (keys.length === 0)
1099
+ output.printInfo('No keys in shared memory');
1100
+ else
1101
+ output.printList(keys.map(function (k) { return output.highlight(k); }));
1102
+ }
1103
+ else if (action === 'get') {
1104
+ output.writeln(output.bold("\nKey: " + key));
1105
+ output.writeln(result.exists ? "Value: " + JSON.stringify(result.value, null, 2) : 'Key not found');
1106
+ }
1107
+ else if (action === 'set') {
1108
+ output.printSuccess("Set " + key + " in shared memory");
1109
+ }
1110
+ else if (action === 'delete') {
1111
+ output.printSuccess(result.deleted ? "Deleted " + key : "Key " + key + " did not exist");
1112
+ }
1113
+ return [2 /*return*/, { success: true, data: result }];
1114
+ case 3:
1115
+ error_11 = _a.sent();
1116
+ output.printError("Memory error: " + (error_11 instanceof MCPClientError ? error_11.message : String(error_11)));
1117
+ return [2 /*return*/, { success: false, exitCode: 1 }];
1118
+ case 4: return [2 /*return*/];
1042
1119
  }
1043
- else if (action === 'delete') {
1044
- output.printSuccess(result.deleted ? `Deleted ${key}` : `Key ${key} did not exist`);
1045
- }
1046
- return { success: true, data: result };
1047
- }
1048
- catch (error) {
1049
- output.printError(`Memory error: ${error instanceof MCPClientError ? error.message : String(error)}`);
1050
- return { success: false, exitCode: 1 };
1051
- }
1052
- }
1120
+ });
1121
+ }); }
1053
1122
  };
1054
1123
  // Shutdown subcommand
1055
- const shutdownCommand = {
1124
+ var shutdownCommand = {
1056
1125
  name: 'shutdown',
1057
1126
  description: 'Shutdown the hive mind',
1058
1127
  options: [
@@ -1061,60 +1130,73 @@ const shutdownCommand = {
1061
1130
  short: 'f',
1062
1131
  description: 'Force shutdown',
1063
1132
  type: 'boolean',
1064
- default: false
1133
+ "default": false
1065
1134
  },
1066
1135
  {
1067
1136
  name: 'save-state',
1068
1137
  short: 's',
1069
1138
  description: 'Save state before shutdown',
1070
1139
  type: 'boolean',
1071
- default: true
1140
+ "default": true
1072
1141
  }
1073
1142
  ],
1074
- action: async (ctx) => {
1075
- const force = ctx.flags.force;
1076
- const saveState = ctx.flags.saveState;
1077
- if (!force && ctx.interactive) {
1078
- const confirmed = await confirm({
1079
- message: 'Shutdown the hive mind? All agents will be terminated.',
1080
- default: false
1081
- });
1082
- if (!confirmed) {
1083
- output.printInfo('Operation cancelled');
1084
- return { success: true };
1085
- }
1086
- }
1087
- output.printInfo('Shutting down hive mind...');
1088
- const spinner = output.createSpinner({ text: 'Graceful shutdown in progress...', spinner: 'dots' });
1089
- spinner.start();
1090
- try {
1091
- const result = await callMCPTool('hive-mind_shutdown', {
1092
- force,
1093
- saveState,
1094
- });
1095
- spinner.succeed('Hive mind shutdown complete');
1096
- output.writeln();
1097
- output.printList([
1098
- `Agents terminated: ${result.agentsTerminated}`,
1099
- `State saved: ${result.stateSaved ? 'Yes' : 'No'}`,
1100
- `Shutdown time: ${result.shutdownTime}`
1101
- ]);
1102
- return { success: true, data: result };
1103
- }
1104
- catch (error) {
1105
- spinner.fail('Shutdown failed');
1106
- if (error instanceof MCPClientError) {
1107
- output.printError(`Shutdown error: ${error.message}`);
1108
- }
1109
- else {
1110
- output.printError(`Unexpected error: ${String(error)}`);
1143
+ action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
1144
+ var force, saveState, confirmed, spinner, result, error_12;
1145
+ return __generator(this, function (_a) {
1146
+ switch (_a.label) {
1147
+ case 0:
1148
+ force = ctx.flags.force;
1149
+ saveState = ctx.flags.saveState;
1150
+ if (!(!force && ctx.interactive)) return [3 /*break*/, 2];
1151
+ return [4 /*yield*/, confirm({
1152
+ message: 'Shutdown the hive mind? All agents will be terminated.',
1153
+ "default": false
1154
+ })];
1155
+ case 1:
1156
+ confirmed = _a.sent();
1157
+ if (!confirmed) {
1158
+ output.printInfo('Operation cancelled');
1159
+ return [2 /*return*/, { success: true }];
1160
+ }
1161
+ _a.label = 2;
1162
+ case 2:
1163
+ output.printInfo('Shutting down hive mind...');
1164
+ spinner = output.createSpinner({ text: 'Graceful shutdown in progress...', spinner: 'dots' });
1165
+ spinner.start();
1166
+ _a.label = 3;
1167
+ case 3:
1168
+ _a.trys.push([3, 5, , 6]);
1169
+ return [4 /*yield*/, callMCPTool('hive-mind_shutdown', {
1170
+ force: force,
1171
+ saveState: saveState
1172
+ })];
1173
+ case 4:
1174
+ result = _a.sent();
1175
+ spinner.succeed('Hive mind shutdown complete');
1176
+ output.writeln();
1177
+ output.printList([
1178
+ "Agents terminated: " + result.agentsTerminated,
1179
+ "State saved: " + (result.stateSaved ? 'Yes' : 'No'),
1180
+ "Shutdown time: " + result.shutdownTime
1181
+ ]);
1182
+ return [2 /*return*/, { success: true, data: result }];
1183
+ case 5:
1184
+ error_12 = _a.sent();
1185
+ spinner.fail('Shutdown failed');
1186
+ if (error_12 instanceof MCPClientError) {
1187
+ output.printError("Shutdown error: " + error_12.message);
1188
+ }
1189
+ else {
1190
+ output.printError("Unexpected error: " + String(error_12));
1191
+ }
1192
+ return [2 /*return*/, { success: false, exitCode: 1 }];
1193
+ case 6: return [2 /*return*/];
1111
1194
  }
1112
- return { success: false, exitCode: 1 };
1113
- }
1114
- }
1195
+ });
1196
+ }); }
1115
1197
  };
1116
1198
  // Main hive-mind command
1117
- export const hiveMindCommand = {
1199
+ export var hiveMindCommand = {
1118
1200
  name: 'hive-mind',
1119
1201
  aliases: ['hive'],
1120
1202
  description: 'Queen-led consensus-based multi-agent coordination',
@@ -1126,46 +1208,48 @@ export const hiveMindCommand = {
1126
1208
  { command: 'claude-flow hive-mind spawn --claude -o "Build a feature"', description: 'Launch Claude Code with hive mind' },
1127
1209
  { command: 'claude-flow hive-mind task -d "Build feature"', description: 'Submit task' }
1128
1210
  ],
1129
- action: async () => {
1130
- output.writeln();
1131
- output.writeln(output.bold('Hive Mind - Consensus-Based Multi-Agent Coordination'));
1132
- output.writeln();
1133
- output.writeln('Usage: claude-flow hive-mind <subcommand> [options]');
1134
- output.writeln();
1135
- output.writeln('Subcommands:');
1136
- output.printList([
1137
- `${output.highlight('init')} - Initialize hive mind`,
1138
- `${output.highlight('spawn')} - Spawn worker agents (use --claude to launch Claude Code)`,
1139
- `${output.highlight('status')} - Show hive status`,
1140
- `${output.highlight('task')} - Submit task to hive`,
1141
- `${output.highlight('join')} - Join an agent to the hive`,
1142
- `${output.highlight('leave')} - Remove an agent from the hive`,
1143
- `${output.highlight('consensus')} - Manage consensus proposals`,
1144
- `${output.highlight('broadcast')} - Broadcast message to workers`,
1145
- `${output.highlight('memory')} - Access shared memory`,
1146
- `${output.highlight('optimize-memory')} - Optimize patterns and memory`,
1147
- `${output.highlight('shutdown')} - Shutdown the hive`
1148
- ]);
1149
- output.writeln();
1150
- output.writeln('Features:');
1151
- output.printList([
1152
- 'Queen-led hierarchical coordination',
1153
- 'Byzantine fault tolerant consensus',
1154
- 'HNSW-accelerated pattern matching',
1155
- 'Cross-session memory persistence',
1156
- 'Automatic load balancing',
1157
- output.success('NEW: --claude flag to launch interactive Claude Code sessions')
1158
- ]);
1159
- output.writeln();
1160
- output.writeln('Quick Start with Claude Code:');
1161
- output.writeln(output.dim(' claude-flow hive-mind init'));
1162
- output.writeln(output.dim(' claude-flow hive-mind spawn -n 5 --claude -o "Your objective here"'));
1163
- return { success: true };
1164
- }
1211
+ action: function () { return __awaiter(void 0, void 0, Promise, function () {
1212
+ return __generator(this, function (_a) {
1213
+ output.writeln();
1214
+ output.writeln(output.bold('Hive Mind - Consensus-Based Multi-Agent Coordination'));
1215
+ output.writeln();
1216
+ output.writeln('Usage: claude-flow hive-mind <subcommand> [options]');
1217
+ output.writeln();
1218
+ output.writeln('Subcommands:');
1219
+ output.printList([
1220
+ output.highlight('init') + " - Initialize hive mind",
1221
+ output.highlight('spawn') + " - Spawn worker agents (use --claude to launch Claude Code)",
1222
+ output.highlight('status') + " - Show hive status",
1223
+ output.highlight('task') + " - Submit task to hive",
1224
+ output.highlight('join') + " - Join an agent to the hive",
1225
+ output.highlight('leave') + " - Remove an agent from the hive",
1226
+ output.highlight('consensus') + " - Manage consensus proposals",
1227
+ output.highlight('broadcast') + " - Broadcast message to workers",
1228
+ output.highlight('memory') + " - Access shared memory",
1229
+ output.highlight('optimize-memory') + " - Optimize patterns and memory",
1230
+ output.highlight('shutdown') + " - Shutdown the hive"
1231
+ ]);
1232
+ output.writeln();
1233
+ output.writeln('Features:');
1234
+ output.printList([
1235
+ 'Queen-led hierarchical coordination',
1236
+ 'Byzantine fault tolerant consensus',
1237
+ 'HNSW-accelerated pattern matching',
1238
+ 'Cross-session memory persistence',
1239
+ 'Automatic load balancing',
1240
+ output.success('NEW: --claude flag to launch interactive Claude Code sessions')
1241
+ ]);
1242
+ output.writeln();
1243
+ output.writeln('Quick Start with Claude Code:');
1244
+ output.writeln(output.dim(' claude-flow hive-mind init'));
1245
+ output.writeln(output.dim(' claude-flow hive-mind spawn -n 5 --claude -o "Your objective here"'));
1246
+ return [2 /*return*/, { success: true }];
1247
+ });
1248
+ }); }
1165
1249
  };
1166
1250
  // Helper functions
1167
1251
  function formatAgentStatus(status) {
1168
- const statusStr = String(status);
1252
+ var statusStr = String(status);
1169
1253
  switch (statusStr) {
1170
1254
  case 'active':
1171
1255
  case 'ready':