kynjal-cli 3.1.4 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/core/coder.md +1 -1
- package/.claude/agents/core/planner.md +2 -2
- package/.claude/agents/core/researcher.md +1 -1
- package/.claude/agents/core/reviewer.md +1 -1
- package/.claude/agents/core/tester.md +1 -1
- package/.claude/agents/data/data-ml-model.md +4 -4
- package/.claude/agents/development/dev-backend-api.md +4 -4
- package/.claude/agents/documentation/docs-api-openapi.md +4 -4
- package/.claude/agents/github/code-review-swarm.md +2 -2
- package/.claude/agents/github/issue-tracker.md +2 -2
- package/.claude/agents/github/pr-manager.md +2 -2
- package/.claude/agents/github/release-manager.md +2 -2
- package/.claude/agents/github/workflow-automation.md +2 -2
- package/.claude/agents/sparc/architecture.md +3 -3
- package/.claude/agents/sparc/pseudocode.md +2 -2
- package/.claude/agents/sparc/refinement.md +3 -3
- package/.claude/agents/sparc/specification.md +2 -2
- package/.claude/agents/swarm/adaptive-coordinator.md +1 -1
- package/.claude/agents/swarm/hierarchical-coordinator.md +1 -1
- package/.claude/agents/swarm/mesh-coordinator.md +1 -1
- package/.claude/agents/templates/base-template-generator.md +25 -4
- package/.claude/agents/templates/sparc-coordinator.md +3 -3
- package/.claude/helpers/auto-commit.sh +1 -1
- package/.claude/helpers/auto-memory-hook.mjs +27 -9
- package/.claude/helpers/hook-handler.cjs +58 -18
- package/.claude/helpers/statusline.cjs +420 -613
- package/.claude/helpers/statusline.js +3 -3
- package/.claude/settings.json +9 -9
- package/.claude/skills/reasoningbank-intelligence/SKILL.md +2 -2
- package/.claude/skills/swarm-orchestration/SKILL.md +1 -1
- package/README.md +383 -170
- package/bin/cli.js +6 -6
- package/bin/mcp-server.js +1 -1
- package/bin/preinstall.cjs +2 -0
- package/dist/src/appliance/gguf-engine.js +664 -0
- package/dist/src/appliance/gguf-engine.js.map +1 -0
- package/dist/src/appliance/ruvllm-bridge.js +492 -0
- package/dist/src/appliance/ruvllm-bridge.js.map +1 -0
- package/dist/src/appliance/rvfa-builder.js +383 -0
- package/dist/src/appliance/rvfa-builder.js.map +1 -0
- package/dist/src/appliance/rvfa-distribution.js +533 -0
- package/dist/src/appliance/rvfa-distribution.js.map +1 -0
- package/dist/src/appliance/rvfa-format.js +465 -0
- package/dist/src/appliance/rvfa-format.js.map +1 -0
- package/dist/src/appliance/rvfa-runner.js +373 -0
- package/dist/src/appliance/rvfa-runner.js.map +1 -0
- package/dist/src/appliance/rvfa-signing.js +469 -0
- package/dist/src/appliance/rvfa-signing.js.map +1 -0
- package/dist/src/benchmarks/pretrain/index.js +542 -331
- package/dist/src/benchmarks/pretrain/index.js.map +1 -1
- package/dist/src/commands/agent.d.ts.map +1 -1
- package/dist/src/commands/agent.js +725 -502
- package/dist/src/commands/agent.js.map +1 -1
- package/dist/src/commands/analyze.js +1548 -1218
- package/dist/src/commands/analyze.js.map +1 -1
- package/dist/src/commands/appliance-advanced.d.ts +9 -0
- package/dist/src/commands/appliance-advanced.d.ts.map +1 -0
- package/dist/src/commands/appliance-advanced.js +324 -0
- package/dist/src/commands/appliance-advanced.js.map +1 -0
- package/dist/src/commands/appliance.d.ts +8 -0
- package/dist/src/commands/appliance.d.ts.map +1 -0
- package/dist/src/commands/appliance.js +581 -0
- package/dist/src/commands/appliance.js.map +1 -0
- package/dist/src/commands/benchmark.js +523 -372
- package/dist/src/commands/benchmark.js.map +1 -1
- package/dist/src/commands/claims.js +364 -274
- package/dist/src/commands/claims.js.map +1 -1
- package/dist/src/commands/cleanup.d.ts +13 -0
- package/dist/src/commands/cleanup.d.ts.map +1 -0
- package/dist/src/commands/cleanup.js +262 -0
- package/dist/src/commands/cleanup.js.map +1 -0
- package/dist/src/commands/completions.js +118 -477
- package/dist/src/commands/completions.js.map +1 -1
- package/dist/src/commands/config.js +303 -237
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/daemon.d.ts.map +1 -1
- package/dist/src/commands/daemon.js +597 -425
- package/dist/src/commands/daemon.js.map +1 -1
- package/dist/src/commands/deployment.js +275 -194
- package/dist/src/commands/deployment.js.map +1 -1
- package/dist/src/commands/doctor.d.ts.map +1 -1
- package/dist/src/commands/doctor.js +690 -460
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/src/commands/embeddings.js +1543 -1293
- package/dist/src/commands/embeddings.js.map +1 -1
- package/dist/src/commands/guidance.js +596 -449
- package/dist/src/commands/guidance.js.map +1 -1
- package/dist/src/commands/hive-mind.js +938 -854
- package/dist/src/commands/hive-mind.js.map +1 -1
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +3677 -2570
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/index.js +322 -122
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/init.d.ts +1 -1
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +943 -787
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/issues.js +558 -383
- package/dist/src/commands/issues.js.map +1 -1
- package/dist/src/commands/mcp.d.ts.map +1 -1
- package/dist/src/commands/mcp.js +605 -475
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/memory.d.ts.map +1 -1
- package/dist/src/commands/memory.js +1031 -814
- package/dist/src/commands/memory.js.map +1 -1
- package/dist/src/commands/migrate.js +347 -282
- package/dist/src/commands/migrate.js.map +1 -1
- package/dist/src/commands/neural.d.ts.map +1 -1
- package/dist/src/commands/neural.js +1563 -1283
- package/dist/src/commands/neural.js.map +1 -1
- package/dist/src/commands/performance.js +643 -497
- package/dist/src/commands/performance.js.map +1 -1
- package/dist/src/commands/plugins.js +841 -668
- package/dist/src/commands/plugins.js.map +1 -1
- package/dist/src/commands/process.js +447 -392
- package/dist/src/commands/process.js.map +1 -1
- package/dist/src/commands/progress.js +256 -162
- package/dist/src/commands/progress.js.map +1 -1
- package/dist/src/commands/providers.js +220 -150
- package/dist/src/commands/providers.js.map +1 -1
- package/dist/src/commands/route.js +665 -520
- package/dist/src/commands/route.js.map +1 -1
- package/dist/src/commands/ruvector/backup.js +651 -505
- package/dist/src/commands/ruvector/backup.js.map +1 -1
- package/dist/src/commands/ruvector/benchmark.js +401 -349
- package/dist/src/commands/ruvector/benchmark.js.map +1 -1
- package/dist/src/commands/ruvector/import.js +267 -225
- package/dist/src/commands/ruvector/import.js.map +1 -1
- package/dist/src/commands/ruvector/index.js +75 -37
- package/dist/src/commands/ruvector/index.js.map +1 -1
- package/dist/src/commands/ruvector/init.js +359 -336
- package/dist/src/commands/ruvector/init.js.map +1 -1
- package/dist/src/commands/ruvector/migrate.js +322 -335
- package/dist/src/commands/ruvector/migrate.js.map +1 -1
- package/dist/src/commands/ruvector/optimize.js +431 -375
- package/dist/src/commands/ruvector/optimize.js.map +1 -1
- package/dist/src/commands/ruvector/setup.js +117 -703
- package/dist/src/commands/ruvector/setup.js.map +1 -1
- package/dist/src/commands/ruvector/status.js +419 -364
- package/dist/src/commands/ruvector/status.js.map +1 -1
- package/dist/src/commands/security.d.ts.map +1 -1
- package/dist/src/commands/security.js +610 -456
- package/dist/src/commands/security.js.map +1 -1
- package/dist/src/commands/session.d.ts +1 -1
- package/dist/src/commands/session.js +627 -505
- package/dist/src/commands/session.js.map +1 -1
- package/dist/src/commands/start.d.ts +1 -1
- package/dist/src/commands/start.js +368 -271
- package/dist/src/commands/start.js.map +1 -1
- package/dist/src/commands/status.d.ts +1 -1
- package/dist/src/commands/status.d.ts.map +1 -1
- package/dist/src/commands/status.js +492 -379
- package/dist/src/commands/status.js.map +1 -1
- package/dist/src/commands/swarm.js +488 -408
- package/dist/src/commands/swarm.js.map +1 -1
- package/dist/src/commands/task.d.ts +1 -1
- package/dist/src/commands/task.js +539 -424
- package/dist/src/commands/task.js.map +1 -1
- package/dist/src/commands/transfer-store.js +412 -322
- package/dist/src/commands/transfer-store.js.map +1 -1
- package/dist/src/commands/update.js +291 -196
- package/dist/src/commands/update.js.map +1 -1
- package/dist/src/commands/workflow.js +486 -386
- package/dist/src/commands/workflow.js.map +1 -1
- package/dist/src/config-adapter.js +40 -39
- package/dist/src/config-adapter.js.map +1 -1
- package/dist/src/index.js +416 -312
- package/dist/src/index.js.map +1 -1
- package/dist/src/infrastructure/in-memory-repositories.js +507 -246
- package/dist/src/infrastructure/in-memory-repositories.js.map +1 -1
- package/dist/src/init/claudemd-generator.js +78 -368
- package/dist/src/init/claudemd-generator.js.map +1 -1
- package/dist/src/init/executor.js +1019 -1345
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/helpers-generator.js +60 -635
- 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.d.ts +0 -1
- package/dist/src/init/mcp-generator.d.ts.map +1 -1
- package/dist/src/init/mcp-generator.js +62 -42
- package/dist/src/init/mcp-generator.js.map +1 -1
- package/dist/src/init/settings-generator.d.ts.map +1 -1
- package/dist/src/init/settings-generator.js +167 -100
- package/dist/src/init/settings-generator.js.map +1 -1
- package/dist/src/init/statusline-generator.d.ts +16 -8
- package/dist/src/init/statusline-generator.d.ts.map +1 -1
- package/dist/src/init/statusline-generator.js +20 -1300
- package/dist/src/init/statusline-generator.js.map +1 -1
- package/dist/src/init/types.d.ts +15 -5
- package/dist/src/init/types.d.ts.map +1 -1
- package/dist/src/init/types.js +66 -76
- package/dist/src/init/types.js.map +1 -1
- package/dist/src/mcp-client.js +130 -76
- package/dist/src/mcp-client.js.map +1 -1
- package/dist/src/mcp-server.js +758 -445
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +492 -391
- package/dist/src/mcp-tools/agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/agentdb-tools.d.ts +30 -0
- package/dist/src/mcp-tools/agentdb-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/agentdb-tools.js +758 -0
- package/dist/src/mcp-tools/agentdb-tools.js.map +1 -0
- package/dist/src/mcp-tools/analyze-tools.js +236 -172
- package/dist/src/mcp-tools/analyze-tools.js.map +1 -1
- package/dist/src/mcp-tools/auto-install.js +142 -80
- package/dist/src/mcp-tools/auto-install.js.map +1 -1
- package/dist/src/mcp-tools/browser-tools.js +375 -252
- package/dist/src/mcp-tools/browser-tools.js.map +1 -1
- package/dist/src/mcp-tools/claims-tools.js +565 -473
- package/dist/src/mcp-tools/claims-tools.js.map +1 -1
- package/dist/src/mcp-tools/config-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/config-tools.js +284 -190
- package/dist/src/mcp-tools/config-tools.js.map +1 -1
- package/dist/src/mcp-tools/coordination-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/coordination-tools.js +600 -349
- package/dist/src/mcp-tools/coordination-tools.js.map +1 -1
- package/dist/src/mcp-tools/daa-tools.js +367 -289
- package/dist/src/mcp-tools/daa-tools.js.map +1 -1
- package/dist/src/mcp-tools/embeddings-tools.js +693 -582
- package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
- package/dist/src/mcp-tools/github-tools.js +312 -261
- package/dist/src/mcp-tools/github-tools.js.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.js +718 -423
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +2726 -1978
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/mcp-tools/index.d.ts +2 -0
- package/dist/src/mcp-tools/index.d.ts.map +1 -1
- package/dist/src/mcp-tools/index.js +2 -0
- package/dist/src/mcp-tools/index.js.map +1 -1
- package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/memory-tools.js +514 -329
- package/dist/src/mcp-tools/memory-tools.js.map +1 -1
- package/dist/src/mcp-tools/neural-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/neural-tools.js +428 -326
- package/dist/src/mcp-tools/neural-tools.js.map +1 -1
- package/dist/src/mcp-tools/performance-tools.js +480 -420
- package/dist/src/mcp-tools/performance-tools.js.map +1 -1
- package/dist/src/mcp-tools/progress-tools.js +278 -204
- package/dist/src/mcp-tools/progress-tools.js.map +1 -1
- package/dist/src/mcp-tools/ruvllm-tools.d.ts +9 -0
- package/dist/src/mcp-tools/ruvllm-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/ruvllm-tools.js +399 -0
- package/dist/src/mcp-tools/ruvllm-tools.js.map +1 -0
- package/dist/src/mcp-tools/security-tools.js +429 -297
- package/dist/src/mcp-tools/security-tools.js.map +1 -1
- package/dist/src/mcp-tools/session-tools.js +234 -185
- package/dist/src/mcp-tools/session-tools.js.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.d.ts +2 -1
- package/dist/src/mcp-tools/swarm-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.js +303 -64
- package/dist/src/mcp-tools/swarm-tools.js.map +1 -1
- package/dist/src/mcp-tools/system-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/system-tools.js +352 -200
- package/dist/src/mcp-tools/system-tools.js.map +1 -1
- package/dist/src/mcp-tools/task-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/task-tools.js +357 -189
- package/dist/src/mcp-tools/task-tools.js.map +1 -1
- package/dist/src/mcp-tools/terminal-tools.js +196 -148
- package/dist/src/mcp-tools/terminal-tools.js.map +1 -1
- package/dist/src/mcp-tools/transfer-tools.js +333 -186
- package/dist/src/mcp-tools/transfer-tools.js.map +1 -1
- package/dist/src/mcp-tools/wasm-agent-tools.d.ts +9 -0
- package/dist/src/mcp-tools/wasm-agent-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/wasm-agent-tools.js +377 -0
- package/dist/src/mcp-tools/wasm-agent-tools.js.map +1 -0
- package/dist/src/mcp-tools/workflow-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/workflow-tools.js +471 -335
- package/dist/src/mcp-tools/workflow-tools.js.map +1 -1
- package/dist/src/memory/ewc-consolidation.js +345 -173
- package/dist/src/memory/ewc-consolidation.js.map +1 -1
- package/dist/src/memory/intelligence.js +841 -359
- package/dist/src/memory/intelligence.js.map +1 -1
- package/dist/src/memory/memory-bridge.js +1964 -0
- package/dist/src/memory/memory-bridge.js.map +1 -0
- package/dist/src/memory/memory-initializer.js +1895 -1602
- package/dist/src/memory/memory-initializer.js.map +1 -1
- package/dist/src/memory/sona-optimizer.js +329 -199
- 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 +273 -242
- package/dist/src/output.js.map +1 -1
- package/dist/src/parser.js +217 -124
- package/dist/src/parser.js.map +1 -1
- package/dist/src/plugins/manager.js +531 -278
- package/dist/src/plugins/manager.js.map +1 -1
- package/dist/src/plugins/store/discovery.js +362 -275
- package/dist/src/plugins/store/discovery.js.map +1 -1
- package/dist/src/plugins/store/index.js +105 -48
- package/dist/src/plugins/store/index.js.map +1 -1
- package/dist/src/plugins/store/search.js +107 -69
- package/dist/src/plugins/store/search.js.map +1 -1
- package/dist/src/plugins/tests/demo-plugin-store.js +160 -113
- package/dist/src/plugins/tests/demo-plugin-store.js.map +1 -1
- package/dist/src/plugins/tests/standalone-test.js +223 -172
- package/dist/src/plugins/tests/standalone-test.js.map +1 -1
- package/dist/src/plugins/tests/test-plugin-store.js +228 -190
- package/dist/src/plugins/tests/test-plugin-store.js.map +1 -1
- package/dist/src/production/circuit-breaker.js +126 -62
- package/dist/src/production/circuit-breaker.js.map +1 -1
- package/dist/src/production/error-handler.js +156 -86
- package/dist/src/production/error-handler.js.map +1 -1
- package/dist/src/production/monitoring.js +220 -139
- package/dist/src/production/monitoring.js.map +1 -1
- package/dist/src/production/rate-limiter.js +93 -74
- package/dist/src/production/rate-limiter.js.map +1 -1
- package/dist/src/production/retry.js +167 -75
- package/dist/src/production/retry.js.map +1 -1
- package/dist/src/prompt.js +560 -436
- package/dist/src/prompt.js.map +1 -1
- package/dist/src/runtime/headless.js +289 -200
- package/dist/src/runtime/headless.js.map +1 -1
- package/dist/src/ruvector/agent-wasm.js +511 -0
- package/dist/src/ruvector/agent-wasm.js.map +1 -0
- package/dist/src/ruvector/ast-analyzer.js +232 -145
- package/dist/src/ruvector/ast-analyzer.js.map +1 -1
- package/dist/src/ruvector/coverage-router.js +419 -287
- package/dist/src/ruvector/coverage-router.js.map +1 -1
- package/dist/src/ruvector/coverage-tools.js +101 -56
- package/dist/src/ruvector/coverage-tools.js.map +1 -1
- package/dist/src/ruvector/diff-classifier.js +451 -324
- package/dist/src/ruvector/diff-classifier.js.map +1 -1
- package/dist/src/ruvector/enhanced-model-router.js +337 -251
- package/dist/src/ruvector/enhanced-model-router.js.map +1 -1
- package/dist/src/ruvector/flash-attention.js +254 -223
- package/dist/src/ruvector/flash-attention.js.map +1 -1
- package/dist/src/ruvector/graph-analyzer.js +680 -486
- package/dist/src/ruvector/graph-analyzer.js.map +1 -1
- package/dist/src/ruvector/index.js +113 -27
- package/dist/src/ruvector/index.js.map +1 -1
- package/dist/src/ruvector/lora-adapter.js +248 -155
- package/dist/src/ruvector/lora-adapter.js.map +1 -1
- package/dist/src/ruvector/model-router.js +248 -175
- package/dist/src/ruvector/model-router.js.map +1 -1
- package/dist/src/ruvector/moe-router.js +286 -228
- package/dist/src/ruvector/moe-router.js.map +1 -1
- package/dist/src/ruvector/q-learning-router.js +338 -257
- package/dist/src/ruvector/q-learning-router.js.map +1 -1
- package/dist/src/ruvector/ruvllm-wasm.js +527 -0
- package/dist/src/ruvector/ruvllm-wasm.js.map +1 -0
- package/dist/src/ruvector/semantic-router.js +67 -60
- package/dist/src/ruvector/semantic-router.js.map +1 -1
- package/dist/src/ruvector/vector-db.js +205 -119
- package/dist/src/ruvector/vector-db.js.map +1 -1
- package/dist/src/services/agentic-flow-bridge.js +168 -0
- package/dist/src/services/agentic-flow-bridge.js.map +1 -0
- package/dist/src/services/claim-service.js +940 -615
- package/dist/src/services/claim-service.js.map +1 -1
- package/dist/src/services/container-worker-pool.js +669 -399
- package/dist/src/services/container-worker-pool.js.map +1 -1
- package/dist/src/services/headless-worker-executor.js +467 -441
- package/dist/src/services/headless-worker-executor.js.map +1 -1
- package/dist/src/services/index.d.ts +5 -5
- 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.js +201 -93
- package/dist/src/services/registry-api.js.map +1 -1
- package/dist/src/services/ruvector-training.js +414 -144
- package/dist/src/services/ruvector-training.js.map +1 -1
- package/dist/src/services/worker-daemon.js +928 -531
- package/dist/src/services/worker-daemon.js.map +1 -1
- package/dist/src/services/worker-queue.js +550 -331
- package/dist/src/services/worker-queue.js.map +1 -1
- package/dist/src/suggest.js +55 -45
- package/dist/src/suggest.js.map +1 -1
- package/dist/src/transfer/anonymization/index.js +37 -29
- package/dist/src/transfer/anonymization/index.js.map +1 -1
- package/dist/src/transfer/deploy-seraphine.d.ts +1 -1
- package/dist/src/transfer/deploy-seraphine.js +156 -129
- package/dist/src/transfer/deploy-seraphine.js.map +1 -1
- package/dist/src/transfer/export.js +142 -84
- 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 +2 -0
- package/dist/src/transfer/index.js.map +1 -1
- package/dist/src/transfer/ipfs/client.js +337 -179
- package/dist/src/transfer/ipfs/client.js.map +1 -1
- package/dist/src/transfer/ipfs/upload.js +434 -290
- package/dist/src/transfer/ipfs/upload.js.map +1 -1
- package/dist/src/transfer/models/seraphine.js +58 -58
- package/dist/src/transfer/models/seraphine.js.map +1 -1
- package/dist/src/transfer/serialization/cfp.js +37 -33
- package/dist/src/transfer/serialization/cfp.js.map +1 -1
- package/dist/src/transfer/storage/gcs.js +248 -139
- package/dist/src/transfer/storage/gcs.js.map +1 -1
- package/dist/src/transfer/store/discovery.js +353 -243
- package/dist/src/transfer/store/discovery.js.map +1 -1
- package/dist/src/transfer/store/download.js +365 -243
- package/dist/src/transfer/store/download.js.map +1 -1
- package/dist/src/transfer/store/index.js +130 -63
- package/dist/src/transfer/store/index.js.map +1 -1
- package/dist/src/transfer/store/publish.js +258 -184
- package/dist/src/transfer/store/publish.js.map +1 -1
- package/dist/src/transfer/store/registry.js +73 -51
- package/dist/src/transfer/store/registry.js.map +1 -1
- package/dist/src/transfer/store/search.js +96 -64
- package/dist/src/transfer/store/search.js.map +1 -1
- package/dist/src/transfer/store/tests/standalone-test.js +231 -174
- package/dist/src/transfer/store/tests/standalone-test.js.map +1 -1
- package/dist/src/transfer/test-seraphine.js +130 -95
- package/dist/src/transfer/test-seraphine.js.map +1 -1
- package/dist/src/transfer/tests/test-store.js +239 -194
- package/dist/src/transfer/tests/test-store.js.map +1 -1
- package/dist/src/types.js +56 -27
- package/dist/src/types.js.map +1 -1
- package/dist/src/update/checker.js +183 -106
- package/dist/src/update/checker.js.map +1 -1
- package/dist/src/update/executor.js +198 -135
- package/dist/src/update/executor.js.map +1 -1
- package/dist/src/update/index.js +85 -38
- package/dist/src/update/index.js.map +1 -1
- package/dist/src/update/rate-limiter.js +31 -19
- package/dist/src/update/rate-limiter.js.map +1 -1
- package/dist/src/update/validator.js +64 -38
- package/dist/src/update/validator.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -10
- package/.claude/agents/custom/accessibility-auditor.yaml +0 -56
- package/.claude/agents/custom/design-architect.yaml +0 -48
- package/.claude/agents/custom/ui-developer.yaml +0 -46
- package/.claude/agents/custom/ux-researcher.yaml +0 -60
- package/dist/src/benchmarks/pretrain/index.d.ts +0 -58
- package/dist/src/benchmarks/pretrain/index.d.ts.map +0 -1
- package/dist/src/commands/index.d.ts +0 -108
- package/dist/src/commands/index.d.ts.map +0 -1
- package/dist/src/config-adapter.d.ts +0 -15
- package/dist/src/config-adapter.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -76
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/infrastructure/in-memory-repositories.d.ts +0 -68
- package/dist/src/infrastructure/in-memory-repositories.d.ts.map +0 -1
- package/dist/src/init/claudemd-generator.d.ts +0 -25
- package/dist/src/init/claudemd-generator.d.ts.map +0 -1
- package/dist/src/init/executor.d.ts +0 -41
- package/dist/src/init/executor.d.ts.map +0 -1
- package/dist/src/init/helpers-generator.d.ts +0 -60
- package/dist/src/init/helpers-generator.d.ts.map +0 -1
- package/dist/src/mcp-client.d.ts +0 -92
- package/dist/src/mcp-client.d.ts.map +0 -1
- package/dist/src/mcp-server.d.ts +0 -161
- package/dist/src/mcp-server.d.ts.map +0 -1
- package/dist/src/mcp-tools/auto-install.d.ts +0 -83
- package/dist/src/mcp-tools/auto-install.d.ts.map +0 -1
- package/dist/src/mcp-tools/types.d.ts +0 -31
- package/dist/src/mcp-tools/types.d.ts.map +0 -1
- package/dist/src/memory/ewc-consolidation.d.ts +0 -271
- package/dist/src/memory/ewc-consolidation.d.ts.map +0 -1
- package/dist/src/memory/intelligence.d.ts +0 -285
- package/dist/src/memory/intelligence.d.ts.map +0 -1
- package/dist/src/memory/memory-initializer.d.ts +0 -396
- package/dist/src/memory/memory-initializer.d.ts.map +0 -1
- package/dist/src/memory/sona-optimizer.d.ts +0 -227
- package/dist/src/memory/sona-optimizer.d.ts.map +0 -1
- package/dist/src/parser.d.ts +0 -41
- package/dist/src/parser.d.ts.map +0 -1
- package/dist/src/plugins/manager.d.ts +0 -133
- package/dist/src/plugins/manager.d.ts.map +0 -1
- package/dist/src/plugins/store/discovery.d.ts +0 -88
- package/dist/src/plugins/store/discovery.d.ts.map +0 -1
- package/dist/src/plugins/store/index.d.ts +0 -76
- package/dist/src/plugins/store/index.d.ts.map +0 -1
- package/dist/src/plugins/store/search.d.ts +0 -46
- package/dist/src/plugins/store/search.d.ts.map +0 -1
- package/dist/src/plugins/store/types.d.ts +0 -274
- package/dist/src/plugins/store/types.d.ts.map +0 -1
- package/dist/src/production/circuit-breaker.d.ts +0 -101
- package/dist/src/production/circuit-breaker.d.ts.map +0 -1
- package/dist/src/production/error-handler.d.ts +0 -92
- package/dist/src/production/error-handler.d.ts.map +0 -1
- package/dist/src/production/monitoring.d.ts +0 -161
- package/dist/src/production/monitoring.d.ts.map +0 -1
- package/dist/src/production/rate-limiter.d.ts +0 -80
- package/dist/src/production/rate-limiter.d.ts.map +0 -1
- package/dist/src/production/retry.d.ts +0 -48
- package/dist/src/production/retry.d.ts.map +0 -1
- package/dist/src/prompt.d.ts +0 -44
- package/dist/src/prompt.d.ts.map +0 -1
- package/dist/src/runtime/headless.d.ts +0 -60
- package/dist/src/runtime/headless.d.ts.map +0 -1
- package/dist/src/ruvector/ast-analyzer.d.ts +0 -67
- package/dist/src/ruvector/ast-analyzer.d.ts.map +0 -1
- package/dist/src/ruvector/coverage-router.d.ts +0 -160
- package/dist/src/ruvector/coverage-router.d.ts.map +0 -1
- package/dist/src/ruvector/diff-classifier.d.ts +0 -175
- package/dist/src/ruvector/diff-classifier.d.ts.map +0 -1
- package/dist/src/ruvector/enhanced-model-router.d.ts +0 -146
- package/dist/src/ruvector/enhanced-model-router.d.ts.map +0 -1
- package/dist/src/ruvector/flash-attention.d.ts +0 -195
- package/dist/src/ruvector/flash-attention.d.ts.map +0 -1
- package/dist/src/ruvector/graph-analyzer.d.ts +0 -187
- package/dist/src/ruvector/graph-analyzer.d.ts.map +0 -1
- package/dist/src/ruvector/index.d.ts +0 -34
- package/dist/src/ruvector/index.d.ts.map +0 -1
- package/dist/src/ruvector/lora-adapter.d.ts +0 -218
- package/dist/src/ruvector/lora-adapter.d.ts.map +0 -1
- package/dist/src/ruvector/model-router.d.ts +0 -220
- package/dist/src/ruvector/model-router.d.ts.map +0 -1
- package/dist/src/ruvector/moe-router.d.ts +0 -206
- package/dist/src/ruvector/moe-router.d.ts.map +0 -1
- package/dist/src/ruvector/q-learning-router.d.ts +0 -211
- package/dist/src/ruvector/q-learning-router.d.ts.map +0 -1
- package/dist/src/ruvector/semantic-router.d.ts +0 -77
- package/dist/src/ruvector/semantic-router.d.ts.map +0 -1
- package/dist/src/ruvector/vector-db.d.ts +0 -69
- package/dist/src/ruvector/vector-db.d.ts.map +0 -1
- package/dist/src/services/claim-service.d.ts +0 -204
- package/dist/src/services/claim-service.d.ts.map +0 -1
- package/dist/src/services/container-worker-pool.d.ts +0 -197
- package/dist/src/services/container-worker-pool.d.ts.map +0 -1
- package/dist/src/services/headless-worker-executor.d.ts +0 -304
- package/dist/src/services/headless-worker-executor.d.ts.map +0 -1
- package/dist/src/services/registry-api.d.ts +0 -58
- package/dist/src/services/registry-api.d.ts.map +0 -1
- package/dist/src/services/ruvector-training.d.ts +0 -213
- package/dist/src/services/ruvector-training.d.ts.map +0 -1
- package/dist/src/services/worker-daemon.d.ts +0 -203
- package/dist/src/services/worker-daemon.d.ts.map +0 -1
- package/dist/src/services/worker-queue.d.ts +0 -194
- package/dist/src/services/worker-queue.d.ts.map +0 -1
- package/dist/src/suggest.d.ts +0 -53
- package/dist/src/suggest.d.ts.map +0 -1
- package/dist/src/transfer/export.d.ts +0 -25
- package/dist/src/transfer/export.d.ts.map +0 -1
- package/dist/src/transfer/ipfs/client.d.ts +0 -109
- package/dist/src/transfer/ipfs/client.d.ts.map +0 -1
- package/dist/src/transfer/ipfs/upload.d.ts +0 -95
- package/dist/src/transfer/ipfs/upload.d.ts.map +0 -1
- package/dist/src/transfer/models/seraphine.d.ts +0 -72
- package/dist/src/transfer/models/seraphine.d.ts.map +0 -1
- package/dist/src/transfer/serialization/cfp.d.ts +0 -49
- package/dist/src/transfer/serialization/cfp.d.ts.map +0 -1
- package/dist/src/transfer/storage/gcs.d.ts +0 -82
- package/dist/src/transfer/storage/gcs.d.ts.map +0 -1
- package/dist/src/transfer/store/discovery.d.ts +0 -84
- package/dist/src/transfer/store/discovery.d.ts.map +0 -1
- package/dist/src/transfer/store/download.d.ts +0 -70
- package/dist/src/transfer/store/download.d.ts.map +0 -1
- package/dist/src/transfer/store/index.d.ts +0 -84
- package/dist/src/transfer/store/index.d.ts.map +0 -1
- package/dist/src/transfer/store/publish.d.ts +0 -76
- package/dist/src/transfer/store/publish.d.ts.map +0 -1
- package/dist/src/transfer/store/search.d.ts +0 -54
- package/dist/src/transfer/store/search.d.ts.map +0 -1
- package/dist/src/transfer/types.d.ts +0 -245
- package/dist/src/transfer/types.d.ts.map +0 -1
- package/dist/src/types.d.ts +0 -198
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/update/checker.d.ts +0 -34
- package/dist/src/update/checker.d.ts.map +0 -1
- package/dist/src/update/executor.d.ts +0 -32
- package/dist/src/update/executor.d.ts.map +0 -1
- package/dist/src/update/index.d.ts +0 -33
- package/dist/src/update/index.d.ts.map +0 -1
- package/dist/src/update/rate-limiter.d.ts +0 -20
- package/dist/src/update/rate-limiter.d.ts.map +0 -1
- package/dist/src/update/validator.d.ts +0 -17
- package/dist/src/update/validator.d.ts.map +0 -1
|
@@ -2,11 +2,82 @@
|
|
|
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
|
+
};
|
|
5
41
|
import { output } from '../output.js';
|
|
6
42
|
import { select, confirm, input } from '../prompt.js';
|
|
7
43
|
import { callMCPTool, MCPClientError } from '../mcp-client.js';
|
|
44
|
+
import * as fs from 'fs';
|
|
45
|
+
import * as path from 'path';
|
|
46
|
+
/**
|
|
47
|
+
* Update swarm-activity.json metrics after agent count changes.
|
|
48
|
+
* The statusline reads this file to display the swarm agent count.
|
|
49
|
+
*/
|
|
50
|
+
function updateSwarmActivityMetrics(agentCountDelta) {
|
|
51
|
+
var _a;
|
|
52
|
+
try {
|
|
53
|
+
var metricsDir = path.join(process.cwd(), '.claude-flow', 'metrics');
|
|
54
|
+
var activityPath = path.join(metricsDir, 'swarm-activity.json');
|
|
55
|
+
var data = {
|
|
56
|
+
timestamp: new Date().toISOString(),
|
|
57
|
+
swarm: { active: false, agent_count: 0, coordination_active: false }
|
|
58
|
+
};
|
|
59
|
+
if (fs.existsSync(activityPath)) {
|
|
60
|
+
data = JSON.parse(fs.readFileSync(activityPath, 'utf-8'));
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
fs.mkdirSync(metricsDir, { recursive: true });
|
|
64
|
+
}
|
|
65
|
+
var swarm = (_a = data.swarm) !== null && _a !== void 0 ? _a : {};
|
|
66
|
+
var currentCount = Math.max(0, swarm.agent_count || 0);
|
|
67
|
+
var newCount = Math.max(0, currentCount + agentCountDelta);
|
|
68
|
+
swarm.agent_count = newCount;
|
|
69
|
+
swarm.active = newCount > 0;
|
|
70
|
+
swarm.coordination_active = newCount > 0;
|
|
71
|
+
data.swarm = swarm;
|
|
72
|
+
data.timestamp = new Date().toISOString();
|
|
73
|
+
fs.writeFileSync(activityPath, JSON.stringify(data, null, 2));
|
|
74
|
+
}
|
|
75
|
+
catch (_b) {
|
|
76
|
+
// Non-critical — don't fail the command if metrics update fails
|
|
77
|
+
}
|
|
78
|
+
}
|
|
8
79
|
// Available agent types with descriptions
|
|
9
|
-
|
|
80
|
+
var AGENT_TYPES = [
|
|
10
81
|
{ value: 'coder', label: 'Coder', hint: 'Code development with neural patterns' },
|
|
11
82
|
{ value: 'researcher', label: 'Researcher', hint: 'Research with web access and data analysis' },
|
|
12
83
|
{ value: 'tester', label: 'Tester', hint: 'Comprehensive testing with automation' },
|
|
@@ -24,7 +95,7 @@ const AGENT_TYPES = [
|
|
|
24
95
|
{ value: 'test-architect', label: 'Test Architect', hint: 'TDD London School methodology' }
|
|
25
96
|
];
|
|
26
97
|
// Agent spawn subcommand
|
|
27
|
-
|
|
98
|
+
var spawnCommand = {
|
|
28
99
|
name: 'spawn',
|
|
29
100
|
description: 'Spawn a new agent',
|
|
30
101
|
options: [
|
|
@@ -33,7 +104,7 @@ const spawnCommand = {
|
|
|
33
104
|
short: 't',
|
|
34
105
|
description: 'Agent type to spawn',
|
|
35
106
|
type: 'string',
|
|
36
|
-
choices: AGENT_TYPES.map(a
|
|
107
|
+
choices: AGENT_TYPES.map(function (a) { return a.value; })
|
|
37
108
|
},
|
|
38
109
|
{
|
|
39
110
|
name: 'name',
|
|
@@ -46,7 +117,7 @@ const spawnCommand = {
|
|
|
46
117
|
short: 'p',
|
|
47
118
|
description: 'Provider to use (anthropic, openrouter, ollama)',
|
|
48
119
|
type: 'string',
|
|
49
|
-
default: 'anthropic'
|
|
120
|
+
"default": 'anthropic'
|
|
50
121
|
},
|
|
51
122
|
{
|
|
52
123
|
name: 'model',
|
|
@@ -63,91 +134,104 @@ const spawnCommand = {
|
|
|
63
134
|
name: 'timeout',
|
|
64
135
|
description: 'Agent timeout in seconds',
|
|
65
136
|
type: 'number',
|
|
66
|
-
default: 300
|
|
137
|
+
"default": 300
|
|
67
138
|
},
|
|
68
139
|
{
|
|
69
140
|
name: 'auto-tools',
|
|
70
141
|
description: 'Enable automatic tool usage',
|
|
71
142
|
type: 'boolean',
|
|
72
|
-
default: true
|
|
143
|
+
"default": true
|
|
73
144
|
}
|
|
74
145
|
],
|
|
75
146
|
examples: [
|
|
76
147
|
{ command: 'claude-flow agent spawn --type coder --name bot-1', description: 'Spawn a coder agent' },
|
|
77
148
|
{ command: 'claude-flow agent spawn -t researcher --task "Research React 19"', description: 'Spawn researcher with task' }
|
|
78
149
|
],
|
|
79
|
-
action:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
{
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
150
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
151
|
+
var agentType, agentName, result, error_1;
|
|
152
|
+
return __generator(this, function (_a) {
|
|
153
|
+
switch (_a.label) {
|
|
154
|
+
case 0:
|
|
155
|
+
agentType = ctx.flags.type;
|
|
156
|
+
agentName = ctx.flags.name;
|
|
157
|
+
if (!(!agentType && ctx.interactive)) return [3 /*break*/, 2];
|
|
158
|
+
return [4 /*yield*/, select({
|
|
159
|
+
message: 'Select agent type:',
|
|
160
|
+
options: AGENT_TYPES
|
|
161
|
+
})];
|
|
162
|
+
case 1:
|
|
163
|
+
agentType = _a.sent();
|
|
164
|
+
_a.label = 2;
|
|
165
|
+
case 2:
|
|
166
|
+
if (!agentType) {
|
|
167
|
+
output.printError('Agent type is required. Use --type or -t flag.');
|
|
168
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
169
|
+
}
|
|
170
|
+
// Generate name if not provided
|
|
171
|
+
if (!agentName) {
|
|
172
|
+
agentName = agentType + "-" + Date.now().toString(36);
|
|
173
|
+
}
|
|
174
|
+
output.printInfo("Spawning " + agentType + " agent: " + output.highlight(agentName));
|
|
175
|
+
_a.label = 3;
|
|
176
|
+
case 3:
|
|
177
|
+
_a.trys.push([3, 5, , 6]);
|
|
178
|
+
return [4 /*yield*/, callMCPTool('agent_spawn', {
|
|
179
|
+
agentType: agentType,
|
|
180
|
+
id: agentName,
|
|
181
|
+
config: {
|
|
182
|
+
provider: ctx.flags.provider || 'anthropic',
|
|
183
|
+
model: ctx.flags.model,
|
|
184
|
+
task: ctx.flags.task,
|
|
185
|
+
timeout: ctx.flags.timeout,
|
|
186
|
+
autoTools: ctx.flags.autoTools
|
|
187
|
+
},
|
|
188
|
+
priority: 'normal',
|
|
189
|
+
metadata: {
|
|
190
|
+
name: agentName,
|
|
191
|
+
capabilities: getAgentCapabilities(agentType)
|
|
192
|
+
}
|
|
193
|
+
})];
|
|
194
|
+
case 4:
|
|
195
|
+
result = _a.sent();
|
|
196
|
+
output.writeln();
|
|
197
|
+
output.printTable({
|
|
198
|
+
columns: [
|
|
199
|
+
{ key: 'property', header: 'Property', width: 15 },
|
|
200
|
+
{ key: 'value', header: 'Value', width: 40 }
|
|
201
|
+
],
|
|
202
|
+
data: [
|
|
203
|
+
{ property: 'ID', value: result.agentId },
|
|
204
|
+
{ property: 'Type', value: result.agentType },
|
|
205
|
+
{ property: 'Name', value: agentName },
|
|
206
|
+
{ property: 'Status', value: result.status },
|
|
207
|
+
{ property: 'Created', value: result.createdAt },
|
|
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*/];
|
|
144
229
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
230
|
+
});
|
|
231
|
+
}); }
|
|
148
232
|
};
|
|
149
233
|
// Agent list subcommand
|
|
150
|
-
|
|
234
|
+
var listCommand = {
|
|
151
235
|
name: 'list',
|
|
152
236
|
aliases: ['ls'],
|
|
153
237
|
description: 'List all active agents',
|
|
@@ -157,7 +241,7 @@ const listCommand = {
|
|
|
157
241
|
short: 'a',
|
|
158
242
|
description: 'Include inactive agents',
|
|
159
243
|
type: 'boolean',
|
|
160
|
-
default: false
|
|
244
|
+
"default": false
|
|
161
245
|
},
|
|
162
246
|
{
|
|
163
247
|
name: 'type',
|
|
@@ -172,62 +256,68 @@ const listCommand = {
|
|
|
172
256
|
type: 'string'
|
|
173
257
|
}
|
|
174
258
|
],
|
|
175
|
-
action:
|
|
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
|
-
|
|
259
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
260
|
+
var result, displayAgents, error_2;
|
|
261
|
+
return __generator(this, function (_a) {
|
|
262
|
+
switch (_a.label) {
|
|
263
|
+
case 0:
|
|
264
|
+
_a.trys.push([0, 2, , 3]);
|
|
265
|
+
return [4 /*yield*/, callMCPTool('agent_list', {
|
|
266
|
+
status: ctx.flags.all ? 'all' : ctx.flags.status || undefined,
|
|
267
|
+
agentType: ctx.flags.type || undefined,
|
|
268
|
+
limit: 100
|
|
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*/];
|
|
224
315
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
316
|
+
});
|
|
317
|
+
}); }
|
|
228
318
|
};
|
|
229
319
|
// Agent status subcommand
|
|
230
|
-
|
|
320
|
+
var statusCommand = {
|
|
231
321
|
name: 'status',
|
|
232
322
|
description: 'Show detailed status of an agent',
|
|
233
323
|
options: [
|
|
@@ -237,70 +327,83 @@ const statusCommand = {
|
|
|
237
327
|
type: 'string'
|
|
238
328
|
}
|
|
239
329
|
],
|
|
240
|
-
action:
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
330
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
331
|
+
var agentId, status, avgExecTime, uptime, error_3;
|
|
332
|
+
var _a, _b, _c, _d, _e;
|
|
333
|
+
return __generator(this, function (_f) {
|
|
334
|
+
switch (_f.label) {
|
|
335
|
+
case 0:
|
|
336
|
+
agentId = ctx.args[0] || ctx.flags.id;
|
|
337
|
+
if (!(!agentId && ctx.interactive)) return [3 /*break*/, 2];
|
|
338
|
+
return [4 /*yield*/, input({
|
|
339
|
+
message: 'Enter agent ID:',
|
|
340
|
+
validate: function (v) { return v.length > 0 || 'Agent ID is required'; }
|
|
341
|
+
})];
|
|
342
|
+
case 1:
|
|
343
|
+
agentId = _f.sent();
|
|
344
|
+
_f.label = 2;
|
|
345
|
+
case 2:
|
|
346
|
+
if (!agentId) {
|
|
347
|
+
output.printError('Agent ID is required');
|
|
348
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
349
|
+
}
|
|
350
|
+
_f.label = 3;
|
|
351
|
+
case 3:
|
|
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*/];
|
|
297
401
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}
|
|
402
|
+
});
|
|
403
|
+
}); }
|
|
301
404
|
};
|
|
302
405
|
// Agent stop subcommand
|
|
303
|
-
|
|
406
|
+
var stopCommand = {
|
|
304
407
|
name: 'stop',
|
|
305
408
|
aliases: ['kill'],
|
|
306
409
|
description: 'Stop a running agent',
|
|
@@ -310,64 +413,78 @@ const stopCommand = {
|
|
|
310
413
|
short: 'f',
|
|
311
414
|
description: 'Force stop without graceful shutdown',
|
|
312
415
|
type: 'boolean',
|
|
313
|
-
default: false
|
|
416
|
+
"default": false
|
|
314
417
|
},
|
|
315
418
|
{
|
|
316
419
|
name: 'timeout',
|
|
317
420
|
description: 'Graceful shutdown timeout in seconds',
|
|
318
421
|
type: 'number',
|
|
319
|
-
default: 30
|
|
422
|
+
"default": 30
|
|
320
423
|
}
|
|
321
424
|
],
|
|
322
|
-
action:
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
425
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
426
|
+
var agentId, force, confirmed, result, error_4;
|
|
427
|
+
return __generator(this, function (_a) {
|
|
428
|
+
switch (_a.label) {
|
|
429
|
+
case 0:
|
|
430
|
+
agentId = ctx.args[0];
|
|
431
|
+
if (!agentId) {
|
|
432
|
+
output.printError('Agent ID is required');
|
|
433
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
434
|
+
}
|
|
435
|
+
force = ctx.flags.force;
|
|
436
|
+
if (!(!force && ctx.interactive)) return [3 /*break*/, 2];
|
|
437
|
+
return [4 /*yield*/, confirm({
|
|
438
|
+
message: "Are you sure you want to stop agent " + agentId + "?",
|
|
439
|
+
"default": false
|
|
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*/];
|
|
361
482
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
}
|
|
365
|
-
return { success: false, exitCode: 1 };
|
|
366
|
-
}
|
|
367
|
-
}
|
|
483
|
+
});
|
|
484
|
+
}); }
|
|
368
485
|
};
|
|
369
486
|
// Agent metrics subcommand
|
|
370
|
-
|
|
487
|
+
var metricsCommand = {
|
|
371
488
|
name: 'metrics',
|
|
372
489
|
description: 'Show agent performance metrics',
|
|
373
490
|
options: [
|
|
@@ -376,78 +493,150 @@ const metricsCommand = {
|
|
|
376
493
|
short: 'p',
|
|
377
494
|
description: 'Time period (1h, 24h, 7d, 30d)',
|
|
378
495
|
type: 'string',
|
|
379
|
-
default: '24h'
|
|
496
|
+
"default": '24h'
|
|
380
497
|
}
|
|
381
498
|
],
|
|
382
|
-
action:
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
499
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
500
|
+
var agentId, period, _a, existsSync, readFileSync, readdirSync, statSync, join, totalAgents, activeAgents, tasksCompleted, typeCounts, swarmDir, agentsDir, files, _i, files_1, file, data, agType, activityFile, activity, vectorCount, dbPath, dbSize, byType, avgSuccessRate, metrics;
|
|
501
|
+
return __generator(this, function (_b) {
|
|
502
|
+
switch (_b.label) {
|
|
503
|
+
case 0:
|
|
504
|
+
agentId = ctx.args[0];
|
|
505
|
+
period = ctx.flags.period;
|
|
506
|
+
return [4 /*yield*/, import('fs')];
|
|
507
|
+
case 1:
|
|
508
|
+
_a = _b.sent(), existsSync = _a.existsSync, readFileSync = _a.readFileSync, readdirSync = _a.readdirSync, statSync = _a.statSync;
|
|
509
|
+
return [4 /*yield*/, import('path')];
|
|
510
|
+
case 2:
|
|
511
|
+
join = (_b.sent()).join;
|
|
512
|
+
totalAgents = 0;
|
|
513
|
+
activeAgents = 0;
|
|
514
|
+
tasksCompleted = 0;
|
|
515
|
+
typeCounts = {};
|
|
516
|
+
swarmDir = join(process.cwd(), '.swarm');
|
|
517
|
+
agentsDir = join(swarmDir, 'agents');
|
|
518
|
+
if (existsSync(agentsDir)) {
|
|
519
|
+
try {
|
|
520
|
+
files = readdirSync(agentsDir).filter(function (f) { return f.endsWith('.json'); });
|
|
521
|
+
for (_i = 0, files_1 = files; _i < files_1.length; _i++) {
|
|
522
|
+
file = files_1[_i];
|
|
523
|
+
try {
|
|
524
|
+
data = JSON.parse(readFileSync(join(agentsDir, file), 'utf-8'));
|
|
525
|
+
totalAgents++;
|
|
526
|
+
agType = data.type || 'unknown';
|
|
527
|
+
if (!typeCounts[agType])
|
|
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'
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
if (ctx.flags.format === 'json') {
|
|
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));
|
|
626
|
+
}
|
|
627
|
+
output.writeln();
|
|
628
|
+
output.writeln(output.bold('Memory'));
|
|
629
|
+
output.printList([
|
|
630
|
+
"Vectors: " + output.success(metrics.performance.memoryVectors),
|
|
631
|
+
"Backend: " + output.success(metrics.performance.searchBackend)
|
|
632
|
+
]);
|
|
633
|
+
return [2 /*return*/, { success: true, data: metrics }];
|
|
405
634
|
}
|
|
406
|
-
};
|
|
407
|
-
if (ctx.flags.format === 'json') {
|
|
408
|
-
output.printJson(metrics);
|
|
409
|
-
return { success: true, data: metrics };
|
|
410
|
-
}
|
|
411
|
-
output.writeln();
|
|
412
|
-
output.writeln(output.bold(`Agent Metrics (${period})`));
|
|
413
|
-
output.writeln();
|
|
414
|
-
output.printTable({
|
|
415
|
-
columns: [
|
|
416
|
-
{ key: 'metric', header: 'Metric', width: 20 },
|
|
417
|
-
{ key: 'value', header: 'Value', width: 15, align: 'right' }
|
|
418
|
-
],
|
|
419
|
-
data: [
|
|
420
|
-
{ metric: 'Total Agents', value: metrics.summary.totalAgents },
|
|
421
|
-
{ metric: 'Active Agents', value: metrics.summary.activeAgents },
|
|
422
|
-
{ metric: 'Tasks Completed', value: metrics.summary.tasksCompleted },
|
|
423
|
-
{ metric: 'Success Rate', value: metrics.summary.avgSuccessRate },
|
|
424
|
-
{ metric: 'Total Tokens', value: metrics.summary.totalTokens.toLocaleString() },
|
|
425
|
-
{ metric: 'Avg Response Time', value: metrics.summary.avgResponseTime }
|
|
426
|
-
]
|
|
427
|
-
});
|
|
428
|
-
output.writeln();
|
|
429
|
-
output.writeln(output.bold('By Agent Type'));
|
|
430
|
-
output.printTable({
|
|
431
|
-
columns: [
|
|
432
|
-
{ key: 'type', header: 'Type', width: 12 },
|
|
433
|
-
{ key: 'count', header: 'Count', width: 8, align: 'right' },
|
|
434
|
-
{ key: 'tasks', header: 'Tasks', width: 8, align: 'right' },
|
|
435
|
-
{ key: 'successRate', header: 'Success', width: 10, align: 'right' }
|
|
436
|
-
],
|
|
437
|
-
data: metrics.byType
|
|
438
635
|
});
|
|
439
|
-
|
|
440
|
-
output.writeln(output.bold('V3 Performance Gains'));
|
|
441
|
-
output.printList([
|
|
442
|
-
`Flash Attention: ${output.success(metrics.performance.flashAttention)}`,
|
|
443
|
-
`Memory Reduction: ${output.success(metrics.performance.memoryReduction)}`,
|
|
444
|
-
`Search: ${output.success(metrics.performance.searchImprovement)}`
|
|
445
|
-
]);
|
|
446
|
-
return { success: true, data: metrics };
|
|
447
|
-
}
|
|
636
|
+
}); }
|
|
448
637
|
};
|
|
449
638
|
// Agent pool subcommand
|
|
450
|
-
|
|
639
|
+
var poolCommand = {
|
|
451
640
|
name: 'pool',
|
|
452
641
|
description: 'Manage agent pool for scaling',
|
|
453
642
|
options: [
|
|
@@ -461,75 +650,84 @@ const poolCommand = {
|
|
|
461
650
|
name: 'min',
|
|
462
651
|
description: 'Minimum pool size',
|
|
463
652
|
type: 'number',
|
|
464
|
-
default: 1
|
|
653
|
+
"default": 1
|
|
465
654
|
},
|
|
466
655
|
{
|
|
467
656
|
name: 'max',
|
|
468
657
|
description: 'Maximum pool size',
|
|
469
658
|
type: 'number',
|
|
470
|
-
default: 10
|
|
659
|
+
"default": 10
|
|
471
660
|
},
|
|
472
661
|
{
|
|
473
662
|
name: 'auto-scale',
|
|
474
663
|
short: 'a',
|
|
475
664
|
description: 'Enable auto-scaling',
|
|
476
665
|
type: 'boolean',
|
|
477
|
-
default: true
|
|
666
|
+
"default": true
|
|
478
667
|
}
|
|
479
668
|
],
|
|
480
669
|
examples: [
|
|
481
670
|
{ command: 'claude-flow agent pool --size 5', description: 'Set pool size' },
|
|
482
671
|
{ command: 'claude-flow agent pool --min 2 --max 15', description: 'Configure auto-scaling' }
|
|
483
672
|
],
|
|
484
|
-
action:
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
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
|
-
|
|
673
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
674
|
+
var result, utilization, agents, error_5;
|
|
675
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
676
|
+
return __generator(this, function (_h) {
|
|
677
|
+
switch (_h.label) {
|
|
678
|
+
case 0:
|
|
679
|
+
_h.trys.push([0, 2, , 3]);
|
|
680
|
+
return [4 /*yield*/, callMCPTool('agent_pool', {
|
|
681
|
+
size: ctx.flags.size,
|
|
682
|
+
min: ctx.flags.min,
|
|
683
|
+
max: ctx.flags.max,
|
|
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*/];
|
|
526
725
|
}
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
}
|
|
726
|
+
});
|
|
727
|
+
}); }
|
|
530
728
|
};
|
|
531
729
|
// Agent health subcommand
|
|
532
|
-
|
|
730
|
+
var healthCommand = {
|
|
533
731
|
name: 'health',
|
|
534
732
|
description: 'Show agent health and metrics',
|
|
535
733
|
options: [
|
|
@@ -544,102 +742,114 @@ const healthCommand = {
|
|
|
544
742
|
short: 'd',
|
|
545
743
|
description: 'Show detailed health metrics',
|
|
546
744
|
type: 'boolean',
|
|
547
|
-
default: false
|
|
745
|
+
"default": false
|
|
548
746
|
},
|
|
549
747
|
{
|
|
550
748
|
name: 'watch',
|
|
551
749
|
short: 'w',
|
|
552
750
|
description: 'Watch mode (refresh every 5s)',
|
|
553
751
|
type: 'boolean',
|
|
554
|
-
default: false
|
|
752
|
+
"default": false
|
|
555
753
|
}
|
|
556
754
|
],
|
|
557
755
|
examples: [
|
|
558
756
|
{ command: 'claude-flow agent health', description: 'Show all agents health' },
|
|
559
757
|
{ command: 'claude-flow agent health -i agent-001 -d', description: 'Detailed health for specific agent' }
|
|
560
758
|
],
|
|
561
|
-
action:
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
`Degraded: ${output.warning(String(overall.degraded ?? 0))}`,
|
|
583
|
-
`Unhealthy: ${output.error(String(overall.unhealthy ?? 0))}`,
|
|
584
|
-
`Avg CPU: ${avgCpu.toFixed(1)}%`,
|
|
585
|
-
`Avg Memory: ${(avgMemory * 100).toFixed(1)}%`
|
|
586
|
-
].join(' | '), 'Overall Status');
|
|
587
|
-
const healthAgents = result.agents ?? [];
|
|
588
|
-
output.writeln();
|
|
589
|
-
output.printTable({
|
|
590
|
-
columns: [
|
|
591
|
-
{ key: 'id', header: 'Agent ID', width: 18 },
|
|
592
|
-
{ key: 'type', header: 'Type', width: 12 },
|
|
593
|
-
{ key: 'health', header: 'Health', width: 10, format: formatHealthStatus },
|
|
594
|
-
{ key: 'cpu', header: 'CPU %', width: 8, align: 'right', format: (v) => `${Number(v ?? 0).toFixed(1)}%` },
|
|
595
|
-
{ key: 'memory', header: 'Memory', width: 10, align: 'right', format: (v) => {
|
|
596
|
-
const mem = v;
|
|
597
|
-
if (!mem)
|
|
598
|
-
return '0%';
|
|
599
|
-
return `${(mem.used / mem.limit * 100).toFixed(0)}%`;
|
|
600
|
-
} },
|
|
601
|
-
{ key: 'tasks', header: 'Tasks', width: 12, align: 'right', format: (v) => {
|
|
602
|
-
const t = v;
|
|
603
|
-
if (!t)
|
|
604
|
-
return '0/0';
|
|
605
|
-
return `${t.active ?? 0}/${t.completed ?? 0}`;
|
|
606
|
-
} }
|
|
607
|
-
],
|
|
608
|
-
data: healthAgents
|
|
609
|
-
});
|
|
610
|
-
if (detailed && healthAgents.length > 0) {
|
|
611
|
-
output.writeln();
|
|
612
|
-
output.writeln(output.bold('Detailed Metrics'));
|
|
613
|
-
for (const agent of healthAgents) {
|
|
759
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
760
|
+
var agentId, detailed, result, overall, avgCpu, avgMemory, healthAgents, _i, healthAgents_1, agent, uptime, latency, tasks, errors, error_6;
|
|
761
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
762
|
+
return __generator(this, function (_t) {
|
|
763
|
+
switch (_t.label) {
|
|
764
|
+
case 0:
|
|
765
|
+
agentId = ctx.args[0] || ctx.flags.id;
|
|
766
|
+
detailed = ctx.flags.detailed;
|
|
767
|
+
_t.label = 1;
|
|
768
|
+
case 1:
|
|
769
|
+
_t.trys.push([1, 3, , 4]);
|
|
770
|
+
return [4 /*yield*/, callMCPTool('agent_health', {
|
|
771
|
+
agentId: agentId,
|
|
772
|
+
detailed: detailed
|
|
773
|
+
})];
|
|
774
|
+
case 2:
|
|
775
|
+
result = _t.sent();
|
|
776
|
+
if (ctx.flags.format === 'json') {
|
|
777
|
+
output.printJson(result);
|
|
778
|
+
return [2 /*return*/, { success: true, data: result }];
|
|
779
|
+
}
|
|
614
780
|
output.writeln();
|
|
615
|
-
output.writeln(output.
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
output.
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
781
|
+
output.writeln(output.bold('Agent Health'));
|
|
782
|
+
output.writeln();
|
|
783
|
+
overall = (_a = result.overall) !== null && _a !== void 0 ? _a : { healthy: 0, degraded: 0, unhealthy: 0, avgCpu: 0, avgMemory: 0 };
|
|
784
|
+
avgCpu = (_b = overall.avgCpu) !== null && _b !== void 0 ? _b : 0;
|
|
785
|
+
avgMemory = (_c = overall.avgMemory) !== null && _c !== void 0 ? _c : 0;
|
|
786
|
+
output.printBox([
|
|
787
|
+
"Healthy: " + output.success(String((_d = overall.healthy) !== null && _d !== void 0 ? _d : 0)),
|
|
788
|
+
"Degraded: " + output.warning(String((_e = overall.degraded) !== null && _e !== void 0 ? _e : 0)),
|
|
789
|
+
"Unhealthy: " + output.error(String((_f = overall.unhealthy) !== null && _f !== void 0 ? _f : 0)),
|
|
790
|
+
"Avg CPU: " + avgCpu.toFixed(1) + "%",
|
|
791
|
+
"Avg Memory: " + (avgMemory * 100).toFixed(1) + "%"
|
|
792
|
+
].join(' | '), 'Overall Status');
|
|
793
|
+
healthAgents = (_g = result.agents) !== null && _g !== void 0 ? _g : [];
|
|
794
|
+
output.writeln();
|
|
795
|
+
output.printTable({
|
|
796
|
+
columns: [
|
|
797
|
+
{ key: 'id', header: 'Agent ID', width: 18 },
|
|
798
|
+
{ key: 'type', header: 'Type', width: 12 },
|
|
799
|
+
{ key: 'health', header: 'Health', width: 10, format: formatHealthStatus },
|
|
800
|
+
{ key: 'cpu', header: 'CPU %', width: 8, align: 'right', format: function (v) { return Number(v !== null && v !== void 0 ? v : 0).toFixed(1) + "%"; } },
|
|
801
|
+
{ key: 'memory', header: 'Memory', width: 10, align: 'right', format: function (v) {
|
|
802
|
+
var mem = v;
|
|
803
|
+
if (!mem)
|
|
804
|
+
return '0%';
|
|
805
|
+
return (mem.used / mem.limit * 100).toFixed(0) + "%";
|
|
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*/];
|
|
636
847
|
}
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
}
|
|
848
|
+
});
|
|
849
|
+
}); }
|
|
640
850
|
};
|
|
641
851
|
// Agent logs subcommand
|
|
642
|
-
|
|
852
|
+
var logsCommand = {
|
|
643
853
|
name: 'logs',
|
|
644
854
|
description: 'Show agent activity logs',
|
|
645
855
|
options: [
|
|
@@ -654,7 +864,7 @@ const logsCommand = {
|
|
|
654
864
|
short: 'n',
|
|
655
865
|
description: 'Number of recent entries',
|
|
656
866
|
type: 'number',
|
|
657
|
-
default: 50
|
|
867
|
+
"default": 50
|
|
658
868
|
},
|
|
659
869
|
{
|
|
660
870
|
name: 'level',
|
|
@@ -662,14 +872,14 @@ const logsCommand = {
|
|
|
662
872
|
description: 'Minimum log level',
|
|
663
873
|
type: 'string',
|
|
664
874
|
choices: ['debug', 'info', 'warn', 'error'],
|
|
665
|
-
default: 'info'
|
|
875
|
+
"default": 'info'
|
|
666
876
|
},
|
|
667
877
|
{
|
|
668
878
|
name: 'follow',
|
|
669
879
|
short: 'f',
|
|
670
880
|
description: 'Follow log output',
|
|
671
881
|
type: 'boolean',
|
|
672
|
-
default: false
|
|
882
|
+
"default": false
|
|
673
883
|
},
|
|
674
884
|
{
|
|
675
885
|
name: 'since',
|
|
@@ -682,52 +892,63 @@ const logsCommand = {
|
|
|
682
892
|
{ command: 'claude-flow agent logs -i agent-001 -f', description: 'Follow agent logs' },
|
|
683
893
|
{ command: 'claude-flow agent logs -l error --since 1h', description: 'Show errors from last hour' }
|
|
684
894
|
],
|
|
685
|
-
action:
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
output.writeln(output.
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
895
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
896
|
+
var agentId, tail, level, result, _i, _a, entry, time, levelStr, error_7;
|
|
897
|
+
return __generator(this, function (_b) {
|
|
898
|
+
switch (_b.label) {
|
|
899
|
+
case 0:
|
|
900
|
+
agentId = ctx.args[0] || ctx.flags.id;
|
|
901
|
+
tail = ctx.flags.tail;
|
|
902
|
+
level = ctx.flags.level;
|
|
903
|
+
if (!agentId) {
|
|
904
|
+
output.printError('Agent ID is required. Use --id or -i');
|
|
905
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
906
|
+
}
|
|
907
|
+
_b.label = 1;
|
|
908
|
+
case 1:
|
|
909
|
+
_b.trys.push([1, 3, , 4]);
|
|
910
|
+
return [4 /*yield*/, callMCPTool('agent_logs', {
|
|
911
|
+
agentId: agentId,
|
|
912
|
+
tail: tail,
|
|
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*/];
|
|
724
946
|
}
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
}
|
|
947
|
+
});
|
|
948
|
+
}); }
|
|
728
949
|
};
|
|
729
950
|
function formatHealthStatus(health) {
|
|
730
|
-
|
|
951
|
+
var h = String(health);
|
|
731
952
|
switch (h) {
|
|
732
953
|
case 'healthy':
|
|
733
954
|
return output.success(h);
|
|
@@ -750,11 +971,11 @@ function formatLogLevel(level) {
|
|
|
750
971
|
case 'error':
|
|
751
972
|
return output.error('[ERROR]');
|
|
752
973
|
default:
|
|
753
|
-
return
|
|
974
|
+
return "[" + level.toUpperCase() + "]";
|
|
754
975
|
}
|
|
755
976
|
}
|
|
756
977
|
// Main agent command
|
|
757
|
-
export
|
|
978
|
+
export var agentCommand = {
|
|
758
979
|
name: 'agent',
|
|
759
980
|
description: 'Agent management commands',
|
|
760
981
|
subcommands: [spawnCommand, listCommand, statusCommand, stopCommand, metricsCommand, poolCommand, healthCommand, logsCommand],
|
|
@@ -764,29 +985,31 @@ export const agentCommand = {
|
|
|
764
985
|
{ command: 'claude-flow agent list', description: 'List all agents' },
|
|
765
986
|
{ command: 'claude-flow agent status agent-001', description: 'Show agent status' }
|
|
766
987
|
],
|
|
767
|
-
action:
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
988
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
989
|
+
return __generator(this, function (_a) {
|
|
990
|
+
// Show help if no subcommand
|
|
991
|
+
output.writeln();
|
|
992
|
+
output.writeln(output.bold('Agent Management Commands'));
|
|
993
|
+
output.writeln();
|
|
994
|
+
output.writeln('Usage: claude-flow agent <subcommand> [options]');
|
|
995
|
+
output.writeln();
|
|
996
|
+
output.writeln('Subcommands:');
|
|
997
|
+
output.printList([
|
|
998
|
+
output.highlight('spawn') + " - Spawn a new agent",
|
|
999
|
+
output.highlight('list') + " - List all active agents",
|
|
1000
|
+
output.highlight('status') + " - Show detailed agent status",
|
|
1001
|
+
output.highlight('stop') + " - Stop a running agent",
|
|
1002
|
+
output.highlight('metrics') + " - Show agent metrics"
|
|
1003
|
+
]);
|
|
1004
|
+
output.writeln();
|
|
1005
|
+
output.writeln('Run "claude-flow agent <subcommand> --help" for subcommand help');
|
|
1006
|
+
return [2 /*return*/, { success: true }];
|
|
1007
|
+
});
|
|
1008
|
+
}); }
|
|
786
1009
|
};
|
|
787
1010
|
// Helper functions
|
|
788
1011
|
function getAgentCapabilities(type) {
|
|
789
|
-
|
|
1012
|
+
var capabilities = {
|
|
790
1013
|
coder: ['code-generation', 'refactoring', 'debugging', 'testing'],
|
|
791
1014
|
researcher: ['web-search', 'data-analysis', 'summarization', 'citation'],
|
|
792
1015
|
tester: ['unit-testing', 'integration-testing', 'coverage-analysis', 'automation'],
|
|
@@ -800,7 +1023,7 @@ function getAgentCapabilities(type) {
|
|
|
800
1023
|
return capabilities[type] || ['general'];
|
|
801
1024
|
}
|
|
802
1025
|
function formatStatus(status) {
|
|
803
|
-
|
|
1026
|
+
var statusStr = String(status);
|
|
804
1027
|
switch (statusStr) {
|
|
805
1028
|
case 'active':
|
|
806
1029
|
return output.success(statusStr);
|