kynjal-cli 3.1.3 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (566) hide show
  1. package/.claude/agents/core/coder.md +1 -1
  2. package/.claude/agents/core/planner.md +2 -2
  3. package/.claude/agents/core/researcher.md +1 -1
  4. package/.claude/agents/core/reviewer.md +1 -1
  5. package/.claude/agents/core/tester.md +1 -1
  6. package/.claude/agents/data/data-ml-model.md +4 -4
  7. package/.claude/agents/development/dev-backend-api.md +4 -4
  8. package/.claude/agents/documentation/docs-api-openapi.md +4 -4
  9. package/.claude/agents/github/code-review-swarm.md +2 -2
  10. package/.claude/agents/github/issue-tracker.md +2 -2
  11. package/.claude/agents/github/pr-manager.md +2 -2
  12. package/.claude/agents/github/release-manager.md +2 -2
  13. package/.claude/agents/github/workflow-automation.md +2 -2
  14. package/.claude/agents/sparc/architecture.md +3 -3
  15. package/.claude/agents/sparc/pseudocode.md +2 -2
  16. package/.claude/agents/sparc/refinement.md +3 -3
  17. package/.claude/agents/sparc/specification.md +2 -2
  18. package/.claude/agents/swarm/adaptive-coordinator.md +1 -1
  19. package/.claude/agents/swarm/hierarchical-coordinator.md +1 -1
  20. package/.claude/agents/swarm/mesh-coordinator.md +1 -1
  21. package/.claude/agents/templates/base-template-generator.md +25 -4
  22. package/.claude/agents/templates/sparc-coordinator.md +3 -3
  23. package/.claude/helpers/auto-commit.sh +1 -1
  24. package/.claude/helpers/auto-memory-hook.mjs +27 -9
  25. package/.claude/helpers/hook-handler.cjs +58 -18
  26. package/.claude/helpers/statusline.cjs +14 -33
  27. package/.claude/helpers/statusline.js +3 -3
  28. package/.claude/settings.json +9 -9
  29. package/.claude/skills/reasoningbank-intelligence/SKILL.md +2 -2
  30. package/.claude/skills/swarm-orchestration/SKILL.md +1 -1
  31. package/README.md +383 -170
  32. package/bin/cli.js +6 -6
  33. package/bin/mcp-server.js +1 -1
  34. package/bin/preinstall.cjs +2 -0
  35. package/dist/src/appliance/gguf-engine.js +664 -0
  36. package/dist/src/appliance/gguf-engine.js.map +1 -0
  37. package/dist/src/appliance/ruvllm-bridge.js +492 -0
  38. package/dist/src/appliance/ruvllm-bridge.js.map +1 -0
  39. package/dist/src/appliance/rvfa-builder.js +383 -0
  40. package/dist/src/appliance/rvfa-builder.js.map +1 -0
  41. package/dist/src/appliance/rvfa-distribution.js +533 -0
  42. package/dist/src/appliance/rvfa-distribution.js.map +1 -0
  43. package/dist/src/appliance/rvfa-format.js +465 -0
  44. package/dist/src/appliance/rvfa-format.js.map +1 -0
  45. package/dist/src/appliance/rvfa-runner.js +373 -0
  46. package/dist/src/appliance/rvfa-runner.js.map +1 -0
  47. package/dist/src/appliance/rvfa-signing.js +469 -0
  48. package/dist/src/appliance/rvfa-signing.js.map +1 -0
  49. package/dist/src/benchmarks/pretrain/index.js +542 -331
  50. package/dist/src/benchmarks/pretrain/index.js.map +1 -1
  51. package/dist/src/commands/agent.d.ts.map +1 -1
  52. package/dist/src/commands/agent.js +725 -502
  53. package/dist/src/commands/agent.js.map +1 -1
  54. package/dist/src/commands/analyze.js +1548 -1218
  55. package/dist/src/commands/analyze.js.map +1 -1
  56. package/dist/src/commands/appliance-advanced.d.ts +9 -0
  57. package/dist/src/commands/appliance-advanced.d.ts.map +1 -0
  58. package/dist/src/commands/appliance-advanced.js +324 -0
  59. package/dist/src/commands/appliance-advanced.js.map +1 -0
  60. package/dist/src/commands/appliance.d.ts +8 -0
  61. package/dist/src/commands/appliance.d.ts.map +1 -0
  62. package/dist/src/commands/appliance.js +581 -0
  63. package/dist/src/commands/appliance.js.map +1 -0
  64. package/dist/src/commands/benchmark.js +523 -372
  65. package/dist/src/commands/benchmark.js.map +1 -1
  66. package/dist/src/commands/claims.js +364 -274
  67. package/dist/src/commands/claims.js.map +1 -1
  68. package/dist/src/commands/cleanup.d.ts +13 -0
  69. package/dist/src/commands/cleanup.d.ts.map +1 -0
  70. package/dist/src/commands/cleanup.js +262 -0
  71. package/dist/src/commands/cleanup.js.map +1 -0
  72. package/dist/src/commands/completions.js +118 -477
  73. package/dist/src/commands/completions.js.map +1 -1
  74. package/dist/src/commands/config.js +303 -237
  75. package/dist/src/commands/config.js.map +1 -1
  76. package/dist/src/commands/daemon.d.ts.map +1 -1
  77. package/dist/src/commands/daemon.js +597 -425
  78. package/dist/src/commands/daemon.js.map +1 -1
  79. package/dist/src/commands/deployment.js +275 -194
  80. package/dist/src/commands/deployment.js.map +1 -1
  81. package/dist/src/commands/doctor.d.ts.map +1 -1
  82. package/dist/src/commands/doctor.js +690 -460
  83. package/dist/src/commands/doctor.js.map +1 -1
  84. package/dist/src/commands/embeddings.js +1543 -1293
  85. package/dist/src/commands/embeddings.js.map +1 -1
  86. package/dist/src/commands/guidance.js +596 -449
  87. package/dist/src/commands/guidance.js.map +1 -1
  88. package/dist/src/commands/hive-mind.js +938 -854
  89. package/dist/src/commands/hive-mind.js.map +1 -1
  90. package/dist/src/commands/hooks.d.ts.map +1 -1
  91. package/dist/src/commands/hooks.js +3677 -2570
  92. package/dist/src/commands/hooks.js.map +1 -1
  93. package/dist/src/commands/index.js +322 -122
  94. package/dist/src/commands/index.js.map +1 -1
  95. package/dist/src/commands/init.d.ts +1 -1
  96. package/dist/src/commands/init.d.ts.map +1 -1
  97. package/dist/src/commands/init.js +943 -787
  98. package/dist/src/commands/init.js.map +1 -1
  99. package/dist/src/commands/issues.js +558 -383
  100. package/dist/src/commands/issues.js.map +1 -1
  101. package/dist/src/commands/mcp.d.ts.map +1 -1
  102. package/dist/src/commands/mcp.js +605 -475
  103. package/dist/src/commands/mcp.js.map +1 -1
  104. package/dist/src/commands/memory.d.ts.map +1 -1
  105. package/dist/src/commands/memory.js +1031 -814
  106. package/dist/src/commands/memory.js.map +1 -1
  107. package/dist/src/commands/migrate.js +347 -282
  108. package/dist/src/commands/migrate.js.map +1 -1
  109. package/dist/src/commands/neural.d.ts.map +1 -1
  110. package/dist/src/commands/neural.js +1563 -1283
  111. package/dist/src/commands/neural.js.map +1 -1
  112. package/dist/src/commands/performance.js +643 -497
  113. package/dist/src/commands/performance.js.map +1 -1
  114. package/dist/src/commands/plugins.js +841 -668
  115. package/dist/src/commands/plugins.js.map +1 -1
  116. package/dist/src/commands/process.js +447 -392
  117. package/dist/src/commands/process.js.map +1 -1
  118. package/dist/src/commands/progress.js +256 -162
  119. package/dist/src/commands/progress.js.map +1 -1
  120. package/dist/src/commands/providers.js +220 -150
  121. package/dist/src/commands/providers.js.map +1 -1
  122. package/dist/src/commands/route.js +665 -520
  123. package/dist/src/commands/route.js.map +1 -1
  124. package/dist/src/commands/ruvector/backup.js +651 -505
  125. package/dist/src/commands/ruvector/backup.js.map +1 -1
  126. package/dist/src/commands/ruvector/benchmark.js +401 -349
  127. package/dist/src/commands/ruvector/benchmark.js.map +1 -1
  128. package/dist/src/commands/ruvector/import.js +267 -225
  129. package/dist/src/commands/ruvector/import.js.map +1 -1
  130. package/dist/src/commands/ruvector/index.js +75 -37
  131. package/dist/src/commands/ruvector/index.js.map +1 -1
  132. package/dist/src/commands/ruvector/init.js +359 -336
  133. package/dist/src/commands/ruvector/init.js.map +1 -1
  134. package/dist/src/commands/ruvector/migrate.js +322 -335
  135. package/dist/src/commands/ruvector/migrate.js.map +1 -1
  136. package/dist/src/commands/ruvector/optimize.js +431 -375
  137. package/dist/src/commands/ruvector/optimize.js.map +1 -1
  138. package/dist/src/commands/ruvector/setup.js +117 -703
  139. package/dist/src/commands/ruvector/setup.js.map +1 -1
  140. package/dist/src/commands/ruvector/status.js +419 -364
  141. package/dist/src/commands/ruvector/status.js.map +1 -1
  142. package/dist/src/commands/security.d.ts.map +1 -1
  143. package/dist/src/commands/security.js +610 -456
  144. package/dist/src/commands/security.js.map +1 -1
  145. package/dist/src/commands/session.d.ts +1 -1
  146. package/dist/src/commands/session.js +627 -505
  147. package/dist/src/commands/session.js.map +1 -1
  148. package/dist/src/commands/start.d.ts +1 -1
  149. package/dist/src/commands/start.js +368 -271
  150. package/dist/src/commands/start.js.map +1 -1
  151. package/dist/src/commands/status.d.ts +1 -1
  152. package/dist/src/commands/status.d.ts.map +1 -1
  153. package/dist/src/commands/status.js +492 -379
  154. package/dist/src/commands/status.js.map +1 -1
  155. package/dist/src/commands/swarm.js +488 -408
  156. package/dist/src/commands/swarm.js.map +1 -1
  157. package/dist/src/commands/task.d.ts +1 -1
  158. package/dist/src/commands/task.js +539 -424
  159. package/dist/src/commands/task.js.map +1 -1
  160. package/dist/src/commands/transfer-store.js +412 -322
  161. package/dist/src/commands/transfer-store.js.map +1 -1
  162. package/dist/src/commands/update.js +291 -196
  163. package/dist/src/commands/update.js.map +1 -1
  164. package/dist/src/commands/workflow.js +486 -386
  165. package/dist/src/commands/workflow.js.map +1 -1
  166. package/dist/src/config-adapter.js +40 -39
  167. package/dist/src/config-adapter.js.map +1 -1
  168. package/dist/src/index.js +416 -312
  169. package/dist/src/index.js.map +1 -1
  170. package/dist/src/infrastructure/in-memory-repositories.js +507 -246
  171. package/dist/src/infrastructure/in-memory-repositories.js.map +1 -1
  172. package/dist/src/init/claudemd-generator.js +78 -368
  173. package/dist/src/init/claudemd-generator.js.map +1 -1
  174. package/dist/src/init/executor.js +1019 -1345
  175. package/dist/src/init/executor.js.map +1 -1
  176. package/dist/src/init/helpers-generator.js +60 -635
  177. package/dist/src/init/helpers-generator.js.map +1 -1
  178. package/dist/src/init/index.d.ts +1 -1
  179. package/dist/src/init/index.d.ts.map +1 -1
  180. package/dist/src/init/index.js +1 -1
  181. package/dist/src/init/index.js.map +1 -1
  182. package/dist/src/init/mcp-generator.d.ts +0 -1
  183. package/dist/src/init/mcp-generator.d.ts.map +1 -1
  184. package/dist/src/init/mcp-generator.js +62 -42
  185. package/dist/src/init/mcp-generator.js.map +1 -1
  186. package/dist/src/init/settings-generator.d.ts.map +1 -1
  187. package/dist/src/init/settings-generator.js +167 -100
  188. package/dist/src/init/settings-generator.js.map +1 -1
  189. package/dist/src/init/statusline-generator.d.ts +16 -8
  190. package/dist/src/init/statusline-generator.d.ts.map +1 -1
  191. package/dist/src/init/statusline-generator.js +20 -1300
  192. package/dist/src/init/statusline-generator.js.map +1 -1
  193. package/dist/src/init/types.d.ts +15 -5
  194. package/dist/src/init/types.d.ts.map +1 -1
  195. package/dist/src/init/types.js +66 -76
  196. package/dist/src/init/types.js.map +1 -1
  197. package/dist/src/mcp-client.js +130 -76
  198. package/dist/src/mcp-client.js.map +1 -1
  199. package/dist/src/mcp-server.js +758 -445
  200. package/dist/src/mcp-server.js.map +1 -1
  201. package/dist/src/mcp-tools/agent-tools.js +492 -391
  202. package/dist/src/mcp-tools/agent-tools.js.map +1 -1
  203. package/dist/src/mcp-tools/agentdb-tools.d.ts +30 -0
  204. package/dist/src/mcp-tools/agentdb-tools.d.ts.map +1 -0
  205. package/dist/src/mcp-tools/agentdb-tools.js +758 -0
  206. package/dist/src/mcp-tools/agentdb-tools.js.map +1 -0
  207. package/dist/src/mcp-tools/analyze-tools.js +236 -172
  208. package/dist/src/mcp-tools/analyze-tools.js.map +1 -1
  209. package/dist/src/mcp-tools/auto-install.js +142 -80
  210. package/dist/src/mcp-tools/auto-install.js.map +1 -1
  211. package/dist/src/mcp-tools/browser-tools.js +375 -252
  212. package/dist/src/mcp-tools/browser-tools.js.map +1 -1
  213. package/dist/src/mcp-tools/claims-tools.js +565 -473
  214. package/dist/src/mcp-tools/claims-tools.js.map +1 -1
  215. package/dist/src/mcp-tools/config-tools.d.ts.map +1 -1
  216. package/dist/src/mcp-tools/config-tools.js +284 -190
  217. package/dist/src/mcp-tools/config-tools.js.map +1 -1
  218. package/dist/src/mcp-tools/coordination-tools.d.ts.map +1 -1
  219. package/dist/src/mcp-tools/coordination-tools.js +600 -349
  220. package/dist/src/mcp-tools/coordination-tools.js.map +1 -1
  221. package/dist/src/mcp-tools/daa-tools.js +367 -289
  222. package/dist/src/mcp-tools/daa-tools.js.map +1 -1
  223. package/dist/src/mcp-tools/embeddings-tools.js +693 -582
  224. package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
  225. package/dist/src/mcp-tools/github-tools.js +312 -261
  226. package/dist/src/mcp-tools/github-tools.js.map +1 -1
  227. package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -1
  228. package/dist/src/mcp-tools/hive-mind-tools.js +718 -423
  229. package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
  230. package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
  231. package/dist/src/mcp-tools/hooks-tools.js +2726 -1978
  232. package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
  233. package/dist/src/mcp-tools/index.d.ts +2 -0
  234. package/dist/src/mcp-tools/index.d.ts.map +1 -1
  235. package/dist/src/mcp-tools/index.js +2 -0
  236. package/dist/src/mcp-tools/index.js.map +1 -1
  237. package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -1
  238. package/dist/src/mcp-tools/memory-tools.js +514 -329
  239. package/dist/src/mcp-tools/memory-tools.js.map +1 -1
  240. package/dist/src/mcp-tools/neural-tools.d.ts.map +1 -1
  241. package/dist/src/mcp-tools/neural-tools.js +428 -326
  242. package/dist/src/mcp-tools/neural-tools.js.map +1 -1
  243. package/dist/src/mcp-tools/performance-tools.js +480 -420
  244. package/dist/src/mcp-tools/performance-tools.js.map +1 -1
  245. package/dist/src/mcp-tools/progress-tools.js +278 -204
  246. package/dist/src/mcp-tools/progress-tools.js.map +1 -1
  247. package/dist/src/mcp-tools/ruvllm-tools.d.ts +9 -0
  248. package/dist/src/mcp-tools/ruvllm-tools.d.ts.map +1 -0
  249. package/dist/src/mcp-tools/ruvllm-tools.js +399 -0
  250. package/dist/src/mcp-tools/ruvllm-tools.js.map +1 -0
  251. package/dist/src/mcp-tools/security-tools.js +429 -297
  252. package/dist/src/mcp-tools/security-tools.js.map +1 -1
  253. package/dist/src/mcp-tools/session-tools.js +234 -185
  254. package/dist/src/mcp-tools/session-tools.js.map +1 -1
  255. package/dist/src/mcp-tools/swarm-tools.d.ts +2 -1
  256. package/dist/src/mcp-tools/swarm-tools.d.ts.map +1 -1
  257. package/dist/src/mcp-tools/swarm-tools.js +303 -64
  258. package/dist/src/mcp-tools/swarm-tools.js.map +1 -1
  259. package/dist/src/mcp-tools/system-tools.d.ts.map +1 -1
  260. package/dist/src/mcp-tools/system-tools.js +352 -200
  261. package/dist/src/mcp-tools/system-tools.js.map +1 -1
  262. package/dist/src/mcp-tools/task-tools.d.ts.map +1 -1
  263. package/dist/src/mcp-tools/task-tools.js +357 -189
  264. package/dist/src/mcp-tools/task-tools.js.map +1 -1
  265. package/dist/src/mcp-tools/terminal-tools.js +196 -148
  266. package/dist/src/mcp-tools/terminal-tools.js.map +1 -1
  267. package/dist/src/mcp-tools/transfer-tools.js +333 -186
  268. package/dist/src/mcp-tools/transfer-tools.js.map +1 -1
  269. package/dist/src/mcp-tools/wasm-agent-tools.d.ts +9 -0
  270. package/dist/src/mcp-tools/wasm-agent-tools.d.ts.map +1 -0
  271. package/dist/src/mcp-tools/wasm-agent-tools.js +377 -0
  272. package/dist/src/mcp-tools/wasm-agent-tools.js.map +1 -0
  273. package/dist/src/mcp-tools/workflow-tools.d.ts.map +1 -1
  274. package/dist/src/mcp-tools/workflow-tools.js +471 -335
  275. package/dist/src/mcp-tools/workflow-tools.js.map +1 -1
  276. package/dist/src/memory/ewc-consolidation.js +345 -173
  277. package/dist/src/memory/ewc-consolidation.js.map +1 -1
  278. package/dist/src/memory/intelligence.js +841 -359
  279. package/dist/src/memory/intelligence.js.map +1 -1
  280. package/dist/src/memory/memory-bridge.js +1964 -0
  281. package/dist/src/memory/memory-bridge.js.map +1 -0
  282. package/dist/src/memory/memory-initializer.js +1895 -1602
  283. package/dist/src/memory/memory-initializer.js.map +1 -1
  284. package/dist/src/memory/sona-optimizer.js +329 -199
  285. package/dist/src/memory/sona-optimizer.js.map +1 -1
  286. package/dist/src/output.d.ts +2 -2
  287. package/dist/src/output.d.ts.map +1 -1
  288. package/dist/src/output.js +273 -242
  289. package/dist/src/output.js.map +1 -1
  290. package/dist/src/parser.js +217 -124
  291. package/dist/src/parser.js.map +1 -1
  292. package/dist/src/plugins/manager.js +531 -278
  293. package/dist/src/plugins/manager.js.map +1 -1
  294. package/dist/src/plugins/store/discovery.js +362 -275
  295. package/dist/src/plugins/store/discovery.js.map +1 -1
  296. package/dist/src/plugins/store/index.js +105 -48
  297. package/dist/src/plugins/store/index.js.map +1 -1
  298. package/dist/src/plugins/store/search.js +107 -69
  299. package/dist/src/plugins/store/search.js.map +1 -1
  300. package/dist/src/plugins/tests/demo-plugin-store.js +160 -113
  301. package/dist/src/plugins/tests/demo-plugin-store.js.map +1 -1
  302. package/dist/src/plugins/tests/standalone-test.js +223 -172
  303. package/dist/src/plugins/tests/standalone-test.js.map +1 -1
  304. package/dist/src/plugins/tests/test-plugin-store.js +228 -190
  305. package/dist/src/plugins/tests/test-plugin-store.js.map +1 -1
  306. package/dist/src/production/circuit-breaker.js +126 -62
  307. package/dist/src/production/circuit-breaker.js.map +1 -1
  308. package/dist/src/production/error-handler.js +156 -86
  309. package/dist/src/production/error-handler.js.map +1 -1
  310. package/dist/src/production/monitoring.js +220 -139
  311. package/dist/src/production/monitoring.js.map +1 -1
  312. package/dist/src/production/rate-limiter.js +93 -74
  313. package/dist/src/production/rate-limiter.js.map +1 -1
  314. package/dist/src/production/retry.js +167 -75
  315. package/dist/src/production/retry.js.map +1 -1
  316. package/dist/src/prompt.js +560 -436
  317. package/dist/src/prompt.js.map +1 -1
  318. package/dist/src/runtime/headless.js +289 -200
  319. package/dist/src/runtime/headless.js.map +1 -1
  320. package/dist/src/ruvector/agent-wasm.js +511 -0
  321. package/dist/src/ruvector/agent-wasm.js.map +1 -0
  322. package/dist/src/ruvector/ast-analyzer.js +232 -145
  323. package/dist/src/ruvector/ast-analyzer.js.map +1 -1
  324. package/dist/src/ruvector/coverage-router.js +419 -287
  325. package/dist/src/ruvector/coverage-router.js.map +1 -1
  326. package/dist/src/ruvector/coverage-tools.js +101 -56
  327. package/dist/src/ruvector/coverage-tools.js.map +1 -1
  328. package/dist/src/ruvector/diff-classifier.js +451 -324
  329. package/dist/src/ruvector/diff-classifier.js.map +1 -1
  330. package/dist/src/ruvector/enhanced-model-router.js +337 -251
  331. package/dist/src/ruvector/enhanced-model-router.js.map +1 -1
  332. package/dist/src/ruvector/flash-attention.js +254 -223
  333. package/dist/src/ruvector/flash-attention.js.map +1 -1
  334. package/dist/src/ruvector/graph-analyzer.js +680 -486
  335. package/dist/src/ruvector/graph-analyzer.js.map +1 -1
  336. package/dist/src/ruvector/index.js +113 -27
  337. package/dist/src/ruvector/index.js.map +1 -1
  338. package/dist/src/ruvector/lora-adapter.js +248 -155
  339. package/dist/src/ruvector/lora-adapter.js.map +1 -1
  340. package/dist/src/ruvector/model-router.js +248 -175
  341. package/dist/src/ruvector/model-router.js.map +1 -1
  342. package/dist/src/ruvector/moe-router.js +286 -228
  343. package/dist/src/ruvector/moe-router.js.map +1 -1
  344. package/dist/src/ruvector/q-learning-router.js +338 -257
  345. package/dist/src/ruvector/q-learning-router.js.map +1 -1
  346. package/dist/src/ruvector/ruvllm-wasm.js +527 -0
  347. package/dist/src/ruvector/ruvllm-wasm.js.map +1 -0
  348. package/dist/src/ruvector/semantic-router.js +67 -60
  349. package/dist/src/ruvector/semantic-router.js.map +1 -1
  350. package/dist/src/ruvector/vector-db.js +205 -119
  351. package/dist/src/ruvector/vector-db.js.map +1 -1
  352. package/dist/src/services/agentic-flow-bridge.js +168 -0
  353. package/dist/src/services/agentic-flow-bridge.js.map +1 -0
  354. package/dist/src/services/claim-service.js +940 -615
  355. package/dist/src/services/claim-service.js.map +1 -1
  356. package/dist/src/services/container-worker-pool.js +669 -399
  357. package/dist/src/services/container-worker-pool.js.map +1 -1
  358. package/dist/src/services/headless-worker-executor.js +467 -441
  359. package/dist/src/services/headless-worker-executor.js.map +1 -1
  360. package/dist/src/services/index.d.ts +5 -5
  361. package/dist/src/services/index.d.ts.map +1 -1
  362. package/dist/src/services/index.js +4 -4
  363. package/dist/src/services/index.js.map +1 -1
  364. package/dist/src/services/registry-api.js +201 -93
  365. package/dist/src/services/registry-api.js.map +1 -1
  366. package/dist/src/services/ruvector-training.js +414 -144
  367. package/dist/src/services/ruvector-training.js.map +1 -1
  368. package/dist/src/services/worker-daemon.js +928 -531
  369. package/dist/src/services/worker-daemon.js.map +1 -1
  370. package/dist/src/services/worker-queue.js +550 -331
  371. package/dist/src/services/worker-queue.js.map +1 -1
  372. package/dist/src/suggest.js +55 -45
  373. package/dist/src/suggest.js.map +1 -1
  374. package/dist/src/transfer/anonymization/index.js +37 -29
  375. package/dist/src/transfer/anonymization/index.js.map +1 -1
  376. package/dist/src/transfer/deploy-seraphine.d.ts +1 -1
  377. package/dist/src/transfer/deploy-seraphine.js +156 -129
  378. package/dist/src/transfer/deploy-seraphine.js.map +1 -1
  379. package/dist/src/transfer/export.js +142 -84
  380. package/dist/src/transfer/export.js.map +1 -1
  381. package/dist/src/transfer/index.d.ts +1 -1
  382. package/dist/src/transfer/index.d.ts.map +1 -1
  383. package/dist/src/transfer/index.js +2 -0
  384. package/dist/src/transfer/index.js.map +1 -1
  385. package/dist/src/transfer/ipfs/client.js +337 -179
  386. package/dist/src/transfer/ipfs/client.js.map +1 -1
  387. package/dist/src/transfer/ipfs/upload.js +434 -290
  388. package/dist/src/transfer/ipfs/upload.js.map +1 -1
  389. package/dist/src/transfer/models/seraphine.js +58 -58
  390. package/dist/src/transfer/models/seraphine.js.map +1 -1
  391. package/dist/src/transfer/serialization/cfp.js +37 -33
  392. package/dist/src/transfer/serialization/cfp.js.map +1 -1
  393. package/dist/src/transfer/storage/gcs.js +248 -139
  394. package/dist/src/transfer/storage/gcs.js.map +1 -1
  395. package/dist/src/transfer/store/discovery.js +353 -243
  396. package/dist/src/transfer/store/discovery.js.map +1 -1
  397. package/dist/src/transfer/store/download.js +365 -243
  398. package/dist/src/transfer/store/download.js.map +1 -1
  399. package/dist/src/transfer/store/index.js +130 -63
  400. package/dist/src/transfer/store/index.js.map +1 -1
  401. package/dist/src/transfer/store/publish.js +258 -184
  402. package/dist/src/transfer/store/publish.js.map +1 -1
  403. package/dist/src/transfer/store/registry.js +73 -51
  404. package/dist/src/transfer/store/registry.js.map +1 -1
  405. package/dist/src/transfer/store/search.js +96 -64
  406. package/dist/src/transfer/store/search.js.map +1 -1
  407. package/dist/src/transfer/store/tests/standalone-test.js +231 -174
  408. package/dist/src/transfer/store/tests/standalone-test.js.map +1 -1
  409. package/dist/src/transfer/test-seraphine.js +130 -95
  410. package/dist/src/transfer/test-seraphine.js.map +1 -1
  411. package/dist/src/transfer/tests/test-store.js +239 -194
  412. package/dist/src/transfer/tests/test-store.js.map +1 -1
  413. package/dist/src/types.js +56 -27
  414. package/dist/src/types.js.map +1 -1
  415. package/dist/src/update/checker.js +183 -106
  416. package/dist/src/update/checker.js.map +1 -1
  417. package/dist/src/update/executor.js +198 -135
  418. package/dist/src/update/executor.js.map +1 -1
  419. package/dist/src/update/index.js +85 -38
  420. package/dist/src/update/index.js.map +1 -1
  421. package/dist/src/update/rate-limiter.js +31 -19
  422. package/dist/src/update/rate-limiter.js.map +1 -1
  423. package/dist/src/update/validator.js +64 -38
  424. package/dist/src/update/validator.js.map +1 -1
  425. package/dist/tsconfig.tsbuildinfo +1 -1
  426. package/package.json +13 -10
  427. package/.claude/agents/custom/accessibility-auditor.yaml +0 -56
  428. package/.claude/agents/custom/design-architect.yaml +0 -48
  429. package/.claude/agents/custom/ui-developer.yaml +0 -46
  430. package/.claude/agents/custom/ux-researcher.yaml +0 -60
  431. package/dist/src/benchmarks/pretrain/index.d.ts +0 -58
  432. package/dist/src/benchmarks/pretrain/index.d.ts.map +0 -1
  433. package/dist/src/commands/index.d.ts +0 -108
  434. package/dist/src/commands/index.d.ts.map +0 -1
  435. package/dist/src/config-adapter.d.ts +0 -15
  436. package/dist/src/config-adapter.d.ts.map +0 -1
  437. package/dist/src/index.d.ts +0 -76
  438. package/dist/src/index.d.ts.map +0 -1
  439. package/dist/src/infrastructure/in-memory-repositories.d.ts +0 -68
  440. package/dist/src/infrastructure/in-memory-repositories.d.ts.map +0 -1
  441. package/dist/src/init/claudemd-generator.d.ts +0 -25
  442. package/dist/src/init/claudemd-generator.d.ts.map +0 -1
  443. package/dist/src/init/executor.d.ts +0 -41
  444. package/dist/src/init/executor.d.ts.map +0 -1
  445. package/dist/src/init/helpers-generator.d.ts +0 -60
  446. package/dist/src/init/helpers-generator.d.ts.map +0 -1
  447. package/dist/src/mcp-client.d.ts +0 -92
  448. package/dist/src/mcp-client.d.ts.map +0 -1
  449. package/dist/src/mcp-server.d.ts +0 -161
  450. package/dist/src/mcp-server.d.ts.map +0 -1
  451. package/dist/src/mcp-tools/auto-install.d.ts +0 -83
  452. package/dist/src/mcp-tools/auto-install.d.ts.map +0 -1
  453. package/dist/src/mcp-tools/types.d.ts +0 -31
  454. package/dist/src/mcp-tools/types.d.ts.map +0 -1
  455. package/dist/src/memory/ewc-consolidation.d.ts +0 -271
  456. package/dist/src/memory/ewc-consolidation.d.ts.map +0 -1
  457. package/dist/src/memory/intelligence.d.ts +0 -285
  458. package/dist/src/memory/intelligence.d.ts.map +0 -1
  459. package/dist/src/memory/memory-initializer.d.ts +0 -396
  460. package/dist/src/memory/memory-initializer.d.ts.map +0 -1
  461. package/dist/src/memory/sona-optimizer.d.ts +0 -227
  462. package/dist/src/memory/sona-optimizer.d.ts.map +0 -1
  463. package/dist/src/parser.d.ts +0 -41
  464. package/dist/src/parser.d.ts.map +0 -1
  465. package/dist/src/plugins/manager.d.ts +0 -133
  466. package/dist/src/plugins/manager.d.ts.map +0 -1
  467. package/dist/src/plugins/store/discovery.d.ts +0 -88
  468. package/dist/src/plugins/store/discovery.d.ts.map +0 -1
  469. package/dist/src/plugins/store/index.d.ts +0 -76
  470. package/dist/src/plugins/store/index.d.ts.map +0 -1
  471. package/dist/src/plugins/store/search.d.ts +0 -46
  472. package/dist/src/plugins/store/search.d.ts.map +0 -1
  473. package/dist/src/plugins/store/types.d.ts +0 -274
  474. package/dist/src/plugins/store/types.d.ts.map +0 -1
  475. package/dist/src/production/circuit-breaker.d.ts +0 -101
  476. package/dist/src/production/circuit-breaker.d.ts.map +0 -1
  477. package/dist/src/production/error-handler.d.ts +0 -92
  478. package/dist/src/production/error-handler.d.ts.map +0 -1
  479. package/dist/src/production/monitoring.d.ts +0 -161
  480. package/dist/src/production/monitoring.d.ts.map +0 -1
  481. package/dist/src/production/rate-limiter.d.ts +0 -80
  482. package/dist/src/production/rate-limiter.d.ts.map +0 -1
  483. package/dist/src/production/retry.d.ts +0 -48
  484. package/dist/src/production/retry.d.ts.map +0 -1
  485. package/dist/src/prompt.d.ts +0 -44
  486. package/dist/src/prompt.d.ts.map +0 -1
  487. package/dist/src/runtime/headless.d.ts +0 -60
  488. package/dist/src/runtime/headless.d.ts.map +0 -1
  489. package/dist/src/ruvector/ast-analyzer.d.ts +0 -67
  490. package/dist/src/ruvector/ast-analyzer.d.ts.map +0 -1
  491. package/dist/src/ruvector/coverage-router.d.ts +0 -160
  492. package/dist/src/ruvector/coverage-router.d.ts.map +0 -1
  493. package/dist/src/ruvector/diff-classifier.d.ts +0 -175
  494. package/dist/src/ruvector/diff-classifier.d.ts.map +0 -1
  495. package/dist/src/ruvector/enhanced-model-router.d.ts +0 -146
  496. package/dist/src/ruvector/enhanced-model-router.d.ts.map +0 -1
  497. package/dist/src/ruvector/flash-attention.d.ts +0 -195
  498. package/dist/src/ruvector/flash-attention.d.ts.map +0 -1
  499. package/dist/src/ruvector/graph-analyzer.d.ts +0 -187
  500. package/dist/src/ruvector/graph-analyzer.d.ts.map +0 -1
  501. package/dist/src/ruvector/index.d.ts +0 -34
  502. package/dist/src/ruvector/index.d.ts.map +0 -1
  503. package/dist/src/ruvector/lora-adapter.d.ts +0 -218
  504. package/dist/src/ruvector/lora-adapter.d.ts.map +0 -1
  505. package/dist/src/ruvector/model-router.d.ts +0 -220
  506. package/dist/src/ruvector/model-router.d.ts.map +0 -1
  507. package/dist/src/ruvector/moe-router.d.ts +0 -206
  508. package/dist/src/ruvector/moe-router.d.ts.map +0 -1
  509. package/dist/src/ruvector/q-learning-router.d.ts +0 -211
  510. package/dist/src/ruvector/q-learning-router.d.ts.map +0 -1
  511. package/dist/src/ruvector/semantic-router.d.ts +0 -77
  512. package/dist/src/ruvector/semantic-router.d.ts.map +0 -1
  513. package/dist/src/ruvector/vector-db.d.ts +0 -69
  514. package/dist/src/ruvector/vector-db.d.ts.map +0 -1
  515. package/dist/src/services/claim-service.d.ts +0 -204
  516. package/dist/src/services/claim-service.d.ts.map +0 -1
  517. package/dist/src/services/container-worker-pool.d.ts +0 -197
  518. package/dist/src/services/container-worker-pool.d.ts.map +0 -1
  519. package/dist/src/services/headless-worker-executor.d.ts +0 -304
  520. package/dist/src/services/headless-worker-executor.d.ts.map +0 -1
  521. package/dist/src/services/registry-api.d.ts +0 -58
  522. package/dist/src/services/registry-api.d.ts.map +0 -1
  523. package/dist/src/services/ruvector-training.d.ts +0 -213
  524. package/dist/src/services/ruvector-training.d.ts.map +0 -1
  525. package/dist/src/services/worker-daemon.d.ts +0 -203
  526. package/dist/src/services/worker-daemon.d.ts.map +0 -1
  527. package/dist/src/services/worker-queue.d.ts +0 -194
  528. package/dist/src/services/worker-queue.d.ts.map +0 -1
  529. package/dist/src/suggest.d.ts +0 -53
  530. package/dist/src/suggest.d.ts.map +0 -1
  531. package/dist/src/transfer/export.d.ts +0 -25
  532. package/dist/src/transfer/export.d.ts.map +0 -1
  533. package/dist/src/transfer/ipfs/client.d.ts +0 -109
  534. package/dist/src/transfer/ipfs/client.d.ts.map +0 -1
  535. package/dist/src/transfer/ipfs/upload.d.ts +0 -95
  536. package/dist/src/transfer/ipfs/upload.d.ts.map +0 -1
  537. package/dist/src/transfer/models/seraphine.d.ts +0 -72
  538. package/dist/src/transfer/models/seraphine.d.ts.map +0 -1
  539. package/dist/src/transfer/serialization/cfp.d.ts +0 -49
  540. package/dist/src/transfer/serialization/cfp.d.ts.map +0 -1
  541. package/dist/src/transfer/storage/gcs.d.ts +0 -82
  542. package/dist/src/transfer/storage/gcs.d.ts.map +0 -1
  543. package/dist/src/transfer/store/discovery.d.ts +0 -84
  544. package/dist/src/transfer/store/discovery.d.ts.map +0 -1
  545. package/dist/src/transfer/store/download.d.ts +0 -70
  546. package/dist/src/transfer/store/download.d.ts.map +0 -1
  547. package/dist/src/transfer/store/index.d.ts +0 -84
  548. package/dist/src/transfer/store/index.d.ts.map +0 -1
  549. package/dist/src/transfer/store/publish.d.ts +0 -76
  550. package/dist/src/transfer/store/publish.d.ts.map +0 -1
  551. package/dist/src/transfer/store/search.d.ts +0 -54
  552. package/dist/src/transfer/store/search.d.ts.map +0 -1
  553. package/dist/src/transfer/types.d.ts +0 -245
  554. package/dist/src/transfer/types.d.ts.map +0 -1
  555. package/dist/src/types.d.ts +0 -198
  556. package/dist/src/types.d.ts.map +0 -1
  557. package/dist/src/update/checker.d.ts +0 -34
  558. package/dist/src/update/checker.d.ts.map +0 -1
  559. package/dist/src/update/executor.d.ts +0 -32
  560. package/dist/src/update/executor.d.ts.map +0 -1
  561. package/dist/src/update/index.d.ts +0 -33
  562. package/dist/src/update/index.d.ts.map +0 -1
  563. package/dist/src/update/rate-limiter.d.ts +0 -20
  564. package/dist/src/update/rate-limiter.d.ts.map +0 -1
  565. package/dist/src/update/validator.d.ts +0 -17
  566. package/dist/src/update/validator.d.ts.map +0 -1
@@ -10,12 +10,48 @@
10
10
  *
11
11
  * Created with love by ruv.io
12
12
  */
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (_) try {
29
+ 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;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
13
49
  import { output } from '../output.js';
14
50
  import { createQLearningRouter, isRuvectorAvailable, } from '../ruvector/index.js';
15
51
  /**
16
52
  * Available agent types for routing
17
53
  */
18
- const AGENT_TYPES = [
54
+ var AGENT_TYPES = [
19
55
  { id: 'coder', name: 'Coder', description: 'Implements features and writes code', capabilities: ['coding', 'implementation', 'refactoring'], priority: 1 },
20
56
  { id: 'tester', name: 'Tester', description: 'Creates tests and validates functionality', capabilities: ['testing', 'validation', 'quality'], priority: 2 },
21
57
  { id: 'reviewer', name: 'Reviewer', description: 'Reviews code quality and security', capabilities: ['review', 'security', 'best-practices'], priority: 3 },
@@ -28,31 +64,40 @@ const AGENT_TYPES = [
28
64
  // ============================================================================
29
65
  // Router Singleton
30
66
  // ============================================================================
31
- let routerInstance = null;
32
- let routerInitialized = false;
67
+ var routerInstance = null;
68
+ var routerInitialized = false;
33
69
  /**
34
70
  * Get or create the router instance
35
71
  */
36
- async function getRouter() {
37
- if (!routerInstance) {
38
- routerInstance = createQLearningRouter();
39
- }
40
- if (!routerInitialized) {
41
- await routerInstance.initialize();
42
- routerInitialized = true;
43
- }
44
- return routerInstance;
72
+ function getRouter() {
73
+ return __awaiter(this, void 0, Promise, function () {
74
+ return __generator(this, function (_a) {
75
+ switch (_a.label) {
76
+ case 0:
77
+ if (!routerInstance) {
78
+ routerInstance = createQLearningRouter();
79
+ }
80
+ if (!!routerInitialized) return [3 /*break*/, 2];
81
+ return [4 /*yield*/, routerInstance.initialize()];
82
+ case 1:
83
+ _a.sent();
84
+ routerInitialized = true;
85
+ _a.label = 2;
86
+ case 2: return [2 /*return*/, routerInstance];
87
+ }
88
+ });
89
+ });
45
90
  }
46
91
  /**
47
92
  * Get agent type by route name
48
93
  */
49
94
  function getAgentType(route) {
50
- return AGENT_TYPES.find(a => a.id === route);
95
+ return AGENT_TYPES.find(function (a) { return a.id === route; });
51
96
  }
52
97
  // ============================================================================
53
98
  // Route Subcommand
54
99
  // ============================================================================
55
- const routeTaskCommand = {
100
+ var routeTaskCommand = {
56
101
  name: 'task',
57
102
  description: 'Route a task to the optimal agent using Q-Learning',
58
103
  options: [
@@ -61,27 +106,27 @@ const routeTaskCommand = {
61
106
  short: 'q',
62
107
  description: 'Use Q-Learning for agent selection (default: true)',
63
108
  type: 'boolean',
64
- default: true,
109
+ "default": true
65
110
  },
66
111
  {
67
112
  name: 'agent',
68
113
  short: 'a',
69
114
  description: 'Force specific agent (bypasses Q-Learning)',
70
- type: 'string',
115
+ type: 'string'
71
116
  },
72
117
  {
73
118
  name: 'explore',
74
119
  short: 'e',
75
120
  description: 'Enable exploration (random selection chance)',
76
121
  type: 'boolean',
77
- default: true,
122
+ "default": true
78
123
  },
79
124
  {
80
125
  name: 'json',
81
126
  short: 'j',
82
127
  description: 'Output in JSON format',
83
128
  type: 'boolean',
84
- default: false,
129
+ "default": false
85
130
  },
86
131
  ],
87
132
  examples: [
@@ -89,123 +134,137 @@ const routeTaskCommand = {
89
134
  { command: 'claude-flow route task "write unit tests" --q-learning', description: 'Use Q-Learning routing' },
90
135
  { command: 'claude-flow route task "review code" --agent reviewer', description: 'Force specific agent' },
91
136
  ],
92
- action: async (ctx) => {
93
- const taskDescription = ctx.args[0];
94
- const forceAgent = ctx.flags.agent;
95
- const useExploration = ctx.flags.explore;
96
- const jsonOutput = ctx.flags.json;
97
- if (!taskDescription) {
98
- output.printError('Task description is required');
99
- output.writeln(output.dim('Usage: claude-flow route task "task description"'));
100
- return { success: false, exitCode: 1 };
101
- }
102
- const spinner = output.createSpinner({ text: 'Analyzing task...', spinner: 'dots' });
103
- spinner.start();
104
- try {
105
- if (forceAgent) {
106
- // Bypass Q-Learning, use specified agent
107
- const agent = getAgentType(forceAgent) ||
108
- AGENT_TYPES.find(a => a.name.toLowerCase() === forceAgent.toLowerCase());
109
- if (!agent) {
110
- spinner.fail(`Agent "${forceAgent}" not found`);
111
- output.writeln();
112
- output.writeln('Available agents:');
113
- output.printList(AGENT_TYPES.map(a => `${output.highlight(a.id)} - ${a.description}`));
114
- return { success: false, exitCode: 1 };
115
- }
116
- spinner.succeed(`Routed to ${agent.name}`);
117
- if (jsonOutput) {
118
- output.printJson({
119
- task: taskDescription,
120
- agentId: agent.id,
121
- agentName: agent.name,
122
- confidence: 1.0,
123
- method: 'forced',
124
- });
125
- }
126
- else {
127
- output.writeln();
128
- output.printBox([
129
- `Task: ${taskDescription}`,
130
- `Agent: ${output.highlight(agent.name)} (${agent.id})`,
131
- `Confidence: ${output.success('100%')} (forced)`,
132
- `Description: ${agent.description}`,
133
- ].join('\n'), 'Routing Result');
134
- }
135
- return { success: true, data: { agentId: agent.id, agentName: agent.name } };
136
- }
137
- // Use Q-Learning routing
138
- const router = await getRouter();
139
- const result = router.route(taskDescription, useExploration);
140
- const agent = getAgentType(result.route) || AGENT_TYPES[0];
141
- spinner.succeed(`Routed to ${agent.name}`);
142
- if (jsonOutput) {
143
- output.printJson({
144
- task: taskDescription,
145
- agentId: result.route,
146
- agentName: agent.name,
147
- confidence: result.confidence,
148
- qValues: result.qValues,
149
- explored: result.explored,
150
- alternatives: result.alternatives.map(a => ({
151
- agentId: a.route,
152
- agentName: getAgentType(a.route)?.name || a.route,
153
- score: a.score,
154
- })),
155
- });
156
- }
157
- else {
158
- output.writeln();
159
- const confidence = result.confidence ?? 0;
160
- // Use bound methods to preserve `this` context when calling output methods
161
- const confidenceColor = confidence >= 0.7
162
- ? (text) => output.success(text)
163
- : confidence >= 0.4
164
- ? (text) => output.warning(text)
165
- : (text) => output.error(text);
166
- const qValues = result.qValues || [0];
167
- const maxQValue = Math.max(...qValues);
168
- const capabilities = agent.capabilities || [];
169
- const alternatives = result.alternatives || [];
170
- output.printBox([
171
- `Task: ${taskDescription}`,
172
- ``,
173
- `Agent: ${output.highlight(agent.name)} (${result.route})`,
174
- `Confidence: ${confidenceColor(`${(confidence * 100).toFixed(1)}%`)}`,
175
- `Q-Value: ${maxQValue.toFixed(3)}`,
176
- `Exploration: ${result.explored ? output.warning('Yes') : 'No'}`,
177
- ``,
178
- `Description: ${agent.description}`,
179
- `Capabilities: ${capabilities.join(', ')}`,
180
- ].join('\n'), 'Q-Learning Routing');
181
- if (alternatives.length > 0) {
182
- output.writeln();
183
- output.writeln(output.bold('Alternatives:'));
184
- output.printTable({
185
- columns: [
186
- { key: 'agent', header: 'Agent', width: 20 },
187
- { key: 'score', header: 'Score', width: 12, align: 'right' },
188
- ],
189
- data: alternatives.map(a => ({
190
- agent: getAgentType(a.route)?.name || a.route,
191
- score: (a.score ?? 0).toFixed(3),
192
- })),
193
- });
194
- }
137
+ action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
138
+ var taskDescription, forceAgent, useExploration, jsonOutput, spinner, agent_1, router, result, agent, confidence, confidenceColor, qValues, maxQValue, capabilities, alternatives, error_1;
139
+ var _a;
140
+ return __generator(this, function (_b) {
141
+ switch (_b.label) {
142
+ case 0:
143
+ taskDescription = ctx.args[0];
144
+ forceAgent = ctx.flags.agent;
145
+ useExploration = ctx.flags.explore;
146
+ jsonOutput = ctx.flags.json;
147
+ if (!taskDescription) {
148
+ output.printError('Task description is required');
149
+ output.writeln(output.dim('Usage: claude-flow route task "task description"'));
150
+ return [2 /*return*/, { success: false, exitCode: 1 }];
151
+ }
152
+ spinner = output.createSpinner({ text: 'Analyzing task...', spinner: 'dots' });
153
+ spinner.start();
154
+ _b.label = 1;
155
+ case 1:
156
+ _b.trys.push([1, 3, , 4]);
157
+ if (forceAgent) {
158
+ agent_1 = getAgentType(forceAgent) ||
159
+ AGENT_TYPES.find(function (a) { return a.name.toLowerCase() === forceAgent.toLowerCase(); });
160
+ if (!agent_1) {
161
+ spinner.fail("Agent \"" + forceAgent + "\" not found");
162
+ output.writeln();
163
+ output.writeln('Available agents:');
164
+ output.printList(AGENT_TYPES.map(function (a) { return output.highlight(a.id) + " - " + a.description; }));
165
+ return [2 /*return*/, { success: false, exitCode: 1 }];
166
+ }
167
+ spinner.succeed("Routed to " + agent_1.name);
168
+ if (jsonOutput) {
169
+ output.printJson({
170
+ task: taskDescription,
171
+ agentId: agent_1.id,
172
+ agentName: agent_1.name,
173
+ confidence: 1.0,
174
+ method: 'forced'
175
+ });
176
+ }
177
+ else {
178
+ output.writeln();
179
+ output.printBox([
180
+ "Task: " + taskDescription,
181
+ "Agent: " + output.highlight(agent_1.name) + " (" + agent_1.id + ")",
182
+ "Confidence: " + output.success('100%') + " (forced)",
183
+ "Description: " + agent_1.description,
184
+ ].join('\n'), 'Routing Result');
185
+ }
186
+ return [2 /*return*/, { success: true, data: { agentId: agent_1.id, agentName: agent_1.name } }];
187
+ }
188
+ return [4 /*yield*/, getRouter()];
189
+ case 2:
190
+ router = _b.sent();
191
+ result = router.route(taskDescription, useExploration);
192
+ agent = getAgentType(result.route) || AGENT_TYPES[0];
193
+ spinner.succeed("Routed to " + agent.name);
194
+ if (jsonOutput) {
195
+ output.printJson({
196
+ task: taskDescription,
197
+ agentId: result.route,
198
+ agentName: agent.name,
199
+ confidence: result.confidence,
200
+ qValues: result.qValues,
201
+ explored: result.explored,
202
+ alternatives: result.alternatives.map(function (a) {
203
+ var _a;
204
+ return ({
205
+ agentId: a.route,
206
+ agentName: ((_a = getAgentType(a.route)) === null || _a === void 0 ? void 0 : _a.name) || a.route,
207
+ score: a.score
208
+ });
209
+ })
210
+ });
211
+ }
212
+ else {
213
+ output.writeln();
214
+ confidence = (_a = result.confidence) !== null && _a !== void 0 ? _a : 0;
215
+ confidenceColor = confidence >= 0.7
216
+ ? function (text) { return output.success(text); }
217
+ : confidence >= 0.4
218
+ ? function (text) { return output.warning(text); }
219
+ : function (text) { return output.error(text); };
220
+ qValues = result.qValues || [0];
221
+ maxQValue = Math.max.apply(Math, qValues);
222
+ capabilities = agent.capabilities || [];
223
+ alternatives = result.alternatives || [];
224
+ output.printBox([
225
+ "Task: " + taskDescription,
226
+ "",
227
+ "Agent: " + output.highlight(agent.name) + " (" + result.route + ")",
228
+ "Confidence: " + confidenceColor((confidence * 100).toFixed(1) + "%"),
229
+ "Q-Value: " + maxQValue.toFixed(3),
230
+ "Exploration: " + (result.explored ? output.warning('Yes') : 'No'),
231
+ "",
232
+ "Description: " + agent.description,
233
+ "Capabilities: " + capabilities.join(', '),
234
+ ].join('\n'), 'Q-Learning Routing');
235
+ if (alternatives.length > 0) {
236
+ output.writeln();
237
+ output.writeln(output.bold('Alternatives:'));
238
+ output.printTable({
239
+ columns: [
240
+ { key: 'agent', header: 'Agent', width: 20 },
241
+ { key: 'score', header: 'Score', width: 12, align: 'right' },
242
+ ],
243
+ data: alternatives.map(function (a) {
244
+ var _a, _b;
245
+ return ({
246
+ agent: ((_a = getAgentType(a.route)) === null || _a === void 0 ? void 0 : _a.name) || a.route,
247
+ score: ((_b = a.score) !== null && _b !== void 0 ? _b : 0).toFixed(3)
248
+ });
249
+ })
250
+ });
251
+ }
252
+ }
253
+ return [2 /*return*/, { success: true, data: { agentId: result.route, result: result } }];
254
+ case 3:
255
+ error_1 = _b.sent();
256
+ spinner.fail('Routing failed');
257
+ output.printError(error_1 instanceof Error ? error_1.message : String(error_1));
258
+ return [2 /*return*/, { success: false, exitCode: 1 }];
259
+ case 4: return [2 /*return*/];
195
260
  }
196
- return { success: true, data: { agentId: result.route, result } };
197
- }
198
- catch (error) {
199
- spinner.fail('Routing failed');
200
- output.printError(error instanceof Error ? error.message : String(error));
201
- return { success: false, exitCode: 1 };
202
- }
203
- },
261
+ });
262
+ }); }
204
263
  };
205
264
  // ============================================================================
206
265
  // List Agents Subcommand
207
266
  // ============================================================================
208
- const listAgentsCommand = {
267
+ var listAgentsCommand = {
209
268
  name: 'list-agents',
210
269
  aliases: ['agents', 'ls'],
211
270
  description: 'List all available agent types for routing',
@@ -215,53 +274,57 @@ const listAgentsCommand = {
215
274
  short: 'j',
216
275
  description: 'Output in JSON format',
217
276
  type: 'boolean',
218
- default: false,
277
+ "default": false
219
278
  },
220
279
  ],
221
280
  examples: [
222
281
  { command: 'claude-flow route list-agents', description: 'List all agents' },
223
282
  { command: 'claude-flow route agents --json', description: 'List agents as JSON' },
224
283
  ],
225
- action: async (ctx) => {
226
- const jsonOutput = ctx.flags.json;
227
- try {
228
- if (jsonOutput) {
229
- output.printJson(AGENT_TYPES);
284
+ action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
285
+ var jsonOutput;
286
+ return __generator(this, function (_a) {
287
+ jsonOutput = ctx.flags.json;
288
+ try {
289
+ if (jsonOutput) {
290
+ output.printJson(AGENT_TYPES);
291
+ }
292
+ else {
293
+ output.writeln();
294
+ output.writeln(output.bold('Available Agent Types'));
295
+ output.writeln(output.dim('Ordered by priority (highest first)'));
296
+ output.writeln();
297
+ output.printTable({
298
+ columns: [
299
+ { key: 'id', header: 'ID', width: 15 },
300
+ { key: 'name', header: 'Name', width: 15 },
301
+ { key: 'priority', header: 'Priority', width: 10, align: 'right' },
302
+ { key: 'description', header: 'Description', width: 45 },
303
+ ],
304
+ data: AGENT_TYPES.map(function (a) { return ({
305
+ id: output.highlight(a.id),
306
+ name: a.name,
307
+ priority: String(a.priority),
308
+ description: a.description
309
+ }); })
310
+ });
311
+ output.writeln();
312
+ output.writeln(output.dim("Total: " + AGENT_TYPES.length + " agent types"));
313
+ }
314
+ return [2 /*return*/, { success: true, data: AGENT_TYPES }];
230
315
  }
231
- else {
232
- output.writeln();
233
- output.writeln(output.bold('Available Agent Types'));
234
- output.writeln(output.dim('Ordered by priority (highest first)'));
235
- output.writeln();
236
- output.printTable({
237
- columns: [
238
- { key: 'id', header: 'ID', width: 15 },
239
- { key: 'name', header: 'Name', width: 15 },
240
- { key: 'priority', header: 'Priority', width: 10, align: 'right' },
241
- { key: 'description', header: 'Description', width: 45 },
242
- ],
243
- data: AGENT_TYPES.map(a => ({
244
- id: output.highlight(a.id),
245
- name: a.name,
246
- priority: String(a.priority),
247
- description: a.description,
248
- })),
249
- });
250
- output.writeln();
251
- output.writeln(output.dim(`Total: ${AGENT_TYPES.length} agent types`));
316
+ catch (error) {
317
+ output.printError(error instanceof Error ? error.message : String(error));
318
+ return [2 /*return*/, { success: false, exitCode: 1 }];
252
319
  }
253
- return { success: true, data: AGENT_TYPES };
254
- }
255
- catch (error) {
256
- output.printError(error instanceof Error ? error.message : String(error));
257
- return { success: false, exitCode: 1 };
258
- }
259
- },
320
+ return [2 /*return*/];
321
+ });
322
+ }); }
260
323
  };
261
324
  // ============================================================================
262
325
  // Stats Subcommand
263
326
  // ============================================================================
264
- const statsCommand = {
327
+ var statsCommand = {
265
328
  name: 'stats',
266
329
  description: 'Show Q-Learning router statistics',
267
330
  options: [
@@ -270,64 +333,76 @@ const statsCommand = {
270
333
  short: 'j',
271
334
  description: 'Output in JSON format',
272
335
  type: 'boolean',
273
- default: false,
336
+ "default": false
274
337
  },
275
338
  ],
276
339
  examples: [
277
340
  { command: 'claude-flow route stats', description: 'Show routing statistics' },
278
341
  ],
279
- action: async (ctx) => {
280
- const jsonOutput = ctx.flags.json;
281
- try {
282
- const router = await getRouter();
283
- const stats = router.getStats();
284
- const ruvectorAvailable = await isRuvectorAvailable();
285
- const ruvectorStatus = {
286
- available: ruvectorAvailable,
287
- wasmAccelerated: stats.useNative === 1,
288
- backend: stats.useNative === 1 ? 'ruvector-native' : 'fallback',
289
- };
290
- if (jsonOutput) {
291
- output.printJson({ stats, ruvector: ruvectorStatus });
292
- }
293
- else {
294
- output.writeln();
295
- output.writeln(output.bold('Q-Learning Router Statistics'));
296
- output.writeln();
297
- output.printTable({
298
- columns: [
299
- { key: 'metric', header: 'Metric', width: 25 },
300
- { key: 'value', header: 'Value', width: 20, align: 'right' },
301
- ],
302
- data: [
303
- { metric: 'Update Count', value: String(stats.updateCount) },
304
- { metric: 'Q-Table Size', value: String(stats.qTableSize) },
305
- { metric: 'Step Count', value: String(stats.stepCount) },
306
- { metric: 'Epsilon', value: stats.epsilon.toFixed(4) },
307
- { metric: 'Avg TD Error', value: stats.avgTDError.toFixed(4) },
308
- { metric: 'Native Backend', value: stats.useNative === 1 ? 'Yes' : 'No' },
309
- ],
310
- });
311
- output.writeln();
312
- output.writeln(output.bold('RuVector Status'));
313
- output.printList([
314
- `Available: ${ruvectorStatus.available ? output.success('Yes') : output.warning('No (using fallback)')}`,
315
- `WASM Accelerated: ${ruvectorStatus.wasmAccelerated ? output.success('Yes') : 'No'}`,
316
- `Backend: ${ruvectorStatus.backend}`,
317
- ]);
342
+ action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
343
+ var jsonOutput, router, stats, ruvectorAvailable, ruvectorStatus, error_2;
344
+ return __generator(this, function (_a) {
345
+ switch (_a.label) {
346
+ case 0:
347
+ jsonOutput = ctx.flags.json;
348
+ _a.label = 1;
349
+ case 1:
350
+ _a.trys.push([1, 4, , 5]);
351
+ return [4 /*yield*/, getRouter()];
352
+ case 2:
353
+ router = _a.sent();
354
+ stats = router.getStats();
355
+ return [4 /*yield*/, isRuvectorAvailable()];
356
+ case 3:
357
+ ruvectorAvailable = _a.sent();
358
+ ruvectorStatus = {
359
+ available: ruvectorAvailable,
360
+ wasmAccelerated: stats.useNative === 1,
361
+ backend: stats.useNative === 1 ? 'ruvector-native' : 'fallback'
362
+ };
363
+ if (jsonOutput) {
364
+ output.printJson({ stats: stats, ruvector: ruvectorStatus });
365
+ }
366
+ else {
367
+ output.writeln();
368
+ output.writeln(output.bold('Q-Learning Router Statistics'));
369
+ output.writeln();
370
+ output.printTable({
371
+ columns: [
372
+ { key: 'metric', header: 'Metric', width: 25 },
373
+ { key: 'value', header: 'Value', width: 20, align: 'right' },
374
+ ],
375
+ data: [
376
+ { metric: 'Update Count', value: String(stats.updateCount) },
377
+ { metric: 'Q-Table Size', value: String(stats.qTableSize) },
378
+ { metric: 'Step Count', value: String(stats.stepCount) },
379
+ { metric: 'Epsilon', value: stats.epsilon.toFixed(4) },
380
+ { metric: 'Avg TD Error', value: stats.avgTDError.toFixed(4) },
381
+ { metric: 'Native Backend', value: stats.useNative === 1 ? 'Yes' : 'No' },
382
+ ]
383
+ });
384
+ output.writeln();
385
+ output.writeln(output.bold('RuVector Status'));
386
+ output.printList([
387
+ "Available: " + (ruvectorStatus.available ? output.success('Yes') : output.warning('No (using fallback)')),
388
+ "WASM Accelerated: " + (ruvectorStatus.wasmAccelerated ? output.success('Yes') : 'No'),
389
+ "Backend: " + ruvectorStatus.backend,
390
+ ]);
391
+ }
392
+ return [2 /*return*/, { success: true, data: { stats: stats, ruvector: ruvectorStatus } }];
393
+ case 4:
394
+ error_2 = _a.sent();
395
+ output.printError(error_2 instanceof Error ? error_2.message : String(error_2));
396
+ return [2 /*return*/, { success: false, exitCode: 1 }];
397
+ case 5: return [2 /*return*/];
318
398
  }
319
- return { success: true, data: { stats, ruvector: ruvectorStatus } };
320
- }
321
- catch (error) {
322
- output.printError(error instanceof Error ? error.message : String(error));
323
- return { success: false, exitCode: 1 };
324
- }
325
- },
399
+ });
400
+ }); }
326
401
  };
327
402
  // ============================================================================
328
403
  // Feedback Subcommand
329
404
  // ============================================================================
330
- const feedbackCommand = {
405
+ var feedbackCommand = {
331
406
  name: 'feedback',
332
407
  description: 'Provide feedback on a routing decision',
333
408
  options: [
@@ -336,75 +411,84 @@ const feedbackCommand = {
336
411
  short: 't',
337
412
  description: 'Task description (context for learning)',
338
413
  type: 'string',
339
- required: true,
414
+ required: true
340
415
  },
341
416
  {
342
417
  name: 'agent',
343
418
  short: 'a',
344
419
  description: 'Agent that was used',
345
420
  type: 'string',
346
- required: true,
421
+ required: true
347
422
  },
348
423
  {
349
424
  name: 'reward',
350
425
  short: 'r',
351
426
  description: 'Reward value (-1 to 1, where 1 is best)',
352
427
  type: 'number',
353
- default: 0.8,
428
+ "default": 0.8
354
429
  },
355
430
  {
356
431
  name: 'next-task',
357
432
  short: 'n',
358
433
  description: 'Next task description (for multi-step learning)',
359
- type: 'string',
434
+ type: 'string'
360
435
  },
361
436
  ],
362
437
  examples: [
363
438
  { command: 'claude-flow route feedback -t "implement auth" -a coder -r 0.9', description: 'Positive feedback' },
364
439
  { command: 'claude-flow route feedback -t "write tests" -a tester -r -0.5', description: 'Negative feedback' },
365
440
  ],
366
- action: async (ctx) => {
367
- const taskDescription = ctx.flags.task;
368
- const agentId = ctx.flags.agent;
369
- const reward = ctx.flags.reward;
370
- const nextTask = ctx.flags['next-task'];
371
- if (!taskDescription || !agentId) {
372
- output.printError('Task description and agent are required');
373
- return { success: false, exitCode: 1 };
374
- }
375
- // Validate agent
376
- const agent = getAgentType(agentId);
377
- if (!agent) {
378
- output.printError(`Unknown agent: ${agentId}`);
379
- output.writeln('Available agents:');
380
- output.printList(AGENT_TYPES.map(a => a.id));
381
- return { success: false, exitCode: 1 };
382
- }
383
- try {
384
- const router = await getRouter();
385
- const clampedReward = Math.max(-1, Math.min(1, reward));
386
- const tdError = router.update(taskDescription, agentId, clampedReward, nextTask);
387
- output.printSuccess(`Feedback recorded for agent "${agent.name}"`);
388
- output.writeln();
389
- output.printBox([
390
- `Task: ${taskDescription}`,
391
- `Agent: ${agent.name} (${agentId})`,
392
- `Reward: ${clampedReward >= 0 ? output.success(clampedReward.toFixed(2)) : output.error(clampedReward.toFixed(2))}`,
393
- `TD Error: ${Math.abs(tdError).toFixed(4)}`,
394
- nextTask ? `Next Task: ${nextTask}` : '',
395
- ].filter(Boolean).join('\n'), 'Feedback Recorded');
396
- return { success: true, data: { tdError } };
397
- }
398
- catch (error) {
399
- output.printError(error instanceof Error ? error.message : String(error));
400
- return { success: false, exitCode: 1 };
401
- }
402
- },
441
+ action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
442
+ var taskDescription, agentId, reward, nextTask, agent, router, clampedReward, tdError, error_3;
443
+ return __generator(this, function (_a) {
444
+ switch (_a.label) {
445
+ case 0:
446
+ taskDescription = ctx.flags.task;
447
+ agentId = ctx.flags.agent;
448
+ reward = ctx.flags.reward;
449
+ nextTask = ctx.flags['next-task'];
450
+ if (!taskDescription || !agentId) {
451
+ output.printError('Task description and agent are required');
452
+ return [2 /*return*/, { success: false, exitCode: 1 }];
453
+ }
454
+ agent = getAgentType(agentId);
455
+ if (!agent) {
456
+ output.printError("Unknown agent: " + agentId);
457
+ output.writeln('Available agents:');
458
+ output.printList(AGENT_TYPES.map(function (a) { return a.id; }));
459
+ return [2 /*return*/, { success: false, exitCode: 1 }];
460
+ }
461
+ _a.label = 1;
462
+ case 1:
463
+ _a.trys.push([1, 3, , 4]);
464
+ return [4 /*yield*/, getRouter()];
465
+ case 2:
466
+ router = _a.sent();
467
+ clampedReward = Math.max(-1, Math.min(1, reward));
468
+ tdError = router.update(taskDescription, agentId, clampedReward, nextTask);
469
+ output.printSuccess("Feedback recorded for agent \"" + agent.name + "\"");
470
+ output.writeln();
471
+ output.printBox([
472
+ "Task: " + taskDescription,
473
+ "Agent: " + agent.name + " (" + agentId + ")",
474
+ "Reward: " + (clampedReward >= 0 ? output.success(clampedReward.toFixed(2)) : output.error(clampedReward.toFixed(2))),
475
+ "TD Error: " + Math.abs(tdError).toFixed(4),
476
+ nextTask ? "Next Task: " + nextTask : '',
477
+ ].filter(Boolean).join('\n'), 'Feedback Recorded');
478
+ return [2 /*return*/, { success: true, data: { tdError: tdError } }];
479
+ case 3:
480
+ error_3 = _a.sent();
481
+ output.printError(error_3 instanceof Error ? error_3.message : String(error_3));
482
+ return [2 /*return*/, { success: false, exitCode: 1 }];
483
+ case 4: return [2 /*return*/];
484
+ }
485
+ });
486
+ }); }
403
487
  };
404
488
  // ============================================================================
405
489
  // Reset Subcommand
406
490
  // ============================================================================
407
- const resetCommand = {
491
+ var resetCommand = {
408
492
  name: 'reset',
409
493
  description: 'Reset the Q-Learning router state',
410
494
  options: [
@@ -413,36 +497,46 @@ const resetCommand = {
413
497
  short: 'f',
414
498
  description: 'Force reset without confirmation',
415
499
  type: 'boolean',
416
- default: false,
500
+ "default": false
417
501
  },
418
502
  ],
419
503
  examples: [
420
504
  { command: 'claude-flow route reset', description: 'Reset router state' },
421
505
  { command: 'claude-flow route reset --force', description: 'Force reset' },
422
506
  ],
423
- action: async (ctx) => {
424
- const force = ctx.flags.force;
425
- if (!force && ctx.interactive) {
426
- output.printWarning('This will reset all learned Q-values and statistics.');
427
- output.writeln(output.dim('Use --force to skip this confirmation.'));
428
- return { success: false, exitCode: 1 };
429
- }
430
- try {
431
- const router = await getRouter();
432
- router.reset();
433
- output.printSuccess('Q-Learning router state has been reset');
434
- return { success: true };
435
- }
436
- catch (error) {
437
- output.printError(error instanceof Error ? error.message : String(error));
438
- return { success: false, exitCode: 1 };
439
- }
440
- },
507
+ action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
508
+ var force, router, error_4;
509
+ return __generator(this, function (_a) {
510
+ switch (_a.label) {
511
+ case 0:
512
+ force = ctx.flags.force;
513
+ if (!force && ctx.interactive) {
514
+ output.printWarning('This will reset all learned Q-values and statistics.');
515
+ output.writeln(output.dim('Use --force to skip this confirmation.'));
516
+ return [2 /*return*/, { success: false, exitCode: 1 }];
517
+ }
518
+ _a.label = 1;
519
+ case 1:
520
+ _a.trys.push([1, 3, , 4]);
521
+ return [4 /*yield*/, getRouter()];
522
+ case 2:
523
+ router = _a.sent();
524
+ router.reset();
525
+ output.printSuccess('Q-Learning router state has been reset');
526
+ return [2 /*return*/, { success: true }];
527
+ case 3:
528
+ error_4 = _a.sent();
529
+ output.printError(error_4 instanceof Error ? error_4.message : String(error_4));
530
+ return [2 /*return*/, { success: false, exitCode: 1 }];
531
+ case 4: return [2 /*return*/];
532
+ }
533
+ });
534
+ }); }
441
535
  };
442
536
  // ============================================================================
443
537
  // Export/Import Subcommands
444
538
  // ============================================================================
445
- const exportCommand = {
539
+ var exportCommand = {
446
540
  name: 'export',
447
541
  description: 'Export Q-table for persistence',
448
542
  options: [
@@ -450,35 +544,49 @@ const exportCommand = {
450
544
  name: 'file',
451
545
  short: 'f',
452
546
  description: 'Output file path (outputs to stdout if not specified)',
453
- type: 'string',
547
+ type: 'string'
454
548
  },
455
549
  ],
456
550
  examples: [
457
551
  { command: 'claude-flow route export', description: 'Export Q-table to stdout' },
458
552
  { command: 'claude-flow route export -f qtable.json', description: 'Export to file' },
459
553
  ],
460
- action: async (ctx) => {
461
- const filePath = ctx.flags.file;
462
- try {
463
- const router = await getRouter();
464
- const data = router.export();
465
- if (filePath) {
466
- const fs = await import('node:fs/promises');
467
- await fs.writeFile(filePath, JSON.stringify(data, null, 2));
468
- output.printSuccess(`Q-table exported to ${filePath}`);
469
- }
470
- else {
471
- output.printJson(data);
554
+ action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
555
+ var filePath, router, data, fs, error_5;
556
+ return __generator(this, function (_a) {
557
+ switch (_a.label) {
558
+ case 0:
559
+ filePath = ctx.flags.file;
560
+ _a.label = 1;
561
+ case 1:
562
+ _a.trys.push([1, 7, , 8]);
563
+ return [4 /*yield*/, getRouter()];
564
+ case 2:
565
+ router = _a.sent();
566
+ data = router["export"]();
567
+ if (!filePath) return [3 /*break*/, 5];
568
+ return [4 /*yield*/, import('node:fs/promises')];
569
+ case 3:
570
+ fs = _a.sent();
571
+ return [4 /*yield*/, fs.writeFile(filePath, JSON.stringify(data, null, 2))];
572
+ case 4:
573
+ _a.sent();
574
+ output.printSuccess("Q-table exported to " + filePath);
575
+ return [3 /*break*/, 6];
576
+ case 5:
577
+ output.printJson(data);
578
+ _a.label = 6;
579
+ case 6: return [2 /*return*/, { success: true, data: data }];
580
+ case 7:
581
+ error_5 = _a.sent();
582
+ output.printError(error_5 instanceof Error ? error_5.message : String(error_5));
583
+ return [2 /*return*/, { success: false, exitCode: 1 }];
584
+ case 8: return [2 /*return*/];
472
585
  }
473
- return { success: true, data };
474
- }
475
- catch (error) {
476
- output.printError(error instanceof Error ? error.message : String(error));
477
- return { success: false, exitCode: 1 };
478
- }
479
- },
586
+ });
587
+ }); }
480
588
  };
481
- const importCommand = {
589
+ var importCommand = {
482
590
  name: 'import',
483
591
  description: 'Import Q-table from file',
484
592
  options: [
@@ -487,38 +595,52 @@ const importCommand = {
487
595
  short: 'f',
488
596
  description: 'Input file path',
489
597
  type: 'string',
490
- required: true,
598
+ required: true
491
599
  },
492
600
  ],
493
601
  examples: [
494
602
  { command: 'claude-flow route import -f qtable.json', description: 'Import Q-table from file' },
495
603
  ],
496
- action: async (ctx) => {
497
- const filePath = ctx.flags.file;
498
- if (!filePath) {
499
- output.printError('File path is required');
500
- return { success: false, exitCode: 1 };
501
- }
502
- try {
503
- const fs = await import('node:fs/promises');
504
- const content = await fs.readFile(filePath, 'utf-8');
505
- const data = JSON.parse(content);
506
- const router = await getRouter();
507
- router.import(data);
508
- output.printSuccess(`Q-table imported from ${filePath}`);
509
- output.writeln(output.dim(`Loaded ${Object.keys(data).length} state entries`));
510
- return { success: true };
511
- }
512
- catch (error) {
513
- output.printError(error instanceof Error ? error.message : String(error));
514
- return { success: false, exitCode: 1 };
515
- }
516
- },
604
+ action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
605
+ var filePath, fs, content, data, router, error_6;
606
+ return __generator(this, function (_a) {
607
+ switch (_a.label) {
608
+ case 0:
609
+ filePath = ctx.flags.file;
610
+ if (!filePath) {
611
+ output.printError('File path is required');
612
+ return [2 /*return*/, { success: false, exitCode: 1 }];
613
+ }
614
+ _a.label = 1;
615
+ case 1:
616
+ _a.trys.push([1, 5, , 6]);
617
+ return [4 /*yield*/, import('node:fs/promises')];
618
+ case 2:
619
+ fs = _a.sent();
620
+ return [4 /*yield*/, fs.readFile(filePath, 'utf-8')];
621
+ case 3:
622
+ content = _a.sent();
623
+ data = JSON.parse(content);
624
+ return [4 /*yield*/, getRouter()];
625
+ case 4:
626
+ router = _a.sent();
627
+ router["import"](data);
628
+ output.printSuccess("Q-table imported from " + filePath);
629
+ output.writeln(output.dim("Loaded " + Object.keys(data).length + " state entries"));
630
+ return [2 /*return*/, { success: true }];
631
+ case 5:
632
+ error_6 = _a.sent();
633
+ output.printError(error_6 instanceof Error ? error_6.message : String(error_6));
634
+ return [2 /*return*/, { success: false, exitCode: 1 }];
635
+ case 6: return [2 /*return*/];
636
+ }
637
+ });
638
+ }); }
517
639
  };
518
640
  // ============================================================================
519
641
  // Coverage-Aware Routing Subcommand
520
642
  // ============================================================================
521
- const coverageRouteCommand = {
643
+ var coverageRouteCommand = {
522
644
  name: 'coverage',
523
645
  aliases: ['cov'],
524
646
  description: 'Route tasks based on test coverage analysis (ADR-017)',
@@ -527,35 +649,35 @@ const coverageRouteCommand = {
527
649
  name: 'path',
528
650
  short: 'p',
529
651
  description: 'Path to analyze for coverage',
530
- type: 'string',
652
+ type: 'string'
531
653
  },
532
654
  {
533
655
  name: 'threshold',
534
656
  short: 't',
535
657
  description: 'Coverage threshold percentage (default: 80)',
536
658
  type: 'number',
537
- default: 80,
659
+ "default": 80
538
660
  },
539
661
  {
540
662
  name: 'suggest',
541
663
  short: 's',
542
664
  description: 'Get suggestions for improving coverage',
543
665
  type: 'boolean',
544
- default: false,
666
+ "default": false
545
667
  },
546
668
  {
547
669
  name: 'gaps',
548
670
  short: 'g',
549
671
  description: 'List coverage gaps with agent assignments',
550
672
  type: 'boolean',
551
- default: false,
673
+ "default": false
552
674
  },
553
675
  {
554
676
  name: 'json',
555
677
  short: 'j',
556
678
  description: 'Output in JSON format',
557
679
  type: 'boolean',
558
- default: false,
680
+ "default": false
559
681
  },
560
682
  ],
561
683
  examples: [
@@ -564,170 +686,185 @@ const coverageRouteCommand = {
564
686
  { command: 'claude-flow route coverage --gaps', description: 'List coverage gaps by agent' },
565
687
  { command: 'claude-flow route coverage -p src/auth -t 90', description: 'Analyze specific path with threshold' },
566
688
  ],
567
- action: async (ctx) => {
568
- const path = ctx.flags.path || '';
569
- const threshold = ctx.flags.threshold || 80;
570
- const suggestMode = ctx.flags.suggest;
571
- const gapsMode = ctx.flags.gaps;
572
- const jsonOutput = ctx.flags.json;
573
- const spinner = output.createSpinner({ text: 'Analyzing coverage...', spinner: 'dots' });
574
- spinner.start();
575
- try {
576
- // Lazy load coverage router
577
- const { coverageRoute, coverageSuggest, coverageGaps } = await import('../ruvector/coverage-router.js');
578
- if (gapsMode) {
579
- // List coverage gaps with agent assignments
580
- const result = await coverageGaps({ threshold, groupByAgent: true });
581
- spinner.succeed(`Found ${result.totalGaps} coverage gaps`);
582
- if (jsonOutput) {
583
- output.printJson(result);
584
- }
585
- else {
586
- output.writeln();
587
- output.writeln(output.bold('Coverage Gaps by Agent'));
588
- output.writeln(output.dim(result.summary));
589
- output.writeln();
590
- if (Object.keys(result.byAgent).length > 0) {
591
- for (const [agent, files] of Object.entries(result.byAgent)) {
592
- output.writeln(`${output.highlight(agent)} (${files.length} files)`);
593
- for (const file of files.slice(0, 5)) {
594
- output.writeln(` ${output.dim('•')} ${file}`);
595
- }
596
- if (files.length > 5) {
597
- output.writeln(output.dim(` ... and ${files.length - 5} more`));
598
- }
599
- output.writeln();
600
- }
689
+ action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
690
+ var path, threshold, suggestMode, gapsMode, jsonOutput, spinner, _a, coverageRoute, coverageSuggest, coverageGaps, result, _i, _b, _c, agent, files, _d, _e, file, result, routeResult, actionColors, colorFn, error_7;
691
+ return __generator(this, function (_f) {
692
+ switch (_f.label) {
693
+ case 0:
694
+ path = ctx.flags.path || '';
695
+ threshold = ctx.flags.threshold || 80;
696
+ suggestMode = ctx.flags.suggest;
697
+ gapsMode = ctx.flags.gaps;
698
+ jsonOutput = ctx.flags.json;
699
+ spinner = output.createSpinner({ text: 'Analyzing coverage...', spinner: 'dots' });
700
+ spinner.start();
701
+ _f.label = 1;
702
+ case 1:
703
+ _f.trys.push([1, 8, , 9]);
704
+ return [4 /*yield*/, import('../ruvector/coverage-router.js')];
705
+ case 2:
706
+ _a = _f.sent(), coverageRoute = _a.coverageRoute, coverageSuggest = _a.coverageSuggest, coverageGaps = _a.coverageGaps;
707
+ if (!gapsMode) return [3 /*break*/, 4];
708
+ return [4 /*yield*/, coverageGaps({ threshold: threshold, groupByAgent: true })];
709
+ case 3:
710
+ result = _f.sent();
711
+ spinner.succeed("Found " + result.totalGaps + " coverage gaps");
712
+ if (jsonOutput) {
713
+ output.printJson(result);
601
714
  }
602
715
  else {
603
- output.printSuccess('No coverage gaps found!');
604
- }
605
- output.writeln();
606
- output.writeln(output.bold('Top Gaps:'));
607
- output.printTable({
608
- columns: [
609
- { key: 'file', header: 'File', width: 50 },
610
- { key: 'coverage', header: 'Coverage', width: 12, align: 'right' },
611
- { key: 'gap', header: 'Gap', width: 10, align: 'right' },
612
- { key: 'agent', header: 'Agent', width: 15 },
613
- ],
614
- data: result.gaps.slice(0, 10).map(g => ({
615
- file: g.file.length > 48 ? '...' + g.file.slice(-45) : g.file,
616
- coverage: `${g.currentCoverage.toFixed(1)}%`,
617
- gap: `${g.gap.toFixed(1)}%`,
618
- agent: g.suggestedAgent,
619
- })),
620
- });
621
- }
622
- return { success: true, data: result };
623
- }
624
- if (suggestMode || path) {
625
- // Suggest improvements for path
626
- const result = await coverageSuggest(path || '.', { threshold, limit: 20 });
627
- spinner.succeed(`Found ${result.suggestions.length} coverage suggestions`);
628
- if (jsonOutput) {
629
- output.printJson(result);
630
- }
631
- else {
632
- output.writeln();
633
- output.writeln(output.bold('Coverage Improvement Suggestions'));
634
- output.writeln(output.dim(`Path: ${result.path}, Threshold: ${threshold}%`));
635
- output.writeln();
636
- if (result.suggestions.length === 0) {
637
- output.printSuccess('All files meet coverage threshold!');
638
- }
639
- else {
640
- output.writeln(`Total Gap: ${output.warning(`${result.totalGap.toFixed(1)}%`)}`);
641
- output.writeln(`Estimated Effort: ${output.dim(`${result.estimatedEffort.toFixed(1)} hours`)}`);
642
716
  output.writeln();
717
+ output.writeln(output.bold('Coverage Gaps by Agent'));
718
+ output.writeln(output.dim(result.summary));
719
+ output.writeln();
720
+ if (Object.keys(result.byAgent).length > 0) {
721
+ for (_i = 0, _b = Object.entries(result.byAgent); _i < _b.length; _i++) {
722
+ _c = _b[_i], agent = _c[0], files = _c[1];
723
+ output.writeln(output.highlight(agent) + " (" + files.length + " files)");
724
+ for (_d = 0, _e = files.slice(0, 5); _d < _e.length; _d++) {
725
+ file = _e[_d];
726
+ output.writeln(" " + output.dim('•') + " " + file);
727
+ }
728
+ if (files.length > 5) {
729
+ output.writeln(output.dim(" ... and " + (files.length - 5) + " more"));
730
+ }
731
+ output.writeln();
732
+ }
733
+ }
734
+ else {
735
+ output.printSuccess('No coverage gaps found!');
736
+ }
737
+ output.writeln();
738
+ output.writeln(output.bold('Top Gaps:'));
643
739
  output.printTable({
644
740
  columns: [
645
- { key: 'file', header: 'File', width: 45 },
646
- { key: 'current', header: 'Current', width: 10, align: 'right' },
647
- { key: 'target', header: 'Target', width: 10, align: 'right' },
648
- { key: 'priority', header: 'Priority', width: 10, align: 'right' },
741
+ { key: 'file', header: 'File', width: 50 },
742
+ { key: 'coverage', header: 'Coverage', width: 12, align: 'right' },
743
+ { key: 'gap', header: 'Gap', width: 10, align: 'right' },
744
+ { key: 'agent', header: 'Agent', width: 15 },
649
745
  ],
650
- data: result.suggestions.slice(0, 15).map(s => ({
651
- file: s.file.length > 43 ? '...' + s.file.slice(-40) : s.file,
652
- current: `${s.currentCoverage.toFixed(1)}%`,
653
- target: `${s.targetCoverage.toFixed(1)}%`,
654
- priority: String(s.priority),
655
- })),
746
+ data: result.gaps.slice(0, 10).map(function (g) { return ({
747
+ file: g.file.length > 48 ? '...' + g.file.slice(-45) : g.file,
748
+ coverage: g.currentCoverage.toFixed(1) + "%",
749
+ gap: g.gap.toFixed(1) + "%",
750
+ agent: g.suggestedAgent
751
+ }); })
656
752
  });
657
- // Show test suggestions for top file
658
- if (result.suggestions.length > 0 && result.suggestions[0].suggestedTests.length > 0) {
753
+ }
754
+ return [2 /*return*/, { success: true, data: result }];
755
+ case 4:
756
+ if (!(suggestMode || path)) return [3 /*break*/, 6];
757
+ return [4 /*yield*/, coverageSuggest(path || '.', { threshold: threshold, limit: 20 })];
758
+ case 5:
759
+ result = _f.sent();
760
+ spinner.succeed("Found " + result.suggestions.length + " coverage suggestions");
761
+ if (jsonOutput) {
762
+ output.printJson(result);
763
+ }
764
+ else {
765
+ output.writeln();
766
+ output.writeln(output.bold('Coverage Improvement Suggestions'));
767
+ output.writeln(output.dim("Path: " + result.path + ", Threshold: " + threshold + "%"));
768
+ output.writeln();
769
+ if (result.suggestions.length === 0) {
770
+ output.printSuccess('All files meet coverage threshold!');
771
+ }
772
+ else {
773
+ output.writeln("Total Gap: " + output.warning(result.totalGap.toFixed(1) + "%"));
774
+ output.writeln("Estimated Effort: " + output.dim(result.estimatedEffort.toFixed(1) + " hours"));
659
775
  output.writeln();
660
- output.writeln(output.bold('Suggested Tests for Top Priority File:'));
661
- output.printList(result.suggestions[0].suggestedTests);
776
+ output.printTable({
777
+ columns: [
778
+ { key: 'file', header: 'File', width: 45 },
779
+ { key: 'current', header: 'Current', width: 10, align: 'right' },
780
+ { key: 'target', header: 'Target', width: 10, align: 'right' },
781
+ { key: 'priority', header: 'Priority', width: 10, align: 'right' },
782
+ ],
783
+ data: result.suggestions.slice(0, 15).map(function (s) { return ({
784
+ file: s.file.length > 43 ? '...' + s.file.slice(-40) : s.file,
785
+ current: s.currentCoverage.toFixed(1) + "%",
786
+ target: s.targetCoverage.toFixed(1) + "%",
787
+ priority: String(s.priority)
788
+ }); })
789
+ });
790
+ // Show test suggestions for top file
791
+ if (result.suggestions.length > 0 && result.suggestions[0].suggestedTests.length > 0) {
792
+ output.writeln();
793
+ output.writeln(output.bold('Suggested Tests for Top Priority File:'));
794
+ output.printList(result.suggestions[0].suggestedTests);
795
+ }
662
796
  }
663
797
  }
664
- }
665
- return { success: true, data: result };
666
- }
667
- // Default: Route based on coverage analysis
668
- const routeResult = await coverageRoute('', { threshold });
669
- spinner.succeed('Coverage analysis complete');
670
- if (jsonOutput) {
671
- output.printJson(routeResult);
672
- }
673
- else {
674
- output.writeln();
675
- output.writeln(output.bold('Coverage-Aware Routing'));
676
- output.writeln();
677
- const actionColors = {
678
- 'add-tests': (s) => output.error(s),
679
- 'review-coverage': (s) => output.warning(s),
680
- 'prioritize': (s) => output.error(s),
681
- 'skip': (s) => output.success(s),
682
- };
683
- const colorFn = actionColors[routeResult.action] || ((s) => s);
684
- output.printBox([
685
- `Action: ${colorFn(routeResult.action.toUpperCase())}`,
686
- `Priority: ${routeResult.priority}/10`,
687
- `Impact Score: ${routeResult.impactScore}%`,
688
- `Estimated Effort: ${routeResult.estimatedEffort} hours`,
689
- ``,
690
- `Test Types: ${routeResult.testTypes.join(', ')}`,
691
- `Target Files: ${routeResult.targetFiles.length}`,
692
- ].join('\n'), 'Coverage Analysis');
693
- if (routeResult.targetFiles.length > 0) {
694
- output.writeln();
695
- output.writeln(output.bold('Target Files:'));
696
- output.printList(routeResult.targetFiles.slice(0, 5).map(f => f.length > 60 ? '...' + f.slice(-57) : f));
697
- if (routeResult.targetFiles.length > 5) {
698
- output.writeln(output.dim(` ... and ${routeResult.targetFiles.length - 5} more`));
798
+ return [2 /*return*/, { success: true, data: result }];
799
+ case 6: return [4 /*yield*/, coverageRoute('', { threshold: threshold })];
800
+ case 7:
801
+ routeResult = _f.sent();
802
+ spinner.succeed('Coverage analysis complete');
803
+ if (jsonOutput) {
804
+ output.printJson(routeResult);
699
805
  }
700
- }
701
- if (routeResult.gaps.length > 0) {
702
- output.writeln();
703
- output.writeln(output.bold('Coverage Gaps:'));
704
- output.printTable({
705
- columns: [
706
- { key: 'file', header: 'File', width: 40 },
707
- { key: 'current', header: 'Current', width: 10, align: 'right' },
708
- { key: 'gap', header: 'Gap', width: 10, align: 'right' },
709
- ],
710
- data: routeResult.gaps.slice(0, 5).map(g => ({
711
- file: g.file.length > 38 ? '...' + g.file.slice(-35) : g.file,
712
- current: `${g.currentCoverage.toFixed(1)}%`,
713
- gap: `${g.gap.toFixed(1)}%`,
714
- })),
715
- });
716
- }
806
+ else {
807
+ output.writeln();
808
+ output.writeln(output.bold('Coverage-Aware Routing'));
809
+ output.writeln();
810
+ actionColors = {
811
+ 'add-tests': function (s) { return output.error(s); },
812
+ 'review-coverage': function (s) { return output.warning(s); },
813
+ 'prioritize': function (s) { return output.error(s); },
814
+ 'skip': function (s) { return output.success(s); }
815
+ };
816
+ colorFn = actionColors[routeResult.action] || (function (s) { return s; });
817
+ output.printBox([
818
+ "Action: " + colorFn(routeResult.action.toUpperCase()),
819
+ "Priority: " + routeResult.priority + "/10",
820
+ "Impact Score: " + routeResult.impactScore + "%",
821
+ "Estimated Effort: " + routeResult.estimatedEffort + " hours",
822
+ "",
823
+ "Test Types: " + routeResult.testTypes.join(', '),
824
+ "Target Files: " + routeResult.targetFiles.length,
825
+ ].join('\n'), 'Coverage Analysis');
826
+ if (routeResult.targetFiles.length > 0) {
827
+ output.writeln();
828
+ output.writeln(output.bold('Target Files:'));
829
+ output.printList(routeResult.targetFiles.slice(0, 5).map(function (f) {
830
+ return f.length > 60 ? '...' + f.slice(-57) : f;
831
+ }));
832
+ if (routeResult.targetFiles.length > 5) {
833
+ output.writeln(output.dim(" ... and " + (routeResult.targetFiles.length - 5) + " more"));
834
+ }
835
+ }
836
+ if (routeResult.gaps.length > 0) {
837
+ output.writeln();
838
+ output.writeln(output.bold('Coverage Gaps:'));
839
+ output.printTable({
840
+ columns: [
841
+ { key: 'file', header: 'File', width: 40 },
842
+ { key: 'current', header: 'Current', width: 10, align: 'right' },
843
+ { key: 'gap', header: 'Gap', width: 10, align: 'right' },
844
+ ],
845
+ data: routeResult.gaps.slice(0, 5).map(function (g) { return ({
846
+ file: g.file.length > 38 ? '...' + g.file.slice(-35) : g.file,
847
+ current: g.currentCoverage.toFixed(1) + "%",
848
+ gap: g.gap.toFixed(1) + "%"
849
+ }); })
850
+ });
851
+ }
852
+ }
853
+ return [2 /*return*/, { success: true, data: routeResult }];
854
+ case 8:
855
+ error_7 = _f.sent();
856
+ spinner.fail('Coverage analysis failed');
857
+ output.printError(error_7 instanceof Error ? error_7.message : String(error_7));
858
+ return [2 /*return*/, { success: false, exitCode: 1 }];
859
+ case 9: return [2 /*return*/];
717
860
  }
718
- return { success: true, data: routeResult };
719
- }
720
- catch (error) {
721
- spinner.fail('Coverage analysis failed');
722
- output.printError(error instanceof Error ? error.message : String(error));
723
- return { success: false, exitCode: 1 };
724
- }
725
- },
861
+ });
862
+ }); }
726
863
  };
727
864
  // ============================================================================
728
865
  // Main Route Command
729
866
  // ============================================================================
730
- export const routeCommand = {
867
+ export var routeCommand = {
731
868
  name: 'route',
732
869
  description: 'Intelligent task-to-agent routing using Q-Learning',
733
870
  subcommands: [
@@ -746,13 +883,13 @@ export const routeCommand = {
746
883
  short: 'q',
747
884
  description: 'Use Q-Learning for agent selection',
748
885
  type: 'boolean',
749
- default: true,
886
+ "default": true
750
887
  },
751
888
  {
752
889
  name: 'agent',
753
890
  short: 'a',
754
891
  description: 'Force specific agent',
755
- type: 'string',
892
+ type: 'string'
756
893
  },
757
894
  ],
758
895
  examples: [
@@ -762,52 +899,60 @@ export const routeCommand = {
762
899
  { command: 'claude-flow route list-agents', description: 'List available agents' },
763
900
  { command: 'claude-flow route stats', description: 'Show routing statistics' },
764
901
  ],
765
- action: async (ctx) => {
766
- // If task description provided directly, route it
767
- if (ctx.args.length > 0 && routeTaskCommand.action) {
768
- const result = await routeTaskCommand.action(ctx);
769
- if (result)
770
- return result;
771
- return { success: true };
772
- }
773
- // Show help
774
- output.writeln();
775
- output.writeln(output.bold('Q-Learning Agent Router'));
776
- output.writeln(output.dim('Intelligent task-to-agent routing using reinforcement learning'));
777
- output.writeln();
778
- output.writeln('Usage: claude-flow route <task> [options]');
779
- output.writeln(' claude-flow route <subcommand>');
780
- output.writeln();
781
- output.writeln(output.bold('Subcommands:'));
782
- output.printList([
783
- `${output.highlight('task')} - Route a task to optimal agent`,
784
- `${output.highlight('list-agents')} - List available agent types`,
785
- `${output.highlight('stats')} - Show router statistics`,
786
- `${output.highlight('feedback')} - Provide routing feedback`,
787
- `${output.highlight('reset')} - Reset router state`,
788
- `${output.highlight('export')} - Export Q-table`,
789
- `${output.highlight('import')} - Import Q-table`,
790
- ]);
791
- output.writeln();
792
- output.writeln(output.bold('How It Works:'));
793
- output.printList([
794
- 'Analyzes task description using hash-based state encoding',
795
- 'Uses Q-Learning to learn from routing outcomes',
796
- 'Epsilon-greedy exploration for continuous improvement',
797
- 'Provides confidence scores and alternatives',
798
- ]);
799
- output.writeln();
800
- // Show quick status
801
- const ruvectorAvailable = await isRuvectorAvailable();
802
- output.writeln(output.bold('Backend Status:'));
803
- output.printList([
804
- `RuVector: ${ruvectorAvailable ? output.success('Available') : output.warning('Fallback mode')}`,
805
- `Backend: ${ruvectorAvailable ? 'ruvector-native' : 'JavaScript fallback'}`,
806
- ]);
807
- output.writeln();
808
- output.writeln(output.dim('Run "claude-flow route <subcommand> --help" for more info'));
809
- return { success: true };
810
- },
902
+ action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
903
+ var result, ruvectorAvailable;
904
+ return __generator(this, function (_a) {
905
+ switch (_a.label) {
906
+ case 0:
907
+ if (!(ctx.args.length > 0 && routeTaskCommand.action)) return [3 /*break*/, 2];
908
+ return [4 /*yield*/, routeTaskCommand.action(ctx)];
909
+ case 1:
910
+ result = _a.sent();
911
+ if (result)
912
+ return [2 /*return*/, result];
913
+ return [2 /*return*/, { success: true }];
914
+ case 2:
915
+ // Show help
916
+ output.writeln();
917
+ output.writeln(output.bold('Q-Learning Agent Router'));
918
+ output.writeln(output.dim('Intelligent task-to-agent routing using reinforcement learning'));
919
+ output.writeln();
920
+ output.writeln('Usage: claude-flow route <task> [options]');
921
+ output.writeln(' claude-flow route <subcommand>');
922
+ output.writeln();
923
+ output.writeln(output.bold('Subcommands:'));
924
+ output.printList([
925
+ output.highlight('task') + " - Route a task to optimal agent",
926
+ output.highlight('list-agents') + " - List available agent types",
927
+ output.highlight('stats') + " - Show router statistics",
928
+ output.highlight('feedback') + " - Provide routing feedback",
929
+ output.highlight('reset') + " - Reset router state",
930
+ output.highlight('export') + " - Export Q-table",
931
+ output.highlight('import') + " - Import Q-table",
932
+ ]);
933
+ output.writeln();
934
+ output.writeln(output.bold('How It Works:'));
935
+ output.printList([
936
+ 'Analyzes task description using hash-based state encoding',
937
+ 'Uses Q-Learning to learn from routing outcomes',
938
+ 'Epsilon-greedy exploration for continuous improvement',
939
+ 'Provides confidence scores and alternatives',
940
+ ]);
941
+ output.writeln();
942
+ return [4 /*yield*/, isRuvectorAvailable()];
943
+ case 3:
944
+ ruvectorAvailable = _a.sent();
945
+ output.writeln(output.bold('Backend Status:'));
946
+ output.printList([
947
+ "RuVector: " + (ruvectorAvailable ? output.success('Available') : output.warning('Fallback mode')),
948
+ "Backend: " + (ruvectorAvailable ? 'ruvector-native' : 'JavaScript fallback'),
949
+ ]);
950
+ output.writeln();
951
+ output.writeln(output.dim('Run "claude-flow route <subcommand> --help" for more info'));
952
+ return [2 /*return*/, { success: true }];
953
+ }
954
+ });
955
+ }); }
811
956
  };
812
957
  export default routeCommand;
813
958
  //# sourceMappingURL=route.js.map