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
|
@@ -2,42 +2,6 @@
|
|
|
2
2
|
* V3 CLI Agent Command
|
|
3
3
|
* Agent management commands for spawning, listing, and controlling agents
|
|
4
4
|
*/
|
|
5
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
15
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
16
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
17
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
18
|
-
function step(op) {
|
|
19
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
20
|
-
while (_) try {
|
|
21
|
-
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;
|
|
22
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
23
|
-
switch (op[0]) {
|
|
24
|
-
case 0: case 1: t = op; break;
|
|
25
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
26
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
27
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
28
|
-
default:
|
|
29
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
30
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
31
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
32
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
33
|
-
if (t[2]) _.ops.pop();
|
|
34
|
-
_.trys.pop(); continue;
|
|
35
|
-
}
|
|
36
|
-
op = body.call(thisArg, _);
|
|
37
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
38
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
5
|
import { output } from '../output.js';
|
|
42
6
|
import { select, confirm, input } from '../prompt.js';
|
|
43
7
|
import { callMCPTool, MCPClientError } from '../mcp-client.js';
|
|
@@ -48,13 +12,12 @@ import * as path from 'path';
|
|
|
48
12
|
* The statusline reads this file to display the swarm agent count.
|
|
49
13
|
*/
|
|
50
14
|
function updateSwarmActivityMetrics(agentCountDelta) {
|
|
51
|
-
var _a;
|
|
52
15
|
try {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
16
|
+
const metricsDir = path.join(process.cwd(), '.claude-flow', 'metrics');
|
|
17
|
+
const activityPath = path.join(metricsDir, 'swarm-activity.json');
|
|
18
|
+
let data = {
|
|
56
19
|
timestamp: new Date().toISOString(),
|
|
57
|
-
swarm: { active: false, agent_count: 0, coordination_active: false }
|
|
20
|
+
swarm: { active: false, agent_count: 0, coordination_active: false },
|
|
58
21
|
};
|
|
59
22
|
if (fs.existsSync(activityPath)) {
|
|
60
23
|
data = JSON.parse(fs.readFileSync(activityPath, 'utf-8'));
|
|
@@ -62,9 +25,9 @@ function updateSwarmActivityMetrics(agentCountDelta) {
|
|
|
62
25
|
else {
|
|
63
26
|
fs.mkdirSync(metricsDir, { recursive: true });
|
|
64
27
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
28
|
+
const swarm = data.swarm ?? {};
|
|
29
|
+
const currentCount = Math.max(0, swarm.agent_count || 0);
|
|
30
|
+
const newCount = Math.max(0, currentCount + agentCountDelta);
|
|
68
31
|
swarm.agent_count = newCount;
|
|
69
32
|
swarm.active = newCount > 0;
|
|
70
33
|
swarm.coordination_active = newCount > 0;
|
|
@@ -72,12 +35,12 @@ function updateSwarmActivityMetrics(agentCountDelta) {
|
|
|
72
35
|
data.timestamp = new Date().toISOString();
|
|
73
36
|
fs.writeFileSync(activityPath, JSON.stringify(data, null, 2));
|
|
74
37
|
}
|
|
75
|
-
catch
|
|
38
|
+
catch {
|
|
76
39
|
// Non-critical — don't fail the command if metrics update fails
|
|
77
40
|
}
|
|
78
41
|
}
|
|
79
42
|
// Available agent types with descriptions
|
|
80
|
-
|
|
43
|
+
const AGENT_TYPES = [
|
|
81
44
|
{ value: 'coder', label: 'Coder', hint: 'Code development with neural patterns' },
|
|
82
45
|
{ value: 'researcher', label: 'Researcher', hint: 'Research with web access and data analysis' },
|
|
83
46
|
{ value: 'tester', label: 'Tester', hint: 'Comprehensive testing with automation' },
|
|
@@ -95,7 +58,7 @@ var AGENT_TYPES = [
|
|
|
95
58
|
{ value: 'test-architect', label: 'Test Architect', hint: 'TDD London School methodology' }
|
|
96
59
|
];
|
|
97
60
|
// Agent spawn subcommand
|
|
98
|
-
|
|
61
|
+
const spawnCommand = {
|
|
99
62
|
name: 'spawn',
|
|
100
63
|
description: 'Spawn a new agent',
|
|
101
64
|
options: [
|
|
@@ -104,7 +67,7 @@ var spawnCommand = {
|
|
|
104
67
|
short: 't',
|
|
105
68
|
description: 'Agent type to spawn',
|
|
106
69
|
type: 'string',
|
|
107
|
-
choices: AGENT_TYPES.map(
|
|
70
|
+
choices: AGENT_TYPES.map(a => a.value)
|
|
108
71
|
},
|
|
109
72
|
{
|
|
110
73
|
name: 'name',
|
|
@@ -117,7 +80,7 @@ var spawnCommand = {
|
|
|
117
80
|
short: 'p',
|
|
118
81
|
description: 'Provider to use (anthropic, openrouter, ollama)',
|
|
119
82
|
type: 'string',
|
|
120
|
-
|
|
83
|
+
default: 'anthropic'
|
|
121
84
|
},
|
|
122
85
|
{
|
|
123
86
|
name: 'model',
|
|
@@ -134,104 +97,93 @@ var spawnCommand = {
|
|
|
134
97
|
name: 'timeout',
|
|
135
98
|
description: 'Agent timeout in seconds',
|
|
136
99
|
type: 'number',
|
|
137
|
-
|
|
100
|
+
default: 300
|
|
138
101
|
},
|
|
139
102
|
{
|
|
140
103
|
name: 'auto-tools',
|
|
141
104
|
description: 'Enable automatic tool usage',
|
|
142
105
|
type: 'boolean',
|
|
143
|
-
|
|
106
|
+
default: true
|
|
144
107
|
}
|
|
145
108
|
],
|
|
146
109
|
examples: [
|
|
147
110
|
{ command: 'claude-flow agent spawn --type coder --name bot-1', description: 'Spawn a coder agent' },
|
|
148
111
|
{ command: 'claude-flow agent spawn -t researcher --task "Research React 19"', description: 'Spawn researcher with task' }
|
|
149
112
|
],
|
|
150
|
-
action:
|
|
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
|
-
{ property: 'Capabilities', value: getAgentCapabilities(agentType).join(', ') }
|
|
209
|
-
]
|
|
210
|
-
});
|
|
211
|
-
output.writeln();
|
|
212
|
-
output.printSuccess("Agent " + agentName + " spawned successfully");
|
|
213
|
-
// Update swarm-activity.json so statusline reflects the new agent count
|
|
214
|
-
updateSwarmActivityMetrics(1);
|
|
215
|
-
if (ctx.flags.format === 'json') {
|
|
216
|
-
output.printJson(result);
|
|
217
|
-
}
|
|
218
|
-
return [2 /*return*/, { success: true, data: result }];
|
|
219
|
-
case 5:
|
|
220
|
-
error_1 = _a.sent();
|
|
221
|
-
if (error_1 instanceof MCPClientError) {
|
|
222
|
-
output.printError("Failed to spawn agent: " + error_1.message);
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
output.printError("Unexpected error: " + String(error_1));
|
|
226
|
-
}
|
|
227
|
-
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
228
|
-
case 6: return [2 /*return*/];
|
|
113
|
+
action: async (ctx) => {
|
|
114
|
+
let agentType = ctx.flags.type;
|
|
115
|
+
let agentName = ctx.flags.name;
|
|
116
|
+
// Interactive mode if type not specified
|
|
117
|
+
if (!agentType && ctx.interactive) {
|
|
118
|
+
agentType = await select({
|
|
119
|
+
message: 'Select agent type:',
|
|
120
|
+
options: AGENT_TYPES
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
if (!agentType) {
|
|
124
|
+
output.printError('Agent type is required. Use --type or -t flag.');
|
|
125
|
+
return { success: false, exitCode: 1 };
|
|
126
|
+
}
|
|
127
|
+
// Generate name if not provided
|
|
128
|
+
if (!agentName) {
|
|
129
|
+
agentName = `${agentType}-${Date.now().toString(36)}`;
|
|
130
|
+
}
|
|
131
|
+
output.printInfo(`Spawning ${agentType} agent: ${output.highlight(agentName)}`);
|
|
132
|
+
try {
|
|
133
|
+
// Call MCP tool to spawn agent
|
|
134
|
+
const result = await callMCPTool('agent_spawn', {
|
|
135
|
+
agentType,
|
|
136
|
+
id: agentName,
|
|
137
|
+
config: {
|
|
138
|
+
provider: ctx.flags.provider || 'anthropic',
|
|
139
|
+
model: ctx.flags.model,
|
|
140
|
+
task: ctx.flags.task,
|
|
141
|
+
timeout: ctx.flags.timeout,
|
|
142
|
+
autoTools: ctx.flags.autoTools,
|
|
143
|
+
},
|
|
144
|
+
priority: 'normal',
|
|
145
|
+
metadata: {
|
|
146
|
+
name: agentName,
|
|
147
|
+
capabilities: getAgentCapabilities(agentType),
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
output.writeln();
|
|
151
|
+
output.printTable({
|
|
152
|
+
columns: [
|
|
153
|
+
{ key: 'property', header: 'Property', width: 15 },
|
|
154
|
+
{ key: 'value', header: 'Value', width: 40 }
|
|
155
|
+
],
|
|
156
|
+
data: [
|
|
157
|
+
{ property: 'ID', value: result.agentId },
|
|
158
|
+
{ property: 'Type', value: result.agentType },
|
|
159
|
+
{ property: 'Name', value: agentName },
|
|
160
|
+
{ property: 'Status', value: result.status },
|
|
161
|
+
{ property: 'Created', value: result.createdAt },
|
|
162
|
+
{ property: 'Capabilities', value: getAgentCapabilities(agentType).join(', ') }
|
|
163
|
+
]
|
|
164
|
+
});
|
|
165
|
+
output.writeln();
|
|
166
|
+
output.printSuccess(`Agent ${agentName} spawned successfully`);
|
|
167
|
+
// Update swarm-activity.json so statusline reflects the new agent count
|
|
168
|
+
updateSwarmActivityMetrics(1);
|
|
169
|
+
if (ctx.flags.format === 'json') {
|
|
170
|
+
output.printJson(result);
|
|
229
171
|
}
|
|
230
|
-
|
|
231
|
-
|
|
172
|
+
return { success: true, data: result };
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
if (error instanceof MCPClientError) {
|
|
176
|
+
output.printError(`Failed to spawn agent: ${error.message}`);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
180
|
+
}
|
|
181
|
+
return { success: false, exitCode: 1 };
|
|
182
|
+
}
|
|
183
|
+
}
|
|
232
184
|
};
|
|
233
185
|
// Agent list subcommand
|
|
234
|
-
|
|
186
|
+
const listCommand = {
|
|
235
187
|
name: 'list',
|
|
236
188
|
aliases: ['ls'],
|
|
237
189
|
description: 'List all active agents',
|
|
@@ -241,7 +193,7 @@ var listCommand = {
|
|
|
241
193
|
short: 'a',
|
|
242
194
|
description: 'Include inactive agents',
|
|
243
195
|
type: 'boolean',
|
|
244
|
-
|
|
196
|
+
default: false
|
|
245
197
|
},
|
|
246
198
|
{
|
|
247
199
|
name: 'type',
|
|
@@ -256,68 +208,62 @@ var listCommand = {
|
|
|
256
208
|
type: 'string'
|
|
257
209
|
}
|
|
258
210
|
],
|
|
259
|
-
action:
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
case 1:
|
|
271
|
-
result = _a.sent();
|
|
272
|
-
if (ctx.flags.format === 'json') {
|
|
273
|
-
output.printJson(result);
|
|
274
|
-
return [2 /*return*/, { success: true, data: result }];
|
|
275
|
-
}
|
|
276
|
-
output.writeln();
|
|
277
|
-
output.writeln(output.bold('Active Agents'));
|
|
278
|
-
output.writeln();
|
|
279
|
-
if (result.agents.length === 0) {
|
|
280
|
-
output.printInfo('No agents found matching criteria');
|
|
281
|
-
return [2 /*return*/, { success: true, data: result }];
|
|
282
|
-
}
|
|
283
|
-
displayAgents = result.agents.map(function (agent) { return ({
|
|
284
|
-
id: agent.id,
|
|
285
|
-
type: agent.agentType,
|
|
286
|
-
status: agent.status,
|
|
287
|
-
created: new Date(agent.createdAt).toLocaleTimeString(),
|
|
288
|
-
lastActivity: agent.lastActivityAt
|
|
289
|
-
? new Date(agent.lastActivityAt).toLocaleTimeString()
|
|
290
|
-
: 'N/A'
|
|
291
|
-
}); });
|
|
292
|
-
output.printTable({
|
|
293
|
-
columns: [
|
|
294
|
-
{ key: 'id', header: 'ID', width: 20 },
|
|
295
|
-
{ key: 'type', header: 'Type', width: 15 },
|
|
296
|
-
{ key: 'status', header: 'Status', width: 12, format: formatStatus },
|
|
297
|
-
{ key: 'created', header: 'Created', width: 12 },
|
|
298
|
-
{ key: 'lastActivity', header: 'Last Activity', width: 12 }
|
|
299
|
-
],
|
|
300
|
-
data: displayAgents
|
|
301
|
-
});
|
|
302
|
-
output.writeln();
|
|
303
|
-
output.printInfo("Total: " + result.total + " agents");
|
|
304
|
-
return [2 /*return*/, { success: true, data: result }];
|
|
305
|
-
case 2:
|
|
306
|
-
error_2 = _a.sent();
|
|
307
|
-
if (error_2 instanceof MCPClientError) {
|
|
308
|
-
output.printError("Failed to list agents: " + error_2.message);
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
311
|
-
output.printError("Unexpected error: " + String(error_2));
|
|
312
|
-
}
|
|
313
|
-
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
314
|
-
case 3: return [2 /*return*/];
|
|
211
|
+
action: async (ctx) => {
|
|
212
|
+
try {
|
|
213
|
+
// Call MCP tool to list agents
|
|
214
|
+
const result = await callMCPTool('agent_list', {
|
|
215
|
+
status: ctx.flags.all ? 'all' : ctx.flags.status || undefined,
|
|
216
|
+
agentType: ctx.flags.type || undefined,
|
|
217
|
+
limit: 100,
|
|
218
|
+
});
|
|
219
|
+
if (ctx.flags.format === 'json') {
|
|
220
|
+
output.printJson(result);
|
|
221
|
+
return { success: true, data: result };
|
|
315
222
|
}
|
|
316
|
-
|
|
317
|
-
|
|
223
|
+
output.writeln();
|
|
224
|
+
output.writeln(output.bold('Active Agents'));
|
|
225
|
+
output.writeln();
|
|
226
|
+
if (result.agents.length === 0) {
|
|
227
|
+
output.printInfo('No agents found matching criteria');
|
|
228
|
+
return { success: true, data: result };
|
|
229
|
+
}
|
|
230
|
+
// Format for display
|
|
231
|
+
const displayAgents = result.agents.map(agent => ({
|
|
232
|
+
id: agent.id,
|
|
233
|
+
type: agent.agentType,
|
|
234
|
+
status: agent.status,
|
|
235
|
+
created: new Date(agent.createdAt).toLocaleTimeString(),
|
|
236
|
+
lastActivity: agent.lastActivityAt
|
|
237
|
+
? new Date(agent.lastActivityAt).toLocaleTimeString()
|
|
238
|
+
: 'N/A',
|
|
239
|
+
}));
|
|
240
|
+
output.printTable({
|
|
241
|
+
columns: [
|
|
242
|
+
{ key: 'id', header: 'ID', width: 20 },
|
|
243
|
+
{ key: 'type', header: 'Type', width: 15 },
|
|
244
|
+
{ key: 'status', header: 'Status', width: 12, format: formatStatus },
|
|
245
|
+
{ key: 'created', header: 'Created', width: 12 },
|
|
246
|
+
{ key: 'lastActivity', header: 'Last Activity', width: 12 }
|
|
247
|
+
],
|
|
248
|
+
data: displayAgents
|
|
249
|
+
});
|
|
250
|
+
output.writeln();
|
|
251
|
+
output.printInfo(`Total: ${result.total} agents`);
|
|
252
|
+
return { success: true, data: result };
|
|
253
|
+
}
|
|
254
|
+
catch (error) {
|
|
255
|
+
if (error instanceof MCPClientError) {
|
|
256
|
+
output.printError(`Failed to list agents: ${error.message}`);
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
260
|
+
}
|
|
261
|
+
return { success: false, exitCode: 1 };
|
|
262
|
+
}
|
|
263
|
+
}
|
|
318
264
|
};
|
|
319
265
|
// Agent status subcommand
|
|
320
|
-
|
|
266
|
+
const statusCommand = {
|
|
321
267
|
name: 'status',
|
|
322
268
|
description: 'Show detailed status of an agent',
|
|
323
269
|
options: [
|
|
@@ -327,83 +273,70 @@ var statusCommand = {
|
|
|
327
273
|
type: 'string'
|
|
328
274
|
}
|
|
329
275
|
],
|
|
330
|
-
action:
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
_f.trys.push([3, 5, , 6]);
|
|
353
|
-
return [4 /*yield*/, callMCPTool('agent_status', {
|
|
354
|
-
agentId: agentId,
|
|
355
|
-
includeMetrics: true,
|
|
356
|
-
includeHistory: false
|
|
357
|
-
})];
|
|
358
|
-
case 4:
|
|
359
|
-
status = _f.sent();
|
|
360
|
-
if (ctx.flags.format === 'json') {
|
|
361
|
-
output.printJson(status);
|
|
362
|
-
return [2 /*return*/, { success: true, data: status }];
|
|
363
|
-
}
|
|
364
|
-
output.writeln();
|
|
365
|
-
output.printBox([
|
|
366
|
-
"Type: " + status.agentType,
|
|
367
|
-
"Status: " + formatStatus(status.status),
|
|
368
|
-
"Created: " + new Date(status.createdAt).toLocaleString(),
|
|
369
|
-
"Last Activity: " + (status.lastActivityAt ? new Date(status.lastActivityAt).toLocaleString() : 'N/A')
|
|
370
|
-
].join('\n'), "Agent: " + status.id);
|
|
371
|
-
if (status.metrics) {
|
|
372
|
-
output.writeln();
|
|
373
|
-
output.writeln(output.bold('Metrics'));
|
|
374
|
-
avgExecTime = (_a = status.metrics.averageExecutionTime) !== null && _a !== void 0 ? _a : 0;
|
|
375
|
-
uptime = (_b = status.metrics.uptime) !== null && _b !== void 0 ? _b : 0;
|
|
376
|
-
output.printTable({
|
|
377
|
-
columns: [
|
|
378
|
-
{ key: 'metric', header: 'Metric', width: 25 },
|
|
379
|
-
{ key: 'value', header: 'Value', width: 15, align: 'right' }
|
|
380
|
-
],
|
|
381
|
-
data: [
|
|
382
|
-
{ metric: 'Tasks Completed', value: (_c = status.metrics.tasksCompleted) !== null && _c !== void 0 ? _c : 0 },
|
|
383
|
-
{ metric: 'Tasks In Progress', value: (_d = status.metrics.tasksInProgress) !== null && _d !== void 0 ? _d : 0 },
|
|
384
|
-
{ metric: 'Tasks Failed', value: (_e = status.metrics.tasksFailed) !== null && _e !== void 0 ? _e : 0 },
|
|
385
|
-
{ metric: 'Avg Execution Time', value: avgExecTime.toFixed(2) + "ms" },
|
|
386
|
-
{ metric: 'Uptime', value: (uptime / 1000 / 60).toFixed(1) + "m" }
|
|
387
|
-
]
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
return [2 /*return*/, { success: true, data: status }];
|
|
391
|
-
case 5:
|
|
392
|
-
error_3 = _f.sent();
|
|
393
|
-
if (error_3 instanceof MCPClientError) {
|
|
394
|
-
output.printError("Failed to get agent status: " + error_3.message);
|
|
395
|
-
}
|
|
396
|
-
else {
|
|
397
|
-
output.printError("Unexpected error: " + String(error_3));
|
|
398
|
-
}
|
|
399
|
-
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
400
|
-
case 6: return [2 /*return*/];
|
|
276
|
+
action: async (ctx) => {
|
|
277
|
+
let agentId = ctx.args[0] || ctx.flags.id;
|
|
278
|
+
if (!agentId && ctx.interactive) {
|
|
279
|
+
agentId = await input({
|
|
280
|
+
message: 'Enter agent ID:',
|
|
281
|
+
validate: (v) => v.length > 0 || 'Agent ID is required'
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
if (!agentId) {
|
|
285
|
+
output.printError('Agent ID is required');
|
|
286
|
+
return { success: false, exitCode: 1 };
|
|
287
|
+
}
|
|
288
|
+
try {
|
|
289
|
+
// Call MCP tool to get agent status
|
|
290
|
+
const status = await callMCPTool('agent_status', {
|
|
291
|
+
agentId,
|
|
292
|
+
includeMetrics: true,
|
|
293
|
+
includeHistory: false,
|
|
294
|
+
});
|
|
295
|
+
if (ctx.flags.format === 'json') {
|
|
296
|
+
output.printJson(status);
|
|
297
|
+
return { success: true, data: status };
|
|
401
298
|
}
|
|
402
|
-
|
|
403
|
-
|
|
299
|
+
output.writeln();
|
|
300
|
+
output.printBox([
|
|
301
|
+
`Type: ${status.agentType}`,
|
|
302
|
+
`Status: ${formatStatus(status.status)}`,
|
|
303
|
+
`Created: ${new Date(status.createdAt).toLocaleString()}`,
|
|
304
|
+
`Last Activity: ${status.lastActivityAt ? new Date(status.lastActivityAt).toLocaleString() : 'N/A'}`
|
|
305
|
+
].join('\n'), `Agent: ${status.id}`);
|
|
306
|
+
if (status.metrics) {
|
|
307
|
+
output.writeln();
|
|
308
|
+
output.writeln(output.bold('Metrics'));
|
|
309
|
+
const avgExecTime = status.metrics.averageExecutionTime ?? 0;
|
|
310
|
+
const uptime = status.metrics.uptime ?? 0;
|
|
311
|
+
output.printTable({
|
|
312
|
+
columns: [
|
|
313
|
+
{ key: 'metric', header: 'Metric', width: 25 },
|
|
314
|
+
{ key: 'value', header: 'Value', width: 15, align: 'right' }
|
|
315
|
+
],
|
|
316
|
+
data: [
|
|
317
|
+
{ metric: 'Tasks Completed', value: status.metrics.tasksCompleted ?? 0 },
|
|
318
|
+
{ metric: 'Tasks In Progress', value: status.metrics.tasksInProgress ?? 0 },
|
|
319
|
+
{ metric: 'Tasks Failed', value: status.metrics.tasksFailed ?? 0 },
|
|
320
|
+
{ metric: 'Avg Execution Time', value: `${avgExecTime.toFixed(2)}ms` },
|
|
321
|
+
{ metric: 'Uptime', value: `${(uptime / 1000 / 60).toFixed(1)}m` }
|
|
322
|
+
]
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
return { success: true, data: status };
|
|
326
|
+
}
|
|
327
|
+
catch (error) {
|
|
328
|
+
if (error instanceof MCPClientError) {
|
|
329
|
+
output.printError(`Failed to get agent status: ${error.message}`);
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
333
|
+
}
|
|
334
|
+
return { success: false, exitCode: 1 };
|
|
335
|
+
}
|
|
336
|
+
}
|
|
404
337
|
};
|
|
405
338
|
// Agent stop subcommand
|
|
406
|
-
|
|
339
|
+
const stopCommand = {
|
|
407
340
|
name: 'stop',
|
|
408
341
|
aliases: ['kill'],
|
|
409
342
|
description: 'Stop a running agent',
|
|
@@ -413,78 +346,66 @@ var stopCommand = {
|
|
|
413
346
|
short: 'f',
|
|
414
347
|
description: 'Force stop without graceful shutdown',
|
|
415
348
|
type: 'boolean',
|
|
416
|
-
|
|
349
|
+
default: false
|
|
417
350
|
},
|
|
418
351
|
{
|
|
419
352
|
name: 'timeout',
|
|
420
353
|
description: 'Graceful shutdown timeout in seconds',
|
|
421
354
|
type: 'number',
|
|
422
|
-
|
|
355
|
+
default: 30
|
|
423
356
|
}
|
|
424
357
|
],
|
|
425
|
-
action:
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
})];
|
|
441
|
-
case 1:
|
|
442
|
-
confirmed = _a.sent();
|
|
443
|
-
if (!confirmed) {
|
|
444
|
-
output.printInfo('Operation cancelled');
|
|
445
|
-
return [2 /*return*/, { success: true }];
|
|
446
|
-
}
|
|
447
|
-
_a.label = 2;
|
|
448
|
-
case 2:
|
|
449
|
-
output.printInfo("Stopping agent " + agentId + "...");
|
|
450
|
-
_a.label = 3;
|
|
451
|
-
case 3:
|
|
452
|
-
_a.trys.push([3, 5, , 6]);
|
|
453
|
-
return [4 /*yield*/, callMCPTool('agent_terminate', {
|
|
454
|
-
agentId: agentId,
|
|
455
|
-
graceful: !force,
|
|
456
|
-
reason: 'Stopped by user via CLI'
|
|
457
|
-
})];
|
|
458
|
-
case 4:
|
|
459
|
-
result = _a.sent();
|
|
460
|
-
if (!force) {
|
|
461
|
-
output.writeln(output.dim(' Completing current task...'));
|
|
462
|
-
output.writeln(output.dim(' Saving state...'));
|
|
463
|
-
output.writeln(output.dim(' Releasing resources...'));
|
|
464
|
-
}
|
|
465
|
-
output.printSuccess("Agent " + agentId + " stopped successfully");
|
|
466
|
-
// Update swarm-activity.json so statusline reflects the reduced agent count
|
|
467
|
-
updateSwarmActivityMetrics(-1);
|
|
468
|
-
if (ctx.flags.format === 'json') {
|
|
469
|
-
output.printJson(result);
|
|
470
|
-
}
|
|
471
|
-
return [2 /*return*/, { success: true, data: result }];
|
|
472
|
-
case 5:
|
|
473
|
-
error_4 = _a.sent();
|
|
474
|
-
if (error_4 instanceof MCPClientError) {
|
|
475
|
-
output.printError("Failed to stop agent: " + error_4.message);
|
|
476
|
-
}
|
|
477
|
-
else {
|
|
478
|
-
output.printError("Unexpected error: " + String(error_4));
|
|
479
|
-
}
|
|
480
|
-
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
481
|
-
case 6: return [2 /*return*/];
|
|
358
|
+
action: async (ctx) => {
|
|
359
|
+
const agentId = ctx.args[0];
|
|
360
|
+
if (!agentId) {
|
|
361
|
+
output.printError('Agent ID is required');
|
|
362
|
+
return { success: false, exitCode: 1 };
|
|
363
|
+
}
|
|
364
|
+
const force = ctx.flags.force;
|
|
365
|
+
if (!force && ctx.interactive) {
|
|
366
|
+
const confirmed = await confirm({
|
|
367
|
+
message: `Are you sure you want to stop agent ${agentId}?`,
|
|
368
|
+
default: false
|
|
369
|
+
});
|
|
370
|
+
if (!confirmed) {
|
|
371
|
+
output.printInfo('Operation cancelled');
|
|
372
|
+
return { success: true };
|
|
482
373
|
}
|
|
483
|
-
}
|
|
484
|
-
|
|
374
|
+
}
|
|
375
|
+
output.printInfo(`Stopping agent ${agentId}...`);
|
|
376
|
+
try {
|
|
377
|
+
// Call MCP tool to terminate agent
|
|
378
|
+
const result = await callMCPTool('agent_terminate', {
|
|
379
|
+
agentId,
|
|
380
|
+
graceful: !force,
|
|
381
|
+
reason: 'Stopped by user via CLI',
|
|
382
|
+
});
|
|
383
|
+
if (!force) {
|
|
384
|
+
output.writeln(output.dim(' Completing current task...'));
|
|
385
|
+
output.writeln(output.dim(' Saving state...'));
|
|
386
|
+
output.writeln(output.dim(' Releasing resources...'));
|
|
387
|
+
}
|
|
388
|
+
output.printSuccess(`Agent ${agentId} stopped successfully`);
|
|
389
|
+
// Update swarm-activity.json so statusline reflects the reduced agent count
|
|
390
|
+
updateSwarmActivityMetrics(-1);
|
|
391
|
+
if (ctx.flags.format === 'json') {
|
|
392
|
+
output.printJson(result);
|
|
393
|
+
}
|
|
394
|
+
return { success: true, data: result };
|
|
395
|
+
}
|
|
396
|
+
catch (error) {
|
|
397
|
+
if (error instanceof MCPClientError) {
|
|
398
|
+
output.printError(`Failed to stop agent: ${error.message}`);
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
402
|
+
}
|
|
403
|
+
return { success: false, exitCode: 1 };
|
|
404
|
+
}
|
|
405
|
+
}
|
|
485
406
|
};
|
|
486
407
|
// Agent metrics subcommand
|
|
487
|
-
|
|
408
|
+
const metricsCommand = {
|
|
488
409
|
name: 'metrics',
|
|
489
410
|
description: 'Show agent performance metrics',
|
|
490
411
|
options: [
|
|
@@ -493,150 +414,140 @@ var metricsCommand = {
|
|
|
493
414
|
short: 'p',
|
|
494
415
|
description: 'Time period (1h, 24h, 7d, 30d)',
|
|
495
416
|
type: 'string',
|
|
496
|
-
|
|
417
|
+
default: '24h'
|
|
497
418
|
}
|
|
498
419
|
],
|
|
499
|
-
action:
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
typeCounts[agType] = { count: 0, tasks: 0, success: 0 };
|
|
529
|
-
typeCounts[agType].count++;
|
|
530
|
-
if (data.status === 'active' || data.status === 'running')
|
|
531
|
-
activeAgents++;
|
|
532
|
-
if (data.tasksCompleted) {
|
|
533
|
-
typeCounts[agType].tasks += data.tasksCompleted;
|
|
534
|
-
tasksCompleted += data.tasksCompleted;
|
|
535
|
-
}
|
|
536
|
-
if (data.successCount)
|
|
537
|
-
typeCounts[agType].success += data.successCount;
|
|
538
|
-
}
|
|
539
|
-
catch ( /* skip malformed */_c) { /* skip malformed */ }
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
catch ( /* no agents dir */_d) { /* no agents dir */ }
|
|
543
|
-
}
|
|
544
|
-
activityFile = join(swarmDir, 'swarm-activity.json');
|
|
545
|
-
if (existsSync(activityFile)) {
|
|
546
|
-
try {
|
|
547
|
-
activity = JSON.parse(readFileSync(activityFile, 'utf-8'));
|
|
548
|
-
if (activity.totalAgents && totalAgents === 0)
|
|
549
|
-
totalAgents = activity.totalAgents;
|
|
550
|
-
if (activity.activeAgents && activeAgents === 0)
|
|
551
|
-
activeAgents = activity.activeAgents;
|
|
552
|
-
}
|
|
553
|
-
catch ( /* ignore */_e) { /* ignore */ }
|
|
554
|
-
}
|
|
555
|
-
vectorCount = 0;
|
|
556
|
-
dbPath = join(swarmDir, 'memory.db');
|
|
557
|
-
if (existsSync(dbPath)) {
|
|
558
|
-
try {
|
|
559
|
-
dbSize = statSync(dbPath).size;
|
|
560
|
-
vectorCount = Math.floor(dbSize / 2048);
|
|
561
|
-
}
|
|
562
|
-
catch ( /* ignore */_f) { /* ignore */ }
|
|
563
|
-
}
|
|
564
|
-
byType = Object.entries(typeCounts).map(function (_a) {
|
|
565
|
-
var type = _a[0], data = _a[1];
|
|
566
|
-
return ({
|
|
567
|
-
type: type,
|
|
568
|
-
count: data.count,
|
|
569
|
-
tasks: data.tasks,
|
|
570
|
-
successRate: data.tasks > 0 ? Math.round((data.success / data.tasks) * 100) + "%" : 'N/A'
|
|
571
|
-
});
|
|
572
|
-
});
|
|
573
|
-
avgSuccessRate = tasksCompleted > 0
|
|
574
|
-
? Math.round(Object.values(typeCounts).reduce(function (a, d) { return a + d.success; }, 0) / tasksCompleted * 100) + "%"
|
|
575
|
-
: 'N/A';
|
|
576
|
-
metrics = {
|
|
577
|
-
period: period,
|
|
578
|
-
summary: {
|
|
579
|
-
totalAgents: totalAgents,
|
|
580
|
-
activeAgents: activeAgents,
|
|
581
|
-
tasksCompleted: tasksCompleted,
|
|
582
|
-
avgSuccessRate: avgSuccessRate,
|
|
583
|
-
vectorCount: vectorCount,
|
|
584
|
-
note: totalAgents === 0 ? 'No agents spawned yet. Use: agent spawn -t coder' : undefined
|
|
585
|
-
},
|
|
586
|
-
byType: byType,
|
|
587
|
-
performance: {
|
|
588
|
-
memoryVectors: vectorCount + " vectors",
|
|
589
|
-
searchBackend: vectorCount > 0 ? 'HNSW-indexed' : 'none'
|
|
420
|
+
action: async (ctx) => {
|
|
421
|
+
const agentId = ctx.args[0];
|
|
422
|
+
const period = ctx.flags.period;
|
|
423
|
+
// Collect real metrics from .swarm/ state
|
|
424
|
+
const { existsSync, readFileSync, readdirSync, statSync } = await import('fs');
|
|
425
|
+
const { join } = await import('path');
|
|
426
|
+
let totalAgents = 0;
|
|
427
|
+
let activeAgents = 0;
|
|
428
|
+
let tasksCompleted = 0;
|
|
429
|
+
const typeCounts = {};
|
|
430
|
+
// Read swarm agent state
|
|
431
|
+
const swarmDir = join(process.cwd(), '.swarm');
|
|
432
|
+
const agentsDir = join(swarmDir, 'agents');
|
|
433
|
+
if (existsSync(agentsDir)) {
|
|
434
|
+
try {
|
|
435
|
+
const files = readdirSync(agentsDir).filter(f => f.endsWith('.json'));
|
|
436
|
+
for (const file of files) {
|
|
437
|
+
try {
|
|
438
|
+
const data = JSON.parse(readFileSync(join(agentsDir, file), 'utf-8'));
|
|
439
|
+
totalAgents++;
|
|
440
|
+
const agType = data.type || 'unknown';
|
|
441
|
+
if (!typeCounts[agType])
|
|
442
|
+
typeCounts[agType] = { count: 0, tasks: 0, success: 0 };
|
|
443
|
+
typeCounts[agType].count++;
|
|
444
|
+
if (data.status === 'active' || data.status === 'running')
|
|
445
|
+
activeAgents++;
|
|
446
|
+
if (data.tasksCompleted) {
|
|
447
|
+
typeCounts[agType].tasks += data.tasksCompleted;
|
|
448
|
+
tasksCompleted += data.tasksCompleted;
|
|
590
449
|
}
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
output.printJson(metrics);
|
|
594
|
-
return [2 /*return*/, { success: true, data: metrics }];
|
|
595
|
-
}
|
|
596
|
-
output.writeln();
|
|
597
|
-
output.writeln(output.bold("Agent Metrics (" + period + ")"));
|
|
598
|
-
output.writeln();
|
|
599
|
-
output.printTable({
|
|
600
|
-
columns: [
|
|
601
|
-
{ key: 'metric', header: 'Metric', width: 20 },
|
|
602
|
-
{ key: 'value', header: 'Value', width: 15, align: 'right' }
|
|
603
|
-
],
|
|
604
|
-
data: [
|
|
605
|
-
{ metric: 'Total Agents', value: metrics.summary.totalAgents },
|
|
606
|
-
{ metric: 'Active Agents', value: metrics.summary.activeAgents },
|
|
607
|
-
{ metric: 'Tasks Completed', value: metrics.summary.tasksCompleted },
|
|
608
|
-
{ metric: 'Success Rate', value: metrics.summary.avgSuccessRate },
|
|
609
|
-
{ metric: 'Memory Vectors', value: metrics.summary.vectorCount }
|
|
610
|
-
]
|
|
611
|
-
});
|
|
612
|
-
output.writeln();
|
|
613
|
-
output.writeln(output.bold('By Agent Type'));
|
|
614
|
-
output.printTable({
|
|
615
|
-
columns: [
|
|
616
|
-
{ key: 'type', header: 'Type', width: 12 },
|
|
617
|
-
{ key: 'count', header: 'Count', width: 8, align: 'right' },
|
|
618
|
-
{ key: 'tasks', header: 'Tasks', width: 8, align: 'right' },
|
|
619
|
-
{ key: 'successRate', header: 'Success', width: 10, align: 'right' }
|
|
620
|
-
],
|
|
621
|
-
data: metrics.byType
|
|
622
|
-
});
|
|
623
|
-
if (metrics.summary.note) {
|
|
624
|
-
output.writeln();
|
|
625
|
-
output.writeln(output.dim(metrics.summary.note));
|
|
450
|
+
if (data.successCount)
|
|
451
|
+
typeCounts[agType].success += data.successCount;
|
|
626
452
|
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
453
|
+
catch { /* skip malformed */ }
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
catch { /* no agents dir */ }
|
|
457
|
+
}
|
|
458
|
+
// Read swarm activity for additional state
|
|
459
|
+
const activityFile = join(swarmDir, 'swarm-activity.json');
|
|
460
|
+
if (existsSync(activityFile)) {
|
|
461
|
+
try {
|
|
462
|
+
const activity = JSON.parse(readFileSync(activityFile, 'utf-8'));
|
|
463
|
+
if (activity.totalAgents && totalAgents === 0)
|
|
464
|
+
totalAgents = activity.totalAgents;
|
|
465
|
+
if (activity.activeAgents && activeAgents === 0)
|
|
466
|
+
activeAgents = activity.activeAgents;
|
|
634
467
|
}
|
|
468
|
+
catch { /* ignore */ }
|
|
469
|
+
}
|
|
470
|
+
// Read memory.db stats
|
|
471
|
+
let vectorCount = 0;
|
|
472
|
+
const dbPath = join(swarmDir, 'memory.db');
|
|
473
|
+
if (existsSync(dbPath)) {
|
|
474
|
+
try {
|
|
475
|
+
const dbSize = statSync(dbPath).size;
|
|
476
|
+
vectorCount = Math.floor(dbSize / 2048);
|
|
477
|
+
}
|
|
478
|
+
catch { /* ignore */ }
|
|
479
|
+
}
|
|
480
|
+
const byType = Object.entries(typeCounts).map(([type, data]) => ({
|
|
481
|
+
type,
|
|
482
|
+
count: data.count,
|
|
483
|
+
tasks: data.tasks,
|
|
484
|
+
successRate: data.tasks > 0 ? `${Math.round((data.success / data.tasks) * 100)}%` : 'N/A'
|
|
485
|
+
}));
|
|
486
|
+
const avgSuccessRate = tasksCompleted > 0
|
|
487
|
+
? `${Math.round(Object.values(typeCounts).reduce((a, d) => a + d.success, 0) / tasksCompleted * 100)}%`
|
|
488
|
+
: 'N/A';
|
|
489
|
+
const metrics = {
|
|
490
|
+
period,
|
|
491
|
+
summary: {
|
|
492
|
+
totalAgents,
|
|
493
|
+
activeAgents,
|
|
494
|
+
tasksCompleted,
|
|
495
|
+
avgSuccessRate,
|
|
496
|
+
vectorCount,
|
|
497
|
+
note: totalAgents === 0 ? 'No agents spawned yet. Use: agent spawn -t coder' : undefined
|
|
498
|
+
},
|
|
499
|
+
byType,
|
|
500
|
+
performance: {
|
|
501
|
+
memoryVectors: `${vectorCount} vectors`,
|
|
502
|
+
searchBackend: vectorCount > 0 ? 'HNSW-indexed' : 'none'
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
if (ctx.flags.format === 'json') {
|
|
506
|
+
output.printJson(metrics);
|
|
507
|
+
return { success: true, data: metrics };
|
|
508
|
+
}
|
|
509
|
+
output.writeln();
|
|
510
|
+
output.writeln(output.bold(`Agent Metrics (${period})`));
|
|
511
|
+
output.writeln();
|
|
512
|
+
output.printTable({
|
|
513
|
+
columns: [
|
|
514
|
+
{ key: 'metric', header: 'Metric', width: 20 },
|
|
515
|
+
{ key: 'value', header: 'Value', width: 15, align: 'right' }
|
|
516
|
+
],
|
|
517
|
+
data: [
|
|
518
|
+
{ metric: 'Total Agents', value: metrics.summary.totalAgents },
|
|
519
|
+
{ metric: 'Active Agents', value: metrics.summary.activeAgents },
|
|
520
|
+
{ metric: 'Tasks Completed', value: metrics.summary.tasksCompleted },
|
|
521
|
+
{ metric: 'Success Rate', value: metrics.summary.avgSuccessRate },
|
|
522
|
+
{ metric: 'Memory Vectors', value: metrics.summary.vectorCount }
|
|
523
|
+
]
|
|
524
|
+
});
|
|
525
|
+
output.writeln();
|
|
526
|
+
output.writeln(output.bold('By Agent Type'));
|
|
527
|
+
output.printTable({
|
|
528
|
+
columns: [
|
|
529
|
+
{ key: 'type', header: 'Type', width: 12 },
|
|
530
|
+
{ key: 'count', header: 'Count', width: 8, align: 'right' },
|
|
531
|
+
{ key: 'tasks', header: 'Tasks', width: 8, align: 'right' },
|
|
532
|
+
{ key: 'successRate', header: 'Success', width: 10, align: 'right' }
|
|
533
|
+
],
|
|
534
|
+
data: metrics.byType
|
|
635
535
|
});
|
|
636
|
-
|
|
536
|
+
if (metrics.summary.note) {
|
|
537
|
+
output.writeln();
|
|
538
|
+
output.writeln(output.dim(metrics.summary.note));
|
|
539
|
+
}
|
|
540
|
+
output.writeln();
|
|
541
|
+
output.writeln(output.bold('Memory'));
|
|
542
|
+
output.printList([
|
|
543
|
+
`Vectors: ${output.success(metrics.performance.memoryVectors)}`,
|
|
544
|
+
`Backend: ${output.success(metrics.performance.searchBackend)}`
|
|
545
|
+
]);
|
|
546
|
+
return { success: true, data: metrics };
|
|
547
|
+
}
|
|
637
548
|
};
|
|
638
549
|
// Agent pool subcommand
|
|
639
|
-
|
|
550
|
+
const poolCommand = {
|
|
640
551
|
name: 'pool',
|
|
641
552
|
description: 'Manage agent pool for scaling',
|
|
642
553
|
options: [
|
|
@@ -650,84 +561,75 @@ var poolCommand = {
|
|
|
650
561
|
name: 'min',
|
|
651
562
|
description: 'Minimum pool size',
|
|
652
563
|
type: 'number',
|
|
653
|
-
|
|
564
|
+
default: 1
|
|
654
565
|
},
|
|
655
566
|
{
|
|
656
567
|
name: 'max',
|
|
657
568
|
description: 'Maximum pool size',
|
|
658
569
|
type: 'number',
|
|
659
|
-
|
|
570
|
+
default: 10
|
|
660
571
|
},
|
|
661
572
|
{
|
|
662
573
|
name: 'auto-scale',
|
|
663
574
|
short: 'a',
|
|
664
575
|
description: 'Enable auto-scaling',
|
|
665
576
|
type: 'boolean',
|
|
666
|
-
|
|
577
|
+
default: true
|
|
667
578
|
}
|
|
668
579
|
],
|
|
669
580
|
examples: [
|
|
670
581
|
{ command: 'claude-flow agent pool --size 5', description: 'Set pool size' },
|
|
671
582
|
{ command: 'claude-flow agent pool --min 2 --max 15', description: 'Configure auto-scaling' }
|
|
672
583
|
],
|
|
673
|
-
action:
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
autoScale: (_a = ctx.flags.autoScale) !== null && _a !== void 0 ? _a : true
|
|
685
|
-
})];
|
|
686
|
-
case 1:
|
|
687
|
-
result = _h.sent();
|
|
688
|
-
if (ctx.flags.format === 'json') {
|
|
689
|
-
output.printJson(result);
|
|
690
|
-
return [2 /*return*/, { success: true, data: result }];
|
|
691
|
-
}
|
|
692
|
-
output.writeln();
|
|
693
|
-
utilization = (_b = result.utilization) !== null && _b !== void 0 ? _b : 0;
|
|
694
|
-
output.printBox([
|
|
695
|
-
"Pool ID: " + ((_c = result.poolId) !== null && _c !== void 0 ? _c : 'default'),
|
|
696
|
-
"Current Size: " + ((_d = result.currentSize) !== null && _d !== void 0 ? _d : 0),
|
|
697
|
-
"Min/Max: " + ((_e = result.minSize) !== null && _e !== void 0 ? _e : 0) + "/" + ((_f = result.maxSize) !== null && _f !== void 0 ? _f : 100),
|
|
698
|
-
"Auto-Scale: " + (result.autoScale ? 'Yes' : 'No'),
|
|
699
|
-
"Utilization: " + (utilization * 100).toFixed(1) + "%"
|
|
700
|
-
].join('\n'), 'Agent Pool');
|
|
701
|
-
agents = (_g = result.agents) !== null && _g !== void 0 ? _g : [];
|
|
702
|
-
if (agents.length > 0) {
|
|
703
|
-
output.writeln();
|
|
704
|
-
output.writeln(output.bold('Pool Agents'));
|
|
705
|
-
output.printTable({
|
|
706
|
-
columns: [
|
|
707
|
-
{ key: 'id', header: 'ID', width: 20 },
|
|
708
|
-
{ key: 'type', header: 'Type', width: 15 },
|
|
709
|
-
{ key: 'status', header: 'Status', width: 12, format: formatStatus }
|
|
710
|
-
],
|
|
711
|
-
data: agents
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
|
-
return [2 /*return*/, { success: true, data: result }];
|
|
715
|
-
case 2:
|
|
716
|
-
error_5 = _h.sent();
|
|
717
|
-
if (error_5 instanceof MCPClientError) {
|
|
718
|
-
output.printError("Pool error: " + error_5.message);
|
|
719
|
-
}
|
|
720
|
-
else {
|
|
721
|
-
output.printError("Unexpected error: " + String(error_5));
|
|
722
|
-
}
|
|
723
|
-
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
724
|
-
case 3: return [2 /*return*/];
|
|
584
|
+
action: async (ctx) => {
|
|
585
|
+
try {
|
|
586
|
+
const result = await callMCPTool('agent_pool', {
|
|
587
|
+
size: ctx.flags.size,
|
|
588
|
+
min: ctx.flags.min,
|
|
589
|
+
max: ctx.flags.max,
|
|
590
|
+
autoScale: ctx.flags.autoScale ?? true,
|
|
591
|
+
});
|
|
592
|
+
if (ctx.flags.format === 'json') {
|
|
593
|
+
output.printJson(result);
|
|
594
|
+
return { success: true, data: result };
|
|
725
595
|
}
|
|
726
|
-
|
|
727
|
-
|
|
596
|
+
output.writeln();
|
|
597
|
+
const utilization = result.utilization ?? 0;
|
|
598
|
+
output.printBox([
|
|
599
|
+
`Pool ID: ${result.poolId ?? 'default'}`,
|
|
600
|
+
`Current Size: ${result.currentSize ?? 0}`,
|
|
601
|
+
`Min/Max: ${result.minSize ?? 0}/${result.maxSize ?? 100}`,
|
|
602
|
+
`Auto-Scale: ${result.autoScale ? 'Yes' : 'No'}`,
|
|
603
|
+
`Utilization: ${(utilization * 100).toFixed(1)}%`
|
|
604
|
+
].join('\n'), 'Agent Pool');
|
|
605
|
+
const agents = result.agents ?? [];
|
|
606
|
+
if (agents.length > 0) {
|
|
607
|
+
output.writeln();
|
|
608
|
+
output.writeln(output.bold('Pool Agents'));
|
|
609
|
+
output.printTable({
|
|
610
|
+
columns: [
|
|
611
|
+
{ key: 'id', header: 'ID', width: 20 },
|
|
612
|
+
{ key: 'type', header: 'Type', width: 15 },
|
|
613
|
+
{ key: 'status', header: 'Status', width: 12, format: formatStatus }
|
|
614
|
+
],
|
|
615
|
+
data: agents
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
return { success: true, data: result };
|
|
619
|
+
}
|
|
620
|
+
catch (error) {
|
|
621
|
+
if (error instanceof MCPClientError) {
|
|
622
|
+
output.printError(`Pool error: ${error.message}`);
|
|
623
|
+
}
|
|
624
|
+
else {
|
|
625
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
626
|
+
}
|
|
627
|
+
return { success: false, exitCode: 1 };
|
|
628
|
+
}
|
|
629
|
+
}
|
|
728
630
|
};
|
|
729
631
|
// Agent health subcommand
|
|
730
|
-
|
|
632
|
+
const healthCommand = {
|
|
731
633
|
name: 'health',
|
|
732
634
|
description: 'Show agent health and metrics',
|
|
733
635
|
options: [
|
|
@@ -742,114 +644,102 @@ var healthCommand = {
|
|
|
742
644
|
short: 'd',
|
|
743
645
|
description: 'Show detailed health metrics',
|
|
744
646
|
type: 'boolean',
|
|
745
|
-
|
|
647
|
+
default: false
|
|
746
648
|
},
|
|
747
649
|
{
|
|
748
650
|
name: 'watch',
|
|
749
651
|
short: 'w',
|
|
750
652
|
description: 'Watch mode (refresh every 5s)',
|
|
751
653
|
type: 'boolean',
|
|
752
|
-
|
|
654
|
+
default: false
|
|
753
655
|
}
|
|
754
656
|
],
|
|
755
657
|
examples: [
|
|
756
658
|
{ command: 'claude-flow agent health', description: 'Show all agents health' },
|
|
757
659
|
{ command: 'claude-flow agent health -i agent-001 -d', description: 'Detailed health for specific agent' }
|
|
758
660
|
],
|
|
759
|
-
action:
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
661
|
+
action: async (ctx) => {
|
|
662
|
+
const agentId = ctx.args[0] || ctx.flags.id;
|
|
663
|
+
const detailed = ctx.flags.detailed;
|
|
664
|
+
try {
|
|
665
|
+
const result = await callMCPTool('agent_health', {
|
|
666
|
+
agentId,
|
|
667
|
+
detailed,
|
|
668
|
+
});
|
|
669
|
+
if (ctx.flags.format === 'json') {
|
|
670
|
+
output.printJson(result);
|
|
671
|
+
return { success: true, data: result };
|
|
672
|
+
}
|
|
673
|
+
output.writeln();
|
|
674
|
+
output.writeln(output.bold('Agent Health'));
|
|
675
|
+
output.writeln();
|
|
676
|
+
// Overall summary with null checks
|
|
677
|
+
const overall = result.overall ?? { healthy: 0, degraded: 0, unhealthy: 0, avgCpu: 0, avgMemory: 0 };
|
|
678
|
+
const avgCpu = overall.avgCpu ?? 0;
|
|
679
|
+
const avgMemory = overall.avgMemory ?? 0;
|
|
680
|
+
output.printBox([
|
|
681
|
+
`Healthy: ${output.success(String(overall.healthy ?? 0))}`,
|
|
682
|
+
`Degraded: ${output.warning(String(overall.degraded ?? 0))}`,
|
|
683
|
+
`Unhealthy: ${output.error(String(overall.unhealthy ?? 0))}`,
|
|
684
|
+
`Avg CPU: ${avgCpu.toFixed(1)}%`,
|
|
685
|
+
`Avg Memory: ${(avgMemory * 100).toFixed(1)}%`
|
|
686
|
+
].join(' | '), 'Overall Status');
|
|
687
|
+
const healthAgents = result.agents ?? [];
|
|
688
|
+
output.writeln();
|
|
689
|
+
output.printTable({
|
|
690
|
+
columns: [
|
|
691
|
+
{ key: 'id', header: 'Agent ID', width: 18 },
|
|
692
|
+
{ key: 'type', header: 'Type', width: 12 },
|
|
693
|
+
{ key: 'health', header: 'Health', width: 10, format: formatHealthStatus },
|
|
694
|
+
{ key: 'cpu', header: 'CPU %', width: 8, align: 'right', format: (v) => `${Number(v ?? 0).toFixed(1)}%` },
|
|
695
|
+
{ key: 'memory', header: 'Memory', width: 10, align: 'right', format: (v) => {
|
|
696
|
+
const mem = v;
|
|
697
|
+
if (!mem)
|
|
698
|
+
return '0%';
|
|
699
|
+
return `${(mem.used / mem.limit * 100).toFixed(0)}%`;
|
|
700
|
+
} },
|
|
701
|
+
{ key: 'tasks', header: 'Tasks', width: 12, align: 'right', format: (v) => {
|
|
702
|
+
const t = v;
|
|
703
|
+
if (!t)
|
|
704
|
+
return '0/0';
|
|
705
|
+
return `${t.active ?? 0}/${t.completed ?? 0}`;
|
|
706
|
+
} }
|
|
707
|
+
],
|
|
708
|
+
data: healthAgents
|
|
709
|
+
});
|
|
710
|
+
if (detailed && healthAgents.length > 0) {
|
|
711
|
+
output.writeln();
|
|
712
|
+
output.writeln(output.bold('Detailed Metrics'));
|
|
713
|
+
for (const agent of healthAgents) {
|
|
794
714
|
output.writeln();
|
|
795
|
-
output.
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
{ key: 'tasks', header: 'Tasks', width: 12, align: 'right', format: function (v) {
|
|
808
|
-
var _a, _b;
|
|
809
|
-
var t = v;
|
|
810
|
-
if (!t)
|
|
811
|
-
return '0/0';
|
|
812
|
-
return ((_a = t.active) !== null && _a !== void 0 ? _a : 0) + "/" + ((_b = t.completed) !== null && _b !== void 0 ? _b : 0);
|
|
813
|
-
} }
|
|
814
|
-
],
|
|
815
|
-
data: healthAgents
|
|
816
|
-
});
|
|
817
|
-
if (detailed && healthAgents.length > 0) {
|
|
818
|
-
output.writeln();
|
|
819
|
-
output.writeln(output.bold('Detailed Metrics'));
|
|
820
|
-
for (_i = 0, healthAgents_1 = healthAgents; _i < healthAgents_1.length; _i++) {
|
|
821
|
-
agent = healthAgents_1[_i];
|
|
822
|
-
output.writeln();
|
|
823
|
-
output.writeln(output.highlight(agent.id));
|
|
824
|
-
uptime = (_h = agent.uptime) !== null && _h !== void 0 ? _h : 0;
|
|
825
|
-
latency = (_j = agent.latency) !== null && _j !== void 0 ? _j : { avg: 0, p99: 0 };
|
|
826
|
-
tasks = (_k = agent.tasks) !== null && _k !== void 0 ? _k : { completed: 0, failed: 0, queued: 0 };
|
|
827
|
-
errors = (_l = agent.errors) !== null && _l !== void 0 ? _l : { count: 0 };
|
|
828
|
-
output.printList([
|
|
829
|
-
"Uptime: " + (uptime / 1000 / 60).toFixed(1) + " min",
|
|
830
|
-
"Latency: avg " + ((_m = latency.avg) !== null && _m !== void 0 ? _m : 0).toFixed(1) + "ms, p99 " + ((_o = latency.p99) !== null && _o !== void 0 ? _o : 0).toFixed(1) + "ms",
|
|
831
|
-
"Tasks: " + ((_p = tasks.completed) !== null && _p !== void 0 ? _p : 0) + " completed, " + ((_q = tasks.failed) !== null && _q !== void 0 ? _q : 0) + " failed, " + ((_r = tasks.queued) !== null && _r !== void 0 ? _r : 0) + " queued",
|
|
832
|
-
"Errors: " + ((_s = errors.count) !== null && _s !== void 0 ? _s : 0) + (errors.lastError ? " (" + errors.lastError + ")" : '')
|
|
833
|
-
]);
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
return [2 /*return*/, { success: true, data: result }];
|
|
837
|
-
case 3:
|
|
838
|
-
error_6 = _t.sent();
|
|
839
|
-
if (error_6 instanceof MCPClientError) {
|
|
840
|
-
output.printError("Health check error: " + error_6.message);
|
|
841
|
-
}
|
|
842
|
-
else {
|
|
843
|
-
output.printError("Unexpected error: " + String(error_6));
|
|
844
|
-
}
|
|
845
|
-
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
846
|
-
case 4: return [2 /*return*/];
|
|
715
|
+
output.writeln(output.highlight(agent.id));
|
|
716
|
+
const uptime = agent.uptime ?? 0;
|
|
717
|
+
const latency = agent.latency ?? { avg: 0, p99: 0 };
|
|
718
|
+
const tasks = agent.tasks ?? { completed: 0, failed: 0, queued: 0 };
|
|
719
|
+
const errors = agent.errors ?? { count: 0 };
|
|
720
|
+
output.printList([
|
|
721
|
+
`Uptime: ${(uptime / 1000 / 60).toFixed(1)} min`,
|
|
722
|
+
`Latency: avg ${(latency.avg ?? 0).toFixed(1)}ms, p99 ${(latency.p99 ?? 0).toFixed(1)}ms`,
|
|
723
|
+
`Tasks: ${tasks.completed ?? 0} completed, ${tasks.failed ?? 0} failed, ${tasks.queued ?? 0} queued`,
|
|
724
|
+
`Errors: ${errors.count ?? 0}${errors.lastError ? ` (${errors.lastError})` : ''}`
|
|
725
|
+
]);
|
|
726
|
+
}
|
|
847
727
|
}
|
|
848
|
-
|
|
849
|
-
|
|
728
|
+
return { success: true, data: result };
|
|
729
|
+
}
|
|
730
|
+
catch (error) {
|
|
731
|
+
if (error instanceof MCPClientError) {
|
|
732
|
+
output.printError(`Health check error: ${error.message}`);
|
|
733
|
+
}
|
|
734
|
+
else {
|
|
735
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
736
|
+
}
|
|
737
|
+
return { success: false, exitCode: 1 };
|
|
738
|
+
}
|
|
739
|
+
}
|
|
850
740
|
};
|
|
851
741
|
// Agent logs subcommand
|
|
852
|
-
|
|
742
|
+
const logsCommand = {
|
|
853
743
|
name: 'logs',
|
|
854
744
|
description: 'Show agent activity logs',
|
|
855
745
|
options: [
|
|
@@ -864,7 +754,7 @@ var logsCommand = {
|
|
|
864
754
|
short: 'n',
|
|
865
755
|
description: 'Number of recent entries',
|
|
866
756
|
type: 'number',
|
|
867
|
-
|
|
757
|
+
default: 50
|
|
868
758
|
},
|
|
869
759
|
{
|
|
870
760
|
name: 'level',
|
|
@@ -872,14 +762,14 @@ var logsCommand = {
|
|
|
872
762
|
description: 'Minimum log level',
|
|
873
763
|
type: 'string',
|
|
874
764
|
choices: ['debug', 'info', 'warn', 'error'],
|
|
875
|
-
|
|
765
|
+
default: 'info'
|
|
876
766
|
},
|
|
877
767
|
{
|
|
878
768
|
name: 'follow',
|
|
879
769
|
short: 'f',
|
|
880
770
|
description: 'Follow log output',
|
|
881
771
|
type: 'boolean',
|
|
882
|
-
|
|
772
|
+
default: false
|
|
883
773
|
},
|
|
884
774
|
{
|
|
885
775
|
name: 'since',
|
|
@@ -892,63 +782,52 @@ var logsCommand = {
|
|
|
892
782
|
{ command: 'claude-flow agent logs -i agent-001 -f', description: 'Follow agent logs' },
|
|
893
783
|
{ command: 'claude-flow agent logs -l error --since 1h', description: 'Show errors from last hour' }
|
|
894
784
|
],
|
|
895
|
-
action:
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
level: level,
|
|
914
|
-
since: ctx.flags.since
|
|
915
|
-
})];
|
|
916
|
-
case 2:
|
|
917
|
-
result = _b.sent();
|
|
918
|
-
if (ctx.flags.format === 'json') {
|
|
919
|
-
output.printJson(result);
|
|
920
|
-
return [2 /*return*/, { success: true, data: result }];
|
|
921
|
-
}
|
|
922
|
-
output.writeln();
|
|
923
|
-
output.writeln(output.bold("Logs for " + agentId));
|
|
924
|
-
output.writeln(output.dim("Showing " + result.entries.length + " of " + result.total + " entries"));
|
|
925
|
-
output.writeln();
|
|
926
|
-
for (_i = 0, _a = result.entries; _i < _a.length; _i++) {
|
|
927
|
-
entry = _a[_i];
|
|
928
|
-
time = new Date(entry.timestamp).toLocaleTimeString();
|
|
929
|
-
levelStr = formatLogLevel(entry.level);
|
|
930
|
-
output.writeln(output.dim(time) + " " + levelStr + " " + entry.message);
|
|
931
|
-
if (entry.context && Object.keys(entry.context).length > 0) {
|
|
932
|
-
output.writeln(output.dim(" " + JSON.stringify(entry.context)));
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
return [2 /*return*/, { success: true, data: result }];
|
|
936
|
-
case 3:
|
|
937
|
-
error_7 = _b.sent();
|
|
938
|
-
if (error_7 instanceof MCPClientError) {
|
|
939
|
-
output.printError("Logs error: " + error_7.message);
|
|
940
|
-
}
|
|
941
|
-
else {
|
|
942
|
-
output.printError("Unexpected error: " + String(error_7));
|
|
943
|
-
}
|
|
944
|
-
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
945
|
-
case 4: return [2 /*return*/];
|
|
785
|
+
action: async (ctx) => {
|
|
786
|
+
const agentId = ctx.args[0] || ctx.flags.id;
|
|
787
|
+
const tail = ctx.flags.tail;
|
|
788
|
+
const level = ctx.flags.level;
|
|
789
|
+
if (!agentId) {
|
|
790
|
+
output.printError('Agent ID is required. Use --id or -i');
|
|
791
|
+
return { success: false, exitCode: 1 };
|
|
792
|
+
}
|
|
793
|
+
try {
|
|
794
|
+
const result = await callMCPTool('agent_logs', {
|
|
795
|
+
agentId,
|
|
796
|
+
tail,
|
|
797
|
+
level,
|
|
798
|
+
since: ctx.flags.since,
|
|
799
|
+
});
|
|
800
|
+
if (ctx.flags.format === 'json') {
|
|
801
|
+
output.printJson(result);
|
|
802
|
+
return { success: true, data: result };
|
|
946
803
|
}
|
|
947
|
-
|
|
948
|
-
|
|
804
|
+
output.writeln();
|
|
805
|
+
output.writeln(output.bold(`Logs for ${agentId}`));
|
|
806
|
+
output.writeln(output.dim(`Showing ${result.entries.length} of ${result.total} entries`));
|
|
807
|
+
output.writeln();
|
|
808
|
+
for (const entry of result.entries) {
|
|
809
|
+
const time = new Date(entry.timestamp).toLocaleTimeString();
|
|
810
|
+
const levelStr = formatLogLevel(entry.level);
|
|
811
|
+
output.writeln(`${output.dim(time)} ${levelStr} ${entry.message}`);
|
|
812
|
+
if (entry.context && Object.keys(entry.context).length > 0) {
|
|
813
|
+
output.writeln(output.dim(` ${JSON.stringify(entry.context)}`));
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
return { success: true, data: result };
|
|
817
|
+
}
|
|
818
|
+
catch (error) {
|
|
819
|
+
if (error instanceof MCPClientError) {
|
|
820
|
+
output.printError(`Logs error: ${error.message}`);
|
|
821
|
+
}
|
|
822
|
+
else {
|
|
823
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
824
|
+
}
|
|
825
|
+
return { success: false, exitCode: 1 };
|
|
826
|
+
}
|
|
827
|
+
}
|
|
949
828
|
};
|
|
950
829
|
function formatHealthStatus(health) {
|
|
951
|
-
|
|
830
|
+
const h = String(health);
|
|
952
831
|
switch (h) {
|
|
953
832
|
case 'healthy':
|
|
954
833
|
return output.success(h);
|
|
@@ -971,11 +850,11 @@ function formatLogLevel(level) {
|
|
|
971
850
|
case 'error':
|
|
972
851
|
return output.error('[ERROR]');
|
|
973
852
|
default:
|
|
974
|
-
return
|
|
853
|
+
return `[${level.toUpperCase()}]`;
|
|
975
854
|
}
|
|
976
855
|
}
|
|
977
856
|
// Main agent command
|
|
978
|
-
export
|
|
857
|
+
export const agentCommand = {
|
|
979
858
|
name: 'agent',
|
|
980
859
|
description: 'Agent management commands',
|
|
981
860
|
subcommands: [spawnCommand, listCommand, statusCommand, stopCommand, metricsCommand, poolCommand, healthCommand, logsCommand],
|
|
@@ -985,31 +864,29 @@ export var agentCommand = {
|
|
|
985
864
|
{ command: 'claude-flow agent list', description: 'List all agents' },
|
|
986
865
|
{ command: 'claude-flow agent status agent-001', description: 'Show agent status' }
|
|
987
866
|
],
|
|
988
|
-
action:
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
output.
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
});
|
|
1008
|
-
}); }
|
|
867
|
+
action: async (ctx) => {
|
|
868
|
+
// Show help if no subcommand
|
|
869
|
+
output.writeln();
|
|
870
|
+
output.writeln(output.bold('Agent Management Commands'));
|
|
871
|
+
output.writeln();
|
|
872
|
+
output.writeln('Usage: claude-flow agent <subcommand> [options]');
|
|
873
|
+
output.writeln();
|
|
874
|
+
output.writeln('Subcommands:');
|
|
875
|
+
output.printList([
|
|
876
|
+
`${output.highlight('spawn')} - Spawn a new agent`,
|
|
877
|
+
`${output.highlight('list')} - List all active agents`,
|
|
878
|
+
`${output.highlight('status')} - Show detailed agent status`,
|
|
879
|
+
`${output.highlight('stop')} - Stop a running agent`,
|
|
880
|
+
`${output.highlight('metrics')} - Show agent metrics`
|
|
881
|
+
]);
|
|
882
|
+
output.writeln();
|
|
883
|
+
output.writeln('Run "claude-flow agent <subcommand> --help" for subcommand help');
|
|
884
|
+
return { success: true };
|
|
885
|
+
}
|
|
1009
886
|
};
|
|
1010
887
|
// Helper functions
|
|
1011
888
|
function getAgentCapabilities(type) {
|
|
1012
|
-
|
|
889
|
+
const capabilities = {
|
|
1013
890
|
coder: ['code-generation', 'refactoring', 'debugging', 'testing'],
|
|
1014
891
|
researcher: ['web-search', 'data-analysis', 'summarization', 'citation'],
|
|
1015
892
|
tester: ['unit-testing', 'integration-testing', 'coverage-analysis', 'automation'],
|
|
@@ -1023,7 +900,7 @@ function getAgentCapabilities(type) {
|
|
|
1023
900
|
return capabilities[type] || ['general'];
|
|
1024
901
|
}
|
|
1025
902
|
function formatStatus(status) {
|
|
1026
|
-
|
|
903
|
+
const statusStr = String(status);
|
|
1027
904
|
switch (statusStr) {
|
|
1028
905
|
case 'active':
|
|
1029
906
|
return output.success(statusStr);
|