@claude-flow/cli 3.0.2 → 3.1.0-alpha.2
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/analysis/analyze-code-quality.md +179 -0
- package/.claude/agents/analysis/code-analyzer.md +210 -0
- package/.claude/agents/analysis/code-review/analyze-code-quality.md +179 -0
- package/.claude/agents/architecture/arch-system-design.md +157 -0
- package/.claude/agents/architecture/system-design/arch-system-design.md +155 -0
- package/.claude/agents/browser/browser-agent.yaml +182 -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 +453 -0
- package/.claude/agents/core/planner.md +375 -0
- package/.claude/agents/core/researcher.md +369 -0
- package/.claude/agents/core/reviewer.md +520 -0
- package/.claude/agents/core/tester.md +512 -0
- package/.claude/agents/custom/test-long-runner.md +44 -0
- package/.claude/agents/data/data-ml-model.md +445 -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/development/dev-backend-api.md +345 -0
- package/.claude/agents/devops/ci-cd/ops-cicd-github.md +164 -0
- package/.claude/agents/devops/ops-cicd-github.md +165 -0
- package/.claude/agents/documentation/api-docs/docs-api-openapi.md +174 -0
- package/.claude/agents/documentation/docs-api-openapi.md +355 -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 +377 -0
- package/.claude/agents/github/github-modes.md +173 -0
- package/.claude/agents/github/issue-tracker.md +576 -0
- package/.claude/agents/github/multi-repo-swarm.md +553 -0
- package/.claude/agents/github/pr-manager.md +438 -0
- package/.claude/agents/github/project-board-sync.md +509 -0
- package/.claude/agents/github/release-manager.md +605 -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 +903 -0
- package/.claude/agents/goal/agent.md +816 -0
- package/.claude/agents/goal/goal-planner.md +73 -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/sona/sona-learning-optimizer.md +74 -0
- package/.claude/agents/sparc/architecture.md +699 -0
- package/.claude/agents/sparc/pseudocode.md +520 -0
- package/.claude/agents/sparc/refinement.md +802 -0
- package/.claude/agents/sparc/specification.md +478 -0
- package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +225 -0
- package/.claude/agents/specialized/spec-mobile-react-native.md +227 -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/adaptive-coordinator.md +1127 -0
- package/.claude/agents/swarm/hierarchical-coordinator.md +710 -0
- package/.claude/agents/swarm/mesh-coordinator.md +963 -0
- package/.claude/agents/templates/automation-smart-agent.md +205 -0
- package/.claude/agents/templates/base-template-generator.md +268 -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/orchestrator-task.md +139 -0
- package/.claude/agents/templates/performance-analyzer.md +199 -0
- package/.claude/agents/templates/sparc-coordinator.md +514 -0
- package/.claude/agents/testing/production-validator.md +395 -0
- package/.claude/agents/testing/tdd-london-swarm.md +244 -0
- package/.claude/agents/v3/adr-architect.md +184 -0
- package/.claude/agents/v3/aidefence-guardian.md +282 -0
- package/.claude/agents/v3/claims-authorizer.md +208 -0
- package/.claude/agents/v3/collective-intelligence-coordinator.md +993 -0
- package/.claude/agents/v3/ddd-domain-expert.md +220 -0
- package/.claude/agents/v3/injection-analyst.md +236 -0
- package/.claude/agents/v3/memory-specialist.md +995 -0
- package/.claude/agents/v3/performance-engineer.md +1233 -0
- package/.claude/agents/v3/pii-detector.md +151 -0
- package/.claude/agents/v3/reasoningbank-learner.md +213 -0
- package/.claude/agents/v3/security-architect-aidefence.md +410 -0
- package/.claude/agents/v3/security-architect.md +867 -0
- package/.claude/agents/v3/security-auditor.md +771 -0
- package/.claude/agents/v3/sparc-orchestrator.md +182 -0
- package/.claude/agents/v3/swarm-memory-manager.md +157 -0
- package/.claude/agents/v3/v3-integration-architect.md +205 -0
- package/.claude/commands/agents/README.md +50 -0
- package/.claude/commands/agents/agent-capabilities.md +140 -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 +216 -0
- package/.claude/commands/agents/health.md +139 -0
- package/.claude/commands/agents/list.md +100 -0
- package/.claude/commands/agents/logs.md +130 -0
- package/.claude/commands/agents/metrics.md +122 -0
- package/.claude/commands/agents/pool.md +127 -0
- package/.claude/commands/agents/spawn.md +140 -0
- package/.claude/commands/agents/status.md +115 -0
- package/.claude/commands/agents/stop.md +102 -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/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 +87 -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 +108 -0
- package/.claude/commands/training/neural-train.md +75 -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/README.md +97 -0
- package/.claude/helpers/adr-compliance.sh +186 -0
- package/.claude/helpers/auto-commit.sh +178 -0
- package/.claude/helpers/checkpoint-manager.sh +251 -0
- package/.claude/helpers/daemon-manager.sh +252 -0
- package/.claude/helpers/ddd-tracker.sh +144 -0
- package/.claude/helpers/github-safe.js +106 -0
- package/.claude/helpers/github-setup.sh +28 -0
- package/.claude/helpers/guidance-hook.sh +13 -0
- package/.claude/helpers/guidance-hooks.sh +102 -0
- package/.claude/helpers/health-monitor.sh +108 -0
- package/.claude/helpers/learning-hooks.sh +329 -0
- package/.claude/helpers/learning-optimizer.sh +127 -0
- package/.claude/helpers/learning-service.mjs +1144 -0
- package/.claude/helpers/memory.js +83 -0
- package/.claude/helpers/metrics-db.mjs +488 -0
- package/.claude/helpers/pattern-consolidator.sh +86 -0
- package/.claude/helpers/perf-worker.sh +160 -0
- package/.claude/helpers/post-commit +16 -0
- package/.claude/helpers/pre-commit +26 -0
- package/.claude/helpers/quick-start.sh +19 -0
- package/.claude/helpers/router.js +66 -0
- package/.claude/helpers/security-scanner.sh +127 -0
- package/.claude/helpers/session.js +127 -0
- package/.claude/helpers/setup-mcp.sh +18 -0
- package/.claude/helpers/standard-checkpoint-hooks.sh +189 -0
- package/.claude/helpers/statusline-hook.sh +21 -0
- package/.claude/helpers/statusline.cjs +509 -0
- package/.claude/helpers/statusline.js +316 -0
- package/.claude/helpers/swarm-comms.sh +353 -0
- package/.claude/helpers/swarm-hooks.sh +761 -0
- package/.claude/helpers/swarm-monitor.sh +211 -0
- package/.claude/helpers/sync-v3-metrics.sh +245 -0
- package/.claude/helpers/update-v3-progress.sh +166 -0
- package/.claude/helpers/v3-quick-status.sh +58 -0
- package/.claude/helpers/v3.sh +111 -0
- package/.claude/helpers/validate-v3-config.sh +216 -0
- package/.claude/helpers/worker-manager.sh +170 -0
- package/.claude/settings.json +237 -0
- package/.claude/skills/agentdb-advanced/SKILL.md +550 -0
- package/.claude/skills/agentdb-learning/SKILL.md +545 -0
- package/.claude/skills/agentdb-memory-patterns/SKILL.md +339 -0
- package/.claude/skills/agentdb-optimization/SKILL.md +509 -0
- package/.claude/skills/agentdb-vector-search/SKILL.md +339 -0
- package/.claude/skills/agentic-jujutsu/SKILL.md +645 -0
- package/.claude/skills/aidefence-scan.md +151 -0
- package/.claude/skills/aidefence.yaml +297 -0
- package/.claude/skills/browser/SKILL.md +204 -0
- package/.claude/skills/flow-nexus-neural/SKILL.md +738 -0
- package/.claude/skills/flow-nexus-platform/SKILL.md +1157 -0
- package/.claude/skills/flow-nexus-swarm/SKILL.md +610 -0
- package/.claude/skills/github-code-review/SKILL.md +1140 -0
- package/.claude/skills/github-multi-repo/SKILL.md +874 -0
- package/.claude/skills/github-project-management/SKILL.md +1277 -0
- package/.claude/skills/github-release-management/SKILL.md +1081 -0
- package/.claude/skills/github-workflow-automation/SKILL.md +1065 -0
- package/.claude/skills/hive-mind-advanced/SKILL.md +712 -0
- package/.claude/skills/hooks-automation/SKILL.md +1201 -0
- package/.claude/skills/pair-programming/SKILL.md +1202 -0
- package/.claude/skills/performance-analysis/SKILL.md +563 -0
- package/.claude/skills/reasoningbank-agentdb/SKILL.md +446 -0
- package/.claude/skills/reasoningbank-intelligence/SKILL.md +201 -0
- package/.claude/skills/secure-review.md +181 -0
- package/{.claude-flow → .claude/skills/skill-builder/.claude-flow}/metrics/performance.json +3 -3
- package/.claude/skills/skill-builder/.claude-flow/metrics/task-metrics.json +10 -0
- package/.claude/skills/skill-builder/SKILL.md +910 -0
- package/.claude/skills/sparc-methodology/SKILL.md +1115 -0
- package/.claude/skills/stream-chain/SKILL.md +563 -0
- package/.claude/skills/swarm-advanced/SKILL.md +973 -0
- package/.claude/skills/swarm-orchestration/SKILL.md +179 -0
- package/.claude/skills/v3-cli-modernization/SKILL.md +872 -0
- package/.claude/skills/v3-core-implementation/SKILL.md +797 -0
- package/.claude/skills/v3-ddd-architecture/SKILL.md +442 -0
- package/.claude/skills/v3-integration-deep/SKILL.md +241 -0
- package/.claude/skills/v3-mcp-optimization/SKILL.md +777 -0
- package/.claude/skills/v3-memory-unification/SKILL.md +174 -0
- package/.claude/skills/v3-performance-optimization/SKILL.md +390 -0
- package/.claude/skills/v3-security-overhaul/SKILL.md +82 -0
- package/.claude/skills/v3-swarm-coordination/SKILL.md +340 -0
- package/.claude/skills/verification-quality/SKILL.md +649 -0
- package/.claude/skills/worker-benchmarks/skill.md +135 -0
- package/.claude/skills/worker-integration/skill.md +154 -0
- package/README.md +6512 -850
- package/bin/cli.js +144 -6
- package/bin/mcp-server.js +189 -0
- package/dist/src/benchmarks/pretrain/index.d.ts +58 -0
- package/dist/src/benchmarks/pretrain/index.d.ts.map +1 -0
- package/dist/src/benchmarks/pretrain/index.js +404 -0
- package/dist/src/benchmarks/pretrain/index.js.map +1 -0
- package/dist/src/commands/agent.d.ts.map +1 -1
- package/dist/src/commands/agent.js +49 -33
- package/dist/src/commands/agent.js.map +1 -1
- package/dist/src/commands/analyze.d.ts +19 -0
- package/dist/src/commands/analyze.d.ts.map +1 -0
- package/dist/src/commands/analyze.js +1823 -0
- package/dist/src/commands/analyze.js.map +1 -0
- package/dist/src/commands/benchmark.d.ts +10 -0
- package/dist/src/commands/benchmark.d.ts.map +1 -0
- package/dist/src/commands/benchmark.js +459 -0
- package/dist/src/commands/benchmark.js.map +1 -0
- package/dist/src/commands/categories.d.ts +75 -0
- package/dist/src/commands/categories.d.ts.map +1 -0
- package/dist/src/commands/categories.js +178 -0
- package/dist/src/commands/categories.js.map +1 -0
- package/dist/src/commands/claims.d.ts +10 -0
- package/dist/src/commands/claims.d.ts.map +1 -0
- package/dist/src/commands/claims.js +373 -0
- package/dist/src/commands/claims.js.map +1 -0
- package/dist/src/commands/completions.d.ts +10 -0
- package/dist/src/commands/completions.d.ts.map +1 -0
- package/dist/src/commands/completions.js +539 -0
- package/dist/src/commands/completions.js.map +1 -0
- package/dist/src/commands/config.js +1 -1
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/daemon.d.ts +8 -0
- package/dist/src/commands/daemon.d.ts.map +1 -0
- package/dist/src/commands/daemon.js +593 -0
- package/dist/src/commands/daemon.js.map +1 -0
- package/dist/src/commands/deployment.d.ts +10 -0
- package/dist/src/commands/deployment.d.ts.map +1 -0
- package/dist/src/commands/deployment.js +289 -0
- package/dist/src/commands/deployment.js.map +1 -0
- package/dist/src/commands/doctor.d.ts +10 -0
- package/dist/src/commands/doctor.d.ts.map +1 -0
- package/dist/src/commands/doctor.js +571 -0
- package/dist/src/commands/doctor.js.map +1 -0
- package/dist/src/commands/embeddings.d.ts +18 -0
- package/dist/src/commands/embeddings.d.ts.map +1 -0
- package/dist/src/commands/embeddings.js +1576 -0
- package/dist/src/commands/embeddings.js.map +1 -0
- package/dist/src/commands/guidance.d.ts +8 -0
- package/dist/src/commands/guidance.d.ts.map +1 -0
- package/dist/src/commands/guidance.js +560 -0
- package/dist/src/commands/guidance.js.map +1 -0
- package/dist/src/commands/hive-mind.d.ts +3 -0
- package/dist/src/commands/hive-mind.d.ts.map +1 -1
- package/dist/src/commands/hive-mind.js +673 -70
- package/dist/src/commands/hive-mind.js.map +1 -1
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +1503 -52
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/index.d.ts +70 -13
- package/dist/src/commands/index.d.ts.map +1 -1
- package/dist/src/commands/index.js +287 -33
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +259 -13
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/issues.d.ts +21 -0
- package/dist/src/commands/issues.d.ts.map +1 -0
- package/dist/src/commands/issues.js +567 -0
- package/dist/src/commands/issues.js.map +1 -0
- package/dist/src/commands/mcp.d.ts.map +1 -1
- package/dist/src/commands/mcp.js +75 -37
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/memory.d.ts.map +1 -1
- package/dist/src/commands/memory.js +355 -74
- package/dist/src/commands/memory.js.map +1 -1
- package/dist/src/commands/migrate.d.ts.map +1 -1
- package/dist/src/commands/migrate.js +15 -3
- package/dist/src/commands/migrate.js.map +1 -1
- package/dist/src/commands/neural.d.ts +10 -0
- package/dist/src/commands/neural.d.ts.map +1 -0
- package/dist/src/commands/neural.js +1448 -0
- package/dist/src/commands/neural.js.map +1 -0
- package/dist/src/commands/performance.d.ts +10 -0
- package/dist/src/commands/performance.d.ts.map +1 -0
- package/dist/src/commands/performance.js +579 -0
- package/dist/src/commands/performance.js.map +1 -0
- package/dist/src/commands/plugins.d.ts +11 -0
- package/dist/src/commands/plugins.d.ts.map +1 -0
- package/dist/src/commands/plugins.js +820 -0
- package/dist/src/commands/plugins.js.map +1 -0
- package/dist/src/commands/progress.d.ts +11 -0
- package/dist/src/commands/progress.d.ts.map +1 -0
- package/dist/src/commands/progress.js +259 -0
- package/dist/src/commands/progress.js.map +1 -0
- package/dist/src/commands/providers.d.ts +10 -0
- package/dist/src/commands/providers.d.ts.map +1 -0
- package/dist/src/commands/providers.js +232 -0
- package/dist/src/commands/providers.js.map +1 -0
- package/dist/src/commands/route.d.ts +16 -0
- package/dist/src/commands/route.d.ts.map +1 -0
- package/dist/src/commands/route.js +813 -0
- package/dist/src/commands/route.js.map +1 -0
- package/dist/src/commands/ruvector/backup.d.ts +11 -0
- package/dist/src/commands/ruvector/backup.d.ts.map +1 -0
- package/dist/src/commands/ruvector/backup.js +746 -0
- package/dist/src/commands/ruvector/backup.js.map +1 -0
- package/dist/src/commands/ruvector/benchmark.d.ts +11 -0
- package/dist/src/commands/ruvector/benchmark.d.ts.map +1 -0
- package/dist/src/commands/ruvector/benchmark.js +480 -0
- package/dist/src/commands/ruvector/benchmark.js.map +1 -0
- package/dist/src/commands/ruvector/import.d.ts +18 -0
- package/dist/src/commands/ruvector/import.d.ts.map +1 -0
- package/dist/src/commands/ruvector/import.js +349 -0
- package/dist/src/commands/ruvector/import.js.map +1 -0
- package/dist/src/commands/ruvector/index.d.ts +29 -0
- package/dist/src/commands/ruvector/index.d.ts.map +1 -0
- package/dist/src/commands/ruvector/index.js +129 -0
- package/dist/src/commands/ruvector/index.js.map +1 -0
- package/dist/src/commands/ruvector/init.d.ts +11 -0
- package/dist/src/commands/ruvector/init.d.ts.map +1 -0
- package/dist/src/commands/ruvector/init.js +431 -0
- package/dist/src/commands/ruvector/init.js.map +1 -0
- package/dist/src/commands/ruvector/migrate.d.ts +11 -0
- package/dist/src/commands/ruvector/migrate.d.ts.map +1 -0
- package/dist/src/commands/ruvector/migrate.js +481 -0
- package/dist/src/commands/ruvector/migrate.js.map +1 -0
- package/dist/src/commands/ruvector/optimize.d.ts +11 -0
- package/dist/src/commands/ruvector/optimize.d.ts.map +1 -0
- package/dist/src/commands/ruvector/optimize.js +503 -0
- package/dist/src/commands/ruvector/optimize.js.map +1 -0
- package/dist/src/commands/ruvector/setup.d.ts +18 -0
- package/dist/src/commands/ruvector/setup.d.ts.map +1 -0
- package/dist/src/commands/ruvector/setup.js +765 -0
- package/dist/src/commands/ruvector/setup.js.map +1 -0
- package/dist/src/commands/ruvector/status.d.ts +11 -0
- package/dist/src/commands/ruvector/status.d.ts.map +1 -0
- package/dist/src/commands/ruvector/status.js +456 -0
- package/dist/src/commands/ruvector/status.js.map +1 -0
- package/dist/src/commands/security.d.ts +10 -0
- package/dist/src/commands/security.d.ts.map +1 -0
- package/dist/src/commands/security.js +575 -0
- package/dist/src/commands/security.js.map +1 -0
- package/dist/src/commands/session.js +9 -9
- package/dist/src/commands/start.d.ts.map +1 -1
- package/dist/src/commands/start.js +27 -7
- package/dist/src/commands/start.js.map +1 -1
- package/dist/src/commands/status.js +7 -7
- package/dist/src/commands/swarm.d.ts.map +1 -1
- package/dist/src/commands/swarm.js +214 -39
- package/dist/src/commands/swarm.js.map +1 -1
- package/dist/src/commands/task.js +8 -8
- package/dist/src/commands/transfer-store.d.ts +13 -0
- package/dist/src/commands/transfer-store.d.ts.map +1 -0
- package/dist/src/commands/transfer-store.js +428 -0
- package/dist/src/commands/transfer-store.js.map +1 -0
- package/dist/src/commands/update.d.ts +8 -0
- package/dist/src/commands/update.d.ts.map +1 -0
- package/dist/src/commands/update.js +276 -0
- package/dist/src/commands/update.js.map +1 -0
- package/dist/src/commands/workflow.js +5 -5
- package/dist/src/config-adapter.js +2 -1
- package/dist/src/config-adapter.js.map +1 -1
- package/dist/src/index.d.ts +22 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +153 -12
- package/dist/src/index.js.map +1 -1
- package/dist/src/init/claudemd-generator.d.ts +15 -5
- package/dist/src/init/claudemd-generator.d.ts.map +1 -1
- package/dist/src/init/claudemd-generator.js +399 -539
- package/dist/src/init/claudemd-generator.js.map +1 -1
- package/dist/src/init/executor.d.ts +24 -0
- package/dist/src/init/executor.d.ts.map +1 -1
- package/dist/src/init/executor.js +874 -38
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/helpers-generator.js +1 -1
- package/dist/src/init/helpers-generator.js.map +1 -1
- package/dist/src/init/index.d.ts +4 -3
- package/dist/src/init/index.d.ts.map +1 -1
- package/dist/src/init/index.js +2 -2
- package/dist/src/init/index.js.map +1 -1
- package/dist/src/init/mcp-generator.d.ts +9 -0
- package/dist/src/init/mcp-generator.d.ts.map +1 -1
- package/dist/src/init/mcp-generator.js +57 -28
- package/dist/src/init/mcp-generator.js.map +1 -1
- package/dist/src/init/settings-generator.d.ts.map +1 -1
- package/dist/src/init/settings-generator.js +126 -89
- package/dist/src/init/settings-generator.js.map +1 -1
- package/dist/src/init/statusline-generator.d.ts +6 -0
- package/dist/src/init/statusline-generator.d.ts.map +1 -1
- package/dist/src/init/statusline-generator.js +1119 -84
- package/dist/src/init/statusline-generator.js.map +1 -1
- package/dist/src/init/types.d.ts +37 -2
- package/dist/src/init/types.d.ts.map +1 -1
- package/dist/src/init/types.js +40 -3
- package/dist/src/init/types.js.map +1 -1
- package/dist/src/mcp-client.d.ts +3 -3
- package/dist/src/mcp-client.d.ts.map +1 -1
- package/dist/src/mcp-client.js +46 -4
- package/dist/src/mcp-client.js.map +1 -1
- package/dist/src/mcp-server.d.ts +9 -1
- package/dist/src/mcp-server.d.ts.map +1 -1
- package/dist/src/mcp-server.js +194 -46
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.d.ts +2 -1
- package/dist/src/mcp-tools/agent-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +479 -20
- package/dist/src/mcp-tools/agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/analyze-tools.d.ts +38 -0
- package/dist/src/mcp-tools/analyze-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/analyze-tools.js +317 -0
- package/dist/src/mcp-tools/analyze-tools.js.map +1 -0
- package/dist/src/mcp-tools/auto-install.d.ts +83 -0
- package/dist/src/mcp-tools/auto-install.d.ts.map +1 -0
- package/dist/src/mcp-tools/auto-install.js +131 -0
- package/dist/src/mcp-tools/auto-install.js.map +1 -0
- package/dist/src/mcp-tools/browser-tools.d.ts +13 -0
- package/dist/src/mcp-tools/browser-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/browser-tools.js +550 -0
- package/dist/src/mcp-tools/browser-tools.js.map +1 -0
- package/dist/src/mcp-tools/claims-tools.d.ts +12 -0
- package/dist/src/mcp-tools/claims-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/claims-tools.js +732 -0
- package/dist/src/mcp-tools/claims-tools.js.map +1 -0
- package/dist/src/mcp-tools/config-tools.d.ts +1 -1
- package/dist/src/mcp-tools/config-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/config-tools.js +266 -19
- package/dist/src/mcp-tools/config-tools.js.map +1 -1
- package/dist/src/mcp-tools/coordination-tools.d.ts +13 -0
- package/dist/src/mcp-tools/coordination-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/coordination-tools.js +486 -0
- package/dist/src/mcp-tools/coordination-tools.js.map +1 -0
- package/dist/src/mcp-tools/daa-tools.d.ts +13 -0
- package/dist/src/mcp-tools/daa-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/daa-tools.js +426 -0
- package/dist/src/mcp-tools/daa-tools.js.map +1 -0
- package/dist/src/mcp-tools/embeddings-tools.d.ts +9 -0
- package/dist/src/mcp-tools/embeddings-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/embeddings-tools.js +782 -0
- package/dist/src/mcp-tools/embeddings-tools.js.map +1 -0
- package/dist/src/mcp-tools/github-tools.d.ts +13 -0
- package/dist/src/mcp-tools/github-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/github-tools.js +373 -0
- package/dist/src/mcp-tools/github-tools.js.map +1 -0
- package/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -0
- package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/hive-mind-tools.js +583 -0
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -0
- package/dist/src/mcp-tools/hooks-tools.d.ts +3 -0
- package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +1307 -182
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/mcp-tools/index.d.ts +9 -0
- package/dist/src/mcp-tools/index.d.ts.map +1 -1
- package/dist/src/mcp-tools/index.js +9 -0
- package/dist/src/mcp-tools/index.js.map +1 -1
- package/dist/src/mcp-tools/memory-tools.d.ts +8 -2
- package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/memory-tools.js +376 -132
- package/dist/src/mcp-tools/memory-tools.js.map +1 -1
- package/dist/src/mcp-tools/neural-tools.d.ts +16 -0
- package/dist/src/mcp-tools/neural-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/neural-tools.js +456 -0
- package/dist/src/mcp-tools/neural-tools.js.map +1 -0
- package/dist/src/mcp-tools/performance-tools.d.ts +16 -0
- package/dist/src/mcp-tools/performance-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/performance-tools.js +534 -0
- package/dist/src/mcp-tools/performance-tools.js.map +1 -0
- package/dist/src/mcp-tools/progress-tools.d.ts +14 -0
- package/dist/src/mcp-tools/progress-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/progress-tools.js +348 -0
- package/dist/src/mcp-tools/progress-tools.js.map +1 -0
- package/dist/src/mcp-tools/security-tools.d.ts +18 -0
- package/dist/src/mcp-tools/security-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/security-tools.js +434 -0
- package/dist/src/mcp-tools/security-tools.js.map +1 -0
- package/dist/src/mcp-tools/session-tools.d.ts +1 -1
- package/dist/src/mcp-tools/session-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/session-tools.js +241 -26
- package/dist/src/mcp-tools/session-tools.js.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.js +4 -4
- package/dist/src/mcp-tools/system-tools.d.ts +13 -0
- package/dist/src/mcp-tools/system-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/system-tools.js +314 -0
- package/dist/src/mcp-tools/system-tools.js.map +1 -0
- package/dist/src/mcp-tools/task-tools.d.ts +1 -1
- package/dist/src/mcp-tools/task-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/task-tools.js +223 -21
- package/dist/src/mcp-tools/task-tools.js.map +1 -1
- package/dist/src/mcp-tools/terminal-tools.d.ts +13 -0
- package/dist/src/mcp-tools/terminal-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/terminal-tools.js +246 -0
- package/dist/src/mcp-tools/terminal-tools.js.map +1 -0
- package/dist/src/mcp-tools/transfer-tools.d.ts +14 -0
- package/dist/src/mcp-tools/transfer-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/transfer-tools.js +396 -0
- package/dist/src/mcp-tools/transfer-tools.js.map +1 -0
- package/dist/src/mcp-tools/workflow-tools.d.ts +8 -0
- package/dist/src/mcp-tools/workflow-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/workflow-tools.js +481 -0
- package/dist/src/mcp-tools/workflow-tools.js.map +1 -0
- package/dist/src/memory/ewc-consolidation.d.ts +271 -0
- package/dist/src/memory/ewc-consolidation.d.ts.map +1 -0
- package/dist/src/memory/ewc-consolidation.js +542 -0
- package/dist/src/memory/ewc-consolidation.js.map +1 -0
- package/dist/src/memory/intelligence.d.ts +285 -0
- package/dist/src/memory/intelligence.d.ts.map +1 -0
- package/dist/src/memory/intelligence.js +766 -0
- package/dist/src/memory/intelligence.js.map +1 -0
- package/dist/src/memory/memory-initializer.d.ts +395 -0
- package/dist/src/memory/memory-initializer.d.ts.map +1 -0
- package/dist/src/memory/memory-initializer.js +1924 -0
- package/dist/src/memory/memory-initializer.js.map +1 -0
- package/dist/src/memory/sona-optimizer.d.ts +227 -0
- package/dist/src/memory/sona-optimizer.d.ts.map +1 -0
- package/dist/src/memory/sona-optimizer.js +633 -0
- package/dist/src/memory/sona-optimizer.js.map +1 -0
- package/dist/src/output.d.ts +16 -0
- package/dist/src/output.d.ts.map +1 -1
- package/dist/src/output.js +42 -0
- package/dist/src/output.js.map +1 -1
- package/dist/src/parser.d.ts.map +1 -1
- package/dist/src/parser.js +27 -3
- package/dist/src/parser.js.map +1 -1
- package/dist/src/plugins/manager.d.ts +133 -0
- package/dist/src/plugins/manager.d.ts.map +1 -0
- package/dist/src/plugins/manager.js +383 -0
- package/dist/src/plugins/manager.js.map +1 -0
- package/dist/src/plugins/store/discovery.d.ts +88 -0
- package/dist/src/plugins/store/discovery.d.ts.map +1 -0
- package/dist/src/plugins/store/discovery.js +1147 -0
- package/dist/src/plugins/store/discovery.js.map +1 -0
- package/dist/src/plugins/store/index.d.ts +76 -0
- package/dist/src/plugins/store/index.d.ts.map +1 -0
- package/dist/src/plugins/store/index.js +141 -0
- package/dist/src/plugins/store/index.js.map +1 -0
- package/dist/src/plugins/store/search.d.ts +46 -0
- package/dist/src/plugins/store/search.d.ts.map +1 -0
- package/dist/src/plugins/store/search.js +230 -0
- package/dist/src/plugins/store/search.js.map +1 -0
- package/dist/src/plugins/store/types.d.ts +274 -0
- package/dist/src/plugins/store/types.d.ts.map +1 -0
- package/dist/src/plugins/store/types.js +7 -0
- package/dist/src/plugins/store/types.js.map +1 -0
- package/dist/src/plugins/tests/demo-plugin-store.d.ts +7 -0
- package/dist/src/plugins/tests/demo-plugin-store.d.ts.map +1 -0
- package/dist/src/plugins/tests/demo-plugin-store.js +126 -0
- package/dist/src/plugins/tests/demo-plugin-store.js.map +1 -0
- package/dist/src/plugins/tests/standalone-test.d.ts +12 -0
- package/dist/src/plugins/tests/standalone-test.d.ts.map +1 -0
- package/dist/src/plugins/tests/standalone-test.js +188 -0
- package/dist/src/plugins/tests/standalone-test.js.map +1 -0
- package/dist/src/plugins/tests/test-plugin-store.d.ts +7 -0
- package/dist/src/plugins/tests/test-plugin-store.d.ts.map +1 -0
- package/dist/src/plugins/tests/test-plugin-store.js +206 -0
- package/dist/src/plugins/tests/test-plugin-store.js.map +1 -0
- package/dist/src/production/circuit-breaker.d.ts +101 -0
- package/dist/src/production/circuit-breaker.d.ts.map +1 -0
- package/dist/src/production/circuit-breaker.js +241 -0
- package/dist/src/production/circuit-breaker.js.map +1 -0
- package/dist/src/production/error-handler.d.ts +92 -0
- package/dist/src/production/error-handler.d.ts.map +1 -0
- package/dist/src/production/error-handler.js +299 -0
- package/dist/src/production/error-handler.js.map +1 -0
- package/dist/src/production/index.d.ts +23 -0
- package/dist/src/production/index.d.ts.map +1 -0
- package/dist/src/production/index.js +18 -0
- package/dist/src/production/index.js.map +1 -0
- package/dist/src/production/monitoring.d.ts +161 -0
- package/dist/src/production/monitoring.d.ts.map +1 -0
- package/dist/src/production/monitoring.js +356 -0
- package/dist/src/production/monitoring.js.map +1 -0
- package/dist/src/production/rate-limiter.d.ts +80 -0
- package/dist/src/production/rate-limiter.d.ts.map +1 -0
- package/dist/src/production/rate-limiter.js +201 -0
- package/dist/src/production/rate-limiter.js.map +1 -0
- package/dist/src/production/retry.d.ts +48 -0
- package/dist/src/production/retry.d.ts.map +1 -0
- package/dist/src/production/retry.js +179 -0
- package/dist/src/production/retry.js.map +1 -0
- package/dist/src/runtime/headless.d.ts +60 -0
- package/dist/src/runtime/headless.d.ts.map +1 -0
- package/dist/src/runtime/headless.js +284 -0
- package/dist/src/runtime/headless.js.map +1 -0
- package/dist/src/ruvector/ast-analyzer.d.ts +67 -0
- package/dist/src/ruvector/ast-analyzer.d.ts.map +1 -0
- package/dist/src/ruvector/ast-analyzer.js +277 -0
- package/dist/src/ruvector/ast-analyzer.js.map +1 -0
- package/dist/src/ruvector/coverage-router.d.ts +160 -0
- package/dist/src/ruvector/coverage-router.d.ts.map +1 -0
- package/dist/src/ruvector/coverage-router.js +529 -0
- package/dist/src/ruvector/coverage-router.js.map +1 -0
- package/dist/src/ruvector/coverage-tools.d.ts +33 -0
- package/dist/src/ruvector/coverage-tools.d.ts.map +1 -0
- package/dist/src/ruvector/coverage-tools.js +157 -0
- package/dist/src/ruvector/coverage-tools.js.map +1 -0
- package/dist/src/ruvector/diff-classifier.d.ts +175 -0
- package/dist/src/ruvector/diff-classifier.d.ts.map +1 -0
- package/dist/src/ruvector/diff-classifier.js +698 -0
- package/dist/src/ruvector/diff-classifier.js.map +1 -0
- package/dist/src/ruvector/enhanced-model-router.d.ts +146 -0
- package/dist/src/ruvector/enhanced-model-router.d.ts.map +1 -0
- package/dist/src/ruvector/enhanced-model-router.js +519 -0
- package/dist/src/ruvector/enhanced-model-router.js.map +1 -0
- package/dist/src/ruvector/flash-attention.d.ts +195 -0
- package/dist/src/ruvector/flash-attention.d.ts.map +1 -0
- package/dist/src/ruvector/flash-attention.js +643 -0
- package/dist/src/ruvector/flash-attention.js.map +1 -0
- package/dist/src/ruvector/graph-analyzer.d.ts +187 -0
- package/dist/src/ruvector/graph-analyzer.d.ts.map +1 -0
- package/dist/src/ruvector/graph-analyzer.js +929 -0
- package/dist/src/ruvector/graph-analyzer.js.map +1 -0
- package/dist/src/ruvector/index.d.ts +34 -0
- package/dist/src/ruvector/index.d.ts.map +1 -0
- package/dist/src/ruvector/index.js +60 -0
- package/dist/src/ruvector/index.js.map +1 -0
- package/dist/src/ruvector/lora-adapter.d.ts +218 -0
- package/dist/src/ruvector/lora-adapter.d.ts.map +1 -0
- package/dist/src/ruvector/lora-adapter.js +455 -0
- package/dist/src/ruvector/lora-adapter.js.map +1 -0
- package/dist/src/ruvector/model-router.d.ts +220 -0
- package/dist/src/ruvector/model-router.d.ts.map +1 -0
- package/dist/src/ruvector/model-router.js +488 -0
- package/dist/src/ruvector/model-router.js.map +1 -0
- package/dist/src/ruvector/moe-router.d.ts +206 -0
- package/dist/src/ruvector/moe-router.d.ts.map +1 -0
- package/dist/src/ruvector/moe-router.js +626 -0
- package/dist/src/ruvector/moe-router.js.map +1 -0
- package/dist/src/ruvector/q-learning-router.d.ts +211 -0
- package/dist/src/ruvector/q-learning-router.d.ts.map +1 -0
- package/dist/src/ruvector/q-learning-router.js +681 -0
- package/dist/src/ruvector/q-learning-router.js.map +1 -0
- package/dist/src/ruvector/semantic-router.d.ts +77 -0
- package/dist/src/ruvector/semantic-router.d.ts.map +1 -0
- package/dist/src/ruvector/semantic-router.js +178 -0
- package/dist/src/ruvector/semantic-router.js.map +1 -0
- package/dist/src/ruvector/vector-db.d.ts +69 -0
- package/dist/src/ruvector/vector-db.d.ts.map +1 -0
- package/dist/src/ruvector/vector-db.js +243 -0
- package/dist/src/ruvector/vector-db.js.map +1 -0
- package/dist/src/services/claim-service.d.ts +204 -0
- package/dist/src/services/claim-service.d.ts.map +1 -0
- package/dist/src/services/claim-service.js +818 -0
- package/dist/src/services/claim-service.js.map +1 -0
- package/dist/src/services/container-worker-pool.d.ts +197 -0
- package/dist/src/services/container-worker-pool.d.ts.map +1 -0
- package/dist/src/services/container-worker-pool.js +581 -0
- package/dist/src/services/container-worker-pool.js.map +1 -0
- package/dist/src/services/headless-worker-executor.d.ts +304 -0
- package/dist/src/services/headless-worker-executor.d.ts.map +1 -0
- package/dist/src/services/headless-worker-executor.js +999 -0
- package/dist/src/services/headless-worker-executor.js.map +1 -0
- package/dist/src/services/index.d.ts +13 -0
- package/dist/src/services/index.d.ts.map +1 -0
- package/dist/src/services/index.js +11 -0
- package/dist/src/services/index.js.map +1 -0
- package/dist/src/services/registry-api.d.ts +58 -0
- package/dist/src/services/registry-api.d.ts.map +1 -0
- package/dist/src/services/registry-api.js +146 -0
- package/dist/src/services/registry-api.js.map +1 -0
- package/dist/src/services/ruvector-training.d.ts +213 -0
- package/dist/src/services/ruvector-training.d.ts.map +1 -0
- package/dist/src/services/ruvector-training.js +498 -0
- package/dist/src/services/ruvector-training.js.map +1 -0
- package/dist/src/services/worker-daemon.d.ts +203 -0
- package/dist/src/services/worker-daemon.d.ts.map +1 -0
- package/dist/src/services/worker-daemon.js +756 -0
- package/dist/src/services/worker-daemon.js.map +1 -0
- package/dist/src/services/worker-queue.d.ts +194 -0
- package/dist/src/services/worker-queue.d.ts.map +1 -0
- package/dist/src/services/worker-queue.js +511 -0
- package/dist/src/services/worker-queue.js.map +1 -0
- package/dist/src/suggest.d.ts +53 -0
- package/dist/src/suggest.d.ts.map +1 -0
- package/dist/src/suggest.js +200 -0
- package/dist/src/suggest.js.map +1 -0
- package/dist/src/tests/ruvector-integration-benchmark.d.ts +6 -0
- package/dist/src/tests/ruvector-integration-benchmark.d.ts.map +1 -0
- package/dist/src/tests/ruvector-integration-benchmark.js +385 -0
- package/dist/src/tests/ruvector-integration-benchmark.js.map +1 -0
- package/dist/src/transfer/anonymization/index.d.ts +25 -0
- package/dist/src/transfer/anonymization/index.d.ts.map +1 -0
- package/dist/src/transfer/anonymization/index.js +175 -0
- package/dist/src/transfer/anonymization/index.js.map +1 -0
- package/dist/src/transfer/deploy-seraphine.d.ts +13 -0
- package/dist/src/transfer/deploy-seraphine.d.ts.map +1 -0
- package/dist/src/transfer/deploy-seraphine.js +205 -0
- package/dist/src/transfer/deploy-seraphine.js.map +1 -0
- package/dist/src/transfer/export.d.ts +25 -0
- package/dist/src/transfer/export.d.ts.map +1 -0
- package/dist/src/transfer/export.js +113 -0
- package/dist/src/transfer/export.js.map +1 -0
- package/dist/src/transfer/index.d.ts +12 -0
- package/dist/src/transfer/index.d.ts.map +1 -0
- package/dist/src/transfer/index.js +31 -0
- package/dist/src/transfer/index.js.map +1 -0
- package/dist/src/transfer/ipfs/client.d.ts +109 -0
- package/dist/src/transfer/ipfs/client.d.ts.map +1 -0
- package/dist/src/transfer/ipfs/client.js +299 -0
- package/dist/src/transfer/ipfs/client.js.map +1 -0
- package/dist/src/transfer/ipfs/upload.d.ts +95 -0
- package/dist/src/transfer/ipfs/upload.d.ts.map +1 -0
- package/dist/src/transfer/ipfs/upload.js +413 -0
- package/dist/src/transfer/ipfs/upload.js.map +1 -0
- package/dist/src/transfer/models/seraphine.d.ts +72 -0
- package/dist/src/transfer/models/seraphine.d.ts.map +1 -0
- package/dist/src/transfer/models/seraphine.js +373 -0
- package/dist/src/transfer/models/seraphine.js.map +1 -0
- package/dist/src/transfer/serialization/cfp.d.ts +49 -0
- package/dist/src/transfer/serialization/cfp.d.ts.map +1 -0
- package/dist/src/transfer/serialization/cfp.js +180 -0
- package/dist/src/transfer/serialization/cfp.js.map +1 -0
- package/dist/src/transfer/storage/gcs.d.ts +82 -0
- package/dist/src/transfer/storage/gcs.d.ts.map +1 -0
- package/dist/src/transfer/storage/gcs.js +230 -0
- package/dist/src/transfer/storage/gcs.js.map +1 -0
- package/dist/src/transfer/storage/index.d.ts +6 -0
- package/dist/src/transfer/storage/index.d.ts.map +1 -0
- package/dist/src/transfer/storage/index.js +6 -0
- package/dist/src/transfer/storage/index.js.map +1 -0
- package/dist/src/transfer/store/discovery.d.ts +84 -0
- package/dist/src/transfer/store/discovery.d.ts.map +1 -0
- package/dist/src/transfer/store/discovery.js +382 -0
- package/dist/src/transfer/store/discovery.js.map +1 -0
- package/dist/src/transfer/store/download.d.ts +70 -0
- package/dist/src/transfer/store/download.d.ts.map +1 -0
- package/dist/src/transfer/store/download.js +334 -0
- package/dist/src/transfer/store/download.js.map +1 -0
- package/dist/src/transfer/store/index.d.ts +84 -0
- package/dist/src/transfer/store/index.d.ts.map +1 -0
- package/dist/src/transfer/store/index.js +153 -0
- package/dist/src/transfer/store/index.js.map +1 -0
- package/dist/src/transfer/store/publish.d.ts +76 -0
- package/dist/src/transfer/store/publish.d.ts.map +1 -0
- package/dist/src/transfer/store/publish.js +294 -0
- package/dist/src/transfer/store/publish.js.map +1 -0
- package/dist/src/transfer/store/registry.d.ts +58 -0
- package/dist/src/transfer/store/registry.d.ts.map +1 -0
- package/dist/src/transfer/store/registry.js +285 -0
- package/dist/src/transfer/store/registry.js.map +1 -0
- package/dist/src/transfer/store/search.d.ts +54 -0
- package/dist/src/transfer/store/search.d.ts.map +1 -0
- package/dist/src/transfer/store/search.js +232 -0
- package/dist/src/transfer/store/search.js.map +1 -0
- package/dist/src/transfer/store/tests/standalone-test.d.ts +12 -0
- package/dist/src/transfer/store/tests/standalone-test.d.ts.map +1 -0
- package/dist/src/transfer/store/tests/standalone-test.js +190 -0
- package/dist/src/transfer/store/tests/standalone-test.js.map +1 -0
- package/dist/src/transfer/store/types.d.ts +193 -0
- package/dist/src/transfer/store/types.d.ts.map +1 -0
- package/dist/src/transfer/store/types.js +6 -0
- package/dist/src/transfer/store/types.js.map +1 -0
- package/dist/src/transfer/test-seraphine.d.ts +6 -0
- package/dist/src/transfer/test-seraphine.d.ts.map +1 -0
- package/dist/src/transfer/test-seraphine.js +105 -0
- package/dist/src/transfer/test-seraphine.js.map +1 -0
- package/dist/src/transfer/tests/test-store.d.ts +7 -0
- package/dist/src/transfer/tests/test-store.d.ts.map +1 -0
- package/dist/src/transfer/tests/test-store.js +214 -0
- package/dist/src/transfer/tests/test-store.js.map +1 -0
- package/dist/src/transfer/types.d.ts +245 -0
- package/dist/src/transfer/types.d.ts.map +1 -0
- package/dist/src/transfer/types.js +6 -0
- package/dist/src/transfer/types.js.map +1 -0
- package/dist/src/types.d.ts +1 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/update/checker.d.ts +34 -0
- package/dist/src/update/checker.d.ts.map +1 -0
- package/dist/src/update/checker.js +190 -0
- package/dist/src/update/checker.js.map +1 -0
- package/dist/src/update/executor.d.ts +32 -0
- package/dist/src/update/executor.d.ts.map +1 -0
- package/dist/src/update/executor.js +181 -0
- package/dist/src/update/executor.js.map +1 -0
- package/dist/src/update/index.d.ts +33 -0
- package/dist/src/update/index.d.ts.map +1 -0
- package/dist/src/update/index.js +64 -0
- package/dist/src/update/index.js.map +1 -0
- package/dist/src/update/rate-limiter.d.ts +20 -0
- package/dist/src/update/rate-limiter.d.ts.map +1 -0
- package/dist/src/update/rate-limiter.js +96 -0
- package/dist/src/update/rate-limiter.js.map +1 -0
- package/dist/src/update/validator.d.ts +17 -0
- package/dist/src/update/validator.d.ts.map +1 -0
- package/dist/src/update/validator.js +123 -0
- package/dist/src/update/validator.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +88 -11
- package/.agentic-flow/intelligence.json +0 -17
- package/.claude-flow/metrics/task-metrics.json +0 -10
- package/__tests__/README.md +0 -140
- package/__tests__/TEST_SUMMARY.md +0 -144
- package/__tests__/cli.test.ts +0 -558
- package/__tests__/commands.test.ts +0 -726
- package/__tests__/config-adapter.test.ts +0 -362
- package/__tests__/config-loading.test.ts +0 -106
- package/__tests__/coverage/.tmp/coverage-0.json +0 -1
- package/__tests__/coverage/.tmp/coverage-1.json +0 -1
- package/__tests__/coverage/.tmp/coverage-2.json +0 -1
- package/__tests__/coverage/.tmp/coverage-3.json +0 -1
- package/__tests__/coverage/.tmp/coverage-4.json +0 -1
- package/__tests__/coverage/.tmp/coverage-5.json +0 -1
- package/__tests__/mcp-client.test.ts +0 -480
- package/__tests__/p1-commands.test.ts +0 -1064
- package/docs/CONFIG_LOADING.md +0 -236
- package/docs/IMPLEMENTATION_COMPLETE.md +0 -421
- package/docs/MCP_CLIENT_GUIDE.md +0 -620
- package/docs/REFACTORING_SUMMARY.md +0 -247
- package/src/commands/agent.ts +0 -941
- package/src/commands/config.ts +0 -452
- package/src/commands/hive-mind.ts +0 -762
- package/src/commands/hooks.ts +0 -2603
- package/src/commands/index.ts +0 -115
- package/src/commands/init.ts +0 -597
- package/src/commands/mcp.ts +0 -753
- package/src/commands/memory.ts +0 -1161
- package/src/commands/migrate.ts +0 -447
- package/src/commands/process.ts +0 -695
- package/src/commands/session.ts +0 -891
- package/src/commands/start.ts +0 -457
- package/src/commands/status.ts +0 -736
- package/src/commands/swarm.ts +0 -648
- package/src/commands/task.ts +0 -792
- package/src/commands/workflow.ts +0 -742
- package/src/config-adapter.ts +0 -210
- package/src/index.ts +0 -400
- package/src/infrastructure/in-memory-repositories.ts +0 -310
- package/src/init/claudemd-generator.ts +0 -631
- package/src/init/executor.ts +0 -762
- package/src/init/helpers-generator.ts +0 -628
- package/src/init/index.ts +0 -60
- package/src/init/mcp-generator.ts +0 -83
- package/src/init/settings-generator.ts +0 -274
- package/src/init/statusline-generator.ts +0 -211
- package/src/init/types.ts +0 -447
- package/src/mcp-client.ts +0 -229
- package/src/mcp-server.ts +0 -577
- package/src/mcp-tools/agent-tools.ts +0 -92
- package/src/mcp-tools/config-tools.ts +0 -88
- package/src/mcp-tools/hooks-tools.ts +0 -1849
- package/src/mcp-tools/index.ts +0 -14
- package/src/mcp-tools/memory-tools.ts +0 -270
- package/src/mcp-tools/session-tools.ts +0 -102
- package/src/mcp-tools/swarm-tools.ts +0 -105
- package/src/mcp-tools/task-tools.ts +0 -102
- package/src/mcp-tools/types.ts +0 -33
- package/src/output.ts +0 -593
- package/src/parser.ts +0 -417
- package/src/prompt.ts +0 -619
- package/src/types.ts +0 -287
- package/tsconfig.json +0 -16
- package/tsconfig.tsbuildinfo +0 -1
- package/vitest.config.ts +0 -13
- /package/{tmp.json → .claude/agents/tmp.json} +0 -0
- /package/{.claude-flow → .claude/skills/skill-builder/.claude-flow}/metrics/agent-metrics.json +0 -0
|
@@ -1,1849 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hooks MCP Tools
|
|
3
|
-
* Provides intelligent hooks functionality via MCP protocol
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { mkdirSync, writeFileSync, existsSync } from 'fs';
|
|
7
|
-
import { join, resolve } from 'path';
|
|
8
|
-
import type { MCPTool } from './types.js';
|
|
9
|
-
|
|
10
|
-
// Agent routing configuration - maps file types to recommended agents
|
|
11
|
-
const AGENT_PATTERNS: Record<string, string[]> = {
|
|
12
|
-
'.ts': ['coder', 'architect', 'tester'],
|
|
13
|
-
'.tsx': ['coder', 'architect', 'reviewer'],
|
|
14
|
-
'.test.ts': ['tester', 'reviewer'],
|
|
15
|
-
'.spec.ts': ['tester', 'reviewer'],
|
|
16
|
-
'.md': ['researcher', 'documenter'],
|
|
17
|
-
'.json': ['coder', 'architect'],
|
|
18
|
-
'.yaml': ['coder', 'devops'],
|
|
19
|
-
'.yml': ['coder', 'devops'],
|
|
20
|
-
'.sh': ['devops', 'coder'],
|
|
21
|
-
'.py': ['coder', 'ml-developer', 'researcher'],
|
|
22
|
-
'.sql': ['coder', 'architect'],
|
|
23
|
-
'.css': ['coder', 'designer'],
|
|
24
|
-
'.scss': ['coder', 'designer'],
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const TASK_PATTERNS: Record<string, { agents: string[]; confidence: number }> = {
|
|
28
|
-
'authentication': { agents: ['security-architect', 'coder', 'tester'], confidence: 0.9 },
|
|
29
|
-
'auth': { agents: ['security-architect', 'coder', 'tester'], confidence: 0.85 },
|
|
30
|
-
'api': { agents: ['architect', 'coder', 'tester'], confidence: 0.85 },
|
|
31
|
-
'test': { agents: ['tester', 'reviewer'], confidence: 0.95 },
|
|
32
|
-
'refactor': { agents: ['architect', 'coder', 'reviewer'], confidence: 0.9 },
|
|
33
|
-
'performance': { agents: ['performance-engineer', 'coder', 'tester'], confidence: 0.88 },
|
|
34
|
-
'security': { agents: ['security-architect', 'security-auditor', 'reviewer'], confidence: 0.92 },
|
|
35
|
-
'database': { agents: ['architect', 'coder', 'tester'], confidence: 0.85 },
|
|
36
|
-
'frontend': { agents: ['coder', 'designer', 'tester'], confidence: 0.82 },
|
|
37
|
-
'backend': { agents: ['architect', 'coder', 'tester'], confidence: 0.85 },
|
|
38
|
-
'bug': { agents: ['coder', 'tester', 'reviewer'], confidence: 0.88 },
|
|
39
|
-
'fix': { agents: ['coder', 'tester', 'reviewer'], confidence: 0.85 },
|
|
40
|
-
'feature': { agents: ['architect', 'coder', 'tester'], confidence: 0.8 },
|
|
41
|
-
'swarm': { agents: ['swarm-specialist', 'coordinator', 'architect'], confidence: 0.9 },
|
|
42
|
-
'memory': { agents: ['memory-specialist', 'architect', 'coder'], confidence: 0.88 },
|
|
43
|
-
'deploy': { agents: ['devops', 'coder', 'tester'], confidence: 0.85 },
|
|
44
|
-
'ci/cd': { agents: ['devops', 'coder'], confidence: 0.9 },
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
function getFileExtension(filePath: string): string {
|
|
48
|
-
const match = filePath.match(/\.[a-zA-Z0-9]+$/);
|
|
49
|
-
return match ? match[0] : '';
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function suggestAgentsForFile(filePath: string): string[] {
|
|
53
|
-
const ext = getFileExtension(filePath);
|
|
54
|
-
|
|
55
|
-
// Check for test files first
|
|
56
|
-
if (filePath.includes('.test.') || filePath.includes('.spec.')) {
|
|
57
|
-
return AGENT_PATTERNS['.test.ts'] || ['tester', 'reviewer'];
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return AGENT_PATTERNS[ext] || ['coder', 'architect'];
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function suggestAgentsForTask(task: string): { agents: string[]; confidence: number } {
|
|
64
|
-
const taskLower = task.toLowerCase();
|
|
65
|
-
|
|
66
|
-
for (const [pattern, result] of Object.entries(TASK_PATTERNS)) {
|
|
67
|
-
if (taskLower.includes(pattern)) {
|
|
68
|
-
return result;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Default fallback
|
|
73
|
-
return { agents: ['coder', 'researcher', 'tester'], confidence: 0.7 };
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function assessCommandRisk(command: string): { risk: string; level: number; warnings: string[] } {
|
|
77
|
-
const warnings: string[] = [];
|
|
78
|
-
let level = 0;
|
|
79
|
-
|
|
80
|
-
// High risk commands
|
|
81
|
-
if (command.includes('rm -rf') || command.includes('rm -r')) {
|
|
82
|
-
level = Math.max(level, 0.9);
|
|
83
|
-
warnings.push('Recursive deletion detected - verify target path');
|
|
84
|
-
}
|
|
85
|
-
if (command.includes('sudo')) {
|
|
86
|
-
level = Math.max(level, 0.7);
|
|
87
|
-
warnings.push('Elevated privileges requested');
|
|
88
|
-
}
|
|
89
|
-
if (command.includes('> /') || command.includes('>> /')) {
|
|
90
|
-
level = Math.max(level, 0.6);
|
|
91
|
-
warnings.push('Writing to system path');
|
|
92
|
-
}
|
|
93
|
-
if (command.includes('chmod') || command.includes('chown')) {
|
|
94
|
-
level = Math.max(level, 0.5);
|
|
95
|
-
warnings.push('Permission modification');
|
|
96
|
-
}
|
|
97
|
-
if (command.includes('curl') && command.includes('|')) {
|
|
98
|
-
level = Math.max(level, 0.8);
|
|
99
|
-
warnings.push('Piping remote content to shell');
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// Safe commands
|
|
103
|
-
if (command.startsWith('npm ') || command.startsWith('npx ')) {
|
|
104
|
-
level = Math.min(level, 0.3);
|
|
105
|
-
}
|
|
106
|
-
if (command.startsWith('git ')) {
|
|
107
|
-
level = Math.min(level, 0.2);
|
|
108
|
-
}
|
|
109
|
-
if (command.startsWith('ls ') || command.startsWith('cat ') || command.startsWith('echo ')) {
|
|
110
|
-
level = Math.min(level, 0.1);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const risk = level >= 0.7 ? 'high' : level >= 0.4 ? 'medium' : 'low';
|
|
114
|
-
|
|
115
|
-
return { risk, level, warnings };
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// MCP Tool implementations - return raw data for direct CLI use
|
|
119
|
-
export const hooksPreEdit: MCPTool = {
|
|
120
|
-
name: 'hooks/pre-edit',
|
|
121
|
-
description: 'Get context and agent suggestions before editing a file',
|
|
122
|
-
inputSchema: {
|
|
123
|
-
type: 'object',
|
|
124
|
-
properties: {
|
|
125
|
-
filePath: { type: 'string', description: 'Path to the file being edited' },
|
|
126
|
-
operation: { type: 'string', description: 'Type of operation (create, update, delete, refactor)' },
|
|
127
|
-
context: { type: 'string', description: 'Additional context' },
|
|
128
|
-
},
|
|
129
|
-
required: ['filePath'],
|
|
130
|
-
},
|
|
131
|
-
handler: async (params: Record<string, unknown>) => {
|
|
132
|
-
const filePath = params.filePath as string;
|
|
133
|
-
const operation = (params.operation as string) || 'update';
|
|
134
|
-
|
|
135
|
-
const suggestedAgents = suggestAgentsForFile(filePath);
|
|
136
|
-
const ext = getFileExtension(filePath);
|
|
137
|
-
|
|
138
|
-
return {
|
|
139
|
-
filePath,
|
|
140
|
-
operation,
|
|
141
|
-
context: {
|
|
142
|
-
fileExists: true,
|
|
143
|
-
fileType: ext || 'unknown',
|
|
144
|
-
relatedFiles: [],
|
|
145
|
-
suggestedAgents,
|
|
146
|
-
patterns: [
|
|
147
|
-
{ pattern: `${ext} file editing`, confidence: 0.85 },
|
|
148
|
-
],
|
|
149
|
-
risks: operation === 'delete' ? ['File deletion is irreversible'] : [],
|
|
150
|
-
},
|
|
151
|
-
recommendations: [
|
|
152
|
-
`Recommended agents: ${suggestedAgents.join(', ')}`,
|
|
153
|
-
'Run tests after changes',
|
|
154
|
-
],
|
|
155
|
-
};
|
|
156
|
-
},
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
export const hooksPostEdit: MCPTool = {
|
|
160
|
-
name: 'hooks/post-edit',
|
|
161
|
-
description: 'Record editing outcome for learning',
|
|
162
|
-
inputSchema: {
|
|
163
|
-
type: 'object',
|
|
164
|
-
properties: {
|
|
165
|
-
filePath: { type: 'string', description: 'Path to the edited file' },
|
|
166
|
-
success: { type: 'boolean', description: 'Whether the edit was successful' },
|
|
167
|
-
agent: { type: 'string', description: 'Agent that performed the edit' },
|
|
168
|
-
},
|
|
169
|
-
required: ['filePath'],
|
|
170
|
-
},
|
|
171
|
-
handler: async (params: Record<string, unknown>) => {
|
|
172
|
-
const filePath = params.filePath as string;
|
|
173
|
-
const success = params.success !== false;
|
|
174
|
-
|
|
175
|
-
return {
|
|
176
|
-
recorded: true,
|
|
177
|
-
filePath,
|
|
178
|
-
success,
|
|
179
|
-
timestamp: new Date().toISOString(),
|
|
180
|
-
learningUpdate: success ? 'pattern_reinforced' : 'pattern_adjusted',
|
|
181
|
-
};
|
|
182
|
-
},
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
export const hooksPreCommand: MCPTool = {
|
|
186
|
-
name: 'hooks/pre-command',
|
|
187
|
-
description: 'Assess risk before executing a command',
|
|
188
|
-
inputSchema: {
|
|
189
|
-
type: 'object',
|
|
190
|
-
properties: {
|
|
191
|
-
command: { type: 'string', description: 'Command to execute' },
|
|
192
|
-
},
|
|
193
|
-
required: ['command'],
|
|
194
|
-
},
|
|
195
|
-
handler: async (params: Record<string, unknown>) => {
|
|
196
|
-
const command = params.command as string;
|
|
197
|
-
const assessment = assessCommandRisk(command);
|
|
198
|
-
|
|
199
|
-
const riskLevel = assessment.level >= 0.8 ? 'critical'
|
|
200
|
-
: assessment.level >= 0.6 ? 'high'
|
|
201
|
-
: assessment.level >= 0.3 ? 'medium'
|
|
202
|
-
: 'low';
|
|
203
|
-
|
|
204
|
-
return {
|
|
205
|
-
command,
|
|
206
|
-
riskLevel,
|
|
207
|
-
risks: assessment.warnings.map((warning, i) => ({
|
|
208
|
-
type: `risk-${i + 1}`,
|
|
209
|
-
severity: assessment.level >= 0.6 ? 'high' : 'medium',
|
|
210
|
-
description: warning,
|
|
211
|
-
})),
|
|
212
|
-
recommendations: assessment.warnings.length > 0
|
|
213
|
-
? ['Review warnings before proceeding', 'Consider using safer alternative']
|
|
214
|
-
: ['Command appears safe to execute'],
|
|
215
|
-
safeAlternatives: [],
|
|
216
|
-
shouldProceed: assessment.level < 0.7,
|
|
217
|
-
};
|
|
218
|
-
},
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
export const hooksPostCommand: MCPTool = {
|
|
222
|
-
name: 'hooks/post-command',
|
|
223
|
-
description: 'Record command execution outcome',
|
|
224
|
-
inputSchema: {
|
|
225
|
-
type: 'object',
|
|
226
|
-
properties: {
|
|
227
|
-
command: { type: 'string', description: 'Executed command' },
|
|
228
|
-
exitCode: { type: 'number', description: 'Command exit code' },
|
|
229
|
-
},
|
|
230
|
-
required: ['command'],
|
|
231
|
-
},
|
|
232
|
-
handler: async (params: Record<string, unknown>) => {
|
|
233
|
-
const command = params.command as string;
|
|
234
|
-
const exitCode = (params.exitCode as number) || 0;
|
|
235
|
-
|
|
236
|
-
return {
|
|
237
|
-
recorded: true,
|
|
238
|
-
command,
|
|
239
|
-
exitCode,
|
|
240
|
-
success: exitCode === 0,
|
|
241
|
-
timestamp: new Date().toISOString(),
|
|
242
|
-
};
|
|
243
|
-
},
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
export const hooksRoute: MCPTool = {
|
|
247
|
-
name: 'hooks/route',
|
|
248
|
-
description: 'Route task to optimal agent using learned patterns',
|
|
249
|
-
inputSchema: {
|
|
250
|
-
type: 'object',
|
|
251
|
-
properties: {
|
|
252
|
-
task: { type: 'string', description: 'Task description' },
|
|
253
|
-
context: { type: 'string', description: 'Additional context' },
|
|
254
|
-
},
|
|
255
|
-
required: ['task'],
|
|
256
|
-
},
|
|
257
|
-
handler: async (params: Record<string, unknown>) => {
|
|
258
|
-
const task = params.task as string;
|
|
259
|
-
const suggestion = suggestAgentsForTask(task);
|
|
260
|
-
|
|
261
|
-
// Determine complexity based on task length and keywords
|
|
262
|
-
const taskLower = task.toLowerCase();
|
|
263
|
-
const complexity = taskLower.includes('complex') || taskLower.includes('architecture') || task.length > 200
|
|
264
|
-
? 'high'
|
|
265
|
-
: taskLower.includes('simple') || taskLower.includes('fix') || task.length < 50
|
|
266
|
-
? 'low'
|
|
267
|
-
: 'medium';
|
|
268
|
-
|
|
269
|
-
return {
|
|
270
|
-
task,
|
|
271
|
-
primaryAgent: {
|
|
272
|
-
type: suggestion.agents[0],
|
|
273
|
-
confidence: suggestion.confidence,
|
|
274
|
-
reason: `Task contains keywords matching ${suggestion.agents[0]} specialization`,
|
|
275
|
-
},
|
|
276
|
-
alternativeAgents: suggestion.agents.slice(1).map((agent, i) => ({
|
|
277
|
-
type: agent,
|
|
278
|
-
confidence: suggestion.confidence - (0.1 * (i + 1)),
|
|
279
|
-
reason: `Alternative agent for ${agent} capabilities`,
|
|
280
|
-
})),
|
|
281
|
-
estimatedMetrics: {
|
|
282
|
-
successProbability: suggestion.confidence,
|
|
283
|
-
estimatedDuration: complexity === 'high' ? '2-4 hours' : complexity === 'medium' ? '30-60 min' : '10-30 min',
|
|
284
|
-
complexity,
|
|
285
|
-
},
|
|
286
|
-
swarmRecommendation: suggestion.agents.length > 2 ? {
|
|
287
|
-
topology: 'hierarchical',
|
|
288
|
-
agents: suggestion.agents,
|
|
289
|
-
coordination: 'queen-led',
|
|
290
|
-
} : null,
|
|
291
|
-
};
|
|
292
|
-
},
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
export const hooksMetrics: MCPTool = {
|
|
296
|
-
name: 'hooks/metrics',
|
|
297
|
-
description: 'View learning metrics dashboard',
|
|
298
|
-
inputSchema: {
|
|
299
|
-
type: 'object',
|
|
300
|
-
properties: {
|
|
301
|
-
period: { type: 'string', description: 'Metrics period (1h, 24h, 7d, 30d)' },
|
|
302
|
-
includeV3: { type: 'boolean', description: 'Include V3 performance metrics' },
|
|
303
|
-
},
|
|
304
|
-
},
|
|
305
|
-
handler: async (params: Record<string, unknown>) => {
|
|
306
|
-
const period = (params.period as string) || '24h';
|
|
307
|
-
|
|
308
|
-
return {
|
|
309
|
-
period,
|
|
310
|
-
patterns: {
|
|
311
|
-
total: 15,
|
|
312
|
-
successful: 12,
|
|
313
|
-
failed: 3,
|
|
314
|
-
avgConfidence: 0.85,
|
|
315
|
-
},
|
|
316
|
-
agents: {
|
|
317
|
-
routingAccuracy: 0.87,
|
|
318
|
-
totalRoutes: 42,
|
|
319
|
-
topAgent: 'coder',
|
|
320
|
-
},
|
|
321
|
-
commands: {
|
|
322
|
-
totalExecuted: 128,
|
|
323
|
-
successRate: 0.94,
|
|
324
|
-
avgRiskScore: 0.15,
|
|
325
|
-
},
|
|
326
|
-
performance: {
|
|
327
|
-
flashAttention: '2.49x-7.47x speedup',
|
|
328
|
-
memoryReduction: '50-75% reduction',
|
|
329
|
-
searchImprovement: '150x-12,500x faster',
|
|
330
|
-
tokenReduction: '32.3% fewer tokens',
|
|
331
|
-
},
|
|
332
|
-
status: 'healthy',
|
|
333
|
-
lastUpdated: new Date().toISOString(),
|
|
334
|
-
};
|
|
335
|
-
},
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
export const hooksList: MCPTool = {
|
|
339
|
-
name: 'hooks/list',
|
|
340
|
-
description: 'List all registered hooks',
|
|
341
|
-
inputSchema: {
|
|
342
|
-
type: 'object',
|
|
343
|
-
properties: {},
|
|
344
|
-
},
|
|
345
|
-
handler: async () => {
|
|
346
|
-
return {
|
|
347
|
-
hooks: [
|
|
348
|
-
// Core hooks
|
|
349
|
-
{ name: 'pre-edit', type: 'PreToolUse', status: 'active' },
|
|
350
|
-
{ name: 'post-edit', type: 'PostToolUse', status: 'active' },
|
|
351
|
-
{ name: 'pre-command', type: 'PreToolUse', status: 'active' },
|
|
352
|
-
{ name: 'post-command', type: 'PostToolUse', status: 'active' },
|
|
353
|
-
{ name: 'pre-task', type: 'PreToolUse', status: 'active' },
|
|
354
|
-
{ name: 'post-task', type: 'PostToolUse', status: 'active' },
|
|
355
|
-
// Routing hooks
|
|
356
|
-
{ name: 'route', type: 'intelligence', status: 'active' },
|
|
357
|
-
{ name: 'explain', type: 'intelligence', status: 'active' },
|
|
358
|
-
// Session hooks
|
|
359
|
-
{ name: 'session-start', type: 'SessionStart', status: 'active' },
|
|
360
|
-
{ name: 'session-end', type: 'SessionEnd', status: 'active' },
|
|
361
|
-
{ name: 'session-restore', type: 'SessionStart', status: 'active' },
|
|
362
|
-
// Learning hooks
|
|
363
|
-
{ name: 'pretrain', type: 'intelligence', status: 'active' },
|
|
364
|
-
{ name: 'build-agents', type: 'intelligence', status: 'active' },
|
|
365
|
-
{ name: 'transfer', type: 'intelligence', status: 'active' },
|
|
366
|
-
{ name: 'metrics', type: 'analytics', status: 'active' },
|
|
367
|
-
// System hooks
|
|
368
|
-
{ name: 'init', type: 'system', status: 'active' },
|
|
369
|
-
{ name: 'notify', type: 'coordination', status: 'active' },
|
|
370
|
-
// Intelligence subcommands
|
|
371
|
-
{ name: 'intelligence', type: 'intelligence', status: 'active' },
|
|
372
|
-
{ name: 'intelligence/trajectory-start', type: 'intelligence', status: 'active' },
|
|
373
|
-
{ name: 'intelligence/trajectory-step', type: 'intelligence', status: 'active' },
|
|
374
|
-
{ name: 'intelligence/trajectory-end', type: 'intelligence', status: 'active' },
|
|
375
|
-
{ name: 'intelligence/pattern-store', type: 'intelligence', status: 'active' },
|
|
376
|
-
{ name: 'intelligence/pattern-search', type: 'intelligence', status: 'active' },
|
|
377
|
-
{ name: 'intelligence/stats', type: 'analytics', status: 'active' },
|
|
378
|
-
{ name: 'intelligence/learn', type: 'intelligence', status: 'active' },
|
|
379
|
-
{ name: 'intelligence/attention', type: 'intelligence', status: 'active' },
|
|
380
|
-
],
|
|
381
|
-
total: 26,
|
|
382
|
-
};
|
|
383
|
-
},
|
|
384
|
-
};
|
|
385
|
-
|
|
386
|
-
export const hooksPreTask: MCPTool = {
|
|
387
|
-
name: 'hooks/pre-task',
|
|
388
|
-
description: 'Record task start and get agent suggestions',
|
|
389
|
-
inputSchema: {
|
|
390
|
-
type: 'object',
|
|
391
|
-
properties: {
|
|
392
|
-
taskId: { type: 'string', description: 'Task identifier' },
|
|
393
|
-
description: { type: 'string', description: 'Task description' },
|
|
394
|
-
},
|
|
395
|
-
required: ['taskId', 'description'],
|
|
396
|
-
},
|
|
397
|
-
handler: async (params: Record<string, unknown>) => {
|
|
398
|
-
const taskId = params.taskId as string;
|
|
399
|
-
const description = params.description as string;
|
|
400
|
-
const suggestion = suggestAgentsForTask(description);
|
|
401
|
-
|
|
402
|
-
// Determine complexity
|
|
403
|
-
const descLower = description.toLowerCase();
|
|
404
|
-
const complexity: 'low' | 'medium' | 'high' = descLower.includes('complex') || descLower.includes('architecture') || description.length > 200
|
|
405
|
-
? 'high'
|
|
406
|
-
: descLower.includes('simple') || descLower.includes('fix') || description.length < 50
|
|
407
|
-
? 'low'
|
|
408
|
-
: 'medium';
|
|
409
|
-
|
|
410
|
-
return {
|
|
411
|
-
taskId,
|
|
412
|
-
description,
|
|
413
|
-
suggestedAgents: suggestion.agents.map((agent, i) => ({
|
|
414
|
-
type: agent,
|
|
415
|
-
confidence: suggestion.confidence - (0.05 * i),
|
|
416
|
-
reason: i === 0
|
|
417
|
-
? `Primary agent for ${agent} tasks based on learned patterns`
|
|
418
|
-
: `Alternative agent with ${agent} capabilities`,
|
|
419
|
-
})),
|
|
420
|
-
complexity,
|
|
421
|
-
estimatedDuration: complexity === 'high' ? '2-4 hours' : complexity === 'medium' ? '30-60 min' : '10-30 min',
|
|
422
|
-
risks: complexity === 'high' ? ['Complex task may require multiple iterations'] : [],
|
|
423
|
-
recommendations: [
|
|
424
|
-
`Use ${suggestion.agents[0]} as primary agent`,
|
|
425
|
-
suggestion.agents.length > 2 ? 'Consider using swarm coordination' : 'Single agent recommended',
|
|
426
|
-
],
|
|
427
|
-
timestamp: new Date().toISOString(),
|
|
428
|
-
};
|
|
429
|
-
},
|
|
430
|
-
};
|
|
431
|
-
|
|
432
|
-
export const hooksPostTask: MCPTool = {
|
|
433
|
-
name: 'hooks/post-task',
|
|
434
|
-
description: 'Record task completion for learning',
|
|
435
|
-
inputSchema: {
|
|
436
|
-
type: 'object',
|
|
437
|
-
properties: {
|
|
438
|
-
taskId: { type: 'string', description: 'Task identifier' },
|
|
439
|
-
success: { type: 'boolean', description: 'Whether task was successful' },
|
|
440
|
-
agent: { type: 'string', description: 'Agent that completed the task' },
|
|
441
|
-
quality: { type: 'number', description: 'Quality score (0-1)' },
|
|
442
|
-
},
|
|
443
|
-
required: ['taskId'],
|
|
444
|
-
},
|
|
445
|
-
handler: async (params: Record<string, unknown>) => {
|
|
446
|
-
const taskId = params.taskId as string;
|
|
447
|
-
const success = params.success !== false;
|
|
448
|
-
const quality = (params.quality as number) || (success ? 0.85 : 0.3);
|
|
449
|
-
|
|
450
|
-
return {
|
|
451
|
-
taskId,
|
|
452
|
-
success,
|
|
453
|
-
duration: Math.floor(Math.random() * 300) + 60, // 1-6 minutes in seconds
|
|
454
|
-
learningUpdates: {
|
|
455
|
-
patternsUpdated: success ? 2 : 1,
|
|
456
|
-
newPatterns: success ? 1 : 0,
|
|
457
|
-
trajectoryId: `traj-${Date.now()}`,
|
|
458
|
-
},
|
|
459
|
-
quality,
|
|
460
|
-
timestamp: new Date().toISOString(),
|
|
461
|
-
};
|
|
462
|
-
},
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
// Explain hook - transparent routing explanation
|
|
466
|
-
export const hooksExplain: MCPTool = {
|
|
467
|
-
name: 'hooks/explain',
|
|
468
|
-
description: 'Explain routing decision with full transparency',
|
|
469
|
-
inputSchema: {
|
|
470
|
-
type: 'object',
|
|
471
|
-
properties: {
|
|
472
|
-
task: { type: 'string', description: 'Task description' },
|
|
473
|
-
agent: { type: 'string', description: 'Specific agent to explain' },
|
|
474
|
-
verbose: { type: 'boolean', description: 'Verbose explanation' },
|
|
475
|
-
},
|
|
476
|
-
required: ['task'],
|
|
477
|
-
},
|
|
478
|
-
handler: async (params: Record<string, unknown>) => {
|
|
479
|
-
const task = params.task as string;
|
|
480
|
-
const suggestion = suggestAgentsForTask(task);
|
|
481
|
-
const taskLower = task.toLowerCase();
|
|
482
|
-
|
|
483
|
-
// Determine matched patterns
|
|
484
|
-
const matchedPatterns: Array<{ pattern: string; matchScore: number; examples: string[] }> = [];
|
|
485
|
-
for (const [pattern, _result] of Object.entries(TASK_PATTERNS)) {
|
|
486
|
-
if (taskLower.includes(pattern)) {
|
|
487
|
-
matchedPatterns.push({
|
|
488
|
-
pattern,
|
|
489
|
-
matchScore: 0.85 + Math.random() * 0.1,
|
|
490
|
-
examples: [`Previous ${pattern} task completed successfully`, `${pattern} patterns from repository analysis`],
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
return {
|
|
496
|
-
task,
|
|
497
|
-
explanation: `The routing decision was made based on keyword analysis of the task description. ` +
|
|
498
|
-
`The task contains keywords that match the "${suggestion.agents[0]}" specialization with ${(suggestion.confidence * 100).toFixed(0)}% confidence.`,
|
|
499
|
-
factors: [
|
|
500
|
-
{ factor: 'Keyword Match', weight: 0.4, value: suggestion.confidence, impact: 'Primary routing signal' },
|
|
501
|
-
{ factor: 'Historical Success', weight: 0.3, value: 0.87, impact: 'Past task success rate' },
|
|
502
|
-
{ factor: 'Agent Availability', weight: 0.2, value: 0.95, impact: 'All suggested agents available' },
|
|
503
|
-
{ factor: 'Task Complexity', weight: 0.1, value: task.length > 100 ? 0.8 : 0.3, impact: 'Complexity assessment' },
|
|
504
|
-
],
|
|
505
|
-
patterns: matchedPatterns.length > 0 ? matchedPatterns : [
|
|
506
|
-
{ pattern: 'general-task', matchScore: 0.7, examples: ['Default pattern for unclassified tasks'] }
|
|
507
|
-
],
|
|
508
|
-
decision: {
|
|
509
|
-
agent: suggestion.agents[0],
|
|
510
|
-
confidence: suggestion.confidence,
|
|
511
|
-
reasoning: [
|
|
512
|
-
`Task analysis identified ${matchedPatterns.length || 1} relevant patterns`,
|
|
513
|
-
`"${suggestion.agents[0]}" has highest capability match for this task type`,
|
|
514
|
-
`Historical success rate for similar tasks: 87%`,
|
|
515
|
-
`Confidence threshold met (${(suggestion.confidence * 100).toFixed(0)}% >= 70%)`,
|
|
516
|
-
],
|
|
517
|
-
},
|
|
518
|
-
};
|
|
519
|
-
},
|
|
520
|
-
};
|
|
521
|
-
|
|
522
|
-
// Pretrain hook - repository analysis for intelligence bootstrap
|
|
523
|
-
export const hooksPretrain: MCPTool = {
|
|
524
|
-
name: 'hooks/pretrain',
|
|
525
|
-
description: 'Analyze repository to bootstrap intelligence (4-step pipeline)',
|
|
526
|
-
inputSchema: {
|
|
527
|
-
type: 'object',
|
|
528
|
-
properties: {
|
|
529
|
-
path: { type: 'string', description: 'Repository path' },
|
|
530
|
-
depth: { type: 'string', description: 'Analysis depth (shallow, medium, deep)' },
|
|
531
|
-
skipCache: { type: 'boolean', description: 'Skip cached analysis' },
|
|
532
|
-
},
|
|
533
|
-
},
|
|
534
|
-
handler: async (params: Record<string, unknown>) => {
|
|
535
|
-
const path = (params.path as string) || '.';
|
|
536
|
-
const depth = (params.depth as string) || 'medium';
|
|
537
|
-
const startTime = Date.now();
|
|
538
|
-
|
|
539
|
-
// Simulate analysis based on depth
|
|
540
|
-
const multiplier = depth === 'deep' ? 3 : depth === 'shallow' ? 1 : 2;
|
|
541
|
-
|
|
542
|
-
return {
|
|
543
|
-
path,
|
|
544
|
-
depth,
|
|
545
|
-
stats: {
|
|
546
|
-
filesAnalyzed: 42 * multiplier,
|
|
547
|
-
patternsExtracted: 15 * multiplier,
|
|
548
|
-
strategiesLearned: 8 * multiplier,
|
|
549
|
-
trajectoriesEvaluated: 23 * multiplier,
|
|
550
|
-
contradictionsResolved: 3,
|
|
551
|
-
},
|
|
552
|
-
pipeline: {
|
|
553
|
-
retrieve: { status: 'completed', duration: 120 * multiplier },
|
|
554
|
-
judge: { status: 'completed', duration: 180 * multiplier },
|
|
555
|
-
distill: { status: 'completed', duration: 90 * multiplier },
|
|
556
|
-
consolidate: { status: 'completed', duration: 60 * multiplier },
|
|
557
|
-
},
|
|
558
|
-
duration: Date.now() - startTime + (500 * multiplier),
|
|
559
|
-
};
|
|
560
|
-
},
|
|
561
|
-
};
|
|
562
|
-
|
|
563
|
-
// Build agents hook - generate optimized agent configs
|
|
564
|
-
export const hooksBuildAgents: MCPTool = {
|
|
565
|
-
name: 'hooks/build-agents',
|
|
566
|
-
description: 'Generate optimized agent configurations from pretrain data',
|
|
567
|
-
inputSchema: {
|
|
568
|
-
type: 'object',
|
|
569
|
-
properties: {
|
|
570
|
-
outputDir: { type: 'string', description: 'Output directory for configs' },
|
|
571
|
-
focus: { type: 'string', description: 'Focus area (v3-implementation, security, performance, all)' },
|
|
572
|
-
format: { type: 'string', description: 'Config format (yaml, json)' },
|
|
573
|
-
persist: { type: 'boolean', description: 'Write configs to disk' },
|
|
574
|
-
},
|
|
575
|
-
},
|
|
576
|
-
handler: async (params: Record<string, unknown>) => {
|
|
577
|
-
const outputDir = resolve((params.outputDir as string) || './agents');
|
|
578
|
-
const focus = (params.focus as string) || 'all';
|
|
579
|
-
const format = (params.format as string) || 'yaml';
|
|
580
|
-
const persist = params.persist !== false; // Default to true
|
|
581
|
-
|
|
582
|
-
const agents = [
|
|
583
|
-
{ type: 'coder', configFile: join(outputDir, `coder.${format}`), capabilities: ['code-generation', 'refactoring', 'debugging'], optimizations: ['flash-attention', 'token-reduction'] },
|
|
584
|
-
{ type: 'architect', configFile: join(outputDir, `architect.${format}`), capabilities: ['system-design', 'api-design', 'documentation'], optimizations: ['context-caching', 'memory-persistence'] },
|
|
585
|
-
{ type: 'tester', configFile: join(outputDir, `tester.${format}`), capabilities: ['unit-testing', 'integration-testing', 'coverage'], optimizations: ['parallel-execution'] },
|
|
586
|
-
{ type: 'security-architect', configFile: join(outputDir, `security-architect.${format}`), capabilities: ['threat-modeling', 'vulnerability-analysis', 'security-review'], optimizations: ['pattern-matching'] },
|
|
587
|
-
{ type: 'reviewer', configFile: join(outputDir, `reviewer.${format}`), capabilities: ['code-review', 'quality-analysis', 'best-practices'], optimizations: ['incremental-analysis'] },
|
|
588
|
-
];
|
|
589
|
-
|
|
590
|
-
const filteredAgents = focus === 'all' ? agents :
|
|
591
|
-
focus === 'security' ? agents.filter(a => a.type.includes('security') || a.type === 'reviewer') :
|
|
592
|
-
focus === 'performance' ? agents.filter(a => ['coder', 'tester'].includes(a.type)) :
|
|
593
|
-
agents;
|
|
594
|
-
|
|
595
|
-
// Persist configs to disk if requested
|
|
596
|
-
if (persist) {
|
|
597
|
-
// Ensure output directory exists
|
|
598
|
-
if (!existsSync(outputDir)) {
|
|
599
|
-
mkdirSync(outputDir, { recursive: true });
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
// Write each agent config
|
|
603
|
-
for (const agent of filteredAgents) {
|
|
604
|
-
const config = {
|
|
605
|
-
type: agent.type,
|
|
606
|
-
capabilities: agent.capabilities,
|
|
607
|
-
optimizations: agent.optimizations,
|
|
608
|
-
version: '3.0.0',
|
|
609
|
-
createdAt: new Date().toISOString(),
|
|
610
|
-
};
|
|
611
|
-
|
|
612
|
-
const content = format === 'json'
|
|
613
|
-
? JSON.stringify(config, null, 2)
|
|
614
|
-
: `# ${agent.type} agent configuration\ntype: ${agent.type}\nversion: "3.0.0"\ncapabilities:\n${agent.capabilities.map(c => ` - ${c}`).join('\n')}\noptimizations:\n${agent.optimizations.map(o => ` - ${o}`).join('\n')}\ncreatedAt: "${config.createdAt}"\n`;
|
|
615
|
-
|
|
616
|
-
writeFileSync(agent.configFile, content, 'utf-8');
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
return {
|
|
621
|
-
outputDir,
|
|
622
|
-
focus,
|
|
623
|
-
persisted: persist,
|
|
624
|
-
agents: filteredAgents,
|
|
625
|
-
stats: {
|
|
626
|
-
configsGenerated: filteredAgents.length,
|
|
627
|
-
patternsApplied: filteredAgents.length * 3,
|
|
628
|
-
optimizationsIncluded: filteredAgents.reduce((acc, a) => acc + a.optimizations.length, 0),
|
|
629
|
-
},
|
|
630
|
-
};
|
|
631
|
-
},
|
|
632
|
-
};
|
|
633
|
-
|
|
634
|
-
// Transfer hook - transfer patterns from another project
|
|
635
|
-
export const hooksTransfer: MCPTool = {
|
|
636
|
-
name: 'hooks/transfer',
|
|
637
|
-
description: 'Transfer learned patterns from another project',
|
|
638
|
-
inputSchema: {
|
|
639
|
-
type: 'object',
|
|
640
|
-
properties: {
|
|
641
|
-
sourcePath: { type: 'string', description: 'Source project path' },
|
|
642
|
-
filter: { type: 'string', description: 'Filter patterns by type' },
|
|
643
|
-
minConfidence: { type: 'number', description: 'Minimum confidence threshold' },
|
|
644
|
-
},
|
|
645
|
-
required: ['sourcePath'],
|
|
646
|
-
},
|
|
647
|
-
handler: async (params: Record<string, unknown>) => {
|
|
648
|
-
const sourcePath = params.sourcePath as string;
|
|
649
|
-
const minConfidence = (params.minConfidence as number) || 0.7;
|
|
650
|
-
const filter = params.filter as string;
|
|
651
|
-
|
|
652
|
-
const byType: Record<string, number> = {
|
|
653
|
-
'file-patterns': 8,
|
|
654
|
-
'task-routing': 12,
|
|
655
|
-
'command-risk': 5,
|
|
656
|
-
'agent-success': 15,
|
|
657
|
-
};
|
|
658
|
-
|
|
659
|
-
if (filter) {
|
|
660
|
-
Object.keys(byType).forEach(key => {
|
|
661
|
-
if (!key.includes(filter)) delete byType[key];
|
|
662
|
-
});
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
const total = Object.values(byType).reduce((a, b) => a + b, 0);
|
|
666
|
-
|
|
667
|
-
return {
|
|
668
|
-
sourcePath,
|
|
669
|
-
transferred: {
|
|
670
|
-
total,
|
|
671
|
-
byType,
|
|
672
|
-
},
|
|
673
|
-
skipped: {
|
|
674
|
-
lowConfidence: Math.floor(total * 0.15),
|
|
675
|
-
duplicates: Math.floor(total * 0.08),
|
|
676
|
-
conflicts: Math.floor(total * 0.03),
|
|
677
|
-
},
|
|
678
|
-
stats: {
|
|
679
|
-
avgConfidence: 0.82 + (minConfidence > 0.8 ? 0.1 : 0),
|
|
680
|
-
avgAge: '3 days',
|
|
681
|
-
},
|
|
682
|
-
};
|
|
683
|
-
},
|
|
684
|
-
};
|
|
685
|
-
|
|
686
|
-
// Session start hook
|
|
687
|
-
export const hooksSessionStart: MCPTool = {
|
|
688
|
-
name: 'hooks/session-start',
|
|
689
|
-
description: 'Initialize a new session',
|
|
690
|
-
inputSchema: {
|
|
691
|
-
type: 'object',
|
|
692
|
-
properties: {
|
|
693
|
-
sessionId: { type: 'string', description: 'Optional session ID' },
|
|
694
|
-
restoreLatest: { type: 'boolean', description: 'Restore latest session state' },
|
|
695
|
-
},
|
|
696
|
-
},
|
|
697
|
-
handler: async (params: Record<string, unknown>) => {
|
|
698
|
-
const sessionId = (params.sessionId as string) || `session-${Date.now()}`;
|
|
699
|
-
const restoreLatest = params.restoreLatest as boolean;
|
|
700
|
-
|
|
701
|
-
return {
|
|
702
|
-
sessionId,
|
|
703
|
-
started: new Date().toISOString(),
|
|
704
|
-
restored: restoreLatest,
|
|
705
|
-
config: {
|
|
706
|
-
intelligenceEnabled: true,
|
|
707
|
-
hooksEnabled: true,
|
|
708
|
-
memoryPersistence: true,
|
|
709
|
-
},
|
|
710
|
-
previousSession: restoreLatest ? {
|
|
711
|
-
id: `session-${Date.now() - 86400000}`,
|
|
712
|
-
tasksRestored: 3,
|
|
713
|
-
memoryRestored: 15,
|
|
714
|
-
} : null,
|
|
715
|
-
};
|
|
716
|
-
},
|
|
717
|
-
};
|
|
718
|
-
|
|
719
|
-
// Session end hook
|
|
720
|
-
export const hooksSessionEnd: MCPTool = {
|
|
721
|
-
name: 'hooks/session-end',
|
|
722
|
-
description: 'End current session and persist state',
|
|
723
|
-
inputSchema: {
|
|
724
|
-
type: 'object',
|
|
725
|
-
properties: {
|
|
726
|
-
saveState: { type: 'boolean', description: 'Save session state' },
|
|
727
|
-
exportMetrics: { type: 'boolean', description: 'Export session metrics' },
|
|
728
|
-
},
|
|
729
|
-
},
|
|
730
|
-
handler: async (params: Record<string, unknown>) => {
|
|
731
|
-
const saveState = params.saveState !== false;
|
|
732
|
-
const sessionId = `session-${Date.now() - 3600000}`; // Default session (1 hour ago)
|
|
733
|
-
|
|
734
|
-
return {
|
|
735
|
-
sessionId,
|
|
736
|
-
duration: 3600000, // 1 hour in ms
|
|
737
|
-
statePath: saveState ? `.claude/sessions/${sessionId}.json` : undefined,
|
|
738
|
-
summary: {
|
|
739
|
-
tasksExecuted: 12,
|
|
740
|
-
tasksSucceeded: 10,
|
|
741
|
-
tasksFailed: 2,
|
|
742
|
-
commandsExecuted: 45,
|
|
743
|
-
filesModified: 23,
|
|
744
|
-
agentsSpawned: 5,
|
|
745
|
-
},
|
|
746
|
-
learningUpdates: {
|
|
747
|
-
patternsLearned: 8,
|
|
748
|
-
trajectoriesRecorded: 12,
|
|
749
|
-
confidenceImproved: 0.05,
|
|
750
|
-
},
|
|
751
|
-
};
|
|
752
|
-
},
|
|
753
|
-
};
|
|
754
|
-
|
|
755
|
-
// Session restore hook
|
|
756
|
-
export const hooksSessionRestore: MCPTool = {
|
|
757
|
-
name: 'hooks/session-restore',
|
|
758
|
-
description: 'Restore a previous session',
|
|
759
|
-
inputSchema: {
|
|
760
|
-
type: 'object',
|
|
761
|
-
properties: {
|
|
762
|
-
sessionId: { type: 'string', description: 'Session ID to restore (or "latest")' },
|
|
763
|
-
restoreAgents: { type: 'boolean', description: 'Restore spawned agents' },
|
|
764
|
-
restoreTasks: { type: 'boolean', description: 'Restore active tasks' },
|
|
765
|
-
},
|
|
766
|
-
},
|
|
767
|
-
handler: async (params: Record<string, unknown>) => {
|
|
768
|
-
const requestedId = (params.sessionId as string) || 'latest';
|
|
769
|
-
const restoreAgents = params.restoreAgents !== false;
|
|
770
|
-
const restoreTasks = params.restoreTasks !== false;
|
|
771
|
-
|
|
772
|
-
const originalSessionId = requestedId === 'latest' ? `session-${Date.now() - 86400000}` : requestedId;
|
|
773
|
-
const newSessionId = `session-${Date.now()}`;
|
|
774
|
-
|
|
775
|
-
return {
|
|
776
|
-
sessionId: newSessionId,
|
|
777
|
-
originalSessionId,
|
|
778
|
-
restoredState: {
|
|
779
|
-
tasksRestored: restoreTasks ? 5 : 0,
|
|
780
|
-
agentsRestored: restoreAgents ? 3 : 0,
|
|
781
|
-
memoryRestored: 42,
|
|
782
|
-
},
|
|
783
|
-
warnings: restoreTasks ? ['2 tasks were in progress and may need review'] : undefined,
|
|
784
|
-
};
|
|
785
|
-
},
|
|
786
|
-
};
|
|
787
|
-
|
|
788
|
-
// Notify hook - cross-agent notifications
|
|
789
|
-
export const hooksNotify: MCPTool = {
|
|
790
|
-
name: 'hooks/notify',
|
|
791
|
-
description: 'Send cross-agent notification',
|
|
792
|
-
inputSchema: {
|
|
793
|
-
type: 'object',
|
|
794
|
-
properties: {
|
|
795
|
-
message: { type: 'string', description: 'Notification message' },
|
|
796
|
-
target: { type: 'string', description: 'Target agent or "all"' },
|
|
797
|
-
priority: { type: 'string', description: 'Priority level (low, normal, high, urgent)' },
|
|
798
|
-
data: { type: 'object', description: 'Additional data payload' },
|
|
799
|
-
},
|
|
800
|
-
required: ['message'],
|
|
801
|
-
},
|
|
802
|
-
handler: async (params: Record<string, unknown>) => {
|
|
803
|
-
const message = params.message as string;
|
|
804
|
-
const target = (params.target as string) || 'all';
|
|
805
|
-
const priority = (params.priority as string) || 'normal';
|
|
806
|
-
|
|
807
|
-
return {
|
|
808
|
-
notificationId: `notify-${Date.now()}`,
|
|
809
|
-
message,
|
|
810
|
-
target,
|
|
811
|
-
priority,
|
|
812
|
-
delivered: true,
|
|
813
|
-
recipients: target === 'all' ? ['coder', 'architect', 'tester', 'reviewer'] : [target],
|
|
814
|
-
timestamp: new Date().toISOString(),
|
|
815
|
-
};
|
|
816
|
-
},
|
|
817
|
-
};
|
|
818
|
-
|
|
819
|
-
// Init hook - initialize hooks in project
|
|
820
|
-
export const hooksInit: MCPTool = {
|
|
821
|
-
name: 'hooks/init',
|
|
822
|
-
description: 'Initialize hooks in project with .claude/settings.json',
|
|
823
|
-
inputSchema: {
|
|
824
|
-
type: 'object',
|
|
825
|
-
properties: {
|
|
826
|
-
path: { type: 'string', description: 'Project path' },
|
|
827
|
-
template: { type: 'string', description: 'Template to use (minimal, standard, full)' },
|
|
828
|
-
force: { type: 'boolean', description: 'Overwrite existing configuration' },
|
|
829
|
-
},
|
|
830
|
-
},
|
|
831
|
-
handler: async (params: Record<string, unknown>) => {
|
|
832
|
-
const path = (params.path as string) || '.';
|
|
833
|
-
const template = (params.template as string) || 'standard';
|
|
834
|
-
const force = params.force as boolean;
|
|
835
|
-
|
|
836
|
-
const hooksConfigured = template === 'minimal' ? 4 : template === 'full' ? 16 : 9;
|
|
837
|
-
|
|
838
|
-
return {
|
|
839
|
-
path,
|
|
840
|
-
template,
|
|
841
|
-
created: {
|
|
842
|
-
settingsJson: `${path}/.claude/settings.json`,
|
|
843
|
-
hooksDir: `${path}/.claude/hooks`,
|
|
844
|
-
},
|
|
845
|
-
hooks: {
|
|
846
|
-
configured: hooksConfigured,
|
|
847
|
-
types: ['PreToolUse', 'PostToolUse', 'SessionStart', 'SessionEnd'],
|
|
848
|
-
},
|
|
849
|
-
intelligence: {
|
|
850
|
-
enabled: template !== 'minimal',
|
|
851
|
-
sona: template === 'full',
|
|
852
|
-
moe: template === 'full',
|
|
853
|
-
hnsw: template !== 'minimal',
|
|
854
|
-
},
|
|
855
|
-
overwritten: force,
|
|
856
|
-
};
|
|
857
|
-
},
|
|
858
|
-
};
|
|
859
|
-
|
|
860
|
-
// Intelligence hook - RuVector intelligence system
|
|
861
|
-
export const hooksIntelligence: MCPTool = {
|
|
862
|
-
name: 'hooks/intelligence',
|
|
863
|
-
description: 'RuVector intelligence system (SONA, MoE, HNSW 150x faster)',
|
|
864
|
-
inputSchema: {
|
|
865
|
-
type: 'object',
|
|
866
|
-
properties: {
|
|
867
|
-
mode: { type: 'string', description: 'Intelligence mode' },
|
|
868
|
-
enableSona: { type: 'boolean', description: 'Enable SONA learning' },
|
|
869
|
-
enableMoe: { type: 'boolean', description: 'Enable MoE routing' },
|
|
870
|
-
enableHnsw: { type: 'boolean', description: 'Enable HNSW search' },
|
|
871
|
-
forceTraining: { type: 'boolean', description: 'Force training cycle' },
|
|
872
|
-
showStatus: { type: 'boolean', description: 'Show status only' },
|
|
873
|
-
},
|
|
874
|
-
},
|
|
875
|
-
handler: async (params: Record<string, unknown>) => {
|
|
876
|
-
const mode = (params.mode as string) || 'balanced';
|
|
877
|
-
const enableSona = params.enableSona !== false;
|
|
878
|
-
const enableMoe = params.enableMoe !== false;
|
|
879
|
-
const enableHnsw = params.enableHnsw !== false;
|
|
880
|
-
|
|
881
|
-
return {
|
|
882
|
-
mode,
|
|
883
|
-
status: 'active',
|
|
884
|
-
components: {
|
|
885
|
-
sona: {
|
|
886
|
-
enabled: enableSona,
|
|
887
|
-
status: enableSona ? 'active' : 'disabled',
|
|
888
|
-
learningTimeMs: 0.042,
|
|
889
|
-
adaptationTimeMs: 0.018,
|
|
890
|
-
trajectoriesRecorded: 156,
|
|
891
|
-
patternsLearned: 89,
|
|
892
|
-
avgQuality: 0.87,
|
|
893
|
-
},
|
|
894
|
-
moe: {
|
|
895
|
-
enabled: enableMoe,
|
|
896
|
-
status: enableMoe ? 'active' : 'disabled',
|
|
897
|
-
expertsActive: 8,
|
|
898
|
-
routingAccuracy: 0.92,
|
|
899
|
-
loadBalance: 0.85,
|
|
900
|
-
},
|
|
901
|
-
hnsw: {
|
|
902
|
-
enabled: enableHnsw,
|
|
903
|
-
status: enableHnsw ? 'ready' : 'disabled',
|
|
904
|
-
indexSize: 12500,
|
|
905
|
-
searchSpeedup: '150x',
|
|
906
|
-
memoryUsage: '45MB',
|
|
907
|
-
dimension: 384,
|
|
908
|
-
},
|
|
909
|
-
embeddings: {
|
|
910
|
-
provider: 'transformers',
|
|
911
|
-
model: 'all-MiniLM-L6-v2',
|
|
912
|
-
dimension: 384,
|
|
913
|
-
cacheHitRate: 0.78,
|
|
914
|
-
},
|
|
915
|
-
},
|
|
916
|
-
performance: {
|
|
917
|
-
flashAttention: '2.49x-7.47x speedup',
|
|
918
|
-
memoryReduction: '50-75% reduction',
|
|
919
|
-
searchImprovement: '150x-12,500x faster',
|
|
920
|
-
tokenReduction: '32.3% fewer tokens',
|
|
921
|
-
sweBenchScore: '84.8%',
|
|
922
|
-
},
|
|
923
|
-
lastTrainingMs: 0.042,
|
|
924
|
-
};
|
|
925
|
-
},
|
|
926
|
-
};
|
|
927
|
-
|
|
928
|
-
// Intelligence reset hook
|
|
929
|
-
export const hooksIntelligenceReset: MCPTool = {
|
|
930
|
-
name: 'hooks/intelligence-reset',
|
|
931
|
-
description: 'Reset intelligence learning state',
|
|
932
|
-
inputSchema: {
|
|
933
|
-
type: 'object',
|
|
934
|
-
properties: {},
|
|
935
|
-
},
|
|
936
|
-
handler: async () => {
|
|
937
|
-
return {
|
|
938
|
-
reset: true,
|
|
939
|
-
cleared: {
|
|
940
|
-
trajectories: 156,
|
|
941
|
-
patterns: 89,
|
|
942
|
-
hnswIndex: 12500,
|
|
943
|
-
},
|
|
944
|
-
timestamp: new Date().toISOString(),
|
|
945
|
-
};
|
|
946
|
-
},
|
|
947
|
-
};
|
|
948
|
-
|
|
949
|
-
// Intelligence trajectory hooks
|
|
950
|
-
export const hooksTrajectoryStart: MCPTool = {
|
|
951
|
-
name: 'hooks/intelligence/trajectory-start',
|
|
952
|
-
description: 'Begin SONA trajectory for reinforcement learning',
|
|
953
|
-
inputSchema: {
|
|
954
|
-
type: 'object',
|
|
955
|
-
properties: {
|
|
956
|
-
task: { type: 'string', description: 'Task description' },
|
|
957
|
-
agent: { type: 'string', description: 'Agent type' },
|
|
958
|
-
},
|
|
959
|
-
required: ['task'],
|
|
960
|
-
},
|
|
961
|
-
handler: async (params: Record<string, unknown>) => {
|
|
962
|
-
const task = params.task as string;
|
|
963
|
-
const agent = (params.agent as string) || 'coder';
|
|
964
|
-
const trajectoryId = `traj-${Date.now()}`;
|
|
965
|
-
|
|
966
|
-
return {
|
|
967
|
-
trajectoryId,
|
|
968
|
-
task,
|
|
969
|
-
agent,
|
|
970
|
-
started: new Date().toISOString(),
|
|
971
|
-
status: 'recording',
|
|
972
|
-
};
|
|
973
|
-
},
|
|
974
|
-
};
|
|
975
|
-
|
|
976
|
-
export const hooksTrajectoryStep: MCPTool = {
|
|
977
|
-
name: 'hooks/intelligence/trajectory-step',
|
|
978
|
-
description: 'Record step in trajectory for reinforcement learning',
|
|
979
|
-
inputSchema: {
|
|
980
|
-
type: 'object',
|
|
981
|
-
properties: {
|
|
982
|
-
trajectoryId: { type: 'string', description: 'Trajectory ID' },
|
|
983
|
-
action: { type: 'string', description: 'Action taken' },
|
|
984
|
-
result: { type: 'string', description: 'Action result' },
|
|
985
|
-
quality: { type: 'number', description: 'Quality score (0-1)' },
|
|
986
|
-
},
|
|
987
|
-
required: ['trajectoryId', 'action'],
|
|
988
|
-
},
|
|
989
|
-
handler: async (params: Record<string, unknown>) => {
|
|
990
|
-
const trajectoryId = params.trajectoryId as string;
|
|
991
|
-
const action = params.action as string;
|
|
992
|
-
const result = (params.result as string) || 'success';
|
|
993
|
-
const quality = (params.quality as number) || 0.85;
|
|
994
|
-
|
|
995
|
-
return {
|
|
996
|
-
trajectoryId,
|
|
997
|
-
stepId: `step-${Date.now()}`,
|
|
998
|
-
action,
|
|
999
|
-
result,
|
|
1000
|
-
quality,
|
|
1001
|
-
recorded: true,
|
|
1002
|
-
timestamp: new Date().toISOString(),
|
|
1003
|
-
};
|
|
1004
|
-
},
|
|
1005
|
-
};
|
|
1006
|
-
|
|
1007
|
-
export const hooksTrajectoryEnd: MCPTool = {
|
|
1008
|
-
name: 'hooks/intelligence/trajectory-end',
|
|
1009
|
-
description: 'End trajectory and trigger SONA learning with EWC++',
|
|
1010
|
-
inputSchema: {
|
|
1011
|
-
type: 'object',
|
|
1012
|
-
properties: {
|
|
1013
|
-
trajectoryId: { type: 'string', description: 'Trajectory ID' },
|
|
1014
|
-
success: { type: 'boolean', description: 'Overall success' },
|
|
1015
|
-
feedback: { type: 'string', description: 'Optional feedback' },
|
|
1016
|
-
},
|
|
1017
|
-
required: ['trajectoryId'],
|
|
1018
|
-
},
|
|
1019
|
-
handler: async (params: Record<string, unknown>) => {
|
|
1020
|
-
const trajectoryId = params.trajectoryId as string;
|
|
1021
|
-
const success = params.success !== false;
|
|
1022
|
-
|
|
1023
|
-
return {
|
|
1024
|
-
trajectoryId,
|
|
1025
|
-
success,
|
|
1026
|
-
ended: new Date().toISOString(),
|
|
1027
|
-
learning: {
|
|
1028
|
-
sonaUpdate: true,
|
|
1029
|
-
ewcConsolidation: success,
|
|
1030
|
-
patternsExtracted: success ? 3 : 1,
|
|
1031
|
-
learningTimeMs: 0.038,
|
|
1032
|
-
},
|
|
1033
|
-
};
|
|
1034
|
-
},
|
|
1035
|
-
};
|
|
1036
|
-
|
|
1037
|
-
// Pattern store/search hooks
|
|
1038
|
-
export const hooksPatternStore: MCPTool = {
|
|
1039
|
-
name: 'hooks/intelligence/pattern-store',
|
|
1040
|
-
description: 'Store pattern in ReasoningBank (HNSW-indexed)',
|
|
1041
|
-
inputSchema: {
|
|
1042
|
-
type: 'object',
|
|
1043
|
-
properties: {
|
|
1044
|
-
pattern: { type: 'string', description: 'Pattern description' },
|
|
1045
|
-
type: { type: 'string', description: 'Pattern type' },
|
|
1046
|
-
confidence: { type: 'number', description: 'Confidence score' },
|
|
1047
|
-
metadata: { type: 'object', description: 'Additional metadata' },
|
|
1048
|
-
},
|
|
1049
|
-
required: ['pattern'],
|
|
1050
|
-
},
|
|
1051
|
-
handler: async (params: Record<string, unknown>) => {
|
|
1052
|
-
const pattern = params.pattern as string;
|
|
1053
|
-
const type = (params.type as string) || 'general';
|
|
1054
|
-
const confidence = (params.confidence as number) || 0.8;
|
|
1055
|
-
|
|
1056
|
-
return {
|
|
1057
|
-
patternId: `pattern-${Date.now()}`,
|
|
1058
|
-
pattern,
|
|
1059
|
-
type,
|
|
1060
|
-
confidence,
|
|
1061
|
-
indexed: true,
|
|
1062
|
-
hnswNode: Math.floor(Math.random() * 10000),
|
|
1063
|
-
timestamp: new Date().toISOString(),
|
|
1064
|
-
};
|
|
1065
|
-
},
|
|
1066
|
-
};
|
|
1067
|
-
|
|
1068
|
-
export const hooksPatternSearch: MCPTool = {
|
|
1069
|
-
name: 'hooks/intelligence/pattern-search',
|
|
1070
|
-
description: 'Search ReasoningBank using HNSW (150x faster)',
|
|
1071
|
-
inputSchema: {
|
|
1072
|
-
type: 'object',
|
|
1073
|
-
properties: {
|
|
1074
|
-
query: { type: 'string', description: 'Search query' },
|
|
1075
|
-
topK: { type: 'number', description: 'Number of results' },
|
|
1076
|
-
minConfidence: { type: 'number', description: 'Minimum confidence' },
|
|
1077
|
-
},
|
|
1078
|
-
required: ['query'],
|
|
1079
|
-
},
|
|
1080
|
-
handler: async (params: Record<string, unknown>) => {
|
|
1081
|
-
const query = params.query as string;
|
|
1082
|
-
const topK = (params.topK as number) || 5;
|
|
1083
|
-
const minConfidence = (params.minConfidence as number) || 0.6;
|
|
1084
|
-
|
|
1085
|
-
// Generate mock results based on query
|
|
1086
|
-
const results: Array<{ patternId: string; pattern: string; similarity: number; confidence: number; type: string }> = [];
|
|
1087
|
-
for (let i = 0; i < topK; i++) {
|
|
1088
|
-
results.push({
|
|
1089
|
-
patternId: `pattern-${Date.now() - i * 1000}`,
|
|
1090
|
-
pattern: `Pattern matching "${query}" #${i + 1}`,
|
|
1091
|
-
similarity: 0.95 - (i * 0.08),
|
|
1092
|
-
confidence: Math.max(minConfidence, 0.9 - (i * 0.05)),
|
|
1093
|
-
type: ['file-edit', 'task-routing', 'command-risk'][i % 3],
|
|
1094
|
-
});
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
|
-
return {
|
|
1098
|
-
query,
|
|
1099
|
-
results,
|
|
1100
|
-
searchTimeMs: 0.12,
|
|
1101
|
-
hnswNodesVisited: 45,
|
|
1102
|
-
speedup: '150x vs brute-force',
|
|
1103
|
-
};
|
|
1104
|
-
},
|
|
1105
|
-
};
|
|
1106
|
-
|
|
1107
|
-
// Intelligence stats hook
|
|
1108
|
-
export const hooksIntelligenceStats: MCPTool = {
|
|
1109
|
-
name: 'hooks/intelligence/stats',
|
|
1110
|
-
description: 'Get RuVector intelligence layer statistics',
|
|
1111
|
-
inputSchema: {
|
|
1112
|
-
type: 'object',
|
|
1113
|
-
properties: {
|
|
1114
|
-
detailed: { type: 'boolean', description: 'Include detailed stats' },
|
|
1115
|
-
},
|
|
1116
|
-
},
|
|
1117
|
-
handler: async (params: Record<string, unknown>) => {
|
|
1118
|
-
const detailed = params.detailed as boolean;
|
|
1119
|
-
|
|
1120
|
-
const stats = {
|
|
1121
|
-
sona: {
|
|
1122
|
-
trajectoriesTotal: 256,
|
|
1123
|
-
trajectoriesSuccessful: 218,
|
|
1124
|
-
avgLearningTimeMs: 0.042,
|
|
1125
|
-
patternsLearned: 189,
|
|
1126
|
-
},
|
|
1127
|
-
moe: {
|
|
1128
|
-
expertsTotal: 12,
|
|
1129
|
-
expertsActive: 8,
|
|
1130
|
-
routingDecisions: 1542,
|
|
1131
|
-
avgRoutingTimeMs: 0.15,
|
|
1132
|
-
},
|
|
1133
|
-
hnsw: {
|
|
1134
|
-
indexSize: 12500,
|
|
1135
|
-
avgSearchTimeMs: 0.12,
|
|
1136
|
-
cacheHitRate: 0.78,
|
|
1137
|
-
memoryUsageMb: 45,
|
|
1138
|
-
},
|
|
1139
|
-
ewc: {
|
|
1140
|
-
consolidations: 89,
|
|
1141
|
-
catastrophicForgettingPrevented: 12,
|
|
1142
|
-
fisherUpdates: 256,
|
|
1143
|
-
},
|
|
1144
|
-
};
|
|
1145
|
-
|
|
1146
|
-
if (detailed) {
|
|
1147
|
-
return {
|
|
1148
|
-
...stats,
|
|
1149
|
-
performance: {
|
|
1150
|
-
p50LatencyMs: 0.08,
|
|
1151
|
-
p95LatencyMs: 0.25,
|
|
1152
|
-
p99LatencyMs: 0.42,
|
|
1153
|
-
throughput: 15000,
|
|
1154
|
-
},
|
|
1155
|
-
memory: {
|
|
1156
|
-
sonaBufferMb: 12,
|
|
1157
|
-
moeWeightsMb: 8,
|
|
1158
|
-
hnswIndexMb: 45,
|
|
1159
|
-
embeddingCacheMb: 25,
|
|
1160
|
-
},
|
|
1161
|
-
};
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
return stats;
|
|
1165
|
-
},
|
|
1166
|
-
};
|
|
1167
|
-
|
|
1168
|
-
// Intelligence learn hook
|
|
1169
|
-
export const hooksIntelligenceLearn: MCPTool = {
|
|
1170
|
-
name: 'hooks/intelligence/learn',
|
|
1171
|
-
description: 'Force immediate SONA learning cycle with EWC++ consolidation',
|
|
1172
|
-
inputSchema: {
|
|
1173
|
-
type: 'object',
|
|
1174
|
-
properties: {
|
|
1175
|
-
trajectoryIds: { type: 'array', description: 'Specific trajectories to learn from' },
|
|
1176
|
-
consolidate: { type: 'boolean', description: 'Run EWC++ consolidation' },
|
|
1177
|
-
},
|
|
1178
|
-
},
|
|
1179
|
-
handler: async (params: Record<string, unknown>) => {
|
|
1180
|
-
const consolidate = params.consolidate !== false;
|
|
1181
|
-
const startTime = Date.now();
|
|
1182
|
-
|
|
1183
|
-
return {
|
|
1184
|
-
learned: true,
|
|
1185
|
-
duration: Date.now() - startTime + 15,
|
|
1186
|
-
updates: {
|
|
1187
|
-
trajectoriesProcessed: 12,
|
|
1188
|
-
patternsExtracted: 8,
|
|
1189
|
-
patternsReinforced: 15,
|
|
1190
|
-
patternsDeprecated: 2,
|
|
1191
|
-
},
|
|
1192
|
-
ewc: consolidate ? {
|
|
1193
|
-
consolidation: true,
|
|
1194
|
-
fisherUpdated: true,
|
|
1195
|
-
forgettingPrevented: 3,
|
|
1196
|
-
} : null,
|
|
1197
|
-
newConfidences: {
|
|
1198
|
-
avgIncrease: 0.05,
|
|
1199
|
-
maxIncrease: 0.12,
|
|
1200
|
-
},
|
|
1201
|
-
};
|
|
1202
|
-
},
|
|
1203
|
-
};
|
|
1204
|
-
|
|
1205
|
-
// Intelligence attention hook
|
|
1206
|
-
export const hooksIntelligenceAttention: MCPTool = {
|
|
1207
|
-
name: 'hooks/intelligence/attention',
|
|
1208
|
-
description: 'Compute attention-weighted similarity using MoE/Flash/Hyperbolic',
|
|
1209
|
-
inputSchema: {
|
|
1210
|
-
type: 'object',
|
|
1211
|
-
properties: {
|
|
1212
|
-
query: { type: 'string', description: 'Query for attention computation' },
|
|
1213
|
-
mode: { type: 'string', description: 'Attention mode (flash, moe, hyperbolic)' },
|
|
1214
|
-
topK: { type: 'number', description: 'Top-k results' },
|
|
1215
|
-
},
|
|
1216
|
-
required: ['query'],
|
|
1217
|
-
},
|
|
1218
|
-
handler: async (params: Record<string, unknown>) => {
|
|
1219
|
-
const query = params.query as string;
|
|
1220
|
-
const mode = (params.mode as string) || 'flash';
|
|
1221
|
-
const topK = (params.topK as number) || 5;
|
|
1222
|
-
|
|
1223
|
-
const attentionWeights: Array<{ index: number; weight: number; pattern: string }> = [];
|
|
1224
|
-
for (let i = 0; i < topK; i++) {
|
|
1225
|
-
attentionWeights.push({
|
|
1226
|
-
index: i,
|
|
1227
|
-
weight: Math.exp(-i * 0.5) / (1 + Math.exp(-i * 0.5)),
|
|
1228
|
-
pattern: `Attention target #${i + 1}`,
|
|
1229
|
-
});
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
return {
|
|
1233
|
-
query,
|
|
1234
|
-
mode,
|
|
1235
|
-
results: attentionWeights,
|
|
1236
|
-
stats: {
|
|
1237
|
-
computeTimeMs: mode === 'flash' ? 0.15 : mode === 'hyperbolic' ? 0.35 : 0.25,
|
|
1238
|
-
speedup: mode === 'flash' ? '2.49x-7.47x' : '1.5x-2x',
|
|
1239
|
-
memoryReduction: mode === 'flash' ? '50-75%' : '25-40%',
|
|
1240
|
-
},
|
|
1241
|
-
};
|
|
1242
|
-
},
|
|
1243
|
-
};
|
|
1244
|
-
|
|
1245
|
-
// =============================================================================
|
|
1246
|
-
// Worker Dispatch Tools (12 Background Workers)
|
|
1247
|
-
// =============================================================================
|
|
1248
|
-
|
|
1249
|
-
/**
|
|
1250
|
-
* Worker trigger types matching agentic-flow@alpha
|
|
1251
|
-
*/
|
|
1252
|
-
type WorkerTrigger =
|
|
1253
|
-
| 'ultralearn' // Deep knowledge acquisition
|
|
1254
|
-
| 'optimize' // Performance optimization
|
|
1255
|
-
| 'consolidate' // Memory consolidation
|
|
1256
|
-
| 'predict' // Predictive preloading
|
|
1257
|
-
| 'audit' // Security analysis
|
|
1258
|
-
| 'map' // Codebase mapping
|
|
1259
|
-
| 'preload' // Resource preloading
|
|
1260
|
-
| 'deepdive' // Deep code analysis
|
|
1261
|
-
| 'document' // Auto-documentation
|
|
1262
|
-
| 'refactor' // Refactoring suggestions
|
|
1263
|
-
| 'benchmark' // Performance benchmarks
|
|
1264
|
-
| 'testgaps'; // Test coverage analysis
|
|
1265
|
-
|
|
1266
|
-
/**
|
|
1267
|
-
* Worker trigger patterns for auto-detection
|
|
1268
|
-
*/
|
|
1269
|
-
const WORKER_TRIGGER_PATTERNS: Record<WorkerTrigger, RegExp[]> = {
|
|
1270
|
-
ultralearn: [
|
|
1271
|
-
/learn\s+about/i,
|
|
1272
|
-
/understand\s+(how|what|why)/i,
|
|
1273
|
-
/deep\s+dive\s+into/i,
|
|
1274
|
-
/explain\s+in\s+detail/i,
|
|
1275
|
-
/comprehensive\s+guide/i,
|
|
1276
|
-
/master\s+this/i,
|
|
1277
|
-
],
|
|
1278
|
-
optimize: [
|
|
1279
|
-
/optimize/i,
|
|
1280
|
-
/improve\s+performance/i,
|
|
1281
|
-
/make\s+(it\s+)?faster/i,
|
|
1282
|
-
/speed\s+up/i,
|
|
1283
|
-
/reduce\s+(memory|time)/i,
|
|
1284
|
-
/performance\s+issue/i,
|
|
1285
|
-
],
|
|
1286
|
-
consolidate: [
|
|
1287
|
-
/consolidate/i,
|
|
1288
|
-
/merge\s+memories/i,
|
|
1289
|
-
/clean\s+up\s+memory/i,
|
|
1290
|
-
/deduplicate/i,
|
|
1291
|
-
/memory\s+maintenance/i,
|
|
1292
|
-
],
|
|
1293
|
-
predict: [
|
|
1294
|
-
/what\s+will\s+happen/i,
|
|
1295
|
-
/predict/i,
|
|
1296
|
-
/forecast/i,
|
|
1297
|
-
/anticipate/i,
|
|
1298
|
-
/preload/i,
|
|
1299
|
-
/prepare\s+for/i,
|
|
1300
|
-
],
|
|
1301
|
-
audit: [
|
|
1302
|
-
/security\s+audit/i,
|
|
1303
|
-
/vulnerability/i,
|
|
1304
|
-
/security\s+check/i,
|
|
1305
|
-
/pentest/i,
|
|
1306
|
-
/security\s+scan/i,
|
|
1307
|
-
/cve/i,
|
|
1308
|
-
/owasp/i,
|
|
1309
|
-
],
|
|
1310
|
-
map: [
|
|
1311
|
-
/map\s+(the\s+)?codebase/i,
|
|
1312
|
-
/architecture\s+overview/i,
|
|
1313
|
-
/project\s+structure/i,
|
|
1314
|
-
/dependency\s+graph/i,
|
|
1315
|
-
/code\s+map/i,
|
|
1316
|
-
/explore\s+codebase/i,
|
|
1317
|
-
],
|
|
1318
|
-
preload: [
|
|
1319
|
-
/preload/i,
|
|
1320
|
-
/cache\s+ahead/i,
|
|
1321
|
-
/prefetch/i,
|
|
1322
|
-
/warm\s+(up\s+)?cache/i,
|
|
1323
|
-
],
|
|
1324
|
-
deepdive: [
|
|
1325
|
-
/deep\s+dive/i,
|
|
1326
|
-
/analyze\s+thoroughly/i,
|
|
1327
|
-
/in-depth\s+analysis/i,
|
|
1328
|
-
/comprehensive\s+review/i,
|
|
1329
|
-
/detailed\s+examination/i,
|
|
1330
|
-
],
|
|
1331
|
-
document: [
|
|
1332
|
-
/document\s+(this|the)/i,
|
|
1333
|
-
/generate\s+docs/i,
|
|
1334
|
-
/add\s+documentation/i,
|
|
1335
|
-
/write\s+readme/i,
|
|
1336
|
-
/api\s+docs/i,
|
|
1337
|
-
/jsdoc/i,
|
|
1338
|
-
],
|
|
1339
|
-
refactor: [
|
|
1340
|
-
/refactor/i,
|
|
1341
|
-
/clean\s+up\s+code/i,
|
|
1342
|
-
/improve\s+code\s+quality/i,
|
|
1343
|
-
/restructure/i,
|
|
1344
|
-
/simplify/i,
|
|
1345
|
-
/make\s+more\s+readable/i,
|
|
1346
|
-
],
|
|
1347
|
-
benchmark: [
|
|
1348
|
-
/benchmark/i,
|
|
1349
|
-
/performance\s+test/i,
|
|
1350
|
-
/measure\s+speed/i,
|
|
1351
|
-
/stress\s+test/i,
|
|
1352
|
-
/load\s+test/i,
|
|
1353
|
-
],
|
|
1354
|
-
testgaps: [
|
|
1355
|
-
/test\s+coverage/i,
|
|
1356
|
-
/missing\s+tests/i,
|
|
1357
|
-
/untested\s+code/i,
|
|
1358
|
-
/coverage\s+report/i,
|
|
1359
|
-
/test\s+gaps/i,
|
|
1360
|
-
/add\s+tests/i,
|
|
1361
|
-
],
|
|
1362
|
-
};
|
|
1363
|
-
|
|
1364
|
-
/**
|
|
1365
|
-
* Worker configurations
|
|
1366
|
-
*/
|
|
1367
|
-
const WORKER_CONFIGS: Record<WorkerTrigger, {
|
|
1368
|
-
description: string;
|
|
1369
|
-
priority: 'low' | 'normal' | 'high' | 'critical';
|
|
1370
|
-
estimatedDuration: string;
|
|
1371
|
-
capabilities: string[];
|
|
1372
|
-
}> = {
|
|
1373
|
-
ultralearn: {
|
|
1374
|
-
description: 'Deep knowledge acquisition and learning',
|
|
1375
|
-
priority: 'normal',
|
|
1376
|
-
estimatedDuration: '60s',
|
|
1377
|
-
capabilities: ['research', 'analysis', 'synthesis'],
|
|
1378
|
-
},
|
|
1379
|
-
optimize: {
|
|
1380
|
-
description: 'Performance optimization and tuning',
|
|
1381
|
-
priority: 'high',
|
|
1382
|
-
estimatedDuration: '30s',
|
|
1383
|
-
capabilities: ['profiling', 'optimization', 'benchmarking'],
|
|
1384
|
-
},
|
|
1385
|
-
consolidate: {
|
|
1386
|
-
description: 'Memory consolidation and cleanup',
|
|
1387
|
-
priority: 'low',
|
|
1388
|
-
estimatedDuration: '20s',
|
|
1389
|
-
capabilities: ['memory-management', 'deduplication'],
|
|
1390
|
-
},
|
|
1391
|
-
predict: {
|
|
1392
|
-
description: 'Predictive preloading and anticipation',
|
|
1393
|
-
priority: 'normal',
|
|
1394
|
-
estimatedDuration: '15s',
|
|
1395
|
-
capabilities: ['prediction', 'caching', 'preloading'],
|
|
1396
|
-
},
|
|
1397
|
-
audit: {
|
|
1398
|
-
description: 'Security analysis and vulnerability scanning',
|
|
1399
|
-
priority: 'critical',
|
|
1400
|
-
estimatedDuration: '45s',
|
|
1401
|
-
capabilities: ['security', 'vulnerability-scanning', 'audit'],
|
|
1402
|
-
},
|
|
1403
|
-
map: {
|
|
1404
|
-
description: 'Codebase mapping and architecture analysis',
|
|
1405
|
-
priority: 'normal',
|
|
1406
|
-
estimatedDuration: '30s',
|
|
1407
|
-
capabilities: ['analysis', 'mapping', 'visualization'],
|
|
1408
|
-
},
|
|
1409
|
-
preload: {
|
|
1410
|
-
description: 'Resource preloading and cache warming',
|
|
1411
|
-
priority: 'low',
|
|
1412
|
-
estimatedDuration: '10s',
|
|
1413
|
-
capabilities: ['caching', 'preloading'],
|
|
1414
|
-
},
|
|
1415
|
-
deepdive: {
|
|
1416
|
-
description: 'Deep code analysis and examination',
|
|
1417
|
-
priority: 'normal',
|
|
1418
|
-
estimatedDuration: '60s',
|
|
1419
|
-
capabilities: ['analysis', 'review', 'understanding'],
|
|
1420
|
-
},
|
|
1421
|
-
document: {
|
|
1422
|
-
description: 'Auto-documentation generation',
|
|
1423
|
-
priority: 'normal',
|
|
1424
|
-
estimatedDuration: '45s',
|
|
1425
|
-
capabilities: ['documentation', 'writing', 'generation'],
|
|
1426
|
-
},
|
|
1427
|
-
refactor: {
|
|
1428
|
-
description: 'Code refactoring suggestions',
|
|
1429
|
-
priority: 'normal',
|
|
1430
|
-
estimatedDuration: '30s',
|
|
1431
|
-
capabilities: ['refactoring', 'code-quality', 'improvement'],
|
|
1432
|
-
},
|
|
1433
|
-
benchmark: {
|
|
1434
|
-
description: 'Performance benchmarking',
|
|
1435
|
-
priority: 'normal',
|
|
1436
|
-
estimatedDuration: '60s',
|
|
1437
|
-
capabilities: ['benchmarking', 'testing', 'measurement'],
|
|
1438
|
-
},
|
|
1439
|
-
testgaps: {
|
|
1440
|
-
description: 'Test coverage analysis',
|
|
1441
|
-
priority: 'normal',
|
|
1442
|
-
estimatedDuration: '30s',
|
|
1443
|
-
capabilities: ['testing', 'coverage', 'analysis'],
|
|
1444
|
-
},
|
|
1445
|
-
};
|
|
1446
|
-
|
|
1447
|
-
// In-memory worker tracking
|
|
1448
|
-
const activeWorkers: Map<string, {
|
|
1449
|
-
id: string;
|
|
1450
|
-
trigger: WorkerTrigger;
|
|
1451
|
-
context: string;
|
|
1452
|
-
status: 'pending' | 'running' | 'completed' | 'failed';
|
|
1453
|
-
progress: number;
|
|
1454
|
-
phase: string;
|
|
1455
|
-
startedAt: Date;
|
|
1456
|
-
completedAt?: Date;
|
|
1457
|
-
}> = new Map();
|
|
1458
|
-
|
|
1459
|
-
let workerIdCounter = 0;
|
|
1460
|
-
|
|
1461
|
-
/**
|
|
1462
|
-
* Detect triggers from prompt text
|
|
1463
|
-
*/
|
|
1464
|
-
function detectWorkerTriggers(text: string): {
|
|
1465
|
-
detected: boolean;
|
|
1466
|
-
triggers: WorkerTrigger[];
|
|
1467
|
-
confidence: number;
|
|
1468
|
-
context: string;
|
|
1469
|
-
} {
|
|
1470
|
-
const detectedTriggers: WorkerTrigger[] = [];
|
|
1471
|
-
let totalMatches = 0;
|
|
1472
|
-
|
|
1473
|
-
for (const [trigger, patterns] of Object.entries(WORKER_TRIGGER_PATTERNS) as [WorkerTrigger, RegExp[]][]) {
|
|
1474
|
-
for (const pattern of patterns) {
|
|
1475
|
-
if (pattern.test(text)) {
|
|
1476
|
-
if (!detectedTriggers.includes(trigger)) {
|
|
1477
|
-
detectedTriggers.push(trigger);
|
|
1478
|
-
}
|
|
1479
|
-
totalMatches++;
|
|
1480
|
-
}
|
|
1481
|
-
}
|
|
1482
|
-
}
|
|
1483
|
-
|
|
1484
|
-
const confidence = detectedTriggers.length > 0
|
|
1485
|
-
? Math.min(1, totalMatches / (detectedTriggers.length * 2))
|
|
1486
|
-
: 0;
|
|
1487
|
-
|
|
1488
|
-
return {
|
|
1489
|
-
detected: detectedTriggers.length > 0,
|
|
1490
|
-
triggers: detectedTriggers,
|
|
1491
|
-
confidence,
|
|
1492
|
-
context: text.slice(0, 100),
|
|
1493
|
-
};
|
|
1494
|
-
}
|
|
1495
|
-
|
|
1496
|
-
// Worker list tool
|
|
1497
|
-
export const hooksWorkerList: MCPTool = {
|
|
1498
|
-
name: 'hooks/worker-list',
|
|
1499
|
-
description: 'List all 12 background workers with status and capabilities',
|
|
1500
|
-
inputSchema: {
|
|
1501
|
-
type: 'object',
|
|
1502
|
-
properties: {
|
|
1503
|
-
status: { type: 'string', description: 'Filter by status (all, running, completed, pending)' },
|
|
1504
|
-
includeActive: { type: 'boolean', description: 'Include active worker instances' },
|
|
1505
|
-
},
|
|
1506
|
-
},
|
|
1507
|
-
handler: async (params: Record<string, unknown>) => {
|
|
1508
|
-
const statusFilter = (params.status as string) || 'all';
|
|
1509
|
-
const includeActive = params.includeActive !== false;
|
|
1510
|
-
|
|
1511
|
-
const workers = Object.entries(WORKER_CONFIGS).map(([trigger, config]) => ({
|
|
1512
|
-
trigger,
|
|
1513
|
-
...config,
|
|
1514
|
-
patterns: WORKER_TRIGGER_PATTERNS[trigger as WorkerTrigger].length,
|
|
1515
|
-
}));
|
|
1516
|
-
|
|
1517
|
-
const activeList = includeActive
|
|
1518
|
-
? Array.from(activeWorkers.values()).filter(w =>
|
|
1519
|
-
statusFilter === 'all' || w.status === statusFilter
|
|
1520
|
-
)
|
|
1521
|
-
: [];
|
|
1522
|
-
|
|
1523
|
-
return {
|
|
1524
|
-
workers,
|
|
1525
|
-
total: 12,
|
|
1526
|
-
active: {
|
|
1527
|
-
instances: activeList,
|
|
1528
|
-
count: activeList.length,
|
|
1529
|
-
byStatus: {
|
|
1530
|
-
pending: activeList.filter(w => w.status === 'pending').length,
|
|
1531
|
-
running: activeList.filter(w => w.status === 'running').length,
|
|
1532
|
-
completed: activeList.filter(w => w.status === 'completed').length,
|
|
1533
|
-
failed: activeList.filter(w => w.status === 'failed').length,
|
|
1534
|
-
},
|
|
1535
|
-
},
|
|
1536
|
-
performanceTargets: {
|
|
1537
|
-
triggerDetection: '<5ms',
|
|
1538
|
-
workerSpawn: '<50ms',
|
|
1539
|
-
maxConcurrent: 10,
|
|
1540
|
-
},
|
|
1541
|
-
};
|
|
1542
|
-
},
|
|
1543
|
-
};
|
|
1544
|
-
|
|
1545
|
-
// Worker dispatch tool
|
|
1546
|
-
export const hooksWorkerDispatch: MCPTool = {
|
|
1547
|
-
name: 'hooks/worker-dispatch',
|
|
1548
|
-
description: 'Dispatch a background worker for analysis/optimization tasks',
|
|
1549
|
-
inputSchema: {
|
|
1550
|
-
type: 'object',
|
|
1551
|
-
properties: {
|
|
1552
|
-
trigger: {
|
|
1553
|
-
type: 'string',
|
|
1554
|
-
description: 'Worker trigger type',
|
|
1555
|
-
enum: ['ultralearn', 'optimize', 'consolidate', 'predict', 'audit', 'map', 'preload', 'deepdive', 'document', 'refactor', 'benchmark', 'testgaps'],
|
|
1556
|
-
},
|
|
1557
|
-
context: { type: 'string', description: 'Context for the worker (file path, topic, etc.)' },
|
|
1558
|
-
priority: { type: 'string', description: 'Priority (low, normal, high, critical)' },
|
|
1559
|
-
background: { type: 'boolean', description: 'Run in background (non-blocking)' },
|
|
1560
|
-
},
|
|
1561
|
-
required: ['trigger'],
|
|
1562
|
-
},
|
|
1563
|
-
handler: async (params: Record<string, unknown>) => {
|
|
1564
|
-
const trigger = params.trigger as WorkerTrigger;
|
|
1565
|
-
const context = (params.context as string) || 'default';
|
|
1566
|
-
const priority = (params.priority as string) || WORKER_CONFIGS[trigger]?.priority || 'normal';
|
|
1567
|
-
const background = params.background !== false;
|
|
1568
|
-
|
|
1569
|
-
if (!WORKER_CONFIGS[trigger]) {
|
|
1570
|
-
return {
|
|
1571
|
-
success: false,
|
|
1572
|
-
error: `Unknown worker trigger: ${trigger}`,
|
|
1573
|
-
availableTriggers: Object.keys(WORKER_CONFIGS),
|
|
1574
|
-
};
|
|
1575
|
-
}
|
|
1576
|
-
|
|
1577
|
-
const workerId = `worker_${trigger}_${++workerIdCounter}_${Date.now().toString(36)}`;
|
|
1578
|
-
const config = WORKER_CONFIGS[trigger];
|
|
1579
|
-
|
|
1580
|
-
const worker: {
|
|
1581
|
-
id: string;
|
|
1582
|
-
trigger: WorkerTrigger;
|
|
1583
|
-
context: string;
|
|
1584
|
-
status: 'pending' | 'running' | 'completed' | 'failed';
|
|
1585
|
-
progress: number;
|
|
1586
|
-
phase: string;
|
|
1587
|
-
startedAt: Date;
|
|
1588
|
-
completedAt?: Date;
|
|
1589
|
-
} = {
|
|
1590
|
-
id: workerId,
|
|
1591
|
-
trigger,
|
|
1592
|
-
context,
|
|
1593
|
-
status: 'running',
|
|
1594
|
-
progress: 0,
|
|
1595
|
-
phase: 'initializing',
|
|
1596
|
-
startedAt: new Date(),
|
|
1597
|
-
};
|
|
1598
|
-
|
|
1599
|
-
activeWorkers.set(workerId, worker);
|
|
1600
|
-
|
|
1601
|
-
// Simulate worker progress in background
|
|
1602
|
-
if (background) {
|
|
1603
|
-
setTimeout(() => {
|
|
1604
|
-
const w = activeWorkers.get(workerId);
|
|
1605
|
-
if (w) {
|
|
1606
|
-
w.progress = 50;
|
|
1607
|
-
w.phase = 'processing';
|
|
1608
|
-
}
|
|
1609
|
-
}, 500);
|
|
1610
|
-
|
|
1611
|
-
setTimeout(() => {
|
|
1612
|
-
const w = activeWorkers.get(workerId);
|
|
1613
|
-
if (w) {
|
|
1614
|
-
w.progress = 100;
|
|
1615
|
-
w.phase = 'completed';
|
|
1616
|
-
w.status = 'completed';
|
|
1617
|
-
w.completedAt = new Date();
|
|
1618
|
-
}
|
|
1619
|
-
}, 1500);
|
|
1620
|
-
} else {
|
|
1621
|
-
worker.progress = 100;
|
|
1622
|
-
worker.phase = 'completed';
|
|
1623
|
-
worker.status = 'completed';
|
|
1624
|
-
worker.completedAt = new Date();
|
|
1625
|
-
}
|
|
1626
|
-
|
|
1627
|
-
return {
|
|
1628
|
-
success: true,
|
|
1629
|
-
workerId,
|
|
1630
|
-
trigger,
|
|
1631
|
-
context,
|
|
1632
|
-
priority,
|
|
1633
|
-
config: {
|
|
1634
|
-
description: config.description,
|
|
1635
|
-
estimatedDuration: config.estimatedDuration,
|
|
1636
|
-
capabilities: config.capabilities,
|
|
1637
|
-
},
|
|
1638
|
-
status: background ? 'dispatched' : 'completed',
|
|
1639
|
-
background,
|
|
1640
|
-
timestamp: new Date().toISOString(),
|
|
1641
|
-
};
|
|
1642
|
-
},
|
|
1643
|
-
};
|
|
1644
|
-
|
|
1645
|
-
// Worker status tool
|
|
1646
|
-
export const hooksWorkerStatus: MCPTool = {
|
|
1647
|
-
name: 'hooks/worker-status',
|
|
1648
|
-
description: 'Get status of a specific worker or all active workers',
|
|
1649
|
-
inputSchema: {
|
|
1650
|
-
type: 'object',
|
|
1651
|
-
properties: {
|
|
1652
|
-
workerId: { type: 'string', description: 'Specific worker ID to check' },
|
|
1653
|
-
includeCompleted: { type: 'boolean', description: 'Include completed workers' },
|
|
1654
|
-
},
|
|
1655
|
-
},
|
|
1656
|
-
handler: async (params: Record<string, unknown>) => {
|
|
1657
|
-
const workerId = params.workerId as string;
|
|
1658
|
-
const includeCompleted = params.includeCompleted !== false;
|
|
1659
|
-
|
|
1660
|
-
if (workerId) {
|
|
1661
|
-
const worker = activeWorkers.get(workerId);
|
|
1662
|
-
if (!worker) {
|
|
1663
|
-
return {
|
|
1664
|
-
success: false,
|
|
1665
|
-
error: `Worker not found: ${workerId}`,
|
|
1666
|
-
};
|
|
1667
|
-
}
|
|
1668
|
-
return {
|
|
1669
|
-
success: true,
|
|
1670
|
-
worker: {
|
|
1671
|
-
...worker,
|
|
1672
|
-
duration: worker.completedAt
|
|
1673
|
-
? worker.completedAt.getTime() - worker.startedAt.getTime()
|
|
1674
|
-
: Date.now() - worker.startedAt.getTime(),
|
|
1675
|
-
},
|
|
1676
|
-
};
|
|
1677
|
-
}
|
|
1678
|
-
|
|
1679
|
-
const workers = Array.from(activeWorkers.values())
|
|
1680
|
-
.filter(w => includeCompleted || w.status !== 'completed')
|
|
1681
|
-
.map(w => ({
|
|
1682
|
-
...w,
|
|
1683
|
-
duration: w.completedAt
|
|
1684
|
-
? w.completedAt.getTime() - w.startedAt.getTime()
|
|
1685
|
-
: Date.now() - w.startedAt.getTime(),
|
|
1686
|
-
}));
|
|
1687
|
-
|
|
1688
|
-
return {
|
|
1689
|
-
success: true,
|
|
1690
|
-
workers,
|
|
1691
|
-
summary: {
|
|
1692
|
-
total: workers.length,
|
|
1693
|
-
running: workers.filter(w => w.status === 'running').length,
|
|
1694
|
-
completed: workers.filter(w => w.status === 'completed').length,
|
|
1695
|
-
failed: workers.filter(w => w.status === 'failed').length,
|
|
1696
|
-
},
|
|
1697
|
-
};
|
|
1698
|
-
},
|
|
1699
|
-
};
|
|
1700
|
-
|
|
1701
|
-
// Worker detect tool - detect triggers from prompt
|
|
1702
|
-
export const hooksWorkerDetect: MCPTool = {
|
|
1703
|
-
name: 'hooks/worker-detect',
|
|
1704
|
-
description: 'Detect worker triggers from user prompt (for UserPromptSubmit hook)',
|
|
1705
|
-
inputSchema: {
|
|
1706
|
-
type: 'object',
|
|
1707
|
-
properties: {
|
|
1708
|
-
prompt: { type: 'string', description: 'User prompt to analyze' },
|
|
1709
|
-
autoDispatch: { type: 'boolean', description: 'Automatically dispatch detected workers' },
|
|
1710
|
-
minConfidence: { type: 'number', description: 'Minimum confidence threshold (0-1)' },
|
|
1711
|
-
},
|
|
1712
|
-
required: ['prompt'],
|
|
1713
|
-
},
|
|
1714
|
-
handler: async (params: Record<string, unknown>) => {
|
|
1715
|
-
const prompt = params.prompt as string;
|
|
1716
|
-
const autoDispatch = params.autoDispatch as boolean;
|
|
1717
|
-
const minConfidence = (params.minConfidence as number) || 0.5;
|
|
1718
|
-
|
|
1719
|
-
const detection = detectWorkerTriggers(prompt);
|
|
1720
|
-
|
|
1721
|
-
const result: Record<string, unknown> = {
|
|
1722
|
-
prompt: prompt.slice(0, 200) + (prompt.length > 200 ? '...' : ''),
|
|
1723
|
-
detection,
|
|
1724
|
-
triggersFound: detection.triggers.length,
|
|
1725
|
-
};
|
|
1726
|
-
|
|
1727
|
-
if (detection.detected && detection.confidence >= minConfidence) {
|
|
1728
|
-
result.triggerDetails = detection.triggers.map(trigger => ({
|
|
1729
|
-
trigger,
|
|
1730
|
-
...WORKER_CONFIGS[trigger],
|
|
1731
|
-
}));
|
|
1732
|
-
|
|
1733
|
-
if (autoDispatch) {
|
|
1734
|
-
const dispatched: string[] = [];
|
|
1735
|
-
for (const trigger of detection.triggers) {
|
|
1736
|
-
const workerId = `worker_${trigger}_${++workerIdCounter}_${Date.now().toString(36)}`;
|
|
1737
|
-
activeWorkers.set(workerId, {
|
|
1738
|
-
id: workerId,
|
|
1739
|
-
trigger,
|
|
1740
|
-
context: prompt.slice(0, 100),
|
|
1741
|
-
status: 'running',
|
|
1742
|
-
progress: 0,
|
|
1743
|
-
phase: 'initializing',
|
|
1744
|
-
startedAt: new Date(),
|
|
1745
|
-
});
|
|
1746
|
-
dispatched.push(workerId);
|
|
1747
|
-
|
|
1748
|
-
// Simulate completion
|
|
1749
|
-
setTimeout(() => {
|
|
1750
|
-
const w = activeWorkers.get(workerId);
|
|
1751
|
-
if (w) {
|
|
1752
|
-
w.progress = 100;
|
|
1753
|
-
w.phase = 'completed';
|
|
1754
|
-
w.status = 'completed';
|
|
1755
|
-
w.completedAt = new Date();
|
|
1756
|
-
}
|
|
1757
|
-
}, 1500);
|
|
1758
|
-
}
|
|
1759
|
-
result.autoDispatched = true;
|
|
1760
|
-
result.workerIds = dispatched;
|
|
1761
|
-
}
|
|
1762
|
-
}
|
|
1763
|
-
|
|
1764
|
-
return result;
|
|
1765
|
-
},
|
|
1766
|
-
};
|
|
1767
|
-
|
|
1768
|
-
// Worker cancel tool
|
|
1769
|
-
export const hooksWorkerCancel: MCPTool = {
|
|
1770
|
-
name: 'hooks/worker-cancel',
|
|
1771
|
-
description: 'Cancel a running worker',
|
|
1772
|
-
inputSchema: {
|
|
1773
|
-
type: 'object',
|
|
1774
|
-
properties: {
|
|
1775
|
-
workerId: { type: 'string', description: 'Worker ID to cancel' },
|
|
1776
|
-
},
|
|
1777
|
-
required: ['workerId'],
|
|
1778
|
-
},
|
|
1779
|
-
handler: async (params: Record<string, unknown>) => {
|
|
1780
|
-
const workerId = params.workerId as string;
|
|
1781
|
-
const worker = activeWorkers.get(workerId);
|
|
1782
|
-
|
|
1783
|
-
if (!worker) {
|
|
1784
|
-
return {
|
|
1785
|
-
success: false,
|
|
1786
|
-
error: `Worker not found: ${workerId}`,
|
|
1787
|
-
};
|
|
1788
|
-
}
|
|
1789
|
-
|
|
1790
|
-
if (worker.status === 'completed' || worker.status === 'failed') {
|
|
1791
|
-
return {
|
|
1792
|
-
success: false,
|
|
1793
|
-
error: `Worker already ${worker.status}`,
|
|
1794
|
-
};
|
|
1795
|
-
}
|
|
1796
|
-
|
|
1797
|
-
worker.status = 'failed';
|
|
1798
|
-
worker.phase = 'cancelled';
|
|
1799
|
-
worker.completedAt = new Date();
|
|
1800
|
-
|
|
1801
|
-
return {
|
|
1802
|
-
success: true,
|
|
1803
|
-
workerId,
|
|
1804
|
-
cancelled: true,
|
|
1805
|
-
timestamp: new Date().toISOString(),
|
|
1806
|
-
};
|
|
1807
|
-
},
|
|
1808
|
-
};
|
|
1809
|
-
|
|
1810
|
-
// Export all hooks tools
|
|
1811
|
-
export const hooksTools: MCPTool[] = [
|
|
1812
|
-
hooksPreEdit,
|
|
1813
|
-
hooksPostEdit,
|
|
1814
|
-
hooksPreCommand,
|
|
1815
|
-
hooksPostCommand,
|
|
1816
|
-
hooksRoute,
|
|
1817
|
-
hooksMetrics,
|
|
1818
|
-
hooksList,
|
|
1819
|
-
hooksPreTask,
|
|
1820
|
-
hooksPostTask,
|
|
1821
|
-
// New hooks
|
|
1822
|
-
hooksExplain,
|
|
1823
|
-
hooksPretrain,
|
|
1824
|
-
hooksBuildAgents,
|
|
1825
|
-
hooksTransfer,
|
|
1826
|
-
hooksSessionStart,
|
|
1827
|
-
hooksSessionEnd,
|
|
1828
|
-
hooksSessionRestore,
|
|
1829
|
-
hooksNotify,
|
|
1830
|
-
hooksInit,
|
|
1831
|
-
hooksIntelligence,
|
|
1832
|
-
hooksIntelligenceReset,
|
|
1833
|
-
hooksTrajectoryStart,
|
|
1834
|
-
hooksTrajectoryStep,
|
|
1835
|
-
hooksTrajectoryEnd,
|
|
1836
|
-
hooksPatternStore,
|
|
1837
|
-
hooksPatternSearch,
|
|
1838
|
-
hooksIntelligenceStats,
|
|
1839
|
-
hooksIntelligenceLearn,
|
|
1840
|
-
hooksIntelligenceAttention,
|
|
1841
|
-
// Worker tools
|
|
1842
|
-
hooksWorkerList,
|
|
1843
|
-
hooksWorkerDispatch,
|
|
1844
|
-
hooksWorkerStatus,
|
|
1845
|
-
hooksWorkerDetect,
|
|
1846
|
-
hooksWorkerCancel,
|
|
1847
|
-
];
|
|
1848
|
-
|
|
1849
|
-
export default hooksTools;
|