@claude-flow/cli 3.32.3 → 3.32.5
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/helpers/helpers.manifest.json +2 -2
- package/catalog-manifest.json +2 -2
- package/dist/src/agenticow/speculative-exploration.d.ts +148 -0
- package/dist/src/agenticow/speculative-exploration.js +218 -0
- package/dist/src/appliance/gguf-engine.d.ts +91 -0
- package/dist/src/appliance/gguf-engine.js +425 -0
- package/dist/src/appliance/ruvllm-bridge.d.ts +102 -0
- package/dist/src/appliance/ruvllm-bridge.js +292 -0
- package/dist/src/appliance/rvfa-builder.d.ts +44 -0
- package/dist/src/appliance/rvfa-builder.js +329 -0
- package/dist/src/appliance/rvfa-distribution.d.ts +97 -0
- package/dist/src/appliance/rvfa-distribution.js +370 -0
- package/dist/src/appliance/rvfa-format.d.ts +111 -0
- package/dist/src/appliance/rvfa-format.js +393 -0
- package/dist/src/appliance/rvfa-runner.d.ts +69 -0
- package/dist/src/appliance/rvfa-runner.js +237 -0
- package/dist/src/appliance/rvfa-signing.d.ts +123 -0
- package/dist/src/appliance/rvfa-signing.js +347 -0
- package/dist/src/auth/client.d.ts +89 -0
- package/dist/src/auth/client.js +242 -0
- package/dist/src/auth/constants.d.ts +7 -0
- package/dist/src/auth/constants.js +7 -0
- package/dist/src/auth/scopes.d.ts +14 -0
- package/dist/src/auth/scopes.js +21 -0
- package/dist/src/auth/security-bridge.d.ts +36 -0
- package/dist/src/auth/security-bridge.js +42 -0
- package/dist/src/auth/session.d.ts +20 -0
- package/dist/src/auth/session.js +32 -0
- package/dist/src/auth/state.d.ts +19 -0
- package/dist/src/auth/state.js +53 -0
- package/dist/src/auth/types.d.ts +27 -0
- package/dist/src/auth/types.js +11 -0
- package/dist/src/autopilot-state.d.ts +77 -0
- package/dist/src/autopilot-state.js +271 -0
- package/dist/src/benchmarks/gaia-agent-planning.smoke.d.ts +18 -0
- package/dist/src/benchmarks/gaia-agent-planning.smoke.js +253 -0
- package/dist/src/benchmarks/gaia-agent.d.ts +198 -0
- package/dist/src/benchmarks/gaia-agent.js +651 -0
- package/dist/src/benchmarks/gaia-causal-memory.d.ts +133 -0
- package/dist/src/benchmarks/gaia-causal-memory.js +281 -0
- package/dist/src/benchmarks/gaia-causal-memory.smoke.d.ts +22 -0
- package/dist/src/benchmarks/gaia-causal-memory.smoke.js +300 -0
- package/dist/src/benchmarks/gaia-convergence.d.ts +138 -0
- package/dist/src/benchmarks/gaia-convergence.js +260 -0
- package/dist/src/benchmarks/gaia-convergence.smoke.d.ts +19 -0
- package/dist/src/benchmarks/gaia-convergence.smoke.js +246 -0
- package/dist/src/benchmarks/gaia-critic.d.ts +123 -0
- package/dist/src/benchmarks/gaia-critic.js +312 -0
- package/dist/src/benchmarks/gaia-critic.smoke.d.ts +21 -0
- package/dist/src/benchmarks/gaia-critic.smoke.js +327 -0
- package/dist/src/benchmarks/gaia-decomposer.d.ts +125 -0
- package/dist/src/benchmarks/gaia-decomposer.js +350 -0
- package/dist/src/benchmarks/gaia-decomposer.smoke.d.ts +21 -0
- package/dist/src/benchmarks/gaia-decomposer.smoke.js +228 -0
- package/dist/src/benchmarks/gaia-e2e-smoke.d.ts +27 -0
- package/dist/src/benchmarks/gaia-e2e-smoke.js +136 -0
- package/dist/src/benchmarks/gaia-extract.smoke.d.ts +45 -0
- package/dist/src/benchmarks/gaia-extract.smoke.js +242 -0
- package/dist/src/benchmarks/gaia-hardness/features.d.ts +46 -0
- package/dist/src/benchmarks/gaia-hardness/features.js +170 -0
- package/dist/src/benchmarks/gaia-hardness/predictor.d.ts +105 -0
- package/dist/src/benchmarks/gaia-hardness/predictor.js +260 -0
- package/dist/src/benchmarks/gaia-hardness/predictor.smoke.d.ts +20 -0
- package/dist/src/benchmarks/gaia-hardness/predictor.smoke.js +235 -0
- package/dist/src/benchmarks/gaia-hardness/train-data-loader.d.ts +51 -0
- package/dist/src/benchmarks/gaia-hardness/train-data-loader.js +179 -0
- package/dist/src/benchmarks/gaia-judge.d.ts +88 -0
- package/dist/src/benchmarks/gaia-judge.js +437 -0
- package/dist/src/benchmarks/gaia-loader.d.ts +87 -0
- package/dist/src/benchmarks/gaia-loader.js +326 -0
- package/dist/src/benchmarks/gaia-tools/file_read.d.ts +35 -0
- package/dist/src/benchmarks/gaia-tools/file_read.js +403 -0
- package/dist/src/benchmarks/gaia-tools/grounded_query.d.ts +126 -0
- package/dist/src/benchmarks/gaia-tools/grounded_query.js +225 -0
- package/dist/src/benchmarks/gaia-tools/index.d.ts +32 -0
- package/dist/src/benchmarks/gaia-tools/index.js +36 -0
- package/dist/src/benchmarks/gaia-tools/types.d.ts +62 -0
- package/dist/src/benchmarks/gaia-tools/types.js +12 -0
- package/dist/src/benchmarks/gaia-tools/web_search.d.ts +30 -0
- package/dist/src/benchmarks/gaia-tools/web_search.js +210 -0
- package/dist/src/benchmarks/gaia-voting.d.ts +88 -0
- package/dist/src/benchmarks/gaia-voting.js +297 -0
- package/dist/src/benchmarks/gaia-voting.smoke.d.ts +20 -0
- package/dist/src/benchmarks/gaia-voting.smoke.js +332 -0
- package/dist/src/benchmarks/pretrain/index.d.ts +58 -0
- package/dist/src/benchmarks/pretrain/index.js +404 -0
- package/dist/src/business-pods/bbs-budget-tracker.d.ts +139 -0
- package/dist/src/business-pods/bbs-budget-tracker.js +358 -0
- package/dist/src/business-pods/domain-affinity-policy.d.ts +47 -0
- package/dist/src/business-pods/domain-affinity-policy.js +65 -0
- package/dist/src/business-pods/pod-schema.d.ts +96 -0
- package/dist/src/business-pods/pod-schema.js +225 -0
- package/dist/src/commands/advisor.d.ts +15 -0
- package/dist/src/commands/advisor.js +94 -0
- package/dist/src/commands/agent-wasm.d.ts +14 -0
- package/dist/src/commands/agent-wasm.js +333 -0
- package/dist/src/commands/agent.d.ts +8 -0
- package/dist/src/commands/agent.js +927 -0
- package/dist/src/commands/analyze.d.ts +19 -0
- package/dist/src/commands/analyze.js +2047 -0
- package/dist/src/commands/announcements.d.ts +17 -0
- package/dist/src/commands/announcements.js +0 -0
- package/dist/src/commands/appliance-advanced.d.ts +9 -0
- package/dist/src/commands/appliance-advanced.js +215 -0
- package/dist/src/commands/appliance.d.ts +8 -0
- package/dist/src/commands/appliance.js +404 -0
- package/dist/src/commands/auth.d.ts +15 -0
- package/dist/src/commands/auth.js +244 -0
- package/dist/src/commands/autopilot.d.ts +15 -0
- package/dist/src/commands/autopilot.js +407 -0
- package/dist/src/commands/benchmark.d.ts +10 -0
- package/dist/src/commands/benchmark.js +460 -0
- package/dist/src/commands/claims.d.ts +10 -0
- package/dist/src/commands/claims.js +620 -0
- package/dist/src/commands/cleanup.d.ts +13 -0
- package/dist/src/commands/cleanup.js +250 -0
- package/dist/src/commands/completions.d.ts +10 -0
- package/dist/src/commands/completions.js +539 -0
- package/dist/src/commands/config.d.ts +8 -0
- package/dist/src/commands/config.js +428 -0
- package/dist/src/commands/daemon.d.ts +59 -0
- package/dist/src/commands/daemon.js +1733 -0
- package/dist/src/commands/deployment.d.ts +10 -0
- package/dist/src/commands/deployment.js +672 -0
- package/dist/src/commands/doctor.d.ts +10 -0
- package/dist/src/commands/doctor.js +1902 -0
- package/dist/src/commands/eject.d.ts +33 -0
- package/dist/src/commands/eject.js +195 -0
- package/dist/src/commands/embeddings.d.ts +18 -0
- package/dist/src/commands/embeddings.js +1623 -0
- package/dist/src/commands/funnel.d.ts +18 -0
- package/dist/src/commands/funnel.js +302 -0
- package/dist/src/commands/gaia-bench.d.ts +40 -0
- package/dist/src/commands/gaia-bench.js +597 -0
- package/dist/src/commands/guidance.d.ts +8 -0
- package/dist/src/commands/guidance.js +556 -0
- package/dist/src/commands/hive-mind.d.ts +11 -0
- package/dist/src/commands/hive-mind.js +1319 -0
- package/dist/src/commands/hooks.d.ts +8 -0
- package/dist/src/commands/hooks.js +4606 -0
- package/dist/src/commands/index.d.ts +118 -0
- package/dist/src/commands/index.js +366 -0
- package/dist/src/commands/init.d.ts +13 -0
- package/dist/src/commands/init.js +1297 -0
- package/dist/src/commands/issues.d.ts +21 -0
- package/dist/src/commands/issues.js +567 -0
- package/dist/src/commands/mcp.d.ts +11 -0
- package/dist/src/commands/mcp.js +732 -0
- package/dist/src/commands/memory-backup.d.ts +11 -0
- package/dist/src/commands/memory-backup.js +46 -0
- package/dist/src/commands/memory-distill.d.ts +27 -0
- package/dist/src/commands/memory-distill.js +374 -0
- package/dist/src/commands/memory.d.ts +8 -0
- package/dist/src/commands/memory.js +1596 -0
- package/dist/src/commands/metaharness.d.ts +39 -0
- package/dist/src/commands/metaharness.js +215 -0
- package/dist/src/commands/migrate.d.ts +8 -0
- package/dist/src/commands/migrate.js +742 -0
- package/dist/src/commands/neural.d.ts +10 -0
- package/dist/src/commands/neural.js +4331 -0
- package/dist/src/commands/performance.d.ts +10 -0
- package/dist/src/commands/performance.js +583 -0
- package/dist/src/commands/plugins.d.ts +11 -0
- package/dist/src/commands/plugins.js +826 -0
- package/dist/src/commands/process.d.ts +10 -0
- package/dist/src/commands/process.js +694 -0
- package/dist/src/commands/progress.d.ts +11 -0
- package/dist/src/commands/progress.js +259 -0
- package/dist/src/commands/providers.d.ts +10 -0
- package/dist/src/commands/providers.js +502 -0
- package/dist/src/commands/proxy-lifecycle.d.ts +20 -0
- package/dist/src/commands/proxy-lifecycle.js +277 -0
- package/dist/src/commands/proxy.d.ts +21 -0
- package/dist/src/commands/proxy.js +403 -0
- package/dist/src/commands/route.d.ts +16 -0
- package/dist/src/commands/route.js +822 -0
- package/dist/src/commands/ruvector/backup.d.ts +11 -0
- package/dist/src/commands/ruvector/backup.js +747 -0
- package/dist/src/commands/ruvector/benchmark.d.ts +11 -0
- package/dist/src/commands/ruvector/benchmark.js +490 -0
- package/dist/src/commands/ruvector/import.d.ts +18 -0
- package/dist/src/commands/ruvector/import.js +373 -0
- package/dist/src/commands/ruvector/index.d.ts +29 -0
- package/dist/src/commands/ruvector/index.js +129 -0
- package/dist/src/commands/ruvector/init.d.ts +11 -0
- package/dist/src/commands/ruvector/init.js +467 -0
- package/dist/src/commands/ruvector/migrate.d.ts +11 -0
- package/dist/src/commands/ruvector/migrate.js +498 -0
- package/dist/src/commands/ruvector/optimize.d.ts +11 -0
- package/dist/src/commands/ruvector/optimize.js +505 -0
- package/dist/src/commands/ruvector/pg-utils.d.ts +14 -0
- package/dist/src/commands/ruvector/pg-utils.js +41 -0
- package/dist/src/commands/ruvector/setup.d.ts +18 -0
- package/dist/src/commands/ruvector/setup.js +765 -0
- package/dist/src/commands/ruvector/status.d.ts +11 -0
- package/dist/src/commands/ruvector/status.js +479 -0
- package/dist/src/commands/security.d.ts +10 -0
- package/dist/src/commands/security.js +1012 -0
- package/dist/src/commands/session.d.ts +8 -0
- package/dist/src/commands/session.js +757 -0
- package/dist/src/commands/settings.d.ts +19 -0
- package/dist/src/commands/settings.js +180 -0
- package/dist/src/commands/spinner.d.ts +16 -0
- package/dist/src/commands/spinner.js +329 -0
- package/dist/src/commands/start.d.ts +8 -0
- package/dist/src/commands/start.js +418 -0
- package/dist/src/commands/status.d.ts +8 -0
- package/dist/src/commands/status.js +608 -0
- package/dist/src/commands/swarm.d.ts +8 -0
- package/dist/src/commands/swarm.js +891 -0
- package/dist/src/commands/task.d.ts +8 -0
- package/dist/src/commands/task.js +675 -0
- package/dist/src/commands/transfer-store.d.ts +13 -0
- package/dist/src/commands/transfer-store.js +428 -0
- package/dist/src/commands/update.d.ts +8 -0
- package/dist/src/commands/update.js +276 -0
- package/dist/src/commands/verify.d.ts +19 -0
- package/dist/src/commands/verify.js +261 -0
- package/dist/src/commands/version.d.ts +42 -0
- package/dist/src/commands/version.js +106 -0
- package/dist/src/commands/workflow.d.ts +8 -0
- package/dist/src/commands/workflow.js +617 -0
- package/dist/src/config/harness-feedback-applier.d.ts +50 -0
- package/dist/src/config/harness-feedback-applier.js +122 -0
- package/dist/src/config/proven-config-refresh.d.ts +39 -0
- package/dist/src/config/proven-config-refresh.js +154 -0
- package/dist/src/config/proven-config-rvfa.d.ts +23 -0
- package/dist/src/config/proven-config-rvfa.js +73 -0
- package/dist/src/config/proven-config.d.ts +86 -0
- package/dist/src/config/proven-config.js +176 -0
- package/dist/src/config-adapter.d.ts +15 -0
- package/dist/src/config-adapter.js +186 -0
- package/dist/src/encryption/vault.d.ts +94 -0
- package/dist/src/encryption/vault.js +172 -0
- package/dist/src/fs-secure.d.ts +86 -0
- package/dist/src/fs-secure.js +133 -0
- package/dist/src/funnel/advisor-tip.d.ts +58 -0
- package/dist/src/funnel/advisor-tip.js +92 -0
- package/dist/src/funnel/attribution.d.ts +37 -0
- package/dist/src/funnel/attribution.js +101 -0
- package/dist/src/funnel/consent.d.ts +22 -0
- package/dist/src/funnel/consent.js +58 -0
- package/dist/src/funnel/credit-errors.d.ts +31 -0
- package/dist/src/funnel/credit-errors.js +88 -0
- package/dist/src/funnel/credit-notifier.d.ts +44 -0
- package/dist/src/funnel/credit-notifier.js +74 -0
- package/dist/src/funnel/disclosure.d.ts +47 -0
- package/dist/src/funnel/disclosure.js +109 -0
- package/dist/src/funnel/enrollment.d.ts +36 -0
- package/dist/src/funnel/enrollment.js +64 -0
- package/dist/src/funnel/environment.d.ts +17 -0
- package/dist/src/funnel/environment.js +39 -0
- package/dist/src/funnel/event-transport.d.ts +51 -0
- package/dist/src/funnel/event-transport.js +199 -0
- package/dist/src/funnel/events.d.ts +42 -0
- package/dist/src/funnel/events.js +150 -0
- package/dist/src/funnel/index.d.ts +21 -0
- package/dist/src/funnel/index.js +21 -0
- package/dist/src/funnel/insights.d.ts +50 -0
- package/dist/src/funnel/insights.js +120 -0
- package/dist/src/funnel/local-signals.d.ts +20 -0
- package/dist/src/funnel/local-signals.js +77 -0
- package/dist/src/funnel/message-transport.d.ts +51 -0
- package/dist/src/funnel/message-transport.js +149 -0
- package/dist/src/funnel/messages.d.ts +55 -0
- package/dist/src/funnel/messages.js +160 -0
- package/dist/src/funnel/payout.d.ts +40 -0
- package/dist/src/funnel/payout.js +60 -0
- package/dist/src/funnel/power-saver-notifier.d.ts +44 -0
- package/dist/src/funnel/power-saver-notifier.js +92 -0
- package/dist/src/funnel/precedence.d.ts +16 -0
- package/dist/src/funnel/precedence.js +85 -0
- package/dist/src/funnel/promo.d.ts +41 -0
- package/dist/src/funnel/promo.js +144 -0
- package/dist/src/funnel/rate-limit-notifier.d.ts +55 -0
- package/dist/src/funnel/rate-limit-notifier.js +102 -0
- package/dist/src/funnel/rotation.d.ts +19 -0
- package/dist/src/funnel/rotation.js +70 -0
- package/dist/src/funnel/state.d.ts +13 -0
- package/dist/src/funnel/state.js +52 -0
- package/dist/src/funnel/toggle-cooldown.d.ts +17 -0
- package/dist/src/funnel/toggle-cooldown.js +32 -0
- package/dist/src/funnel/types.d.ts +98 -0
- package/dist/src/funnel/types.js +26 -0
- package/dist/src/index.d.ts +81 -0
- package/dist/src/index.js +609 -0
- package/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
- package/dist/src/infrastructure/in-memory-repositories.js +264 -0
- package/dist/src/init/claudemd-generator.d.ts +16 -0
- package/dist/src/init/claudemd-generator.js +368 -0
- package/dist/src/init/executor.d.ts +41 -0
- package/dist/src/init/executor.js +2142 -0
- package/dist/src/init/helper-refresh.d.ts +79 -0
- package/dist/src/init/helper-refresh.js +347 -0
- package/dist/src/init/helper-signing.d.ts +37 -0
- package/dist/src/init/helper-signing.js +67 -0
- package/dist/src/init/helpers-generator.d.ts +87 -0
- package/dist/src/init/helpers-generator.js +1456 -0
- package/dist/src/init/index.d.ts +13 -0
- package/dist/src/init/index.js +15 -0
- package/dist/src/init/mcp-generator.d.ts +26 -0
- package/dist/src/init/mcp-generator.js +126 -0
- package/dist/src/init/memory-package-resolver.d.ts +53 -0
- package/dist/src/init/memory-package-resolver.js +118 -0
- package/dist/src/init/settings-generator.d.ts +14 -0
- package/dist/src/init/settings-generator.js +462 -0
- package/dist/src/init/statusline-generator.d.ts +28 -0
- package/dist/src/init/statusline-generator.js +177 -0
- package/dist/src/init/types.d.ts +331 -0
- package/dist/src/init/types.js +276 -0
- package/dist/src/log-filters.d.ts +46 -0
- package/dist/src/log-filters.js +107 -0
- package/dist/src/mcp-client.d.ts +92 -0
- package/dist/src/mcp-client.js +397 -0
- package/dist/src/mcp-server.d.ts +163 -0
- package/dist/src/mcp-server.js +751 -0
- package/dist/src/mcp-tools/agent-execute-core.d.ts +115 -0
- package/dist/src/mcp-tools/agent-execute-core.js +587 -0
- package/dist/src/mcp-tools/agent-tools.d.ts +9 -0
- package/dist/src/mcp-tools/agent-tools.js +837 -0
- package/dist/src/mcp-tools/agentbbs-tools.d.ts +28 -0
- package/dist/src/mcp-tools/agentbbs-tools.js +394 -0
- package/dist/src/mcp-tools/agentdb-tools.d.ts +35 -0
- package/dist/src/mcp-tools/agentdb-tools.js +1473 -0
- package/dist/src/mcp-tools/agenticow-loader.d.ts +59 -0
- package/dist/src/mcp-tools/agenticow-loader.js +105 -0
- package/dist/src/mcp-tools/agenticow-speculate-tools.d.ts +24 -0
- package/dist/src/mcp-tools/agenticow-speculate-tools.js +209 -0
- package/dist/src/mcp-tools/agenticow-tools.d.ts +36 -0
- package/dist/src/mcp-tools/agenticow-tools.js +360 -0
- package/dist/src/mcp-tools/analyze-tools.d.ts +38 -0
- package/dist/src/mcp-tools/analyze-tools.js +346 -0
- package/dist/src/mcp-tools/auto-install.d.ts +83 -0
- package/dist/src/mcp-tools/auto-install.js +131 -0
- package/dist/src/mcp-tools/autopilot-tools.d.ts +12 -0
- package/dist/src/mcp-tools/autopilot-tools.js +231 -0
- package/dist/src/mcp-tools/browser-intent-tools.d.ts +162 -0
- package/dist/src/mcp-tools/browser-intent-tools.js +548 -0
- package/dist/src/mcp-tools/browser-session-tools.d.ts +27 -0
- package/dist/src/mcp-tools/browser-session-tools.js +398 -0
- package/dist/src/mcp-tools/browser-tools.d.ts +21 -0
- package/dist/src/mcp-tools/browser-tools.js +760 -0
- package/dist/src/mcp-tools/business-pod-tools.d.ts +20 -0
- package/dist/src/mcp-tools/business-pod-tools.js +169 -0
- package/dist/src/mcp-tools/claims-tools.d.ts +12 -0
- package/dist/src/mcp-tools/claims-tools.js +863 -0
- package/dist/src/mcp-tools/config-tools.d.ts +8 -0
- package/dist/src/mcp-tools/config-tools.js +411 -0
- package/dist/src/mcp-tools/coordination-tools.d.ts +13 -0
- package/dist/src/mcp-tools/coordination-tools.js +729 -0
- package/dist/src/mcp-tools/daa-tools.d.ts +13 -0
- package/dist/src/mcp-tools/daa-tools.js +534 -0
- package/dist/src/mcp-tools/embeddings-tools.d.ts +9 -0
- package/dist/src/mcp-tools/embeddings-tools.js +904 -0
- package/dist/src/mcp-tools/github-tools.d.ts +9 -0
- package/dist/src/mcp-tools/github-tools.js +659 -0
- package/dist/src/mcp-tools/guidance-tools.d.ts +15 -0
- package/dist/src/mcp-tools/guidance-tools.js +639 -0
- package/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -0
- package/dist/src/mcp-tools/hive-mind-tools.js +953 -0
- package/dist/src/mcp-tools/hooks-tools.d.ts +65 -0
- package/dist/src/mcp-tools/hooks-tools.js +4836 -0
- package/dist/src/mcp-tools/http-fetch-tools.d.ts +55 -0
- package/dist/src/mcp-tools/http-fetch-tools.js +329 -0
- package/dist/src/mcp-tools/index.d.ts +34 -0
- package/dist/src/mcp-tools/index.js +40 -0
- package/dist/src/mcp-tools/managed-agent-tools.d.ts +22 -0
- package/dist/src/mcp-tools/managed-agent-tools.js +357 -0
- package/dist/src/mcp-tools/memory-tools.d.ts +14 -0
- package/dist/src/mcp-tools/memory-tools.js +1330 -0
- package/dist/src/mcp-tools/metaharness-tools.d.ts +51 -0
- package/dist/src/mcp-tools/metaharness-tools.js +684 -0
- package/dist/src/mcp-tools/neural-tools.d.ts +54 -0
- package/dist/src/mcp-tools/neural-tools.js +1168 -0
- package/dist/src/mcp-tools/performance-tools.d.ts +16 -0
- package/dist/src/mcp-tools/performance-tools.js +675 -0
- package/dist/src/mcp-tools/progress-tools.d.ts +14 -0
- package/dist/src/mcp-tools/progress-tools.js +348 -0
- package/dist/src/mcp-tools/request-tracker.d.ts +17 -0
- package/dist/src/mcp-tools/request-tracker.js +27 -0
- package/dist/src/mcp-tools/ruvllm-tools.d.ts +9 -0
- package/dist/src/mcp-tools/ruvllm-tools.js +355 -0
- package/dist/src/mcp-tools/security-tools.d.ts +18 -0
- package/dist/src/mcp-tools/security-tools.js +556 -0
- package/dist/src/mcp-tools/session-tools.d.ts +8 -0
- package/dist/src/mcp-tools/session-tools.js +517 -0
- package/dist/src/mcp-tools/swarm-tools.d.ts +37 -0
- package/dist/src/mcp-tools/swarm-tools.js +390 -0
- package/dist/src/mcp-tools/system-tools.d.ts +13 -0
- package/dist/src/mcp-tools/system-tools.js +688 -0
- package/dist/src/mcp-tools/task-tools.d.ts +8 -0
- package/dist/src/mcp-tools/task-tools.js +487 -0
- package/dist/src/mcp-tools/terminal-tools.d.ts +8 -0
- package/dist/src/mcp-tools/terminal-tools.js +306 -0
- package/dist/src/mcp-tools/testgen-tools.d.ts +26 -0
- package/dist/src/mcp-tools/testgen-tools.js +168 -0
- package/dist/src/mcp-tools/tool-loop-guardrail.d.ts +31 -0
- package/dist/src/mcp-tools/tool-loop-guardrail.js +71 -0
- package/dist/src/mcp-tools/transfer-tools.d.ts +14 -0
- package/dist/src/mcp-tools/transfer-tools.js +447 -0
- package/dist/src/mcp-tools/types.d.ts +8 -0
- package/dist/src/mcp-tools/types.js +8 -0
- package/dist/src/mcp-tools/validate-input.d.ts +9 -0
- package/dist/src/mcp-tools/validate-input.js +9 -0
- package/dist/src/mcp-tools/wasm-agent-tools.d.ts +13 -0
- package/dist/src/mcp-tools/wasm-agent-tools.js +840 -0
- package/dist/src/mcp-tools/workflow-tools.d.ts +8 -0
- package/dist/src/mcp-tools/workflow-tools.js +884 -0
- package/dist/src/memory/bge-embedder.d.ts +25 -0
- package/dist/src/memory/bge-embedder.js +121 -0
- package/dist/src/memory/cross-encoder-rerank.d.ts +33 -0
- package/dist/src/memory/cross-encoder-rerank.js +123 -0
- package/dist/src/memory/embedding-policy.d.ts +21 -0
- package/dist/src/memory/embedding-policy.js +30 -0
- package/dist/src/memory/embedding-quantization.d.ts +62 -0
- package/dist/src/memory/embedding-quantization.js +156 -0
- package/dist/src/memory/ewc-consolidation.d.ts +305 -0
- package/dist/src/memory/ewc-consolidation.js +611 -0
- package/dist/src/memory/graph-edge-writer.d.ts +95 -0
- package/dist/src/memory/graph-edge-writer.js +217 -0
- package/dist/src/memory/hybrid-retrieval.d.ts +77 -0
- package/dist/src/memory/hybrid-retrieval.js +192 -0
- package/dist/src/memory/intelligence.d.ts +405 -0
- package/dist/src/memory/intelligence.js +1316 -0
- package/dist/src/memory/lucene-bm25.d.ts +19 -0
- package/dist/src/memory/lucene-bm25.js +308 -0
- package/dist/src/memory/memory-bridge.d.ts +537 -0
- package/dist/src/memory/memory-bridge.js +2460 -0
- package/dist/src/memory/memory-initializer.d.ts +556 -0
- package/dist/src/memory/memory-initializer.js +3021 -0
- package/dist/src/memory/neural-package-bridge.d.ts +48 -0
- package/dist/src/memory/neural-package-bridge.js +87 -0
- package/dist/src/memory/rabitq-index.d.ts +60 -0
- package/dist/src/memory/rabitq-index.js +242 -0
- package/dist/src/memory/sona-optimizer.d.ts +267 -0
- package/dist/src/memory/sona-optimizer.js +779 -0
- package/dist/src/memory/structured-distill.d.ts +48 -0
- package/dist/src/memory/structured-distill.js +125 -0
- package/dist/src/output.d.ts +9 -0
- package/dist/src/output.js +9 -0
- package/dist/src/parser.d.ts +89 -0
- package/dist/src/parser.js +516 -0
- package/dist/src/plugins/manager.d.ts +133 -0
- package/dist/src/plugins/manager.js +415 -0
- package/dist/src/plugins/store/discovery.d.ts +99 -0
- package/dist/src/plugins/store/discovery.js +1224 -0
- package/dist/src/plugins/store/index.d.ts +76 -0
- package/dist/src/plugins/store/index.js +141 -0
- package/dist/src/plugins/store/search.d.ts +46 -0
- package/dist/src/plugins/store/search.js +230 -0
- package/dist/src/plugins/store/types.d.ts +279 -0
- package/dist/src/plugins/store/types.js +7 -0
- package/dist/src/plugins/tests/demo-plugin-store.d.ts +7 -0
- package/dist/src/plugins/tests/demo-plugin-store.js +126 -0
- package/dist/src/plugins/tests/standalone-test.d.ts +12 -0
- package/dist/src/plugins/tests/standalone-test.js +188 -0
- package/dist/src/plugins/tests/test-plugin-store.d.ts +7 -0
- package/dist/src/plugins/tests/test-plugin-store.js +206 -0
- package/dist/src/production/circuit-breaker.d.ts +101 -0
- package/dist/src/production/circuit-breaker.js +241 -0
- package/dist/src/production/error-handler.d.ts +92 -0
- package/dist/src/production/error-handler.js +299 -0
- package/dist/src/production/index.d.ts +23 -0
- package/dist/src/production/index.js +18 -0
- package/dist/src/production/monitoring.d.ts +161 -0
- package/dist/src/production/monitoring.js +356 -0
- package/dist/src/production/rate-limiter.d.ts +80 -0
- package/dist/src/production/rate-limiter.js +201 -0
- package/dist/src/production/retry.d.ts +48 -0
- package/dist/src/production/retry.js +179 -0
- package/dist/src/prompt.d.ts +44 -0
- package/dist/src/prompt.js +501 -0
- package/dist/src/proxy/install.d.ts +29 -0
- package/dist/src/proxy/install.js +135 -0
- package/dist/src/proxy/lifecycle.d.ts +61 -0
- package/dist/src/proxy/lifecycle.js +249 -0
- package/dist/src/proxy/paths.d.ts +34 -0
- package/dist/src/proxy/paths.js +70 -0
- package/dist/src/proxy/release.d.ts +47 -0
- package/dist/src/proxy/release.js +138 -0
- package/dist/src/proxy/token-bridge.d.ts +5 -0
- package/dist/src/proxy/token-bridge.js +61 -0
- package/dist/src/proxy/verify.d.ts +44 -0
- package/dist/src/proxy/verify.js +68 -0
- package/dist/src/runtime/headless.d.ts +60 -0
- package/dist/src/runtime/headless.js +284 -0
- package/dist/src/runtime/parent-death-watchdog.d.ts +42 -0
- package/dist/src/runtime/parent-death-watchdog.js +70 -0
- package/dist/src/ruvector/agent-wasm.d.ts +228 -0
- package/dist/src/ruvector/agent-wasm.js +463 -0
- package/dist/src/ruvector/ast-analyzer.d.ts +67 -0
- package/dist/src/ruvector/ast-analyzer.js +277 -0
- package/dist/src/ruvector/codemods/engine.d.ts +45 -0
- package/dist/src/ruvector/codemods/engine.js +291 -0
- package/dist/src/ruvector/codemods/scope-analysis.d.ts +29 -0
- package/dist/src/ruvector/codemods/scope-analysis.js +162 -0
- package/dist/src/ruvector/coverage-router.d.ts +160 -0
- package/dist/src/ruvector/coverage-router.js +531 -0
- package/dist/src/ruvector/coverage-tools.d.ts +33 -0
- package/dist/src/ruvector/coverage-tools.js +157 -0
- package/dist/src/ruvector/diff-classifier.d.ts +175 -0
- package/dist/src/ruvector/diff-classifier.js +699 -0
- package/dist/src/ruvector/diskann-backend.d.ts +78 -0
- package/dist/src/ruvector/diskann-backend.js +310 -0
- package/dist/src/ruvector/enhanced-model-router.d.ts +172 -0
- package/dist/src/ruvector/enhanced-model-router.js +577 -0
- package/dist/src/ruvector/graph-analyzer.d.ts +187 -0
- package/dist/src/ruvector/graph-analyzer.js +929 -0
- package/dist/src/ruvector/graph-backend.d.ts +79 -0
- package/dist/src/ruvector/graph-backend.js +220 -0
- package/dist/src/ruvector/index.d.ts +38 -0
- package/dist/src/ruvector/index.js +86 -0
- package/dist/src/ruvector/lora-adapter.d.ts +292 -0
- package/dist/src/ruvector/lora-adapter.js +710 -0
- package/dist/src/ruvector/model-prices.d.ts +50 -0
- package/dist/src/ruvector/model-prices.js +72 -0
- package/dist/src/ruvector/model-router.d.ts +408 -0
- package/dist/src/ruvector/model-router.js +1162 -0
- package/dist/src/ruvector/neural-router.d.ts +182 -0
- package/dist/src/ruvector/neural-router.js +825 -0
- package/dist/src/ruvector/output-verifier.d.ts +83 -0
- package/dist/src/ruvector/output-verifier.js +277 -0
- package/dist/src/ruvector/q-learning-router.d.ts +227 -0
- package/dist/src/ruvector/q-learning-router.js +721 -0
- package/dist/src/ruvector/router-calibrator.d.ts +65 -0
- package/dist/src/ruvector/router-calibrator.js +120 -0
- package/dist/src/ruvector/router-parallel-recorder.d.ts +127 -0
- package/dist/src/ruvector/router-parallel-recorder.js +183 -0
- package/dist/src/ruvector/router-trajectory.d.ts +194 -0
- package/dist/src/ruvector/router-trajectory.js +281 -0
- package/dist/src/ruvector/run-transcript-recorder.d.ts +154 -0
- package/dist/src/ruvector/run-transcript-recorder.js +209 -0
- package/dist/src/ruvector/ruvllm-wasm.d.ts +179 -0
- package/dist/src/ruvector/ruvllm-wasm.js +379 -0
- package/dist/src/ruvector/semantic-router.d.ts +77 -0
- package/dist/src/ruvector/semantic-router.js +178 -0
- package/dist/src/ruvector/task-embedder.d.ts +56 -0
- package/dist/src/ruvector/task-embedder.js +237 -0
- package/dist/src/ruvector/trajectory-tree.d.ts +113 -0
- package/dist/src/ruvector/trajectory-tree.js +237 -0
- package/dist/src/ruvector/vector-db.d.ts +73 -0
- package/dist/src/ruvector/vector-db.js +301 -0
- package/dist/src/ruvector/wasm-embedder.d.ts +13 -0
- package/dist/src/ruvector/wasm-embedder.js +143 -0
- package/dist/src/security/builtin-aidefence.d.ts +34 -0
- package/dist/src/security/builtin-aidefence.js +86 -0
- package/dist/src/services/agentic-flow-bridge.d.ts +50 -0
- package/dist/src/services/agentic-flow-bridge.js +95 -0
- package/dist/src/services/ai-job-dedup.d.ts +61 -0
- package/dist/src/services/ai-job-dedup.js +136 -0
- package/dist/src/services/checkpoint-gate.d.ts +140 -0
- package/dist/src/services/checkpoint-gate.js +223 -0
- package/dist/src/services/claim-service.d.ts +204 -0
- package/dist/src/services/claim-service.js +818 -0
- package/dist/src/services/config-file-manager.d.ts +37 -0
- package/dist/src/services/config-file-manager.js +224 -0
- package/dist/src/services/container-worker-pool.d.ts +204 -0
- package/dist/src/services/container-worker-pool.js +589 -0
- package/dist/src/services/daemon-autostart.d.ts +17 -0
- package/dist/src/services/daemon-autostart.js +102 -0
- package/dist/src/services/distill-oracle.d.ts +190 -0
- package/dist/src/services/distill-oracle.js +349 -0
- package/dist/src/services/distill-tuning.d.ts +111 -0
- package/dist/src/services/distill-tuning.js +510 -0
- package/dist/src/services/evolve-proof.d.ts +253 -0
- package/dist/src/services/evolve-proof.js +343 -0
- package/dist/src/services/fable-harness.d.ts +208 -0
- package/dist/src/services/fable-harness.js +388 -0
- package/dist/src/services/git-workspace-identity.d.ts +42 -0
- package/dist/src/services/git-workspace-identity.js +99 -0
- package/dist/src/services/global-ai-budget.d.ts +135 -0
- package/dist/src/services/global-ai-budget.js +415 -0
- package/dist/src/services/harness-benchmark.d.ts +68 -0
- package/dist/src/services/harness-benchmark.js +94 -0
- package/dist/src/services/harness-canary.d.ts +60 -0
- package/dist/src/services/harness-canary.js +69 -0
- package/dist/src/services/harness-corpus-harvester.d.ts +51 -0
- package/dist/src/services/harness-corpus-harvester.js +74 -0
- package/dist/src/services/harness-flywheel-generations.d.ts +115 -0
- package/dist/src/services/harness-flywheel-generations.js +360 -0
- package/dist/src/services/harness-flywheel-runtime.d.ts +25 -0
- package/dist/src/services/harness-flywheel-runtime.js +92 -0
- package/dist/src/services/harness-flywheel.d.ts +48 -0
- package/dist/src/services/harness-flywheel.js +207 -0
- package/dist/src/services/harness-frozen-eval.d.ts +22 -0
- package/dist/src/services/harness-frozen-eval.js +66 -0
- package/dist/src/services/harness-hosts.d.ts +40 -0
- package/dist/src/services/harness-hosts.js +88 -0
- package/dist/src/services/harness-improvement-ledger.d.ts +63 -0
- package/dist/src/services/harness-improvement-ledger.js +101 -0
- package/dist/src/services/harness-loop.d.ts +53 -0
- package/dist/src/services/harness-loop.js +85 -0
- package/dist/src/services/harness-qualification.d.ts +66 -0
- package/dist/src/services/harness-qualification.js +143 -0
- package/dist/src/services/harness-replay.d.ts +37 -0
- package/dist/src/services/harness-replay.js +92 -0
- package/dist/src/services/harness-verify.d.ts +33 -0
- package/dist/src/services/harness-verify.js +26 -0
- package/dist/src/services/harness-worker.d.ts +23 -0
- package/dist/src/services/harness-worker.js +66 -0
- package/dist/src/services/headless-worker-executor.d.ts +358 -0
- package/dist/src/services/headless-worker-executor.js +1269 -0
- package/dist/src/services/index.d.ts +13 -0
- package/dist/src/services/index.js +11 -0
- package/dist/src/services/memory-backup.d.ts +53 -0
- package/dist/src/services/memory-backup.js +198 -0
- package/dist/src/services/memory-distillation.d.ts +41 -0
- package/dist/src/services/memory-distillation.js +277 -0
- package/dist/src/services/native-training.d.ts +68 -0
- package/dist/src/services/native-training.js +141 -0
- package/dist/src/services/registry-api.d.ts +58 -0
- package/dist/src/services/registry-api.js +146 -0
- package/dist/src/services/repo-supervisor.d.ts +70 -0
- package/dist/src/services/repo-supervisor.js +228 -0
- package/dist/src/services/ruvector-training.d.ts +222 -0
- package/dist/src/services/ruvector-training.js +693 -0
- package/dist/src/services/swarm-memory-branches.d.ts +135 -0
- package/dist/src/services/swarm-memory-branches.js +213 -0
- package/dist/src/services/weight-eft.d.ts +305 -0
- package/dist/src/services/weight-eft.js +296 -0
- package/dist/src/services/worker-daemon.d.ts +439 -0
- package/dist/src/services/worker-daemon.js +1865 -0
- package/dist/src/services/worker-queue.d.ts +194 -0
- package/dist/src/services/worker-queue.js +513 -0
- package/dist/src/services/workspace-lease.d.ts +55 -0
- package/dist/src/services/workspace-lease.js +191 -0
- package/dist/src/suggest.d.ts +53 -0
- package/dist/src/suggest.js +200 -0
- package/dist/src/transfer/anonymization/index.d.ts +25 -0
- package/dist/src/transfer/anonymization/index.js +175 -0
- package/dist/src/transfer/deploy-seraphine.d.ts +13 -0
- package/dist/src/transfer/deploy-seraphine.js +205 -0
- package/dist/src/transfer/export.d.ts +25 -0
- package/dist/src/transfer/export.js +113 -0
- package/dist/src/transfer/index.d.ts +12 -0
- package/dist/src/transfer/index.js +31 -0
- package/dist/src/transfer/ipfs/client.d.ts +109 -0
- package/dist/src/transfer/ipfs/client.js +307 -0
- package/dist/src/transfer/ipfs/upload.d.ts +95 -0
- package/dist/src/transfer/ipfs/upload.js +413 -0
- package/dist/src/transfer/models/seraphine.d.ts +72 -0
- package/dist/src/transfer/models/seraphine.js +373 -0
- package/dist/src/transfer/serialization/cfp.d.ts +49 -0
- package/dist/src/transfer/serialization/cfp.js +183 -0
- package/dist/src/transfer/storage/gcs.d.ts +82 -0
- package/dist/src/transfer/storage/gcs.js +272 -0
- package/dist/src/transfer/storage/index.d.ts +6 -0
- package/dist/src/transfer/storage/index.js +6 -0
- package/dist/src/transfer/store/discovery.d.ts +84 -0
- package/dist/src/transfer/store/discovery.js +382 -0
- package/dist/src/transfer/store/download.d.ts +70 -0
- package/dist/src/transfer/store/download.js +334 -0
- package/dist/src/transfer/store/index.d.ts +84 -0
- package/dist/src/transfer/store/index.js +153 -0
- package/dist/src/transfer/store/publish.d.ts +76 -0
- package/dist/src/transfer/store/publish.js +294 -0
- package/dist/src/transfer/store/registry.d.ts +58 -0
- package/dist/src/transfer/store/registry.js +285 -0
- package/dist/src/transfer/store/search.d.ts +54 -0
- package/dist/src/transfer/store/search.js +232 -0
- package/dist/src/transfer/store/tests/standalone-test.d.ts +12 -0
- package/dist/src/transfer/store/tests/standalone-test.js +190 -0
- package/dist/src/transfer/store/types.d.ts +193 -0
- package/dist/src/transfer/store/types.js +6 -0
- package/dist/src/transfer/test-seraphine.d.ts +6 -0
- package/dist/src/transfer/test-seraphine.js +105 -0
- package/dist/src/transfer/tests/test-store.d.ts +7 -0
- package/dist/src/transfer/tests/test-store.js +214 -0
- package/dist/src/transfer/types.d.ts +245 -0
- package/dist/src/transfer/types.js +6 -0
- package/dist/src/types.d.ts +13 -0
- package/dist/src/types.js +13 -0
- package/dist/src/update/checker.d.ts +34 -0
- package/dist/src/update/checker.js +191 -0
- package/dist/src/update/executor.d.ts +33 -0
- package/dist/src/update/executor.js +217 -0
- package/dist/src/update/index.d.ts +33 -0
- package/dist/src/update/index.js +64 -0
- package/dist/src/update/rate-limiter.d.ts +20 -0
- package/dist/src/update/rate-limiter.js +96 -0
- package/dist/src/update/validator.d.ts +17 -0
- package/dist/src/update/validator.js +123 -0
- package/package.json +1 -1
|
@@ -0,0 +1,891 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V3 CLI Swarm Command
|
|
3
|
+
* Swarm coordination and management commands
|
|
4
|
+
*/
|
|
5
|
+
import { output } from '../output.js';
|
|
6
|
+
import { select, confirm } from '../prompt.js';
|
|
7
|
+
import { callMCPTool, MCPClientError } from '../mcp-client.js';
|
|
8
|
+
import * as fs from 'fs';
|
|
9
|
+
import * as path from 'path';
|
|
10
|
+
// Get dynamic swarm status from memory/session files
|
|
11
|
+
function getSwarmStatus(swarmId) {
|
|
12
|
+
const swarmDir = path.join(process.cwd(), '.swarm');
|
|
13
|
+
const sessionDir = path.join(process.cwd(), '.claude', 'sessions');
|
|
14
|
+
const memoryPaths = [
|
|
15
|
+
path.join(process.cwd(), '.swarm', 'memory.db'),
|
|
16
|
+
path.join(process.cwd(), '.claude', 'memory.db'),
|
|
17
|
+
];
|
|
18
|
+
// Check for active swarm state file
|
|
19
|
+
const swarmStateFile = path.join(swarmDir, 'state.json');
|
|
20
|
+
let swarmState = null;
|
|
21
|
+
if (fs.existsSync(swarmStateFile)) {
|
|
22
|
+
try {
|
|
23
|
+
swarmState = JSON.parse(fs.readFileSync(swarmStateFile, 'utf-8'));
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// Ignore parse errors
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// Count active agents from process files
|
|
30
|
+
let activeAgents = 0;
|
|
31
|
+
let totalAgents = 0;
|
|
32
|
+
const agentsDir = path.join(swarmDir, 'agents');
|
|
33
|
+
if (fs.existsSync(agentsDir)) {
|
|
34
|
+
try {
|
|
35
|
+
const agentFiles = fs.readdirSync(agentsDir).filter(f => f.endsWith('.json'));
|
|
36
|
+
totalAgents = agentFiles.length;
|
|
37
|
+
for (const file of agentFiles) {
|
|
38
|
+
try {
|
|
39
|
+
const agent = JSON.parse(fs.readFileSync(path.join(agentsDir, file), 'utf-8'));
|
|
40
|
+
if (agent.status === 'active' || agent.status === 'running') {
|
|
41
|
+
activeAgents++;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// Ignore
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
// Ignore
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// Get session count
|
|
54
|
+
let sessionCount = 0;
|
|
55
|
+
if (fs.existsSync(sessionDir)) {
|
|
56
|
+
try {
|
|
57
|
+
sessionCount = fs.readdirSync(sessionDir).filter(f => f.endsWith('.json')).length;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
// Ignore
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// Get memory size as rough indicator of activity
|
|
64
|
+
let memorySize = 0;
|
|
65
|
+
for (const dbPath of memoryPaths) {
|
|
66
|
+
if (fs.existsSync(dbPath)) {
|
|
67
|
+
try {
|
|
68
|
+
memorySize = fs.statSync(dbPath).size;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
// Ignore
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// Count task files if they exist
|
|
77
|
+
let completedTasks = 0;
|
|
78
|
+
let inProgressTasks = 0;
|
|
79
|
+
let pendingTasks = 0;
|
|
80
|
+
const tasksDir = path.join(swarmDir, 'tasks');
|
|
81
|
+
if (fs.existsSync(tasksDir)) {
|
|
82
|
+
try {
|
|
83
|
+
const taskFiles = fs.readdirSync(tasksDir).filter(f => f.endsWith('.json'));
|
|
84
|
+
for (const file of taskFiles) {
|
|
85
|
+
try {
|
|
86
|
+
const task = JSON.parse(fs.readFileSync(path.join(tasksDir, file), 'utf-8'));
|
|
87
|
+
if (task.status === 'completed' || task.status === 'done') {
|
|
88
|
+
completedTasks++;
|
|
89
|
+
}
|
|
90
|
+
else if (task.status === 'in_progress' || task.status === 'running') {
|
|
91
|
+
inProgressTasks++;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
pendingTasks++;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
// Ignore
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
// Ignore
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Calculate dynamic progress based on actual state
|
|
107
|
+
// If no swarm state, show 0%. Otherwise calculate from completed tasks
|
|
108
|
+
const totalTasks = completedTasks + inProgressTasks + pendingTasks;
|
|
109
|
+
let progress = 0;
|
|
110
|
+
if (totalTasks > 0) {
|
|
111
|
+
progress = Math.round((completedTasks / totalTasks) * 100);
|
|
112
|
+
}
|
|
113
|
+
else if (swarmState) {
|
|
114
|
+
// Swarm initialized but no tasks yet
|
|
115
|
+
progress = 5;
|
|
116
|
+
}
|
|
117
|
+
// Determine status
|
|
118
|
+
let status = 'idle';
|
|
119
|
+
if (inProgressTasks > 0 || activeAgents > 0) {
|
|
120
|
+
status = 'running';
|
|
121
|
+
}
|
|
122
|
+
else if (completedTasks > 0 && pendingTasks === 0 && inProgressTasks === 0) {
|
|
123
|
+
status = 'completed';
|
|
124
|
+
}
|
|
125
|
+
else if (swarmState) {
|
|
126
|
+
status = 'ready';
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
id: swarmId || swarmState?.id || 'no-active-swarm',
|
|
130
|
+
topology: swarmState?.topology || 'none',
|
|
131
|
+
status,
|
|
132
|
+
objective: swarmState?.objective || 'No active objective',
|
|
133
|
+
strategy: swarmState?.strategy || 'none',
|
|
134
|
+
agents: {
|
|
135
|
+
total: totalAgents,
|
|
136
|
+
active: activeAgents,
|
|
137
|
+
idle: Math.max(0, totalAgents - activeAgents),
|
|
138
|
+
completed: 0
|
|
139
|
+
},
|
|
140
|
+
progress,
|
|
141
|
+
tasks: {
|
|
142
|
+
total: totalTasks,
|
|
143
|
+
completed: completedTasks,
|
|
144
|
+
inProgress: inProgressTasks,
|
|
145
|
+
pending: pendingTasks
|
|
146
|
+
},
|
|
147
|
+
metrics: {
|
|
148
|
+
tokensUsed: swarmState?.tokensUsed ?? null,
|
|
149
|
+
avgResponseTime: (() => {
|
|
150
|
+
// Calculate average response time from task files with startedAt/completedAt
|
|
151
|
+
const taskTimesMs = [];
|
|
152
|
+
if (fs.existsSync(tasksDir)) {
|
|
153
|
+
try {
|
|
154
|
+
const taskFiles = fs.readdirSync(tasksDir).filter(f => f.endsWith('.json'));
|
|
155
|
+
for (const file of taskFiles) {
|
|
156
|
+
try {
|
|
157
|
+
const task = JSON.parse(fs.readFileSync(path.join(tasksDir, file), 'utf-8'));
|
|
158
|
+
if (task.startedAt && task.completedAt) {
|
|
159
|
+
const elapsed = new Date(task.completedAt).getTime() - new Date(task.startedAt).getTime();
|
|
160
|
+
if (elapsed > 0)
|
|
161
|
+
taskTimesMs.push(elapsed);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
catch { /* skip malformed task files */ }
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
catch { /* skip if dir unreadable */ }
|
|
168
|
+
}
|
|
169
|
+
if (taskTimesMs.length === 0)
|
|
170
|
+
return null;
|
|
171
|
+
const avgMs = Math.round(taskTimesMs.reduce((a, b) => a + b, 0) / taskTimesMs.length);
|
|
172
|
+
return avgMs < 1000 ? `${avgMs}ms` : `${(avgMs / 1000).toFixed(1)}s`;
|
|
173
|
+
})(),
|
|
174
|
+
successRate: totalTasks > 0 ? `${Math.round((completedTasks / totalTasks) * 100)}%` : null,
|
|
175
|
+
elapsedTime: (() => {
|
|
176
|
+
// Calculate from swarm startedAt in state.json
|
|
177
|
+
const startedAt = swarmState?.startedAt
|
|
178
|
+
|| swarmState?.initializedAt;
|
|
179
|
+
if (!startedAt)
|
|
180
|
+
return null;
|
|
181
|
+
const elapsedMs = Date.now() - new Date(startedAt).getTime();
|
|
182
|
+
if (elapsedMs < 0)
|
|
183
|
+
return null;
|
|
184
|
+
const secs = Math.floor(elapsedMs / 1000);
|
|
185
|
+
if (secs < 60)
|
|
186
|
+
return `${secs}s`;
|
|
187
|
+
const mins = Math.floor(secs / 60);
|
|
188
|
+
const remSecs = secs % 60;
|
|
189
|
+
if (mins < 60)
|
|
190
|
+
return `${mins}m ${remSecs}s`;
|
|
191
|
+
const hrs = Math.floor(mins / 60);
|
|
192
|
+
const remMins = mins % 60;
|
|
193
|
+
return `${hrs}h ${remMins}m`;
|
|
194
|
+
})()
|
|
195
|
+
},
|
|
196
|
+
coordination: (() => {
|
|
197
|
+
// Read real coordination counts from .swarm/coordination/ directory
|
|
198
|
+
const coordDir = path.join(swarmDir, 'coordination');
|
|
199
|
+
let consensusRounds = 0;
|
|
200
|
+
let messagesSent = 0;
|
|
201
|
+
let conflictsResolved = 0;
|
|
202
|
+
if (fs.existsSync(coordDir)) {
|
|
203
|
+
try {
|
|
204
|
+
const coordFiles = fs.readdirSync(coordDir).filter(f => f.endsWith('.json'));
|
|
205
|
+
for (const file of coordFiles) {
|
|
206
|
+
try {
|
|
207
|
+
const entry = JSON.parse(fs.readFileSync(path.join(coordDir, file), 'utf-8'));
|
|
208
|
+
if (entry.type === 'consensus')
|
|
209
|
+
consensusRounds++;
|
|
210
|
+
else if (entry.type === 'message')
|
|
211
|
+
messagesSent++;
|
|
212
|
+
else if (entry.type === 'conflict' || entry.type === 'conflict-resolution')
|
|
213
|
+
conflictsResolved++;
|
|
214
|
+
// Also aggregate pre-counted fields if present
|
|
215
|
+
if (typeof entry.consensusRounds === 'number')
|
|
216
|
+
consensusRounds += entry.consensusRounds;
|
|
217
|
+
if (typeof entry.messagesSent === 'number')
|
|
218
|
+
messagesSent += entry.messagesSent;
|
|
219
|
+
if (typeof entry.conflictsResolved === 'number')
|
|
220
|
+
conflictsResolved += entry.conflictsResolved;
|
|
221
|
+
}
|
|
222
|
+
catch { /* skip malformed coordination files */ }
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
catch { /* skip if dir unreadable */ }
|
|
226
|
+
}
|
|
227
|
+
// Also check state.json for aggregate coordination stats
|
|
228
|
+
if (swarmState) {
|
|
229
|
+
const coord = swarmState.coordination;
|
|
230
|
+
if (coord) {
|
|
231
|
+
if (typeof coord.consensusRounds === 'number')
|
|
232
|
+
consensusRounds += coord.consensusRounds;
|
|
233
|
+
if (typeof coord.messagesSent === 'number')
|
|
234
|
+
messagesSent += coord.messagesSent;
|
|
235
|
+
if (typeof coord.conflictsResolved === 'number')
|
|
236
|
+
conflictsResolved += coord.conflictsResolved;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return { consensusRounds, messagesSent, conflictsResolved };
|
|
240
|
+
})(),
|
|
241
|
+
hasActiveSwarm: !!swarmState || totalAgents > 0
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
// Swarm topologies
|
|
245
|
+
const TOPOLOGIES = [
|
|
246
|
+
{ value: 'hierarchical', label: 'Hierarchical', hint: 'Queen-led coordination with worker agents' },
|
|
247
|
+
{ value: 'mesh', label: 'Mesh', hint: 'Fully connected peer-to-peer network' },
|
|
248
|
+
{ value: 'ring', label: 'Ring', hint: 'Circular communication pattern' },
|
|
249
|
+
{ value: 'star', label: 'Star', hint: 'Central coordinator with spoke agents' },
|
|
250
|
+
{ value: 'hybrid', label: 'Hybrid', hint: 'Hierarchical mesh for maximum flexibility' },
|
|
251
|
+
{ value: 'hierarchical-mesh', label: 'Hierarchical Mesh', hint: 'V3 15-agent queen + peer communication (recommended)' }
|
|
252
|
+
];
|
|
253
|
+
// Swarm strategies
|
|
254
|
+
const STRATEGIES = [
|
|
255
|
+
{ value: 'specialized', label: 'Specialized', hint: 'Clear roles, no overlap (anti-drift)' },
|
|
256
|
+
{ value: 'balanced', label: 'Balanced', hint: 'Even distribution of work' },
|
|
257
|
+
{ value: 'adaptive', label: 'Adaptive', hint: 'Dynamic strategy based on task' },
|
|
258
|
+
{ value: 'research', label: 'Research', hint: 'Distributed research and analysis' },
|
|
259
|
+
{ value: 'development', label: 'Development', hint: 'Collaborative code development' },
|
|
260
|
+
{ value: 'testing', label: 'Testing', hint: 'Comprehensive test coverage' },
|
|
261
|
+
{ value: 'optimization', label: 'Optimization', hint: 'Performance optimization' },
|
|
262
|
+
{ value: 'maintenance', label: 'Maintenance', hint: 'Codebase maintenance and refactoring' },
|
|
263
|
+
{ value: 'analysis', label: 'Analysis', hint: 'Code analysis and documentation' }
|
|
264
|
+
];
|
|
265
|
+
// Initialize swarm
|
|
266
|
+
const initCommand = {
|
|
267
|
+
name: 'init',
|
|
268
|
+
description: 'Initialize a new swarm',
|
|
269
|
+
options: [
|
|
270
|
+
{
|
|
271
|
+
name: 'topology',
|
|
272
|
+
short: 't',
|
|
273
|
+
description: 'Swarm topology',
|
|
274
|
+
type: 'string',
|
|
275
|
+
choices: TOPOLOGIES.map(t => t.value),
|
|
276
|
+
default: 'hierarchical'
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
name: 'max-agents',
|
|
280
|
+
short: 'm',
|
|
281
|
+
description: 'Maximum number of agents',
|
|
282
|
+
type: 'number',
|
|
283
|
+
default: 15
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
name: 'auto-scale',
|
|
287
|
+
description: 'Enable automatic scaling',
|
|
288
|
+
type: 'boolean',
|
|
289
|
+
default: true
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
name: 'strategy',
|
|
293
|
+
short: 's',
|
|
294
|
+
description: 'Coordination strategy',
|
|
295
|
+
type: 'string',
|
|
296
|
+
choices: STRATEGIES.map(s => s.value)
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
name: 'v3-mode',
|
|
300
|
+
description: 'Enable V3 15-agent hierarchical mesh mode',
|
|
301
|
+
type: 'boolean',
|
|
302
|
+
default: false
|
|
303
|
+
}
|
|
304
|
+
],
|
|
305
|
+
action: async (ctx) => {
|
|
306
|
+
let topology = ctx.flags.topology;
|
|
307
|
+
const maxAgents = ctx.flags.maxAgents || 15;
|
|
308
|
+
const v3Mode = ctx.flags.v3Mode;
|
|
309
|
+
// V3 mode enables hierarchical-mesh hybrid
|
|
310
|
+
if (v3Mode) {
|
|
311
|
+
topology = 'hierarchical-mesh';
|
|
312
|
+
output.printInfo('V3 Mode: Using hierarchical-mesh topology with 15-agent coordination');
|
|
313
|
+
}
|
|
314
|
+
// Interactive topology selection
|
|
315
|
+
if (!topology && ctx.interactive) {
|
|
316
|
+
topology = await select({
|
|
317
|
+
message: 'Select swarm topology:',
|
|
318
|
+
options: TOPOLOGIES,
|
|
319
|
+
default: 'hierarchical'
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
output.writeln();
|
|
323
|
+
output.printInfo('Initializing swarm...');
|
|
324
|
+
try {
|
|
325
|
+
// Call MCP tool to initialize swarm
|
|
326
|
+
const result = await callMCPTool('swarm_init', {
|
|
327
|
+
topology: topology,
|
|
328
|
+
maxAgents,
|
|
329
|
+
config: {
|
|
330
|
+
communicationProtocol: 'message-bus',
|
|
331
|
+
consensusMechanism: 'majority',
|
|
332
|
+
failureHandling: 'retry',
|
|
333
|
+
loadBalancing: true,
|
|
334
|
+
autoScaling: ctx.flags.autoScale ?? true,
|
|
335
|
+
},
|
|
336
|
+
metadata: {
|
|
337
|
+
v3Mode,
|
|
338
|
+
strategy: ctx.flags.strategy || 'development',
|
|
339
|
+
},
|
|
340
|
+
});
|
|
341
|
+
// Display initialization progress
|
|
342
|
+
output.writeln(output.dim(' Creating coordination topology...'));
|
|
343
|
+
output.writeln(output.dim(' Initializing memory namespace...'));
|
|
344
|
+
output.writeln(output.dim(' Setting up communication channels...'));
|
|
345
|
+
if (v3Mode) {
|
|
346
|
+
output.writeln(output.dim(' Enabling Flash Attention (2.49x-7.47x speedup)...'));
|
|
347
|
+
output.writeln(output.dim(' Configuring AgentDB integration (150x faster)...'));
|
|
348
|
+
output.writeln(output.dim(' Initializing SONA learning system...'));
|
|
349
|
+
}
|
|
350
|
+
output.writeln();
|
|
351
|
+
output.printTable({
|
|
352
|
+
columns: [
|
|
353
|
+
{ key: 'property', header: 'Property', width: 20 },
|
|
354
|
+
{ key: 'value', header: 'Value', width: 35 }
|
|
355
|
+
],
|
|
356
|
+
data: [
|
|
357
|
+
{ property: 'Swarm ID', value: result.swarmId },
|
|
358
|
+
{ property: 'Topology', value: result.topology },
|
|
359
|
+
{ property: 'Max Agents', value: result.config.maxAgents },
|
|
360
|
+
{ property: 'Auto Scale', value: result.config.autoScaling ? 'Enabled' : 'Disabled' },
|
|
361
|
+
{ property: 'Protocol', value: result.config.communicationProtocol || 'N/A' },
|
|
362
|
+
{ property: 'V3 Mode', value: v3Mode ? 'Enabled' : 'Disabled' }
|
|
363
|
+
]
|
|
364
|
+
});
|
|
365
|
+
output.writeln();
|
|
366
|
+
output.printSuccess('Swarm initialized successfully');
|
|
367
|
+
// Save swarm state locally for status command to read
|
|
368
|
+
const swarmDir = path.join(process.cwd(), '.swarm');
|
|
369
|
+
try {
|
|
370
|
+
if (!fs.existsSync(swarmDir)) {
|
|
371
|
+
fs.mkdirSync(swarmDir, { recursive: true });
|
|
372
|
+
}
|
|
373
|
+
const stateFile = path.join(swarmDir, 'state.json');
|
|
374
|
+
fs.writeFileSync(stateFile, JSON.stringify({
|
|
375
|
+
id: result.swarmId,
|
|
376
|
+
topology: result.topology,
|
|
377
|
+
maxAgents: result.config.maxAgents,
|
|
378
|
+
strategy: ctx.flags.strategy || 'development',
|
|
379
|
+
v3Mode,
|
|
380
|
+
initializedAt: result.initializedAt,
|
|
381
|
+
status: 'ready'
|
|
382
|
+
}, null, 2));
|
|
383
|
+
}
|
|
384
|
+
catch {
|
|
385
|
+
// Ignore errors writing state file
|
|
386
|
+
}
|
|
387
|
+
if (ctx.flags.format === 'json') {
|
|
388
|
+
output.printJson(result);
|
|
389
|
+
}
|
|
390
|
+
return { success: true, data: result };
|
|
391
|
+
}
|
|
392
|
+
catch (error) {
|
|
393
|
+
if (error instanceof MCPClientError) {
|
|
394
|
+
output.printError(`Failed to initialize swarm: ${error.message}`);
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
398
|
+
}
|
|
399
|
+
return { success: false, exitCode: 1 };
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
// Start swarm execution
|
|
404
|
+
const startCommand = {
|
|
405
|
+
name: 'start',
|
|
406
|
+
description: 'Start swarm execution',
|
|
407
|
+
options: [
|
|
408
|
+
{
|
|
409
|
+
name: 'objective',
|
|
410
|
+
short: 'o',
|
|
411
|
+
description: 'Swarm objective/task',
|
|
412
|
+
type: 'string',
|
|
413
|
+
required: true
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
name: 'strategy',
|
|
417
|
+
short: 's',
|
|
418
|
+
description: 'Execution strategy',
|
|
419
|
+
type: 'string',
|
|
420
|
+
choices: STRATEGIES.map(s => s.value)
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
name: 'parallel',
|
|
424
|
+
short: 'p',
|
|
425
|
+
description: 'Enable parallel execution',
|
|
426
|
+
type: 'boolean',
|
|
427
|
+
default: true
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
name: 'monitor',
|
|
431
|
+
description: 'Enable real-time monitoring',
|
|
432
|
+
type: 'boolean',
|
|
433
|
+
default: true
|
|
434
|
+
}
|
|
435
|
+
],
|
|
436
|
+
examples: [
|
|
437
|
+
{ command: 'claude-flow swarm start -o "Build REST API" -s development', description: 'Start development swarm' },
|
|
438
|
+
{ command: 'claude-flow swarm start -o "Analyze codebase" --parallel', description: 'Parallel analysis' }
|
|
439
|
+
],
|
|
440
|
+
action: async (ctx) => {
|
|
441
|
+
const objective = ctx.args[0] || ctx.flags.objective;
|
|
442
|
+
let strategy = ctx.flags.strategy;
|
|
443
|
+
if (!objective) {
|
|
444
|
+
output.printError('Objective is required. Use -o or provide as argument.');
|
|
445
|
+
return { success: false, exitCode: 1 };
|
|
446
|
+
}
|
|
447
|
+
// Interactive strategy selection
|
|
448
|
+
if (!strategy && ctx.interactive) {
|
|
449
|
+
strategy = await select({
|
|
450
|
+
message: 'Select execution strategy:',
|
|
451
|
+
options: STRATEGIES,
|
|
452
|
+
default: 'development'
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
strategy = strategy || 'development';
|
|
456
|
+
output.writeln();
|
|
457
|
+
output.printInfo(`Starting swarm with objective: ${output.highlight(objective)}`);
|
|
458
|
+
output.writeln();
|
|
459
|
+
// Compute agent deployment plan based on strategy
|
|
460
|
+
const agentPlan = getAgentPlan(strategy);
|
|
461
|
+
output.writeln(output.bold('Agent Deployment Plan'));
|
|
462
|
+
output.printTable({
|
|
463
|
+
columns: [
|
|
464
|
+
{ key: 'role', header: 'Role', width: 20 },
|
|
465
|
+
{ key: 'type', header: 'Type', width: 15 },
|
|
466
|
+
{ key: 'count', header: 'Count', width: 8, align: 'right' },
|
|
467
|
+
{ key: 'purpose', header: 'Purpose', width: 30 }
|
|
468
|
+
],
|
|
469
|
+
data: agentPlan
|
|
470
|
+
});
|
|
471
|
+
// Confirm execution
|
|
472
|
+
if (ctx.interactive) {
|
|
473
|
+
const confirmed = await confirm({
|
|
474
|
+
message: `Deploy ${agentPlan.reduce((sum, a) => sum + a.count, 0)} agents?`,
|
|
475
|
+
default: true
|
|
476
|
+
});
|
|
477
|
+
if (!confirmed) {
|
|
478
|
+
output.printInfo('Swarm execution cancelled');
|
|
479
|
+
return { success: true };
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
// Initialize swarm via MCP and persist state (#1423: was stub-only, no actual execution)
|
|
483
|
+
const swarmId = `swarm-${Date.now().toString(36)}`;
|
|
484
|
+
const totalAgents = agentPlan.reduce((sum, a) => sum + a.count, 0);
|
|
485
|
+
output.writeln();
|
|
486
|
+
const spinner = output.createSpinner({ text: 'Initializing swarm via MCP...', spinner: 'dots' });
|
|
487
|
+
spinner.start();
|
|
488
|
+
try {
|
|
489
|
+
// Actually call MCP to initialize the swarm
|
|
490
|
+
const initResult = await callMCPTool('swarm_init', {
|
|
491
|
+
topology: 'hierarchical',
|
|
492
|
+
maxAgents: totalAgents,
|
|
493
|
+
strategy: strategy === 'development' ? 'specialized' : strategy,
|
|
494
|
+
});
|
|
495
|
+
spinner.succeed('Swarm initialized via MCP');
|
|
496
|
+
}
|
|
497
|
+
catch (err) {
|
|
498
|
+
spinner.fail('MCP swarm_init failed — swarm metadata saved locally only');
|
|
499
|
+
output.writeln(output.dim(` Error: ${err instanceof Error ? err.message : String(err)}`));
|
|
500
|
+
// #2370: the old hint referenced the deprecated `claude-flow@v3alpha`
|
|
501
|
+
// dist-tag which now resolves to a pre-rename package. Use the current
|
|
502
|
+
// `ruflo@latest` and force a fresh fetch with `-y` so npx doesn't pick
|
|
503
|
+
// a stale local install.
|
|
504
|
+
output.writeln(output.dim(' The MCP server may not be running. Start it with: claude mcp add claude-flow -- npx -y ruflo@latest mcp start'));
|
|
505
|
+
}
|
|
506
|
+
// Persist swarm state to disk so `swarm status` can read it
|
|
507
|
+
const swarmDir = path.join(process.cwd(), '.swarm');
|
|
508
|
+
if (!fs.existsSync(swarmDir))
|
|
509
|
+
fs.mkdirSync(swarmDir, { recursive: true });
|
|
510
|
+
const executionState = {
|
|
511
|
+
swarmId,
|
|
512
|
+
objective,
|
|
513
|
+
strategy,
|
|
514
|
+
status: 'initialized',
|
|
515
|
+
agents: totalAgents,
|
|
516
|
+
agentPlan,
|
|
517
|
+
startedAt: new Date().toISOString(),
|
|
518
|
+
parallel: ctx.flags.parallel ?? true
|
|
519
|
+
};
|
|
520
|
+
fs.writeFileSync(path.join(swarmDir, 'state.json'), JSON.stringify(executionState, null, 2));
|
|
521
|
+
output.writeln();
|
|
522
|
+
output.printSuccess(`Swarm ${swarmId} initialized with ${totalAgents} agent slots`);
|
|
523
|
+
output.writeln(output.dim(' This CLI coordinates agent state. Execution happens via:'));
|
|
524
|
+
output.writeln(output.dim(' - Claude Code Agent tool (interactive)'));
|
|
525
|
+
output.writeln(output.dim(' - claude -p (headless background)'));
|
|
526
|
+
output.writeln(output.dim(' - hive-mind spawn --claude (autonomous)'));
|
|
527
|
+
output.writeln(output.dim(` Monitor: claude-flow swarm status ${swarmId}`));
|
|
528
|
+
return { success: true, data: executionState };
|
|
529
|
+
}
|
|
530
|
+
};
|
|
531
|
+
// Swarm status
|
|
532
|
+
const statusCommand = {
|
|
533
|
+
name: 'status',
|
|
534
|
+
description: 'Show swarm status',
|
|
535
|
+
action: async (ctx) => {
|
|
536
|
+
const swarmId = ctx.args[0];
|
|
537
|
+
// Get dynamic status from actual swarm state files
|
|
538
|
+
const status = getSwarmStatus(swarmId);
|
|
539
|
+
if (ctx.flags.format === 'json') {
|
|
540
|
+
output.printJson(status);
|
|
541
|
+
return { success: true, data: status };
|
|
542
|
+
}
|
|
543
|
+
output.writeln();
|
|
544
|
+
// Show different message if no active swarm
|
|
545
|
+
if (!status.hasActiveSwarm) {
|
|
546
|
+
output.writeln(output.warning('No active swarm'));
|
|
547
|
+
output.writeln();
|
|
548
|
+
output.writeln(output.dim('Start a swarm with:'));
|
|
549
|
+
output.writeln(output.dim(' npx @claude-flow/cli@latest swarm init'));
|
|
550
|
+
output.writeln(output.dim(' npx @claude-flow/cli@latest swarm start'));
|
|
551
|
+
output.writeln();
|
|
552
|
+
return { success: true, data: status };
|
|
553
|
+
}
|
|
554
|
+
output.writeln(output.bold(`Swarm Status: ${status.id}`));
|
|
555
|
+
output.writeln();
|
|
556
|
+
// Progress bar
|
|
557
|
+
output.writeln(`Overall Progress: ${output.progressBar(status.progress, 100, 40)}`);
|
|
558
|
+
output.writeln();
|
|
559
|
+
// Agent status
|
|
560
|
+
output.writeln(output.bold('Agents'));
|
|
561
|
+
output.printTable({
|
|
562
|
+
columns: [
|
|
563
|
+
{ key: 'status', header: 'Status', width: 12 },
|
|
564
|
+
{ key: 'count', header: 'Count', width: 10, align: 'right' }
|
|
565
|
+
],
|
|
566
|
+
data: [
|
|
567
|
+
{ status: output.success('Active'), count: status.agents.active },
|
|
568
|
+
{ status: output.warning('Idle'), count: status.agents.idle },
|
|
569
|
+
{ status: output.dim('Completed'), count: status.agents.completed },
|
|
570
|
+
{ status: 'Total', count: status.agents.total }
|
|
571
|
+
]
|
|
572
|
+
});
|
|
573
|
+
output.writeln();
|
|
574
|
+
// Task status
|
|
575
|
+
output.writeln(output.bold('Tasks'));
|
|
576
|
+
output.printTable({
|
|
577
|
+
columns: [
|
|
578
|
+
{ key: 'status', header: 'Status', width: 12 },
|
|
579
|
+
{ key: 'count', header: 'Count', width: 10, align: 'right' }
|
|
580
|
+
],
|
|
581
|
+
data: [
|
|
582
|
+
{ status: output.success('Completed'), count: status.tasks.completed },
|
|
583
|
+
{ status: output.info('In Progress'), count: status.tasks.inProgress },
|
|
584
|
+
{ status: output.dim('Pending'), count: status.tasks.pending },
|
|
585
|
+
{ status: 'Total', count: status.tasks.total }
|
|
586
|
+
]
|
|
587
|
+
});
|
|
588
|
+
output.writeln();
|
|
589
|
+
// Metrics
|
|
590
|
+
output.writeln(output.bold('Performance Metrics'));
|
|
591
|
+
output.printList([
|
|
592
|
+
`Tokens Used: ${status.metrics.tokensUsed != null ? status.metrics.tokensUsed.toLocaleString() : output.dim('unknown')}`,
|
|
593
|
+
`Avg Response Time: ${status.metrics.avgResponseTime ?? output.dim('no data')}`,
|
|
594
|
+
`Success Rate: ${status.metrics.successRate ?? output.dim('no data')}`,
|
|
595
|
+
`Elapsed Time: ${status.metrics.elapsedTime ?? output.dim('no data')}`
|
|
596
|
+
]);
|
|
597
|
+
output.writeln();
|
|
598
|
+
// Coordination stats
|
|
599
|
+
output.writeln(output.bold('Coordination'));
|
|
600
|
+
output.printList([
|
|
601
|
+
`Consensus Rounds: ${status.coordination.consensusRounds}`,
|
|
602
|
+
`Messages Sent: ${status.coordination.messagesSent}`,
|
|
603
|
+
`Conflicts Resolved: ${status.coordination.conflictsResolved}`
|
|
604
|
+
]);
|
|
605
|
+
return { success: true, data: status };
|
|
606
|
+
}
|
|
607
|
+
};
|
|
608
|
+
// Stop swarm
|
|
609
|
+
const stopCommand = {
|
|
610
|
+
name: 'stop',
|
|
611
|
+
description: 'Stop swarm execution',
|
|
612
|
+
options: [
|
|
613
|
+
{
|
|
614
|
+
name: 'force',
|
|
615
|
+
short: 'f',
|
|
616
|
+
description: 'Force immediate stop',
|
|
617
|
+
type: 'boolean',
|
|
618
|
+
default: false
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
name: 'save-state',
|
|
622
|
+
description: 'Save current state for resume',
|
|
623
|
+
type: 'boolean',
|
|
624
|
+
default: true
|
|
625
|
+
}
|
|
626
|
+
],
|
|
627
|
+
action: async (ctx) => {
|
|
628
|
+
const swarmId = ctx.args[0];
|
|
629
|
+
const force = ctx.flags.force;
|
|
630
|
+
if (!swarmId) {
|
|
631
|
+
output.printError('Swarm ID is required');
|
|
632
|
+
return { success: false, exitCode: 1 };
|
|
633
|
+
}
|
|
634
|
+
if (ctx.interactive && !force) {
|
|
635
|
+
const confirmed = await confirm({
|
|
636
|
+
message: `Stop swarm ${swarmId}? Progress will be saved.`,
|
|
637
|
+
default: false
|
|
638
|
+
});
|
|
639
|
+
if (!confirmed) {
|
|
640
|
+
output.printInfo('Operation cancelled');
|
|
641
|
+
return { success: true };
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
output.printInfo(`Stopping swarm ${swarmId}...`);
|
|
645
|
+
// Update persisted swarm state if it exists (#1423)
|
|
646
|
+
const swarmStateFile = path.join(process.cwd(), '.swarm', 'state.json');
|
|
647
|
+
if (fs.existsSync(swarmStateFile)) {
|
|
648
|
+
try {
|
|
649
|
+
const state = JSON.parse(fs.readFileSync(swarmStateFile, 'utf-8'));
|
|
650
|
+
state.status = 'stopped';
|
|
651
|
+
state.stoppedAt = new Date().toISOString();
|
|
652
|
+
fs.writeFileSync(swarmStateFile, JSON.stringify(state, null, 2));
|
|
653
|
+
output.writeln(output.dim(' Swarm state updated'));
|
|
654
|
+
}
|
|
655
|
+
catch {
|
|
656
|
+
output.writeln(output.dim(' Could not update swarm state file'));
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
// Attempt MCP cleanup
|
|
660
|
+
try {
|
|
661
|
+
await callMCPTool('swarm_shutdown', { swarmId, force });
|
|
662
|
+
output.writeln(output.dim(' MCP swarm stopped'));
|
|
663
|
+
}
|
|
664
|
+
catch {
|
|
665
|
+
// MCP may not be available
|
|
666
|
+
}
|
|
667
|
+
output.printSuccess(`Swarm ${swarmId} stopped`);
|
|
668
|
+
return { success: true, data: { swarmId, stopped: true, force } };
|
|
669
|
+
}
|
|
670
|
+
};
|
|
671
|
+
// Scale swarm
|
|
672
|
+
const scaleCommand = {
|
|
673
|
+
name: 'scale',
|
|
674
|
+
description: 'Scale swarm agent count',
|
|
675
|
+
options: [
|
|
676
|
+
{
|
|
677
|
+
name: 'agents',
|
|
678
|
+
short: 'a',
|
|
679
|
+
description: 'Target number of agents',
|
|
680
|
+
type: 'number',
|
|
681
|
+
required: true
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
name: 'type',
|
|
685
|
+
short: 't',
|
|
686
|
+
description: 'Agent type to scale',
|
|
687
|
+
type: 'string'
|
|
688
|
+
}
|
|
689
|
+
],
|
|
690
|
+
action: async (ctx) => {
|
|
691
|
+
const swarmId = ctx.args[0];
|
|
692
|
+
const targetAgents = ctx.flags.agents;
|
|
693
|
+
const agentType = ctx.flags.type;
|
|
694
|
+
if (!swarmId) {
|
|
695
|
+
output.printError('Swarm ID is required');
|
|
696
|
+
return { success: false, exitCode: 1 };
|
|
697
|
+
}
|
|
698
|
+
if (!targetAgents) {
|
|
699
|
+
output.printError('Target agent count required. Use --agents or -a');
|
|
700
|
+
return { success: false, exitCode: 1 };
|
|
701
|
+
}
|
|
702
|
+
output.printInfo(`Scaling swarm ${swarmId} to ${targetAgents} agents...`);
|
|
703
|
+
// Calculate scaling delta — fetch actual count instead of hardcoded 8 (#1425)
|
|
704
|
+
const { callMCPTool } = await import('../mcp-client.js');
|
|
705
|
+
let currentAgents = 0;
|
|
706
|
+
try {
|
|
707
|
+
const statusResult = await callMCPTool('swarm_status', {});
|
|
708
|
+
const statusData = typeof statusResult === 'string' ? JSON.parse(statusResult) : statusResult;
|
|
709
|
+
currentAgents = statusData?.agentCount ?? statusData?.agents?.length ?? 0;
|
|
710
|
+
}
|
|
711
|
+
catch {
|
|
712
|
+
// If MCP unavailable, fall back to 0 (will spawn all requested agents)
|
|
713
|
+
currentAgents = 0;
|
|
714
|
+
}
|
|
715
|
+
const delta = targetAgents - currentAgents;
|
|
716
|
+
if (delta > 0) {
|
|
717
|
+
output.writeln(output.dim(` Spawning ${delta} new agents...`));
|
|
718
|
+
}
|
|
719
|
+
else if (delta < 0) {
|
|
720
|
+
output.writeln(output.dim(` Gracefully stopping ${-delta} agents...`));
|
|
721
|
+
}
|
|
722
|
+
else {
|
|
723
|
+
output.printInfo('Swarm already at target size');
|
|
724
|
+
return { success: true };
|
|
725
|
+
}
|
|
726
|
+
output.printSuccess(`Swarm scaled to ${targetAgents} agents`);
|
|
727
|
+
return { success: true, data: { swarmId, agents: targetAgents, delta } };
|
|
728
|
+
}
|
|
729
|
+
};
|
|
730
|
+
// Coordinate command (V3 specific)
|
|
731
|
+
const coordinateCommand = {
|
|
732
|
+
name: 'coordinate',
|
|
733
|
+
description: 'Execute V3 15-agent hierarchical mesh coordination',
|
|
734
|
+
options: [
|
|
735
|
+
{
|
|
736
|
+
name: 'agents',
|
|
737
|
+
description: 'Number of agents',
|
|
738
|
+
type: 'number',
|
|
739
|
+
default: 15
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
name: 'domains',
|
|
743
|
+
description: 'Domains to activate',
|
|
744
|
+
type: 'array'
|
|
745
|
+
}
|
|
746
|
+
],
|
|
747
|
+
action: async (ctx) => {
|
|
748
|
+
const agentCount = ctx.flags.agents || 15;
|
|
749
|
+
output.writeln();
|
|
750
|
+
output.writeln(output.bold('V3 15-Agent Hierarchical Mesh Coordination'));
|
|
751
|
+
output.writeln();
|
|
752
|
+
// V3 agent structure
|
|
753
|
+
const v3Agents = [
|
|
754
|
+
{ id: 1, role: 'Queen Coordinator', domain: 'Orchestration', status: 'primary' },
|
|
755
|
+
{ id: 2, role: 'Security Architect', domain: 'Security', status: 'active' },
|
|
756
|
+
{ id: 3, role: 'Security Auditor', domain: 'Security', status: 'active' },
|
|
757
|
+
{ id: 4, role: 'Test Architect', domain: 'Security', status: 'active' },
|
|
758
|
+
{ id: 5, role: 'Core Architect', domain: 'Core', status: 'active' },
|
|
759
|
+
{ id: 6, role: 'Memory Specialist', domain: 'Core', status: 'active' },
|
|
760
|
+
{ id: 7, role: 'Swarm Specialist', domain: 'Core', status: 'active' },
|
|
761
|
+
{ id: 8, role: 'Integration Architect', domain: 'Integration', status: 'active' },
|
|
762
|
+
{ id: 9, role: 'Performance Engineer', domain: 'Integration', status: 'active' },
|
|
763
|
+
{ id: 10, role: 'CLI Developer', domain: 'Integration', status: 'active' },
|
|
764
|
+
{ id: 11, role: 'Hooks Developer', domain: 'Integration', status: 'active' },
|
|
765
|
+
{ id: 12, role: 'MCP Specialist', domain: 'Integration', status: 'active' },
|
|
766
|
+
{ id: 13, role: 'Project Coordinator', domain: 'Management', status: 'active' },
|
|
767
|
+
{ id: 14, role: 'Documentation Lead', domain: 'Management', status: 'standby' },
|
|
768
|
+
{ id: 15, role: 'DevOps Engineer', domain: 'Management', status: 'standby' }
|
|
769
|
+
].slice(0, agentCount);
|
|
770
|
+
output.printTable({
|
|
771
|
+
columns: [
|
|
772
|
+
{ key: 'id', header: '#', width: 3, align: 'right' },
|
|
773
|
+
{ key: 'role', header: 'Role', width: 22 },
|
|
774
|
+
{ key: 'domain', header: 'Domain', width: 15 },
|
|
775
|
+
{ key: 'status', header: 'Status', width: 10, format: (v) => {
|
|
776
|
+
if (v === 'primary')
|
|
777
|
+
return output.highlight(String(v));
|
|
778
|
+
if (v === 'active')
|
|
779
|
+
return output.success(String(v));
|
|
780
|
+
return output.dim(String(v));
|
|
781
|
+
} }
|
|
782
|
+
],
|
|
783
|
+
data: v3Agents
|
|
784
|
+
});
|
|
785
|
+
// Actually initialize via MCP instead of just displaying (#1423)
|
|
786
|
+
output.writeln();
|
|
787
|
+
try {
|
|
788
|
+
await callMCPTool('swarm_init', {
|
|
789
|
+
topology: 'hierarchical-mesh',
|
|
790
|
+
maxAgents: agentCount,
|
|
791
|
+
strategy: 'specialized',
|
|
792
|
+
});
|
|
793
|
+
output.printSuccess(`Swarm coordination initialized with ${agentCount} agent slots via MCP`);
|
|
794
|
+
}
|
|
795
|
+
catch {
|
|
796
|
+
output.printWarning('MCP unavailable — showing agent plan only (no active coordination)');
|
|
797
|
+
}
|
|
798
|
+
output.writeln();
|
|
799
|
+
output.writeln(output.dim('Note: Use Claude Code Task tool or hive-mind spawn --claude to'));
|
|
800
|
+
output.writeln(output.dim('drive actual agent execution. This command sets up the topology.'));
|
|
801
|
+
return { success: true, data: { agents: v3Agents, count: agentCount } };
|
|
802
|
+
}
|
|
803
|
+
};
|
|
804
|
+
// Main swarm command
|
|
805
|
+
export const swarmCommand = {
|
|
806
|
+
name: 'swarm',
|
|
807
|
+
description: 'Swarm coordination commands',
|
|
808
|
+
subcommands: [initCommand, startCommand, statusCommand, stopCommand, scaleCommand, coordinateCommand],
|
|
809
|
+
options: [],
|
|
810
|
+
examples: [
|
|
811
|
+
{ command: 'claude-flow swarm init --v3-mode', description: 'Initialize V3 swarm' },
|
|
812
|
+
{ command: 'claude-flow swarm start -o "Build API" -s development', description: 'Start development swarm' },
|
|
813
|
+
{ command: 'claude-flow swarm coordinate --agents 15', description: 'V3 coordination' }
|
|
814
|
+
],
|
|
815
|
+
action: async (ctx) => {
|
|
816
|
+
output.writeln();
|
|
817
|
+
output.writeln(output.bold('Swarm Coordination Commands'));
|
|
818
|
+
output.writeln();
|
|
819
|
+
output.writeln('Usage: claude-flow swarm <subcommand> [options]');
|
|
820
|
+
output.writeln();
|
|
821
|
+
output.writeln('Subcommands:');
|
|
822
|
+
output.printList([
|
|
823
|
+
`${output.highlight('init')} - Initialize a new swarm`,
|
|
824
|
+
`${output.highlight('start')} - Start swarm execution`,
|
|
825
|
+
`${output.highlight('status')} - Show swarm status`,
|
|
826
|
+
`${output.highlight('stop')} - Stop swarm execution`,
|
|
827
|
+
`${output.highlight('scale')} - Scale swarm agent count`,
|
|
828
|
+
`${output.highlight('coordinate')} - V3 15-agent coordination`
|
|
829
|
+
]);
|
|
830
|
+
return { success: true };
|
|
831
|
+
}
|
|
832
|
+
};
|
|
833
|
+
// Helper function
|
|
834
|
+
function getAgentPlan(strategy) {
|
|
835
|
+
const plans = {
|
|
836
|
+
specialized: [
|
|
837
|
+
{ role: 'Coordinator', type: 'coordinator', count: 1, purpose: 'Central orchestration (anti-drift)' },
|
|
838
|
+
{ role: 'Researcher', type: 'researcher', count: 1, purpose: 'Requirements analysis' },
|
|
839
|
+
{ role: 'Architect', type: 'architect', count: 1, purpose: 'System design' },
|
|
840
|
+
{ role: 'Coder', type: 'coder', count: 2, purpose: 'Implementation' },
|
|
841
|
+
{ role: 'Tester', type: 'tester', count: 1, purpose: 'Quality assurance' },
|
|
842
|
+
{ role: 'Reviewer', type: 'reviewer', count: 1, purpose: 'Code review' }
|
|
843
|
+
],
|
|
844
|
+
balanced: [
|
|
845
|
+
{ role: 'Coordinator', type: 'coordinator', count: 1, purpose: 'Orchestrate workflow' },
|
|
846
|
+
{ role: 'Worker', type: 'coder', count: 4, purpose: 'General implementation' },
|
|
847
|
+
{ role: 'Reviewer', type: 'reviewer', count: 1, purpose: 'Quality review' }
|
|
848
|
+
],
|
|
849
|
+
adaptive: [
|
|
850
|
+
{ role: 'Coordinator', type: 'coordinator', count: 1, purpose: 'Dynamic orchestration' },
|
|
851
|
+
{ role: 'Scout', type: 'researcher', count: 1, purpose: 'Task analysis' },
|
|
852
|
+
{ role: 'Worker', type: 'coder', count: 3, purpose: 'Adaptive execution' }
|
|
853
|
+
],
|
|
854
|
+
development: [
|
|
855
|
+
{ role: 'Coordinator', type: 'coordinator', count: 1, purpose: 'Orchestrate workflow' },
|
|
856
|
+
{ role: 'Architect', type: 'architect', count: 1, purpose: 'System design' },
|
|
857
|
+
{ role: 'Coder', type: 'coder', count: 3, purpose: 'Implementation' },
|
|
858
|
+
{ role: 'Tester', type: 'tester', count: 2, purpose: 'Quality assurance' },
|
|
859
|
+
{ role: 'Reviewer', type: 'reviewer', count: 1, purpose: 'Code review' }
|
|
860
|
+
],
|
|
861
|
+
research: [
|
|
862
|
+
{ role: 'Coordinator', type: 'coordinator', count: 1, purpose: 'Research coordination' },
|
|
863
|
+
{ role: 'Researcher', type: 'researcher', count: 4, purpose: 'Data gathering' },
|
|
864
|
+
{ role: 'Analyst', type: 'analyst', count: 2, purpose: 'Analysis and synthesis' }
|
|
865
|
+
],
|
|
866
|
+
testing: [
|
|
867
|
+
{ role: 'Test Lead', type: 'tester', count: 1, purpose: 'Test strategy' },
|
|
868
|
+
{ role: 'Unit Tester', type: 'tester', count: 2, purpose: 'Unit tests' },
|
|
869
|
+
{ role: 'Integration Tester', type: 'tester', count: 2, purpose: 'Integration tests' },
|
|
870
|
+
{ role: 'QA Reviewer', type: 'reviewer', count: 1, purpose: 'Quality review' }
|
|
871
|
+
],
|
|
872
|
+
optimization: [
|
|
873
|
+
{ role: 'Performance Lead', type: 'optimizer', count: 1, purpose: 'Performance strategy' },
|
|
874
|
+
{ role: 'Profiler', type: 'analyst', count: 2, purpose: 'Profiling' },
|
|
875
|
+
{ role: 'Optimizer', type: 'coder', count: 2, purpose: 'Optimization' }
|
|
876
|
+
],
|
|
877
|
+
maintenance: [
|
|
878
|
+
{ role: 'Coordinator', type: 'coordinator', count: 1, purpose: 'Maintenance planning' },
|
|
879
|
+
{ role: 'Refactorer', type: 'coder', count: 2, purpose: 'Code cleanup' },
|
|
880
|
+
{ role: 'Documenter', type: 'researcher', count: 1, purpose: 'Documentation' }
|
|
881
|
+
],
|
|
882
|
+
analysis: [
|
|
883
|
+
{ role: 'Analyst Lead', type: 'analyst', count: 1, purpose: 'Analysis coordination' },
|
|
884
|
+
{ role: 'Code Analyst', type: 'analyst', count: 2, purpose: 'Code analysis' },
|
|
885
|
+
{ role: 'Security Analyst', type: 'reviewer', count: 1, purpose: 'Security review' }
|
|
886
|
+
]
|
|
887
|
+
};
|
|
888
|
+
return plans[strategy] || plans.development;
|
|
889
|
+
}
|
|
890
|
+
export default swarmCommand;
|
|
891
|
+
//# sourceMappingURL=swarm.js.map
|