agentic-flow 1.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/MIGRATION_SUMMARY.md +222 -0
- package/.claude/agents/README.md +89 -0
- package/.claude/agents/analysis/code-analyzer.md +209 -0
- package/.claude/agents/analysis/code-review/analyze-code-quality.md +180 -0
- package/.claude/agents/architecture/system-design/arch-system-design.md +156 -0
- package/.claude/agents/base-template-generator.md +42 -0
- package/.claude/agents/consensus/README.md +253 -0
- package/.claude/agents/consensus/byzantine-coordinator.md +63 -0
- package/.claude/agents/consensus/crdt-synchronizer.md +997 -0
- package/.claude/agents/consensus/gossip-coordinator.md +63 -0
- package/.claude/agents/consensus/performance-benchmarker.md +851 -0
- package/.claude/agents/consensus/quorum-manager.md +823 -0
- package/.claude/agents/consensus/raft-manager.md +63 -0
- package/.claude/agents/consensus/security-manager.md +622 -0
- package/.claude/agents/core/coder.md +211 -0
- package/.claude/agents/core/planner.md +116 -0
- package/.claude/agents/core/researcher.md +136 -0
- package/.claude/agents/core/reviewer.md +272 -0
- package/.claude/agents/core/tester.md +266 -0
- package/.claude/agents/data/ml/data-ml-model.md +193 -0
- package/.claude/agents/development/backend/dev-backend-api.md +142 -0
- package/.claude/agents/devops/ci-cd/ops-cicd-github.md +164 -0
- package/.claude/agents/documentation/api-docs/docs-api-openapi.md +174 -0
- package/.claude/agents/flow-nexus/app-store.md +88 -0
- package/.claude/agents/flow-nexus/authentication.md +69 -0
- package/.claude/agents/flow-nexus/challenges.md +81 -0
- package/.claude/agents/flow-nexus/neural-network.md +88 -0
- package/.claude/agents/flow-nexus/payments.md +83 -0
- package/.claude/agents/flow-nexus/sandbox.md +76 -0
- package/.claude/agents/flow-nexus/swarm.md +76 -0
- package/.claude/agents/flow-nexus/user-tools.md +96 -0
- package/.claude/agents/flow-nexus/workflow.md +84 -0
- package/.claude/agents/github/code-review-swarm.md +538 -0
- package/.claude/agents/github/github-modes.md +173 -0
- package/.claude/agents/github/issue-tracker.md +319 -0
- package/.claude/agents/github/multi-repo-swarm.md +553 -0
- package/.claude/agents/github/pr-manager.md +191 -0
- package/.claude/agents/github/project-board-sync.md +509 -0
- package/.claude/agents/github/release-manager.md +367 -0
- package/.claude/agents/github/release-swarm.md +583 -0
- package/.claude/agents/github/repo-architect.md +398 -0
- package/.claude/agents/github/swarm-issue.md +573 -0
- package/.claude/agents/github/swarm-pr.md +428 -0
- package/.claude/agents/github/sync-coordinator.md +452 -0
- package/.claude/agents/github/workflow-automation.md +635 -0
- package/.claude/agents/goal/agent.md +816 -0
- package/.claude/agents/goal/goal-planner.md +73 -0
- package/.claude/agents/optimization/README.md +250 -0
- package/.claude/agents/optimization/benchmark-suite.md +665 -0
- package/.claude/agents/optimization/load-balancer.md +431 -0
- package/.claude/agents/optimization/performance-monitor.md +672 -0
- package/.claude/agents/optimization/resource-allocator.md +674 -0
- package/.claude/agents/optimization/topology-optimizer.md +808 -0
- package/.claude/agents/payments/agentic-payments.md +126 -0
- package/.claude/agents/sparc/architecture.md +472 -0
- package/.claude/agents/sparc/pseudocode.md +318 -0
- package/.claude/agents/sparc/refinement.md +525 -0
- package/.claude/agents/sparc/specification.md +276 -0
- package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +226 -0
- package/.claude/agents/sublinear/consensus-coordinator.md +338 -0
- package/.claude/agents/sublinear/matrix-optimizer.md +185 -0
- package/.claude/agents/sublinear/pagerank-analyzer.md +299 -0
- package/.claude/agents/sublinear/performance-optimizer.md +368 -0
- package/.claude/agents/sublinear/trading-predictor.md +246 -0
- package/.claude/agents/swarm/README.md +190 -0
- package/.claude/agents/swarm/adaptive-coordinator.md +396 -0
- package/.claude/agents/swarm/hierarchical-coordinator.md +256 -0
- package/.claude/agents/swarm/mesh-coordinator.md +392 -0
- package/.claude/agents/templates/automation-smart-agent.md +205 -0
- package/.claude/agents/templates/coordinator-swarm-init.md +90 -0
- package/.claude/agents/templates/github-pr-manager.md +177 -0
- package/.claude/agents/templates/implementer-sparc-coder.md +259 -0
- package/.claude/agents/templates/memory-coordinator.md +187 -0
- package/.claude/agents/templates/migration-plan.md +746 -0
- package/.claude/agents/templates/orchestrator-task.md +139 -0
- package/.claude/agents/templates/performance-analyzer.md +199 -0
- package/.claude/agents/templates/sparc-coordinator.md +183 -0
- package/.claude/agents/test-neural.md +14 -0
- package/.claude/agents/testing/unit/tdd-london-swarm.md +244 -0
- package/.claude/agents/testing/validation/production-validator.md +395 -0
- package/.claude/commands/agents/README.md +10 -0
- package/.claude/commands/agents/agent-capabilities.md +21 -0
- package/.claude/commands/agents/agent-coordination.md +28 -0
- package/.claude/commands/agents/agent-spawning.md +28 -0
- package/.claude/commands/agents/agent-types.md +26 -0
- package/.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +54 -0
- package/.claude/commands/analysis/README.md +9 -0
- package/.claude/commands/analysis/bottleneck-detect.md +162 -0
- package/.claude/commands/analysis/performance-bottlenecks.md +59 -0
- package/.claude/commands/analysis/performance-report.md +25 -0
- package/.claude/commands/analysis/token-efficiency.md +45 -0
- package/.claude/commands/analysis/token-usage.md +25 -0
- package/.claude/commands/automation/README.md +9 -0
- package/.claude/commands/automation/auto-agent.md +122 -0
- package/.claude/commands/automation/self-healing.md +106 -0
- package/.claude/commands/automation/session-memory.md +90 -0
- package/.claude/commands/automation/smart-agents.md +73 -0
- package/.claude/commands/automation/smart-spawn.md +25 -0
- package/.claude/commands/automation/workflow-select.md +25 -0
- package/.claude/commands/claude-flow-help.md +103 -0
- package/.claude/commands/claude-flow-memory.md +107 -0
- package/.claude/commands/claude-flow-swarm.md +205 -0
- package/.claude/commands/coordination/README.md +9 -0
- package/.claude/commands/coordination/agent-spawn.md +25 -0
- package/.claude/commands/coordination/init.md +44 -0
- package/.claude/commands/coordination/orchestrate.md +43 -0
- package/.claude/commands/coordination/spawn.md +45 -0
- package/.claude/commands/coordination/swarm-init.md +85 -0
- package/.claude/commands/coordination/task-orchestrate.md +25 -0
- package/.claude/commands/flow-nexus/app-store.md +124 -0
- package/.claude/commands/flow-nexus/challenges.md +120 -0
- package/.claude/commands/flow-nexus/login-registration.md +65 -0
- package/.claude/commands/flow-nexus/neural-network.md +134 -0
- package/.claude/commands/flow-nexus/payments.md +116 -0
- package/.claude/commands/flow-nexus/sandbox.md +83 -0
- package/.claude/commands/flow-nexus/swarm.md +87 -0
- package/.claude/commands/flow-nexus/user-tools.md +152 -0
- package/.claude/commands/flow-nexus/workflow.md +115 -0
- package/.claude/commands/github/README.md +11 -0
- package/.claude/commands/github/code-review-swarm.md +514 -0
- package/.claude/commands/github/code-review.md +25 -0
- package/.claude/commands/github/github-modes.md +147 -0
- package/.claude/commands/github/github-swarm.md +121 -0
- package/.claude/commands/github/issue-tracker.md +292 -0
- package/.claude/commands/github/issue-triage.md +25 -0
- package/.claude/commands/github/multi-repo-swarm.md +519 -0
- package/.claude/commands/github/pr-enhance.md +26 -0
- package/.claude/commands/github/pr-manager.md +170 -0
- package/.claude/commands/github/project-board-sync.md +471 -0
- package/.claude/commands/github/release-manager.md +338 -0
- package/.claude/commands/github/release-swarm.md +544 -0
- package/.claude/commands/github/repo-analyze.md +25 -0
- package/.claude/commands/github/repo-architect.md +367 -0
- package/.claude/commands/github/swarm-issue.md +482 -0
- package/.claude/commands/github/swarm-pr.md +285 -0
- package/.claude/commands/github/sync-coordinator.md +301 -0
- package/.claude/commands/github/workflow-automation.md +442 -0
- package/.claude/commands/hive-mind/README.md +17 -0
- package/.claude/commands/hive-mind/hive-mind-consensus.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-init.md +18 -0
- package/.claude/commands/hive-mind/hive-mind-memory.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-metrics.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-resume.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-sessions.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-spawn.md +21 -0
- package/.claude/commands/hive-mind/hive-mind-status.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-stop.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-wizard.md +8 -0
- package/.claude/commands/hive-mind/hive-mind.md +27 -0
- package/.claude/commands/hooks/README.md +11 -0
- package/.claude/commands/hooks/overview.md +58 -0
- package/.claude/commands/hooks/post-edit.md +117 -0
- package/.claude/commands/hooks/post-task.md +112 -0
- package/.claude/commands/hooks/pre-edit.md +113 -0
- package/.claude/commands/hooks/pre-task.md +111 -0
- package/.claude/commands/hooks/session-end.md +118 -0
- package/.claude/commands/hooks/setup.md +103 -0
- package/.claude/commands/memory/README.md +9 -0
- package/.claude/commands/memory/memory-persist.md +25 -0
- package/.claude/commands/memory/memory-search.md +25 -0
- package/.claude/commands/memory/memory-usage.md +25 -0
- package/.claude/commands/memory/neural.md +47 -0
- package/.claude/commands/memory/usage.md +46 -0
- package/.claude/commands/monitoring/README.md +9 -0
- package/.claude/commands/monitoring/agent-metrics.md +25 -0
- package/.claude/commands/monitoring/agents.md +44 -0
- package/.claude/commands/monitoring/real-time-view.md +25 -0
- package/.claude/commands/monitoring/status.md +46 -0
- package/.claude/commands/monitoring/swarm-monitor.md +25 -0
- package/.claude/commands/optimization/README.md +9 -0
- package/.claude/commands/optimization/auto-topology.md +62 -0
- package/.claude/commands/optimization/cache-manage.md +25 -0
- package/.claude/commands/optimization/parallel-execute.md +25 -0
- package/.claude/commands/optimization/parallel-execution.md +50 -0
- package/.claude/commands/optimization/topology-optimize.md +25 -0
- package/.claude/commands/pair/README.md +261 -0
- package/.claude/commands/pair/commands.md +546 -0
- package/.claude/commands/pair/config.md +510 -0
- package/.claude/commands/pair/examples.md +512 -0
- package/.claude/commands/pair/modes.md +348 -0
- package/.claude/commands/pair/session.md +407 -0
- package/.claude/commands/pair/start.md +209 -0
- package/.claude/commands/sparc/analyzer.md +52 -0
- package/.claude/commands/sparc/architect.md +53 -0
- package/.claude/commands/sparc/ask.md +97 -0
- package/.claude/commands/sparc/batch-executor.md +54 -0
- package/.claude/commands/sparc/code.md +89 -0
- package/.claude/commands/sparc/coder.md +54 -0
- package/.claude/commands/sparc/debug.md +83 -0
- package/.claude/commands/sparc/debugger.md +54 -0
- package/.claude/commands/sparc/designer.md +53 -0
- package/.claude/commands/sparc/devops.md +109 -0
- package/.claude/commands/sparc/docs-writer.md +80 -0
- package/.claude/commands/sparc/documenter.md +54 -0
- package/.claude/commands/sparc/innovator.md +54 -0
- package/.claude/commands/sparc/integration.md +83 -0
- package/.claude/commands/sparc/mcp.md +117 -0
- package/.claude/commands/sparc/memory-manager.md +54 -0
- package/.claude/commands/sparc/optimizer.md +54 -0
- package/.claude/commands/sparc/orchestrator.md +132 -0
- package/.claude/commands/sparc/post-deployment-monitoring-mode.md +83 -0
- package/.claude/commands/sparc/refinement-optimization-mode.md +83 -0
- package/.claude/commands/sparc/researcher.md +54 -0
- package/.claude/commands/sparc/reviewer.md +54 -0
- package/.claude/commands/sparc/security-review.md +80 -0
- package/.claude/commands/sparc/sparc-modes.md +174 -0
- package/.claude/commands/sparc/sparc.md +111 -0
- package/.claude/commands/sparc/spec-pseudocode.md +80 -0
- package/.claude/commands/sparc/supabase-admin.md +348 -0
- package/.claude/commands/sparc/swarm-coordinator.md +54 -0
- package/.claude/commands/sparc/tdd.md +54 -0
- package/.claude/commands/sparc/tester.md +54 -0
- package/.claude/commands/sparc/tutorial.md +79 -0
- package/.claude/commands/sparc/workflow-manager.md +54 -0
- package/.claude/commands/sparc.md +166 -0
- package/.claude/commands/stream-chain/pipeline.md +121 -0
- package/.claude/commands/stream-chain/run.md +70 -0
- package/.claude/commands/swarm/README.md +15 -0
- package/.claude/commands/swarm/analysis.md +95 -0
- package/.claude/commands/swarm/development.md +96 -0
- package/.claude/commands/swarm/examples.md +168 -0
- package/.claude/commands/swarm/maintenance.md +102 -0
- package/.claude/commands/swarm/optimization.md +117 -0
- package/.claude/commands/swarm/research.md +136 -0
- package/.claude/commands/swarm/swarm-analysis.md +8 -0
- package/.claude/commands/swarm/swarm-background.md +8 -0
- package/.claude/commands/swarm/swarm-init.md +19 -0
- package/.claude/commands/swarm/swarm-modes.md +8 -0
- package/.claude/commands/swarm/swarm-monitor.md +8 -0
- package/.claude/commands/swarm/swarm-spawn.md +19 -0
- package/.claude/commands/swarm/swarm-status.md +8 -0
- package/.claude/commands/swarm/swarm-strategies.md +8 -0
- package/.claude/commands/swarm/swarm.md +27 -0
- package/.claude/commands/swarm/testing.md +131 -0
- package/.claude/commands/training/README.md +9 -0
- package/.claude/commands/training/model-update.md +25 -0
- package/.claude/commands/training/neural-patterns.md +74 -0
- package/.claude/commands/training/neural-train.md +25 -0
- package/.claude/commands/training/pattern-learn.md +25 -0
- package/.claude/commands/training/specialization.md +63 -0
- package/.claude/commands/truth/start.md +143 -0
- package/.claude/commands/verify/check.md +50 -0
- package/.claude/commands/verify/start.md +128 -0
- package/.claude/commands/workflows/README.md +9 -0
- package/.claude/commands/workflows/development.md +78 -0
- package/.claude/commands/workflows/research.md +63 -0
- package/.claude/commands/workflows/workflow-create.md +25 -0
- package/.claude/commands/workflows/workflow-execute.md +25 -0
- package/.claude/commands/workflows/workflow-export.md +25 -0
- package/.claude/helpers/checkpoint-manager.sh +251 -0
- package/.claude/helpers/github-safe.js +106 -0
- package/.claude/helpers/github-setup.sh +28 -0
- package/.claude/helpers/quick-start.sh +19 -0
- package/.claude/helpers/setup-mcp.sh +18 -0
- package/.claude/helpers/standard-checkpoint-hooks.sh +179 -0
- package/.claude/mcp.json +13 -0
- package/.claude/settings-backup.json +130 -0
- package/.claude/settings-optimized.json +116 -0
- package/.claude/settings-simple.json +78 -0
- package/.claude/settings.json +114 -0
- package/.claude/settings.local.json +14 -0
- package/README.md +1280 -0
- package/dist/agents/claudeAgent.js +73 -0
- package/dist/agents/claudeFlowAgent.js +115 -0
- package/dist/agents/codeReviewAgent.js +34 -0
- package/dist/agents/dataAgent.js +34 -0
- package/dist/agents/directApiAgent.js +260 -0
- package/dist/agents/webResearchAgent.js +35 -0
- package/dist/cli/mcp.js +135 -0
- package/dist/cli-proxy.js +246 -0
- package/dist/cli.js +158 -0
- package/dist/config/claudeFlow.js +67 -0
- package/dist/config/tools.js +33 -0
- package/dist/coordination/parallelSwarm.js +226 -0
- package/dist/examples/multi-agent-orchestration.js +45 -0
- package/dist/examples/parallel-swarm-deployment.js +171 -0
- package/dist/examples/use-goal-planner.js +52 -0
- package/dist/health.js +46 -0
- package/dist/index-with-proxy.js +101 -0
- package/dist/index.js +167 -0
- package/dist/mcp/claudeFlowSdkServer.js +202 -0
- package/dist/mcp/fastmcp/servers/claude-flow-sdk.js +198 -0
- package/dist/mcp/fastmcp/servers/http-streaming-updated.js +421 -0
- package/dist/mcp/fastmcp/servers/poc-stdio.js +82 -0
- package/dist/mcp/fastmcp/servers/stdio-full.js +421 -0
- package/dist/mcp/fastmcp/tools/agent/add-agent.js +107 -0
- package/dist/mcp/fastmcp/tools/agent/add-command.js +117 -0
- package/dist/mcp/fastmcp/tools/agent/execute.js +56 -0
- package/dist/mcp/fastmcp/tools/agent/list.js +82 -0
- package/dist/mcp/fastmcp/tools/agent/parallel.js +63 -0
- package/dist/mcp/fastmcp/tools/memory/retrieve.js +38 -0
- package/dist/mcp/fastmcp/tools/memory/search.js +41 -0
- package/dist/mcp/fastmcp/tools/memory/store.js +56 -0
- package/dist/mcp/fastmcp/tools/swarm/init.js +41 -0
- package/dist/mcp/fastmcp/tools/swarm/orchestrate.js +47 -0
- package/dist/mcp/fastmcp/tools/swarm/spawn.js +40 -0
- package/dist/mcp/fastmcp/types/index.js +2 -0
- package/dist/proxy/anthropic-to-openrouter.js +246 -0
- package/dist/router/providers/anthropic.js +89 -0
- package/dist/router/providers/onnx-local-optimized.js +167 -0
- package/dist/router/providers/onnx-local.js +294 -0
- package/dist/router/providers/onnx-phi4.js +190 -0
- package/dist/router/providers/onnx.js +242 -0
- package/dist/router/providers/openrouter.js +242 -0
- package/dist/router/router.js +283 -0
- package/dist/router/test-integration.js +140 -0
- package/dist/router/test-onnx-benchmark.js +145 -0
- package/dist/router/test-onnx-integration.js +128 -0
- package/dist/router/test-onnx-local.js +37 -0
- package/dist/router/test-onnx.js +148 -0
- package/dist/router/test-openrouter.js +121 -0
- package/dist/router/test-phi4.js +137 -0
- package/dist/router/types.js +2 -0
- package/dist/utils/agentLoader.js +106 -0
- package/dist/utils/cli.js +128 -0
- package/dist/utils/logger.js +41 -0
- package/dist/utils/mcpCommands.js +214 -0
- package/dist/utils/model-downloader.js +182 -0
- package/dist/utils/retry.js +54 -0
- package/docs/.claude-flow/metrics/agent-metrics.json +1 -0
- package/docs/.claude-flow/metrics/performance.json +9 -0
- package/docs/.claude-flow/metrics/task-metrics.json +10 -0
- package/docs/CHANGELOG.md +155 -0
- package/docs/CLAUDE.md +352 -0
- package/docs/COMPLETE_VALIDATION_SUMMARY.md +405 -0
- package/docs/INDEX.md +183 -0
- package/docs/LICENSE +21 -0
- package/docs/ONNX_CLI_USAGE.md +344 -0
- package/docs/ONNX_ENV_VARS.md +564 -0
- package/docs/ONNX_INTEGRATION.md +422 -0
- package/docs/ONNX_OPTIMIZATION_GUIDE.md +665 -0
- package/docs/ONNX_OPTIMIZATION_SUMMARY.md +374 -0
- package/docs/ONNX_VS_CLAUDE_QUALITY.md +442 -0
- package/docs/OPENROUTER_DEPLOYMENT.md +495 -0
- package/docs/architecture/EXECUTIVE_SUMMARY.md +310 -0
- package/docs/architecture/IMPROVEMENT_PLAN.md +11 -0
- package/docs/architecture/INTEGRATION-STATUS.md +290 -0
- package/docs/architecture/MULTI_MODEL_ROUTER_PLAN.md +620 -0
- package/docs/architecture/QUICK_WINS.md +333 -0
- package/docs/architecture/README.md +15 -0
- package/docs/architecture/RESEARCH_SUMMARY.md +652 -0
- package/docs/archived/FASTMCP_COMPLETE.md +428 -0
- package/docs/archived/FASTMCP_INTEGRATION_STATUS.md +288 -0
- package/docs/archived/FLOW-NEXUS-COMPLETE.md +269 -0
- package/docs/archived/INTEGRATION_CONFIRMED.md +351 -0
- package/docs/archived/ONNX_FINAL_REPORT.md +312 -0
- package/docs/archived/ONNX_IMPLEMENTATION_COMPLETE.md +215 -0
- package/docs/archived/ONNX_IMPLEMENTATION_SUMMARY.md +197 -0
- package/docs/archived/ONNX_SUCCESS_REPORT.md +271 -0
- package/docs/archived/OPENROUTER_PROXY_COMPLETE.md +494 -0
- package/docs/archived/PACKAGE-COMPLETE.md +138 -0
- package/docs/archived/README.md +27 -0
- package/docs/archived/RESEARCH_COMPLETE.txt +335 -0
- package/docs/archived/SDK-SETUP-COMPLETE.md +252 -0
- package/docs/guides/ALTERNATIVE_LLM_MODELS.md +524 -0
- package/docs/guides/DOCKER_AGENT_USAGE.md +352 -0
- package/docs/guides/IMPLEMENTATION_EXAMPLES.md +960 -0
- package/docs/guides/NPM-PUBLISH.md +218 -0
- package/docs/guides/README.md +17 -0
- package/docs/guides/agent-sdk.md +234 -0
- package/docs/integrations/CLAUDE_AGENTS_INTEGRATION.md +356 -0
- package/docs/integrations/CLAUDE_FLOW_INTEGRATION.md +535 -0
- package/docs/integrations/FASTMCP_CLI_INTEGRATION.md +503 -0
- package/docs/integrations/FLOW-NEXUS-INTEGRATION.md +319 -0
- package/docs/integrations/README.md +18 -0
- package/docs/integrations/fastmcp-implementation-plan.md +2516 -0
- package/docs/integrations/fastmcp-poc-integration.md +198 -0
- package/docs/router/ONNX_PHI4_RESEARCH.md +220 -0
- package/docs/router/ONNX_RUNTIME_INTEGRATION_PLAN.md +866 -0
- package/docs/router/PHI4_HYPEROPTIMIZATION_PLAN.md +2488 -0
- package/docs/router/README.md +552 -0
- package/docs/router/ROUTER_CONFIG_REFERENCE.md +577 -0
- package/docs/router/ROUTER_USER_GUIDE.md +865 -0
- package/docs/validation/DOCKER_MCP_VALIDATION.md +358 -0
- package/docs/validation/DOCKER_OPENROUTER_VALIDATION.md +443 -0
- package/docs/validation/FINAL_SYSTEM_VALIDATION.md +458 -0
- package/docs/validation/FINAL_VALIDATION_SUMMARY.md +409 -0
- package/docs/validation/MCP_CLI_TOOLS_VALIDATION.md +266 -0
- package/docs/validation/MODEL_VALIDATION_REPORT.md +386 -0
- package/docs/validation/OPENROUTER_VALIDATION_COMPLETE.md +382 -0
- package/docs/validation/README.md +20 -0
- package/docs/validation/ROUTER_VALIDATION.md +311 -0
- package/package.json +140 -0
package/dist/cli/mcp.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// MCP CLI commands for agentic-flow
|
|
3
|
+
import { spawn } from 'child_process';
|
|
4
|
+
import { resolve, dirname } from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = dirname(__filename);
|
|
8
|
+
// Start stdio MCP server (for Claude Desktop)
|
|
9
|
+
export async function startStdioServer(options = {}) {
|
|
10
|
+
console.log('🚀 Starting FastMCP stdio server...');
|
|
11
|
+
console.log('📦 Tools: memory_store, memory_retrieve, memory_search, swarm_init, agent_spawn, task_orchestrate\n');
|
|
12
|
+
const serverPath = resolve(__dirname, '../mcp/fastmcp/servers/stdio-full.js');
|
|
13
|
+
const proc = spawn('node', [serverPath], {
|
|
14
|
+
stdio: 'inherit',
|
|
15
|
+
env: {
|
|
16
|
+
...process.env,
|
|
17
|
+
DEBUG: options.debug ? 'fastmcp:*' : undefined
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
proc.on('exit', (code) => {
|
|
21
|
+
process.exit(code || 0);
|
|
22
|
+
});
|
|
23
|
+
// Handle termination signals
|
|
24
|
+
process.on('SIGINT', () => {
|
|
25
|
+
proc.kill('SIGINT');
|
|
26
|
+
});
|
|
27
|
+
process.on('SIGTERM', () => {
|
|
28
|
+
proc.kill('SIGTERM');
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
// Start HTTP + SSE server (for web/remote clients)
|
|
32
|
+
export async function startHttpServer(options = {}) {
|
|
33
|
+
const port = options.port || '3000';
|
|
34
|
+
console.log('🚀 Starting FastMCP HTTP + SSE server...');
|
|
35
|
+
console.log(`🌐 Port: ${port}`);
|
|
36
|
+
console.log('📡 SSE endpoint: /events');
|
|
37
|
+
console.log('🔧 MCP endpoint: /mcp');
|
|
38
|
+
console.log('❤️ Health check: /health');
|
|
39
|
+
console.log('📦 Tools: 11 (memory × 3, swarm × 3, agent × 5)\n');
|
|
40
|
+
const serverPath = resolve(__dirname, '../mcp/fastmcp/servers/http-streaming.js');
|
|
41
|
+
const proc = spawn('node', [serverPath], {
|
|
42
|
+
stdio: 'inherit',
|
|
43
|
+
env: {
|
|
44
|
+
...process.env,
|
|
45
|
+
PORT: port,
|
|
46
|
+
DEBUG: options.debug ? 'fastmcp:*' : undefined
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
proc.on('exit', (code) => {
|
|
50
|
+
process.exit(code || 0);
|
|
51
|
+
});
|
|
52
|
+
// Handle termination signals
|
|
53
|
+
process.on('SIGINT', () => {
|
|
54
|
+
proc.kill('SIGINT');
|
|
55
|
+
});
|
|
56
|
+
process.on('SIGTERM', () => {
|
|
57
|
+
proc.kill('SIGTERM');
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
// List available MCP tools
|
|
61
|
+
export function listTools() {
|
|
62
|
+
console.log('\n📦 Available MCP Tools (11 total)\n');
|
|
63
|
+
console.log('Memory Tools:');
|
|
64
|
+
console.log(' 1. memory_store - Store values with TTL and namespacing');
|
|
65
|
+
console.log(' 2. memory_retrieve - Retrieve stored values');
|
|
66
|
+
console.log(' 3. memory_search - Search keys with pattern matching\n');
|
|
67
|
+
console.log('Swarm Coordination Tools:');
|
|
68
|
+
console.log(' 4. swarm_init - Initialize multi-agent swarms');
|
|
69
|
+
console.log(' 5. agent_spawn - Spawn specialized agents');
|
|
70
|
+
console.log(' 6. task_orchestrate - Orchestrate distributed tasks\n');
|
|
71
|
+
console.log('Agent Execution Tools:');
|
|
72
|
+
console.log(' 7. agent_execute - Execute specific agent with task');
|
|
73
|
+
console.log(' 8. agent_parallel - Run 3 agents in parallel mode');
|
|
74
|
+
console.log(' 9. agent_list - List all available agents\n');
|
|
75
|
+
console.log('Custom Extension Tools:');
|
|
76
|
+
console.log(' 10. agent_add - Add new custom agent (markdown)');
|
|
77
|
+
console.log(' 11. command_add - Add new custom command (markdown)\n');
|
|
78
|
+
}
|
|
79
|
+
// Show server status
|
|
80
|
+
export function showStatus() {
|
|
81
|
+
console.log('\n🔍 FastMCP Server Status\n');
|
|
82
|
+
console.log('Available Transports:');
|
|
83
|
+
console.log(' ✅ stdio - JSON-RPC over stdio (for local MCP clients)');
|
|
84
|
+
console.log(' ✅ HTTP+SSE - HTTP with Server-Sent Events (for web/remote)\n');
|
|
85
|
+
console.log('Tools: 11/11 implemented');
|
|
86
|
+
console.log(' ✅ memory_store');
|
|
87
|
+
console.log(' ✅ memory_retrieve');
|
|
88
|
+
console.log(' ✅ memory_search');
|
|
89
|
+
console.log(' ✅ swarm_init');
|
|
90
|
+
console.log(' ✅ agent_spawn');
|
|
91
|
+
console.log(' ✅ task_orchestrate');
|
|
92
|
+
console.log(' ✅ agent_execute');
|
|
93
|
+
console.log(' ✅ agent_parallel');
|
|
94
|
+
console.log(' ✅ agent_list');
|
|
95
|
+
console.log(' ✅ agent_add');
|
|
96
|
+
console.log(' ✅ command_add\n');
|
|
97
|
+
console.log('Documentation:');
|
|
98
|
+
console.log(' 📖 Implementation: docs/fastmcp-implementation.md');
|
|
99
|
+
console.log(' 🚀 Quick Start: docs/fastmcp-quick-start.md');
|
|
100
|
+
console.log(' 🏗️ Architecture: docs/ARCHITECTURE.md\n');
|
|
101
|
+
}
|
|
102
|
+
// CLI handler
|
|
103
|
+
export function handleMCPCommand(command, options = {}) {
|
|
104
|
+
switch (command) {
|
|
105
|
+
case 'start':
|
|
106
|
+
case 'stdio':
|
|
107
|
+
return startStdioServer(options);
|
|
108
|
+
case 'http':
|
|
109
|
+
case 'sse':
|
|
110
|
+
return startHttpServer(options);
|
|
111
|
+
case 'tools':
|
|
112
|
+
return listTools();
|
|
113
|
+
case 'status':
|
|
114
|
+
return showStatus();
|
|
115
|
+
default:
|
|
116
|
+
console.error(`Unknown MCP command: ${command}`);
|
|
117
|
+
console.error('\nAvailable commands:');
|
|
118
|
+
console.error(' start, stdio - Start stdio MCP server');
|
|
119
|
+
console.error(' http, sse - Start HTTP + SSE server');
|
|
120
|
+
console.error(' tools - List available tools');
|
|
121
|
+
console.error(' status - Show server status\n');
|
|
122
|
+
process.exit(1);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// If run directly
|
|
126
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
127
|
+
const command = process.argv[2] || 'start';
|
|
128
|
+
const options = {
|
|
129
|
+
port: process.argv.includes('--port')
|
|
130
|
+
? process.argv[process.argv.indexOf('--port') + 1]
|
|
131
|
+
: undefined,
|
|
132
|
+
debug: process.argv.includes('--debug')
|
|
133
|
+
};
|
|
134
|
+
handleMCPCommand(command, options);
|
|
135
|
+
}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Agentic Flow - Standalone CLI with integrated OpenRouter proxy
|
|
4
|
+
* Usage: npx agentic-flow-proxy --agent coder --task "Create code" --openrouter
|
|
5
|
+
*/
|
|
6
|
+
import "dotenv/config";
|
|
7
|
+
import { AnthropicToOpenRouterProxy } from "./proxy/anthropic-to-openrouter.js";
|
|
8
|
+
import { logger } from "./utils/logger.js";
|
|
9
|
+
import { parseArgs } from "./utils/cli.js";
|
|
10
|
+
import { getAgent, listAgents } from "./utils/agentLoader.js";
|
|
11
|
+
import { claudeAgent } from "./agents/claudeAgent.js";
|
|
12
|
+
import { handleMCPCommand } from "./utils/mcpCommands.js";
|
|
13
|
+
class AgenticFlowCLI {
|
|
14
|
+
proxyServer = null;
|
|
15
|
+
proxyPort = 3000;
|
|
16
|
+
async start() {
|
|
17
|
+
const options = parseArgs();
|
|
18
|
+
if (options.help) {
|
|
19
|
+
this.printHelp();
|
|
20
|
+
process.exit(0);
|
|
21
|
+
}
|
|
22
|
+
if (options.mode === 'list') {
|
|
23
|
+
this.listAgents();
|
|
24
|
+
process.exit(0);
|
|
25
|
+
}
|
|
26
|
+
if (options.mode === 'mcp') {
|
|
27
|
+
await handleMCPCommand(options.mcpCommand || 'start', options.mcpServer || 'all');
|
|
28
|
+
process.exit(0);
|
|
29
|
+
}
|
|
30
|
+
// Determine if we should use OpenRouter
|
|
31
|
+
const useOpenRouter = this.shouldUseOpenRouter(options);
|
|
32
|
+
try {
|
|
33
|
+
// Start proxy if needed
|
|
34
|
+
if (useOpenRouter) {
|
|
35
|
+
await this.startProxy();
|
|
36
|
+
}
|
|
37
|
+
// Run agent
|
|
38
|
+
await this.runAgent(options, useOpenRouter);
|
|
39
|
+
logger.info('Execution completed successfully');
|
|
40
|
+
process.exit(0);
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
logger.error('Execution failed', { error: err });
|
|
44
|
+
console.error(err);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
shouldUseOpenRouter(options) {
|
|
49
|
+
// Don't use OpenRouter if ONNX is explicitly requested
|
|
50
|
+
if (options.provider === 'onnx' || process.env.USE_ONNX === 'true' || process.env.PROVIDER === 'onnx') {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
// Use OpenRouter if:
|
|
54
|
+
// 1. Provider is explicitly set to openrouter
|
|
55
|
+
// 2. Model parameter contains "/" (e.g., "meta-llama/llama-3.1-8b-instruct")
|
|
56
|
+
// 3. USE_OPENROUTER env var is set
|
|
57
|
+
// 4. OPENROUTER_API_KEY is set and ANTHROPIC_API_KEY is not
|
|
58
|
+
if (options.provider === 'openrouter' || process.env.PROVIDER === 'openrouter') {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
if (options.model?.includes('/')) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
if (process.env.USE_OPENROUTER === 'true') {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
if (process.env.OPENROUTER_API_KEY && !process.env.ANTHROPIC_API_KEY) {
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
async startProxy() {
|
|
73
|
+
const openrouterKey = process.env.OPENROUTER_API_KEY;
|
|
74
|
+
if (!openrouterKey) {
|
|
75
|
+
console.error('❌ Error: OPENROUTER_API_KEY required for OpenRouter models');
|
|
76
|
+
console.error('Set it in .env or export OPENROUTER_API_KEY=sk-or-v1-xxxxx');
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
logger.info('Starting integrated OpenRouter proxy');
|
|
80
|
+
const defaultModel = process.env.COMPLETION_MODEL ||
|
|
81
|
+
process.env.REASONING_MODEL ||
|
|
82
|
+
'meta-llama/llama-3.1-8b-instruct';
|
|
83
|
+
const proxy = new AnthropicToOpenRouterProxy({
|
|
84
|
+
openrouterApiKey: openrouterKey,
|
|
85
|
+
openrouterBaseUrl: process.env.ANTHROPIC_PROXY_BASE_URL,
|
|
86
|
+
defaultModel
|
|
87
|
+
});
|
|
88
|
+
// Start proxy in background
|
|
89
|
+
proxy.start(this.proxyPort);
|
|
90
|
+
this.proxyServer = proxy;
|
|
91
|
+
// Set ANTHROPIC_BASE_URL to proxy
|
|
92
|
+
process.env.ANTHROPIC_BASE_URL = `http://localhost:${this.proxyPort}`;
|
|
93
|
+
console.log(`🔗 Proxy Mode: OpenRouter`);
|
|
94
|
+
console.log(`🔧 Proxy URL: http://localhost:${this.proxyPort}`);
|
|
95
|
+
console.log(`🤖 Default Model: ${defaultModel}\n`);
|
|
96
|
+
// Wait for proxy to be ready
|
|
97
|
+
await new Promise(resolve => setTimeout(resolve, 1500));
|
|
98
|
+
}
|
|
99
|
+
async runAgent(options, useOpenRouter) {
|
|
100
|
+
const agentName = options.agent || process.env.AGENT || '';
|
|
101
|
+
const task = options.task || process.env.TASK || '';
|
|
102
|
+
if (!agentName) {
|
|
103
|
+
console.error('❌ Error: --agent required');
|
|
104
|
+
this.printHelp();
|
|
105
|
+
process.exit(1);
|
|
106
|
+
}
|
|
107
|
+
if (!task) {
|
|
108
|
+
console.error('❌ Error: --task required');
|
|
109
|
+
this.printHelp();
|
|
110
|
+
process.exit(1);
|
|
111
|
+
}
|
|
112
|
+
const agent = getAgent(agentName);
|
|
113
|
+
if (!agent) {
|
|
114
|
+
const available = listAgents();
|
|
115
|
+
console.error(`\n❌ Agent '${agentName}' not found.\n`);
|
|
116
|
+
console.error('Available agents:');
|
|
117
|
+
available.slice(0, 20).forEach(a => {
|
|
118
|
+
console.error(` • ${a.name}: ${a.description.substring(0, 80)}...`);
|
|
119
|
+
});
|
|
120
|
+
if (available.length > 20) {
|
|
121
|
+
console.error(` ... and ${available.length - 20} more (use --list to see all)`);
|
|
122
|
+
}
|
|
123
|
+
process.exit(1);
|
|
124
|
+
}
|
|
125
|
+
console.log(`\n🤖 Agent: ${agent.name}`);
|
|
126
|
+
console.log(`📝 Description: ${agent.description}\n`);
|
|
127
|
+
console.log(`🎯 Task: ${task}\n`);
|
|
128
|
+
if (useOpenRouter) {
|
|
129
|
+
const model = options.model || process.env.COMPLETION_MODEL || 'meta-llama/llama-3.1-8b-instruct';
|
|
130
|
+
console.log(`🔧 Provider: OpenRouter (via proxy)`);
|
|
131
|
+
console.log(`🔧 Model: ${model}\n`);
|
|
132
|
+
}
|
|
133
|
+
else if (options.provider === 'onnx' || process.env.USE_ONNX === 'true' || process.env.PROVIDER === 'onnx') {
|
|
134
|
+
console.log(`🔧 Provider: ONNX Local (Phi-4-mini)`);
|
|
135
|
+
console.log(`💾 Free local inference - no API costs`);
|
|
136
|
+
if (process.env.ONNX_OPTIMIZED === 'true') {
|
|
137
|
+
console.log(`⚡ Optimizations: Context pruning, prompt optimization`);
|
|
138
|
+
}
|
|
139
|
+
console.log('');
|
|
140
|
+
}
|
|
141
|
+
console.log('⏳ Running...\n');
|
|
142
|
+
const streamHandler = options.stream ? (chunk) => process.stdout.write(chunk) : undefined;
|
|
143
|
+
const modelOverride = useOpenRouter ? (options.model || process.env.COMPLETION_MODEL) : undefined;
|
|
144
|
+
const result = await claudeAgent(agent, task, streamHandler, modelOverride);
|
|
145
|
+
if (!options.stream) {
|
|
146
|
+
console.log('\n✅ Completed!\n');
|
|
147
|
+
console.log('═══════════════════════════════════════\n');
|
|
148
|
+
console.log(result.output);
|
|
149
|
+
console.log('\n═══════════════════════════════════════\n');
|
|
150
|
+
}
|
|
151
|
+
logger.info('Agent completed', {
|
|
152
|
+
agent: agentName,
|
|
153
|
+
outputLength: result.output.length,
|
|
154
|
+
provider: useOpenRouter ? 'openrouter' : 'anthropic'
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
listAgents() {
|
|
158
|
+
const agents = listAgents();
|
|
159
|
+
console.log(`\n📦 Available Agents (${agents.length} total)\n`);
|
|
160
|
+
const grouped = new Map();
|
|
161
|
+
agents.forEach(agent => {
|
|
162
|
+
const parts = agent.filePath.split('/');
|
|
163
|
+
const category = parts[parts.length - 2] || 'other';
|
|
164
|
+
if (!grouped.has(category)) {
|
|
165
|
+
grouped.set(category, []);
|
|
166
|
+
}
|
|
167
|
+
grouped.get(category).push(agent);
|
|
168
|
+
});
|
|
169
|
+
Array.from(grouped.entries())
|
|
170
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
171
|
+
.forEach(([category, categoryAgents]) => {
|
|
172
|
+
console.log(`\n${category.toUpperCase()}:`);
|
|
173
|
+
categoryAgents.forEach(agent => {
|
|
174
|
+
console.log(` ${agent.name.padEnd(30)} ${agent.description.substring(0, 80)}`);
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
console.log(`\nUsage:`);
|
|
178
|
+
console.log(` npx agentic-flow --agent <name> --task "Your task"\n`);
|
|
179
|
+
}
|
|
180
|
+
printHelp() {
|
|
181
|
+
console.log(`
|
|
182
|
+
🤖 Agentic Flow - AI Agent Orchestration with OpenRouter Support
|
|
183
|
+
|
|
184
|
+
USAGE:
|
|
185
|
+
npx agentic-flow [COMMAND] [OPTIONS]
|
|
186
|
+
|
|
187
|
+
COMMANDS:
|
|
188
|
+
mcp <command> [server] Manage MCP servers (start, stop, status, list)
|
|
189
|
+
--list, -l List all available agents
|
|
190
|
+
--agent, -a <name> Run specific agent mode
|
|
191
|
+
|
|
192
|
+
MCP COMMANDS:
|
|
193
|
+
npx agentic-flow mcp start [server] Start MCP server(s)
|
|
194
|
+
npx agentic-flow mcp stop [server] Stop MCP server(s)
|
|
195
|
+
npx agentic-flow mcp status [server] Check MCP server status
|
|
196
|
+
npx agentic-flow mcp list List all available MCP tools
|
|
197
|
+
|
|
198
|
+
Available servers: claude-flow, flow-nexus, agentic-payments, all (default)
|
|
199
|
+
|
|
200
|
+
OPTIONS:
|
|
201
|
+
--task, -t <task> Task description for agent mode
|
|
202
|
+
--model, -m <model> Model to use (triggers OpenRouter if contains "/")
|
|
203
|
+
--provider, -p <name> Provider to use (anthropic, openrouter, onnx)
|
|
204
|
+
--stream, -s Enable real-time streaming output
|
|
205
|
+
--help, -h Show this help message
|
|
206
|
+
|
|
207
|
+
EXAMPLES:
|
|
208
|
+
# MCP Server Management
|
|
209
|
+
npx agentic-flow mcp start # Start all MCP servers
|
|
210
|
+
npx agentic-flow mcp start claude-flow # Start specific server
|
|
211
|
+
npx agentic-flow mcp list # List all 203+ MCP tools
|
|
212
|
+
npx agentic-flow mcp status # Check server status
|
|
213
|
+
|
|
214
|
+
# Agent Execution
|
|
215
|
+
npx agentic-flow --list # List all 150+ agents
|
|
216
|
+
npx agentic-flow --agent coder --task "Create Python hello world"
|
|
217
|
+
npx agentic-flow --agent coder --task "Create REST API" --model "meta-llama/llama-3.1-8b-instruct"
|
|
218
|
+
npx agentic-flow --agent coder --task "Create code" --provider onnx
|
|
219
|
+
|
|
220
|
+
ENVIRONMENT VARIABLES:
|
|
221
|
+
ANTHROPIC_API_KEY Anthropic API key (for Claude models)
|
|
222
|
+
OPENROUTER_API_KEY OpenRouter API key (for alternative models)
|
|
223
|
+
USE_OPENROUTER Set to 'true' to force OpenRouter usage
|
|
224
|
+
COMPLETION_MODEL Default model for OpenRouter
|
|
225
|
+
AGENTS_DIR Path to agents directory
|
|
226
|
+
PROXY_PORT Proxy server port (default: 3000)
|
|
227
|
+
|
|
228
|
+
OPENROUTER MODELS:
|
|
229
|
+
- meta-llama/llama-3.1-8b-instruct (99% cost savings)
|
|
230
|
+
- deepseek/deepseek-chat-v3.1 (excellent for code)
|
|
231
|
+
- google/gemini-2.5-flash-preview (fastest)
|
|
232
|
+
- See https://openrouter.ai/models for full list
|
|
233
|
+
|
|
234
|
+
MCP TOOLS (203+ available):
|
|
235
|
+
• claude-flow-sdk: 6 in-process tools (memory, swarm coordination)
|
|
236
|
+
• claude-flow: 101 tools (neural networks, GitHub, workflows, DAA)
|
|
237
|
+
• flow-nexus: 96 cloud tools (sandboxes, distributed swarms, templates)
|
|
238
|
+
• agentic-payments: Payment authorization and multi-agent consensus
|
|
239
|
+
|
|
240
|
+
For more information: https://github.com/ruvnet/agentic-flow
|
|
241
|
+
`);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
// Run CLI
|
|
245
|
+
const cli = new AgenticFlowCLI();
|
|
246
|
+
cli.start();
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import "dotenv/config";
|
|
3
|
+
import { webResearchAgent } from "./agents/webResearchAgent.js";
|
|
4
|
+
import { codeReviewAgent } from "./agents/codeReviewAgent.js";
|
|
5
|
+
import { dataAgent } from "./agents/dataAgent.js";
|
|
6
|
+
import { claudeAgent } from "./agents/claudeAgent.js";
|
|
7
|
+
import { logger } from "./utils/logger.js";
|
|
8
|
+
import { startHealthServer } from "./health.js";
|
|
9
|
+
import { parseArgs, printHelp, validateOptions } from "./utils/cli.js";
|
|
10
|
+
import { getAgent, listAgents } from "./utils/agentLoader.js";
|
|
11
|
+
async function runParallelMode() {
|
|
12
|
+
const topic = process.env.TOPIC ?? "migrate payments service";
|
|
13
|
+
const codeDiff = process.env.DIFF ?? "feat: add payments router and mandate checks";
|
|
14
|
+
const datasetHint = process.env.DATASET ?? "monthly tx volume, refunds, chargebacks";
|
|
15
|
+
logger.info('Starting parallel agent execution', {
|
|
16
|
+
topic,
|
|
17
|
+
diff: codeDiff.substring(0, 50),
|
|
18
|
+
dataset: datasetHint
|
|
19
|
+
});
|
|
20
|
+
// Stream handler for real-time output
|
|
21
|
+
const streamHandler = (agent) => (chunk) => {
|
|
22
|
+
if (process.env.ENABLE_STREAMING === 'true') {
|
|
23
|
+
process.stdout.write(`[${agent}] ${chunk}`);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
// Each agent runs with its own context. Fan out in parallel.
|
|
27
|
+
const startTime = Date.now();
|
|
28
|
+
const [researchOut, reviewOut, dataOut] = await Promise.all([
|
|
29
|
+
webResearchAgent(`Give me context and risks about: ${topic}`, streamHandler('RESEARCH')),
|
|
30
|
+
codeReviewAgent(`Review this diff at a high level and propose tests:\n${codeDiff}`, streamHandler('CODE_REVIEW')),
|
|
31
|
+
dataAgent(`Analyze ${datasetHint} and report key stats.`, streamHandler('DATA'))
|
|
32
|
+
]);
|
|
33
|
+
const totalDuration = Date.now() - startTime;
|
|
34
|
+
logger.info('All agents completed', {
|
|
35
|
+
totalDuration,
|
|
36
|
+
agentCount: 3,
|
|
37
|
+
avgDuration: Math.round(totalDuration / 3)
|
|
38
|
+
});
|
|
39
|
+
// Basic reconcile step
|
|
40
|
+
const summary = [
|
|
41
|
+
"=== RESEARCH ===",
|
|
42
|
+
researchOut.output?.trim() ?? "",
|
|
43
|
+
"=== CODE REVIEW ===",
|
|
44
|
+
reviewOut.output?.trim() ?? "",
|
|
45
|
+
"=== DATA ===",
|
|
46
|
+
dataOut.output?.trim() ?? ""
|
|
47
|
+
].join("\n");
|
|
48
|
+
console.log(summary);
|
|
49
|
+
}
|
|
50
|
+
async function runAgentMode(agentName, task, stream) {
|
|
51
|
+
logger.info('Running agent mode', { agent: agentName, task: task.substring(0, 100) });
|
|
52
|
+
// Load the specified agent
|
|
53
|
+
const agent = getAgent(agentName);
|
|
54
|
+
if (!agent) {
|
|
55
|
+
const availableAgents = listAgents();
|
|
56
|
+
logger.error('Agent not found', { agent: agentName });
|
|
57
|
+
console.error(`\n❌ Agent '${agentName}' not found.\n`);
|
|
58
|
+
console.error('Available agents:');
|
|
59
|
+
availableAgents.slice(0, 20).forEach(a => {
|
|
60
|
+
console.error(` • ${a.name}: ${a.description.substring(0, 80)}...`);
|
|
61
|
+
});
|
|
62
|
+
if (availableAgents.length > 20) {
|
|
63
|
+
console.error(` ... and ${availableAgents.length - 20} more (use --list to see all)`);
|
|
64
|
+
}
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
console.log(`\n🤖 Agent: ${agent.name}`);
|
|
68
|
+
console.log(`📝 Description: ${agent.description}\n`);
|
|
69
|
+
console.log(`🎯 Task: ${task}\n`);
|
|
70
|
+
console.log('⏳ Running...\n');
|
|
71
|
+
const streamHandler = stream ? (chunk) => process.stdout.write(chunk) : undefined;
|
|
72
|
+
// Use Claude Agent SDK with in-SDK MCP server
|
|
73
|
+
logger.info('Using Claude Agent SDK with in-SDK MCP server');
|
|
74
|
+
const result = await claudeAgent(agent, task, streamHandler);
|
|
75
|
+
if (!stream) {
|
|
76
|
+
console.log('\n✅ Completed!\n');
|
|
77
|
+
console.log('═══════════════════════════════════════\n');
|
|
78
|
+
console.log(result.output);
|
|
79
|
+
console.log('\n═══════════════════════════════════════\n');
|
|
80
|
+
}
|
|
81
|
+
logger.info('Agent mode completed', { agent: agentName, outputLength: result.output.length });
|
|
82
|
+
}
|
|
83
|
+
function runListMode() {
|
|
84
|
+
const agents = listAgents();
|
|
85
|
+
console.log(`\n📦 Available Agents (${agents.length} total)\n`);
|
|
86
|
+
// Group by category (based on directory structure)
|
|
87
|
+
const grouped = new Map();
|
|
88
|
+
agents.forEach(agent => {
|
|
89
|
+
const parts = agent.filePath.split('/');
|
|
90
|
+
const category = parts[parts.length - 2] || 'other';
|
|
91
|
+
if (!grouped.has(category)) {
|
|
92
|
+
grouped.set(category, []);
|
|
93
|
+
}
|
|
94
|
+
grouped.get(category).push(agent);
|
|
95
|
+
});
|
|
96
|
+
// Print grouped
|
|
97
|
+
Array.from(grouped.entries())
|
|
98
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
99
|
+
.forEach(([category, categoryAgents]) => {
|
|
100
|
+
console.log(`\n${category.toUpperCase()}:`);
|
|
101
|
+
categoryAgents.forEach(agent => {
|
|
102
|
+
console.log(` ${agent.name.padEnd(30)} ${agent.description.substring(0, 80)}`);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
console.log(`\nTo use an agent:`);
|
|
106
|
+
console.log(` docker run --env-file .env claude-agents --agent <name> --task "Your task"\n`);
|
|
107
|
+
}
|
|
108
|
+
async function main() {
|
|
109
|
+
logger.setContext({ service: 'claude-agents', version: '1.0.0' });
|
|
110
|
+
// Parse CLI arguments
|
|
111
|
+
const options = parseArgs();
|
|
112
|
+
// Handle help
|
|
113
|
+
if (options.help) {
|
|
114
|
+
printHelp();
|
|
115
|
+
process.exit(0);
|
|
116
|
+
}
|
|
117
|
+
// Handle list mode
|
|
118
|
+
if (options.mode === 'list') {
|
|
119
|
+
runListMode();
|
|
120
|
+
process.exit(0);
|
|
121
|
+
}
|
|
122
|
+
// Validate options
|
|
123
|
+
const validationError = validateOptions(options);
|
|
124
|
+
if (validationError) {
|
|
125
|
+
console.error(`\n❌ ${validationError}\n`);
|
|
126
|
+
printHelp();
|
|
127
|
+
process.exit(1);
|
|
128
|
+
}
|
|
129
|
+
logger.info('Starting Claude Agent SDK', { mode: options.mode });
|
|
130
|
+
// Start health check server
|
|
131
|
+
const healthPort = parseInt(process.env.HEALTH_PORT || '8080');
|
|
132
|
+
const healthServer = startHealthServer(healthPort);
|
|
133
|
+
try {
|
|
134
|
+
if (options.mode === 'agent') {
|
|
135
|
+
const task = options.task || process.env.TASK || '';
|
|
136
|
+
const agent = options.agent || process.env.AGENT || '';
|
|
137
|
+
await runAgentMode(agent, task, options.stream || false);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
await runParallelMode();
|
|
141
|
+
}
|
|
142
|
+
logger.info('Execution completed successfully');
|
|
143
|
+
}
|
|
144
|
+
catch (err) {
|
|
145
|
+
logger.error('Execution failed', { error: err });
|
|
146
|
+
throw err;
|
|
147
|
+
}
|
|
148
|
+
finally {
|
|
149
|
+
// Keep health server running for container health checks
|
|
150
|
+
if (process.env.KEEP_ALIVE !== 'true') {
|
|
151
|
+
healthServer.close();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
main().catch(err => {
|
|
156
|
+
console.error(err);
|
|
157
|
+
process.exit(1);
|
|
158
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Claude Flow integration configuration
|
|
2
|
+
import { logger } from '../utils/logger.js';
|
|
3
|
+
export const defaultClaudeFlowConfig = {
|
|
4
|
+
enableMemory: true,
|
|
5
|
+
enableCoordination: true,
|
|
6
|
+
enableSwarm: true,
|
|
7
|
+
memoryNamespace: 'claude-agents',
|
|
8
|
+
coordinationTopology: 'mesh'
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Initialize claude-flow MCP tools for agent use
|
|
12
|
+
*/
|
|
13
|
+
export function getClaudeFlowTools(config = defaultClaudeFlowConfig) {
|
|
14
|
+
const tools = [];
|
|
15
|
+
if (config.enableMemory) {
|
|
16
|
+
tools.push('mcp__claude-flow__memory_usage', 'mcp__claude-flow__memory_search', 'mcp__claude-flow__memory_persist', 'mcp__claude-flow__memory_namespace');
|
|
17
|
+
logger.info('Claude Flow memory tools enabled', { namespace: config.memoryNamespace });
|
|
18
|
+
}
|
|
19
|
+
if (config.enableCoordination) {
|
|
20
|
+
tools.push('mcp__claude-flow__swarm_init', 'mcp__claude-flow__agent_spawn', 'mcp__claude-flow__task_orchestrate', 'mcp__claude-flow__swarm_status', 'mcp__claude-flow__coordination_sync');
|
|
21
|
+
logger.info('Claude Flow coordination tools enabled', { topology: config.coordinationTopology });
|
|
22
|
+
}
|
|
23
|
+
if (config.enableSwarm) {
|
|
24
|
+
tools.push('mcp__claude-flow__swarm_scale', 'mcp__claude-flow__load_balance', 'mcp__claude-flow__agent_metrics', 'mcp__claude-flow__swarm_monitor');
|
|
25
|
+
logger.info('Claude Flow swarm tools enabled');
|
|
26
|
+
}
|
|
27
|
+
return tools;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Check if claude-flow MCP is available
|
|
31
|
+
*/
|
|
32
|
+
export async function isClaudeFlowAvailable() {
|
|
33
|
+
try {
|
|
34
|
+
// Check if claude-flow is installed
|
|
35
|
+
const { execSync } = await import('child_process');
|
|
36
|
+
execSync('npx claude-flow@alpha --version', { stdio: 'ignore' });
|
|
37
|
+
logger.info('Claude Flow detected and available');
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
logger.warn('Claude Flow not available', { error });
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Initialize memory namespace for agent session
|
|
47
|
+
*/
|
|
48
|
+
export function getMemoryConfig(agentName) {
|
|
49
|
+
const namespace = agentName
|
|
50
|
+
? `claude-agents:${agentName}`
|
|
51
|
+
: 'claude-agents:default';
|
|
52
|
+
return {
|
|
53
|
+
namespace,
|
|
54
|
+
ttl: 3600, // 1 hour default TTL
|
|
55
|
+
action: 'store'
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Initialize swarm coordination for multi-agent tasks
|
|
60
|
+
*/
|
|
61
|
+
export function getSwarmConfig(topology = 'mesh') {
|
|
62
|
+
return {
|
|
63
|
+
topology,
|
|
64
|
+
maxAgents: 8,
|
|
65
|
+
strategy: 'balanced'
|
|
66
|
+
};
|
|
67
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Tool configuration for Claude Agent SDK
|
|
2
|
+
import { getClaudeFlowTools, defaultClaudeFlowConfig } from './claudeFlow.js';
|
|
3
|
+
export const enabledTools = [
|
|
4
|
+
'Read',
|
|
5
|
+
'Write',
|
|
6
|
+
'Edit',
|
|
7
|
+
'Bash',
|
|
8
|
+
'Glob',
|
|
9
|
+
'Grep',
|
|
10
|
+
'WebFetch',
|
|
11
|
+
'WebSearch'
|
|
12
|
+
];
|
|
13
|
+
// Get claude-flow tools dynamically
|
|
14
|
+
const claudeFlowTools = getClaudeFlowTools(defaultClaudeFlowConfig);
|
|
15
|
+
export const toolConfig = {
|
|
16
|
+
// Enable all standard tools for full capability
|
|
17
|
+
enableAllTools: true,
|
|
18
|
+
// MCP servers configuration
|
|
19
|
+
mcpServers: {
|
|
20
|
+
'claude-flow': {
|
|
21
|
+
command: 'npx',
|
|
22
|
+
args: ['claude-flow@alpha', 'mcp', 'start'],
|
|
23
|
+
env: {
|
|
24
|
+
CLAUDE_FLOW_MEMORY_ENABLED: 'true',
|
|
25
|
+
CLAUDE_FLOW_COORDINATION_ENABLED: 'true'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
// Permission mode
|
|
30
|
+
permissionMode: 'default',
|
|
31
|
+
// Additional enabled tools from claude-flow
|
|
32
|
+
additionalTools: claudeFlowTools
|
|
33
|
+
};
|