claude-flow 2.0.0-alpha.35 ā 2.0.0-alpha.37
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/README.md
CHANGED
|
@@ -30,7 +30,23 @@
|
|
|
30
30
|
- **ā” Performance**: 84.8% SWE-Bench solve rate, 2.8-4.4x speed improvement
|
|
31
31
|
|
|
32
32
|
> š„ **Revolutionary AI Coordination**: Build faster, smarter, and more efficiently with AI-powered development orchestration
|
|
33
|
-
|
|
33
|
+
|
|
34
|
+
## š **Table of Contents**
|
|
35
|
+
|
|
36
|
+
- [ā” Quick Start](#-try-v200-alpha-in-4-commands)
|
|
37
|
+
- [šŖ Advanced Hooks System](#-advanced-hooks-system)
|
|
38
|
+
- [š§ Neural Features](#neural-features)
|
|
39
|
+
- [š§ DAA MCP Endpoints](#-daa-mcp-endpoints)
|
|
40
|
+
- [š Hive-Mind Intelligence](#-revolutionary-hive-mind-intelligence)
|
|
41
|
+
- [š§ Hive-Mind Optimization](#-hive-mind-database-optimization)
|
|
42
|
+
- [ā” 87 Advanced MCP Tools](#-87-advanced-mcp-tools)
|
|
43
|
+
- [š® Advanced Usage Examples](#-advanced-usage-examples)
|
|
44
|
+
- [šļø Architecture Overview](#ļø-alpha-architecture-overview)
|
|
45
|
+
- [š ļø Installation & Setup](#ļø-alpha-installation--setup)
|
|
46
|
+
- [š Documentation](#-comprehensive-documentation)
|
|
47
|
+
- [š¤ Contributing](#-contributing-to-alpha)
|
|
48
|
+
- [š License](#-license)
|
|
49
|
+
|
|
34
50
|
## ā” **Try v2.0.0 Alpha in 4 Commands**
|
|
35
51
|
|
|
36
52
|
### šÆ **Instant Alpha Testing**
|
package/package.json
CHANGED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Safe wrapper for ruv-swarm MCP server
|
|
5
|
+
* Handles known logger issue in v1.0.8
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { spawn } from 'child_process';
|
|
9
|
+
import { createInterface } from 'readline';
|
|
10
|
+
|
|
11
|
+
console.log('š Starting ruv-swarm MCP server with error handling...');
|
|
12
|
+
|
|
13
|
+
const ruvSwarmProcess = spawn('npx', ['ruv-swarm', 'mcp', 'start'], {
|
|
14
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
15
|
+
env: {
|
|
16
|
+
...process.env,
|
|
17
|
+
MCP_MODE: 'stdio',
|
|
18
|
+
LOG_LEVEL: 'WARN'
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Forward stdin to ruv-swarm
|
|
23
|
+
process.stdin.pipe(ruvSwarmProcess.stdin);
|
|
24
|
+
|
|
25
|
+
// Handle stdout (JSON-RPC messages)
|
|
26
|
+
ruvSwarmProcess.stdout.pipe(process.stdout);
|
|
27
|
+
|
|
28
|
+
// Handle stderr with filtering
|
|
29
|
+
const rlErr = createInterface({
|
|
30
|
+
input: ruvSwarmProcess.stderr,
|
|
31
|
+
crlfDelay: Infinity
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
let errorHandled = false;
|
|
35
|
+
|
|
36
|
+
rlErr.on('line', (line) => {
|
|
37
|
+
// Filter out the known logger error
|
|
38
|
+
if (line.includes('logger.logMemoryUsage is not a function')) {
|
|
39
|
+
if (!errorHandled) {
|
|
40
|
+
console.error('ā ļø Known ruv-swarm v1.0.8 logger issue detected - continuing normally');
|
|
41
|
+
console.error('š” This error does not affect functionality');
|
|
42
|
+
errorHandled = true;
|
|
43
|
+
}
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Forward other stderr output
|
|
48
|
+
process.stderr.write(line + '\n');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Handle process exit
|
|
52
|
+
ruvSwarmProcess.on('exit', (code, signal) => {
|
|
53
|
+
if (code !== null && code !== 0) {
|
|
54
|
+
console.error(`\nā ruv-swarm exited with code ${code}`);
|
|
55
|
+
console.error('š” Try using: npx claude-flow@alpha mcp start');
|
|
56
|
+
}
|
|
57
|
+
process.exit(code || 0);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Handle errors
|
|
61
|
+
ruvSwarmProcess.on('error', (error) => {
|
|
62
|
+
console.error('ā Failed to start ruv-swarm:', error.message);
|
|
63
|
+
console.error('š” Try using: npx claude-flow@alpha mcp start');
|
|
64
|
+
process.exit(1);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// Handle termination signals
|
|
68
|
+
process.on('SIGTERM', () => {
|
|
69
|
+
ruvSwarmProcess.kill('SIGTERM');
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
process.on('SIGINT', () => {
|
|
73
|
+
ruvSwarmProcess.kill('SIGINT');
|
|
74
|
+
});
|
|
@@ -1602,7 +1602,7 @@ async function spawnClaudeCodeInstances(swarmId, swarmName, objective, workers,
|
|
|
1602
1602
|
claudeAvailable = true;
|
|
1603
1603
|
} catch {
|
|
1604
1604
|
console.log(chalk.yellow('\nā ļø Claude Code CLI not found in PATH'));
|
|
1605
|
-
console.log(chalk.gray('Install it with: npm install -g @anthropic/claude-code
|
|
1605
|
+
console.log(chalk.gray('Install it with: npm install -g @anthropic-ai/claude-code'));
|
|
1606
1606
|
console.log(chalk.gray('\nFalling back to displaying instructions...'));
|
|
1607
1607
|
}
|
|
1608
1608
|
|
|
@@ -1646,7 +1646,7 @@ async function spawnClaudeCodeInstances(swarmId, swarmName, objective, workers,
|
|
|
1646
1646
|
console.log(chalk.yellow('\nš Manual Execution Instructions:'));
|
|
1647
1647
|
console.log(chalk.gray('ā'.repeat(50)));
|
|
1648
1648
|
console.log(chalk.gray('1. Install Claude Code:'));
|
|
1649
|
-
console.log(chalk.green(' npm install -g @anthropic/claude-code
|
|
1649
|
+
console.log(chalk.green(' npm install -g @anthropic-ai/claude-code'));
|
|
1650
1650
|
console.log(chalk.gray('\n2. Run with the saved prompt:'));
|
|
1651
1651
|
console.log(chalk.green(` claude < ${promptFile}`));
|
|
1652
1652
|
console.log(chalk.gray('\n3. Or copy the prompt manually:'));
|
|
@@ -115,7 +115,7 @@ export async function swarmCommand(args, flags) {
|
|
|
115
115
|
claudeAvailable = true;
|
|
116
116
|
} catch {
|
|
117
117
|
console.log('ā ļø Claude Code CLI not found in PATH');
|
|
118
|
-
console.log('Install it with: npm install -g @anthropic/claude-code
|
|
118
|
+
console.log('Install it with: npm install -g @anthropic-ai/claude-code');
|
|
119
119
|
console.log('\nWould spawn Claude Code with swarm objective:');
|
|
120
120
|
console.log(`š Objective: ${objective}`);
|
|
121
121
|
console.log('\nTo use the built-in executor instead: claude-flow swarm "objective" --executor');
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrapper for ruv-swarm MCP server to handle logger issues
|
|
3
|
+
* This wrapper ensures compatibility and handles known issues in ruv-swarm
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { spawn } from 'child_process';
|
|
7
|
+
import { createInterface } from 'readline';
|
|
8
|
+
|
|
9
|
+
export class RuvSwarmWrapper {
|
|
10
|
+
constructor(options = {}) {
|
|
11
|
+
this.options = {
|
|
12
|
+
silent: options.silent || false,
|
|
13
|
+
autoRestart: options.autoRestart !== false,
|
|
14
|
+
maxRestarts: options.maxRestarts || 3,
|
|
15
|
+
restartDelay: options.restartDelay || 1000,
|
|
16
|
+
...options
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
this.process = null;
|
|
20
|
+
this.restartCount = 0;
|
|
21
|
+
this.isShuttingDown = false;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async start() {
|
|
25
|
+
if (this.process) {
|
|
26
|
+
throw new Error('RuvSwarm MCP server is already running');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
30
|
+
try {
|
|
31
|
+
// Spawn ruv-swarm MCP server
|
|
32
|
+
this.process = spawn('npx', ['ruv-swarm', 'mcp', 'start'], {
|
|
33
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
34
|
+
env: {
|
|
35
|
+
...process.env,
|
|
36
|
+
// Ensure stdio mode for MCP
|
|
37
|
+
MCP_MODE: 'stdio',
|
|
38
|
+
// Set log level to reduce noise
|
|
39
|
+
LOG_LEVEL: 'WARN'
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
let initialized = false;
|
|
44
|
+
let initTimeout;
|
|
45
|
+
|
|
46
|
+
// Handle stdout (JSON-RPC messages)
|
|
47
|
+
const rlOut = createInterface({
|
|
48
|
+
input: this.process.stdout,
|
|
49
|
+
crlfDelay: Infinity
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
rlOut.on('line', (line) => {
|
|
53
|
+
try {
|
|
54
|
+
const message = JSON.parse(line);
|
|
55
|
+
|
|
56
|
+
// Check for initialization
|
|
57
|
+
if (message.method === 'server.initialized' && !initialized) {
|
|
58
|
+
initialized = true;
|
|
59
|
+
clearTimeout(initTimeout);
|
|
60
|
+
resolve({
|
|
61
|
+
process: this.process,
|
|
62
|
+
stdout: this.process.stdout,
|
|
63
|
+
stdin: this.process.stdin
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Forward JSON-RPC messages
|
|
68
|
+
process.stdout.write(line + '\n');
|
|
69
|
+
} catch (err) {
|
|
70
|
+
// Not JSON, ignore
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// Handle stderr (logs and errors)
|
|
75
|
+
const rlErr = createInterface({
|
|
76
|
+
input: this.process.stderr,
|
|
77
|
+
crlfDelay: Infinity
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
rlErr.on('line', (line) => {
|
|
81
|
+
// Filter out known harmless errors
|
|
82
|
+
if (line.includes('logger.logMemoryUsage is not a function')) {
|
|
83
|
+
// This is a known issue in ruv-swarm v1.0.8
|
|
84
|
+
// The server continues to work despite this error
|
|
85
|
+
if (!this.options.silent) {
|
|
86
|
+
console.error('ā ļø Known ruv-swarm logger issue detected (continuing normally)');
|
|
87
|
+
}
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Filter out initialization messages if silent
|
|
92
|
+
if (this.options.silent) {
|
|
93
|
+
if (line.includes('ā
') || line.includes('š§ ') || line.includes('š')) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Forward other stderr output
|
|
99
|
+
if (!this.options.silent) {
|
|
100
|
+
process.stderr.write(line + '\n');
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// Handle process errors
|
|
105
|
+
this.process.on('error', (error) => {
|
|
106
|
+
if (!initialized) {
|
|
107
|
+
clearTimeout(initTimeout);
|
|
108
|
+
reject(new Error(`Failed to start ruv-swarm: ${error.message}`));
|
|
109
|
+
} else {
|
|
110
|
+
console.error('RuvSwarm process error:', error);
|
|
111
|
+
this.handleProcessExit(error.code || 1);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// Handle process exit
|
|
116
|
+
this.process.on('exit', (code, signal) => {
|
|
117
|
+
if (!initialized) {
|
|
118
|
+
clearTimeout(initTimeout);
|
|
119
|
+
reject(new Error(`RuvSwarm exited before initialization: code ${code}, signal ${signal}`));
|
|
120
|
+
} else {
|
|
121
|
+
this.handleProcessExit(code || 0);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// Set initialization timeout
|
|
126
|
+
initTimeout = setTimeout(() => {
|
|
127
|
+
if (!initialized) {
|
|
128
|
+
this.stop();
|
|
129
|
+
reject(new Error('RuvSwarm initialization timeout'));
|
|
130
|
+
}
|
|
131
|
+
}, 30000); // 30 second timeout
|
|
132
|
+
|
|
133
|
+
} catch (error) {
|
|
134
|
+
reject(error);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
handleProcessExit(code) {
|
|
140
|
+
this.process = null;
|
|
141
|
+
|
|
142
|
+
if (this.isShuttingDown) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
console.error(`RuvSwarm MCP server exited with code ${code}`);
|
|
147
|
+
|
|
148
|
+
// Auto-restart if enabled and under limit
|
|
149
|
+
if (this.options.autoRestart && this.restartCount < this.options.maxRestarts) {
|
|
150
|
+
this.restartCount++;
|
|
151
|
+
console.log(`Attempting to restart RuvSwarm (attempt ${this.restartCount}/${this.options.maxRestarts})...`);
|
|
152
|
+
|
|
153
|
+
setTimeout(() => {
|
|
154
|
+
this.start().catch(err => {
|
|
155
|
+
console.error('Failed to restart RuvSwarm:', err);
|
|
156
|
+
});
|
|
157
|
+
}, this.options.restartDelay);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async stop() {
|
|
162
|
+
this.isShuttingDown = true;
|
|
163
|
+
|
|
164
|
+
if (!this.process) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return new Promise((resolve) => {
|
|
169
|
+
const killTimeout = setTimeout(() => {
|
|
170
|
+
console.warn('RuvSwarm did not exit gracefully, forcing kill...');
|
|
171
|
+
this.process.kill('SIGKILL');
|
|
172
|
+
}, 5000);
|
|
173
|
+
|
|
174
|
+
this.process.on('exit', () => {
|
|
175
|
+
clearTimeout(killTimeout);
|
|
176
|
+
this.process = null;
|
|
177
|
+
resolve();
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
// Send graceful shutdown signal
|
|
181
|
+
this.process.kill('SIGTERM');
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
isRunning() {
|
|
186
|
+
return this.process !== null && !this.process.killed;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Export a function to start ruv-swarm with error handling
|
|
191
|
+
export async function startRuvSwarmMCP(options = {}) {
|
|
192
|
+
const wrapper = new RuvSwarmWrapper(options);
|
|
193
|
+
|
|
194
|
+
try {
|
|
195
|
+
const result = await wrapper.start();
|
|
196
|
+
console.log('ā
RuvSwarm MCP server started successfully');
|
|
197
|
+
return { wrapper, ...result };
|
|
198
|
+
} catch (error) {
|
|
199
|
+
console.error('ā Failed to start RuvSwarm MCP server:', error.message);
|
|
200
|
+
throw error;
|
|
201
|
+
}
|
|
202
|
+
}
|