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
@@ -10,48 +10,12 @@
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
- };
49
13
  import { output } from '../output.js';
50
14
  import { createQLearningRouter, isRuvectorAvailable, } from '../ruvector/index.js';
51
15
  /**
52
16
  * Available agent types for routing
53
17
  */
54
- var AGENT_TYPES = [
18
+ const AGENT_TYPES = [
55
19
  { id: 'coder', name: 'Coder', description: 'Implements features and writes code', capabilities: ['coding', 'implementation', 'refactoring'], priority: 1 },
56
20
  { id: 'tester', name: 'Tester', description: 'Creates tests and validates functionality', capabilities: ['testing', 'validation', 'quality'], priority: 2 },
57
21
  { id: 'reviewer', name: 'Reviewer', description: 'Reviews code quality and security', capabilities: ['review', 'security', 'best-practices'], priority: 3 },
@@ -64,40 +28,31 @@ var AGENT_TYPES = [
64
28
  // ============================================================================
65
29
  // Router Singleton
66
30
  // ============================================================================
67
- var routerInstance = null;
68
- var routerInitialized = false;
31
+ let routerInstance = null;
32
+ let routerInitialized = false;
69
33
  /**
70
34
  * Get or create the router instance
71
35
  */
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
- });
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;
90
45
  }
91
46
  /**
92
47
  * Get agent type by route name
93
48
  */
94
49
  function getAgentType(route) {
95
- return AGENT_TYPES.find(function (a) { return a.id === route; });
50
+ return AGENT_TYPES.find(a => a.id === route);
96
51
  }
97
52
  // ============================================================================
98
53
  // Route Subcommand
99
54
  // ============================================================================
100
- var routeTaskCommand = {
55
+ const routeTaskCommand = {
101
56
  name: 'task',
102
57
  description: 'Route a task to the optimal agent using Q-Learning',
103
58
  options: [
@@ -106,27 +61,27 @@ var routeTaskCommand = {
106
61
  short: 'q',
107
62
  description: 'Use Q-Learning for agent selection (default: true)',
108
63
  type: 'boolean',
109
- "default": true
64
+ default: true,
110
65
  },
111
66
  {
112
67
  name: 'agent',
113
68
  short: 'a',
114
69
  description: 'Force specific agent (bypasses Q-Learning)',
115
- type: 'string'
70
+ type: 'string',
116
71
  },
117
72
  {
118
73
  name: 'explore',
119
74
  short: 'e',
120
75
  description: 'Enable exploration (random selection chance)',
121
76
  type: 'boolean',
122
- "default": true
77
+ default: true,
123
78
  },
124
79
  {
125
80
  name: 'json',
126
81
  short: 'j',
127
82
  description: 'Output in JSON format',
128
83
  type: 'boolean',
129
- "default": false
84
+ default: false,
130
85
  },
131
86
  ],
132
87
  examples: [
@@ -134,137 +89,123 @@ var routeTaskCommand = {
134
89
  { command: 'claude-flow route task "write unit tests" --q-learning', description: 'Use Q-Learning routing' },
135
90
  { command: 'claude-flow route task "review code" --agent reviewer', description: 'Force specific agent' },
136
91
  ],
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*/];
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
+ }
260
195
  }
261
- });
262
- }); }
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
+ },
263
204
  };
264
205
  // ============================================================================
265
206
  // List Agents Subcommand
266
207
  // ============================================================================
267
- var listAgentsCommand = {
208
+ const listAgentsCommand = {
268
209
  name: 'list-agents',
269
210
  aliases: ['agents', 'ls'],
270
211
  description: 'List all available agent types for routing',
@@ -274,57 +215,53 @@ var listAgentsCommand = {
274
215
  short: 'j',
275
216
  description: 'Output in JSON format',
276
217
  type: 'boolean',
277
- "default": false
218
+ default: false,
278
219
  },
279
220
  ],
280
221
  examples: [
281
222
  { command: 'claude-flow route list-agents', description: 'List all agents' },
282
223
  { command: 'claude-flow route agents --json', description: 'List agents as JSON' },
283
224
  ],
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 }];
225
+ action: async (ctx) => {
226
+ const jsonOutput = ctx.flags.json;
227
+ try {
228
+ if (jsonOutput) {
229
+ output.printJson(AGENT_TYPES);
315
230
  }
316
- catch (error) {
317
- output.printError(error instanceof Error ? error.message : String(error));
318
- return [2 /*return*/, { success: false, exitCode: 1 }];
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`));
319
252
  }
320
- return [2 /*return*/];
321
- });
322
- }); }
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
+ },
323
260
  };
324
261
  // ============================================================================
325
262
  // Stats Subcommand
326
263
  // ============================================================================
327
- var statsCommand = {
264
+ const statsCommand = {
328
265
  name: 'stats',
329
266
  description: 'Show Q-Learning router statistics',
330
267
  options: [
@@ -333,76 +270,64 @@ var statsCommand = {
333
270
  short: 'j',
334
271
  description: 'Output in JSON format',
335
272
  type: 'boolean',
336
- "default": false
273
+ default: false,
337
274
  },
338
275
  ],
339
276
  examples: [
340
277
  { command: 'claude-flow route stats', description: 'Show routing statistics' },
341
278
  ],
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*/];
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
+ ]);
398
318
  }
399
- });
400
- }); }
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
+ },
401
326
  };
402
327
  // ============================================================================
403
328
  // Feedback Subcommand
404
329
  // ============================================================================
405
- var feedbackCommand = {
330
+ const feedbackCommand = {
406
331
  name: 'feedback',
407
332
  description: 'Provide feedback on a routing decision',
408
333
  options: [
@@ -411,84 +336,75 @@ var feedbackCommand = {
411
336
  short: 't',
412
337
  description: 'Task description (context for learning)',
413
338
  type: 'string',
414
- required: true
339
+ required: true,
415
340
  },
416
341
  {
417
342
  name: 'agent',
418
343
  short: 'a',
419
344
  description: 'Agent that was used',
420
345
  type: 'string',
421
- required: true
346
+ required: true,
422
347
  },
423
348
  {
424
349
  name: 'reward',
425
350
  short: 'r',
426
351
  description: 'Reward value (-1 to 1, where 1 is best)',
427
352
  type: 'number',
428
- "default": 0.8
353
+ default: 0.8,
429
354
  },
430
355
  {
431
356
  name: 'next-task',
432
357
  short: 'n',
433
358
  description: 'Next task description (for multi-step learning)',
434
- type: 'string'
359
+ type: 'string',
435
360
  },
436
361
  ],
437
362
  examples: [
438
363
  { command: 'claude-flow route feedback -t "implement auth" -a coder -r 0.9', description: 'Positive feedback' },
439
364
  { command: 'claude-flow route feedback -t "write tests" -a tester -r -0.5', description: 'Negative feedback' },
440
365
  ],
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
- }); }
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
+ },
487
403
  };
488
404
  // ============================================================================
489
405
  // Reset Subcommand
490
406
  // ============================================================================
491
- var resetCommand = {
407
+ const resetCommand = {
492
408
  name: 'reset',
493
409
  description: 'Reset the Q-Learning router state',
494
410
  options: [
@@ -497,46 +413,36 @@ var resetCommand = {
497
413
  short: 'f',
498
414
  description: 'Force reset without confirmation',
499
415
  type: 'boolean',
500
- "default": false
416
+ default: false,
501
417
  },
502
418
  ],
503
419
  examples: [
504
420
  { command: 'claude-flow route reset', description: 'Reset router state' },
505
421
  { command: 'claude-flow route reset --force', description: 'Force reset' },
506
422
  ],
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
- }); }
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
+ },
535
441
  };
536
442
  // ============================================================================
537
443
  // Export/Import Subcommands
538
444
  // ============================================================================
539
- var exportCommand = {
445
+ const exportCommand = {
540
446
  name: 'export',
541
447
  description: 'Export Q-table for persistence',
542
448
  options: [
@@ -544,49 +450,35 @@ var exportCommand = {
544
450
  name: 'file',
545
451
  short: 'f',
546
452
  description: 'Output file path (outputs to stdout if not specified)',
547
- type: 'string'
453
+ type: 'string',
548
454
  },
549
455
  ],
550
456
  examples: [
551
457
  { command: 'claude-flow route export', description: 'Export Q-table to stdout' },
552
458
  { command: 'claude-flow route export -f qtable.json', description: 'Export to file' },
553
459
  ],
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*/];
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);
585
472
  }
586
- });
587
- }); }
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
+ },
588
480
  };
589
- var importCommand = {
481
+ const importCommand = {
590
482
  name: 'import',
591
483
  description: 'Import Q-table from file',
592
484
  options: [
@@ -595,52 +487,38 @@ var importCommand = {
595
487
  short: 'f',
596
488
  description: 'Input file path',
597
489
  type: 'string',
598
- required: true
490
+ required: true,
599
491
  },
600
492
  ],
601
493
  examples: [
602
494
  { command: 'claude-flow route import -f qtable.json', description: 'Import Q-table from file' },
603
495
  ],
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
- }); }
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
+ },
639
517
  };
640
518
  // ============================================================================
641
519
  // Coverage-Aware Routing Subcommand
642
520
  // ============================================================================
643
- var coverageRouteCommand = {
521
+ const coverageRouteCommand = {
644
522
  name: 'coverage',
645
523
  aliases: ['cov'],
646
524
  description: 'Route tasks based on test coverage analysis (ADR-017)',
@@ -649,35 +527,35 @@ var coverageRouteCommand = {
649
527
  name: 'path',
650
528
  short: 'p',
651
529
  description: 'Path to analyze for coverage',
652
- type: 'string'
530
+ type: 'string',
653
531
  },
654
532
  {
655
533
  name: 'threshold',
656
534
  short: 't',
657
535
  description: 'Coverage threshold percentage (default: 80)',
658
536
  type: 'number',
659
- "default": 80
537
+ default: 80,
660
538
  },
661
539
  {
662
540
  name: 'suggest',
663
541
  short: 's',
664
542
  description: 'Get suggestions for improving coverage',
665
543
  type: 'boolean',
666
- "default": false
544
+ default: false,
667
545
  },
668
546
  {
669
547
  name: 'gaps',
670
548
  short: 'g',
671
549
  description: 'List coverage gaps with agent assignments',
672
550
  type: 'boolean',
673
- "default": false
551
+ default: false,
674
552
  },
675
553
  {
676
554
  name: 'json',
677
555
  short: 'j',
678
556
  description: 'Output in JSON format',
679
557
  type: 'boolean',
680
- "default": false
558
+ default: false,
681
559
  },
682
560
  ],
683
561
  examples: [
@@ -686,185 +564,170 @@ var coverageRouteCommand = {
686
564
  { command: 'claude-flow route coverage --gaps', description: 'List coverage gaps by agent' },
687
565
  { command: 'claude-flow route coverage -p src/auth -t 90', description: 'Analyze specific path with threshold' },
688
566
  ],
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);
714
- }
715
- else {
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();
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}`);
732
595
  }
596
+ if (files.length > 5) {
597
+ output.writeln(output.dim(` ... and ${files.length - 5} more`));
598
+ }
599
+ output.writeln();
733
600
  }
734
- else {
735
- output.printSuccess('No coverage gaps found!');
736
- }
737
- output.writeln();
738
- output.writeln(output.bold('Top Gaps:'));
739
- output.printTable({
740
- columns: [
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 },
745
- ],
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
- }); })
752
- });
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
601
  }
764
602
  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"));
775
- output.writeln();
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
- }
796
- }
603
+ output.printSuccess('No coverage gaps found!');
797
604
  }
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);
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!');
805
638
  }
806
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`)}`);
807
642
  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) {
643
+ output.printTable({
644
+ 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' },
649
+ ],
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
+ })),
656
+ });
657
+ // Show test suggestions for top file
658
+ if (result.suggestions.length > 0 && result.suggestions[0].suggestedTests.length > 0) {
837
659
  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
- });
660
+ output.writeln(output.bold('Suggested Tests for Top Priority File:'));
661
+ output.printList(result.suggestions[0].suggestedTests);
851
662
  }
852
663
  }
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*/];
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`));
699
+ }
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
+ }
860
717
  }
861
- });
862
- }); }
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
+ },
863
726
  };
864
727
  // ============================================================================
865
728
  // Main Route Command
866
729
  // ============================================================================
867
- export var routeCommand = {
730
+ export const routeCommand = {
868
731
  name: 'route',
869
732
  description: 'Intelligent task-to-agent routing using Q-Learning',
870
733
  subcommands: [
@@ -883,13 +746,13 @@ export var routeCommand = {
883
746
  short: 'q',
884
747
  description: 'Use Q-Learning for agent selection',
885
748
  type: 'boolean',
886
- "default": true
749
+ default: true,
887
750
  },
888
751
  {
889
752
  name: 'agent',
890
753
  short: 'a',
891
754
  description: 'Force specific agent',
892
- type: 'string'
755
+ type: 'string',
893
756
  },
894
757
  ],
895
758
  examples: [
@@ -899,60 +762,52 @@ export var routeCommand = {
899
762
  { command: 'claude-flow route list-agents', description: 'List available agents' },
900
763
  { command: 'claude-flow route stats', description: 'Show routing statistics' },
901
764
  ],
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
- }); }
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
+ },
956
811
  };
957
812
  export default routeCommand;
958
813
  //# sourceMappingURL=route.js.map