claude-flow 2.0.0-alpha.62 → 2.0.0-alpha.63

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.
Files changed (101) hide show
  1. package/.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +54 -0
  2. package/.claude/commands/analysis/token-efficiency.md +2 -1
  3. package/.claude/commands/automation/self-healing.md +47 -2
  4. package/.claude/commands/automation/session-memory.md +39 -10
  5. package/.claude/commands/automation/smart-agents.md +36 -8
  6. package/.claude/commands/github/code-review-swarm.md +80 -15
  7. package/.claude/commands/github/github-modes.md +14 -14
  8. package/.claude/commands/github/issue-tracker.md +19 -16
  9. package/.claude/commands/github/multi-repo-swarm.md +114 -16
  10. package/.claude/commands/github/pr-manager.md +5 -4
  11. package/.claude/commands/github/project-board-sync.md +38 -5
  12. package/.claude/commands/github/release-manager.md +19 -19
  13. package/.claude/commands/github/release-swarm.md +102 -13
  14. package/.claude/commands/github/repo-architect.md +6 -6
  15. package/.claude/commands/github/swarm-issue.md +139 -17
  16. package/.claude/commands/github/swarm-pr.md +49 -15
  17. package/.claude/commands/github/sync-coordinator.md +33 -33
  18. package/.claude/commands/github/workflow-automation.md +37 -10
  19. package/.claude/commands/hooks/overview.md +2 -2
  20. package/.claude/commands/hooks/setup.md +7 -7
  21. package/.claude/commands/memory/neural.md +10 -5
  22. package/.claude/commands/memory/usage.md +9 -5
  23. package/.claude/commands/monitoring/agents.md +7 -5
  24. package/.claude/commands/monitoring/status.md +8 -5
  25. package/.claude/commands/optimization/auto-topology.md +13 -1
  26. package/.claude/commands/optimization/parallel-execution.md +7 -1
  27. package/.claude/commands/sparc/analyzer.md +28 -2
  28. package/.claude/commands/sparc/architect.md +27 -1
  29. package/.claude/commands/sparc/batch-executor.md +27 -1
  30. package/.claude/commands/sparc/coder.md +27 -1
  31. package/.claude/commands/sparc/debugger.md +27 -1
  32. package/.claude/commands/sparc/designer.md +27 -1
  33. package/.claude/commands/sparc/documenter.md +27 -1
  34. package/.claude/commands/sparc/innovator.md +27 -1
  35. package/.claude/commands/sparc/memory-manager.md +27 -1
  36. package/.claude/commands/sparc/optimizer.md +27 -1
  37. package/.claude/commands/sparc/orchestrator.md +106 -2
  38. package/.claude/commands/sparc/researcher.md +27 -1
  39. package/.claude/commands/sparc/reviewer.md +27 -1
  40. package/.claude/commands/sparc/sparc-modes.md +137 -5
  41. package/.claude/commands/sparc/swarm-coordinator.md +27 -1
  42. package/.claude/commands/sparc/tdd.md +27 -1
  43. package/.claude/commands/sparc/tester.md +27 -1
  44. package/.claude/commands/sparc/workflow-manager.md +27 -1
  45. package/.claude/commands/swarm/analysis.md +82 -5
  46. package/.claude/commands/swarm/development.md +83 -6
  47. package/.claude/commands/swarm/examples.md +141 -3
  48. package/.claude/commands/swarm/maintenance.md +92 -8
  49. package/.claude/commands/swarm/optimization.md +107 -9
  50. package/.claude/commands/swarm/research.md +126 -8
  51. package/.claude/commands/swarm/testing.md +121 -9
  52. package/.claude/commands/training/neural-patterns.md +27 -2
  53. package/.claude/commands/training/specialization.md +13 -3
  54. package/.claude/commands/workflows/development.md +43 -4
  55. package/.claude/commands/workflows/research.md +26 -2
  56. package/README.md +8 -0
  57. package/bin/claude-flow +1 -1
  58. package/dist/cli/simple-commands/hive-mind/mcp-wrapper.d.ts +66 -0
  59. package/dist/cli/simple-commands/hive-mind/mcp-wrapper.d.ts.map +1 -1
  60. package/dist/cli/simple-commands/hive-mind/mcp-wrapper.js +220 -2
  61. package/dist/cli/simple-commands/hive-mind/mcp-wrapper.js.map +1 -1
  62. package/dist/cli/simple-commands/hive-mind.d.ts.map +1 -1
  63. package/dist/cli/simple-commands/hive-mind.js +83 -5
  64. package/dist/cli/simple-commands/hive-mind.js.map +1 -1
  65. package/dist/memory/fallback-store.d.ts +1 -0
  66. package/dist/memory/fallback-store.d.ts.map +1 -1
  67. package/dist/memory/fallback-store.js +25 -3
  68. package/dist/memory/fallback-store.js.map +1 -1
  69. package/dist/memory/sqlite-store.d.ts +34 -0
  70. package/dist/memory/sqlite-store.d.ts.map +1 -0
  71. package/dist/memory/sqlite-store.js +2 -3
  72. package/dist/memory/sqlite-store.js.map +1 -1
  73. package/dist/memory/sqlite-wrapper.d.ts +38 -0
  74. package/dist/memory/sqlite-wrapper.d.ts.map +1 -0
  75. package/dist/memory/sqlite-wrapper.js +157 -0
  76. package/dist/memory/sqlite-wrapper.js.map +1 -0
  77. package/package.json +1 -1
  78. package/src/api/claude-api-errors.ts +248 -0
  79. package/src/api/claude-client-enhanced.ts +616 -0
  80. package/src/api/claude-client.ts +282 -14
  81. package/src/cli/help-text.js +2 -1
  82. package/src/cli/simple-commands/coordination.js +73 -49
  83. package/src/cli/simple-commands/hive-mind/auto-save-middleware.js +6 -6
  84. package/src/cli/simple-commands/hive-mind/mcp-wrapper.js +327 -8
  85. package/src/cli/simple-commands/hive-mind/session-manager.js +330 -108
  86. package/src/cli/simple-commands/hive-mind.js +192 -11
  87. package/src/cli/simple-commands/init/claude-commands/optimized-slash-commands.js +53 -28
  88. package/src/cli/simple-commands/init/claude-commands/slash-commands.js +36 -14
  89. package/src/cli/simple-commands/init/claude-commands/sparc-commands.js +107 -30
  90. package/src/cli/simple-commands/init/copy-revised-templates.js +175 -0
  91. package/src/cli/simple-commands/init/index.js +156 -235
  92. package/src/cli/simple-commands/init/template-copier.js +583 -0
  93. package/src/cli/simple-commands/init/templates/coordination.md +16 -0
  94. package/src/cli/simple-commands/init/templates/memory-bank.md +16 -0
  95. package/src/cli/simple-commands/init/templates/settings.json.enhanced +35 -0
  96. package/src/cli/simple-commands/init/templates/sparc-modes.js +634 -23
  97. package/src/hive-mind/core/DatabaseManager.ts +75 -16
  98. package/src/memory/backends/sqlite.ts +21 -3
  99. package/src/memory/fallback-store.js +35 -3
  100. package/src/memory/sqlite-store.js +2 -3
  101. package/src/memory/sqlite-wrapper.js +173 -0
@@ -4,16 +4,128 @@
4
4
  Comprehensive testing through distributed execution.
5
5
 
6
6
  ## Activation
7
- `./claude-flow swarm "test application" --strategy testing`
7
+
8
+ ### Using MCP Tools
9
+ ```javascript
10
+ // Initialize testing swarm
11
+ mcp__claude-flow__swarm_init({
12
+ "topology": "star",
13
+ "maxAgents": 7,
14
+ "strategy": "parallel"
15
+ })
16
+
17
+ // Orchestrate testing task
18
+ mcp__claude-flow__task_orchestrate({
19
+ "task": "test application",
20
+ "strategy": "parallel",
21
+ "priority": "high"
22
+ })
23
+ ```
24
+
25
+ ### Using CLI (Fallback)
26
+ `npx claude-flow swarm "test application" --strategy testing`
8
27
 
9
28
  ## Agent Roles
10
- - Unit Tester: Tests individual components
11
- - Integration Tester: Validates interactions
12
- - E2E Tester: Tests user flows
13
- - Performance Tester: Measures metrics
14
- - Security Tester: Finds vulnerabilities
29
+
30
+ ### Agent Spawning with MCP
31
+ ```javascript
32
+ // Spawn testing agents
33
+ mcp__claude-flow__agent_spawn({
34
+ "type": "tester",
35
+ "name": "Unit Tester",
36
+ "capabilities": ["unit-testing", "mocking", "coverage"]
37
+ })
38
+
39
+ mcp__claude-flow__agent_spawn({
40
+ "type": "tester",
41
+ "name": "Integration Tester",
42
+ "capabilities": ["integration", "api-testing", "contract-testing"]
43
+ })
44
+
45
+ mcp__claude-flow__agent_spawn({
46
+ "type": "tester",
47
+ "name": "E2E Tester",
48
+ "capabilities": ["e2e", "ui-testing", "user-flows"]
49
+ })
50
+
51
+ mcp__claude-flow__agent_spawn({
52
+ "type": "tester",
53
+ "name": "Performance Tester",
54
+ "capabilities": ["load-testing", "stress-testing", "benchmarking"]
55
+ })
56
+
57
+ mcp__claude-flow__agent_spawn({
58
+ "type": "monitor",
59
+ "name": "Security Tester",
60
+ "capabilities": ["security-testing", "penetration-testing", "vulnerability-scanning"]
61
+ })
62
+ ```
15
63
 
16
64
  ## Test Coverage
17
- - Code coverage analysis
18
- - Edge case identification
19
- - Regression prevention
65
+
66
+ ### Coverage Analysis
67
+ ```javascript
68
+ // Quality assessment
69
+ mcp__claude-flow__quality_assess({
70
+ "target": "test-coverage",
71
+ "criteria": ["line-coverage", "branch-coverage", "function-coverage"]
72
+ })
73
+
74
+ // Edge case detection
75
+ mcp__claude-flow__pattern_recognize({
76
+ "data": testScenarios,
77
+ "patterns": ["edge-case", "boundary-condition", "error-path"]
78
+ })
79
+ ```
80
+
81
+ ### Test Execution
82
+ ```javascript
83
+ // Parallel test execution
84
+ mcp__claude-flow__parallel_execute({
85
+ "tasks": [
86
+ { "id": "unit-tests", "command": "npm run test:unit" },
87
+ { "id": "integration-tests", "command": "npm run test:integration" },
88
+ { "id": "e2e-tests", "command": "npm run test:e2e" }
89
+ ]
90
+ })
91
+
92
+ // Batch processing for test suites
93
+ mcp__claude-flow__batch_process({
94
+ "items": testSuites,
95
+ "operation": "execute-test-suite"
96
+ })
97
+ ```
98
+
99
+ ### Performance Testing
100
+ ```javascript
101
+ // Run performance benchmarks
102
+ mcp__claude-flow__benchmark_run({
103
+ "suite": "performance-tests"
104
+ })
105
+
106
+ // Security scanning
107
+ mcp__claude-flow__security_scan({
108
+ "target": "application",
109
+ "depth": "comprehensive"
110
+ })
111
+ ```
112
+
113
+ ### Monitoring and Reporting
114
+ ```javascript
115
+ // Monitor test execution
116
+ mcp__claude-flow__swarm_monitor({
117
+ "swarmId": "testing-swarm",
118
+ "interval": 2000
119
+ })
120
+
121
+ // Generate test report
122
+ mcp__claude-flow__performance_report({
123
+ "format": "detailed",
124
+ "timeframe": "current-run"
125
+ })
126
+
127
+ // Get test results
128
+ mcp__claude-flow__task_results({
129
+ "taskId": "test-execution-001"
130
+ })
131
+ ```
@@ -15,7 +15,11 @@ Every successful operation trains the neural networks:
15
15
  ### 2. Manual Training
16
16
  ```
17
17
  Tool: mcp__claude-flow__neural_train
18
- Parameters: {"iterations": 20}
18
+ Parameters: {
19
+ "pattern_type": "coordination",
20
+ "training_data": "successful task patterns",
21
+ "epochs": 50
22
+ }
19
23
  ```
20
24
 
21
25
  ### 3. Pattern Types
@@ -42,8 +46,29 @@ Result: {
42
46
  }
43
47
  ```
44
48
 
49
+ ## Pattern Analysis
50
+ ```
51
+ Tool: mcp__claude-flow__neural_patterns
52
+ Parameters: {
53
+ "action": "analyze",
54
+ "operation": "recent_edits"
55
+ }
56
+ ```
57
+
45
58
  ## Benefits
46
59
  - 🧠 Learns your coding style
47
60
  - 📈 Improves with each use
48
61
  - 🎯 Better task predictions
49
- - ⚡ Faster coordination
62
+ - ⚡ Faster coordination
63
+
64
+ ## CLI Usage
65
+ ```bash
66
+ # Train neural patterns via CLI
67
+ npx claude-flow neural train --type coordination --epochs 50
68
+
69
+ # Check neural status
70
+ npx claude-flow neural status
71
+
72
+ # Analyze patterns
73
+ npx claude-flow neural patterns --analyze
74
+ ```
@@ -17,7 +17,8 @@ Agents automatically specialize based on file extensions:
17
17
  Tool: mcp__claude-flow__agent_spawn
18
18
  Parameters: {
19
19
  "type": "coder",
20
- "capabilities": ["react", "typescript", "testing"]
20
+ "capabilities": ["react", "typescript", "testing"],
21
+ "name": "React Specialist"
21
22
  }
22
23
  ```
23
24
 
@@ -32,7 +33,7 @@ The system trains through:
32
33
  ```
33
34
  # Check agent specializations
34
35
  Tool: mcp__claude-flow__agent_list
35
- Parameters: {"filter": "active"}
36
+ Parameters: {"swarmId": "current"}
36
37
 
37
38
  Result shows expertise levels:
38
39
  {
@@ -50,4 +51,13 @@ Result shows expertise levels:
50
51
  ```
51
52
 
52
53
  ## Continuous Improvement
53
- Agents share learnings across sessions for cumulative expertise!
54
+ Agents share learnings across sessions for cumulative expertise!
55
+
56
+ ## CLI Usage
57
+ ```bash
58
+ # Train agent specialization via CLI
59
+ npx claude-flow train agent --type coder --capabilities "react,typescript"
60
+
61
+ # Check specializations
62
+ npx claude-flow agent list --specializations
63
+ ```
@@ -15,18 +15,45 @@ Creates hierarchical structure for organized, top-down development.
15
15
  ### 2. Define Development Perspectives
16
16
  ```
17
17
  Tool: mcp__claude-flow__agent_spawn
18
- Parameters: {"type": "architect", "name": "System Design"}
18
+ Parameters: {
19
+ "type": "architect",
20
+ "name": "System Design",
21
+ "capabilities": ["api-design", "database-schema"]
22
+ }
19
23
  ```
20
24
  ```
21
25
  Tool: mcp__claude-flow__agent_spawn
22
- Parameters: {"type": "coder", "name": "Implementation Focus"}
26
+ Parameters: {
27
+ "type": "coder",
28
+ "name": "Implementation Focus",
29
+ "capabilities": ["nodejs", "typescript", "express"]
30
+ }
31
+ ```
32
+ ```
33
+ Tool: mcp__claude-flow__agent_spawn
34
+ Parameters: {
35
+ "type": "tester",
36
+ "name": "Quality Assurance",
37
+ "capabilities": ["unit-testing", "integration-testing"]
38
+ }
23
39
  ```
24
40
  Sets up architectural and implementation thinking patterns.
25
41
 
26
42
  ### 3. Coordinate Implementation
27
43
  ```
28
44
  Tool: mcp__claude-flow__task_orchestrate
29
- Parameters: {"task": "Build REST API with authentication", "strategy": "parallel", "priority": "high"}
45
+ Parameters: {
46
+ "task": "Build REST API with authentication",
47
+ "strategy": "parallel",
48
+ "priority": "high",
49
+ "dependencies": ["database setup", "auth system"]
50
+ }
51
+ ```
52
+
53
+ ### 4. Monitor Progress
54
+ ```
55
+ Tool: mcp__claude-flow__task_status
56
+ Parameters: {"taskId": "api-build-task-123"}
30
57
  ```
31
58
 
32
59
  ## What Claude Code Actually Does
@@ -36,4 +63,16 @@ Parameters: {"task": "Build REST API with authentication", "strategy": "parallel
36
63
  4. Uses **TodoWrite** tool for task tracking
37
64
  5. Follows coordination patterns for systematic implementation
38
65
 
39
- Remember: All code is written by Claude Code using its native tools!
66
+ Remember: All code is written by Claude Code using its native tools!
67
+
68
+ ## CLI Usage
69
+ ```bash
70
+ # Start development workflow via CLI
71
+ npx claude-flow workflow dev "REST API with auth"
72
+
73
+ # Create custom workflow
74
+ npx claude-flow workflow create --name "api-dev" --steps "design,implement,test,deploy"
75
+
76
+ # Execute saved workflow
77
+ npx claude-flow workflow execute api-dev
78
+ ```
@@ -26,7 +26,22 @@ Sets up different analytical approaches for Claude Code to use.
26
26
  ### 3. Execute Coordinated Research
27
27
  ```
28
28
  Tool: mcp__claude-flow__task_orchestrate
29
- Parameters: {"task": "Research modern web frameworks performance", "strategy": "adaptive"}
29
+ Parameters: {
30
+ "task": "Research modern web frameworks performance",
31
+ "strategy": "adaptive",
32
+ "priority": "medium"
33
+ }
34
+ ```
35
+
36
+ ### 4. Store Research Findings
37
+ ```
38
+ Tool: mcp__claude-flow__memory_usage
39
+ Parameters: {
40
+ "action": "store",
41
+ "key": "research_findings",
42
+ "value": "framework performance analysis results",
43
+ "namespace": "research"
44
+ }
30
45
  ```
31
46
 
32
47
  ## What Claude Code Actually Does
@@ -36,4 +51,13 @@ Parameters: {"task": "Research modern web frameworks performance", "strategy": "
36
51
  4. Synthesizes findings using coordination patterns
37
52
  5. Stores insights in memory for future reference
38
53
 
39
- Remember: The swarm coordinates HOW Claude Code researches, not WHAT it finds.
54
+ Remember: The swarm coordinates HOW Claude Code researches, not WHAT it finds.
55
+
56
+ ## CLI Usage
57
+ ```bash
58
+ # Start research workflow via CLI
59
+ npx claude-flow workflow research "modern web frameworks"
60
+
61
+ # Export research workflow
62
+ npx claude-flow workflow export research --format json
63
+ ```
package/README.md CHANGED
@@ -35,6 +35,10 @@
35
35
 
36
36
  ### 📋 **Prerequisites**
37
37
 
38
+ - **Node.js 18+** (LTS recommended)
39
+ - **npm 9+** or equivalent package manager
40
+ - **Windows users**: See [Windows Installation Guide](https://github.com/ruvnet/claude-code-flow/blob/main/docs/windows-installation.md) for special instructions
41
+
38
42
  ⚠️ **IMPORTANT**: Claude Code must be installed first:
39
43
 
40
44
  ```bash
@@ -45,6 +49,8 @@ npm install -g @anthropic-ai/claude-code
45
49
  claude --dangerously-skip-permissions
46
50
  ```
47
51
 
52
+ 💡 **Windows Note**: If you encounter SQLite errors, Claude Flow will automatically use in-memory storage. For persistent storage options, see our [Windows guide](https://github.com/ruvnet/claude-code-flow/blob/main/docs/windows-installation.md).
53
+
48
54
  ### 🎯 **Instant Alpha Testing**
49
55
 
50
56
  ```bash
@@ -301,6 +307,8 @@ npx claude-flow@alpha memory export backup.json --namespace default
301
307
  npx claude-flow@alpha memory import project-memory.json
302
308
  ```
303
309
 
310
+ > 🪟 **Windows Users**: SQLite will automatically fallback to in-memory storage if native modules fail. All features work normally, but data won't persist between sessions. See [Windows guide](https://github.com/ruvnet/claude-code-flow/blob/main/docs/windows-installation.md) for persistent storage options.
311
+
304
312
  ### **🔄 Workflow Orchestration**
305
313
  ```bash
306
314
  # Advanced workflow automation
package/bin/claude-flow CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
  # Claude-Flow Smart Dispatcher - Detects and uses the best available runtime
3
3
 
4
- VERSION="2.0.0-alpha.62"
4
+ VERSION="2.0.0-alpha.63"
5
5
 
6
6
  # Determine the correct path based on how the script is invoked
7
7
  if [ -L "$0" ]; then
@@ -188,6 +188,72 @@ export class MCPToolWrapper {
188
188
  * Clean up and destroy swarm
189
189
  */
190
190
  destroySwarm(swarmId: any): Promise<any[]>;
191
+ /**
192
+ * Get real swarm status from memory storage
193
+ */
194
+ getSwarmStatus(params?: {}): Promise<{
195
+ swarms: {
196
+ id: any;
197
+ name: any;
198
+ status: string;
199
+ agents: number;
200
+ tasks: {
201
+ total: number;
202
+ completed: number;
203
+ pending: number;
204
+ failed: number;
205
+ };
206
+ topology: string;
207
+ createdAt: null;
208
+ lastActivity: null;
209
+ memoryUsage: number;
210
+ }[];
211
+ activeAgents: number;
212
+ totalTasks: number;
213
+ completedTasks: number;
214
+ pendingTasks: number;
215
+ recentActivity: {
216
+ swarmId: any;
217
+ action: any;
218
+ type: any;
219
+ timestamp: any;
220
+ }[];
221
+ summary: {
222
+ totalSwarms: number;
223
+ activeSwarms: number;
224
+ idleSwarms: number;
225
+ inactiveSwarms: number;
226
+ };
227
+ error?: undefined;
228
+ } | {
229
+ swarms: any[];
230
+ activeAgents: number;
231
+ totalTasks: number;
232
+ completedTasks: number;
233
+ pendingTasks: number;
234
+ summary: {
235
+ totalSwarms: number;
236
+ activeSwarms: number;
237
+ idleSwarms?: undefined;
238
+ inactiveSwarms?: undefined;
239
+ };
240
+ recentActivity?: undefined;
241
+ error?: undefined;
242
+ } | {
243
+ swarms: never[];
244
+ activeAgents: number;
245
+ totalTasks: number;
246
+ completedTasks: number;
247
+ pendingTasks: number;
248
+ recentActivity: never[];
249
+ summary: {
250
+ totalSwarms: number;
251
+ activeSwarms: number;
252
+ idleSwarms: number;
253
+ inactiveSwarms: number;
254
+ };
255
+ error: any;
256
+ }>;
191
257
  }
192
258
  export namespace MCP_TOOLS {
193
259
  let swarm: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-wrapper.d.ts","sourceRoot":"","sources":["../../../../src/cli/simple-commands/hive-mind/mcp-wrapper.js"],"names":[],"mappings":"AAmHA;;GAEG;AACH;IACE,yBAiBC;IAhBC;;;;MAKC;IAED,yBAA0B;IAC1B,qBAAuB;IACvB,mBAAsB;IAEtB,uDAAuD;IACvD,UADW,OAAO,gBAAgB,EAAE,QAAQ,GAAG,IAAI,CAC/B;IAMtB;;OAEG;IACH,yCAuCC;IAFG,uCAA4B;IAIhC;;OAEG;IACH,sDA6BC;IAED;;OAEG;IACH,gDA8DC;IAED;;OAEG;IACH,qDAcC;IAED;;OAEG;IACH,iDA2BC;IAED;;OAEG;IACH,2DAgBC;IAED;;OAEG;IACH,mFAoBC;IAlBG;;;;;;;kBAOC;IAaL;;OAEG;IACH,+DA0BC;IAED;;OAEG;IACH,+CAOC;IAED;;OAEG;IACH,kDA+BC;IAED;;OAEG;IACH,kEAoBC;IAED;;OAEG;IACH;;;;;;;;;;;;;;;;;;;;;;;;MA+BC;IAED;;OAEG;IACH,6CAQC;IAED;;OAEG;IACH,mCAMC;IAED;;OAEG;IACH,mCAKC;IAED;;OAEG;IACH,6BAKC;IAED;;OAEG;IACH,6CAwDC;IAED;;OAEG;IACH,sDAqCC;IAED;;OAEG;IACH,oCA4BC;IAED;;OAEG;IACH,8DAkBC;IAhBG;;;;;;;kBAOC;IAWL;;OAEG;IACH;;;;;;;;;;;;;;;;OAmDC;IAED;;OAEG;IACH,qDA4CC;IAED;;OAEG;IACH;;;;;;OAqFC;IAED;;OAEG;IACH,6EA2CC;IAED;;OAEG;IACH,iDAQC;IAED;;OAEG;IACH,uEAcC;IAED;;OAEG;IACH,2DAcC;IAED;;OAEG;IACH,2CAoBC;CACF"}
1
+ {"version":3,"file":"mcp-wrapper.d.ts","sourceRoot":"","sources":["../../../../src/cli/simple-commands/hive-mind/mcp-wrapper.js"],"names":[],"mappings":"AAmHA;;GAEG;AACH;IACE,yBAiBC;IAhBC;;;;MAKC;IAED,yBAA0B;IAC1B,qBAAuB;IACvB,mBAAsB;IAEtB,uDAAuD;IACvD,UADW,OAAO,gBAAgB,EAAE,QAAQ,GAAG,IAAI,CAC/B;IAMtB;;OAEG;IACH,yCAuCC;IAFG,uCAA4B;IAIhC;;OAEG;IACH,sDA6BC;IAED;;OAEG;IACH,gDA8DC;IAED;;OAEG;IACH,qDAcC;IAED;;OAEG;IACH,iDA2BC;IAED;;OAEG;IACH,2DAgBC;IAED;;OAEG;IACH,mFAoBC;IAlBG;;;;;;;kBAOC;IAaL;;OAEG;IACH,+DA4BC;IAED;;OAEG;IACH,+CAOC;IAED;;OAEG;IACH,kDA+BC;IAED;;OAEG;IACH,kEAoBC;IAED;;OAEG;IACH;;;;;;;;;;;;;;;;;;;;;;;;MA+BC;IAED;;OAEG;IACH,6CAQC;IAED;;OAEG;IACH,mCAMC;IAED;;OAEG;IACH,mCAKC;IAED;;OAEG;IACH,6BAKC;IAED;;OAEG;IACH,6CA6EC;IAED;;OAEG;IACH,sDAqCC;IAED;;OAEG;IACH,oCA4BC;IAED;;OAEG;IACH,8DAkBC;IAhBG;;;;;;;kBAOC;IAWL;;OAEG;IACH;;;;;;;;;;;;;;;;OAmDC;IAED;;OAEG;IACH,qDA4CC;IAED;;OAEG;IACH;;;;;;OAqFC;IAED;;OAEG;IACH,6EA2CC;IAED;;OAEG;IACH,iDAQC;IAED;;OAEG;IACH,uEAcC;IAED;;OAEG;IACH,2DAcC;IAED;;OAEG;IACH,2CAoBC;IAED;;OAEG;IACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsNC;CACF"}
@@ -352,6 +352,9 @@ export class MCPToolWrapper {
352
352
  else if (toolName === 'memory_search') {
353
353
  return await this.searchMemory(params.namespace, params.pattern);
354
354
  }
355
+ else if (toolName === 'swarm_status') {
356
+ return await this.getSwarmStatus(params);
357
+ }
355
358
  // For other tools, use mock responses
356
359
  console.log(`Executing MCP tool: mcp__claude-flow__${toolName} with params:`, params);
357
360
  // Simulate async execution for non-memory tools
@@ -538,10 +541,19 @@ export class MCPToolWrapper {
538
541
  const initTime = Date.now() - startTime;
539
542
  await this.storeMemory(swarmId, 'init_performance', {
540
543
  initTime,
541
- topology: config.topology,
542
- maxAgents: config.maxAgents,
544
+ topology: config.topology || 'hierarchical',
545
+ maxAgents: config.maxAgents || 8,
543
546
  timestamp: Date.now(),
544
547
  }, 'metrics');
548
+ // Store swarm status
549
+ await this.storeMemory(swarmId, 'status', 'active', 'status');
550
+ // Store swarm config
551
+ await this.storeMemory(swarmId, 'config', {
552
+ topology: config.topology || 'hierarchical',
553
+ maxAgents: config.maxAgents || 8,
554
+ strategy: config.strategy || 'auto',
555
+ createdAt: Date.now(),
556
+ }, 'config');
545
557
  return [swarmInitResult, ...supportingResults];
546
558
  }
547
559
  catch (error) {
@@ -930,6 +942,212 @@ export class MCPToolWrapper {
930
942
  ];
931
943
  return await this.executeParallel(batch);
932
944
  }
945
+ /**
946
+ * Get real swarm status from memory storage
947
+ */
948
+ async getSwarmStatus(params = {}) {
949
+ try {
950
+ if (!this.memoryDb) {
951
+ await this.initializeMemoryStorage();
952
+ }
953
+ const swarms = [];
954
+ let activeAgents = 0;
955
+ let totalTasks = 0;
956
+ let completedTasks = 0;
957
+ if (this.memoryDb) {
958
+ // Get all unique swarm namespaces
959
+ const namespacesQuery = this.memoryDb.prepare(`
960
+ SELECT DISTINCT namespace FROM memories
961
+ WHERE namespace LIKE 'swarm-%' OR namespace LIKE 'hive-%'
962
+ ORDER BY timestamp DESC
963
+ `);
964
+ const namespaces = namespacesQuery.all();
965
+ // For each swarm, gather its information
966
+ for (const { namespace } of namespaces) {
967
+ const swarmId = namespace;
968
+ // Get swarm metadata
969
+ const metadataQuery = this.memoryDb.prepare(`
970
+ SELECT key, value, type, timestamp FROM memories
971
+ WHERE namespace = ? AND (
972
+ key IN ('init_performance', 'config', 'status', 'agents', 'tasks', 'topology')
973
+ OR key LIKE 'agent-%'
974
+ OR key LIKE 'task-%'
975
+ )
976
+ `);
977
+ const swarmData = metadataQuery.all(swarmId);
978
+ // Parse swarm information
979
+ let swarmInfo = {
980
+ id: swarmId,
981
+ name: swarmId,
982
+ status: 'unknown',
983
+ agents: 0,
984
+ tasks: { total: 0, completed: 0, pending: 0, failed: 0 },
985
+ topology: 'hierarchical',
986
+ createdAt: null,
987
+ lastActivity: null,
988
+ memoryUsage: swarmData.length
989
+ };
990
+ // Process swarm data
991
+ for (const record of swarmData) {
992
+ try {
993
+ const value = typeof record.value === 'string' ? JSON.parse(record.value) : record.value;
994
+ switch (record.key) {
995
+ case 'init_performance':
996
+ swarmInfo.createdAt = value.timestamp;
997
+ swarmInfo.topology = value.topology || 'hierarchical';
998
+ break;
999
+ case 'status':
1000
+ swarmInfo.status = value;
1001
+ break;
1002
+ case 'config':
1003
+ swarmInfo.topology = value.topology || swarmInfo.topology;
1004
+ break;
1005
+ }
1006
+ // Count agents
1007
+ if (record.key.startsWith('agent-')) {
1008
+ swarmInfo.agents++;
1009
+ activeAgents++;
1010
+ }
1011
+ // Count tasks
1012
+ if (record.key.startsWith('task-')) {
1013
+ swarmInfo.tasks.total++;
1014
+ totalTasks++;
1015
+ if (value.status === 'completed') {
1016
+ swarmInfo.tasks.completed++;
1017
+ completedTasks++;
1018
+ }
1019
+ else if (value.status === 'failed') {
1020
+ swarmInfo.tasks.failed++;
1021
+ }
1022
+ else if (value.status === 'pending' || value.status === 'in_progress') {
1023
+ swarmInfo.tasks.pending++;
1024
+ }
1025
+ }
1026
+ // Track last activity
1027
+ if (record.timestamp > (swarmInfo.lastActivity || 0)) {
1028
+ swarmInfo.lastActivity = record.timestamp;
1029
+ }
1030
+ }
1031
+ catch (e) {
1032
+ // Skip invalid JSON values
1033
+ }
1034
+ }
1035
+ // Determine swarm status based on activity
1036
+ if (swarmInfo.status === 'unknown') {
1037
+ const now = Date.now();
1038
+ const lastActivityAge = now - (swarmInfo.lastActivity || 0);
1039
+ if (lastActivityAge < 60000) { // Active within last minute
1040
+ swarmInfo.status = 'active';
1041
+ }
1042
+ else if (lastActivityAge < 300000) { // Active within last 5 minutes
1043
+ swarmInfo.status = 'idle';
1044
+ }
1045
+ else {
1046
+ swarmInfo.status = 'inactive';
1047
+ }
1048
+ }
1049
+ swarms.push(swarmInfo);
1050
+ }
1051
+ // Get recent activity logs
1052
+ const activityQuery = this.memoryDb.prepare(`
1053
+ SELECT namespace, key, type, timestamp FROM memories
1054
+ WHERE (namespace LIKE 'swarm-%' OR namespace LIKE 'hive-%')
1055
+ AND timestamp > ?
1056
+ ORDER BY timestamp DESC
1057
+ LIMIT 10
1058
+ `);
1059
+ const recentActivity = activityQuery.all(Date.now() - 300000); // Last 5 minutes
1060
+ return {
1061
+ swarms,
1062
+ activeAgents,
1063
+ totalTasks,
1064
+ completedTasks,
1065
+ pendingTasks: totalTasks - completedTasks,
1066
+ recentActivity: recentActivity.map(r => ({
1067
+ swarmId: r.namespace,
1068
+ action: r.key,
1069
+ type: r.type,
1070
+ timestamp: r.timestamp
1071
+ })),
1072
+ summary: {
1073
+ totalSwarms: swarms.length,
1074
+ activeSwarms: swarms.filter(s => s.status === 'active').length,
1075
+ idleSwarms: swarms.filter(s => s.status === 'idle').length,
1076
+ inactiveSwarms: swarms.filter(s => s.status === 'inactive').length
1077
+ }
1078
+ };
1079
+ }
1080
+ else {
1081
+ // Fallback to in-memory storage
1082
+ const swarmMap = new Map();
1083
+ for (const [key, memory] of this.memoryStore) {
1084
+ const namespace = memory.namespace;
1085
+ if (namespace && (namespace.startsWith('swarm-') || namespace.startsWith('hive-'))) {
1086
+ if (!swarmMap.has(namespace)) {
1087
+ swarmMap.set(namespace, {
1088
+ id: namespace,
1089
+ name: namespace,
1090
+ status: 'active',
1091
+ agents: 0,
1092
+ tasks: { total: 0, completed: 0, pending: 0, failed: 0 },
1093
+ memoryUsage: 0
1094
+ });
1095
+ }
1096
+ const swarm = swarmMap.get(namespace);
1097
+ swarm.memoryUsage++;
1098
+ if (memory.key.startsWith('agent-')) {
1099
+ swarm.agents++;
1100
+ activeAgents++;
1101
+ }
1102
+ if (memory.key.startsWith('task-')) {
1103
+ swarm.tasks.total++;
1104
+ totalTasks++;
1105
+ try {
1106
+ const taskData = JSON.parse(memory.value);
1107
+ if (taskData.status === 'completed') {
1108
+ swarm.tasks.completed++;
1109
+ completedTasks++;
1110
+ }
1111
+ }
1112
+ catch (e) {
1113
+ // Skip invalid JSON
1114
+ }
1115
+ }
1116
+ }
1117
+ }
1118
+ return {
1119
+ swarms: Array.from(swarmMap.values()),
1120
+ activeAgents,
1121
+ totalTasks,
1122
+ completedTasks,
1123
+ pendingTasks: totalTasks - completedTasks,
1124
+ summary: {
1125
+ totalSwarms: swarmMap.size,
1126
+ activeSwarms: swarmMap.size
1127
+ }
1128
+ };
1129
+ }
1130
+ }
1131
+ catch (error) {
1132
+ console.error('Error getting swarm status:', error);
1133
+ // Return empty status on error
1134
+ return {
1135
+ swarms: [],
1136
+ activeAgents: 0,
1137
+ totalTasks: 0,
1138
+ completedTasks: 0,
1139
+ pendingTasks: 0,
1140
+ recentActivity: [],
1141
+ summary: {
1142
+ totalSwarms: 0,
1143
+ activeSwarms: 0,
1144
+ idleSwarms: 0,
1145
+ inactiveSwarms: 0
1146
+ },
1147
+ error: error.message
1148
+ };
1149
+ }
1150
+ }
933
1151
  }
934
1152
  // Export tool categories for reference
935
1153
  export { MCP_TOOLS };