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.
- package/dist/src/appliance/gguf-engine.d.ts +91 -0
- package/dist/src/appliance/gguf-engine.d.ts.map +1 -0
- package/dist/src/appliance/gguf-engine.js +286 -525
- package/dist/src/appliance/gguf-engine.js.map +1 -1
- package/dist/src/appliance/ruvllm-bridge.d.ts +102 -0
- package/dist/src/appliance/ruvllm-bridge.d.ts.map +1 -0
- package/dist/src/appliance/ruvllm-bridge.js +203 -403
- package/dist/src/appliance/ruvllm-bridge.js.map +1 -1
- package/dist/src/appliance/rvfa-builder.d.ts +44 -0
- package/dist/src/appliance/rvfa-builder.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-builder.js +154 -208
- package/dist/src/appliance/rvfa-builder.js.map +1 -1
- package/dist/src/appliance/rvfa-distribution.d.ts +97 -0
- package/dist/src/appliance/rvfa-distribution.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-distribution.js +260 -423
- package/dist/src/appliance/rvfa-distribution.js.map +1 -1
- package/dist/src/appliance/rvfa-format.d.ts +111 -0
- package/dist/src/appliance/rvfa-format.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-format.js +128 -200
- package/dist/src/appliance/rvfa-format.js.map +1 -1
- package/dist/src/appliance/rvfa-runner.d.ts +69 -0
- package/dist/src/appliance/rvfa-runner.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-runner.js +168 -304
- package/dist/src/appliance/rvfa-runner.js.map +1 -1
- package/dist/src/appliance/rvfa-signing.d.ts +123 -0
- package/dist/src/appliance/rvfa-signing.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-signing.js +173 -295
- package/dist/src/appliance/rvfa-signing.js.map +1 -1
- package/dist/src/benchmarks/pretrain/index.d.ts +58 -0
- package/dist/src/benchmarks/pretrain/index.d.ts.map +1 -0
- package/dist/src/benchmarks/pretrain/index.js +331 -542
- package/dist/src/benchmarks/pretrain/index.js.map +1 -1
- package/dist/src/commands/agent.js +574 -697
- package/dist/src/commands/agent.js.map +1 -1
- package/dist/src/commands/analyze.js +1218 -1548
- package/dist/src/commands/analyze.js.map +1 -1
- package/dist/src/commands/appliance-advanced.js +158 -267
- package/dist/src/commands/appliance-advanced.js.map +1 -1
- package/dist/src/commands/appliance.js +318 -493
- package/dist/src/commands/appliance.js.map +1 -1
- package/dist/src/commands/benchmark.js +372 -523
- package/dist/src/commands/benchmark.js.map +1 -1
- package/dist/src/commands/claims.js +274 -364
- package/dist/src/commands/claims.js.map +1 -1
- package/dist/src/commands/cleanup.js +113 -157
- package/dist/src/commands/cleanup.js.map +1 -1
- package/dist/src/commands/completions.js +477 -118
- package/dist/src/commands/completions.js.map +1 -1
- package/dist/src/commands/config.js +237 -303
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/daemon.js +487 -596
- package/dist/src/commands/daemon.js.map +1 -1
- package/dist/src/commands/deployment.js +194 -275
- package/dist/src/commands/deployment.js.map +1 -1
- package/dist/src/commands/doctor.js +504 -686
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/src/commands/embeddings.js +1293 -1543
- package/dist/src/commands/embeddings.js.map +1 -1
- package/dist/src/commands/guidance.js +449 -596
- package/dist/src/commands/guidance.js.map +1 -1
- package/dist/src/commands/hive-mind.js +854 -938
- package/dist/src/commands/hive-mind.js.map +1 -1
- package/dist/src/commands/hooks.js +3112 -3519
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/index.d.ts +115 -0
- package/dist/src/commands/index.d.ts.map +1 -0
- package/dist/src/commands/index.js +126 -308
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/init.js +788 -940
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/issues.js +383 -558
- package/dist/src/commands/issues.js.map +1 -1
- package/dist/src/commands/mcp.js +493 -605
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/memory.js +833 -1026
- package/dist/src/commands/memory.js.map +1 -1
- package/dist/src/commands/migrate.js +282 -347
- package/dist/src/commands/migrate.js.map +1 -1
- package/dist/src/commands/neural.js +1289 -1563
- package/dist/src/commands/neural.js.map +1 -1
- package/dist/src/commands/performance.js +497 -643
- package/dist/src/commands/performance.js.map +1 -1
- package/dist/src/commands/plugins.js +668 -841
- package/dist/src/commands/plugins.js.map +1 -1
- package/dist/src/commands/process.js +392 -447
- package/dist/src/commands/process.js.map +1 -1
- package/dist/src/commands/progress.js +162 -256
- package/dist/src/commands/progress.js.map +1 -1
- package/dist/src/commands/providers.js +150 -220
- package/dist/src/commands/providers.js.map +1 -1
- package/dist/src/commands/route.js +520 -665
- package/dist/src/commands/route.js.map +1 -1
- package/dist/src/commands/ruvector/backup.js +505 -651
- package/dist/src/commands/ruvector/backup.js.map +1 -1
- package/dist/src/commands/ruvector/benchmark.js +349 -401
- package/dist/src/commands/ruvector/benchmark.js.map +1 -1
- package/dist/src/commands/ruvector/import.js +224 -266
- package/dist/src/commands/ruvector/import.js.map +1 -1
- package/dist/src/commands/ruvector/index.js +37 -75
- package/dist/src/commands/ruvector/index.js.map +1 -1
- package/dist/src/commands/ruvector/init.js +336 -359
- package/dist/src/commands/ruvector/init.js.map +1 -1
- package/dist/src/commands/ruvector/migrate.js +335 -322
- package/dist/src/commands/ruvector/migrate.js.map +1 -1
- package/dist/src/commands/ruvector/optimize.js +375 -431
- package/dist/src/commands/ruvector/optimize.js.map +1 -1
- package/dist/src/commands/ruvector/setup.js +703 -117
- package/dist/src/commands/ruvector/setup.js.map +1 -1
- package/dist/src/commands/ruvector/status.js +364 -419
- package/dist/src/commands/ruvector/status.js.map +1 -1
- package/dist/src/commands/security.js +485 -608
- package/dist/src/commands/security.js.map +1 -1
- package/dist/src/commands/session.js +504 -626
- package/dist/src/commands/session.js.map +1 -1
- package/dist/src/commands/start.js +267 -364
- package/dist/src/commands/start.js.map +1 -1
- package/dist/src/commands/status.js +380 -486
- package/dist/src/commands/status.js.map +1 -1
- package/dist/src/commands/swarm.js +408 -488
- package/dist/src/commands/swarm.js.map +1 -1
- package/dist/src/commands/task.js +423 -538
- package/dist/src/commands/task.js.map +1 -1
- package/dist/src/commands/transfer-store.js +322 -412
- package/dist/src/commands/transfer-store.js.map +1 -1
- package/dist/src/commands/update.js +196 -291
- package/dist/src/commands/update.js.map +1 -1
- package/dist/src/commands/workflow.js +386 -486
- package/dist/src/commands/workflow.js.map +1 -1
- package/dist/src/config-adapter.d.ts +15 -0
- package/dist/src/config-adapter.d.ts.map +1 -0
- package/dist/src/config-adapter.js +38 -39
- package/dist/src/config-adapter.js.map +1 -1
- package/dist/src/index.d.ts +77 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +309 -411
- package/dist/src/index.js.map +1 -1
- package/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
- package/dist/src/infrastructure/in-memory-repositories.d.ts.map +1 -0
- package/dist/src/infrastructure/in-memory-repositories.js +246 -507
- package/dist/src/infrastructure/in-memory-repositories.js.map +1 -1
- package/dist/src/init/claudemd-generator.d.ts +25 -0
- package/dist/src/init/claudemd-generator.d.ts.map +1 -0
- package/dist/src/init/claudemd-generator.js +368 -78
- package/dist/src/init/claudemd-generator.js.map +1 -1
- package/dist/src/init/executor.d.ts +41 -0
- package/dist/src/init/executor.d.ts.map +1 -0
- package/dist/src/init/executor.js +1307 -996
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/helpers-generator.d.ts +60 -0
- package/dist/src/init/helpers-generator.d.ts.map +1 -0
- package/dist/src/init/helpers-generator.js +657 -12
- package/dist/src/init/helpers-generator.js.map +1 -1
- package/dist/src/init/index.d.ts +1 -1
- package/dist/src/init/index.d.ts.map +1 -1
- package/dist/src/init/index.js +1 -1
- package/dist/src/init/index.js.map +1 -1
- package/dist/src/init/mcp-generator.js +33 -37
- package/dist/src/init/mcp-generator.js.map +1 -1
- package/dist/src/init/settings-generator.js +76 -77
- package/dist/src/init/settings-generator.js.map +1 -1
- package/dist/src/init/statusline-generator.js +801 -3
- package/dist/src/init/statusline-generator.js.map +1 -1
- package/dist/src/init/types.d.ts +1 -1
- package/dist/src/init/types.d.ts.map +1 -1
- package/dist/src/init/types.js +76 -59
- package/dist/src/init/types.js.map +1 -1
- package/dist/src/mcp-client.d.ts +92 -0
- package/dist/src/mcp-client.d.ts.map +1 -0
- package/dist/src/mcp-client.js +81 -125
- package/dist/src/mcp-client.js.map +1 -1
- package/dist/src/mcp-server.d.ts +161 -0
- package/dist/src/mcp-server.d.ts.map +1 -0
- package/dist/src/mcp-server.js +470 -757
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +391 -492
- package/dist/src/mcp-tools/agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/agentdb-tools.js +332 -533
- package/dist/src/mcp-tools/agentdb-tools.js.map +1 -1
- package/dist/src/mcp-tools/analyze-tools.js +172 -236
- package/dist/src/mcp-tools/analyze-tools.js.map +1 -1
- package/dist/src/mcp-tools/auto-install.d.ts +83 -0
- package/dist/src/mcp-tools/auto-install.d.ts.map +1 -0
- package/dist/src/mcp-tools/auto-install.js +80 -142
- package/dist/src/mcp-tools/auto-install.js.map +1 -1
- package/dist/src/mcp-tools/browser-tools.js +252 -375
- package/dist/src/mcp-tools/browser-tools.js.map +1 -1
- package/dist/src/mcp-tools/claims-tools.js +473 -565
- package/dist/src/mcp-tools/claims-tools.js.map +1 -1
- package/dist/src/mcp-tools/config-tools.js +197 -272
- package/dist/src/mcp-tools/config-tools.js.map +1 -1
- package/dist/src/mcp-tools/coordination-tools.js +500 -572
- package/dist/src/mcp-tools/coordination-tools.js.map +1 -1
- package/dist/src/mcp-tools/daa-tools.js +286 -364
- package/dist/src/mcp-tools/daa-tools.js.map +1 -1
- package/dist/src/mcp-tools/embeddings-tools.js +582 -693
- package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
- package/dist/src/mcp-tools/github-tools.js +260 -311
- package/dist/src/mcp-tools/github-tools.js.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.js +573 -640
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +2215 -2648
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/mcp-tools/memory-tools.js +350 -505
- package/dist/src/mcp-tools/memory-tools.js.map +1 -1
- package/dist/src/mcp-tools/neural-tools.js +315 -412
- package/dist/src/mcp-tools/neural-tools.js.map +1 -1
- package/dist/src/mcp-tools/performance-tools.js +420 -480
- package/dist/src/mcp-tools/performance-tools.js.map +1 -1
- package/dist/src/mcp-tools/progress-tools.js +204 -278
- package/dist/src/mcp-tools/progress-tools.js.map +1 -1
- package/dist/src/mcp-tools/ruvllm-tools.js +163 -279
- package/dist/src/mcp-tools/ruvllm-tools.js.map +1 -1
- package/dist/src/mcp-tools/security-tools.js +297 -429
- package/dist/src/mcp-tools/security-tools.js.map +1 -1
- package/dist/src/mcp-tools/session-tools.js +185 -234
- package/dist/src/mcp-tools/session-tools.js.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.js +207 -260
- package/dist/src/mcp-tools/swarm-tools.js.map +1 -1
- package/dist/src/mcp-tools/system-tools.js +276 -325
- package/dist/src/mcp-tools/system-tools.js.map +1 -1
- package/dist/src/mcp-tools/task-tools.js +270 -336
- package/dist/src/mcp-tools/task-tools.js.map +1 -1
- package/dist/src/mcp-tools/terminal-tools.js +148 -196
- package/dist/src/mcp-tools/terminal-tools.js.map +1 -1
- package/dist/src/mcp-tools/transfer-tools.js +186 -333
- package/dist/src/mcp-tools/transfer-tools.js.map +1 -1
- package/dist/src/mcp-tools/types.d.ts +31 -0
- package/dist/src/mcp-tools/types.d.ts.map +1 -0
- package/dist/src/mcp-tools/wasm-agent-tools.js +133 -280
- package/dist/src/mcp-tools/wasm-agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/workflow-tools.js +405 -450
- package/dist/src/mcp-tools/workflow-tools.js.map +1 -1
- package/dist/src/memory/ewc-consolidation.d.ts +295 -0
- package/dist/src/memory/ewc-consolidation.d.ts.map +1 -0
- package/dist/src/memory/ewc-consolidation.js +190 -303
- package/dist/src/memory/ewc-consolidation.js.map +1 -1
- package/dist/src/memory/intelligence.d.ts +338 -0
- package/dist/src/memory/intelligence.d.ts.map +1 -0
- package/dist/src/memory/intelligence.js +569 -794
- package/dist/src/memory/intelligence.js.map +1 -1
- package/dist/src/memory/memory-bridge.d.ts +407 -0
- package/dist/src/memory/memory-bridge.d.ts.map +1 -0
- package/dist/src/memory/memory-bridge.js +1170 -1640
- package/dist/src/memory/memory-bridge.js.map +1 -1
- package/dist/src/memory/memory-initializer.d.ts +412 -0
- package/dist/src/memory/memory-initializer.d.ts.map +1 -0
- package/dist/src/memory/memory-initializer.js +1836 -1851
- package/dist/src/memory/memory-initializer.js.map +1 -1
- package/dist/src/memory/sona-optimizer.d.ts +227 -0
- package/dist/src/memory/sona-optimizer.d.ts.map +1 -0
- package/dist/src/memory/sona-optimizer.js +199 -329
- package/dist/src/memory/sona-optimizer.js.map +1 -1
- package/dist/src/output.d.ts +2 -2
- package/dist/src/output.d.ts.map +1 -1
- package/dist/src/output.js +242 -272
- package/dist/src/output.js.map +1 -1
- package/dist/src/parser.d.ts +51 -0
- package/dist/src/parser.d.ts.map +1 -0
- package/dist/src/parser.js +140 -187
- package/dist/src/parser.js.map +1 -1
- package/dist/src/plugins/manager.d.ts +133 -0
- package/dist/src/plugins/manager.d.ts.map +1 -0
- package/dist/src/plugins/manager.js +285 -521
- package/dist/src/plugins/manager.js.map +1 -1
- package/dist/src/plugins/store/discovery.d.ts +88 -0
- package/dist/src/plugins/store/discovery.d.ts.map +1 -0
- package/dist/src/plugins/store/discovery.js +271 -358
- package/dist/src/plugins/store/discovery.js.map +1 -1
- package/dist/src/plugins/store/index.d.ts +76 -0
- package/dist/src/plugins/store/index.d.ts.map +1 -0
- package/dist/src/plugins/store/index.js +48 -105
- package/dist/src/plugins/store/index.js.map +1 -1
- package/dist/src/plugins/store/search.d.ts +46 -0
- package/dist/src/plugins/store/search.d.ts.map +1 -0
- package/dist/src/plugins/store/search.js +69 -107
- package/dist/src/plugins/store/search.js.map +1 -1
- package/dist/src/plugins/store/types.d.ts +274 -0
- package/dist/src/plugins/store/types.d.ts.map +1 -0
- package/dist/src/plugins/tests/demo-plugin-store.js +113 -160
- package/dist/src/plugins/tests/demo-plugin-store.js.map +1 -1
- package/dist/src/plugins/tests/standalone-test.js +172 -223
- package/dist/src/plugins/tests/standalone-test.js.map +1 -1
- package/dist/src/plugins/tests/test-plugin-store.js +190 -228
- package/dist/src/plugins/tests/test-plugin-store.js.map +1 -1
- package/dist/src/production/circuit-breaker.d.ts +101 -0
- package/dist/src/production/circuit-breaker.d.ts.map +1 -0
- package/dist/src/production/circuit-breaker.js +62 -126
- package/dist/src/production/circuit-breaker.js.map +1 -1
- package/dist/src/production/error-handler.d.ts +92 -0
- package/dist/src/production/error-handler.d.ts.map +1 -0
- package/dist/src/production/error-handler.js +86 -156
- package/dist/src/production/error-handler.js.map +1 -1
- package/dist/src/production/monitoring.d.ts +161 -0
- package/dist/src/production/monitoring.d.ts.map +1 -0
- package/dist/src/production/monitoring.js +139 -220
- package/dist/src/production/monitoring.js.map +1 -1
- package/dist/src/production/rate-limiter.d.ts +80 -0
- package/dist/src/production/rate-limiter.d.ts.map +1 -0
- package/dist/src/production/rate-limiter.js +74 -93
- package/dist/src/production/rate-limiter.js.map +1 -1
- package/dist/src/production/retry.d.ts +48 -0
- package/dist/src/production/retry.d.ts.map +1 -0
- package/dist/src/production/retry.js +75 -167
- package/dist/src/production/retry.js.map +1 -1
- package/dist/src/prompt.d.ts +44 -0
- package/dist/src/prompt.d.ts.map +1 -0
- package/dist/src/prompt.js +436 -560
- package/dist/src/prompt.js.map +1 -1
- package/dist/src/runtime/headless.d.ts +60 -0
- package/dist/src/runtime/headless.d.ts.map +1 -0
- package/dist/src/runtime/headless.js +197 -286
- package/dist/src/runtime/headless.js.map +1 -1
- package/dist/src/ruvector/agent-wasm.d.ts +182 -0
- package/dist/src/ruvector/agent-wasm.d.ts.map +1 -0
- package/dist/src/ruvector/agent-wasm.js +156 -351
- package/dist/src/ruvector/agent-wasm.js.map +1 -1
- package/dist/src/ruvector/ast-analyzer.d.ts +67 -0
- package/dist/src/ruvector/ast-analyzer.d.ts.map +1 -0
- package/dist/src/ruvector/ast-analyzer.js +145 -232
- package/dist/src/ruvector/ast-analyzer.js.map +1 -1
- package/dist/src/ruvector/coverage-router.d.ts +160 -0
- package/dist/src/ruvector/coverage-router.d.ts.map +1 -0
- package/dist/src/ruvector/coverage-router.js +287 -419
- package/dist/src/ruvector/coverage-router.js.map +1 -1
- package/dist/src/ruvector/coverage-tools.js +56 -101
- package/dist/src/ruvector/coverage-tools.js.map +1 -1
- package/dist/src/ruvector/diff-classifier.d.ts +175 -0
- package/dist/src/ruvector/diff-classifier.d.ts.map +1 -0
- package/dist/src/ruvector/diff-classifier.js +324 -451
- package/dist/src/ruvector/diff-classifier.js.map +1 -1
- package/dist/src/ruvector/enhanced-model-router.d.ts +146 -0
- package/dist/src/ruvector/enhanced-model-router.d.ts.map +1 -0
- package/dist/src/ruvector/enhanced-model-router.js +260 -336
- package/dist/src/ruvector/enhanced-model-router.js.map +1 -1
- package/dist/src/ruvector/flash-attention.d.ts +195 -0
- package/dist/src/ruvector/flash-attention.d.ts.map +1 -0
- package/dist/src/ruvector/flash-attention.js +223 -254
- package/dist/src/ruvector/flash-attention.js.map +1 -1
- package/dist/src/ruvector/graph-analyzer.d.ts +187 -0
- package/dist/src/ruvector/graph-analyzer.d.ts.map +1 -0
- package/dist/src/ruvector/graph-analyzer.js +486 -680
- package/dist/src/ruvector/graph-analyzer.js.map +1 -1
- package/dist/src/ruvector/index.d.ts +40 -0
- package/dist/src/ruvector/index.d.ts.map +1 -0
- package/dist/src/ruvector/index.js +36 -106
- package/dist/src/ruvector/index.js.map +1 -1
- package/dist/src/ruvector/lora-adapter.d.ts +218 -0
- package/dist/src/ruvector/lora-adapter.d.ts.map +1 -0
- package/dist/src/ruvector/lora-adapter.js +155 -248
- package/dist/src/ruvector/lora-adapter.js.map +1 -1
- package/dist/src/ruvector/model-router.d.ts +220 -0
- package/dist/src/ruvector/model-router.d.ts.map +1 -0
- package/dist/src/ruvector/model-router.js +175 -248
- package/dist/src/ruvector/model-router.js.map +1 -1
- package/dist/src/ruvector/moe-router.d.ts +206 -0
- package/dist/src/ruvector/moe-router.d.ts.map +1 -0
- package/dist/src/ruvector/moe-router.js +228 -286
- package/dist/src/ruvector/moe-router.js.map +1 -1
- package/dist/src/ruvector/q-learning-router.d.ts +211 -0
- package/dist/src/ruvector/q-learning-router.d.ts.map +1 -0
- package/dist/src/ruvector/q-learning-router.js +257 -338
- package/dist/src/ruvector/q-learning-router.js.map +1 -1
- package/dist/src/ruvector/ruvllm-wasm.d.ts +179 -0
- package/dist/src/ruvector/ruvllm-wasm.d.ts.map +1 -0
- package/dist/src/ruvector/ruvllm-wasm.js +270 -434
- package/dist/src/ruvector/ruvllm-wasm.js.map +1 -1
- package/dist/src/ruvector/semantic-router.d.ts +77 -0
- package/dist/src/ruvector/semantic-router.d.ts.map +1 -0
- package/dist/src/ruvector/semantic-router.js +60 -67
- package/dist/src/ruvector/semantic-router.js.map +1 -1
- package/dist/src/ruvector/vector-db.d.ts +69 -0
- package/dist/src/ruvector/vector-db.d.ts.map +1 -0
- package/dist/src/ruvector/vector-db.js +119 -205
- package/dist/src/ruvector/vector-db.js.map +1 -1
- package/dist/src/services/agentic-flow-bridge.d.ts +50 -0
- package/dist/src/services/agentic-flow-bridge.d.ts.map +1 -0
- package/dist/src/services/agentic-flow-bridge.js +32 -105
- package/dist/src/services/agentic-flow-bridge.js.map +1 -1
- package/dist/src/services/claim-service.d.ts +204 -0
- package/dist/src/services/claim-service.d.ts.map +1 -0
- package/dist/src/services/claim-service.js +615 -940
- package/dist/src/services/claim-service.js.map +1 -1
- package/dist/src/services/container-worker-pool.d.ts +197 -0
- package/dist/src/services/container-worker-pool.d.ts.map +1 -0
- package/dist/src/services/container-worker-pool.js +398 -666
- package/dist/src/services/container-worker-pool.js.map +1 -1
- package/dist/src/services/headless-worker-executor.d.ts +304 -0
- package/dist/src/services/headless-worker-executor.d.ts.map +1 -0
- package/dist/src/services/headless-worker-executor.js +441 -467
- package/dist/src/services/headless-worker-executor.js.map +1 -1
- package/dist/src/services/index.d.ts +4 -4
- package/dist/src/services/index.d.ts.map +1 -1
- package/dist/src/services/index.js +4 -4
- package/dist/src/services/index.js.map +1 -1
- package/dist/src/services/registry-api.d.ts +58 -0
- package/dist/src/services/registry-api.d.ts.map +1 -0
- package/dist/src/services/registry-api.js +92 -200
- package/dist/src/services/registry-api.js.map +1 -1
- package/dist/src/services/ruvector-training.d.ts +222 -0
- package/dist/src/services/ruvector-training.d.ts.map +1 -0
- package/dist/src/services/ruvector-training.js +257 -337
- package/dist/src/services/ruvector-training.js.map +1 -1
- package/dist/src/services/worker-daemon.d.ts +228 -0
- package/dist/src/services/worker-daemon.d.ts.map +1 -0
- package/dist/src/services/worker-daemon.js +591 -849
- package/dist/src/services/worker-daemon.js.map +1 -1
- package/dist/src/services/worker-queue.d.ts +194 -0
- package/dist/src/services/worker-queue.d.ts.map +1 -0
- package/dist/src/services/worker-queue.js +331 -548
- package/dist/src/services/worker-queue.js.map +1 -1
- package/dist/src/suggest.d.ts +53 -0
- package/dist/src/suggest.d.ts.map +1 -0
- package/dist/src/suggest.js +45 -55
- package/dist/src/suggest.js.map +1 -1
- package/dist/src/transfer/anonymization/index.js +29 -37
- package/dist/src/transfer/anonymization/index.js.map +1 -1
- package/dist/src/transfer/deploy-seraphine.js +128 -155
- package/dist/src/transfer/deploy-seraphine.js.map +1 -1
- package/dist/src/transfer/export.d.ts +25 -0
- package/dist/src/transfer/export.d.ts.map +1 -0
- package/dist/src/transfer/export.js +84 -142
- package/dist/src/transfer/export.js.map +1 -1
- package/dist/src/transfer/index.d.ts +1 -1
- package/dist/src/transfer/index.d.ts.map +1 -1
- package/dist/src/transfer/index.js +0 -2
- package/dist/src/transfer/index.js.map +1 -1
- package/dist/src/transfer/ipfs/client.d.ts +109 -0
- package/dist/src/transfer/ipfs/client.d.ts.map +1 -0
- package/dist/src/transfer/ipfs/client.js +187 -337
- package/dist/src/transfer/ipfs/client.js.map +1 -1
- package/dist/src/transfer/ipfs/upload.d.ts +95 -0
- package/dist/src/transfer/ipfs/upload.d.ts.map +1 -0
- package/dist/src/transfer/ipfs/upload.js +288 -434
- package/dist/src/transfer/ipfs/upload.js.map +1 -1
- package/dist/src/transfer/models/seraphine.d.ts +72 -0
- package/dist/src/transfer/models/seraphine.d.ts.map +1 -0
- package/dist/src/transfer/models/seraphine.js +55 -55
- package/dist/src/transfer/models/seraphine.js.map +1 -1
- package/dist/src/transfer/serialization/cfp.d.ts +49 -0
- package/dist/src/transfer/serialization/cfp.d.ts.map +1 -0
- package/dist/src/transfer/serialization/cfp.js +30 -31
- package/dist/src/transfer/serialization/cfp.js.map +1 -1
- package/dist/src/transfer/storage/gcs.d.ts +82 -0
- package/dist/src/transfer/storage/gcs.d.ts.map +1 -0
- package/dist/src/transfer/storage/gcs.js +165 -232
- package/dist/src/transfer/storage/gcs.js.map +1 -1
- package/dist/src/transfer/store/discovery.d.ts +84 -0
- package/dist/src/transfer/store/discovery.d.ts.map +1 -0
- package/dist/src/transfer/store/discovery.js +239 -349
- package/dist/src/transfer/store/discovery.js.map +1 -1
- package/dist/src/transfer/store/download.d.ts +70 -0
- package/dist/src/transfer/store/download.d.ts.map +1 -0
- package/dist/src/transfer/store/download.js +243 -365
- package/dist/src/transfer/store/download.js.map +1 -1
- package/dist/src/transfer/store/index.d.ts +84 -0
- package/dist/src/transfer/store/index.d.ts.map +1 -0
- package/dist/src/transfer/store/index.js +63 -130
- package/dist/src/transfer/store/index.js.map +1 -1
- package/dist/src/transfer/store/publish.d.ts +76 -0
- package/dist/src/transfer/store/publish.d.ts.map +1 -0
- package/dist/src/transfer/store/publish.js +184 -258
- package/dist/src/transfer/store/publish.js.map +1 -1
- package/dist/src/transfer/store/registry.js +50 -72
- package/dist/src/transfer/store/registry.js.map +1 -1
- package/dist/src/transfer/store/search.d.ts +54 -0
- package/dist/src/transfer/store/search.d.ts.map +1 -0
- package/dist/src/transfer/store/search.js +64 -96
- package/dist/src/transfer/store/search.js.map +1 -1
- package/dist/src/transfer/store/tests/standalone-test.js +174 -231
- package/dist/src/transfer/store/tests/standalone-test.js.map +1 -1
- package/dist/src/transfer/test-seraphine.js +95 -130
- package/dist/src/transfer/test-seraphine.js.map +1 -1
- package/dist/src/transfer/tests/test-store.js +194 -239
- package/dist/src/transfer/tests/test-store.js.map +1 -1
- package/dist/src/transfer/types.d.ts +245 -0
- package/dist/src/transfer/types.d.ts.map +1 -0
- package/dist/src/types.d.ts +198 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +26 -55
- package/dist/src/types.js.map +1 -1
- package/dist/src/update/checker.d.ts +34 -0
- package/dist/src/update/checker.d.ts.map +1 -0
- package/dist/src/update/checker.js +106 -183
- package/dist/src/update/checker.js.map +1 -1
- package/dist/src/update/executor.d.ts +32 -0
- package/dist/src/update/executor.d.ts.map +1 -0
- package/dist/src/update/executor.js +135 -198
- package/dist/src/update/executor.js.map +1 -1
- package/dist/src/update/index.d.ts +33 -0
- package/dist/src/update/index.d.ts.map +1 -0
- package/dist/src/update/index.js +38 -85
- package/dist/src/update/index.js.map +1 -1
- package/dist/src/update/rate-limiter.d.ts +20 -0
- package/dist/src/update/rate-limiter.d.ts.map +1 -0
- package/dist/src/update/rate-limiter.js +19 -31
- package/dist/src/update/rate-limiter.js.map +1 -1
- package/dist/src/update/validator.d.ts +17 -0
- package/dist/src/update/validator.d.ts.map +1 -0
- package/dist/src/update/validator.js +38 -64
- package/dist/src/update/validator.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- 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
|
-
|
|
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
|
-
|
|
68
|
-
|
|
31
|
+
let routerInstance = null;
|
|
32
|
+
let routerInitialized = false;
|
|
69
33
|
/**
|
|
70
34
|
* Get or create the router instance
|
|
71
35
|
*/
|
|
72
|
-
function getRouter() {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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(
|
|
50
|
+
return AGENT_TYPES.find(a => a.id === route);
|
|
96
51
|
}
|
|
97
52
|
// ============================================================================
|
|
98
53
|
// Route Subcommand
|
|
99
54
|
// ============================================================================
|
|
100
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
jsonOutput
|
|
288
|
-
|
|
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
|
-
|
|
317
|
-
output.
|
|
318
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
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
|
-
|
|
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:
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
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
|
-
|
|
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:
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
result
|
|
711
|
-
|
|
712
|
-
if (
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
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.
|
|
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
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
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.
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
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('
|
|
839
|
-
output.
|
|
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
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
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
|
|
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
|
-
|
|
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:
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
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
|