kynjal-cli 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (502) hide show
  1. package/dist/src/appliance/gguf-engine.d.ts +91 -0
  2. package/dist/src/appliance/gguf-engine.d.ts.map +1 -0
  3. package/dist/src/appliance/gguf-engine.js +286 -525
  4. package/dist/src/appliance/gguf-engine.js.map +1 -1
  5. package/dist/src/appliance/ruvllm-bridge.d.ts +102 -0
  6. package/dist/src/appliance/ruvllm-bridge.d.ts.map +1 -0
  7. package/dist/src/appliance/ruvllm-bridge.js +203 -403
  8. package/dist/src/appliance/ruvllm-bridge.js.map +1 -1
  9. package/dist/src/appliance/rvfa-builder.d.ts +44 -0
  10. package/dist/src/appliance/rvfa-builder.d.ts.map +1 -0
  11. package/dist/src/appliance/rvfa-builder.js +154 -208
  12. package/dist/src/appliance/rvfa-builder.js.map +1 -1
  13. package/dist/src/appliance/rvfa-distribution.d.ts +97 -0
  14. package/dist/src/appliance/rvfa-distribution.d.ts.map +1 -0
  15. package/dist/src/appliance/rvfa-distribution.js +260 -423
  16. package/dist/src/appliance/rvfa-distribution.js.map +1 -1
  17. package/dist/src/appliance/rvfa-format.d.ts +111 -0
  18. package/dist/src/appliance/rvfa-format.d.ts.map +1 -0
  19. package/dist/src/appliance/rvfa-format.js +128 -200
  20. package/dist/src/appliance/rvfa-format.js.map +1 -1
  21. package/dist/src/appliance/rvfa-runner.d.ts +69 -0
  22. package/dist/src/appliance/rvfa-runner.d.ts.map +1 -0
  23. package/dist/src/appliance/rvfa-runner.js +168 -304
  24. package/dist/src/appliance/rvfa-runner.js.map +1 -1
  25. package/dist/src/appliance/rvfa-signing.d.ts +123 -0
  26. package/dist/src/appliance/rvfa-signing.d.ts.map +1 -0
  27. package/dist/src/appliance/rvfa-signing.js +173 -295
  28. package/dist/src/appliance/rvfa-signing.js.map +1 -1
  29. package/dist/src/benchmarks/pretrain/index.d.ts +58 -0
  30. package/dist/src/benchmarks/pretrain/index.d.ts.map +1 -0
  31. package/dist/src/benchmarks/pretrain/index.js +331 -542
  32. package/dist/src/benchmarks/pretrain/index.js.map +1 -1
  33. package/dist/src/commands/agent.js +574 -697
  34. package/dist/src/commands/agent.js.map +1 -1
  35. package/dist/src/commands/analyze.js +1218 -1548
  36. package/dist/src/commands/analyze.js.map +1 -1
  37. package/dist/src/commands/appliance-advanced.js +158 -267
  38. package/dist/src/commands/appliance-advanced.js.map +1 -1
  39. package/dist/src/commands/appliance.js +318 -493
  40. package/dist/src/commands/appliance.js.map +1 -1
  41. package/dist/src/commands/benchmark.js +372 -523
  42. package/dist/src/commands/benchmark.js.map +1 -1
  43. package/dist/src/commands/claims.js +274 -364
  44. package/dist/src/commands/claims.js.map +1 -1
  45. package/dist/src/commands/cleanup.js +113 -157
  46. package/dist/src/commands/cleanup.js.map +1 -1
  47. package/dist/src/commands/completions.js +477 -118
  48. package/dist/src/commands/completions.js.map +1 -1
  49. package/dist/src/commands/config.js +237 -303
  50. package/dist/src/commands/config.js.map +1 -1
  51. package/dist/src/commands/daemon.js +487 -596
  52. package/dist/src/commands/daemon.js.map +1 -1
  53. package/dist/src/commands/deployment.js +194 -275
  54. package/dist/src/commands/deployment.js.map +1 -1
  55. package/dist/src/commands/doctor.js +504 -686
  56. package/dist/src/commands/doctor.js.map +1 -1
  57. package/dist/src/commands/embeddings.js +1293 -1543
  58. package/dist/src/commands/embeddings.js.map +1 -1
  59. package/dist/src/commands/guidance.js +449 -596
  60. package/dist/src/commands/guidance.js.map +1 -1
  61. package/dist/src/commands/hive-mind.js +854 -938
  62. package/dist/src/commands/hive-mind.js.map +1 -1
  63. package/dist/src/commands/hooks.js +3112 -3519
  64. package/dist/src/commands/hooks.js.map +1 -1
  65. package/dist/src/commands/index.d.ts +115 -0
  66. package/dist/src/commands/index.d.ts.map +1 -0
  67. package/dist/src/commands/index.js +126 -308
  68. package/dist/src/commands/index.js.map +1 -1
  69. package/dist/src/commands/init.js +788 -940
  70. package/dist/src/commands/init.js.map +1 -1
  71. package/dist/src/commands/issues.js +383 -558
  72. package/dist/src/commands/issues.js.map +1 -1
  73. package/dist/src/commands/mcp.js +493 -605
  74. package/dist/src/commands/mcp.js.map +1 -1
  75. package/dist/src/commands/memory.js +833 -1026
  76. package/dist/src/commands/memory.js.map +1 -1
  77. package/dist/src/commands/migrate.js +282 -347
  78. package/dist/src/commands/migrate.js.map +1 -1
  79. package/dist/src/commands/neural.js +1289 -1563
  80. package/dist/src/commands/neural.js.map +1 -1
  81. package/dist/src/commands/performance.js +497 -643
  82. package/dist/src/commands/performance.js.map +1 -1
  83. package/dist/src/commands/plugins.js +668 -841
  84. package/dist/src/commands/plugins.js.map +1 -1
  85. package/dist/src/commands/process.js +392 -447
  86. package/dist/src/commands/process.js.map +1 -1
  87. package/dist/src/commands/progress.js +162 -256
  88. package/dist/src/commands/progress.js.map +1 -1
  89. package/dist/src/commands/providers.js +150 -220
  90. package/dist/src/commands/providers.js.map +1 -1
  91. package/dist/src/commands/route.js +520 -665
  92. package/dist/src/commands/route.js.map +1 -1
  93. package/dist/src/commands/ruvector/backup.js +505 -651
  94. package/dist/src/commands/ruvector/backup.js.map +1 -1
  95. package/dist/src/commands/ruvector/benchmark.js +349 -401
  96. package/dist/src/commands/ruvector/benchmark.js.map +1 -1
  97. package/dist/src/commands/ruvector/import.js +224 -266
  98. package/dist/src/commands/ruvector/import.js.map +1 -1
  99. package/dist/src/commands/ruvector/index.js +37 -75
  100. package/dist/src/commands/ruvector/index.js.map +1 -1
  101. package/dist/src/commands/ruvector/init.js +336 -359
  102. package/dist/src/commands/ruvector/init.js.map +1 -1
  103. package/dist/src/commands/ruvector/migrate.js +335 -322
  104. package/dist/src/commands/ruvector/migrate.js.map +1 -1
  105. package/dist/src/commands/ruvector/optimize.js +375 -431
  106. package/dist/src/commands/ruvector/optimize.js.map +1 -1
  107. package/dist/src/commands/ruvector/setup.js +703 -117
  108. package/dist/src/commands/ruvector/setup.js.map +1 -1
  109. package/dist/src/commands/ruvector/status.js +364 -419
  110. package/dist/src/commands/ruvector/status.js.map +1 -1
  111. package/dist/src/commands/security.js +485 -608
  112. package/dist/src/commands/security.js.map +1 -1
  113. package/dist/src/commands/session.js +504 -626
  114. package/dist/src/commands/session.js.map +1 -1
  115. package/dist/src/commands/start.js +267 -364
  116. package/dist/src/commands/start.js.map +1 -1
  117. package/dist/src/commands/status.js +380 -486
  118. package/dist/src/commands/status.js.map +1 -1
  119. package/dist/src/commands/swarm.js +408 -488
  120. package/dist/src/commands/swarm.js.map +1 -1
  121. package/dist/src/commands/task.js +423 -538
  122. package/dist/src/commands/task.js.map +1 -1
  123. package/dist/src/commands/transfer-store.js +322 -412
  124. package/dist/src/commands/transfer-store.js.map +1 -1
  125. package/dist/src/commands/update.js +196 -291
  126. package/dist/src/commands/update.js.map +1 -1
  127. package/dist/src/commands/workflow.js +386 -486
  128. package/dist/src/commands/workflow.js.map +1 -1
  129. package/dist/src/config-adapter.d.ts +15 -0
  130. package/dist/src/config-adapter.d.ts.map +1 -0
  131. package/dist/src/config-adapter.js +38 -39
  132. package/dist/src/config-adapter.js.map +1 -1
  133. package/dist/src/index.d.ts +77 -0
  134. package/dist/src/index.d.ts.map +1 -0
  135. package/dist/src/index.js +309 -411
  136. package/dist/src/index.js.map +1 -1
  137. package/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
  138. package/dist/src/infrastructure/in-memory-repositories.d.ts.map +1 -0
  139. package/dist/src/infrastructure/in-memory-repositories.js +246 -507
  140. package/dist/src/infrastructure/in-memory-repositories.js.map +1 -1
  141. package/dist/src/init/claudemd-generator.d.ts +25 -0
  142. package/dist/src/init/claudemd-generator.d.ts.map +1 -0
  143. package/dist/src/init/claudemd-generator.js +368 -78
  144. package/dist/src/init/claudemd-generator.js.map +1 -1
  145. package/dist/src/init/executor.d.ts +41 -0
  146. package/dist/src/init/executor.d.ts.map +1 -0
  147. package/dist/src/init/executor.js +1307 -996
  148. package/dist/src/init/executor.js.map +1 -1
  149. package/dist/src/init/helpers-generator.d.ts +60 -0
  150. package/dist/src/init/helpers-generator.d.ts.map +1 -0
  151. package/dist/src/init/helpers-generator.js +657 -12
  152. package/dist/src/init/helpers-generator.js.map +1 -1
  153. package/dist/src/init/index.d.ts +1 -1
  154. package/dist/src/init/index.d.ts.map +1 -1
  155. package/dist/src/init/index.js +1 -1
  156. package/dist/src/init/index.js.map +1 -1
  157. package/dist/src/init/mcp-generator.js +33 -37
  158. package/dist/src/init/mcp-generator.js.map +1 -1
  159. package/dist/src/init/settings-generator.js +76 -77
  160. package/dist/src/init/settings-generator.js.map +1 -1
  161. package/dist/src/init/statusline-generator.js +801 -3
  162. package/dist/src/init/statusline-generator.js.map +1 -1
  163. package/dist/src/init/types.d.ts +1 -1
  164. package/dist/src/init/types.d.ts.map +1 -1
  165. package/dist/src/init/types.js +76 -59
  166. package/dist/src/init/types.js.map +1 -1
  167. package/dist/src/mcp-client.d.ts +92 -0
  168. package/dist/src/mcp-client.d.ts.map +1 -0
  169. package/dist/src/mcp-client.js +81 -125
  170. package/dist/src/mcp-client.js.map +1 -1
  171. package/dist/src/mcp-server.d.ts +161 -0
  172. package/dist/src/mcp-server.d.ts.map +1 -0
  173. package/dist/src/mcp-server.js +470 -757
  174. package/dist/src/mcp-server.js.map +1 -1
  175. package/dist/src/mcp-tools/agent-tools.js +391 -492
  176. package/dist/src/mcp-tools/agent-tools.js.map +1 -1
  177. package/dist/src/mcp-tools/agentdb-tools.js +332 -533
  178. package/dist/src/mcp-tools/agentdb-tools.js.map +1 -1
  179. package/dist/src/mcp-tools/analyze-tools.js +172 -236
  180. package/dist/src/mcp-tools/analyze-tools.js.map +1 -1
  181. package/dist/src/mcp-tools/auto-install.d.ts +83 -0
  182. package/dist/src/mcp-tools/auto-install.d.ts.map +1 -0
  183. package/dist/src/mcp-tools/auto-install.js +80 -142
  184. package/dist/src/mcp-tools/auto-install.js.map +1 -1
  185. package/dist/src/mcp-tools/browser-tools.js +252 -375
  186. package/dist/src/mcp-tools/browser-tools.js.map +1 -1
  187. package/dist/src/mcp-tools/claims-tools.js +473 -565
  188. package/dist/src/mcp-tools/claims-tools.js.map +1 -1
  189. package/dist/src/mcp-tools/config-tools.js +197 -272
  190. package/dist/src/mcp-tools/config-tools.js.map +1 -1
  191. package/dist/src/mcp-tools/coordination-tools.js +500 -572
  192. package/dist/src/mcp-tools/coordination-tools.js.map +1 -1
  193. package/dist/src/mcp-tools/daa-tools.js +286 -364
  194. package/dist/src/mcp-tools/daa-tools.js.map +1 -1
  195. package/dist/src/mcp-tools/embeddings-tools.js +582 -693
  196. package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
  197. package/dist/src/mcp-tools/github-tools.js +260 -311
  198. package/dist/src/mcp-tools/github-tools.js.map +1 -1
  199. package/dist/src/mcp-tools/hive-mind-tools.js +573 -640
  200. package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
  201. package/dist/src/mcp-tools/hooks-tools.js +2215 -2648
  202. package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
  203. package/dist/src/mcp-tools/memory-tools.js +350 -505
  204. package/dist/src/mcp-tools/memory-tools.js.map +1 -1
  205. package/dist/src/mcp-tools/neural-tools.js +315 -412
  206. package/dist/src/mcp-tools/neural-tools.js.map +1 -1
  207. package/dist/src/mcp-tools/performance-tools.js +420 -480
  208. package/dist/src/mcp-tools/performance-tools.js.map +1 -1
  209. package/dist/src/mcp-tools/progress-tools.js +204 -278
  210. package/dist/src/mcp-tools/progress-tools.js.map +1 -1
  211. package/dist/src/mcp-tools/ruvllm-tools.js +163 -279
  212. package/dist/src/mcp-tools/ruvllm-tools.js.map +1 -1
  213. package/dist/src/mcp-tools/security-tools.js +297 -429
  214. package/dist/src/mcp-tools/security-tools.js.map +1 -1
  215. package/dist/src/mcp-tools/session-tools.js +185 -234
  216. package/dist/src/mcp-tools/session-tools.js.map +1 -1
  217. package/dist/src/mcp-tools/swarm-tools.js +207 -260
  218. package/dist/src/mcp-tools/swarm-tools.js.map +1 -1
  219. package/dist/src/mcp-tools/system-tools.js +276 -325
  220. package/dist/src/mcp-tools/system-tools.js.map +1 -1
  221. package/dist/src/mcp-tools/task-tools.js +270 -336
  222. package/dist/src/mcp-tools/task-tools.js.map +1 -1
  223. package/dist/src/mcp-tools/terminal-tools.js +148 -196
  224. package/dist/src/mcp-tools/terminal-tools.js.map +1 -1
  225. package/dist/src/mcp-tools/transfer-tools.js +186 -333
  226. package/dist/src/mcp-tools/transfer-tools.js.map +1 -1
  227. package/dist/src/mcp-tools/types.d.ts +31 -0
  228. package/dist/src/mcp-tools/types.d.ts.map +1 -0
  229. package/dist/src/mcp-tools/wasm-agent-tools.js +133 -280
  230. package/dist/src/mcp-tools/wasm-agent-tools.js.map +1 -1
  231. package/dist/src/mcp-tools/workflow-tools.js +405 -450
  232. package/dist/src/mcp-tools/workflow-tools.js.map +1 -1
  233. package/dist/src/memory/ewc-consolidation.d.ts +295 -0
  234. package/dist/src/memory/ewc-consolidation.d.ts.map +1 -0
  235. package/dist/src/memory/ewc-consolidation.js +190 -303
  236. package/dist/src/memory/ewc-consolidation.js.map +1 -1
  237. package/dist/src/memory/intelligence.d.ts +338 -0
  238. package/dist/src/memory/intelligence.d.ts.map +1 -0
  239. package/dist/src/memory/intelligence.js +569 -794
  240. package/dist/src/memory/intelligence.js.map +1 -1
  241. package/dist/src/memory/memory-bridge.d.ts +407 -0
  242. package/dist/src/memory/memory-bridge.d.ts.map +1 -0
  243. package/dist/src/memory/memory-bridge.js +1170 -1640
  244. package/dist/src/memory/memory-bridge.js.map +1 -1
  245. package/dist/src/memory/memory-initializer.d.ts +412 -0
  246. package/dist/src/memory/memory-initializer.d.ts.map +1 -0
  247. package/dist/src/memory/memory-initializer.js +1836 -1851
  248. package/dist/src/memory/memory-initializer.js.map +1 -1
  249. package/dist/src/memory/sona-optimizer.d.ts +227 -0
  250. package/dist/src/memory/sona-optimizer.d.ts.map +1 -0
  251. package/dist/src/memory/sona-optimizer.js +199 -329
  252. package/dist/src/memory/sona-optimizer.js.map +1 -1
  253. package/dist/src/output.d.ts +2 -2
  254. package/dist/src/output.d.ts.map +1 -1
  255. package/dist/src/output.js +242 -272
  256. package/dist/src/output.js.map +1 -1
  257. package/dist/src/parser.d.ts +51 -0
  258. package/dist/src/parser.d.ts.map +1 -0
  259. package/dist/src/parser.js +140 -187
  260. package/dist/src/parser.js.map +1 -1
  261. package/dist/src/plugins/manager.d.ts +133 -0
  262. package/dist/src/plugins/manager.d.ts.map +1 -0
  263. package/dist/src/plugins/manager.js +285 -521
  264. package/dist/src/plugins/manager.js.map +1 -1
  265. package/dist/src/plugins/store/discovery.d.ts +88 -0
  266. package/dist/src/plugins/store/discovery.d.ts.map +1 -0
  267. package/dist/src/plugins/store/discovery.js +271 -358
  268. package/dist/src/plugins/store/discovery.js.map +1 -1
  269. package/dist/src/plugins/store/index.d.ts +76 -0
  270. package/dist/src/plugins/store/index.d.ts.map +1 -0
  271. package/dist/src/plugins/store/index.js +48 -105
  272. package/dist/src/plugins/store/index.js.map +1 -1
  273. package/dist/src/plugins/store/search.d.ts +46 -0
  274. package/dist/src/plugins/store/search.d.ts.map +1 -0
  275. package/dist/src/plugins/store/search.js +69 -107
  276. package/dist/src/plugins/store/search.js.map +1 -1
  277. package/dist/src/plugins/store/types.d.ts +274 -0
  278. package/dist/src/plugins/store/types.d.ts.map +1 -0
  279. package/dist/src/plugins/tests/demo-plugin-store.js +113 -160
  280. package/dist/src/plugins/tests/demo-plugin-store.js.map +1 -1
  281. package/dist/src/plugins/tests/standalone-test.js +172 -223
  282. package/dist/src/plugins/tests/standalone-test.js.map +1 -1
  283. package/dist/src/plugins/tests/test-plugin-store.js +190 -228
  284. package/dist/src/plugins/tests/test-plugin-store.js.map +1 -1
  285. package/dist/src/production/circuit-breaker.d.ts +101 -0
  286. package/dist/src/production/circuit-breaker.d.ts.map +1 -0
  287. package/dist/src/production/circuit-breaker.js +62 -126
  288. package/dist/src/production/circuit-breaker.js.map +1 -1
  289. package/dist/src/production/error-handler.d.ts +92 -0
  290. package/dist/src/production/error-handler.d.ts.map +1 -0
  291. package/dist/src/production/error-handler.js +86 -156
  292. package/dist/src/production/error-handler.js.map +1 -1
  293. package/dist/src/production/monitoring.d.ts +161 -0
  294. package/dist/src/production/monitoring.d.ts.map +1 -0
  295. package/dist/src/production/monitoring.js +139 -220
  296. package/dist/src/production/monitoring.js.map +1 -1
  297. package/dist/src/production/rate-limiter.d.ts +80 -0
  298. package/dist/src/production/rate-limiter.d.ts.map +1 -0
  299. package/dist/src/production/rate-limiter.js +74 -93
  300. package/dist/src/production/rate-limiter.js.map +1 -1
  301. package/dist/src/production/retry.d.ts +48 -0
  302. package/dist/src/production/retry.d.ts.map +1 -0
  303. package/dist/src/production/retry.js +75 -167
  304. package/dist/src/production/retry.js.map +1 -1
  305. package/dist/src/prompt.d.ts +44 -0
  306. package/dist/src/prompt.d.ts.map +1 -0
  307. package/dist/src/prompt.js +436 -560
  308. package/dist/src/prompt.js.map +1 -1
  309. package/dist/src/runtime/headless.d.ts +60 -0
  310. package/dist/src/runtime/headless.d.ts.map +1 -0
  311. package/dist/src/runtime/headless.js +197 -286
  312. package/dist/src/runtime/headless.js.map +1 -1
  313. package/dist/src/ruvector/agent-wasm.d.ts +182 -0
  314. package/dist/src/ruvector/agent-wasm.d.ts.map +1 -0
  315. package/dist/src/ruvector/agent-wasm.js +156 -351
  316. package/dist/src/ruvector/agent-wasm.js.map +1 -1
  317. package/dist/src/ruvector/ast-analyzer.d.ts +67 -0
  318. package/dist/src/ruvector/ast-analyzer.d.ts.map +1 -0
  319. package/dist/src/ruvector/ast-analyzer.js +145 -232
  320. package/dist/src/ruvector/ast-analyzer.js.map +1 -1
  321. package/dist/src/ruvector/coverage-router.d.ts +160 -0
  322. package/dist/src/ruvector/coverage-router.d.ts.map +1 -0
  323. package/dist/src/ruvector/coverage-router.js +287 -419
  324. package/dist/src/ruvector/coverage-router.js.map +1 -1
  325. package/dist/src/ruvector/coverage-tools.js +56 -101
  326. package/dist/src/ruvector/coverage-tools.js.map +1 -1
  327. package/dist/src/ruvector/diff-classifier.d.ts +175 -0
  328. package/dist/src/ruvector/diff-classifier.d.ts.map +1 -0
  329. package/dist/src/ruvector/diff-classifier.js +324 -451
  330. package/dist/src/ruvector/diff-classifier.js.map +1 -1
  331. package/dist/src/ruvector/enhanced-model-router.d.ts +146 -0
  332. package/dist/src/ruvector/enhanced-model-router.d.ts.map +1 -0
  333. package/dist/src/ruvector/enhanced-model-router.js +260 -336
  334. package/dist/src/ruvector/enhanced-model-router.js.map +1 -1
  335. package/dist/src/ruvector/flash-attention.d.ts +195 -0
  336. package/dist/src/ruvector/flash-attention.d.ts.map +1 -0
  337. package/dist/src/ruvector/flash-attention.js +223 -254
  338. package/dist/src/ruvector/flash-attention.js.map +1 -1
  339. package/dist/src/ruvector/graph-analyzer.d.ts +187 -0
  340. package/dist/src/ruvector/graph-analyzer.d.ts.map +1 -0
  341. package/dist/src/ruvector/graph-analyzer.js +486 -680
  342. package/dist/src/ruvector/graph-analyzer.js.map +1 -1
  343. package/dist/src/ruvector/index.d.ts +40 -0
  344. package/dist/src/ruvector/index.d.ts.map +1 -0
  345. package/dist/src/ruvector/index.js +36 -106
  346. package/dist/src/ruvector/index.js.map +1 -1
  347. package/dist/src/ruvector/lora-adapter.d.ts +218 -0
  348. package/dist/src/ruvector/lora-adapter.d.ts.map +1 -0
  349. package/dist/src/ruvector/lora-adapter.js +155 -248
  350. package/dist/src/ruvector/lora-adapter.js.map +1 -1
  351. package/dist/src/ruvector/model-router.d.ts +220 -0
  352. package/dist/src/ruvector/model-router.d.ts.map +1 -0
  353. package/dist/src/ruvector/model-router.js +175 -248
  354. package/dist/src/ruvector/model-router.js.map +1 -1
  355. package/dist/src/ruvector/moe-router.d.ts +206 -0
  356. package/dist/src/ruvector/moe-router.d.ts.map +1 -0
  357. package/dist/src/ruvector/moe-router.js +228 -286
  358. package/dist/src/ruvector/moe-router.js.map +1 -1
  359. package/dist/src/ruvector/q-learning-router.d.ts +211 -0
  360. package/dist/src/ruvector/q-learning-router.d.ts.map +1 -0
  361. package/dist/src/ruvector/q-learning-router.js +257 -338
  362. package/dist/src/ruvector/q-learning-router.js.map +1 -1
  363. package/dist/src/ruvector/ruvllm-wasm.d.ts +179 -0
  364. package/dist/src/ruvector/ruvllm-wasm.d.ts.map +1 -0
  365. package/dist/src/ruvector/ruvllm-wasm.js +270 -434
  366. package/dist/src/ruvector/ruvllm-wasm.js.map +1 -1
  367. package/dist/src/ruvector/semantic-router.d.ts +77 -0
  368. package/dist/src/ruvector/semantic-router.d.ts.map +1 -0
  369. package/dist/src/ruvector/semantic-router.js +60 -67
  370. package/dist/src/ruvector/semantic-router.js.map +1 -1
  371. package/dist/src/ruvector/vector-db.d.ts +69 -0
  372. package/dist/src/ruvector/vector-db.d.ts.map +1 -0
  373. package/dist/src/ruvector/vector-db.js +119 -205
  374. package/dist/src/ruvector/vector-db.js.map +1 -1
  375. package/dist/src/services/agentic-flow-bridge.d.ts +50 -0
  376. package/dist/src/services/agentic-flow-bridge.d.ts.map +1 -0
  377. package/dist/src/services/agentic-flow-bridge.js +32 -105
  378. package/dist/src/services/agentic-flow-bridge.js.map +1 -1
  379. package/dist/src/services/claim-service.d.ts +204 -0
  380. package/dist/src/services/claim-service.d.ts.map +1 -0
  381. package/dist/src/services/claim-service.js +615 -940
  382. package/dist/src/services/claim-service.js.map +1 -1
  383. package/dist/src/services/container-worker-pool.d.ts +197 -0
  384. package/dist/src/services/container-worker-pool.d.ts.map +1 -0
  385. package/dist/src/services/container-worker-pool.js +398 -666
  386. package/dist/src/services/container-worker-pool.js.map +1 -1
  387. package/dist/src/services/headless-worker-executor.d.ts +304 -0
  388. package/dist/src/services/headless-worker-executor.d.ts.map +1 -0
  389. package/dist/src/services/headless-worker-executor.js +441 -467
  390. package/dist/src/services/headless-worker-executor.js.map +1 -1
  391. package/dist/src/services/index.d.ts +4 -4
  392. package/dist/src/services/index.d.ts.map +1 -1
  393. package/dist/src/services/index.js +4 -4
  394. package/dist/src/services/index.js.map +1 -1
  395. package/dist/src/services/registry-api.d.ts +58 -0
  396. package/dist/src/services/registry-api.d.ts.map +1 -0
  397. package/dist/src/services/registry-api.js +92 -200
  398. package/dist/src/services/registry-api.js.map +1 -1
  399. package/dist/src/services/ruvector-training.d.ts +222 -0
  400. package/dist/src/services/ruvector-training.d.ts.map +1 -0
  401. package/dist/src/services/ruvector-training.js +257 -337
  402. package/dist/src/services/ruvector-training.js.map +1 -1
  403. package/dist/src/services/worker-daemon.d.ts +228 -0
  404. package/dist/src/services/worker-daemon.d.ts.map +1 -0
  405. package/dist/src/services/worker-daemon.js +591 -849
  406. package/dist/src/services/worker-daemon.js.map +1 -1
  407. package/dist/src/services/worker-queue.d.ts +194 -0
  408. package/dist/src/services/worker-queue.d.ts.map +1 -0
  409. package/dist/src/services/worker-queue.js +331 -548
  410. package/dist/src/services/worker-queue.js.map +1 -1
  411. package/dist/src/suggest.d.ts +53 -0
  412. package/dist/src/suggest.d.ts.map +1 -0
  413. package/dist/src/suggest.js +45 -55
  414. package/dist/src/suggest.js.map +1 -1
  415. package/dist/src/transfer/anonymization/index.js +29 -37
  416. package/dist/src/transfer/anonymization/index.js.map +1 -1
  417. package/dist/src/transfer/deploy-seraphine.js +128 -155
  418. package/dist/src/transfer/deploy-seraphine.js.map +1 -1
  419. package/dist/src/transfer/export.d.ts +25 -0
  420. package/dist/src/transfer/export.d.ts.map +1 -0
  421. package/dist/src/transfer/export.js +84 -142
  422. package/dist/src/transfer/export.js.map +1 -1
  423. package/dist/src/transfer/index.d.ts +1 -1
  424. package/dist/src/transfer/index.d.ts.map +1 -1
  425. package/dist/src/transfer/index.js +0 -2
  426. package/dist/src/transfer/index.js.map +1 -1
  427. package/dist/src/transfer/ipfs/client.d.ts +109 -0
  428. package/dist/src/transfer/ipfs/client.d.ts.map +1 -0
  429. package/dist/src/transfer/ipfs/client.js +187 -337
  430. package/dist/src/transfer/ipfs/client.js.map +1 -1
  431. package/dist/src/transfer/ipfs/upload.d.ts +95 -0
  432. package/dist/src/transfer/ipfs/upload.d.ts.map +1 -0
  433. package/dist/src/transfer/ipfs/upload.js +288 -434
  434. package/dist/src/transfer/ipfs/upload.js.map +1 -1
  435. package/dist/src/transfer/models/seraphine.d.ts +72 -0
  436. package/dist/src/transfer/models/seraphine.d.ts.map +1 -0
  437. package/dist/src/transfer/models/seraphine.js +55 -55
  438. package/dist/src/transfer/models/seraphine.js.map +1 -1
  439. package/dist/src/transfer/serialization/cfp.d.ts +49 -0
  440. package/dist/src/transfer/serialization/cfp.d.ts.map +1 -0
  441. package/dist/src/transfer/serialization/cfp.js +30 -31
  442. package/dist/src/transfer/serialization/cfp.js.map +1 -1
  443. package/dist/src/transfer/storage/gcs.d.ts +82 -0
  444. package/dist/src/transfer/storage/gcs.d.ts.map +1 -0
  445. package/dist/src/transfer/storage/gcs.js +165 -232
  446. package/dist/src/transfer/storage/gcs.js.map +1 -1
  447. package/dist/src/transfer/store/discovery.d.ts +84 -0
  448. package/dist/src/transfer/store/discovery.d.ts.map +1 -0
  449. package/dist/src/transfer/store/discovery.js +239 -349
  450. package/dist/src/transfer/store/discovery.js.map +1 -1
  451. package/dist/src/transfer/store/download.d.ts +70 -0
  452. package/dist/src/transfer/store/download.d.ts.map +1 -0
  453. package/dist/src/transfer/store/download.js +243 -365
  454. package/dist/src/transfer/store/download.js.map +1 -1
  455. package/dist/src/transfer/store/index.d.ts +84 -0
  456. package/dist/src/transfer/store/index.d.ts.map +1 -0
  457. package/dist/src/transfer/store/index.js +63 -130
  458. package/dist/src/transfer/store/index.js.map +1 -1
  459. package/dist/src/transfer/store/publish.d.ts +76 -0
  460. package/dist/src/transfer/store/publish.d.ts.map +1 -0
  461. package/dist/src/transfer/store/publish.js +184 -258
  462. package/dist/src/transfer/store/publish.js.map +1 -1
  463. package/dist/src/transfer/store/registry.js +50 -72
  464. package/dist/src/transfer/store/registry.js.map +1 -1
  465. package/dist/src/transfer/store/search.d.ts +54 -0
  466. package/dist/src/transfer/store/search.d.ts.map +1 -0
  467. package/dist/src/transfer/store/search.js +64 -96
  468. package/dist/src/transfer/store/search.js.map +1 -1
  469. package/dist/src/transfer/store/tests/standalone-test.js +174 -231
  470. package/dist/src/transfer/store/tests/standalone-test.js.map +1 -1
  471. package/dist/src/transfer/test-seraphine.js +95 -130
  472. package/dist/src/transfer/test-seraphine.js.map +1 -1
  473. package/dist/src/transfer/tests/test-store.js +194 -239
  474. package/dist/src/transfer/tests/test-store.js.map +1 -1
  475. package/dist/src/transfer/types.d.ts +245 -0
  476. package/dist/src/transfer/types.d.ts.map +1 -0
  477. package/dist/src/types.d.ts +198 -0
  478. package/dist/src/types.d.ts.map +1 -0
  479. package/dist/src/types.js +26 -55
  480. package/dist/src/types.js.map +1 -1
  481. package/dist/src/update/checker.d.ts +34 -0
  482. package/dist/src/update/checker.d.ts.map +1 -0
  483. package/dist/src/update/checker.js +106 -183
  484. package/dist/src/update/checker.js.map +1 -1
  485. package/dist/src/update/executor.d.ts +32 -0
  486. package/dist/src/update/executor.d.ts.map +1 -0
  487. package/dist/src/update/executor.js +135 -198
  488. package/dist/src/update/executor.js.map +1 -1
  489. package/dist/src/update/index.d.ts +33 -0
  490. package/dist/src/update/index.d.ts.map +1 -0
  491. package/dist/src/update/index.js +38 -85
  492. package/dist/src/update/index.js.map +1 -1
  493. package/dist/src/update/rate-limiter.d.ts +20 -0
  494. package/dist/src/update/rate-limiter.d.ts.map +1 -0
  495. package/dist/src/update/rate-limiter.js +19 -31
  496. package/dist/src/update/rate-limiter.js.map +1 -1
  497. package/dist/src/update/validator.d.ts +17 -0
  498. package/dist/src/update/validator.d.ts.map +1 -0
  499. package/dist/src/update/validator.js +38 -64
  500. package/dist/src/update/validator.js.map +1 -1
  501. package/dist/tsconfig.tsbuildinfo +1 -1
  502. package/package.json +1 -1
@@ -5,42 +5,6 @@
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
- };
44
8
  import { output } from '../output.js';
45
9
  import { select, confirm, input } from '../prompt.js';
46
10
  import { callMCPTool, MCPClientError } from '../mcp-client.js';
@@ -48,14 +12,14 @@ import { spawn as childSpawn, execSync } from 'child_process';
48
12
  import { mkdir, writeFile } from 'fs/promises';
49
13
  import { join } from 'path';
50
14
  // Hive topologies
51
- var TOPOLOGIES = [
15
+ const TOPOLOGIES = [
52
16
  { value: 'hierarchical', label: 'Hierarchical', hint: 'Queen-led with worker agents' },
53
17
  { value: 'mesh', label: 'Mesh', hint: 'Peer-to-peer coordination' },
54
18
  { value: 'hierarchical-mesh', label: 'Hierarchical Mesh', hint: 'Queen + peer communication (recommended)' },
55
19
  { value: 'adaptive', label: 'Adaptive', hint: 'Dynamic topology based on task' }
56
20
  ];
57
21
  // Consensus strategies
58
- var CONSENSUS_STRATEGIES = [
22
+ const CONSENSUS_STRATEGIES = [
59
23
  { value: 'byzantine', label: 'Byzantine Fault Tolerant', hint: '2/3 majority, handles malicious actors' },
60
24
  { value: 'raft', label: 'Raft', hint: 'Leader-based consensus' },
61
25
  { value: 'gossip', label: 'Gossip', hint: 'Eventually consistent, scalable' },
@@ -66,10 +30,9 @@ var CONSENSUS_STRATEGIES = [
66
30
  * Group workers by their type for prompt generation
67
31
  */
68
32
  function groupWorkersByType(workers) {
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';
33
+ const groups = {};
34
+ for (const worker of workers) {
35
+ const type = worker.type || worker.role || 'worker';
73
36
  if (!groups[type]) {
74
37
  groups[type] = [];
75
38
  }
@@ -82,187 +45,267 @@ function groupWorkersByType(workers) {
82
45
  * Ported from v2.7.47 with enhancements for v3
83
46
  */
84
47
  function generateHiveMindPrompt(swarmId, swarmName, objective, workers, workerGroups, flags) {
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";
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__ruflo__hive-mind_consensus - Democratic decision making
75
+ mcp__ruflo__hive-mind_memory - Share knowledge across the hive
76
+ mcp__ruflo__hive-mind_broadcast - Broadcast to all workers
77
+ mcp__ruflo__neural_patterns - Neural pattern recognition
78
+
79
+ 2️⃣ **QUEEN COORDINATION**
80
+ mcp__ruflo__hive-mind_status - Monitor swarm health
81
+ mcp__ruflo__task_create - Create and delegate tasks
82
+ mcp__ruflo__coordination_orchestrate - Orchestrate task distribution
83
+ mcp__ruflo__agent_spawn - Spawn additional workers
84
+
85
+ 3️⃣ **WORKER MANAGEMENT**
86
+ mcp__ruflo__agent_list - List all active agents
87
+ mcp__ruflo__agent_status - Check agent status
88
+ mcp__ruflo__agent_health - Check worker health
89
+ mcp__ruflo__hive-mind_join - Add agent to hive
90
+ mcp__ruflo__hive-mind_leave - Remove agent from hive
91
+
92
+ 4️⃣ **TASK ORCHESTRATION**
93
+ mcp__ruflo__task_assign - Assign tasks to workers
94
+ mcp__ruflo__task_status - Track task progress
95
+ mcp__ruflo__task_complete - Mark tasks complete
96
+ mcp__ruflo__workflow_create - Create workflows
97
+
98
+ 5️⃣ **MEMORY & LEARNING**
99
+ mcp__ruflo__memory_store - Store collective knowledge
100
+ mcp__ruflo__memory_retrieve - Access shared memory
101
+ mcp__ruflo__memory_search - Search memory patterns
102
+ mcp__ruflo__neural_train - Learn from experiences
103
+ mcp__ruflo__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__ruflo__hive-mind_broadcast for swarm-wide announcements
136
+ • Check worker status regularly with mcp__ruflo__hive-mind_status
137
+ • Store important decisions in shared memory for persistence
138
+ • Use consensus for any decisions affecting multiple workers
139
+ • Use mcp__ruflo__task_assign to assign tasks to workers, then mcp__ruflo__task_complete when done
140
+
141
+ 🚀 BEGIN HIVE MIND COORDINATION NOW!
142
+ Start by checking the current hive status and then proceed with the objective.
143
+ `;
91
144
  }
92
145
  /**
93
146
  * Spawn Claude Code with Hive Mind coordination instructions
94
147
  * Ported from v2.7.47 spawnClaudeCodeInstances function
95
148
  */
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:
102
- output.writeln();
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
114
- output.writeln();
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();
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 Claude-Flow 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) {
134
248
  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();
249
+ output.printSuccess('Claude Code completed successfully');
250
+ }
251
+ else if (code !== null) {
251
252
  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
- });
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
+ }
263
306
  }
264
307
  // Init subcommand
265
- var initCommand = {
308
+ const initCommand = {
266
309
  name: 'init',
267
310
  description: 'Initialize a hive mind',
268
311
  options: [
@@ -271,124 +314,107 @@ var initCommand = {
271
314
  short: 't',
272
315
  description: 'Hive topology',
273
316
  type: 'string',
274
- choices: TOPOLOGIES.map(function (t) { return t.value; }),
275
- "default": 'hierarchical-mesh'
317
+ choices: TOPOLOGIES.map(t => t.value),
318
+ default: 'hierarchical-mesh'
276
319
  },
277
320
  {
278
321
  name: 'consensus',
279
322
  short: 'c',
280
323
  description: 'Consensus strategy',
281
324
  type: 'string',
282
- choices: CONSENSUS_STRATEGIES.map(function (s) { return s.value; }),
283
- "default": 'byzantine'
325
+ choices: CONSENSUS_STRATEGIES.map(s => s.value),
326
+ default: 'byzantine'
284
327
  },
285
328
  {
286
329
  name: 'max-agents',
287
330
  short: 'm',
288
331
  description: 'Maximum agents',
289
332
  type: 'number',
290
- "default": 15
333
+ default: 15
291
334
  },
292
335
  {
293
336
  name: 'persist',
294
337
  short: 'p',
295
338
  description: 'Enable persistent state',
296
339
  type: 'boolean',
297
- "default": true
340
+ default: true
298
341
  },
299
342
  {
300
343
  name: 'memory-backend',
301
344
  description: 'Memory backend (agentdb, sqlite, hybrid)',
302
345
  type: 'string',
303
- "default": 'hybrid'
346
+ default: 'hybrid'
304
347
  }
305
348
  ],
306
349
  examples: [
307
350
  { command: 'claude-flow hive-mind init -t hierarchical-mesh', description: 'Init hierarchical mesh' },
308
351
  { command: 'claude-flow hive-mind init -c byzantine -m 20', description: 'Init with Byzantine consensus' }
309
352
  ],
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*/];
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 };
386
387
  }
387
- });
388
- }); }
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)}`);
411
+ }
412
+ return { success: false, exitCode: 1 };
413
+ }
414
+ }
389
415
  };
390
416
  // Spawn subcommand - UPDATED with --claude flag
391
- var spawnCommand = {
417
+ const spawnCommand = {
392
418
  name: 'spawn',
393
419
  description: 'Spawn worker agents into the hive (use --claude to launch Claude Code)',
394
420
  options: [
@@ -397,7 +423,7 @@ var spawnCommand = {
397
423
  short: 'n',
398
424
  description: 'Number of workers to spawn',
399
425
  type: 'number',
400
- "default": 1
426
+ default: 1
401
427
  },
402
428
  {
403
429
  name: 'role',
@@ -405,28 +431,28 @@ var spawnCommand = {
405
431
  description: 'Worker role (worker, specialist, scout)',
406
432
  type: 'string',
407
433
  choices: ['worker', 'specialist', 'scout'],
408
- "default": 'worker'
434
+ default: 'worker'
409
435
  },
410
436
  {
411
437
  name: 'type',
412
438
  short: 't',
413
439
  description: 'Agent type',
414
440
  type: 'string',
415
- "default": 'worker'
441
+ default: 'worker'
416
442
  },
417
443
  {
418
444
  name: 'prefix',
419
445
  short: 'p',
420
446
  description: 'Prefix for worker IDs',
421
447
  type: 'string',
422
- "default": 'hive-worker'
448
+ default: 'hive-worker'
423
449
  },
424
450
  // NEW: --claude flag for launching Claude Code
425
451
  {
426
452
  name: 'claude',
427
453
  description: 'Launch Claude Code with hive-mind coordination prompt',
428
454
  type: 'boolean',
429
- "default": false
455
+ default: false
430
456
  },
431
457
  {
432
458
  name: 'objective',
@@ -438,25 +464,25 @@ var spawnCommand = {
438
464
  name: 'dangerously-skip-permissions',
439
465
  description: 'Skip permission prompts in Claude Code (use with caution)',
440
466
  type: 'boolean',
441
- "default": true
467
+ default: true
442
468
  },
443
469
  {
444
470
  name: 'no-auto-permissions',
445
471
  description: 'Disable automatic permission skipping',
446
472
  type: 'boolean',
447
- "default": false
473
+ default: false
448
474
  },
449
475
  {
450
476
  name: 'dry-run',
451
477
  description: 'Show what would be done without launching Claude Code',
452
478
  type: 'boolean',
453
- "default": false
479
+ default: false
454
480
  },
455
481
  {
456
482
  name: 'non-interactive',
457
483
  description: 'Run Claude Code in non-interactive mode',
458
484
  type: 'boolean',
459
- "default": false
485
+ default: false
460
486
  }
461
487
  ],
462
488
  examples: [
@@ -466,116 +492,104 @@ var spawnCommand = {
466
492
  { command: 'claude-flow hive-mind spawn --claude -o "Build a REST API"', description: 'Launch Claude Code with objective' },
467
493
  { command: 'claude-flow hive-mind spawn -n 5 --claude -o "Research AI patterns"', description: 'Spawn workers and launch Claude Code' }
468
494
  ],
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
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'
516
547
  });
548
+ }
549
+ if (!objective) {
517
550
  output.writeln();
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();
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 });
543
559
  swarmId = statusResult.hiveId || swarmId;
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*/];
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)}`);
573
586
  }
574
- });
575
- }); }
587
+ return { success: false, exitCode: 1 };
588
+ }
589
+ }
576
590
  };
577
591
  // Status subcommand
578
- var statusCommand = {
592
+ const statusCommand = {
579
593
  name: 'status',
580
594
  description: 'Show hive mind status',
581
595
  options: [
@@ -584,135 +598,125 @@ var statusCommand = {
584
598
  short: 'd',
585
599
  description: 'Show detailed metrics',
586
600
  type: 'boolean',
587
- "default": false
601
+ default: false
588
602
  },
589
603
  {
590
604
  name: 'watch',
591
605
  short: 'w',
592
606
  description: 'Watch for changes',
593
607
  type: 'boolean',
594
- "default": false
608
+ default: false
595
609
  }
596
610
  ],
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*/];
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)}`);
710
713
  }
711
- });
712
- }); }
714
+ return { success: false, exitCode: 1 };
715
+ }
716
+ }
713
717
  };
714
718
  // Task subcommand
715
- var taskCommand = {
719
+ const taskCommand = {
716
720
  name: 'task',
717
721
  description: 'Submit tasks to the hive',
718
722
  options: [
@@ -728,93 +732,80 @@ var taskCommand = {
728
732
  description: 'Task priority',
729
733
  type: 'string',
730
734
  choices: ['low', 'normal', 'high', 'critical'],
731
- "default": 'normal'
735
+ default: 'normal'
732
736
  },
733
737
  {
734
738
  name: 'require-consensus',
735
739
  short: 'c',
736
740
  description: 'Require consensus for completion',
737
741
  type: 'boolean',
738
- "default": false
742
+ default: false
739
743
  },
740
744
  {
741
745
  name: 'timeout',
742
746
  description: 'Task timeout in seconds',
743
747
  type: 'number',
744
- "default": 300
748
+ default: 300
745
749
  }
746
750
  ],
747
751
  examples: [
748
752
  { command: 'claude-flow hive-mind task -d "Implement auth module"', description: 'Submit task' },
749
753
  { command: 'claude-flow hive-mind task -d "Security review" -p critical -c', description: 'Critical task with consensus' }
750
754
  ],
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*/];
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 };
812
781
  }
813
- });
814
- }); }
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)}`);
802
+ }
803
+ return { success: false, exitCode: 1 };
804
+ }
805
+ }
815
806
  };
816
807
  // Optimize memory subcommand
817
- var optimizeMemoryCommand = {
808
+ const optimizeMemoryCommand = {
818
809
  name: 'optimize-memory',
819
810
  description: 'Optimize hive memory and patterns',
820
811
  options: [
@@ -823,305 +814,245 @@ var optimizeMemoryCommand = {
823
814
  short: 'a',
824
815
  description: 'Aggressive optimization',
825
816
  type: 'boolean',
826
- "default": false
817
+ default: false
827
818
  },
828
819
  {
829
820
  name: 'threshold',
830
821
  description: 'Quality threshold for pattern retention',
831
822
  type: 'number',
832
- "default": 0.7
823
+ default: 0.7
833
824
  }
834
825
  ],
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*/];
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)}`);
889
869
  }
890
- });
891
- }); }
870
+ return { success: false, exitCode: 1 };
871
+ }
872
+ }
892
873
  };
893
874
  // Join subcommand
894
- var joinCommand = {
875
+ const joinCommand = {
895
876
  name: 'join',
896
877
  description: 'Join an agent to the hive mind',
897
878
  options: [
898
879
  { name: 'agent-id', short: 'a', description: 'Agent ID to join', type: 'string' },
899
- { name: 'role', short: 'r', description: 'Agent role (worker, specialist, scout)', type: 'string', "default": 'worker' }
880
+ { name: 'role', short: 'r', description: 'Agent role (worker, specialist, scout)', type: 'string', default: 'worker' }
900
881
  ],
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*/];
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 };
928
893
  }
929
- });
930
- }); }
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
+ }
931
902
  };
932
903
  // Leave subcommand
933
- var leaveCommand = {
904
+ const leaveCommand = {
934
905
  name: 'leave',
935
906
  description: 'Remove an agent from the hive mind',
936
907
  options: [{ name: 'agent-id', short: 'a', description: 'Agent ID to remove', type: 'string' }],
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*/];
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 };
964
919
  }
965
- });
966
- }); }
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
+ }
967
928
  };
968
929
  // Consensus subcommand
969
- var consensusCommand = {
930
+ const consensusCommand = {
970
931
  name: 'consensus',
971
932
  description: 'Manage consensus proposals and voting',
972
933
  options: [
973
- { name: 'action', short: 'a', description: 'Consensus action', type: 'string', choices: ['propose', 'vote', 'status', 'list'], "default": 'list' },
934
+ { name: 'action', short: 'a', description: 'Consensus action', type: 'string', choices: ['propose', 'vote', 'status', 'list'], default: 'list' },
974
935
  { name: 'proposal-id', short: 'p', description: 'Proposal ID', type: 'string' },
975
936
  { name: 'type', short: 't', description: 'Proposal type', type: 'string' },
976
937
  { name: 'value', description: 'Proposal value', type: 'string' },
977
938
  { name: 'vote', short: 'v', description: 'Vote (yes/no)', type: 'string' },
978
939
  { name: 'voter-id', description: 'Voter agent ID', type: 'string' }
979
940
  ],
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*/];
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}`);
1016
959
  }
1017
- });
1018
- }); }
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
+ }
1019
970
  };
1020
971
  // Broadcast subcommand
1021
- var broadcastCommand = {
972
+ const broadcastCommand = {
1022
973
  name: 'broadcast',
1023
974
  description: 'Broadcast a message to all workers in the hive',
1024
975
  options: [
1025
976
  { name: 'message', short: 'm', description: 'Message to broadcast', type: 'string', required: true },
1026
- { name: 'priority', short: 'p', description: 'Message priority', type: 'string', choices: ['low', 'normal', 'high', 'critical'], "default": 'normal' },
977
+ { name: 'priority', short: 'p', description: 'Message priority', type: 'string', choices: ['low', 'normal', 'high', 'critical'], default: 'normal' },
1027
978
  { name: 'from', short: 'f', description: 'Sender agent ID', type: 'string' }
1028
979
  ],
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*/];
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 };
1056
991
  }
1057
- });
1058
- }); }
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
+ }
1059
1000
  };
1060
1001
  // Memory subcommand
1061
- var memorySubCommand = {
1002
+ const memorySubCommand = {
1062
1003
  name: 'memory',
1063
1004
  description: 'Access hive shared memory',
1064
1005
  options: [
1065
- { name: 'action', short: 'a', description: 'Memory action', type: 'string', choices: ['get', 'set', 'delete', 'list'], "default": 'list' },
1006
+ { name: 'action', short: 'a', description: 'Memory action', type: 'string', choices: ['get', 'set', 'delete', 'list'], default: 'list' },
1066
1007
  { name: 'key', short: 'k', description: 'Memory key', type: 'string' },
1067
1008
  { name: 'value', short: 'v', description: 'Value to store', type: 'string' }
1068
1009
  ],
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*/];
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`);
1119
1042
  }
1120
- });
1121
- }); }
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
+ }
1122
1053
  };
1123
1054
  // Shutdown subcommand
1124
- var shutdownCommand = {
1055
+ const shutdownCommand = {
1125
1056
  name: 'shutdown',
1126
1057
  description: 'Shutdown the hive mind',
1127
1058
  options: [
@@ -1130,73 +1061,60 @@ var shutdownCommand = {
1130
1061
  short: 'f',
1131
1062
  description: 'Force shutdown',
1132
1063
  type: 'boolean',
1133
- "default": false
1064
+ default: false
1134
1065
  },
1135
1066
  {
1136
1067
  name: 'save-state',
1137
1068
  short: 's',
1138
1069
  description: 'Save state before shutdown',
1139
1070
  type: 'boolean',
1140
- "default": true
1071
+ default: true
1141
1072
  }
1142
1073
  ],
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*/];
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 };
1194
1085
  }
1195
- });
1196
- }); }
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)}`);
1111
+ }
1112
+ return { success: false, exitCode: 1 };
1113
+ }
1114
+ }
1197
1115
  };
1198
1116
  // Main hive-mind command
1199
- export var hiveMindCommand = {
1117
+ export const hiveMindCommand = {
1200
1118
  name: 'hive-mind',
1201
1119
  aliases: ['hive'],
1202
1120
  description: 'Queen-led consensus-based multi-agent coordination',
@@ -1208,48 +1126,46 @@ export var hiveMindCommand = {
1208
1126
  { command: 'claude-flow hive-mind spawn --claude -o "Build a feature"', description: 'Launch Claude Code with hive mind' },
1209
1127
  { command: 'claude-flow hive-mind task -d "Build feature"', description: 'Submit task' }
1210
1128
  ],
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
- }); }
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
+ }
1249
1165
  };
1250
1166
  // Helper functions
1251
1167
  function formatAgentStatus(status) {
1252
- var statusStr = String(status);
1168
+ const statusStr = String(status);
1253
1169
  switch (statusStr) {
1254
1170
  case 'active':
1255
1171
  case 'ready':