claude-flow-novice 2.0.4 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/cli/commands/guidance.js +668 -487
- package/dist/src/cli/commands/index-validate.js +29 -18
- package/dist/src/cli/commands/mcp-troubleshoot.js +282 -230
- package/dist/src/cli/commands/neural-goal-init.js +125 -92
- package/dist/src/cli/commands/swarm-exec.js +393 -317
- package/dist/src/cli/commands/validate-framework.js +1100 -983
- package/dist/src/cli/commands/validate.js +223 -144
- package/dist/src/cli/main.js +1 -1
- package/dist/src/cli/simple-commands/__tests__/agent.test.js +277 -265
- package/dist/src/cli/simple-commands/__tests__/memory.test.js +7 -6
- package/dist/src/cli/simple-commands/__tests__/swarm.test.js +356 -373
- package/dist/src/cli/simple-commands/__tests__/task.test.js +7 -6
- package/dist/src/cli/simple-commands/agent.js +193 -157
- package/dist/src/cli/simple-commands/analysis.js +446 -336
- package/dist/src/cli/simple-commands/automation-executor.js +1339 -1095
- package/dist/src/cli/simple-commands/automation.js +469 -481
- package/dist/src/cli/simple-commands/batch-manager.js +313 -261
- package/dist/src/cli/simple-commands/claude-telemetry.js +267 -241
- package/dist/src/cli/simple-commands/claude-track.js +90 -68
- package/dist/src/cli/simple-commands/concurrent-display.js +320 -266
- package/dist/src/cli/simple-commands/config.js +290 -245
- package/dist/src/cli/simple-commands/coordination.js +234 -182
- package/dist/src/cli/simple-commands/enhanced-ui-views.js +615 -812
- package/dist/src/cli/simple-commands/enhanced-webui-complete.js +981 -922
- package/dist/src/cli/simple-commands/fix-hook-variables.js +294 -274
- package/dist/src/cli/simple-commands/github/gh-coordinator.js +457 -378
- package/dist/src/cli/simple-commands/github/github-api.js +574 -535
- package/dist/src/cli/simple-commands/github/init.js +303 -276
- package/dist/src/cli/simple-commands/github.js +247 -222
- package/dist/src/cli/simple-commands/goal.js +63 -51
- package/dist/src/cli/simple-commands/hive-mind/auto-save-middleware.js +278 -208
- package/dist/src/cli/simple-commands/hive-mind/communication.js +696 -601
- package/dist/src/cli/simple-commands/hive-mind/core.js +979 -907
- package/dist/src/cli/simple-commands/hive-mind/db-optimizer.js +655 -406
- package/dist/src/cli/simple-commands/hive-mind/mcp-wrapper.js +1245 -1125
- package/dist/src/cli/simple-commands/hive-mind/memory.js +1090 -854
- package/dist/src/cli/simple-commands/hive-mind/performance-optimizer.js +574 -459
- package/dist/src/cli/simple-commands/hive-mind/performance-test.js +347 -263
- package/dist/src/cli/simple-commands/hive-mind/queen.js +768 -727
- package/dist/src/cli/simple-commands/hive-mind/session-manager.js +1049 -745
- package/dist/src/cli/simple-commands/hive-mind-optimize.js +283 -227
- package/dist/src/cli/simple-commands/hive-mind-wizard.js +217 -174
- package/dist/src/cli/simple-commands/hive-mind.js +2282 -1841
- package/dist/src/cli/simple-commands/hive.js +79 -90
- package/dist/src/cli/simple-commands/hook-safety.js +521 -431
- package/dist/src/cli/simple-commands/hooks/session-start-soul.js +254 -203
- package/dist/src/cli/simple-commands/hooks.js +1204 -1064
- package/dist/src/cli/simple-commands/init/agent-copier.js +319 -294
- package/dist/src/cli/simple-commands/init/batch-init.js +562 -496
- package/dist/src/cli/simple-commands/init/claude-commands/claude-flow-commands.js +19 -13
- package/dist/src/cli/simple-commands/init/claude-commands/optimized-claude-flow-commands.js +19 -13
- package/dist/src/cli/simple-commands/init/claude-commands/optimized-slash-commands.js +88 -61
- package/dist/src/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js +150 -125
- package/dist/src/cli/simple-commands/init/claude-commands/slash-commands.js +49 -42
- package/dist/src/cli/simple-commands/init/claude-commands/sparc-commands.js +61 -43
- package/dist/src/cli/simple-commands/init/copy-revised-templates.js +147 -141
- package/dist/src/cli/simple-commands/init/executable-wrapper.js +44 -31
- package/dist/src/cli/simple-commands/init/gitignore-updater.js +90 -64
- package/dist/src/cli/simple-commands/init/help.js +107 -104
- package/dist/src/cli/simple-commands/init/hive-mind-init.js +528 -509
- package/dist/src/cli/simple-commands/init/index.js +1759 -1510
- package/dist/src/cli/simple-commands/init/performance-monitor.js +317 -234
- package/dist/src/cli/simple-commands/init/rollback/backup-manager.js +504 -441
- package/dist/src/cli/simple-commands/init/rollback/index.js +364 -289
- package/dist/src/cli/simple-commands/init/rollback/recovery-manager.js +728 -652
- package/dist/src/cli/simple-commands/init/rollback/rollback-executor.js +481 -416
- package/dist/src/cli/simple-commands/init/rollback/state-tracker.js +448 -369
- package/dist/src/cli/simple-commands/init/sparc/roo-readme.js +2 -1
- package/dist/src/cli/simple-commands/init/sparc/roomodes-config.js +99 -122
- package/dist/src/cli/simple-commands/init/sparc/workflows.js +37 -32
- package/dist/src/cli/simple-commands/init/sparc-structure.js +62 -55
- package/dist/src/cli/simple-commands/init/template-copier.js +533 -421
- package/dist/src/cli/simple-commands/init/templates/coordination-md.js +6 -3
- package/dist/src/cli/simple-commands/init/templates/enhanced-templates.js +318 -344
- package/dist/src/cli/simple-commands/init/templates/github-safe-enhanced.js +218 -173
- package/dist/src/cli/simple-commands/init/templates/github-safe.js +75 -65
- package/dist/src/cli/simple-commands/init/templates/memory-bank-md.js +6 -3
- package/dist/src/cli/simple-commands/init/templates/readme-files.js +4 -2
- package/dist/src/cli/simple-commands/init/templates/safe-hook-patterns.js +230 -187
- package/dist/src/cli/simple-commands/init/templates/sparc-modes.js +80 -53
- package/dist/src/cli/simple-commands/init/templates/verification-claude-md.js +85 -101
- package/dist/src/cli/simple-commands/init/validation/config-validator.js +330 -283
- package/dist/src/cli/simple-commands/init/validation/health-checker.js +561 -495
- package/dist/src/cli/simple-commands/init/validation/index.js +358 -302
- package/dist/src/cli/simple-commands/init/validation/mode-validator.js +359 -308
- package/dist/src/cli/simple-commands/init/validation/post-init-validator.js +366 -389
- package/dist/src/cli/simple-commands/init/validation/pre-init-validator.js +268 -270
- package/dist/src/cli/simple-commands/init/validation/test-runner.js +447 -427
- package/dist/src/cli/simple-commands/init.js +2 -1
- package/dist/src/cli/simple-commands/mcp-health.js +158 -131
- package/dist/src/cli/simple-commands/mcp-integration-layer.js +634 -533
- package/dist/src/cli/simple-commands/mcp.js +400 -345
- package/dist/src/cli/simple-commands/memory-consolidation.js +537 -426
- package/dist/src/cli/simple-commands/memory.js +311 -247
- package/dist/src/cli/simple-commands/migrate-hooks.js +46 -39
- package/dist/src/cli/simple-commands/monitor.js +363 -294
- package/dist/src/cli/simple-commands/neural.js +65 -51
- package/dist/src/cli/simple-commands/pair-autofix-only.js +662 -538
- package/dist/src/cli/simple-commands/pair-basic.js +656 -528
- package/dist/src/cli/simple-commands/pair-old.js +543 -430
- package/dist/src/cli/simple-commands/pair-working.js +751 -615
- package/dist/src/cli/simple-commands/pair.js +751 -615
- package/dist/src/cli/simple-commands/performance-hooks.js +111 -83
- package/dist/src/cli/simple-commands/performance-metrics.js +433 -348
- package/dist/src/cli/simple-commands/process-ui-enhanced.js +787 -708
- package/dist/src/cli/simple-commands/process-ui.js +254 -230
- package/dist/src/cli/simple-commands/realtime-update-system.js +611 -525
- package/dist/src/cli/simple-commands/sparc/architecture.js +1530 -1704
- package/dist/src/cli/simple-commands/sparc/commands.js +516 -438
- package/dist/src/cli/simple-commands/sparc/completion.js +1481 -1224
- package/dist/src/cli/simple-commands/sparc/coordinator.js +978 -913
- package/dist/src/cli/simple-commands/sparc/index.js +298 -241
- package/dist/src/cli/simple-commands/sparc/phase-base.js +390 -314
- package/dist/src/cli/simple-commands/sparc/pseudocode.js +869 -965
- package/dist/src/cli/simple-commands/sparc/refinement.js +1273 -980
- package/dist/src/cli/simple-commands/sparc/specification.js +645 -559
- package/dist/src/cli/simple-commands/sparc-modes/architect.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/ask.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/code.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/debug.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/devops.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/docs-writer.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/generic.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/index.js +55 -47
- package/dist/src/cli/simple-commands/sparc-modes/integration.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/mcp.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/monitoring.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/optimization.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/security-review.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/sparc-orchestrator.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/spec-pseudocode.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/supabase-admin.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/swarm.js +87 -101
- package/dist/src/cli/simple-commands/sparc-modes/tdd.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/tutorial.js +1 -1
- package/dist/src/cli/simple-commands/sparc.js +493 -465
- package/dist/src/cli/simple-commands/start-ui.js +132 -108
- package/dist/src/cli/simple-commands/start-wrapper.js +268 -240
- package/dist/src/cli/simple-commands/start.js +1 -1
- package/dist/src/cli/simple-commands/status.js +275 -254
- package/dist/src/cli/simple-commands/stream-chain-clean.js +171 -128
- package/dist/src/cli/simple-commands/stream-chain-fixed.js +82 -61
- package/dist/src/cli/simple-commands/stream-chain-real.js +331 -267
- package/dist/src/cli/simple-commands/stream-chain-working.js +263 -211
- package/dist/src/cli/simple-commands/stream-chain.js +318 -260
- package/dist/src/cli/simple-commands/stream-processor.js +315 -290
- package/dist/src/cli/simple-commands/swarm-executor.js +222 -189
- package/dist/src/cli/simple-commands/swarm-metrics-integration.js +300 -208
- package/dist/src/cli/simple-commands/swarm-ui.js +703 -623
- package/dist/src/cli/simple-commands/swarm-webui-integration.js +286 -258
- package/dist/src/cli/simple-commands/swarm.js +1082 -887
- package/dist/src/cli/simple-commands/task.js +206 -161
- package/dist/src/cli/simple-commands/timestamp-fix.js +89 -59
- package/dist/src/cli/simple-commands/token-tracker.js +316 -258
- package/dist/src/cli/simple-commands/tool-execution-framework.js +519 -433
- package/dist/src/cli/simple-commands/train-and-stream.js +331 -275
- package/dist/src/cli/simple-commands/training-pipeline.js +725 -619
- package/dist/src/cli/simple-commands/training.js +227 -170
- package/dist/src/cli/simple-commands/verification-hooks.js +284 -261
- package/dist/src/cli/simple-commands/verification-integration.js +417 -389
- package/dist/src/cli/simple-commands/verification-training-integration.js +606 -486
- package/dist/src/cli/simple-commands/verification.js +513 -493
- package/dist/src/cli/simple-commands/web-server.js +836 -766
- package/dist/src/cli/simple-commands/webui-validator.js +124 -106
- package/dist/src/coordination/byzantine-memory-channels.js +25 -1
- package/dist/src/coordination/event-bus/demo-wasm-integration.js +251 -212
- package/dist/src/coordination/event-bus/qe-event-bus.js +748 -608
- package/dist/src/coordination/event-bus/qe-event-bus.test.js +454 -379
- package/dist/src/coordination/iteration-tracker.js +454 -363
- package/dist/src/index.js +384 -35
- package/dist/src/mcp/DEPRECATED.js +60 -46
- package/dist/src/mcp/fixes/mcp-error-fixes.js +134 -115
- package/dist/src/mcp/implementations/agent-tracker.js +128 -114
- package/dist/src/mcp/implementations/daa-tools.js +350 -292
- package/dist/src/mcp/implementations/workflow-tools.js +361 -329
- package/dist/src/mcp/mcp-config-manager.js +1331 -1183
- package/dist/src/mcp/mcp-server-novice-simplified.js +17 -11
- package/dist/src/mcp/mcp-server-novice.js +17 -11
- package/dist/src/mcp/mcp-server-sdk.js +17 -11
- package/dist/src/mcp/mcp-server.js +1484 -1620
- package/dist/src/mcp/ruv-swarm-wrapper.js +239 -209
- package/dist/src/memory/advanced-serializer.js +589 -609
- package/dist/src/memory/enhanced-examples.js +305 -220
- package/dist/src/memory/enhanced-memory.js +336 -295
- package/dist/src/memory/enhanced-session-serializer.js +492 -408
- package/dist/src/memory/fallback-memory-system.js +1021 -900
- package/dist/src/memory/fallback-store.js +131 -93
- package/dist/src/memory/high-performance-serialization.js +730 -592
- package/dist/src/memory/in-memory-store.js +213 -161
- package/dist/src/memory/index.js +157 -123
- package/dist/src/memory/lock-free-structures.js +764 -578
- package/dist/src/memory/memory-mapped-persistence.js +766 -585
- package/dist/src/memory/memory-pressure-manager.js +707 -569
- package/dist/src/memory/migration.js +445 -358
- package/dist/src/memory/shared-memory.js +768 -641
- package/dist/src/memory/sqlite-store.js +325 -245
- package/dist/src/memory/sqlite-wrapper.js +151 -122
- package/dist/src/memory/swarm-memory.js +603 -470
- package/dist/src/memory/test-example.js +134 -126
- package/dist/src/memory/ultra-fast-memory-store.js +821 -622
- package/dist/src/memory/unified-memory-manager.js +437 -356
- package/dist/src/swarm/CodeRefactoringSwarm.js +952 -777
- package/dist/src/utils/__tests__/github-cli-safety-wrapper.test.js +400 -332
- package/dist/src/utils/error-handler.js +2 -36
- package/dist/src/utils/github-cli-safe.js +64 -56
- package/dist/src/utils/github-cli-safety-wrapper.js +546 -451
- package/dist/src/utils/npx-isolated-cache.js +119 -104
- package/dist/src/utils/preference-manager.js +652 -622
- package/dist/src/utils/timezone-utils.js +105 -86
- package/dist/src/web/api/apm-routes.js +353 -0
- package/dist/src/web/api/config/api-config.js +184 -0
- package/dist/src/web/api/middleware/auth.js +203 -0
- package/dist/src/web/api/middleware/cache.js +273 -0
- package/dist/src/web/api/middleware/error-handler.js +257 -0
- package/dist/src/web/api/middleware/request-logger.js +215 -0
- package/dist/src/web/api/middleware/validation.js +323 -0
- package/dist/src/web/api/routes/events.js +463 -0
- package/dist/src/web/api/routes/hierarchy.js +300 -0
- package/dist/src/web/api/routes/index.js +12 -0
- package/dist/src/web/api/routes/metrics.js +559 -0
- package/dist/src/web/api/routes/parallel-status.js +359 -0
- package/dist/src/web/api/routes/status.js +448 -0
- package/dist/src/web/api/server.js +462 -0
- package/dist/src/web/dashboard/hooks/useWebSocket.js +383 -0
- package/dist/src/web/dashboard/index.js +85 -0
- package/dist/src/web/dashboard/realtime/CustomSyncManager.js +439 -0
- package/dist/src/web/dashboard/realtime/NativeWebSocketManager.js +323 -0
- package/dist/src/web/dashboard/realtime/PerformanceBenchmark.js +527 -0
- package/dist/src/web/dashboard/realtime/RealtimeCommunicationManager.js +474 -0
- package/dist/src/web/dashboard/realtime/RealtimeServer.js +666 -0
- package/dist/src/web/dashboard/realtime/SSEManager.js +426 -0
- package/dist/src/web/dashboard/types.js +4 -0
- package/dist/src/web/messaging/agent-status-tracker.js +453 -0
- package/dist/src/web/messaging/human-intervention-system.js +305 -0
- package/dist/src/web/messaging/message-filter.js +302 -0
- package/dist/src/web/messaging/swarm-message-router.js +324 -0
- package/dist/src/web/messaging/transparency-logger.js +421 -0
- package/dist/src/web/portal-server.js +460 -0
- package/dist/src/web/server.js +322 -0
- package/dist/src/web/websocket/apm-websocket-handler.js +453 -0
- package/dist/src/web/websocket/websocket-manager.js +780 -0
- package/package.json +5 -3
- package/dist/src/cli/minimal-main.js +0 -22
- package/dist/src/enterprise/analytics-manager.js +0 -1135
- package/dist/src/enterprise/audit-manager.js +0 -1115
- package/dist/src/enterprise/cloud-manager.js +0 -891
- package/dist/src/enterprise/deployment-manager.js +0 -966
- package/dist/src/enterprise/index.js +0 -6
- package/dist/src/enterprise/project-manager.js +0 -584
- package/dist/src/enterprise/security-manager.js +0 -991
- package/dist/src/migration/index.js +0 -92
- package/dist/src/migration/logger.js +0 -121
- package/dist/src/migration/migration-analyzer.js +0 -268
- package/dist/src/migration/migration-runner.js +0 -522
- package/dist/src/migration/migration-validator.js +0 -285
- package/dist/src/migration/progress-reporter.js +0 -150
- package/dist/src/migration/rollback-manager.js +0 -321
- package/dist/src/migration/tests/migration-system.test.js +0 -7
- package/dist/src/migration/types.js +0 -3
- package/dist/src/swarm/__tests__/integration.test.js +0 -227
- package/dist/src/swarm/__tests__/prompt-copier.test.js +0 -344
- package/dist/src/swarm/advanced-orchestrator.js +0 -1095
- package/dist/src/swarm/claude-code-interface.js +0 -961
- package/dist/src/swarm/claude-flow-executor.js +0 -229
- package/dist/src/swarm/consensus-coordinator.js +0 -475
- package/dist/src/swarm/coordinator.js +0 -2993
- package/dist/src/swarm/direct-executor.js +0 -1180
- package/dist/src/swarm/error-recovery/advanced-error-detection.js +0 -691
- package/dist/src/swarm/error-recovery/automated-recovery-workflows.js +0 -998
- package/dist/src/swarm/error-recovery/error-recovery-coordinator.js +0 -1197
- package/dist/src/swarm/error-recovery/recovery-monitoring.js +0 -772
- package/dist/src/swarm/error-recovery/resilience-architecture.js +0 -714
- package/dist/src/swarm/error-recovery/self-healing-mechanisms.js +0 -1319
- package/dist/src/swarm/error-recovery/test-error-recovery-effectiveness.js +0 -808
- package/dist/src/swarm/executor-v2.js +0 -322
- package/dist/src/swarm/executor.js +0 -815
- package/dist/src/swarm/hive-mind-integration.js +0 -703
- package/dist/src/swarm/index.js +0 -41
- package/dist/src/swarm/json-output-aggregator.js +0 -267
- package/dist/src/swarm/large-scale-coordinator.js +0 -542
- package/dist/src/swarm/mcp-integration-wrapper.js +0 -628
- package/dist/src/swarm/memory.js +0 -1117
- package/dist/src/swarm/optimizations/__tests__/optimization.test.js +0 -348
- package/dist/src/swarm/optimizations/async-file-manager.js +0 -285
- package/dist/src/swarm/optimizations/circular-buffer.js +0 -162
- package/dist/src/swarm/optimizations/connection-pool.js +0 -244
- package/dist/src/swarm/optimizations/index.js +0 -28
- package/dist/src/swarm/optimizations/optimized-executor.js +0 -320
- package/dist/src/swarm/optimizations/ttl-map.js +0 -234
- package/dist/src/swarm/prompt-cli.js +0 -200
- package/dist/src/swarm/prompt-copier-enhanced.js +0 -202
- package/dist/src/swarm/prompt-copier.js +0 -381
- package/dist/src/swarm/prompt-manager.js +0 -295
- package/dist/src/swarm/prompt-utils.js +0 -310
- package/dist/src/swarm/result-aggregator.js +0 -718
- package/dist/src/swarm/sparc-executor.js +0 -1568
- package/dist/src/swarm/strategies/auto.js +0 -758
- package/dist/src/swarm/strategies/base.js +0 -128
- package/dist/src/swarm/strategies/research.js +0 -914
- package/dist/src/swarm/strategies/strategy-metrics-patch.js +0 -2
- package/dist/src/swarm/types.js +0 -52
- package/dist/src/swarm/workers/copy-worker.js +0 -56
- package/dist/src/validators/epic-config-schema.js +0 -214
- package/dist/src/validators/index.js +0 -10
- package/dist/src/validators/swarm-init-validator.js +0 -259
- package/dist/src/validators/todowrite-batching-validator.js +0 -215
- package/dist/src/validators/todowrite-integration.js +0 -187
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/documentSymbols/browser/documentSymbols.js +0 -23
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js +0 -57
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +0 -401
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/defaultProviders.js +0 -181
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorContribution.js +0 -44
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js +0 -157
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/edit.js +0 -71
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/editorState/browser/editorState.js +0 -112
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findController.js +0 -990
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findDecorations.js +0 -296
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findModel.js +0 -488
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findOptionsWidget.js +0 -138
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findState.js +0 -243
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findWidget.js +0 -1177
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/folding.js +0 -1093
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/foldingDecorations.js +0 -133
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/foldingModel.js +0 -538
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/foldingRanges.js +0 -351
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/fontZoom/browser/fontZoom.js +0 -49
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/format/browser/format.js +0 -360
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/format/browser/formatActions.js +0 -263
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/format/browser/formattingEdit.js +0 -54
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/gotoSymbol/browser/link/clickLinkGesture.js +0 -149
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/hover/browser/contentHover.js +0 -874
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/inlineCompletions/browser/commandIds.js +0 -7
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/inlineCompletions/browser/commands.js +0 -199
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/linesOperations/browser/copyLinesCommand.js +0 -70
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/quickAccess/browser/commandsQuickAccess.js +0 -26
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/quickAccess/browser/editorNavigationQuickAccess.js +0 -153
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +0 -33
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/semanticTokens/browser/documentSemanticTokens.js +0 -354
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/smartSelect/browser/bracketSelections.js +0 -146
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/suggest/browser/completionModel.js +0 -224
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +0 -119
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/edcore.main.js +0 -14
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.all.js +0 -63
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.api.js +0 -55
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.main.js +0 -7
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.worker.js +0 -25
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/standalone/browser/colorizer.js +0 -118
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/language/css/css.worker.js +0 -36869
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/language/css/cssMode.js +0 -2035
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/accessibility/browser/accessibilityService.js +0 -88
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/accessibility/common/accessibility.js +0 -9
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/action/common/action.js +0 -7
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/action/common/actionCommonCategories.js +0 -13
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actionWidget/browser/actionList.js +0 -276
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actionWidget/browser/actionWidget.js +0 -248
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actionWidget/common/actionWidget.js +0 -5
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actions/common/actions.js +0 -409
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/audioCues/browser/audioCueService.js +0 -176
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/clipboard/browser/clipboardService.js +0 -141
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/clipboard/common/clipboardService.js +0 -6
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/commands/common/commands.js +0 -80
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configuration.js +0 -86
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configurationModels.js +0 -554
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configurationRegistry.js +0 -317
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configurations.js +0 -41
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextkey/browser/contextKeyService.js +0 -432
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextkey/common/contextkey.js +0 -1547
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextkey/common/contextkeys.js +0 -18
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextMenuHandler.js +0 -124
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextMenuService.js +0 -101
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextView.js +0 -7
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextViewService.js +0 -72
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/dialogs/common/dialogs.js +0 -2
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/dnd/browser/dnd.js +0 -36
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/editor/common/editor.js +0 -17
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/environment/common/environment.js +0 -2
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/extensions/common/extensions.js +0 -47
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/files/common/files.js +0 -9
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +0 -105
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/instantiation/common/descriptors.js +0 -11
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/instantiation/common/extensions.js +0 -15
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/keybinding/common/abstractKeybindingService.js +0 -277
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/keybinding/common/baseResolvedKeybinding.js +0 -53
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +0 -354
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/theme/browser/defaultStyles.js +0 -162
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/theme/common/colorRegistry.js +0 -482
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/abap/abap.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/apex/apex.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/azcli/azcli.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/bat/bat.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/bicep/bicep.js +0 -11
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/cameligo/cameligo.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/clojure/clojure.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/coffee/coffee.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/cpp/cpp.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/csharp/csharp.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/csp/csp.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/css/css.js +0 -12
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/cypher/cypher.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/dart/dart.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/dockerfile/dockerfile.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/ecl/ecl.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/elixir/elixir.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/flow9/flow9.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.js +0 -745
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.de.js +0 -31
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.es.js +0 -31
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.fr.js +0 -29
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.it.js +0 -29
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.ja.js +0 -31
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.js +0 -29
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.ko.js +0 -29
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.ru.js +0 -31
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.zh-cn.js +0 -31
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.zh-tw.js +0 -29
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/language/css/cssMode.js +0 -13
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/language/css/cssWorker.js +0 -81
- package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/cli.js +0 -64
- package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/example.js +0 -36
- package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/index.js +0 -205
- package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/test.js +0 -260
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/async/index.browser.js +0 -34
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/async/index.js +0 -35
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/async/index.native.js +0 -26
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/index.browser.js +0 -34
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/index.js +0 -45
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/nanoid.js +0 -1
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/non-secure/index.js +0 -21
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/url-alphabet/index.js +0 -3
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/bin/nodemon.js +0 -16
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/cli/index.js +0 -49
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/cli/parse.js +0 -230
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/command.js +0 -43
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/defaults.js +0 -34
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/exec.js +0 -234
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/index.js +0 -93
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/load.js +0 -225
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/help/index.js +0 -27
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/index.js +0 -1
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/index.js +0 -4
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/match.js +0 -287
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/run.js +0 -562
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/signals.js +0 -34
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/watch.js +0 -244
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/nodemon.js +0 -317
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/rules/add.js +0 -89
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/rules/index.js +0 -53
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/rules/parse.js +0 -43
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/spawn.js +0 -74
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/bus.js +0 -44
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/clone.js +0 -40
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/colour.js +0 -26
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/index.js +0 -103
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/log.js +0 -82
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/merge.js +0 -47
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/version.js +0 -100
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/brace-expansion/index.js +0 -201
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/has-flag/index.js +0 -8
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/minimatch/minimatch.js +0 -947
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/supports-color/browser.js +0 -5
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/supports-color/index.js +0 -131
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/bin/pidtree.js +0 -128
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/index.js +0 -49
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/bin.js +0 -61
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/get.js +0 -45
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/pidtree.js +0 -104
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/ps.js +0 -47
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/wmic.js +0 -49
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/doc.js +0 -1270
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/acorn.js +0 -15
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/angular.js +0 -2
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/babel.js +0 -15
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/estree.js +0 -36
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/flow.js +0 -19
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/glimmer.js +0 -29
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/graphql.js +0 -29
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/html.js +0 -22
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/markdown.js +0 -63
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/meriyah.js +0 -4
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/postcss.js +0 -54
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/typescript.js +0 -20
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/yaml.js +0 -160
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/standalone.js +0 -34
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/bin/react-scripts.js +0 -58
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/env.js +0 -112
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/getHttpsConfig.js +0 -74
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/jest/babelTransform.js +0 -37
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/jest/cssTransform.js +0 -22
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/jest/fileTransform.js +0 -40
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/modules.js +0 -142
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/paths.js +0 -153
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/webpack/persistentCache/createEnvironmentHash.js +0 -9
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/webpack.config.js +0 -796
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/webpackDevServer.config.js +0 -135
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/scripts/build.js +0 -225
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/scripts/eject.js +0 -340
|
@@ -3,1688 +3,1552 @@
|
|
|
3
3
|
* ⚠️ DEPRECATED: MCP server has been removed in v2.0.0
|
|
4
4
|
* Please use: claude-flow-novice start
|
|
5
5
|
* See: MCP_DEPRECATION_NOTICE.md
|
|
6
|
-
*/
|
|
6
|
+
*/
|
|
7
|
+
require('./DEPRECATED.js');
|
|
7
8
|
process.exit(1);
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
/* LEGACY CODE - NON-FUNCTIONAL
|
|
11
|
+
* Claude-Flow MCP Server
|
|
12
|
+
* Implements the Model Context Protocol for Claude-Flow v2.0.0
|
|
13
|
+
* Compatible with ruv-swarm MCP interface
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { promises as fs } from 'fs';
|
|
17
|
+
import path from 'path';
|
|
18
|
+
import { fileURLToPath } from 'url';
|
|
19
|
+
import { EnhancedMemory } from '../memory/enhanced-memory.js';
|
|
10
20
|
// Use the same memory system that npx commands use - singleton instance
|
|
11
|
-
import { memoryStore } from
|
|
21
|
+
import { memoryStore } from '../memory/fallback-store.js';
|
|
22
|
+
|
|
12
23
|
// Initialize agent tracker
|
|
13
|
-
await import(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
await import('./implementations/agent-tracker.js').catch(() => {
|
|
25
|
+
// If ES module import fails, try require
|
|
26
|
+
try {
|
|
27
|
+
require('./implementations/agent-tracker');
|
|
28
|
+
} catch (e) {
|
|
29
|
+
console.log('Agent tracker not loaded');
|
|
30
|
+
}
|
|
20
31
|
});
|
|
32
|
+
|
|
21
33
|
// Initialize DAA manager
|
|
22
|
-
await import(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
await import('./implementations/daa-tools.js').catch(() => {
|
|
35
|
+
// If ES module import fails, try require
|
|
36
|
+
try {
|
|
37
|
+
require('./implementations/daa-tools');
|
|
38
|
+
} catch (e) {
|
|
39
|
+
console.log('DAA manager not loaded');
|
|
40
|
+
}
|
|
29
41
|
});
|
|
42
|
+
|
|
30
43
|
// Initialize Workflow and Performance managers
|
|
31
|
-
await import(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
44
|
+
await import('./implementations/workflow-tools.js').catch(() => {
|
|
45
|
+
// If ES module import fails, try require
|
|
46
|
+
try {
|
|
47
|
+
require('./implementations/workflow-tools');
|
|
48
|
+
} catch (e) {
|
|
49
|
+
console.log('Workflow tools not loaded');
|
|
50
|
+
}
|
|
38
51
|
});
|
|
52
|
+
|
|
39
53
|
const __filename = fileURLToPath(import.meta.url);
|
|
40
54
|
const __dirname = path.dirname(__filename);
|
|
55
|
+
|
|
41
56
|
// Legacy agent type mapping for backward compatibility
|
|
42
57
|
const LEGACY_AGENT_MAPPING = {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
58
|
+
analyst: 'code-analyzer',
|
|
59
|
+
coordinator: 'task-orchestrator',
|
|
60
|
+
optimizer: 'perf-analyzer',
|
|
61
|
+
documenter: 'api-docs',
|
|
62
|
+
monitor: 'performance-benchmarker',
|
|
63
|
+
specialist: 'system-architect',
|
|
64
|
+
architect: 'system-architect',
|
|
50
65
|
};
|
|
66
|
+
|
|
51
67
|
// Resolve legacy agent types to current equivalents
|
|
52
68
|
function resolveLegacyAgentType(legacyType) {
|
|
53
|
-
|
|
69
|
+
return LEGACY_AGENT_MAPPING[legacyType] || legacyType;
|
|
54
70
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
inputSchema: {
|
|
144
|
-
type: 'object',
|
|
145
|
-
properties: {
|
|
146
|
-
task: {
|
|
147
|
-
type: 'string'
|
|
148
|
-
},
|
|
149
|
-
strategy: {
|
|
150
|
-
type: 'string',
|
|
151
|
-
enum: [
|
|
152
|
-
'parallel',
|
|
153
|
-
'sequential',
|
|
154
|
-
'adaptive',
|
|
155
|
-
'balanced'
|
|
156
|
-
]
|
|
157
|
-
},
|
|
158
|
-
priority: {
|
|
159
|
-
type: 'string',
|
|
160
|
-
enum: [
|
|
161
|
-
'low',
|
|
162
|
-
'medium',
|
|
163
|
-
'high',
|
|
164
|
-
'critical'
|
|
165
|
-
]
|
|
166
|
-
},
|
|
167
|
-
dependencies: {
|
|
168
|
-
type: 'array'
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
required: [
|
|
172
|
-
'task'
|
|
173
|
-
]
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
swarm_status: {
|
|
177
|
-
name: 'swarm_status',
|
|
178
|
-
description: 'Monitor swarm health and performance',
|
|
179
|
-
inputSchema: {
|
|
180
|
-
type: 'object',
|
|
181
|
-
properties: {
|
|
182
|
-
swarmId: {
|
|
183
|
-
type: 'string'
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
// Neural Network Tools - DEPRECATED: Advanced neural features hidden from novice users
|
|
189
|
-
// Retained: neural_status, neural_train, neural_patterns (basic functionality)
|
|
190
|
-
// Use memory_usage for pattern storage instead of neural-specific tools
|
|
191
|
-
// Memory & Persistence Tools (12)
|
|
192
|
-
memory_usage: {
|
|
193
|
-
name: 'memory_usage',
|
|
194
|
-
description: 'Store/retrieve persistent memory with TTL and namespacing',
|
|
195
|
-
inputSchema: {
|
|
196
|
-
type: 'object',
|
|
197
|
-
properties: {
|
|
198
|
-
action: {
|
|
199
|
-
type: 'string',
|
|
200
|
-
enum: [
|
|
201
|
-
'store',
|
|
202
|
-
'retrieve',
|
|
203
|
-
'list',
|
|
204
|
-
'delete',
|
|
205
|
-
'search'
|
|
206
|
-
]
|
|
207
|
-
},
|
|
208
|
-
key: {
|
|
209
|
-
type: 'string'
|
|
210
|
-
},
|
|
211
|
-
value: {
|
|
212
|
-
type: 'string'
|
|
213
|
-
},
|
|
214
|
-
namespace: {
|
|
215
|
-
type: 'string',
|
|
216
|
-
default: 'default'
|
|
217
|
-
},
|
|
218
|
-
ttl: {
|
|
219
|
-
type: 'number'
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
required: [
|
|
223
|
-
'action'
|
|
224
|
-
]
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
memory_search: {
|
|
228
|
-
name: 'memory_search',
|
|
229
|
-
description: 'Search memory with patterns',
|
|
230
|
-
inputSchema: {
|
|
231
|
-
type: 'object',
|
|
232
|
-
properties: {
|
|
233
|
-
pattern: {
|
|
234
|
-
type: 'string'
|
|
235
|
-
},
|
|
236
|
-
namespace: {
|
|
237
|
-
type: 'string'
|
|
238
|
-
},
|
|
239
|
-
limit: {
|
|
240
|
-
type: 'number',
|
|
241
|
-
default: 10
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
required: [
|
|
245
|
-
'pattern'
|
|
246
|
-
]
|
|
247
|
-
}
|
|
248
|
-
},
|
|
249
|
-
// Analysis & Monitoring Tools (13)
|
|
250
|
-
performance_report: {
|
|
251
|
-
name: 'performance_report',
|
|
252
|
-
description: 'Generate performance reports with real-time metrics',
|
|
253
|
-
inputSchema: {
|
|
254
|
-
type: 'object',
|
|
255
|
-
properties: {
|
|
256
|
-
timeframe: {
|
|
257
|
-
type: 'string',
|
|
258
|
-
enum: [
|
|
259
|
-
'24h',
|
|
260
|
-
'7d',
|
|
261
|
-
'30d'
|
|
262
|
-
],
|
|
263
|
-
default: '24h'
|
|
264
|
-
},
|
|
265
|
-
format: {
|
|
266
|
-
type: 'string',
|
|
267
|
-
enum: [
|
|
268
|
-
'summary',
|
|
269
|
-
'detailed',
|
|
270
|
-
'json'
|
|
271
|
-
],
|
|
272
|
-
default: 'summary'
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
},
|
|
277
|
-
bottleneck_analyze: {
|
|
278
|
-
name: 'bottleneck_analyze',
|
|
279
|
-
description: 'Identify performance bottlenecks',
|
|
280
|
-
inputSchema: {
|
|
281
|
-
type: 'object',
|
|
282
|
-
properties: {
|
|
283
|
-
component: {
|
|
284
|
-
type: 'string'
|
|
285
|
-
},
|
|
286
|
-
metrics: {
|
|
287
|
-
type: 'array'
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
},
|
|
292
|
-
token_usage: {
|
|
293
|
-
name: 'token_usage',
|
|
294
|
-
description: 'Analyze token consumption',
|
|
295
|
-
inputSchema: {
|
|
296
|
-
type: 'object',
|
|
297
|
-
properties: {
|
|
298
|
-
operation: {
|
|
299
|
-
type: 'string'
|
|
300
|
-
},
|
|
301
|
-
timeframe: {
|
|
302
|
-
type: 'string',
|
|
303
|
-
default: '24h'
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
},
|
|
308
|
-
// GitHub Integration Tools (8)
|
|
309
|
-
github_repo_analyze: {
|
|
310
|
-
name: 'github_repo_analyze',
|
|
311
|
-
description: 'Repository analysis',
|
|
312
|
-
inputSchema: {
|
|
313
|
-
type: 'object',
|
|
314
|
-
properties: {
|
|
315
|
-
repo: {
|
|
316
|
-
type: 'string'
|
|
317
|
-
},
|
|
318
|
-
analysis_type: {
|
|
319
|
-
type: 'string',
|
|
320
|
-
enum: [
|
|
321
|
-
'code_quality',
|
|
322
|
-
'performance',
|
|
323
|
-
'security'
|
|
324
|
-
]
|
|
325
|
-
}
|
|
326
|
-
},
|
|
327
|
-
required: [
|
|
328
|
-
'repo'
|
|
329
|
-
]
|
|
330
|
-
}
|
|
331
|
-
},
|
|
332
|
-
github_pr_manage: {
|
|
333
|
-
name: 'github_pr_manage',
|
|
334
|
-
description: 'Pull request management',
|
|
335
|
-
inputSchema: {
|
|
336
|
-
type: 'object',
|
|
337
|
-
properties: {
|
|
338
|
-
repo: {
|
|
339
|
-
type: 'string'
|
|
340
|
-
},
|
|
341
|
-
pr_number: {
|
|
342
|
-
type: 'number'
|
|
343
|
-
},
|
|
344
|
-
action: {
|
|
345
|
-
type: 'string',
|
|
346
|
-
enum: [
|
|
347
|
-
'review',
|
|
348
|
-
'merge',
|
|
349
|
-
'close'
|
|
350
|
-
]
|
|
351
|
-
}
|
|
352
|
-
},
|
|
353
|
-
required: [
|
|
354
|
-
'repo',
|
|
355
|
-
'action'
|
|
356
|
-
]
|
|
357
|
-
}
|
|
358
|
-
},
|
|
359
|
-
// DAA Tools - DEPRECATED: Tools removed, functionality integrated into swarm_init and agent_spawn
|
|
360
|
-
// Legacy tools daa_agent_create and daa_capability_match have been consolidated
|
|
361
|
-
// Workflow Tools (11)
|
|
362
|
-
workflow_create: {
|
|
363
|
-
name: 'workflow_create',
|
|
364
|
-
description: 'Create custom workflows',
|
|
365
|
-
inputSchema: {
|
|
366
|
-
type: 'object',
|
|
367
|
-
properties: {
|
|
368
|
-
name: {
|
|
369
|
-
type: 'string'
|
|
370
|
-
},
|
|
371
|
-
steps: {
|
|
372
|
-
type: 'array'
|
|
373
|
-
},
|
|
374
|
-
triggers: {
|
|
375
|
-
type: 'array'
|
|
376
|
-
}
|
|
377
|
-
},
|
|
378
|
-
required: [
|
|
379
|
-
'name',
|
|
380
|
-
'steps'
|
|
381
|
-
]
|
|
382
|
-
}
|
|
383
|
-
},
|
|
384
|
-
sparc_mode: {
|
|
385
|
-
name: 'sparc_mode',
|
|
386
|
-
description: 'Run SPARC development modes',
|
|
387
|
-
inputSchema: {
|
|
388
|
-
type: 'object',
|
|
389
|
-
properties: {
|
|
390
|
-
mode: {
|
|
391
|
-
type: 'string',
|
|
392
|
-
enum: [
|
|
393
|
-
'dev',
|
|
394
|
-
'api',
|
|
395
|
-
'ui',
|
|
396
|
-
'test',
|
|
397
|
-
'refactor'
|
|
398
|
-
]
|
|
399
|
-
},
|
|
400
|
-
task_description: {
|
|
401
|
-
type: 'string'
|
|
402
|
-
},
|
|
403
|
-
options: {
|
|
404
|
-
type: 'object'
|
|
405
|
-
}
|
|
406
|
-
},
|
|
407
|
-
required: [
|
|
408
|
-
'mode',
|
|
409
|
-
'task_description'
|
|
410
|
-
]
|
|
411
|
-
}
|
|
412
|
-
},
|
|
413
|
-
// Additional Swarm Tools
|
|
414
|
-
agent_list: {
|
|
415
|
-
name: 'agent_list',
|
|
416
|
-
description: 'List active agents & capabilities',
|
|
417
|
-
inputSchema: {
|
|
418
|
-
type: 'object',
|
|
419
|
-
properties: {
|
|
420
|
-
swarmId: {
|
|
421
|
-
type: 'string'
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
},
|
|
426
|
-
agent_metrics: {
|
|
427
|
-
name: 'agent_metrics',
|
|
428
|
-
description: 'Agent performance metrics',
|
|
429
|
-
inputSchema: {
|
|
430
|
-
type: 'object',
|
|
431
|
-
properties: {
|
|
432
|
-
agentId: {
|
|
433
|
-
type: 'string'
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
},
|
|
438
|
-
swarm_monitor: {
|
|
439
|
-
name: 'swarm_monitor',
|
|
440
|
-
description: 'Real-time swarm monitoring',
|
|
441
|
-
inputSchema: {
|
|
442
|
-
type: 'object',
|
|
443
|
-
properties: {
|
|
444
|
-
swarmId: {
|
|
445
|
-
type: 'string'
|
|
446
|
-
},
|
|
447
|
-
interval: {
|
|
448
|
-
type: 'number'
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
},
|
|
453
|
-
topology_optimize: {
|
|
454
|
-
name: 'topology_optimize',
|
|
455
|
-
description: 'Auto-optimize swarm topology',
|
|
456
|
-
inputSchema: {
|
|
457
|
-
type: 'object',
|
|
458
|
-
properties: {
|
|
459
|
-
swarmId: {
|
|
460
|
-
type: 'string'
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
},
|
|
465
|
-
load_balance: {
|
|
466
|
-
name: 'load_balance',
|
|
467
|
-
description: 'Distribute tasks efficiently',
|
|
468
|
-
inputSchema: {
|
|
469
|
-
type: 'object',
|
|
470
|
-
properties: {
|
|
471
|
-
swarmId: {
|
|
472
|
-
type: 'string'
|
|
473
|
-
},
|
|
474
|
-
tasks: {
|
|
475
|
-
type: 'array'
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
},
|
|
480
|
-
coordination_sync: {
|
|
481
|
-
name: 'coordination_sync',
|
|
482
|
-
description: 'Sync agent coordination',
|
|
483
|
-
inputSchema: {
|
|
484
|
-
type: 'object',
|
|
485
|
-
properties: {
|
|
486
|
-
swarmId: {
|
|
487
|
-
type: 'string'
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
},
|
|
492
|
-
swarm_scale: {
|
|
493
|
-
name: 'swarm_scale',
|
|
494
|
-
description: 'Auto-scale agent count',
|
|
495
|
-
inputSchema: {
|
|
496
|
-
type: 'object',
|
|
497
|
-
properties: {
|
|
498
|
-
swarmId: {
|
|
499
|
-
type: 'string'
|
|
500
|
-
},
|
|
501
|
-
targetSize: {
|
|
502
|
-
type: 'number'
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
},
|
|
507
|
-
swarm_destroy: {
|
|
508
|
-
name: 'swarm_destroy',
|
|
509
|
-
description: 'Gracefully shutdown swarm',
|
|
510
|
-
inputSchema: {
|
|
511
|
-
type: 'object',
|
|
512
|
-
properties: {
|
|
513
|
-
swarmId: {
|
|
514
|
-
type: 'string'
|
|
515
|
-
}
|
|
516
|
-
},
|
|
517
|
-
required: [
|
|
518
|
-
'swarmId'
|
|
519
|
-
]
|
|
520
|
-
}
|
|
521
|
-
},
|
|
522
|
-
// Additional Neural Tools - DEPRECATED: Removed 13 advanced neural tools
|
|
523
|
-
// Tools removed: neural_predict, model_load, model_save, wasm_optimize, inference_run,
|
|
524
|
-
// pattern_recognize, cognitive_analyze, learning_adapt, neural_compress, ensemble_create,
|
|
525
|
-
// transfer_learn, neural_explain
|
|
526
|
-
// Rationale: Complexity reduction for novice users, functionality available via plugins
|
|
527
|
-
// Additional Memory Tools - DEPRECATED: Removed 10 advanced memory management tools
|
|
528
|
-
// Tools removed: memory_persist, memory_namespace, memory_backup, memory_restore,
|
|
529
|
-
// memory_compress, memory_sync, cache_manage, state_snapshot, context_restore, memory_analytics
|
|
530
|
-
// Retained: memory_usage, memory_search (core functionality)
|
|
531
|
-
// Rationale: Simplified memory interface, basic features in memory_usage sufficient
|
|
532
|
-
// Additional Analysis Tools
|
|
533
|
-
task_status: {
|
|
534
|
-
name: 'task_status',
|
|
535
|
-
description: 'Check task execution status',
|
|
536
|
-
inputSchema: {
|
|
537
|
-
type: 'object',
|
|
538
|
-
properties: {
|
|
539
|
-
taskId: {
|
|
540
|
-
type: 'string'
|
|
541
|
-
}
|
|
542
|
-
},
|
|
543
|
-
required: [
|
|
544
|
-
'taskId'
|
|
545
|
-
]
|
|
546
|
-
}
|
|
547
|
-
},
|
|
548
|
-
task_results: {
|
|
549
|
-
name: 'task_results',
|
|
550
|
-
description: 'Get task completion results',
|
|
551
|
-
inputSchema: {
|
|
552
|
-
type: 'object',
|
|
553
|
-
properties: {
|
|
554
|
-
taskId: {
|
|
555
|
-
type: 'string'
|
|
556
|
-
}
|
|
557
|
-
},
|
|
558
|
-
required: [
|
|
559
|
-
'taskId'
|
|
560
|
-
]
|
|
561
|
-
}
|
|
562
|
-
},
|
|
563
|
-
benchmark_run: {
|
|
564
|
-
name: 'benchmark_run',
|
|
565
|
-
description: 'Performance benchmarks',
|
|
566
|
-
inputSchema: {
|
|
567
|
-
type: 'object',
|
|
568
|
-
properties: {
|
|
569
|
-
suite: {
|
|
570
|
-
type: 'string'
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
},
|
|
575
|
-
metrics_collect: {
|
|
576
|
-
name: 'metrics_collect',
|
|
577
|
-
description: 'Collect system metrics',
|
|
578
|
-
inputSchema: {
|
|
579
|
-
type: 'object',
|
|
580
|
-
properties: {
|
|
581
|
-
components: {
|
|
582
|
-
type: 'array'
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
},
|
|
587
|
-
trend_analysis: {
|
|
588
|
-
name: 'trend_analysis',
|
|
589
|
-
description: 'Analyze performance trends',
|
|
590
|
-
inputSchema: {
|
|
591
|
-
type: 'object',
|
|
592
|
-
properties: {
|
|
593
|
-
metric: {
|
|
594
|
-
type: 'string'
|
|
595
|
-
},
|
|
596
|
-
period: {
|
|
597
|
-
type: 'string'
|
|
598
|
-
}
|
|
599
|
-
},
|
|
600
|
-
required: [
|
|
601
|
-
'metric'
|
|
602
|
-
]
|
|
603
|
-
}
|
|
604
|
-
},
|
|
605
|
-
cost_analysis: {
|
|
606
|
-
name: 'cost_analysis',
|
|
607
|
-
description: 'Cost and resource analysis',
|
|
608
|
-
inputSchema: {
|
|
609
|
-
type: 'object',
|
|
610
|
-
properties: {
|
|
611
|
-
timeframe: {
|
|
612
|
-
type: 'string'
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
},
|
|
617
|
-
quality_assess: {
|
|
618
|
-
name: 'quality_assess',
|
|
619
|
-
description: 'Quality assessment',
|
|
620
|
-
inputSchema: {
|
|
621
|
-
type: 'object',
|
|
622
|
-
properties: {
|
|
623
|
-
target: {
|
|
624
|
-
type: 'string'
|
|
625
|
-
},
|
|
626
|
-
criteria: {
|
|
627
|
-
type: 'array'
|
|
628
|
-
}
|
|
629
|
-
},
|
|
630
|
-
required: [
|
|
631
|
-
'target'
|
|
632
|
-
]
|
|
633
|
-
}
|
|
634
|
-
},
|
|
635
|
-
error_analysis: {
|
|
636
|
-
name: 'error_analysis',
|
|
637
|
-
description: 'Error pattern analysis',
|
|
638
|
-
inputSchema: {
|
|
639
|
-
type: 'object',
|
|
640
|
-
properties: {
|
|
641
|
-
logs: {
|
|
642
|
-
type: 'array'
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
},
|
|
647
|
-
usage_stats: {
|
|
648
|
-
name: 'usage_stats',
|
|
649
|
-
description: 'Usage statistics',
|
|
650
|
-
inputSchema: {
|
|
651
|
-
type: 'object',
|
|
652
|
-
properties: {
|
|
653
|
-
component: {
|
|
654
|
-
type: 'string'
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
},
|
|
659
|
-
health_check: {
|
|
660
|
-
name: 'health_check',
|
|
661
|
-
description: 'System health monitoring',
|
|
662
|
-
inputSchema: {
|
|
663
|
-
type: 'object',
|
|
664
|
-
properties: {
|
|
665
|
-
components: {
|
|
666
|
-
type: 'array'
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
},
|
|
671
|
-
// Additional Workflow Tools - DEPRECATED: Removed 9 workflow automation tools
|
|
672
|
-
// Tools removed: workflow_execute, workflow_export, automation_setup, pipeline_create,
|
|
673
|
-
// scheduler_manage, trigger_setup, workflow_template, batch_process, parallel_execute
|
|
674
|
-
// Retained: workflow_create (basic functionality)
|
|
675
|
-
// Rationale: Workflow execution integrated into task_orchestrate, reduces tool count
|
|
676
|
-
// GitHub Integration Tools
|
|
677
|
-
github_issue_track: {
|
|
678
|
-
name: 'github_issue_track',
|
|
679
|
-
description: 'Issue tracking & triage',
|
|
680
|
-
inputSchema: {
|
|
681
|
-
type: 'object',
|
|
682
|
-
properties: {
|
|
683
|
-
repo: {
|
|
684
|
-
type: 'string'
|
|
685
|
-
},
|
|
686
|
-
action: {
|
|
687
|
-
type: 'string'
|
|
688
|
-
}
|
|
689
|
-
},
|
|
690
|
-
required: [
|
|
691
|
-
'repo',
|
|
692
|
-
'action'
|
|
693
|
-
]
|
|
694
|
-
}
|
|
695
|
-
},
|
|
696
|
-
github_release_coord: {
|
|
697
|
-
name: 'github_release_coord',
|
|
698
|
-
description: 'Release coordination',
|
|
699
|
-
inputSchema: {
|
|
700
|
-
type: 'object',
|
|
701
|
-
properties: {
|
|
702
|
-
repo: {
|
|
703
|
-
type: 'string'
|
|
704
|
-
},
|
|
705
|
-
version: {
|
|
706
|
-
type: 'string'
|
|
707
|
-
}
|
|
708
|
-
},
|
|
709
|
-
required: [
|
|
710
|
-
'repo',
|
|
711
|
-
'version'
|
|
712
|
-
]
|
|
713
|
-
}
|
|
714
|
-
},
|
|
715
|
-
github_workflow_auto: {
|
|
716
|
-
name: 'github_workflow_auto',
|
|
717
|
-
description: 'Workflow automation',
|
|
718
|
-
inputSchema: {
|
|
719
|
-
type: 'object',
|
|
720
|
-
properties: {
|
|
721
|
-
repo: {
|
|
722
|
-
type: 'string'
|
|
723
|
-
},
|
|
724
|
-
workflow: {
|
|
725
|
-
type: 'object'
|
|
726
|
-
}
|
|
727
|
-
},
|
|
728
|
-
required: [
|
|
729
|
-
'repo',
|
|
730
|
-
'workflow'
|
|
731
|
-
]
|
|
732
|
-
}
|
|
733
|
-
},
|
|
734
|
-
github_code_review: {
|
|
735
|
-
name: 'github_code_review',
|
|
736
|
-
description: 'Automated code review',
|
|
737
|
-
inputSchema: {
|
|
738
|
-
type: 'object',
|
|
739
|
-
properties: {
|
|
740
|
-
repo: {
|
|
741
|
-
type: 'string'
|
|
742
|
-
},
|
|
743
|
-
pr: {
|
|
744
|
-
type: 'number'
|
|
745
|
-
}
|
|
746
|
-
},
|
|
747
|
-
required: [
|
|
748
|
-
'repo',
|
|
749
|
-
'pr'
|
|
750
|
-
]
|
|
751
|
-
}
|
|
752
|
-
},
|
|
753
|
-
github_sync_coord: {
|
|
754
|
-
name: 'github_sync_coord',
|
|
755
|
-
description: 'Multi-repo sync coordination',
|
|
756
|
-
inputSchema: {
|
|
757
|
-
type: 'object',
|
|
758
|
-
properties: {
|
|
759
|
-
repos: {
|
|
760
|
-
type: 'array'
|
|
761
|
-
}
|
|
762
|
-
},
|
|
763
|
-
required: [
|
|
764
|
-
'repos'
|
|
765
|
-
]
|
|
766
|
-
}
|
|
71
|
+
|
|
72
|
+
class ClaudeFlowMCPServer {
|
|
73
|
+
constructor() {
|
|
74
|
+
this.version = '2.0.0-alpha.59';
|
|
75
|
+
this.memoryStore = memoryStore; // Use shared singleton instance
|
|
76
|
+
// Use the same memory system that already works
|
|
77
|
+
this.capabilities = {
|
|
78
|
+
tools: {
|
|
79
|
+
listChanged: true,
|
|
80
|
+
},
|
|
81
|
+
resources: {
|
|
82
|
+
subscribe: true,
|
|
83
|
+
listChanged: true,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
this.sessionId = `session-cf-${Date.now()}-${Math.random().toString(36).substr(2, 4)}`;
|
|
87
|
+
this.tools = this.initializeTools();
|
|
88
|
+
this.resources = this.initializeResources();
|
|
89
|
+
|
|
90
|
+
// Initialize shared memory store (same as npx commands)
|
|
91
|
+
this.initializeMemory().catch((err) => {
|
|
92
|
+
console.error(
|
|
93
|
+
`[${new Date().toISOString()}] ERROR [claude-flow-mcp] Failed to initialize shared memory:`,
|
|
94
|
+
err,
|
|
95
|
+
);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// Database operations now use the same shared memory store as npx commands
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async initializeMemory() {
|
|
102
|
+
await this.memoryStore.initialize();
|
|
103
|
+
console.error(
|
|
104
|
+
`[${new Date().toISOString()}] INFO [claude-flow-mcp] (${this.sessionId}) Shared memory store initialized (same as npx)`,
|
|
105
|
+
);
|
|
106
|
+
console.error(
|
|
107
|
+
`[${new Date().toISOString()}] INFO [claude-flow-mcp] (${this.sessionId}) Using ${this.memoryStore.isUsingFallback() ? 'in-memory' : 'SQLite'} storage`,
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Database operations now use the same memory store as working npx commands
|
|
112
|
+
|
|
113
|
+
initializeTools() {
|
|
114
|
+
return {
|
|
115
|
+
// Swarm Coordination Tools (12)
|
|
116
|
+
swarm_init: {
|
|
117
|
+
name: 'swarm_init',
|
|
118
|
+
description: 'Initialize swarm with topology and configuration',
|
|
119
|
+
inputSchema: {
|
|
120
|
+
type: 'object',
|
|
121
|
+
properties: {
|
|
122
|
+
topology: { type: 'string', enum: ['hierarchical', 'mesh', 'ring', 'star'] },
|
|
123
|
+
maxAgents: { type: 'number', default: 8 },
|
|
124
|
+
strategy: { type: 'string', default: 'auto' },
|
|
125
|
+
},
|
|
126
|
+
required: ['topology'],
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
agent_spawn: {
|
|
130
|
+
name: 'agent_spawn',
|
|
131
|
+
description: 'Create specialized AI agents',
|
|
132
|
+
inputSchema: {
|
|
133
|
+
type: 'object',
|
|
134
|
+
properties: {
|
|
135
|
+
type: {
|
|
136
|
+
type: 'string',
|
|
137
|
+
enum: [
|
|
138
|
+
// Legacy types (for backward compatibility)
|
|
139
|
+
'coordinator',
|
|
140
|
+
'analyst',
|
|
141
|
+
'optimizer',
|
|
142
|
+
'documenter',
|
|
143
|
+
'monitor',
|
|
144
|
+
'specialist',
|
|
145
|
+
'architect',
|
|
146
|
+
// Current types
|
|
147
|
+
'task-orchestrator',
|
|
148
|
+
'code-analyzer',
|
|
149
|
+
'perf-analyzer',
|
|
150
|
+
'api-docs',
|
|
151
|
+
'performance-benchmarker',
|
|
152
|
+
'system-architect',
|
|
153
|
+
// Core types
|
|
154
|
+
'researcher',
|
|
155
|
+
'coder',
|
|
156
|
+
'tester',
|
|
157
|
+
'reviewer',
|
|
158
|
+
],
|
|
767
159
|
},
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
}
|
|
783
|
-
|
|
160
|
+
name: { type: 'string' },
|
|
161
|
+
capabilities: { type: 'array' },
|
|
162
|
+
swarmId: { type: 'string' },
|
|
163
|
+
},
|
|
164
|
+
required: ['type'],
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
task_orchestrate: {
|
|
168
|
+
name: 'task_orchestrate',
|
|
169
|
+
description: 'Orchestrate complex task workflows',
|
|
170
|
+
inputSchema: {
|
|
171
|
+
type: 'object',
|
|
172
|
+
properties: {
|
|
173
|
+
task: { type: 'string' },
|
|
174
|
+
strategy: { type: 'string', enum: ['parallel', 'sequential', 'adaptive', 'balanced'] },
|
|
175
|
+
priority: { type: 'string', enum: ['low', 'medium', 'high', 'critical'] },
|
|
176
|
+
dependencies: { type: 'array' },
|
|
177
|
+
},
|
|
178
|
+
required: ['task'],
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
swarm_status: {
|
|
182
|
+
name: 'swarm_status',
|
|
183
|
+
description: 'Monitor swarm health and performance',
|
|
184
|
+
inputSchema: {
|
|
185
|
+
type: 'object',
|
|
186
|
+
properties: {
|
|
187
|
+
swarmId: { type: 'string' },
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
// Neural Network Tools - DEPRECATED: Advanced neural features hidden from novice users
|
|
193
|
+
// Retained: neural_status, neural_train, neural_patterns (basic functionality)
|
|
194
|
+
// Use memory_usage for pattern storage instead of neural-specific tools
|
|
195
|
+
|
|
196
|
+
// Memory & Persistence Tools (12)
|
|
197
|
+
memory_usage: {
|
|
198
|
+
name: 'memory_usage',
|
|
199
|
+
description: 'Store/retrieve persistent memory with TTL and namespacing',
|
|
200
|
+
inputSchema: {
|
|
201
|
+
type: 'object',
|
|
202
|
+
properties: {
|
|
203
|
+
action: { type: 'string', enum: ['store', 'retrieve', 'list', 'delete', 'search'] },
|
|
204
|
+
key: { type: 'string' },
|
|
205
|
+
value: { type: 'string' },
|
|
206
|
+
namespace: { type: 'string', default: 'default' },
|
|
207
|
+
ttl: { type: 'number' },
|
|
208
|
+
},
|
|
209
|
+
required: ['action'],
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
memory_search: {
|
|
213
|
+
name: 'memory_search',
|
|
214
|
+
description: 'Search memory with patterns',
|
|
215
|
+
inputSchema: {
|
|
216
|
+
type: 'object',
|
|
217
|
+
properties: {
|
|
218
|
+
pattern: { type: 'string' },
|
|
219
|
+
namespace: { type: 'string' },
|
|
220
|
+
limit: { type: 'number', default: 10 },
|
|
221
|
+
},
|
|
222
|
+
required: ['pattern'],
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
// Analysis & Monitoring Tools (13)
|
|
227
|
+
performance_report: {
|
|
228
|
+
name: 'performance_report',
|
|
229
|
+
description: 'Generate performance reports with real-time metrics',
|
|
230
|
+
inputSchema: {
|
|
231
|
+
type: 'object',
|
|
232
|
+
properties: {
|
|
233
|
+
timeframe: { type: 'string', enum: ['24h', '7d', '30d'], default: '24h' },
|
|
234
|
+
format: { type: 'string', enum: ['summary', 'detailed', 'json'], default: 'summary' },
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
bottleneck_analyze: {
|
|
239
|
+
name: 'bottleneck_analyze',
|
|
240
|
+
description: 'Identify performance bottlenecks',
|
|
241
|
+
inputSchema: {
|
|
242
|
+
type: 'object',
|
|
243
|
+
properties: {
|
|
244
|
+
component: { type: 'string' },
|
|
245
|
+
metrics: { type: 'array' },
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
token_usage: {
|
|
250
|
+
name: 'token_usage',
|
|
251
|
+
description: 'Analyze token consumption',
|
|
252
|
+
inputSchema: {
|
|
253
|
+
type: 'object',
|
|
254
|
+
properties: {
|
|
255
|
+
operation: { type: 'string' },
|
|
256
|
+
timeframe: { type: 'string', default: '24h' },
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
|
|
261
|
+
// GitHub Integration Tools (8)
|
|
262
|
+
github_repo_analyze: {
|
|
263
|
+
name: 'github_repo_analyze',
|
|
264
|
+
description: 'Repository analysis',
|
|
265
|
+
inputSchema: {
|
|
266
|
+
type: 'object',
|
|
267
|
+
properties: {
|
|
268
|
+
repo: { type: 'string' },
|
|
269
|
+
analysis_type: { type: 'string', enum: ['code_quality', 'performance', 'security'] },
|
|
270
|
+
},
|
|
271
|
+
required: ['repo'],
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
github_pr_manage: {
|
|
275
|
+
name: 'github_pr_manage',
|
|
276
|
+
description: 'Pull request management',
|
|
277
|
+
inputSchema: {
|
|
278
|
+
type: 'object',
|
|
279
|
+
properties: {
|
|
280
|
+
repo: { type: 'string' },
|
|
281
|
+
pr_number: { type: 'number' },
|
|
282
|
+
action: { type: 'string', enum: ['review', 'merge', 'close'] },
|
|
283
|
+
},
|
|
284
|
+
required: ['repo', 'action'],
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
|
|
288
|
+
// DAA Tools - DEPRECATED: Tools removed, functionality integrated into swarm_init and agent_spawn
|
|
289
|
+
// Legacy tools daa_agent_create and daa_capability_match have been consolidated
|
|
290
|
+
|
|
291
|
+
// Workflow Tools (11)
|
|
292
|
+
workflow_create: {
|
|
293
|
+
name: 'workflow_create',
|
|
294
|
+
description: 'Create custom workflows',
|
|
295
|
+
inputSchema: {
|
|
296
|
+
type: 'object',
|
|
297
|
+
properties: {
|
|
298
|
+
name: { type: 'string' },
|
|
299
|
+
steps: { type: 'array' },
|
|
300
|
+
triggers: { type: 'array' },
|
|
301
|
+
},
|
|
302
|
+
required: ['name', 'steps'],
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
sparc_mode: {
|
|
306
|
+
name: 'sparc_mode',
|
|
307
|
+
description: 'Run SPARC development modes',
|
|
308
|
+
inputSchema: {
|
|
309
|
+
type: 'object',
|
|
310
|
+
properties: {
|
|
311
|
+
mode: { type: 'string', enum: ['dev', 'api', 'ui', 'test', 'refactor'] },
|
|
312
|
+
task_description: { type: 'string' },
|
|
313
|
+
options: { type: 'object' },
|
|
314
|
+
},
|
|
315
|
+
required: ['mode', 'task_description'],
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
|
|
319
|
+
// Additional Swarm Tools
|
|
320
|
+
agent_list: {
|
|
321
|
+
name: 'agent_list',
|
|
322
|
+
description: 'List active agents & capabilities',
|
|
323
|
+
inputSchema: { type: 'object', properties: { swarmId: { type: 'string' } } },
|
|
324
|
+
},
|
|
325
|
+
agent_metrics: {
|
|
326
|
+
name: 'agent_metrics',
|
|
327
|
+
description: 'Agent performance metrics',
|
|
328
|
+
inputSchema: { type: 'object', properties: { agentId: { type: 'string' } } },
|
|
329
|
+
},
|
|
330
|
+
swarm_monitor: {
|
|
331
|
+
name: 'swarm_monitor',
|
|
332
|
+
description: 'Real-time swarm monitoring',
|
|
333
|
+
inputSchema: {
|
|
334
|
+
type: 'object',
|
|
335
|
+
properties: { swarmId: { type: 'string' }, interval: { type: 'number' } },
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
topology_optimize: {
|
|
339
|
+
name: 'topology_optimize',
|
|
340
|
+
description: 'Auto-optimize swarm topology',
|
|
341
|
+
inputSchema: { type: 'object', properties: { swarmId: { type: 'string' } } },
|
|
342
|
+
},
|
|
343
|
+
load_balance: {
|
|
344
|
+
name: 'load_balance',
|
|
345
|
+
description: 'Distribute tasks efficiently',
|
|
346
|
+
inputSchema: {
|
|
347
|
+
type: 'object',
|
|
348
|
+
properties: { swarmId: { type: 'string' }, tasks: { type: 'array' } },
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
coordination_sync: {
|
|
352
|
+
name: 'coordination_sync',
|
|
353
|
+
description: 'Sync agent coordination',
|
|
354
|
+
inputSchema: { type: 'object', properties: { swarmId: { type: 'string' } } },
|
|
355
|
+
},
|
|
356
|
+
swarm_scale: {
|
|
357
|
+
name: 'swarm_scale',
|
|
358
|
+
description: 'Auto-scale agent count',
|
|
359
|
+
inputSchema: {
|
|
360
|
+
type: 'object',
|
|
361
|
+
properties: { swarmId: { type: 'string' }, targetSize: { type: 'number' } },
|
|
362
|
+
},
|
|
363
|
+
},
|
|
364
|
+
swarm_destroy: {
|
|
365
|
+
name: 'swarm_destroy',
|
|
366
|
+
description: 'Gracefully shutdown swarm',
|
|
367
|
+
inputSchema: {
|
|
368
|
+
type: 'object',
|
|
369
|
+
properties: { swarmId: { type: 'string' } },
|
|
370
|
+
required: ['swarmId'],
|
|
371
|
+
},
|
|
372
|
+
},
|
|
373
|
+
|
|
374
|
+
// Additional Neural Tools - DEPRECATED: Removed 13 advanced neural tools
|
|
375
|
+
// Tools removed: neural_predict, model_load, model_save, wasm_optimize, inference_run,
|
|
376
|
+
// pattern_recognize, cognitive_analyze, learning_adapt, neural_compress, ensemble_create,
|
|
377
|
+
// transfer_learn, neural_explain
|
|
378
|
+
// Rationale: Complexity reduction for novice users, functionality available via plugins
|
|
379
|
+
|
|
380
|
+
// Additional Memory Tools - DEPRECATED: Removed 10 advanced memory management tools
|
|
381
|
+
// Tools removed: memory_persist, memory_namespace, memory_backup, memory_restore,
|
|
382
|
+
// memory_compress, memory_sync, cache_manage, state_snapshot, context_restore, memory_analytics
|
|
383
|
+
// Retained: memory_usage, memory_search (core functionality)
|
|
384
|
+
// Rationale: Simplified memory interface, basic features in memory_usage sufficient
|
|
385
|
+
|
|
386
|
+
// Additional Analysis Tools
|
|
387
|
+
task_status: {
|
|
388
|
+
name: 'task_status',
|
|
389
|
+
description: 'Check task execution status',
|
|
390
|
+
inputSchema: {
|
|
391
|
+
type: 'object',
|
|
392
|
+
properties: { taskId: { type: 'string' } },
|
|
393
|
+
required: ['taskId'],
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
task_results: {
|
|
397
|
+
name: 'task_results',
|
|
398
|
+
description: 'Get task completion results',
|
|
399
|
+
inputSchema: {
|
|
400
|
+
type: 'object',
|
|
401
|
+
properties: { taskId: { type: 'string' } },
|
|
402
|
+
required: ['taskId'],
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
benchmark_run: {
|
|
406
|
+
name: 'benchmark_run',
|
|
407
|
+
description: 'Performance benchmarks',
|
|
408
|
+
inputSchema: { type: 'object', properties: { suite: { type: 'string' } } },
|
|
409
|
+
},
|
|
410
|
+
metrics_collect: {
|
|
411
|
+
name: 'metrics_collect',
|
|
412
|
+
description: 'Collect system metrics',
|
|
413
|
+
inputSchema: { type: 'object', properties: { components: { type: 'array' } } },
|
|
414
|
+
},
|
|
415
|
+
trend_analysis: {
|
|
416
|
+
name: 'trend_analysis',
|
|
417
|
+
description: 'Analyze performance trends',
|
|
418
|
+
inputSchema: {
|
|
419
|
+
type: 'object',
|
|
420
|
+
properties: { metric: { type: 'string' }, period: { type: 'string' } },
|
|
421
|
+
required: ['metric'],
|
|
422
|
+
},
|
|
423
|
+
},
|
|
424
|
+
cost_analysis: {
|
|
425
|
+
name: 'cost_analysis',
|
|
426
|
+
description: 'Cost and resource analysis',
|
|
427
|
+
inputSchema: { type: 'object', properties: { timeframe: { type: 'string' } } },
|
|
428
|
+
},
|
|
429
|
+
quality_assess: {
|
|
430
|
+
name: 'quality_assess',
|
|
431
|
+
description: 'Quality assessment',
|
|
432
|
+
inputSchema: {
|
|
433
|
+
type: 'object',
|
|
434
|
+
properties: { target: { type: 'string' }, criteria: { type: 'array' } },
|
|
435
|
+
required: ['target'],
|
|
436
|
+
},
|
|
437
|
+
},
|
|
438
|
+
error_analysis: {
|
|
439
|
+
name: 'error_analysis',
|
|
440
|
+
description: 'Error pattern analysis',
|
|
441
|
+
inputSchema: { type: 'object', properties: { logs: { type: 'array' } } },
|
|
442
|
+
},
|
|
443
|
+
usage_stats: {
|
|
444
|
+
name: 'usage_stats',
|
|
445
|
+
description: 'Usage statistics',
|
|
446
|
+
inputSchema: { type: 'object', properties: { component: { type: 'string' } } },
|
|
447
|
+
},
|
|
448
|
+
health_check: {
|
|
449
|
+
name: 'health_check',
|
|
450
|
+
description: 'System health monitoring',
|
|
451
|
+
inputSchema: { type: 'object', properties: { components: { type: 'array' } } },
|
|
452
|
+
},
|
|
453
|
+
|
|
454
|
+
// Additional Workflow Tools - DEPRECATED: Removed 9 workflow automation tools
|
|
455
|
+
// Tools removed: workflow_execute, workflow_export, automation_setup, pipeline_create,
|
|
456
|
+
// scheduler_manage, trigger_setup, workflow_template, batch_process, parallel_execute
|
|
457
|
+
// Retained: workflow_create (basic functionality)
|
|
458
|
+
// Rationale: Workflow execution integrated into task_orchestrate, reduces tool count
|
|
459
|
+
|
|
460
|
+
// GitHub Integration Tools
|
|
461
|
+
github_issue_track: {
|
|
462
|
+
name: 'github_issue_track',
|
|
463
|
+
description: 'Issue tracking & triage',
|
|
464
|
+
inputSchema: {
|
|
465
|
+
type: 'object',
|
|
466
|
+
properties: { repo: { type: 'string' }, action: { type: 'string' } },
|
|
467
|
+
required: ['repo', 'action'],
|
|
468
|
+
},
|
|
469
|
+
},
|
|
470
|
+
github_release_coord: {
|
|
471
|
+
name: 'github_release_coord',
|
|
472
|
+
description: 'Release coordination',
|
|
473
|
+
inputSchema: {
|
|
474
|
+
type: 'object',
|
|
475
|
+
properties: { repo: { type: 'string' }, version: { type: 'string' } },
|
|
476
|
+
required: ['repo', 'version'],
|
|
477
|
+
},
|
|
478
|
+
},
|
|
479
|
+
github_workflow_auto: {
|
|
480
|
+
name: 'github_workflow_auto',
|
|
481
|
+
description: 'Workflow automation',
|
|
482
|
+
inputSchema: {
|
|
483
|
+
type: 'object',
|
|
484
|
+
properties: { repo: { type: 'string' }, workflow: { type: 'object' } },
|
|
485
|
+
required: ['repo', 'workflow'],
|
|
486
|
+
},
|
|
487
|
+
},
|
|
488
|
+
github_code_review: {
|
|
489
|
+
name: 'github_code_review',
|
|
490
|
+
description: 'Automated code review',
|
|
491
|
+
inputSchema: {
|
|
492
|
+
type: 'object',
|
|
493
|
+
properties: { repo: { type: 'string' }, pr: { type: 'number' } },
|
|
494
|
+
required: ['repo', 'pr'],
|
|
495
|
+
},
|
|
496
|
+
},
|
|
497
|
+
github_sync_coord: {
|
|
498
|
+
name: 'github_sync_coord',
|
|
499
|
+
description: 'Multi-repo sync coordination',
|
|
500
|
+
inputSchema: {
|
|
501
|
+
type: 'object',
|
|
502
|
+
properties: { repos: { type: 'array' } },
|
|
503
|
+
required: ['repos'],
|
|
504
|
+
},
|
|
505
|
+
},
|
|
506
|
+
github_metrics: {
|
|
507
|
+
name: 'github_metrics',
|
|
508
|
+
description: 'Repository metrics',
|
|
509
|
+
inputSchema: {
|
|
510
|
+
type: 'object',
|
|
511
|
+
properties: { repo: { type: 'string' } },
|
|
512
|
+
required: ['repo'],
|
|
513
|
+
},
|
|
514
|
+
},
|
|
515
|
+
|
|
516
|
+
// Additional DAA Tools - DEPRECATED: Removed 6 advanced DAA tools
|
|
517
|
+
// Tools removed: daa_resource_alloc, daa_lifecycle_manage, daa_communication,
|
|
518
|
+
// daa_consensus, daa_fault_tolerance, daa_optimization
|
|
519
|
+
// Rationale: DAA functionality consolidated into core swarm tools (swarm_init, agent_spawn, task_orchestrate)
|
|
520
|
+
|
|
521
|
+
// System & Utilities Tools - DEPRECATED: Removed 8 system utility tools
|
|
522
|
+
// Tools removed: terminal_execute, config_manage, features_detect, security_scan,
|
|
523
|
+
// backup_create, restore_system, log_analysis, diagnostic_run
|
|
524
|
+
// Rationale: Terminal execution insecure for MCP, other tools redundant with CLI commands
|
|
525
|
+
// Note: features_detect retained in limited scope for framework detection only
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
initializeResources() {
|
|
530
|
+
return {
|
|
531
|
+
'claude-flow://swarms': {
|
|
532
|
+
uri: 'claude-flow://swarms',
|
|
533
|
+
name: 'Active Swarms',
|
|
534
|
+
description: 'List of active swarm configurations and status',
|
|
535
|
+
mimeType: 'application/json',
|
|
536
|
+
},
|
|
537
|
+
'claude-flow://agents': {
|
|
538
|
+
uri: 'claude-flow://agents',
|
|
539
|
+
name: 'Agent Registry',
|
|
540
|
+
description: 'Registry of available agents and their capabilities',
|
|
541
|
+
mimeType: 'application/json',
|
|
542
|
+
},
|
|
543
|
+
'claude-flow://models': {
|
|
544
|
+
uri: 'claude-flow://models',
|
|
545
|
+
name: 'Neural Models',
|
|
546
|
+
description: 'Available neural network models and training status',
|
|
547
|
+
mimeType: 'application/json',
|
|
548
|
+
},
|
|
549
|
+
'claude-flow://performance': {
|
|
550
|
+
uri: 'claude-flow://performance',
|
|
551
|
+
name: 'Performance Metrics',
|
|
552
|
+
description: 'Real-time performance metrics and benchmarks',
|
|
553
|
+
mimeType: 'application/json',
|
|
554
|
+
},
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
async handleMessage(message) {
|
|
559
|
+
try {
|
|
560
|
+
const { id, method, params } = message;
|
|
561
|
+
|
|
562
|
+
switch (method) {
|
|
563
|
+
case 'initialize':
|
|
564
|
+
return this.handleInitialize(id, params);
|
|
565
|
+
case 'tools/list':
|
|
566
|
+
return this.handleToolsList(id);
|
|
567
|
+
case 'tools/call':
|
|
568
|
+
return this.handleToolCall(id, params);
|
|
569
|
+
case 'resources/list':
|
|
570
|
+
return this.handleResourcesList(id);
|
|
571
|
+
case 'resources/read':
|
|
572
|
+
return this.handleResourceRead(id, params);
|
|
573
|
+
default:
|
|
574
|
+
return this.createErrorResponse(id, -32601, 'Method not found');
|
|
575
|
+
}
|
|
576
|
+
} catch (error) {
|
|
577
|
+
return this.createErrorResponse(message.id, -32603, 'Internal error', error.message);
|
|
784
578
|
}
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
handleInitialize(id, params) {
|
|
582
|
+
console.error(
|
|
583
|
+
`[${new Date().toISOString()}] INFO [claude-flow-mcp] (${this.sessionId}) 🔌 Connection established: ${this.sessionId}`,
|
|
584
|
+
);
|
|
585
|
+
|
|
586
|
+
return {
|
|
587
|
+
jsonrpc: '2.0',
|
|
588
|
+
id,
|
|
589
|
+
result: {
|
|
590
|
+
protocolVersion: '2024-11-05',
|
|
591
|
+
capabilities: this.capabilities,
|
|
592
|
+
serverInfo: {
|
|
593
|
+
name: 'claude-flow',
|
|
594
|
+
version: this.version,
|
|
595
|
+
},
|
|
596
|
+
},
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
handleToolsList(id) {
|
|
601
|
+
const toolsList = Object.values(this.tools);
|
|
602
|
+
return {
|
|
603
|
+
jsonrpc: '2.0',
|
|
604
|
+
id,
|
|
605
|
+
result: {
|
|
606
|
+
tools: toolsList,
|
|
607
|
+
},
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
async handleToolCall(id, params) {
|
|
612
|
+
const { name, arguments: args } = params;
|
|
613
|
+
|
|
614
|
+
console.error(
|
|
615
|
+
`[${new Date().toISOString()}] INFO [claude-flow-mcp] (${this.sessionId}) 🔧 Tool called: ${name}`,
|
|
616
|
+
);
|
|
617
|
+
|
|
618
|
+
try {
|
|
619
|
+
const result = await this.executeTool(name, args);
|
|
620
|
+
return {
|
|
621
|
+
jsonrpc: '2.0',
|
|
622
|
+
id,
|
|
623
|
+
result: {
|
|
624
|
+
content: [
|
|
625
|
+
{
|
|
626
|
+
type: 'text',
|
|
627
|
+
text: JSON.stringify(result, null, 2),
|
|
798
628
|
},
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
629
|
+
],
|
|
630
|
+
},
|
|
631
|
+
};
|
|
632
|
+
} catch (error) {
|
|
633
|
+
return this.createErrorResponse(id, -32000, 'Tool execution failed', error.message);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
handleResourcesList(id) {
|
|
638
|
+
const resourcesList = Object.values(this.resources);
|
|
639
|
+
return {
|
|
640
|
+
jsonrpc: '2.0',
|
|
641
|
+
id,
|
|
642
|
+
result: {
|
|
643
|
+
resources: resourcesList,
|
|
644
|
+
},
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
async handleResourceRead(id, params) {
|
|
649
|
+
const { uri } = params;
|
|
650
|
+
|
|
651
|
+
try {
|
|
652
|
+
const content = await this.readResource(uri);
|
|
653
|
+
return {
|
|
654
|
+
jsonrpc: '2.0',
|
|
655
|
+
id,
|
|
656
|
+
result: {
|
|
657
|
+
contents: [
|
|
658
|
+
{
|
|
659
|
+
uri,
|
|
660
|
+
mimeType: 'application/json',
|
|
661
|
+
text: JSON.stringify(content, null, 2),
|
|
804
662
|
},
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
}
|
|
811
|
-
};
|
|
663
|
+
],
|
|
664
|
+
},
|
|
665
|
+
};
|
|
666
|
+
} catch (error) {
|
|
667
|
+
return this.createErrorResponse(id, -32000, 'Resource read failed', error.message);
|
|
812
668
|
}
|
|
813
|
-
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
async executeTool(name, args) {
|
|
672
|
+
// Simulate tool execution based on the tool name
|
|
673
|
+
switch (name) {
|
|
674
|
+
case 'swarm_init':
|
|
675
|
+
const swarmId = `swarm_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
676
|
+
|
|
677
|
+
// Track swarm creation
|
|
678
|
+
if (global.agentTracker) {
|
|
679
|
+
global.agentTracker.trackSwarm(swarmId, {
|
|
680
|
+
topology: args.topology || 'mesh',
|
|
681
|
+
maxAgents: args.maxAgents || 5,
|
|
682
|
+
strategy: args.strategy || 'balanced',
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
const swarmData = {
|
|
687
|
+
id: swarmId,
|
|
688
|
+
name: `Swarm-${new Date().toISOString().split('T')[0]}`,
|
|
689
|
+
topology: args.topology || 'hierarchical',
|
|
690
|
+
queenMode: 'collaborative',
|
|
691
|
+
maxAgents: args.maxAgents || 8,
|
|
692
|
+
consensusThreshold: 0.7,
|
|
693
|
+
memoryTTL: 86400, // 24 hours
|
|
694
|
+
config: JSON.stringify({
|
|
695
|
+
strategy: args.strategy || 'auto',
|
|
696
|
+
sessionId: this.sessionId,
|
|
697
|
+
createdBy: 'mcp-server',
|
|
698
|
+
}),
|
|
699
|
+
};
|
|
700
|
+
|
|
701
|
+
// Store swarm data in memory store (same as npx commands)
|
|
814
702
|
try {
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
return this.handleResourceRead(id, params);
|
|
827
|
-
default:
|
|
828
|
-
return this.createErrorResponse(id, -32601, 'Method not found');
|
|
829
|
-
}
|
|
703
|
+
await this.memoryStore.store(`swarm:${swarmId}`, JSON.stringify(swarmData), {
|
|
704
|
+
namespace: 'swarms',
|
|
705
|
+
metadata: { type: 'swarm_data', sessionId: this.sessionId },
|
|
706
|
+
});
|
|
707
|
+
await this.memoryStore.store('active_swarm', swarmId, {
|
|
708
|
+
namespace: 'system',
|
|
709
|
+
metadata: { type: 'active_swarm', sessionId: this.sessionId },
|
|
710
|
+
});
|
|
711
|
+
console.error(
|
|
712
|
+
`[${new Date().toISOString()}] INFO [claude-flow-mcp] Swarm persisted to memory: ${swarmId}`,
|
|
713
|
+
);
|
|
830
714
|
} catch (error) {
|
|
831
|
-
|
|
715
|
+
console.error(
|
|
716
|
+
`[${new Date().toISOString()}] ERROR [claude-flow-mcp] Failed to persist swarm:`,
|
|
717
|
+
error,
|
|
718
|
+
);
|
|
832
719
|
}
|
|
833
|
-
|
|
834
|
-
handleInitialize(id, params) {
|
|
835
|
-
console.error(`[${new Date().toISOString()}] INFO [claude-flow-mcp] (${this.sessionId}) 🔌 Connection established: ${this.sessionId}`);
|
|
720
|
+
|
|
836
721
|
return {
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
}
|
|
846
|
-
}
|
|
722
|
+
success: true,
|
|
723
|
+
swarmId: swarmId,
|
|
724
|
+
topology: swarmData.topology,
|
|
725
|
+
maxAgents: swarmData.maxAgents,
|
|
726
|
+
strategy: args.strategy || 'auto',
|
|
727
|
+
status: 'initialized',
|
|
728
|
+
persisted: !!this.databaseManager,
|
|
729
|
+
timestamp: new Date().toISOString(),
|
|
847
730
|
};
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
const
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
731
|
+
|
|
732
|
+
case 'agent_spawn':
|
|
733
|
+
const agentId = `agent_${Date.now()}_${Math.random().toString(36).substr(2, 6)}`;
|
|
734
|
+
const resolvedType = resolveLegacyAgentType(args.type);
|
|
735
|
+
const agentData = {
|
|
736
|
+
id: agentId,
|
|
737
|
+
swarmId: args.swarmId || (await this.getActiveSwarmId()),
|
|
738
|
+
name: args.name || `${resolvedType}-${Date.now()}`,
|
|
739
|
+
type: resolvedType,
|
|
740
|
+
status: 'active',
|
|
741
|
+
capabilities: JSON.stringify(args.capabilities || []),
|
|
742
|
+
metadata: JSON.stringify({
|
|
743
|
+
sessionId: this.sessionId,
|
|
744
|
+
createdBy: 'mcp-server',
|
|
745
|
+
spawnedAt: new Date().toISOString(),
|
|
746
|
+
}),
|
|
857
747
|
};
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
const { name, arguments: args } = params;
|
|
861
|
-
console.error(`[${new Date().toISOString()}] INFO [claude-flow-mcp] (${this.sessionId}) 🔧 Tool called: ${name}`);
|
|
748
|
+
|
|
749
|
+
// Store agent data in memory store (same as npx commands)
|
|
862
750
|
try {
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
751
|
+
const swarmId = agentData.swarmId || (await this.getActiveSwarmId());
|
|
752
|
+
if (swarmId) {
|
|
753
|
+
await this.memoryStore.store(`agent:${swarmId}:${agentId}`, JSON.stringify(agentData), {
|
|
754
|
+
namespace: 'agents',
|
|
755
|
+
metadata: { type: 'agent_data', swarmId: swarmId, sessionId: this.sessionId },
|
|
756
|
+
});
|
|
757
|
+
} else {
|
|
758
|
+
// Fallback to old format if no swarm ID
|
|
759
|
+
await this.memoryStore.store(`agent:${agentId}`, JSON.stringify(agentData), {
|
|
760
|
+
namespace: 'agents',
|
|
761
|
+
metadata: { type: 'agent_data', sessionId: this.sessionId },
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
console.error(
|
|
765
|
+
`[${new Date().toISOString()}] INFO [claude-flow-mcp] Agent persisted to memory: ${agentId}`,
|
|
766
|
+
);
|
|
876
767
|
} catch (error) {
|
|
877
|
-
|
|
768
|
+
console.error(
|
|
769
|
+
`[${new Date().toISOString()}] ERROR [claude-flow-mcp] Failed to persist agent:`,
|
|
770
|
+
error,
|
|
771
|
+
);
|
|
878
772
|
}
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
773
|
+
|
|
774
|
+
// Track spawned agent
|
|
775
|
+
if (global.agentTracker) {
|
|
776
|
+
global.agentTracker.trackAgent(agentId, {
|
|
777
|
+
...agentData,
|
|
778
|
+
capabilities: args.capabilities || [],
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
|
|
882
782
|
return {
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
783
|
+
success: true,
|
|
784
|
+
agentId: agentId,
|
|
785
|
+
type: args.type,
|
|
786
|
+
name: agentData.name,
|
|
787
|
+
status: 'active',
|
|
788
|
+
capabilities: args.capabilities || [],
|
|
789
|
+
persisted: !!this.databaseManager,
|
|
790
|
+
timestamp: new Date().toISOString(),
|
|
888
791
|
};
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
const
|
|
892
|
-
|
|
893
|
-
|
|
792
|
+
|
|
793
|
+
case 'neural_train':
|
|
794
|
+
const epochs = args.epochs || 50;
|
|
795
|
+
const baseAccuracy = 0.65;
|
|
796
|
+
const maxAccuracy = 0.98;
|
|
797
|
+
|
|
798
|
+
// Realistic training progression: more epochs = better accuracy but with diminishing returns
|
|
799
|
+
const epochFactor = Math.min(epochs / 100, 10); // Normalize epochs
|
|
800
|
+
const accuracyGain = (maxAccuracy - baseAccuracy) * (1 - Math.exp(-epochFactor / 3));
|
|
801
|
+
const finalAccuracy = baseAccuracy + accuracyGain + (Math.random() * 0.05 - 0.025); // Add some noise
|
|
802
|
+
|
|
803
|
+
// Training time increases with epochs but not linearly (parallel processing)
|
|
804
|
+
const baseTime = 2;
|
|
805
|
+
const timePerEpoch = 0.08;
|
|
806
|
+
const trainingTime = baseTime + epochs * timePerEpoch + (Math.random() * 2 - 1);
|
|
807
|
+
|
|
808
|
+
return {
|
|
809
|
+
success: true,
|
|
810
|
+
modelId: `model_${args.pattern_type || 'general'}_${Date.now()}`,
|
|
811
|
+
pattern_type: args.pattern_type || 'coordination',
|
|
812
|
+
epochs: epochs,
|
|
813
|
+
accuracy: Math.min(finalAccuracy, maxAccuracy),
|
|
814
|
+
training_time: Math.max(trainingTime, 1),
|
|
815
|
+
status: 'completed',
|
|
816
|
+
improvement_rate: epochFactor > 1 ? 'converged' : 'improving',
|
|
817
|
+
data_source: args.training_data || 'recent',
|
|
818
|
+
timestamp: new Date().toISOString(),
|
|
819
|
+
};
|
|
820
|
+
|
|
821
|
+
case 'memory_usage':
|
|
822
|
+
return await this.handleMemoryUsage(args);
|
|
823
|
+
|
|
824
|
+
case 'performance_report':
|
|
825
|
+
return {
|
|
826
|
+
success: true,
|
|
827
|
+
timeframe: args.timeframe || '24h',
|
|
828
|
+
format: args.format || 'summary',
|
|
829
|
+
metrics: {
|
|
830
|
+
tasks_executed: Math.floor(Math.random() * 200) + 50,
|
|
831
|
+
success_rate: Math.random() * 0.2 + 0.8,
|
|
832
|
+
avg_execution_time: Math.random() * 10 + 5,
|
|
833
|
+
agents_spawned: Math.floor(Math.random() * 50) + 10,
|
|
834
|
+
memory_efficiency: Math.random() * 0.3 + 0.7,
|
|
835
|
+
neural_events: Math.floor(Math.random() * 100) + 20,
|
|
836
|
+
},
|
|
837
|
+
timestamp: new Date().toISOString(),
|
|
838
|
+
};
|
|
839
|
+
|
|
840
|
+
// DEPRECATED: Enhanced Neural Tools - Handlers removed for 10 deprecated neural tools
|
|
841
|
+
// Removed cases: model_save, model_load, neural_predict, pattern_recognize, cognitive_analyze,
|
|
842
|
+
// learning_adapt, neural_compress, ensemble_create, transfer_learn, neural_explain
|
|
843
|
+
// Rationale: Complexity reduction, functionality available via plugin architecture
|
|
844
|
+
|
|
845
|
+
case 'agent_list':
|
|
846
|
+
// First check agent tracker for real-time data
|
|
847
|
+
if (global.agentTracker) {
|
|
848
|
+
const swarmId = args.swarmId || (await this.getActiveSwarmId());
|
|
849
|
+
const trackedAgents = global.agentTracker.getAgents(swarmId);
|
|
850
|
+
|
|
851
|
+
if (trackedAgents.length > 0) {
|
|
894
852
|
return {
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
uri,
|
|
901
|
-
mimeType: 'application/json',
|
|
902
|
-
text: JSON.stringify(content, null, 2)
|
|
903
|
-
}
|
|
904
|
-
]
|
|
905
|
-
}
|
|
853
|
+
success: true,
|
|
854
|
+
swarmId: swarmId || 'dynamic',
|
|
855
|
+
agents: trackedAgents,
|
|
856
|
+
count: trackedAgents.length,
|
|
857
|
+
timestamp: new Date().toISOString(),
|
|
906
858
|
};
|
|
907
|
-
|
|
908
|
-
return this.createErrorResponse(id, -32000, 'Resource read failed', error.message);
|
|
859
|
+
}
|
|
909
860
|
}
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
// Track swarm creation
|
|
917
|
-
if (global.agentTracker) {
|
|
918
|
-
global.agentTracker.trackSwarm(swarmId, {
|
|
919
|
-
topology: args.topology || 'mesh',
|
|
920
|
-
maxAgents: args.maxAgents || 5,
|
|
921
|
-
strategy: args.strategy || 'balanced'
|
|
922
|
-
});
|
|
923
|
-
}
|
|
924
|
-
const swarmData = {
|
|
925
|
-
id: swarmId,
|
|
926
|
-
name: `Swarm-${new Date().toISOString().split('T')[0]}`,
|
|
927
|
-
topology: args.topology || 'hierarchical',
|
|
928
|
-
queenMode: 'collaborative',
|
|
929
|
-
maxAgents: args.maxAgents || 8,
|
|
930
|
-
consensusThreshold: 0.7,
|
|
931
|
-
memoryTTL: 86400,
|
|
932
|
-
config: JSON.stringify({
|
|
933
|
-
strategy: args.strategy || 'auto',
|
|
934
|
-
sessionId: this.sessionId,
|
|
935
|
-
createdBy: 'mcp-server'
|
|
936
|
-
})
|
|
937
|
-
};
|
|
938
|
-
// Store swarm data in memory store (same as npx commands)
|
|
939
|
-
try {
|
|
940
|
-
await this.memoryStore.store(`swarm:${swarmId}`, JSON.stringify(swarmData), {
|
|
941
|
-
namespace: 'swarms',
|
|
942
|
-
metadata: {
|
|
943
|
-
type: 'swarm_data',
|
|
944
|
-
sessionId: this.sessionId
|
|
945
|
-
}
|
|
946
|
-
});
|
|
947
|
-
await this.memoryStore.store('active_swarm', swarmId, {
|
|
948
|
-
namespace: 'system',
|
|
949
|
-
metadata: {
|
|
950
|
-
type: 'active_swarm',
|
|
951
|
-
sessionId: this.sessionId
|
|
952
|
-
}
|
|
953
|
-
});
|
|
954
|
-
console.error(`[${new Date().toISOString()}] INFO [claude-flow-mcp] Swarm persisted to memory: ${swarmId}`);
|
|
955
|
-
} catch (error) {
|
|
956
|
-
console.error(`[${new Date().toISOString()}] ERROR [claude-flow-mcp] Failed to persist swarm:`, error);
|
|
957
|
-
}
|
|
958
|
-
return {
|
|
959
|
-
success: true,
|
|
960
|
-
swarmId: swarmId,
|
|
961
|
-
topology: swarmData.topology,
|
|
962
|
-
maxAgents: swarmData.maxAgents,
|
|
963
|
-
strategy: args.strategy || 'auto',
|
|
964
|
-
status: 'initialized',
|
|
965
|
-
persisted: !!this.databaseManager,
|
|
966
|
-
timestamp: new Date().toISOString()
|
|
967
|
-
};
|
|
968
|
-
case 'agent_spawn':
|
|
969
|
-
const agentId = `agent_${Date.now()}_${Math.random().toString(36).substr(2, 6)}`;
|
|
970
|
-
const resolvedType = resolveLegacyAgentType(args.type);
|
|
971
|
-
const agentData = {
|
|
972
|
-
id: agentId,
|
|
973
|
-
swarmId: args.swarmId || await this.getActiveSwarmId(),
|
|
974
|
-
name: args.name || `${resolvedType}-${Date.now()}`,
|
|
975
|
-
type: resolvedType,
|
|
976
|
-
status: 'active',
|
|
977
|
-
capabilities: JSON.stringify(args.capabilities || []),
|
|
978
|
-
metadata: JSON.stringify({
|
|
979
|
-
sessionId: this.sessionId,
|
|
980
|
-
createdBy: 'mcp-server',
|
|
981
|
-
spawnedAt: new Date().toISOString()
|
|
982
|
-
})
|
|
983
|
-
};
|
|
984
|
-
// Store agent data in memory store (same as npx commands)
|
|
985
|
-
try {
|
|
986
|
-
const swarmId = agentData.swarmId || await this.getActiveSwarmId();
|
|
987
|
-
if (swarmId) {
|
|
988
|
-
await this.memoryStore.store(`agent:${swarmId}:${agentId}`, JSON.stringify(agentData), {
|
|
989
|
-
namespace: 'agents',
|
|
990
|
-
metadata: {
|
|
991
|
-
type: 'agent_data',
|
|
992
|
-
swarmId: swarmId,
|
|
993
|
-
sessionId: this.sessionId
|
|
994
|
-
}
|
|
995
|
-
});
|
|
996
|
-
} else {
|
|
997
|
-
// Fallback to old format if no swarm ID
|
|
998
|
-
await this.memoryStore.store(`agent:${agentId}`, JSON.stringify(agentData), {
|
|
999
|
-
namespace: 'agents',
|
|
1000
|
-
metadata: {
|
|
1001
|
-
type: 'agent_data',
|
|
1002
|
-
sessionId: this.sessionId
|
|
1003
|
-
}
|
|
1004
|
-
});
|
|
1005
|
-
}
|
|
1006
|
-
console.error(`[${new Date().toISOString()}] INFO [claude-flow-mcp] Agent persisted to memory: ${agentId}`);
|
|
1007
|
-
} catch (error) {
|
|
1008
|
-
console.error(`[${new Date().toISOString()}] ERROR [claude-flow-mcp] Failed to persist agent:`, error);
|
|
1009
|
-
}
|
|
1010
|
-
// Track spawned agent
|
|
1011
|
-
if (global.agentTracker) {
|
|
1012
|
-
global.agentTracker.trackAgent(agentId, {
|
|
1013
|
-
...agentData,
|
|
1014
|
-
capabilities: args.capabilities || []
|
|
1015
|
-
});
|
|
1016
|
-
}
|
|
1017
|
-
return {
|
|
1018
|
-
success: true,
|
|
1019
|
-
agentId: agentId,
|
|
1020
|
-
type: args.type,
|
|
1021
|
-
name: agentData.name,
|
|
1022
|
-
status: 'active',
|
|
1023
|
-
capabilities: args.capabilities || [],
|
|
1024
|
-
persisted: !!this.databaseManager,
|
|
1025
|
-
timestamp: new Date().toISOString()
|
|
1026
|
-
};
|
|
1027
|
-
case 'neural_train':
|
|
1028
|
-
const epochs = args.epochs || 50;
|
|
1029
|
-
const baseAccuracy = 0.65;
|
|
1030
|
-
const maxAccuracy = 0.98;
|
|
1031
|
-
// Realistic training progression: more epochs = better accuracy but with diminishing returns
|
|
1032
|
-
const epochFactor = Math.min(epochs / 100, 10); // Normalize epochs
|
|
1033
|
-
const accuracyGain = (maxAccuracy - baseAccuracy) * (1 - Math.exp(-epochFactor / 3));
|
|
1034
|
-
const finalAccuracy = baseAccuracy + accuracyGain + (Math.random() * 0.05 - 0.025); // Add some noise
|
|
1035
|
-
// Training time increases with epochs but not linearly (parallel processing)
|
|
1036
|
-
const baseTime = 2;
|
|
1037
|
-
const timePerEpoch = 0.08;
|
|
1038
|
-
const trainingTime = baseTime + epochs * timePerEpoch + (Math.random() * 2 - 1);
|
|
1039
|
-
return {
|
|
1040
|
-
success: true,
|
|
1041
|
-
modelId: `model_${args.pattern_type || 'general'}_${Date.now()}`,
|
|
1042
|
-
pattern_type: args.pattern_type || 'coordination',
|
|
1043
|
-
epochs: epochs,
|
|
1044
|
-
accuracy: Math.min(finalAccuracy, maxAccuracy),
|
|
1045
|
-
training_time: Math.max(trainingTime, 1),
|
|
1046
|
-
status: 'completed',
|
|
1047
|
-
improvement_rate: epochFactor > 1 ? 'converged' : 'improving',
|
|
1048
|
-
data_source: args.training_data || 'recent',
|
|
1049
|
-
timestamp: new Date().toISOString()
|
|
1050
|
-
};
|
|
1051
|
-
case 'memory_usage':
|
|
1052
|
-
return await this.handleMemoryUsage(args);
|
|
1053
|
-
case 'performance_report':
|
|
1054
|
-
return {
|
|
1055
|
-
success: true,
|
|
1056
|
-
timeframe: args.timeframe || '24h',
|
|
1057
|
-
format: args.format || 'summary',
|
|
1058
|
-
metrics: {
|
|
1059
|
-
tasks_executed: Math.floor(Math.random() * 200) + 50,
|
|
1060
|
-
success_rate: Math.random() * 0.2 + 0.8,
|
|
1061
|
-
avg_execution_time: Math.random() * 10 + 5,
|
|
1062
|
-
agents_spawned: Math.floor(Math.random() * 50) + 10,
|
|
1063
|
-
memory_efficiency: Math.random() * 0.3 + 0.7,
|
|
1064
|
-
neural_events: Math.floor(Math.random() * 100) + 20
|
|
1065
|
-
},
|
|
1066
|
-
timestamp: new Date().toISOString()
|
|
1067
|
-
};
|
|
1068
|
-
// DEPRECATED: Enhanced Neural Tools - Handlers removed for 10 deprecated neural tools
|
|
1069
|
-
// Removed cases: model_save, model_load, neural_predict, pattern_recognize, cognitive_analyze,
|
|
1070
|
-
// learning_adapt, neural_compress, ensemble_create, transfer_learn, neural_explain
|
|
1071
|
-
// Rationale: Complexity reduction, functionality available via plugin architecture
|
|
1072
|
-
case 'agent_list':
|
|
1073
|
-
// First check agent tracker for real-time data
|
|
1074
|
-
if (global.agentTracker) {
|
|
1075
|
-
const swarmId = args.swarmId || await this.getActiveSwarmId();
|
|
1076
|
-
const trackedAgents = global.agentTracker.getAgents(swarmId);
|
|
1077
|
-
if (trackedAgents.length > 0) {
|
|
1078
|
-
return {
|
|
1079
|
-
success: true,
|
|
1080
|
-
swarmId: swarmId || 'dynamic',
|
|
1081
|
-
agents: trackedAgents,
|
|
1082
|
-
count: trackedAgents.length,
|
|
1083
|
-
timestamp: new Date().toISOString()
|
|
1084
|
-
};
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
if (this.databaseManager) {
|
|
1088
|
-
try {
|
|
1089
|
-
const swarmId = args.swarmId || await this.getActiveSwarmId();
|
|
1090
|
-
if (!swarmId) {
|
|
1091
|
-
return {
|
|
1092
|
-
success: false,
|
|
1093
|
-
error: 'No active swarm found',
|
|
1094
|
-
agents: [],
|
|
1095
|
-
timestamp: new Date().toISOString()
|
|
1096
|
-
};
|
|
1097
|
-
}
|
|
1098
|
-
const agents = await this.databaseManager.getAgents(swarmId);
|
|
1099
|
-
return {
|
|
1100
|
-
success: true,
|
|
1101
|
-
swarmId: swarmId,
|
|
1102
|
-
agents: agents.map((agent)=>({
|
|
1103
|
-
id: agent.id,
|
|
1104
|
-
name: agent.name,
|
|
1105
|
-
type: agent.type,
|
|
1106
|
-
status: agent.status,
|
|
1107
|
-
capabilities: JSON.parse(agent.capabilities || '[]'),
|
|
1108
|
-
created: agent.created_at,
|
|
1109
|
-
lastActive: agent.last_active_at
|
|
1110
|
-
})),
|
|
1111
|
-
count: agents.length,
|
|
1112
|
-
timestamp: new Date().toISOString()
|
|
1113
|
-
};
|
|
1114
|
-
} catch (error) {
|
|
1115
|
-
console.error(`[${new Date().toISOString()}] ERROR [claude-flow-mcp] Failed to list agents:`, error);
|
|
1116
|
-
return {
|
|
1117
|
-
success: false,
|
|
1118
|
-
error: error.message,
|
|
1119
|
-
agents: [],
|
|
1120
|
-
timestamp: new Date().toISOString()
|
|
1121
|
-
};
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
// Fallback mock response
|
|
1125
|
-
return {
|
|
1126
|
-
success: true,
|
|
1127
|
-
swarmId: args.swarmId || 'mock-swarm',
|
|
1128
|
-
agents: [
|
|
1129
|
-
{
|
|
1130
|
-
id: 'agent-1',
|
|
1131
|
-
name: 'coordinator-1',
|
|
1132
|
-
type: 'coordinator',
|
|
1133
|
-
status: 'active',
|
|
1134
|
-
capabilities: []
|
|
1135
|
-
},
|
|
1136
|
-
{
|
|
1137
|
-
id: 'agent-2',
|
|
1138
|
-
name: 'researcher-1',
|
|
1139
|
-
type: 'researcher',
|
|
1140
|
-
status: 'active',
|
|
1141
|
-
capabilities: []
|
|
1142
|
-
},
|
|
1143
|
-
{
|
|
1144
|
-
id: 'agent-3',
|
|
1145
|
-
name: 'coder-1',
|
|
1146
|
-
type: 'coder',
|
|
1147
|
-
status: 'busy',
|
|
1148
|
-
capabilities: []
|
|
1149
|
-
}
|
|
1150
|
-
],
|
|
1151
|
-
count: 3,
|
|
1152
|
-
timestamp: new Date().toISOString()
|
|
1153
|
-
};
|
|
1154
|
-
case 'swarm_status':
|
|
1155
|
-
try {
|
|
1156
|
-
// Get active swarm ID from memory store
|
|
1157
|
-
let swarmId = args.swarmId;
|
|
1158
|
-
if (!swarmId) {
|
|
1159
|
-
swarmId = await this.memoryStore.retrieve('active_swarm', {
|
|
1160
|
-
namespace: 'system'
|
|
1161
|
-
});
|
|
1162
|
-
}
|
|
1163
|
-
if (!swarmId) {
|
|
1164
|
-
return {
|
|
1165
|
-
success: false,
|
|
1166
|
-
error: 'No active swarm found',
|
|
1167
|
-
timestamp: new Date().toISOString()
|
|
1168
|
-
};
|
|
1169
|
-
}
|
|
1170
|
-
// Check agent tracker for real counts
|
|
1171
|
-
if (global.agentTracker) {
|
|
1172
|
-
const status = global.agentTracker.getSwarmStatus(swarmId);
|
|
1173
|
-
if (status.agentCount > 0) {
|
|
1174
|
-
const swarmDataRaw = await this.memoryStore.retrieve(`swarm:${swarmId}`, {
|
|
1175
|
-
namespace: 'swarms'
|
|
1176
|
-
});
|
|
1177
|
-
const swarm = swarmDataRaw ? typeof swarmDataRaw === 'string' ? JSON.parse(swarmDataRaw) : swarmDataRaw : {};
|
|
1178
|
-
return {
|
|
1179
|
-
success: true,
|
|
1180
|
-
swarmId: swarmId,
|
|
1181
|
-
topology: swarm.topology || 'mesh',
|
|
1182
|
-
agentCount: status.agentCount,
|
|
1183
|
-
activeAgents: status.activeAgents,
|
|
1184
|
-
taskCount: status.taskCount,
|
|
1185
|
-
pendingTasks: status.pendingTasks,
|
|
1186
|
-
completedTasks: status.completedTasks,
|
|
1187
|
-
timestamp: new Date().toISOString()
|
|
1188
|
-
};
|
|
1189
|
-
}
|
|
1190
|
-
}
|
|
1191
|
-
// Retrieve swarm data from memory store
|
|
1192
|
-
const swarmDataRaw = await this.memoryStore.retrieve(`swarm:${swarmId}`, {
|
|
1193
|
-
namespace: 'swarms'
|
|
1194
|
-
});
|
|
1195
|
-
if (!swarmDataRaw) {
|
|
1196
|
-
return {
|
|
1197
|
-
success: false,
|
|
1198
|
-
error: `Swarm ${swarmId} not found`,
|
|
1199
|
-
timestamp: new Date().toISOString()
|
|
1200
|
-
};
|
|
1201
|
-
}
|
|
1202
|
-
const swarm = typeof swarmDataRaw === 'string' ? JSON.parse(swarmDataRaw) : swarmDataRaw;
|
|
1203
|
-
// Retrieve agents from memory
|
|
1204
|
-
const agentsData = await this.memoryStore.list({
|
|
1205
|
-
namespace: 'agents',
|
|
1206
|
-
limit: 100
|
|
1207
|
-
});
|
|
1208
|
-
// Filter agents for this swarm
|
|
1209
|
-
const swarmAgents = agentsData.filter((entry)=>entry.key.startsWith(`agent:${swarmId}:`)).map((entry)=>{
|
|
1210
|
-
try {
|
|
1211
|
-
return JSON.parse(entry.value);
|
|
1212
|
-
} catch (e) {
|
|
1213
|
-
return null;
|
|
1214
|
-
}
|
|
1215
|
-
}).filter((agent)=>agent !== null);
|
|
1216
|
-
// Retrieve tasks from memory
|
|
1217
|
-
const tasksData = await this.memoryStore.list({
|
|
1218
|
-
namespace: 'tasks',
|
|
1219
|
-
limit: 100
|
|
1220
|
-
});
|
|
1221
|
-
// Filter tasks for this swarm
|
|
1222
|
-
const swarmTasks = tasksData.filter((entry)=>entry.key.startsWith(`task:${swarmId}:`)).map((entry)=>{
|
|
1223
|
-
try {
|
|
1224
|
-
return JSON.parse(entry.value);
|
|
1225
|
-
} catch (e) {
|
|
1226
|
-
return null;
|
|
1227
|
-
}
|
|
1228
|
-
}).filter((task)=>task !== null);
|
|
1229
|
-
// Calculate stats
|
|
1230
|
-
const activeAgents = swarmAgents.filter((a)=>a.status === 'active' || a.status === 'busy').length;
|
|
1231
|
-
const pendingTasks = swarmTasks.filter((t)=>t.status === 'pending').length;
|
|
1232
|
-
const completedTasks = swarmTasks.filter((t)=>t.status === 'completed').length;
|
|
1233
|
-
const response = {
|
|
1234
|
-
success: true,
|
|
1235
|
-
swarmId: swarmId,
|
|
1236
|
-
topology: swarm.topology || 'hierarchical',
|
|
1237
|
-
agentCount: swarmAgents.length,
|
|
1238
|
-
activeAgents: activeAgents,
|
|
1239
|
-
taskCount: swarmTasks.length,
|
|
1240
|
-
pendingTasks: pendingTasks,
|
|
1241
|
-
completedTasks: completedTasks,
|
|
1242
|
-
timestamp: new Date().toISOString()
|
|
1243
|
-
};
|
|
1244
|
-
// Add verbose details if requested
|
|
1245
|
-
if (args.verbose === true || args.verbose === 'true') {
|
|
1246
|
-
response.agents = swarmAgents;
|
|
1247
|
-
response.tasks = swarmTasks;
|
|
1248
|
-
response.swarmDetails = swarm;
|
|
1249
|
-
}
|
|
1250
|
-
return response;
|
|
1251
|
-
} catch (error) {
|
|
1252
|
-
console.error(`[${new Date().toISOString()}] ERROR [claude-flow-mcp] Failed to get swarm status:`, error);
|
|
1253
|
-
// Return a more informative fallback response
|
|
1254
|
-
return {
|
|
1255
|
-
success: false,
|
|
1256
|
-
error: error.message || 'Failed to retrieve swarm status',
|
|
1257
|
-
swarmId: args.swarmId || 'unknown',
|
|
1258
|
-
topology: 'unknown',
|
|
1259
|
-
agentCount: 0,
|
|
1260
|
-
activeAgents: 0,
|
|
1261
|
-
taskCount: 0,
|
|
1262
|
-
pendingTasks: 0,
|
|
1263
|
-
completedTasks: 0,
|
|
1264
|
-
timestamp: new Date().toISOString()
|
|
1265
|
-
};
|
|
1266
|
-
}
|
|
1267
|
-
case 'task_orchestrate':
|
|
1268
|
-
const taskId = `task_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
1269
|
-
// Track task creation
|
|
1270
|
-
if (global.agentTracker) {
|
|
1271
|
-
global.agentTracker.trackTask(taskId, {
|
|
1272
|
-
task: args.task,
|
|
1273
|
-
strategy: args.strategy || 'parallel',
|
|
1274
|
-
priority: args.priority || 'medium',
|
|
1275
|
-
status: 'pending',
|
|
1276
|
-
swarmId: args.swarmId
|
|
1277
|
-
});
|
|
1278
|
-
}
|
|
1279
|
-
const swarmIdForTask = args.swarmId || await this.getActiveSwarmId();
|
|
1280
|
-
const taskData = {
|
|
1281
|
-
id: taskId,
|
|
1282
|
-
swarmId: swarmIdForTask,
|
|
1283
|
-
description: args.task,
|
|
1284
|
-
priority: args.priority || 'medium',
|
|
1285
|
-
strategy: args.strategy || 'auto',
|
|
1286
|
-
status: 'pending',
|
|
1287
|
-
dependencies: JSON.stringify(args.dependencies || []),
|
|
1288
|
-
assignedAgents: JSON.stringify([]),
|
|
1289
|
-
requireConsensus: false,
|
|
1290
|
-
maxAgents: 5,
|
|
1291
|
-
requiredCapabilities: JSON.stringify([]),
|
|
1292
|
-
metadata: JSON.stringify({
|
|
1293
|
-
sessionId: this.sessionId,
|
|
1294
|
-
createdBy: 'mcp-server',
|
|
1295
|
-
orchestratedAt: new Date().toISOString()
|
|
1296
|
-
})
|
|
1297
|
-
};
|
|
1298
|
-
// Store task data in memory store
|
|
1299
|
-
try {
|
|
1300
|
-
if (swarmIdForTask) {
|
|
1301
|
-
await this.memoryStore.store(`task:${swarmIdForTask}:${taskId}`, JSON.stringify(taskData), {
|
|
1302
|
-
namespace: 'tasks',
|
|
1303
|
-
metadata: {
|
|
1304
|
-
type: 'task_data',
|
|
1305
|
-
swarmId: swarmIdForTask,
|
|
1306
|
-
sessionId: this.sessionId
|
|
1307
|
-
}
|
|
1308
|
-
});
|
|
1309
|
-
console.error(`[${new Date().toISOString()}] INFO [claude-flow-mcp] Task persisted to memory: ${taskId}`);
|
|
1310
|
-
}
|
|
1311
|
-
} catch (error) {
|
|
1312
|
-
console.error(`[${new Date().toISOString()}] ERROR [claude-flow-mcp] Failed to persist task:`, error);
|
|
1313
|
-
}
|
|
1314
|
-
return {
|
|
1315
|
-
success: true,
|
|
1316
|
-
taskId: taskId,
|
|
1317
|
-
task: args.task,
|
|
1318
|
-
strategy: taskData.strategy,
|
|
1319
|
-
priority: taskData.priority,
|
|
1320
|
-
status: 'pending',
|
|
1321
|
-
persisted: true,
|
|
1322
|
-
timestamp: new Date().toISOString()
|
|
1323
|
-
};
|
|
1324
|
-
// DEPRECATED: DAA Tools Implementation - Handlers removed for 6 deprecated DAA tools
|
|
1325
|
-
// Removed cases: daa_agent_create, daa_capability_match, daa_resource_alloc,
|
|
1326
|
-
// daa_lifecycle_manage, daa_communication, daa_consensus
|
|
1327
|
-
// Rationale: DAA functionality consolidated into core swarm tools
|
|
1328
|
-
// Note: DAA implementation files (daa-tools.js) retained for backward compatibility
|
|
1329
|
-
// Workflow Tools Implementation
|
|
1330
|
-
case 'workflow_create':
|
|
1331
|
-
if (global.workflowManager) {
|
|
1332
|
-
return global.workflowManager.workflow_create(args);
|
|
1333
|
-
}
|
|
1334
|
-
return {
|
|
1335
|
-
success: false,
|
|
1336
|
-
error: 'Workflow manager not initialized',
|
|
1337
|
-
timestamp: new Date().toISOString()
|
|
1338
|
-
};
|
|
1339
|
-
// DEPRECATED: Workflow Execution Tools - Handlers removed for 5 deprecated workflow tools
|
|
1340
|
-
// Removed cases: workflow_execute, parallel_execute, batch_process, workflow_export, workflow_template
|
|
1341
|
-
// Retained: workflow_create (basic functionality)
|
|
1342
|
-
// Rationale: Workflow execution integrated into task_orchestrate
|
|
1343
|
-
// Note: Workflow implementation files (workflow-tools.js) retained for backward compatibility
|
|
1344
|
-
// Performance Tools Implementation
|
|
1345
|
-
case 'performance_report':
|
|
1346
|
-
if (global.performanceMonitor) {
|
|
1347
|
-
return global.performanceMonitor.performance_report(args);
|
|
1348
|
-
}
|
|
1349
|
-
return {
|
|
1350
|
-
success: false,
|
|
1351
|
-
error: 'Performance monitor not initialized',
|
|
1352
|
-
timestamp: new Date().toISOString()
|
|
1353
|
-
};
|
|
1354
|
-
case 'bottleneck_analyze':
|
|
1355
|
-
if (global.performanceMonitor) {
|
|
1356
|
-
return global.performanceMonitor.bottleneck_analyze(args);
|
|
1357
|
-
}
|
|
1358
|
-
return {
|
|
1359
|
-
success: false,
|
|
1360
|
-
error: 'Performance monitor not initialized',
|
|
1361
|
-
timestamp: new Date().toISOString()
|
|
1362
|
-
};
|
|
1363
|
-
case 'memory_analytics':
|
|
1364
|
-
if (global.performanceMonitor) {
|
|
1365
|
-
return global.performanceMonitor.memory_analytics(args);
|
|
1366
|
-
}
|
|
1367
|
-
return {
|
|
1368
|
-
success: false,
|
|
1369
|
-
error: 'Performance monitor not initialized',
|
|
1370
|
-
timestamp: new Date().toISOString()
|
|
1371
|
-
};
|
|
1372
|
-
default:
|
|
1373
|
-
return {
|
|
1374
|
-
success: true,
|
|
1375
|
-
tool: name,
|
|
1376
|
-
message: `Tool ${name} executed successfully`,
|
|
1377
|
-
args: args,
|
|
1378
|
-
timestamp: new Date().toISOString()
|
|
1379
|
-
};
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
async readResource(uri) {
|
|
1383
|
-
switch(uri){
|
|
1384
|
-
case 'claude-flow://swarms':
|
|
1385
|
-
return {
|
|
1386
|
-
active_swarms: 3,
|
|
1387
|
-
total_agents: 15,
|
|
1388
|
-
topologies: [
|
|
1389
|
-
'hierarchical',
|
|
1390
|
-
'mesh',
|
|
1391
|
-
'ring',
|
|
1392
|
-
'star'
|
|
1393
|
-
],
|
|
1394
|
-
performance: '2.8-4.4x speedup'
|
|
1395
|
-
};
|
|
1396
|
-
case 'claude-flow://agents':
|
|
1397
|
-
return {
|
|
1398
|
-
total_agents: 8,
|
|
1399
|
-
types: [
|
|
1400
|
-
'researcher',
|
|
1401
|
-
'coder',
|
|
1402
|
-
'analyst',
|
|
1403
|
-
'architect',
|
|
1404
|
-
'tester',
|
|
1405
|
-
'coordinator',
|
|
1406
|
-
'reviewer',
|
|
1407
|
-
'optimizer'
|
|
1408
|
-
],
|
|
1409
|
-
active: 15,
|
|
1410
|
-
capabilities: 127
|
|
1411
|
-
};
|
|
1412
|
-
case 'claude-flow://models':
|
|
1413
|
-
return {
|
|
1414
|
-
total_models: 27,
|
|
1415
|
-
wasm_enabled: true,
|
|
1416
|
-
simd_support: true,
|
|
1417
|
-
training_active: true,
|
|
1418
|
-
accuracy_avg: 0.89
|
|
1419
|
-
};
|
|
1420
|
-
case 'claude-flow://performance':
|
|
1421
|
-
return {
|
|
1422
|
-
uptime: '99.9%',
|
|
1423
|
-
token_reduction: '32.3%',
|
|
1424
|
-
swe_bench_rate: '84.8%',
|
|
1425
|
-
speed_improvement: '2.8-4.4x',
|
|
1426
|
-
memory_efficiency: '78%'
|
|
1427
|
-
};
|
|
1428
|
-
default:
|
|
1429
|
-
throw new Error(`Unknown resource: ${uri}`);
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
async handleMemoryUsage(args) {
|
|
1433
|
-
if (!this.memoryStore) {
|
|
1434
|
-
return {
|
|
861
|
+
|
|
862
|
+
if (this.databaseManager) {
|
|
863
|
+
try {
|
|
864
|
+
const swarmId = args.swarmId || (await this.getActiveSwarmId());
|
|
865
|
+
if (!swarmId) {
|
|
866
|
+
return {
|
|
1435
867
|
success: false,
|
|
1436
|
-
error: '
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
try {
|
|
1441
|
-
switch(args.action){
|
|
1442
|
-
case 'store':
|
|
1443
|
-
const storeResult = await this.memoryStore.store(args.key, args.value, {
|
|
1444
|
-
namespace: args.namespace || 'default',
|
|
1445
|
-
ttl: args.ttl,
|
|
1446
|
-
metadata: {
|
|
1447
|
-
sessionId: this.sessionId,
|
|
1448
|
-
storedBy: 'mcp-server',
|
|
1449
|
-
type: 'knowledge'
|
|
1450
|
-
}
|
|
1451
|
-
});
|
|
1452
|
-
console.error(`[${new Date().toISOString()}] INFO [claude-flow-mcp] Stored in shared memory: ${args.key} (namespace: ${args.namespace || 'default'})`);
|
|
1453
|
-
return {
|
|
1454
|
-
success: true,
|
|
1455
|
-
action: 'store',
|
|
1456
|
-
key: args.key,
|
|
1457
|
-
namespace: args.namespace || 'default',
|
|
1458
|
-
stored: true,
|
|
1459
|
-
size: storeResult.size || args.value.length,
|
|
1460
|
-
id: storeResult.id,
|
|
1461
|
-
storage_type: this.memoryStore.isUsingFallback() ? 'in-memory' : 'sqlite',
|
|
1462
|
-
timestamp: new Date().toISOString()
|
|
1463
|
-
};
|
|
1464
|
-
case 'retrieve':
|
|
1465
|
-
const value = await this.memoryStore.retrieve(args.key, {
|
|
1466
|
-
namespace: args.namespace || 'default'
|
|
1467
|
-
});
|
|
1468
|
-
console.error(`[${new Date().toISOString()}] INFO [claude-flow-mcp] Retrieved from shared memory: ${args.key} (found: ${value !== null})`);
|
|
1469
|
-
return {
|
|
1470
|
-
success: true,
|
|
1471
|
-
action: 'retrieve',
|
|
1472
|
-
key: args.key,
|
|
1473
|
-
value: value,
|
|
1474
|
-
found: value !== null,
|
|
1475
|
-
namespace: args.namespace || 'default',
|
|
1476
|
-
storage_type: this.memoryStore.isUsingFallback() ? 'in-memory' : 'sqlite',
|
|
1477
|
-
timestamp: new Date().toISOString()
|
|
1478
|
-
};
|
|
1479
|
-
case 'list':
|
|
1480
|
-
const entries = await this.memoryStore.list({
|
|
1481
|
-
namespace: args.namespace || 'default',
|
|
1482
|
-
limit: 100
|
|
1483
|
-
});
|
|
1484
|
-
console.error(`[${new Date().toISOString()}] INFO [claude-flow-mcp] Listed shared memory entries: ${entries.length} (namespace: ${args.namespace || 'default'})`);
|
|
1485
|
-
return {
|
|
1486
|
-
success: true,
|
|
1487
|
-
action: 'list',
|
|
1488
|
-
namespace: args.namespace || 'default',
|
|
1489
|
-
entries: entries,
|
|
1490
|
-
count: entries.length,
|
|
1491
|
-
storage_type: this.memoryStore.isUsingFallback() ? 'in-memory' : 'sqlite',
|
|
1492
|
-
timestamp: new Date().toISOString()
|
|
1493
|
-
};
|
|
1494
|
-
case 'delete':
|
|
1495
|
-
const deleted = await this.memoryStore.delete(args.key, {
|
|
1496
|
-
namespace: args.namespace || 'default'
|
|
1497
|
-
});
|
|
1498
|
-
console.error(`[${new Date().toISOString()}] INFO [claude-flow-mcp] Deleted from shared memory: ${args.key} (success: ${deleted})`);
|
|
1499
|
-
return {
|
|
1500
|
-
success: true,
|
|
1501
|
-
action: 'delete',
|
|
1502
|
-
key: args.key,
|
|
1503
|
-
namespace: args.namespace || 'default',
|
|
1504
|
-
deleted: deleted,
|
|
1505
|
-
storage_type: this.memoryStore.isUsingFallback() ? 'in-memory' : 'sqlite',
|
|
1506
|
-
timestamp: new Date().toISOString()
|
|
1507
|
-
};
|
|
1508
|
-
case 'search':
|
|
1509
|
-
const results = await this.memoryStore.search(args.value || '', {
|
|
1510
|
-
namespace: args.namespace || 'default',
|
|
1511
|
-
limit: 50
|
|
1512
|
-
});
|
|
1513
|
-
console.error(`[${new Date().toISOString()}] INFO [claude-flow-mcp] Searched shared memory: ${results.length} results for "${args.value}"`);
|
|
1514
|
-
return {
|
|
1515
|
-
success: true,
|
|
1516
|
-
action: 'search',
|
|
1517
|
-
pattern: args.value,
|
|
1518
|
-
namespace: args.namespace || 'default',
|
|
1519
|
-
results: results,
|
|
1520
|
-
count: results.length,
|
|
1521
|
-
storage_type: this.memoryStore.isUsingFallback() ? 'in-memory' : 'sqlite',
|
|
1522
|
-
timestamp: new Date().toISOString()
|
|
1523
|
-
};
|
|
1524
|
-
default:
|
|
1525
|
-
return {
|
|
1526
|
-
success: false,
|
|
1527
|
-
error: `Unknown memory action: ${args.action}`,
|
|
1528
|
-
timestamp: new Date().toISOString()
|
|
1529
|
-
};
|
|
868
|
+
error: 'No active swarm found',
|
|
869
|
+
agents: [],
|
|
870
|
+
timestamp: new Date().toISOString(),
|
|
871
|
+
};
|
|
1530
872
|
}
|
|
1531
|
-
|
|
1532
|
-
|
|
873
|
+
|
|
874
|
+
const agents = await this.databaseManager.getAgents(swarmId);
|
|
1533
875
|
return {
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
876
|
+
success: true,
|
|
877
|
+
swarmId: swarmId,
|
|
878
|
+
agents: agents.map((agent) => ({
|
|
879
|
+
id: agent.id,
|
|
880
|
+
name: agent.name,
|
|
881
|
+
type: agent.type,
|
|
882
|
+
status: agent.status,
|
|
883
|
+
capabilities: JSON.parse(agent.capabilities || '[]'),
|
|
884
|
+
created: agent.created_at,
|
|
885
|
+
lastActive: agent.last_active_at,
|
|
886
|
+
})),
|
|
887
|
+
count: agents.length,
|
|
888
|
+
timestamp: new Date().toISOString(),
|
|
1539
889
|
};
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
890
|
+
} catch (error) {
|
|
891
|
+
console.error(
|
|
892
|
+
`[${new Date().toISOString()}] ERROR [claude-flow-mcp] Failed to list agents:`,
|
|
893
|
+
error,
|
|
894
|
+
);
|
|
1544
895
|
return {
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
896
|
+
success: false,
|
|
897
|
+
error: error.message,
|
|
898
|
+
agents: [],
|
|
899
|
+
timestamp: new Date().toISOString(),
|
|
1548
900
|
};
|
|
901
|
+
}
|
|
1549
902
|
}
|
|
903
|
+
|
|
904
|
+
// Fallback mock response
|
|
905
|
+
return {
|
|
906
|
+
success: true,
|
|
907
|
+
swarmId: args.swarmId || 'mock-swarm',
|
|
908
|
+
agents: [
|
|
909
|
+
{
|
|
910
|
+
id: 'agent-1',
|
|
911
|
+
name: 'coordinator-1',
|
|
912
|
+
type: 'coordinator',
|
|
913
|
+
status: 'active',
|
|
914
|
+
capabilities: [],
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
id: 'agent-2',
|
|
918
|
+
name: 'researcher-1',
|
|
919
|
+
type: 'researcher',
|
|
920
|
+
status: 'active',
|
|
921
|
+
capabilities: [],
|
|
922
|
+
},
|
|
923
|
+
{ id: 'agent-3', name: 'coder-1', type: 'coder', status: 'busy', capabilities: [] },
|
|
924
|
+
],
|
|
925
|
+
count: 3,
|
|
926
|
+
timestamp: new Date().toISOString(),
|
|
927
|
+
};
|
|
928
|
+
|
|
929
|
+
case 'swarm_status':
|
|
1550
930
|
try {
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
931
|
+
// Get active swarm ID from memory store
|
|
932
|
+
let swarmId = args.swarmId;
|
|
933
|
+
if (!swarmId) {
|
|
934
|
+
swarmId = await this.memoryStore.retrieve('active_swarm', {
|
|
935
|
+
namespace: 'system',
|
|
1554
936
|
});
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
if (!swarmId) {
|
|
1555
940
|
return {
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
results: results,
|
|
1560
|
-
count: results.length,
|
|
1561
|
-
timestamp: new Date().toISOString()
|
|
941
|
+
success: false,
|
|
942
|
+
error: 'No active swarm found',
|
|
943
|
+
timestamp: new Date().toISOString(),
|
|
1562
944
|
};
|
|
1563
|
-
|
|
1564
|
-
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
// Check agent tracker for real counts
|
|
948
|
+
if (global.agentTracker) {
|
|
949
|
+
const status = global.agentTracker.getSwarmStatus(swarmId);
|
|
950
|
+
if (status.agentCount > 0) {
|
|
951
|
+
const swarmDataRaw = await this.memoryStore.retrieve(`swarm:${swarmId}`, {
|
|
952
|
+
namespace: 'swarms',
|
|
953
|
+
});
|
|
954
|
+
const swarm = swarmDataRaw
|
|
955
|
+
? typeof swarmDataRaw === 'string'
|
|
956
|
+
? JSON.parse(swarmDataRaw)
|
|
957
|
+
: swarmDataRaw
|
|
958
|
+
: {};
|
|
959
|
+
|
|
960
|
+
return {
|
|
961
|
+
success: true,
|
|
962
|
+
swarmId: swarmId,
|
|
963
|
+
topology: swarm.topology || 'mesh',
|
|
964
|
+
agentCount: status.agentCount,
|
|
965
|
+
activeAgents: status.activeAgents,
|
|
966
|
+
taskCount: status.taskCount,
|
|
967
|
+
pendingTasks: status.pendingTasks,
|
|
968
|
+
completedTasks: status.completedTasks,
|
|
969
|
+
timestamp: new Date().toISOString(),
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
// Retrieve swarm data from memory store
|
|
975
|
+
const swarmDataRaw = await this.memoryStore.retrieve(`swarm:${swarmId}`, {
|
|
976
|
+
namespace: 'swarms',
|
|
977
|
+
});
|
|
978
|
+
|
|
979
|
+
if (!swarmDataRaw) {
|
|
1565
980
|
return {
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
981
|
+
success: false,
|
|
982
|
+
error: `Swarm ${swarmId} not found`,
|
|
983
|
+
timestamp: new Date().toISOString(),
|
|
1569
984
|
};
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
const swarm = typeof swarmDataRaw === 'string' ? JSON.parse(swarmDataRaw) : swarmDataRaw;
|
|
988
|
+
|
|
989
|
+
// Retrieve agents from memory
|
|
990
|
+
const agentsData = await this.memoryStore.list({
|
|
991
|
+
namespace: 'agents',
|
|
992
|
+
limit: 100,
|
|
993
|
+
});
|
|
994
|
+
|
|
995
|
+
// Filter agents for this swarm
|
|
996
|
+
const swarmAgents = agentsData
|
|
997
|
+
.filter((entry) => entry.key.startsWith(`agent:${swarmId}:`))
|
|
998
|
+
.map((entry) => {
|
|
999
|
+
try {
|
|
1000
|
+
return JSON.parse(entry.value);
|
|
1001
|
+
} catch (e) {
|
|
1002
|
+
return null;
|
|
1003
|
+
}
|
|
1004
|
+
})
|
|
1005
|
+
.filter((agent) => agent !== null);
|
|
1006
|
+
|
|
1007
|
+
// Retrieve tasks from memory
|
|
1008
|
+
const tasksData = await this.memoryStore.list({
|
|
1009
|
+
namespace: 'tasks',
|
|
1010
|
+
limit: 100,
|
|
1011
|
+
});
|
|
1012
|
+
|
|
1013
|
+
// Filter tasks for this swarm
|
|
1014
|
+
const swarmTasks = tasksData
|
|
1015
|
+
.filter((entry) => entry.key.startsWith(`task:${swarmId}:`))
|
|
1016
|
+
.map((entry) => {
|
|
1017
|
+
try {
|
|
1018
|
+
return JSON.parse(entry.value);
|
|
1019
|
+
} catch (e) {
|
|
1020
|
+
return null;
|
|
1021
|
+
}
|
|
1022
|
+
})
|
|
1023
|
+
.filter((task) => task !== null);
|
|
1024
|
+
|
|
1025
|
+
// Calculate stats
|
|
1026
|
+
const activeAgents = swarmAgents.filter(
|
|
1027
|
+
(a) => a.status === 'active' || a.status === 'busy',
|
|
1028
|
+
).length;
|
|
1029
|
+
const pendingTasks = swarmTasks.filter((t) => t.status === 'pending').length;
|
|
1030
|
+
const completedTasks = swarmTasks.filter((t) => t.status === 'completed').length;
|
|
1031
|
+
|
|
1032
|
+
const response = {
|
|
1033
|
+
success: true,
|
|
1034
|
+
swarmId: swarmId,
|
|
1035
|
+
topology: swarm.topology || 'hierarchical',
|
|
1036
|
+
agentCount: swarmAgents.length,
|
|
1037
|
+
activeAgents: activeAgents,
|
|
1038
|
+
taskCount: swarmTasks.length,
|
|
1039
|
+
pendingTasks: pendingTasks,
|
|
1040
|
+
completedTasks: completedTasks,
|
|
1041
|
+
timestamp: new Date().toISOString(),
|
|
1042
|
+
};
|
|
1043
|
+
|
|
1044
|
+
// Add verbose details if requested
|
|
1045
|
+
if (args.verbose === true || args.verbose === 'true') {
|
|
1046
|
+
response.agents = swarmAgents;
|
|
1047
|
+
response.tasks = swarmTasks;
|
|
1048
|
+
response.swarmDetails = swarm;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
return response;
|
|
1052
|
+
} catch (error) {
|
|
1053
|
+
console.error(
|
|
1054
|
+
`[${new Date().toISOString()}] ERROR [claude-flow-mcp] Failed to get swarm status:`,
|
|
1055
|
+
error,
|
|
1056
|
+
);
|
|
1057
|
+
|
|
1058
|
+
// Return a more informative fallback response
|
|
1059
|
+
return {
|
|
1060
|
+
success: false,
|
|
1061
|
+
error: error.message || 'Failed to retrieve swarm status',
|
|
1062
|
+
swarmId: args.swarmId || 'unknown',
|
|
1063
|
+
topology: 'unknown',
|
|
1064
|
+
agentCount: 0,
|
|
1065
|
+
activeAgents: 0,
|
|
1066
|
+
taskCount: 0,
|
|
1067
|
+
pendingTasks: 0,
|
|
1068
|
+
completedTasks: 0,
|
|
1069
|
+
timestamp: new Date().toISOString(),
|
|
1070
|
+
};
|
|
1570
1071
|
}
|
|
1571
|
-
|
|
1572
|
-
|
|
1072
|
+
|
|
1073
|
+
case 'task_orchestrate':
|
|
1074
|
+
const taskId = `task_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
1075
|
+
|
|
1076
|
+
// Track task creation
|
|
1077
|
+
if (global.agentTracker) {
|
|
1078
|
+
global.agentTracker.trackTask(taskId, {
|
|
1079
|
+
task: args.task,
|
|
1080
|
+
strategy: args.strategy || 'parallel',
|
|
1081
|
+
priority: args.priority || 'medium',
|
|
1082
|
+
status: 'pending',
|
|
1083
|
+
swarmId: args.swarmId,
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
const swarmIdForTask = args.swarmId || (await this.getActiveSwarmId());
|
|
1087
|
+
const taskData = {
|
|
1088
|
+
id: taskId,
|
|
1089
|
+
swarmId: swarmIdForTask,
|
|
1090
|
+
description: args.task,
|
|
1091
|
+
priority: args.priority || 'medium',
|
|
1092
|
+
strategy: args.strategy || 'auto',
|
|
1093
|
+
status: 'pending',
|
|
1094
|
+
dependencies: JSON.stringify(args.dependencies || []),
|
|
1095
|
+
assignedAgents: JSON.stringify([]),
|
|
1096
|
+
requireConsensus: false,
|
|
1097
|
+
maxAgents: 5,
|
|
1098
|
+
requiredCapabilities: JSON.stringify([]),
|
|
1099
|
+
metadata: JSON.stringify({
|
|
1100
|
+
sessionId: this.sessionId,
|
|
1101
|
+
createdBy: 'mcp-server',
|
|
1102
|
+
orchestratedAt: new Date().toISOString(),
|
|
1103
|
+
}),
|
|
1104
|
+
};
|
|
1105
|
+
|
|
1106
|
+
// Store task data in memory store
|
|
1573
1107
|
try {
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1108
|
+
if (swarmIdForTask) {
|
|
1109
|
+
await this.memoryStore.store(
|
|
1110
|
+
`task:${swarmIdForTask}:${taskId}`,
|
|
1111
|
+
JSON.stringify(taskData),
|
|
1112
|
+
{
|
|
1113
|
+
namespace: 'tasks',
|
|
1114
|
+
metadata: { type: 'task_data', swarmId: swarmIdForTask, sessionId: this.sessionId },
|
|
1115
|
+
},
|
|
1116
|
+
);
|
|
1117
|
+
console.error(
|
|
1118
|
+
`[${new Date().toISOString()}] INFO [claude-flow-mcp] Task persisted to memory: ${taskId}`,
|
|
1119
|
+
);
|
|
1120
|
+
}
|
|
1578
1121
|
} catch (error) {
|
|
1579
|
-
|
|
1580
|
-
|
|
1122
|
+
console.error(
|
|
1123
|
+
`[${new Date().toISOString()}] ERROR [claude-flow-mcp] Failed to persist task:`,
|
|
1124
|
+
error,
|
|
1125
|
+
);
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
return {
|
|
1129
|
+
success: true,
|
|
1130
|
+
taskId: taskId,
|
|
1131
|
+
task: args.task,
|
|
1132
|
+
strategy: taskData.strategy,
|
|
1133
|
+
priority: taskData.priority,
|
|
1134
|
+
status: 'pending',
|
|
1135
|
+
persisted: true,
|
|
1136
|
+
timestamp: new Date().toISOString(),
|
|
1137
|
+
};
|
|
1138
|
+
|
|
1139
|
+
// DEPRECATED: DAA Tools Implementation - Handlers removed for 6 deprecated DAA tools
|
|
1140
|
+
// Removed cases: daa_agent_create, daa_capability_match, daa_resource_alloc,
|
|
1141
|
+
// daa_lifecycle_manage, daa_communication, daa_consensus
|
|
1142
|
+
// Rationale: DAA functionality consolidated into core swarm tools
|
|
1143
|
+
// Note: DAA implementation files (daa-tools.js) retained for backward compatibility
|
|
1144
|
+
|
|
1145
|
+
// Workflow Tools Implementation
|
|
1146
|
+
case 'workflow_create':
|
|
1147
|
+
if (global.workflowManager) {
|
|
1148
|
+
return global.workflowManager.workflow_create(args);
|
|
1149
|
+
}
|
|
1150
|
+
return {
|
|
1151
|
+
success: false,
|
|
1152
|
+
error: 'Workflow manager not initialized',
|
|
1153
|
+
timestamp: new Date().toISOString(),
|
|
1154
|
+
};
|
|
1155
|
+
|
|
1156
|
+
// DEPRECATED: Workflow Execution Tools - Handlers removed for 5 deprecated workflow tools
|
|
1157
|
+
// Removed cases: workflow_execute, parallel_execute, batch_process, workflow_export, workflow_template
|
|
1158
|
+
// Retained: workflow_create (basic functionality)
|
|
1159
|
+
// Rationale: Workflow execution integrated into task_orchestrate
|
|
1160
|
+
// Note: Workflow implementation files (workflow-tools.js) retained for backward compatibility
|
|
1161
|
+
|
|
1162
|
+
// Performance Tools Implementation
|
|
1163
|
+
case 'performance_report':
|
|
1164
|
+
if (global.performanceMonitor) {
|
|
1165
|
+
return global.performanceMonitor.performance_report(args);
|
|
1166
|
+
}
|
|
1167
|
+
return {
|
|
1168
|
+
success: false,
|
|
1169
|
+
error: 'Performance monitor not initialized',
|
|
1170
|
+
timestamp: new Date().toISOString(),
|
|
1171
|
+
};
|
|
1172
|
+
|
|
1173
|
+
case 'bottleneck_analyze':
|
|
1174
|
+
if (global.performanceMonitor) {
|
|
1175
|
+
return global.performanceMonitor.bottleneck_analyze(args);
|
|
1176
|
+
}
|
|
1177
|
+
return {
|
|
1178
|
+
success: false,
|
|
1179
|
+
error: 'Performance monitor not initialized',
|
|
1180
|
+
timestamp: new Date().toISOString(),
|
|
1181
|
+
};
|
|
1182
|
+
|
|
1183
|
+
case 'memory_analytics':
|
|
1184
|
+
if (global.performanceMonitor) {
|
|
1185
|
+
return global.performanceMonitor.memory_analytics(args);
|
|
1581
1186
|
}
|
|
1187
|
+
return {
|
|
1188
|
+
success: false,
|
|
1189
|
+
error: 'Performance monitor not initialized',
|
|
1190
|
+
timestamp: new Date().toISOString(),
|
|
1191
|
+
};
|
|
1192
|
+
|
|
1193
|
+
default:
|
|
1194
|
+
return {
|
|
1195
|
+
success: true,
|
|
1196
|
+
tool: name,
|
|
1197
|
+
message: `Tool ${name} executed successfully`,
|
|
1198
|
+
args: args,
|
|
1199
|
+
timestamp: new Date().toISOString(),
|
|
1200
|
+
};
|
|
1582
1201
|
}
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
async readResource(uri) {
|
|
1205
|
+
switch (uri) {
|
|
1206
|
+
case 'claude-flow://swarms':
|
|
1207
|
+
return {
|
|
1208
|
+
active_swarms: 3,
|
|
1209
|
+
total_agents: 15,
|
|
1210
|
+
topologies: ['hierarchical', 'mesh', 'ring', 'star'],
|
|
1211
|
+
performance: '2.8-4.4x speedup',
|
|
1212
|
+
};
|
|
1213
|
+
|
|
1214
|
+
case 'claude-flow://agents':
|
|
1215
|
+
return {
|
|
1216
|
+
total_agents: 8,
|
|
1217
|
+
types: [
|
|
1218
|
+
'researcher',
|
|
1219
|
+
'coder',
|
|
1220
|
+
'analyst',
|
|
1221
|
+
'architect',
|
|
1222
|
+
'tester',
|
|
1223
|
+
'coordinator',
|
|
1224
|
+
'reviewer',
|
|
1225
|
+
'optimizer',
|
|
1226
|
+
],
|
|
1227
|
+
active: 15,
|
|
1228
|
+
capabilities: 127,
|
|
1229
|
+
};
|
|
1230
|
+
|
|
1231
|
+
case 'claude-flow://models':
|
|
1232
|
+
return {
|
|
1233
|
+
total_models: 27,
|
|
1234
|
+
wasm_enabled: true,
|
|
1235
|
+
simd_support: true,
|
|
1236
|
+
training_active: true,
|
|
1237
|
+
accuracy_avg: 0.89,
|
|
1591
1238
|
};
|
|
1592
|
-
|
|
1593
|
-
|
|
1239
|
+
|
|
1240
|
+
case 'claude-flow://performance':
|
|
1241
|
+
return {
|
|
1242
|
+
uptime: '99.9%',
|
|
1243
|
+
token_reduction: '32.3%',
|
|
1244
|
+
swe_bench_rate: '84.8%',
|
|
1245
|
+
speed_improvement: '2.8-4.4x',
|
|
1246
|
+
memory_efficiency: '78%',
|
|
1247
|
+
};
|
|
1248
|
+
|
|
1249
|
+
default:
|
|
1250
|
+
throw new Error(`Unknown resource: ${uri}`);
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
async handleMemoryUsage(args) {
|
|
1255
|
+
if (!this.memoryStore) {
|
|
1256
|
+
return {
|
|
1257
|
+
success: false,
|
|
1258
|
+
error: 'Shared memory system not initialized',
|
|
1259
|
+
timestamp: new Date().toISOString(),
|
|
1260
|
+
};
|
|
1594
1261
|
}
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1262
|
+
|
|
1263
|
+
try {
|
|
1264
|
+
switch (args.action) {
|
|
1265
|
+
case 'store':
|
|
1266
|
+
const storeResult = await this.memoryStore.store(args.key, args.value, {
|
|
1267
|
+
namespace: args.namespace || 'default',
|
|
1268
|
+
ttl: args.ttl,
|
|
1269
|
+
metadata: {
|
|
1270
|
+
sessionId: this.sessionId,
|
|
1271
|
+
storedBy: 'mcp-server',
|
|
1272
|
+
type: 'knowledge',
|
|
1602
1273
|
},
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
}
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1274
|
+
});
|
|
1275
|
+
|
|
1276
|
+
console.error(
|
|
1277
|
+
`[${new Date().toISOString()}] INFO [claude-flow-mcp] Stored in shared memory: ${args.key} (namespace: ${args.namespace || 'default'})`,
|
|
1278
|
+
);
|
|
1279
|
+
|
|
1280
|
+
return {
|
|
1281
|
+
success: true,
|
|
1282
|
+
action: 'store',
|
|
1283
|
+
key: args.key,
|
|
1284
|
+
namespace: args.namespace || 'default',
|
|
1285
|
+
stored: true,
|
|
1286
|
+
size: storeResult.size || args.value.length,
|
|
1287
|
+
id: storeResult.id,
|
|
1288
|
+
storage_type: this.memoryStore.isUsingFallback() ? 'in-memory' : 'sqlite',
|
|
1289
|
+
timestamp: new Date().toISOString(),
|
|
1290
|
+
};
|
|
1291
|
+
|
|
1292
|
+
case 'retrieve':
|
|
1293
|
+
const value = await this.memoryStore.retrieve(args.key, {
|
|
1294
|
+
namespace: args.namespace || 'default',
|
|
1295
|
+
});
|
|
1296
|
+
|
|
1297
|
+
console.error(
|
|
1298
|
+
`[${new Date().toISOString()}] INFO [claude-flow-mcp] Retrieved from shared memory: ${args.key} (found: ${value !== null})`,
|
|
1299
|
+
);
|
|
1300
|
+
|
|
1301
|
+
return {
|
|
1302
|
+
success: true,
|
|
1303
|
+
action: 'retrieve',
|
|
1304
|
+
key: args.key,
|
|
1305
|
+
value: value,
|
|
1306
|
+
found: value !== null,
|
|
1307
|
+
namespace: args.namespace || 'default',
|
|
1308
|
+
storage_type: this.memoryStore.isUsingFallback() ? 'in-memory' : 'sqlite',
|
|
1309
|
+
timestamp: new Date().toISOString(),
|
|
1310
|
+
};
|
|
1311
|
+
|
|
1312
|
+
case 'list':
|
|
1313
|
+
const entries = await this.memoryStore.list({
|
|
1314
|
+
namespace: args.namespace || 'default',
|
|
1315
|
+
limit: 100,
|
|
1316
|
+
});
|
|
1317
|
+
|
|
1318
|
+
console.error(
|
|
1319
|
+
`[${new Date().toISOString()}] INFO [claude-flow-mcp] Listed shared memory entries: ${entries.length} (namespace: ${args.namespace || 'default'})`,
|
|
1320
|
+
);
|
|
1321
|
+
|
|
1322
|
+
return {
|
|
1323
|
+
success: true,
|
|
1324
|
+
action: 'list',
|
|
1325
|
+
namespace: args.namespace || 'default',
|
|
1326
|
+
entries: entries,
|
|
1327
|
+
count: entries.length,
|
|
1328
|
+
storage_type: this.memoryStore.isUsingFallback() ? 'in-memory' : 'sqlite',
|
|
1329
|
+
timestamp: new Date().toISOString(),
|
|
1330
|
+
};
|
|
1331
|
+
|
|
1332
|
+
case 'delete':
|
|
1333
|
+
const deleted = await this.memoryStore.delete(args.key, {
|
|
1334
|
+
namespace: args.namespace || 'default',
|
|
1335
|
+
});
|
|
1336
|
+
|
|
1337
|
+
console.error(
|
|
1338
|
+
`[${new Date().toISOString()}] INFO [claude-flow-mcp] Deleted from shared memory: ${args.key} (success: ${deleted})`,
|
|
1339
|
+
);
|
|
1340
|
+
|
|
1341
|
+
return {
|
|
1342
|
+
success: true,
|
|
1343
|
+
action: 'delete',
|
|
1344
|
+
key: args.key,
|
|
1345
|
+
namespace: args.namespace || 'default',
|
|
1346
|
+
deleted: deleted,
|
|
1347
|
+
storage_type: this.memoryStore.isUsingFallback() ? 'in-memory' : 'sqlite',
|
|
1348
|
+
timestamp: new Date().toISOString(),
|
|
1349
|
+
};
|
|
1350
|
+
|
|
1351
|
+
case 'search':
|
|
1352
|
+
const results = await this.memoryStore.search(args.value || '', {
|
|
1353
|
+
namespace: args.namespace || 'default',
|
|
1354
|
+
limit: 50,
|
|
1355
|
+
});
|
|
1356
|
+
|
|
1357
|
+
console.error(
|
|
1358
|
+
`[${new Date().toISOString()}] INFO [claude-flow-mcp] Searched shared memory: ${results.length} results for "${args.value}"`,
|
|
1359
|
+
);
|
|
1360
|
+
|
|
1361
|
+
return {
|
|
1362
|
+
success: true,
|
|
1363
|
+
action: 'search',
|
|
1364
|
+
pattern: args.value,
|
|
1365
|
+
namespace: args.namespace || 'default',
|
|
1366
|
+
results: results,
|
|
1367
|
+
count: results.length,
|
|
1368
|
+
storage_type: this.memoryStore.isUsingFallback() ? 'in-memory' : 'sqlite',
|
|
1369
|
+
timestamp: new Date().toISOString(),
|
|
1370
|
+
};
|
|
1371
|
+
|
|
1372
|
+
default:
|
|
1373
|
+
return {
|
|
1374
|
+
success: false,
|
|
1375
|
+
error: `Unknown memory action: ${args.action}`,
|
|
1376
|
+
timestamp: new Date().toISOString(),
|
|
1377
|
+
};
|
|
1378
|
+
}
|
|
1379
|
+
} catch (error) {
|
|
1380
|
+
console.error(
|
|
1381
|
+
`[${new Date().toISOString()}] ERROR [claude-flow-mcp] Shared memory operation failed:`,
|
|
1382
|
+
error,
|
|
1383
|
+
);
|
|
1384
|
+
return {
|
|
1385
|
+
success: false,
|
|
1386
|
+
error: error.message,
|
|
1387
|
+
action: args.action,
|
|
1388
|
+
storage_type: this.memoryStore?.isUsingFallback() ? 'in-memory' : 'sqlite',
|
|
1389
|
+
timestamp: new Date().toISOString(),
|
|
1390
|
+
};
|
|
1616
1391
|
}
|
|
1617
|
-
}
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
async handleMemorySearch(args) {
|
|
1395
|
+
if (!this.memoryStore) {
|
|
1396
|
+
return {
|
|
1397
|
+
success: false,
|
|
1398
|
+
error: 'Memory system not initialized',
|
|
1399
|
+
timestamp: new Date().toISOString(),
|
|
1400
|
+
};
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
try {
|
|
1404
|
+
const results = await this.sharedMemory.search(args.pattern, {
|
|
1405
|
+
namespace: args.namespace || 'default',
|
|
1406
|
+
limit: args.limit || 10,
|
|
1407
|
+
});
|
|
1408
|
+
|
|
1409
|
+
return {
|
|
1410
|
+
success: true,
|
|
1411
|
+
pattern: args.pattern,
|
|
1412
|
+
namespace: args.namespace || 'default',
|
|
1413
|
+
results: results,
|
|
1414
|
+
count: results.length,
|
|
1415
|
+
timestamp: new Date().toISOString(),
|
|
1416
|
+
};
|
|
1417
|
+
} catch (error) {
|
|
1418
|
+
console.error(
|
|
1419
|
+
`[${new Date().toISOString()}] ERROR [claude-flow-mcp] Memory search failed:`,
|
|
1420
|
+
error,
|
|
1421
|
+
);
|
|
1422
|
+
return {
|
|
1423
|
+
success: false,
|
|
1424
|
+
error: error.message,
|
|
1425
|
+
timestamp: new Date().toISOString(),
|
|
1426
|
+
};
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
async getActiveSwarmId() {
|
|
1431
|
+
try {
|
|
1432
|
+
const activeSwarmId = await this.memoryStore.retrieve('active_swarm', {
|
|
1433
|
+
namespace: 'system',
|
|
1434
|
+
});
|
|
1435
|
+
return activeSwarmId || null;
|
|
1436
|
+
} catch (error) {
|
|
1437
|
+
console.error(
|
|
1438
|
+
`[${new Date().toISOString()}] ERROR [claude-flow-mcp] Failed to get active swarm:`,
|
|
1439
|
+
error,
|
|
1440
|
+
);
|
|
1441
|
+
return null;
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
createErrorResponse(id, code, message, data = null) {
|
|
1446
|
+
const response = {
|
|
1447
|
+
jsonrpc: '2.0',
|
|
1448
|
+
id,
|
|
1449
|
+
error: { code, message },
|
|
1450
|
+
};
|
|
1451
|
+
if (data) response.error.data = data;
|
|
1452
|
+
return response;
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1618
1456
|
// Main server execution
|
|
1619
1457
|
async function startMCPServer() {
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
await server.sharedMemory.close();
|
|
1675
|
-
}
|
|
1676
|
-
process.exit(0);
|
|
1677
|
-
});
|
|
1678
|
-
process.on('SIGTERM', async ()=>{
|
|
1679
|
-
console.error(`[${new Date().toISOString()}] INFO [claude-flow-mcp] (${server.sessionId}) Received SIGTERM, shutting down gracefully...`);
|
|
1680
|
-
if (server.sharedMemory) {
|
|
1681
|
-
await server.sharedMemory.close();
|
|
1458
|
+
const server = new ClaudeFlowMCPServer();
|
|
1459
|
+
|
|
1460
|
+
console.error(
|
|
1461
|
+
`[${new Date().toISOString()}] INFO [claude-flow-mcp] (${server.sessionId}) Claude-Flow MCP server starting in stdio mode`,
|
|
1462
|
+
);
|
|
1463
|
+
console.error({
|
|
1464
|
+
arch: process.arch,
|
|
1465
|
+
mode: 'mcp-stdio',
|
|
1466
|
+
nodeVersion: process.version,
|
|
1467
|
+
pid: process.pid,
|
|
1468
|
+
platform: process.platform,
|
|
1469
|
+
protocol: 'stdio',
|
|
1470
|
+
sessionId: server.sessionId,
|
|
1471
|
+
version: server.version,
|
|
1472
|
+
});
|
|
1473
|
+
|
|
1474
|
+
// Send server capabilities
|
|
1475
|
+
console.log(
|
|
1476
|
+
JSON.stringify({
|
|
1477
|
+
jsonrpc: '2.0',
|
|
1478
|
+
method: 'server.initialized',
|
|
1479
|
+
params: {
|
|
1480
|
+
serverInfo: {
|
|
1481
|
+
name: 'claude-flow',
|
|
1482
|
+
version: server.version,
|
|
1483
|
+
capabilities: server.capabilities,
|
|
1484
|
+
},
|
|
1485
|
+
},
|
|
1486
|
+
}),
|
|
1487
|
+
);
|
|
1488
|
+
|
|
1489
|
+
// Handle stdin messages
|
|
1490
|
+
let buffer = '';
|
|
1491
|
+
|
|
1492
|
+
process.stdin.on('data', async (chunk) => {
|
|
1493
|
+
buffer += chunk.toString();
|
|
1494
|
+
|
|
1495
|
+
// Process complete JSON messages
|
|
1496
|
+
let lines = buffer.split('\n');
|
|
1497
|
+
buffer = lines.pop() || ''; // Keep incomplete line in buffer
|
|
1498
|
+
|
|
1499
|
+
for (const line of lines) {
|
|
1500
|
+
if (line.trim()) {
|
|
1501
|
+
try {
|
|
1502
|
+
const message = JSON.parse(line);
|
|
1503
|
+
const response = await server.handleMessage(message);
|
|
1504
|
+
if (response) {
|
|
1505
|
+
console.log(JSON.stringify(response));
|
|
1506
|
+
}
|
|
1507
|
+
} catch (error) {
|
|
1508
|
+
console.error(
|
|
1509
|
+
`[${new Date().toISOString()}] ERROR [claude-flow-mcp] Failed to parse message:`,
|
|
1510
|
+
error.message,
|
|
1511
|
+
);
|
|
1682
1512
|
}
|
|
1683
|
-
|
|
1684
|
-
}
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
});
|
|
1516
|
+
|
|
1517
|
+
process.stdin.on('end', () => {
|
|
1518
|
+
console.error(
|
|
1519
|
+
`[${new Date().toISOString()}] INFO [claude-flow-mcp] (${server.sessionId}) 🔌 Connection closed: ${server.sessionId}`,
|
|
1520
|
+
);
|
|
1521
|
+
console.error(
|
|
1522
|
+
`[${new Date().toISOString()}] INFO [claude-flow-mcp] (${server.sessionId}) MCP: stdin closed, shutting down...`,
|
|
1523
|
+
);
|
|
1524
|
+
process.exit(0);
|
|
1525
|
+
});
|
|
1526
|
+
|
|
1527
|
+
// Handle process termination
|
|
1528
|
+
process.on('SIGINT', async () => {
|
|
1529
|
+
console.error(
|
|
1530
|
+
`[${new Date().toISOString()}] INFO [claude-flow-mcp] (${server.sessionId}) Received SIGINT, shutting down gracefully...`,
|
|
1531
|
+
);
|
|
1532
|
+
if (server.sharedMemory) {
|
|
1533
|
+
await server.sharedMemory.close();
|
|
1534
|
+
}
|
|
1535
|
+
process.exit(0);
|
|
1536
|
+
});
|
|
1537
|
+
|
|
1538
|
+
process.on('SIGTERM', async () => {
|
|
1539
|
+
console.error(
|
|
1540
|
+
`[${new Date().toISOString()}] INFO [claude-flow-mcp] (${server.sessionId}) Received SIGTERM, shutting down gracefully...`,
|
|
1541
|
+
);
|
|
1542
|
+
if (server.sharedMemory) {
|
|
1543
|
+
await server.sharedMemory.close();
|
|
1544
|
+
}
|
|
1545
|
+
process.exit(0);
|
|
1546
|
+
});
|
|
1685
1547
|
}
|
|
1548
|
+
|
|
1686
1549
|
// Start the server if this file is run directly
|
|
1687
1550
|
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
1688
|
-
|
|
1551
|
+
startMCPServer().catch(console.error);
|
|
1689
1552
|
}
|
|
1553
|
+
|
|
1690
1554
|
export { ClaudeFlowMCPServer };
|