@sparkleideas/ruv-swarm 1.0.18-patch.1
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 +1565 -0
- package/bin/ruv-swarm-clean.js +1872 -0
- package/bin/ruv-swarm-memory.js +119 -0
- package/bin/ruv-swarm-secure-heartbeat.js +1549 -0
- package/bin/ruv-swarm-secure.js +1689 -0
- package/package.json +221 -0
- package/src/agent.ts +342 -0
- package/src/benchmark.js +267 -0
- package/src/claude-flow-enhanced.js +839 -0
- package/src/claude-integration/advanced-commands.js +561 -0
- package/src/claude-integration/core.js +112 -0
- package/src/claude-integration/docs.js +1548 -0
- package/src/claude-integration/env-template.js +39 -0
- package/src/claude-integration/index.js +209 -0
- package/src/claude-integration/remote.js +408 -0
- package/src/cli-diagnostics.js +364 -0
- package/src/cognitive-pattern-evolution.js +1317 -0
- package/src/daa-cognition.js +977 -0
- package/src/daa-service.d.ts +298 -0
- package/src/daa-service.js +1116 -0
- package/src/diagnostics.js +533 -0
- package/src/errors.js +528 -0
- package/src/github-coordinator/README.md +193 -0
- package/src/github-coordinator/claude-hooks.js +162 -0
- package/src/github-coordinator/gh-cli-coordinator.js +260 -0
- package/src/hooks/cli.js +82 -0
- package/src/hooks/index.js +1900 -0
- package/src/index-enhanced.d.ts +371 -0
- package/src/index-enhanced.js +734 -0
- package/src/index.d.ts +287 -0
- package/src/index.js +405 -0
- package/src/index.ts +457 -0
- package/src/logger.js +182 -0
- package/src/logging-config.js +179 -0
- package/src/mcp-daa-tools.js +735 -0
- package/src/mcp-tools-benchmarks.js +328 -0
- package/src/mcp-tools-enhanced.js +2863 -0
- package/src/memory-config.js +42 -0
- package/src/meta-learning-framework.js +1359 -0
- package/src/neural-agent.js +830 -0
- package/src/neural-coordination-protocol.js +1363 -0
- package/src/neural-models/README.md +118 -0
- package/src/neural-models/autoencoder.js +543 -0
- package/src/neural-models/base.js +269 -0
- package/src/neural-models/cnn.js +497 -0
- package/src/neural-models/gnn.js +447 -0
- package/src/neural-models/gru.js +536 -0
- package/src/neural-models/index.js +273 -0
- package/src/neural-models/lstm.js +551 -0
- package/src/neural-models/neural-presets-complete.js +1306 -0
- package/src/neural-models/presets/graph.js +392 -0
- package/src/neural-models/presets/index.js +279 -0
- package/src/neural-models/presets/nlp.js +328 -0
- package/src/neural-models/presets/timeseries.js +368 -0
- package/src/neural-models/presets/vision.js +387 -0
- package/src/neural-models/resnet.js +534 -0
- package/src/neural-models/transformer.js +515 -0
- package/src/neural-models/vae.js +489 -0
- package/src/neural-network-manager.js +1938 -0
- package/src/neural-network.ts +296 -0
- package/src/neural.js +574 -0
- package/src/performance-benchmarks.js +898 -0
- package/src/performance.js +458 -0
- package/src/persistence-pooled.js +695 -0
- package/src/persistence.js +480 -0
- package/src/schemas.js +864 -0
- package/src/security.js +218 -0
- package/src/singleton-container.js +183 -0
- package/src/sqlite-pool.js +587 -0
- package/src/sqlite-worker.js +141 -0
- package/src/types.ts +164 -0
- package/src/utils.ts +286 -0
- package/src/wasm-loader.js +601 -0
- package/src/wasm-loader2.js +404 -0
- package/src/wasm-memory-optimizer.js +783 -0
- package/src/wasm-types.d.ts +63 -0
- package/wasm/README.md +347 -0
- package/wasm/neuro-divergent.wasm +0 -0
- package/wasm/package.json +18 -0
- package/wasm/ruv-fann.wasm +0 -0
- package/wasm/ruv_swarm_simd.wasm +0 -0
- package/wasm/ruv_swarm_wasm.d.ts +391 -0
- package/wasm/ruv_swarm_wasm.js +2164 -0
- package/wasm/ruv_swarm_wasm_bg.wasm +0 -0
- package/wasm/ruv_swarm_wasm_bg.wasm.d.ts +123 -0
- package/wasm/wasm-bindings-loader.mjs +435 -0
- package/wasm/wasm-updates.md +684 -0
|
@@ -0,0 +1,1689 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Production-ready @sparkleideas/ruv-swarm MCP server with ZERO timeout mechanisms
|
|
4
|
+
* ALL timeout/connection/interval code completely removed for bulletproof operation
|
|
5
|
+
* Maintains security and stability without ANY timeout-related disconnections
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { spawn } from 'child_process';
|
|
9
|
+
import { setupClaudeIntegration, invokeClaudeWithSwarm as _invokeClaudeWithSwarm } from '../src/claude-integration/index.js';
|
|
10
|
+
import { RuvSwarm } from '../src/index-enhanced.js';
|
|
11
|
+
import { EnhancedMCPTools } from '../src/mcp-tools-enhanced.js';
|
|
12
|
+
import { daaMcpTools } from '../src/mcp-daa-tools.js';
|
|
13
|
+
import mcpToolsEnhanced from '../src/mcp-tools-enhanced.js';
|
|
14
|
+
import { Logger } from '../src/logger.js';
|
|
15
|
+
import { CommandSanitizer, SecurityError } from '../src/security.js';
|
|
16
|
+
import { readFileSync } from 'fs';
|
|
17
|
+
import { fileURLToPath } from 'url';
|
|
18
|
+
import { dirname, join } from 'path';
|
|
19
|
+
|
|
20
|
+
// Get version from package.json
|
|
21
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
22
|
+
const __dirname = dirname(__filename);
|
|
23
|
+
|
|
24
|
+
async function getVersion() {
|
|
25
|
+
try {
|
|
26
|
+
const packagePath = join(__dirname, '..', 'package.json');
|
|
27
|
+
const packageJson = JSON.parse(readFileSync(packagePath, 'utf8'));
|
|
28
|
+
return packageJson.version;
|
|
29
|
+
} catch (error) {
|
|
30
|
+
return 'unknown';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Stability configuration - NO TIMEOUT MECHANISMS
|
|
35
|
+
const MAX_RESTARTS = 10;
|
|
36
|
+
const RESTART_DELAY = 1000; // 1 second
|
|
37
|
+
const RESTART_RESET_TIME = 300000; // 5 minutes
|
|
38
|
+
|
|
39
|
+
let restartCount = 0;
|
|
40
|
+
let lastRestartTime = 0;
|
|
41
|
+
let isStabilityMode = false;
|
|
42
|
+
let childProcess = null;
|
|
43
|
+
|
|
44
|
+
// Input validation constants and functions
|
|
45
|
+
const VALID_TOPOLOGIES = ['mesh', 'hierarchical', 'ring', 'star'];
|
|
46
|
+
const VALID_AGENT_TYPES = ['researcher', 'coder', 'analyst', 'optimizer', 'coordinator', 'architect', 'tester'];
|
|
47
|
+
const MAX_AGENTS_LIMIT = 100;
|
|
48
|
+
const MIN_AGENTS_LIMIT = 1;
|
|
49
|
+
|
|
50
|
+
class ValidationError extends Error {
|
|
51
|
+
constructor(message, parameter = null) {
|
|
52
|
+
super(message);
|
|
53
|
+
this.name = 'ValidationError';
|
|
54
|
+
this.parameter = parameter;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function validateTopology(topology) {
|
|
59
|
+
if (!topology || typeof topology !== 'string') {
|
|
60
|
+
throw new ValidationError('Topology must be a non-empty string', 'topology');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!VALID_TOPOLOGIES.includes(topology.toLowerCase())) {
|
|
64
|
+
throw new ValidationError(
|
|
65
|
+
`Invalid topology '${topology}'. Valid topologies are: ${VALID_TOPOLOGIES.join(', ')}`,
|
|
66
|
+
'topology'
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return topology.toLowerCase();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function validateMaxAgents(maxAgents) {
|
|
74
|
+
// Handle string input
|
|
75
|
+
if (typeof maxAgents === 'string') {
|
|
76
|
+
const parsed = parseInt(maxAgents, 10);
|
|
77
|
+
if (isNaN(parsed)) {
|
|
78
|
+
throw new ValidationError(
|
|
79
|
+
`Invalid maxAgents '${maxAgents}'. Must be a number between ${MIN_AGENTS_LIMIT} and ${MAX_AGENTS_LIMIT}`,
|
|
80
|
+
'maxAgents'
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
maxAgents = parsed;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (!Number.isInteger(maxAgents) || maxAgents < MIN_AGENTS_LIMIT || maxAgents > MAX_AGENTS_LIMIT) {
|
|
87
|
+
throw new ValidationError(
|
|
88
|
+
`Invalid maxAgents '${maxAgents}'. Must be an integer between ${MIN_AGENTS_LIMIT} and ${MAX_AGENTS_LIMIT}`,
|
|
89
|
+
'maxAgents'
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return maxAgents;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function validateAgentType(type) {
|
|
97
|
+
if (!type || typeof type !== 'string') {
|
|
98
|
+
throw new ValidationError('Agent type must be a non-empty string', 'type');
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (!VALID_AGENT_TYPES.includes(type.toLowerCase())) {
|
|
102
|
+
throw new ValidationError(
|
|
103
|
+
`Invalid agent type '${type}'. Valid types are: ${VALID_AGENT_TYPES.join(', ')}`,
|
|
104
|
+
'type'
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return type.toLowerCase();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function validateAgentName(name) {
|
|
112
|
+
if (name !== null && name !== undefined) {
|
|
113
|
+
if (typeof name !== 'string') {
|
|
114
|
+
throw new ValidationError('Agent name must be a string', 'name');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (name.length === 0) {
|
|
118
|
+
throw new ValidationError('Agent name cannot be empty', 'name');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (name.length > 100) {
|
|
122
|
+
throw new ValidationError('Agent name cannot exceed 100 characters', 'name');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Check for invalid characters
|
|
126
|
+
if (!/^[a-zA-Z0-9\s\-_\.]+$/.test(name)) {
|
|
127
|
+
throw new ValidationError(
|
|
128
|
+
'Agent name can only contain letters, numbers, spaces, hyphens, underscores, and periods',
|
|
129
|
+
'name'
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return name;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function validateTaskDescription(task) {
|
|
138
|
+
if (!task || typeof task !== 'string') {
|
|
139
|
+
throw new ValidationError('Task description must be a non-empty string', 'task');
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (task.trim().length === 0) {
|
|
143
|
+
throw new ValidationError('Task description cannot be empty or only whitespace', 'task');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (task.length > 1000) {
|
|
147
|
+
throw new ValidationError('Task description cannot exceed 1000 characters', 'task');
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return task.trim();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function logValidationError(error, command) {
|
|
154
|
+
console.log(`ā Validation Error in '${command}' command:`);
|
|
155
|
+
console.log(` ${error.message}`);
|
|
156
|
+
if (error.parameter) {
|
|
157
|
+
console.log(` Parameter: ${error.parameter}`);
|
|
158
|
+
}
|
|
159
|
+
console.log(`\nš” For help with valid parameters, run: @sparkleideas/ruv-swarm help`);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function stabilityLog(message) {
|
|
163
|
+
const timestamp = new Date().toISOString();
|
|
164
|
+
console.error(`[${timestamp}] [STABILITY] ${message}`);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
let globalRuvSwarm = null;
|
|
168
|
+
let globalMCPTools = null;
|
|
169
|
+
let globalLogger = null;
|
|
170
|
+
|
|
171
|
+
// Initialize logger based on environment
|
|
172
|
+
async function initializeLogger() {
|
|
173
|
+
if (!globalLogger) {
|
|
174
|
+
globalLogger = new Logger({
|
|
175
|
+
name: 'ruv-swarm-mcp-no-timeout',
|
|
176
|
+
level: process.env.LOG_LEVEL || (process.argv.includes('--debug') ? 'DEBUG' : 'INFO'),
|
|
177
|
+
enableStderr: true, // Always use stderr in MCP mode
|
|
178
|
+
enableFile: process.env.LOG_TO_FILE === 'true',
|
|
179
|
+
formatJson: process.env.LOG_FORMAT === 'json',
|
|
180
|
+
logDir: process.env.LOG_DIR || './logs',
|
|
181
|
+
metadata: {
|
|
182
|
+
pid: process.pid,
|
|
183
|
+
version: await getVersion(),
|
|
184
|
+
mode: 'mcp-stdio-no-timeout'
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
// Set up global error handlers with stability - NO TIMEOUT MECHANISMS
|
|
189
|
+
process.on('uncaughtException', (error) => {
|
|
190
|
+
globalLogger.fatal('Uncaught exception', { error });
|
|
191
|
+
if (isStabilityMode) {
|
|
192
|
+
stabilityLog(`Uncaught exception: ${error.message}`);
|
|
193
|
+
stabilityLog('Attempting graceful recovery...');
|
|
194
|
+
// NO TIMEOUT - immediate exit
|
|
195
|
+
process.exit(1);
|
|
196
|
+
} else {
|
|
197
|
+
process.exit(1);
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
process.on('unhandledRejection', (reason, promise) => {
|
|
202
|
+
globalLogger.fatal('Unhandled rejection', { reason, promise });
|
|
203
|
+
if (isStabilityMode) {
|
|
204
|
+
stabilityLog(`Unhandled rejection: ${reason}`);
|
|
205
|
+
stabilityLog('Attempting graceful recovery...');
|
|
206
|
+
} else {
|
|
207
|
+
process.exit(1);
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
return globalLogger;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
async function initializeSystem() {
|
|
215
|
+
if (!globalRuvSwarm) {
|
|
216
|
+
// RuvSwarm.initialize already prints initialization messages
|
|
217
|
+
globalRuvSwarm = await RuvSwarm.initialize({
|
|
218
|
+
loadingStrategy: 'progressive',
|
|
219
|
+
enablePersistence: true,
|
|
220
|
+
enableNeuralNetworks: true,
|
|
221
|
+
enableForecasting: true,
|
|
222
|
+
useSIMD: RuvSwarm.detectSIMDSupport(),
|
|
223
|
+
debug: process.argv.includes('--debug')
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (!globalMCPTools) {
|
|
228
|
+
// Pass the already initialized RuvSwarm instance to avoid duplicate initialization
|
|
229
|
+
globalMCPTools = new EnhancedMCPTools(globalRuvSwarm);
|
|
230
|
+
await globalMCPTools.initialize(globalRuvSwarm);
|
|
231
|
+
|
|
232
|
+
// Initialize DAA MCP tools with the same instance
|
|
233
|
+
daaMcpTools.mcpTools = globalMCPTools;
|
|
234
|
+
await daaMcpTools.ensureInitialized();
|
|
235
|
+
|
|
236
|
+
// Add DAA tool methods to the MCP tools object
|
|
237
|
+
const daaToolNames = [
|
|
238
|
+
'daa_init', 'daa_agent_create', 'daa_agent_adapt', 'daa_workflow_create',
|
|
239
|
+
'daa_workflow_execute', 'daa_knowledge_share', 'daa_learning_status',
|
|
240
|
+
'daa_cognitive_pattern', 'daa_meta_learning', 'daa_performance_metrics'
|
|
241
|
+
];
|
|
242
|
+
|
|
243
|
+
for (const toolName of daaToolNames) {
|
|
244
|
+
if (typeof daaMcpTools[toolName] === 'function') {
|
|
245
|
+
globalMCPTools[toolName] = daaMcpTools[toolName].bind(daaMcpTools);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return { ruvSwarm: globalRuvSwarm, mcpTools: globalMCPTools };
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
async function handleInit(args) {
|
|
254
|
+
try {
|
|
255
|
+
const { mcpTools } = await initializeSystem();
|
|
256
|
+
|
|
257
|
+
// Filter out flags to get positional arguments
|
|
258
|
+
const positionalArgs = args.filter(arg => !arg.startsWith('--'));
|
|
259
|
+
const rawTopology = positionalArgs[0] || 'mesh';
|
|
260
|
+
const rawMaxAgents = positionalArgs[1] || '5';
|
|
261
|
+
const setupClaude = args.includes('--claude') || args.includes('--setup-claude');
|
|
262
|
+
const forceSetup = args.includes('--force');
|
|
263
|
+
const mergeSetup = args.includes('--merge');
|
|
264
|
+
const noInteractive = args.includes('--no-interactive');
|
|
265
|
+
const noBackup = args.includes('--no-backup');
|
|
266
|
+
|
|
267
|
+
// Validate inputs
|
|
268
|
+
const topology = validateTopology(rawTopology);
|
|
269
|
+
const maxAgents = validateMaxAgents(rawMaxAgents);
|
|
270
|
+
|
|
271
|
+
console.log('š Initializing @sparkleideas/ruv-swarm (NO TIMEOUT VERSION)...');
|
|
272
|
+
|
|
273
|
+
const result = await mcpTools.swarm_init({
|
|
274
|
+
topology,
|
|
275
|
+
maxAgents,
|
|
276
|
+
strategy: 'balanced',
|
|
277
|
+
enableCognitiveDiversity: true,
|
|
278
|
+
enableNeuralAgents: true,
|
|
279
|
+
enableForecasting: args.includes('--forecasting')
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
console.log('š Swarm initialized:');
|
|
283
|
+
console.log(' ID: ' + result.id);
|
|
284
|
+
console.log(' Topology: ' + result.topology);
|
|
285
|
+
console.log(' Max Agents: ' + result.maxAgents);
|
|
286
|
+
console.log(' Features: ' + Object.entries(result.features).filter(([k,v]) => v).map(([k,v]) => k).join(', '));
|
|
287
|
+
console.log(' Performance: ' + result.performance.initialization_time_ms.toFixed(1) + 'ms');
|
|
288
|
+
console.log(' š„ TIMEOUT MECHANISMS: COMPLETELY REMOVED');
|
|
289
|
+
|
|
290
|
+
// Setup Claude integration using modular approach
|
|
291
|
+
if (setupClaude || forceSetup || mergeSetup) {
|
|
292
|
+
console.log('\nš Setting up modular Claude Code integration...');
|
|
293
|
+
try {
|
|
294
|
+
await setupClaudeIntegration({
|
|
295
|
+
autoSetup: setupClaude,
|
|
296
|
+
forceSetup: forceSetup,
|
|
297
|
+
mergeSetup: mergeSetup,
|
|
298
|
+
noBackup: noBackup,
|
|
299
|
+
interactive: !noInteractive,
|
|
300
|
+
workingDir: process.cwd(),
|
|
301
|
+
packageName: '@sparkleideas/ruv-swarm'
|
|
302
|
+
});
|
|
303
|
+
} catch (error) {
|
|
304
|
+
console.log('ā ļø Claude integration setup had issues:', error.message);
|
|
305
|
+
console.log('š” Manual setup: claude mcp add @sparkleideas/ruv-swarm npx @sparkleideas/ruv-swarm mcp start');
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
console.log('\nā
Initialization complete!');
|
|
310
|
+
console.log('\nš Next steps:');
|
|
311
|
+
console.log(' 1. Test with MCP tools: mcp__ruv-swarm__agent_spawn');
|
|
312
|
+
console.log(' 2. Use wrapper scripts for remote execution');
|
|
313
|
+
console.log(' 3. Check .claude/commands/ for detailed guides');
|
|
314
|
+
console.log(' 4. š„ ENJOY INFINITE RUNTIME - NO TIMEOUTS!');
|
|
315
|
+
|
|
316
|
+
if (forceSetup) {
|
|
317
|
+
console.log('\nš Files regenerated with --force flag');
|
|
318
|
+
} else if (mergeSetup) {
|
|
319
|
+
console.log('\nš Configuration merged with existing files');
|
|
320
|
+
}
|
|
321
|
+
} catch (error) {
|
|
322
|
+
if (error instanceof ValidationError) {
|
|
323
|
+
logValidationError(error, 'init');
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
throw error;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
async function handleSpawn(args) {
|
|
331
|
+
try {
|
|
332
|
+
const { mcpTools } = await initializeSystem();
|
|
333
|
+
|
|
334
|
+
const rawType = args[0] || 'researcher';
|
|
335
|
+
const rawName = args[1] || null;
|
|
336
|
+
|
|
337
|
+
// Validate inputs
|
|
338
|
+
const type = validateAgentType(rawType);
|
|
339
|
+
const name = validateAgentName(rawName);
|
|
340
|
+
|
|
341
|
+
const result = await mcpTools.agent_spawn({
|
|
342
|
+
type,
|
|
343
|
+
name,
|
|
344
|
+
enableNeuralNetwork: !args.includes('--no-neural')
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
console.log('š¤ Agent spawned:');
|
|
348
|
+
console.log(' ID: ' + result.agent.id);
|
|
349
|
+
console.log(' Name: ' + result.agent.name);
|
|
350
|
+
console.log(' Type: ' + result.agent.type);
|
|
351
|
+
console.log(' Cognitive Pattern: ' + result.agent.cognitive_pattern);
|
|
352
|
+
if (result.agent.neural_network_id) {
|
|
353
|
+
console.log(' Neural Network: ' + result.agent.neural_network_id);
|
|
354
|
+
}
|
|
355
|
+
console.log(' Swarm Capacity: ' + result.swarm_info.capacity);
|
|
356
|
+
console.log(' š„ TIMEOUT PROTECTION: DISABLED');
|
|
357
|
+
} catch (error) {
|
|
358
|
+
if (error instanceof ValidationError) {
|
|
359
|
+
logValidationError(error, 'spawn');
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
throw error;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
async function handleOrchestrate(args) {
|
|
367
|
+
try {
|
|
368
|
+
const { mcpTools } = await initializeSystem();
|
|
369
|
+
|
|
370
|
+
const rawTask = args.join(' ');
|
|
371
|
+
if (!rawTask) {
|
|
372
|
+
console.log('ā No task provided');
|
|
373
|
+
console.log('Usage: @sparkleideas/ruv-swarm orchestrate "task description"');
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// Validate task description
|
|
378
|
+
const task = validateTaskDescription(rawTask);
|
|
379
|
+
|
|
380
|
+
const result = await mcpTools.task_orchestrate({
|
|
381
|
+
task: task,
|
|
382
|
+
strategy: 'adaptive'
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
console.log('š Task orchestrated:');
|
|
386
|
+
console.log(' ID: ' + result.taskId);
|
|
387
|
+
console.log(' Description: ' + result.description);
|
|
388
|
+
console.log(' Assigned Agents: ' + result.assigned_agents.length);
|
|
389
|
+
console.log(' Status: ' + result.status);
|
|
390
|
+
console.log(' Estimated Completion: ' + result.performance.estimated_completion_ms + 'ms');
|
|
391
|
+
console.log(' š„ EXECUTION MODE: INFINITE RUNTIME');
|
|
392
|
+
} catch (error) {
|
|
393
|
+
if (error instanceof ValidationError) {
|
|
394
|
+
logValidationError(error, 'orchestrate');
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
throw error;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
async function handleClaudeInvoke(args) {
|
|
402
|
+
const prompt = args.join(' ');
|
|
403
|
+
|
|
404
|
+
if (!prompt.trim()) {
|
|
405
|
+
console.log('ā No prompt provided');
|
|
406
|
+
console.log('Usage: @sparkleideas/ruv-swarm claude-invoke "your swarm prompt"');
|
|
407
|
+
console.log('Note: Use --dangerously-skip-permissions explicitly if needed');
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
// Security: validate prompt for dangerous patterns
|
|
412
|
+
try {
|
|
413
|
+
CommandSanitizer.validateArgument(prompt.trim());
|
|
414
|
+
} catch (error) {
|
|
415
|
+
if (error instanceof SecurityError) {
|
|
416
|
+
console.error('ā Security validation failed:', error.message);
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
throw error;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
console.log('š Invoking Claude Code with @sparkleideas/ruv-swarm integration...');
|
|
423
|
+
console.log('Prompt: ' + prompt.trim());
|
|
424
|
+
|
|
425
|
+
try {
|
|
426
|
+
// Create orchestrator with secure mode
|
|
427
|
+
const { ClaudeIntegrationOrchestrator } = await import('../src/claude-integration/index.js');
|
|
428
|
+
const orchestrator = new ClaudeIntegrationOrchestrator({
|
|
429
|
+
workingDir: process.cwd()
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
// Use secure mode (no automatic permissions)
|
|
433
|
+
await orchestrator.core.invokeClaudeWithPrompt(prompt, { secure: true });
|
|
434
|
+
} catch (error) {
|
|
435
|
+
console.error('ā Claude invocation failed:', error.message);
|
|
436
|
+
console.error('Make sure Claude Code CLI is installed and in your PATH');
|
|
437
|
+
process.exit(1);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
async function handleStatus(args) {
|
|
442
|
+
const { mcpTools } = await initializeSystem();
|
|
443
|
+
|
|
444
|
+
const verbose = args.includes('--verbose') || args.includes('-v');
|
|
445
|
+
const swarmId = args.find(arg => !arg.startsWith('-'));
|
|
446
|
+
|
|
447
|
+
const result = await mcpTools.swarm_status({ verbose });
|
|
448
|
+
|
|
449
|
+
if (swarmId) {
|
|
450
|
+
console.log(`š Swarm Status (${swarmId}) - NO TIMEOUT VERSION:`);
|
|
451
|
+
console.log(` Agents: ${result.agents.total} (${result.agents.active} active, ${result.agents.idle} idle)`);
|
|
452
|
+
console.log(` Tasks: ${result.tasks.total} (${result.tasks.pending} pending, ${result.tasks.in_progress} in progress)`);
|
|
453
|
+
console.log(` š„ TIMEOUT PROTECTION: COMPLETELY DISABLED`);
|
|
454
|
+
} else {
|
|
455
|
+
console.log('š Global Status (NO TIMEOUT VERSION):');
|
|
456
|
+
console.log(` Active Swarms: ${result.active_swarms}`);
|
|
457
|
+
console.log(` Total Agents: ${result.global_metrics.totalAgents}`);
|
|
458
|
+
console.log(` Total Tasks: ${result.global_metrics.totalTasks}`);
|
|
459
|
+
console.log(` Memory Usage: ${result.global_metrics.memoryUsage / (1024 * 1024)}MB`);
|
|
460
|
+
console.log(` š„ RUNTIME: INFINITE (NO TIMEOUTS)`);
|
|
461
|
+
|
|
462
|
+
if (verbose) {
|
|
463
|
+
console.log('\nš WASM Modules:');
|
|
464
|
+
Object.entries(result.runtime_info.wasm_modules).forEach(([name, status]) => {
|
|
465
|
+
console.log(` ${name}: ${status.loaded ? 'ā
Loaded' : 'ā³ Not loaded'} (${(status.size / 1024).toFixed(0)}KB)`);
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
async function handleMonitor(args) {
|
|
472
|
+
const { mcpTools } = await initializeSystem();
|
|
473
|
+
|
|
474
|
+
const duration = parseInt(args.find(arg => arg.match(/^\d+$/)), 10) || 10000;
|
|
475
|
+
|
|
476
|
+
console.log(`š Monitoring for ${duration}ms... (NO TIMEOUT VERSION)`);
|
|
477
|
+
console.log('Press Ctrl+C to stop\n');
|
|
478
|
+
|
|
479
|
+
// REMOVED: All connection intervals and timeout mechanisms
|
|
480
|
+
// Instead, use a simple loop with await delay
|
|
481
|
+
let elapsed = 0;
|
|
482
|
+
const interval = 1000; // 1 second
|
|
483
|
+
|
|
484
|
+
while (elapsed < duration) {
|
|
485
|
+
const status = await mcpTools.swarm_status({ verbose: false });
|
|
486
|
+
process.stdout.write('\r');
|
|
487
|
+
process.stdout.write(`Swarms: ${status.active_swarms} | Agents: ${status.global_metrics.totalAgents} | Tasks: ${status.global_metrics.totalTasks} | Memory: ${(status.global_metrics.memoryUsage / (1024 * 1024)).toFixed(1)}MB | Runtime: INFINITE`);
|
|
488
|
+
|
|
489
|
+
// Simple delay without setTimeout
|
|
490
|
+
await new Promise(resolve => {
|
|
491
|
+
const start = Date.now();
|
|
492
|
+
while (Date.now() - start < interval) {
|
|
493
|
+
// Busy wait - no timeout mechanisms
|
|
494
|
+
}
|
|
495
|
+
resolve();
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
elapsed += interval;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
console.log('\n\nā
Monitoring complete (NO TIMEOUT MECHANISMS USED)');
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
async function handleMcp(args) {
|
|
505
|
+
const subcommand = args[0] || 'help';
|
|
506
|
+
|
|
507
|
+
switch (subcommand) {
|
|
508
|
+
case 'start':
|
|
509
|
+
await startMcpServer(args.slice(1));
|
|
510
|
+
break;
|
|
511
|
+
case 'status':
|
|
512
|
+
await getMcpStatus();
|
|
513
|
+
break;
|
|
514
|
+
case 'stop':
|
|
515
|
+
await stopMcpServer();
|
|
516
|
+
break;
|
|
517
|
+
case 'tools':
|
|
518
|
+
await listMcpTools();
|
|
519
|
+
break;
|
|
520
|
+
case 'config':
|
|
521
|
+
await configureMcp(args.slice(1));
|
|
522
|
+
break;
|
|
523
|
+
case 'help':
|
|
524
|
+
default:
|
|
525
|
+
showMcpHelp();
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
async function startMcpServer(args) {
|
|
530
|
+
const protocol = args.find(arg => arg.startsWith('--protocol='))?.split('=')[1] || 'stdio';
|
|
531
|
+
const enableStability = args.includes('--stability') || process.env.MCP_STABILITY === 'true';
|
|
532
|
+
|
|
533
|
+
if (enableStability) {
|
|
534
|
+
isStabilityMode = true;
|
|
535
|
+
stabilityLog('Starting MCP server with stability mode enabled (NO TIMEOUT VERSION)');
|
|
536
|
+
return startStableMcpServer(args);
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// Initialize logger first
|
|
540
|
+
const logger = await initializeLogger();
|
|
541
|
+
const sessionId = logger.setCorrelationId();
|
|
542
|
+
|
|
543
|
+
try {
|
|
544
|
+
if (protocol === 'stdio') {
|
|
545
|
+
// In stdio mode, only JSON-RPC messages should go to stdout
|
|
546
|
+
logger.info('@sparkleideas/ruv-swarm MCP server starting in stdio mode (NO TIMEOUT VERSION)', {
|
|
547
|
+
protocol,
|
|
548
|
+
sessionId,
|
|
549
|
+
nodeVersion: process.version,
|
|
550
|
+
platform: process.platform,
|
|
551
|
+
arch: process.arch
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
// Log connection establishment
|
|
555
|
+
logger.logConnection('established', sessionId, {
|
|
556
|
+
protocol: 'stdio',
|
|
557
|
+
transport: 'stdin/stdout',
|
|
558
|
+
timestamp: new Date().toISOString()
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
// Initialize WASM if needed
|
|
562
|
+
const initOpId = logger.startOperation('initialize-system');
|
|
563
|
+
const { ruvSwarm, mcpTools } = await initializeSystem();
|
|
564
|
+
logger.endOperation(initOpId, true, { modulesLoaded: true });
|
|
565
|
+
|
|
566
|
+
// Start stdio MCP server loop
|
|
567
|
+
process.stdin.setEncoding('utf8');
|
|
568
|
+
|
|
569
|
+
// Signal server readiness for testing
|
|
570
|
+
if (process.env.MCP_TEST_MODE === 'true') {
|
|
571
|
+
console.error('MCP server ready (NO TIMEOUT VERSION)'); // Use stderr so it doesn't interfere with JSON-RPC
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
let buffer = '';
|
|
575
|
+
let messageCount = 0;
|
|
576
|
+
// Infinite runtime - no activity tracking needed
|
|
577
|
+
|
|
578
|
+
process.stdin.on('data', (chunk) => {
|
|
579
|
+
logger.trace('Received stdin data', { bytes: chunk.length });
|
|
580
|
+
// Infinite runtime - no activity tracking needed
|
|
581
|
+
buffer += chunk;
|
|
582
|
+
|
|
583
|
+
// Process complete JSON messages
|
|
584
|
+
const lines = buffer.split('\n');
|
|
585
|
+
buffer = lines.pop() || '';
|
|
586
|
+
|
|
587
|
+
for (const line of lines) {
|
|
588
|
+
if (line.trim()) {
|
|
589
|
+
messageCount++;
|
|
590
|
+
const messageId = `msg-${sessionId}-${messageCount}`;
|
|
591
|
+
|
|
592
|
+
try {
|
|
593
|
+
const request = JSON.parse(line);
|
|
594
|
+
logger.logMcp('in', request.method || 'unknown', {
|
|
595
|
+
method: request.method,
|
|
596
|
+
id: request.id,
|
|
597
|
+
params: request.params,
|
|
598
|
+
messageId
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
const opId = logger.startOperation(`mcp-${request.method}`, {
|
|
602
|
+
requestId: request.id,
|
|
603
|
+
messageId
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
handleMcpRequest(request, mcpTools, logger).then(response => {
|
|
607
|
+
logger.endOperation(opId, !response.error, {
|
|
608
|
+
hasError: !!response.error
|
|
609
|
+
});
|
|
610
|
+
|
|
611
|
+
logger.logMcp('out', request.method || 'response', {
|
|
612
|
+
method: request.method,
|
|
613
|
+
id: response.id,
|
|
614
|
+
result: response.result,
|
|
615
|
+
error: response.error,
|
|
616
|
+
messageId
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
try {
|
|
620
|
+
process.stdout.write(JSON.stringify(response) + '\n');
|
|
621
|
+
} catch (writeError) {
|
|
622
|
+
logger.error('Failed to write response to stdout', { writeError, response });
|
|
623
|
+
process.exit(1);
|
|
624
|
+
}
|
|
625
|
+
}).catch(error => {
|
|
626
|
+
logger.endOperation(opId, false, { error });
|
|
627
|
+
logger.error('Request handler error', { error, request });
|
|
628
|
+
|
|
629
|
+
const errorResponse = {
|
|
630
|
+
jsonrpc: '2.0',
|
|
631
|
+
error: {
|
|
632
|
+
code: -32603,
|
|
633
|
+
message: 'Internal error',
|
|
634
|
+
data: error.message
|
|
635
|
+
},
|
|
636
|
+
id: request.id
|
|
637
|
+
};
|
|
638
|
+
process.stdout.write(JSON.stringify(errorResponse) + '\n');
|
|
639
|
+
});
|
|
640
|
+
} catch (error) {
|
|
641
|
+
logger.error('JSON parse error', {
|
|
642
|
+
error,
|
|
643
|
+
line: line.substring(0, 100),
|
|
644
|
+
messageId
|
|
645
|
+
});
|
|
646
|
+
|
|
647
|
+
const errorResponse = {
|
|
648
|
+
jsonrpc: '2.0',
|
|
649
|
+
error: {
|
|
650
|
+
code: -32700,
|
|
651
|
+
message: 'Parse error',
|
|
652
|
+
data: error.message
|
|
653
|
+
},
|
|
654
|
+
id: null
|
|
655
|
+
};
|
|
656
|
+
process.stdout.write(JSON.stringify(errorResponse) + '\n');
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
// Infinite runtime - no monitoring intervals needed
|
|
663
|
+
// The server now runs indefinitely without any timeout checks
|
|
664
|
+
|
|
665
|
+
// Handle stdin close
|
|
666
|
+
process.stdin.on('end', () => {
|
|
667
|
+
logger.logConnection('closed', sessionId, {
|
|
668
|
+
messagesProcessed: messageCount,
|
|
669
|
+
uptime: process.uptime()
|
|
670
|
+
});
|
|
671
|
+
logger.info('MCP: stdin closed, shutting down...');
|
|
672
|
+
// REMOVED: clearInterval calls (no intervals to clear)
|
|
673
|
+
process.exit(0);
|
|
674
|
+
});
|
|
675
|
+
|
|
676
|
+
process.stdin.on('error', (error) => {
|
|
677
|
+
logger.logConnection('failed', sessionId, { error });
|
|
678
|
+
logger.error('MCP: stdin error, shutting down...', { error });
|
|
679
|
+
// REMOVED: clearInterval calls (no intervals to clear)
|
|
680
|
+
process.exit(1);
|
|
681
|
+
});
|
|
682
|
+
|
|
683
|
+
// Handle process termination signals
|
|
684
|
+
process.on('SIGTERM', () => {
|
|
685
|
+
logger.info('MCP: Received SIGTERM, shutting down gracefully...');
|
|
686
|
+
// REMOVED: clearInterval calls (no intervals to clear)
|
|
687
|
+
process.exit(0);
|
|
688
|
+
});
|
|
689
|
+
|
|
690
|
+
process.on('SIGINT', () => {
|
|
691
|
+
logger.info('MCP: Received SIGINT, shutting down gracefully...');
|
|
692
|
+
// REMOVED: clearInterval calls (no intervals to clear)
|
|
693
|
+
process.exit(0);
|
|
694
|
+
});
|
|
695
|
+
|
|
696
|
+
// Send initialization message
|
|
697
|
+
const version = await getVersion();
|
|
698
|
+
const initMessage = {
|
|
699
|
+
jsonrpc: '2.0',
|
|
700
|
+
method: 'server.initialized',
|
|
701
|
+
params: {
|
|
702
|
+
serverInfo: {
|
|
703
|
+
name: 'ruv-swarm-no-timeout',
|
|
704
|
+
version: version,
|
|
705
|
+
capabilities: {
|
|
706
|
+
tools: true,
|
|
707
|
+
prompts: false,
|
|
708
|
+
resources: true
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
};
|
|
713
|
+
process.stdout.write(JSON.stringify(initMessage) + '\n');
|
|
714
|
+
|
|
715
|
+
// COMPLETELY REMOVED: ALL CONNECTION AND TIMEOUT MECHANISMS
|
|
716
|
+
// The server now runs indefinitely without any timeout checks
|
|
717
|
+
logger.info('MCP server running with NO TIMEOUT MECHANISMS', {
|
|
718
|
+
connectionStatus: 'INFINITE_RUNTIME',
|
|
719
|
+
timeoutStatus: 'DISABLED',
|
|
720
|
+
connectionMode: 'INFINITE'
|
|
721
|
+
});
|
|
722
|
+
|
|
723
|
+
} else {
|
|
724
|
+
logger.error('WebSocket protocol not yet implemented', { protocol });
|
|
725
|
+
console.log('ā WebSocket protocol not yet implemented in production version');
|
|
726
|
+
console.log('Use stdio mode for Claude Code integration');
|
|
727
|
+
}
|
|
728
|
+
} catch (error) {
|
|
729
|
+
logger.fatal('Failed to start MCP server', { error, protocol });
|
|
730
|
+
console.error('ā Failed to start MCP server:', error.message);
|
|
731
|
+
process.exit(1);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
async function startStableMcpServer(args) {
|
|
736
|
+
const now = Date.now();
|
|
737
|
+
|
|
738
|
+
// Reset restart count if it's been more than 5 minutes
|
|
739
|
+
if (now - lastRestartTime > RESTART_RESET_TIME) {
|
|
740
|
+
restartCount = 0;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
if (restartCount >= MAX_RESTARTS) {
|
|
744
|
+
stabilityLog(`Maximum restarts (${MAX_RESTARTS}) reached. Server may have persistent issues.`);
|
|
745
|
+
stabilityLog('Please check logs and restart manually if needed.');
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
restartCount++;
|
|
750
|
+
lastRestartTime = now;
|
|
751
|
+
|
|
752
|
+
stabilityLog(`Starting MCP server (attempt ${restartCount}/${MAX_RESTARTS}) - NO TIMEOUT VERSION`);
|
|
753
|
+
|
|
754
|
+
// Create new process args without --stability flag
|
|
755
|
+
const processArgs = ['mcp', 'start', ...args.filter(arg => arg !== '--stability')];
|
|
756
|
+
|
|
757
|
+
childProcess = spawn('node', [__filename, ...processArgs], {
|
|
758
|
+
stdio: ['inherit', 'inherit', 'inherit'],
|
|
759
|
+
env: { ...process.env, MCP_STABILITY: 'false' }
|
|
760
|
+
});
|
|
761
|
+
|
|
762
|
+
childProcess.on('exit', (code, signal) => {
|
|
763
|
+
if (code === 0) {
|
|
764
|
+
stabilityLog('MCP server exited normally');
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
stabilityLog(`MCP server crashed with code ${code} and signal ${signal}`);
|
|
769
|
+
stabilityLog(`Restarting in ${RESTART_DELAY}ms...`);
|
|
770
|
+
|
|
771
|
+
// Using async delay instead of timeout mechanisms
|
|
772
|
+
(async () => {
|
|
773
|
+
const delayStart = Date.now();
|
|
774
|
+
const delayEnd = delayStart + RESTART_DELAY;
|
|
775
|
+
|
|
776
|
+
while (Date.now() < delayEnd) {
|
|
777
|
+
await new Promise(resolve => {
|
|
778
|
+
const waitTime = Math.min(100, delayEnd - Date.now());
|
|
779
|
+
const start = Date.now();
|
|
780
|
+
while (Date.now() - start < waitTime) {
|
|
781
|
+
// Busy wait - no intervals
|
|
782
|
+
}
|
|
783
|
+
resolve();
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
startStableMcpServer(args);
|
|
788
|
+
})();
|
|
789
|
+
});
|
|
790
|
+
|
|
791
|
+
childProcess.on('error', (error) => {
|
|
792
|
+
stabilityLog(`Failed to start MCP server: ${error.message}`);
|
|
793
|
+
stabilityLog(`Restarting in ${RESTART_DELAY}ms...`);
|
|
794
|
+
|
|
795
|
+
// Using async delay instead of timeout mechanisms
|
|
796
|
+
(async () => {
|
|
797
|
+
const delayStart = Date.now();
|
|
798
|
+
const delayEnd = delayStart + RESTART_DELAY;
|
|
799
|
+
|
|
800
|
+
while (Date.now() < delayEnd) {
|
|
801
|
+
await new Promise(resolve => {
|
|
802
|
+
const waitTime = Math.min(100, delayEnd - Date.now());
|
|
803
|
+
const start = Date.now();
|
|
804
|
+
while (Date.now() - start < waitTime) {
|
|
805
|
+
// Busy wait - no intervals
|
|
806
|
+
}
|
|
807
|
+
resolve();
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
startStableMcpServer(args);
|
|
812
|
+
})();
|
|
813
|
+
});
|
|
814
|
+
|
|
815
|
+
// Handle process termination signals
|
|
816
|
+
process.on('SIGTERM', () => {
|
|
817
|
+
stabilityLog('Received SIGTERM, shutting down...');
|
|
818
|
+
if (childProcess) {
|
|
819
|
+
childProcess.kill('SIGTERM');
|
|
820
|
+
}
|
|
821
|
+
process.exit(0);
|
|
822
|
+
});
|
|
823
|
+
|
|
824
|
+
process.on('SIGINT', () => {
|
|
825
|
+
stabilityLog('Received SIGINT, shutting down...');
|
|
826
|
+
if (childProcess) {
|
|
827
|
+
childProcess.kill('SIGINT');
|
|
828
|
+
}
|
|
829
|
+
process.exit(0);
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
async function getMcpStatus() {
|
|
834
|
+
console.log('š MCP Server Status (NO TIMEOUT VERSION):');
|
|
835
|
+
console.log(' Protocol: stdio (for Claude Code integration)');
|
|
836
|
+
console.log(' Status: Ready to start');
|
|
837
|
+
console.log(' Usage: npx @sparkleideas/ruv-swarm mcp start [--stability]');
|
|
838
|
+
console.log(' Stability: Auto-restart on crashes (use --stability flag)');
|
|
839
|
+
console.log(' š„ TIMEOUT MECHANISMS: COMPLETELY DISABLED');
|
|
840
|
+
console.log(' š„ RUNTIME: INFINITE');
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
async function stopMcpServer() {
|
|
844
|
+
if (childProcess) {
|
|
845
|
+
stabilityLog('Stopping MCP server...');
|
|
846
|
+
childProcess.kill('SIGTERM');
|
|
847
|
+
childProcess = null;
|
|
848
|
+
}
|
|
849
|
+
console.log('ā
MCP server stopped');
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
async function listMcpTools() {
|
|
853
|
+
console.log('š ļø Available MCP Tools (NO TIMEOUT VERSION):');
|
|
854
|
+
console.log('\nš Core Swarm Tools:');
|
|
855
|
+
console.log(' mcp__ruv-swarm__swarm_init - Initialize a new swarm');
|
|
856
|
+
console.log(' mcp__ruv-swarm__agent_spawn - Spawn new agents');
|
|
857
|
+
console.log(' mcp__ruv-swarm__task_orchestrate - Orchestrate tasks');
|
|
858
|
+
console.log(' mcp__ruv-swarm__swarm_status - Get swarm status');
|
|
859
|
+
console.log(' ... and 11 more core tools');
|
|
860
|
+
console.log('\nš¤ DAA (Decentralized Autonomous Agents) Tools:');
|
|
861
|
+
console.log(' mcp__ruv-swarm__daa_init - Initialize DAA service');
|
|
862
|
+
console.log(' mcp__ruv-swarm__daa_agent_create - Create autonomous agents');
|
|
863
|
+
console.log(' mcp__ruv-swarm__daa_workflow_create - Create DAA workflows');
|
|
864
|
+
console.log(' mcp__ruv-swarm__daa_learning_status - Get learning progress');
|
|
865
|
+
console.log(' ... and 6 more DAA tools');
|
|
866
|
+
console.log('\nš„ SPECIAL FEATURE: NO TIMEOUT MECHANISMS');
|
|
867
|
+
console.log(' ⢠Infinite runtime capability');
|
|
868
|
+
console.log(' ⢠No connection interruptions');
|
|
869
|
+
console.log(' ⢠No connection timeouts');
|
|
870
|
+
console.log(' ⢠Bulletproof stability');
|
|
871
|
+
console.log('\nFor full documentation, run: @sparkleideas/ruv-swarm init --claude');
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
function showMcpHelp() {
|
|
875
|
+
console.log(`
|
|
876
|
+
š MCP (Model Context Protocol) Commands - NO TIMEOUT VERSION
|
|
877
|
+
|
|
878
|
+
Usage: @sparkleideas/ruv-swarm mcp <subcommand> [options]
|
|
879
|
+
|
|
880
|
+
Subcommands:
|
|
881
|
+
start [--protocol=stdio] [--stability] Start MCP server
|
|
882
|
+
status Show MCP server status
|
|
883
|
+
stop Stop MCP server
|
|
884
|
+
tools List available MCP tools
|
|
885
|
+
help Show this help message
|
|
886
|
+
|
|
887
|
+
Options:
|
|
888
|
+
--stability Enable auto-restart on crashes
|
|
889
|
+
--protocol=stdio Use stdio protocol (default)
|
|
890
|
+
|
|
891
|
+
š„ TIMEOUT MECHANISMS: COMPLETELY REMOVED
|
|
892
|
+
⢠No connection intervals
|
|
893
|
+
⢠No connection timeouts
|
|
894
|
+
⢠No activity monitoring
|
|
895
|
+
⢠Infinite runtime capability
|
|
896
|
+
|
|
897
|
+
Environment Variables:
|
|
898
|
+
LOG_LEVEL Log level (DEBUG, INFO, WARN, ERROR)
|
|
899
|
+
|
|
900
|
+
šØ REMOVED VARIABLES (NO LONGER NEEDED):
|
|
901
|
+
MCP_CONNECTION_INTERVAL ā REMOVED
|
|
902
|
+
MCP_CONNECTION_TIMEOUT ā REMOVED
|
|
903
|
+
|
|
904
|
+
Examples:
|
|
905
|
+
@sparkleideas/ruv-swarm mcp start # Start stdio MCP server (no timeouts)
|
|
906
|
+
@sparkleideas/ruv-swarm mcp start --stability # Start with crash protection (no timeouts)
|
|
907
|
+
@sparkleideas/ruv-swarm mcp tools # List available tools
|
|
908
|
+
|
|
909
|
+
For Claude Code integration:
|
|
910
|
+
claude mcp add @sparkleideas/ruv-swarm npx @sparkleideas/ruv-swarm mcp start --stability
|
|
911
|
+
|
|
912
|
+
š„ SPECIAL FEATURES:
|
|
913
|
+
⢠Bulletproof infinite runtime
|
|
914
|
+
⢠No disconnection mechanisms
|
|
915
|
+
⢠Maximum stability without timeouts
|
|
916
|
+
⢠Secure operation maintained
|
|
917
|
+
`);
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
async function configureMcp(args) {
|
|
921
|
+
console.log('š§ MCP configuration is managed through Claude Code');
|
|
922
|
+
console.log('Run: @sparkleideas/ruv-swarm init --claude');
|
|
923
|
+
console.log('š„ NO TIMEOUT CONFIGURATION NEEDED - RUNS FOREVER!');
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
async function getResourceContent(uri) {
|
|
927
|
+
const resources = {
|
|
928
|
+
'swarm://docs/getting-started': {
|
|
929
|
+
contents: [{
|
|
930
|
+
uri,
|
|
931
|
+
mimeType: 'text/markdown',
|
|
932
|
+
text: `# Getting Started with @sparkleideas/ruv-swarm (NO TIMEOUT VERSION)
|
|
933
|
+
|
|
934
|
+
## Introduction
|
|
935
|
+
@sparkleideas/ruv-swarm is a powerful WASM-powered neural swarm orchestration system that enhances Claude Code's capabilities through intelligent agent coordination.
|
|
936
|
+
|
|
937
|
+
š„ **SPECIAL FEATURE: NO TIMEOUT MECHANISMS**
|
|
938
|
+
This version has ALL timeout and connection monitoring mechanisms completely removed for bulletproof infinite runtime.
|
|
939
|
+
|
|
940
|
+
## Quick Start
|
|
941
|
+
|
|
942
|
+
1. **Initialize a swarm:**
|
|
943
|
+
\`\`\`bash
|
|
944
|
+
mcp__ruv-swarm__swarm_init { topology: "mesh", maxAgents: 5 }
|
|
945
|
+
\`\`\`
|
|
946
|
+
|
|
947
|
+
2. **Spawn agents:**
|
|
948
|
+
\`\`\`bash
|
|
949
|
+
mcp__ruv-swarm__agent_spawn { type: "researcher", name: "Doc Analyzer" }
|
|
950
|
+
mcp__ruv-swarm__agent_spawn { type: "coder", name: "Implementation Expert" }
|
|
951
|
+
\`\`\`
|
|
952
|
+
|
|
953
|
+
3. **Orchestrate tasks:**
|
|
954
|
+
\`\`\`bash
|
|
955
|
+
mcp__ruv-swarm__task_orchestrate { task: "Build a REST API", strategy: "adaptive" }
|
|
956
|
+
\`\`\`
|
|
957
|
+
|
|
958
|
+
## Key Concepts
|
|
959
|
+
|
|
960
|
+
- **Agents**: Cognitive patterns that guide Claude Code's approach
|
|
961
|
+
- **Topologies**: Organizational structures for agent coordination
|
|
962
|
+
- **Memory**: Persistent state across sessions
|
|
963
|
+
- **Neural Training**: Continuous improvement through learning
|
|
964
|
+
- **š„ INFINITE RUNTIME**: No timeout mechanisms whatsoever
|
|
965
|
+
|
|
966
|
+
## Best Practices
|
|
967
|
+
|
|
968
|
+
1. Always batch operations in a single message
|
|
969
|
+
2. Use memory for cross-agent coordination
|
|
970
|
+
3. Monitor progress with status tools
|
|
971
|
+
4. Train neural patterns for better results
|
|
972
|
+
5. š„ ENJOY INFINITE RUNTIME - NO TIMEOUTS!
|
|
973
|
+
|
|
974
|
+
## Removed Features (For Bulletproof Operation)
|
|
975
|
+
- ā Connection monitoring mechanisms
|
|
976
|
+
- ā Connection timeouts
|
|
977
|
+
- ā Activity monitoring
|
|
978
|
+
- ā Automatic disconnections
|
|
979
|
+
- ā
Infinite runtime capability`
|
|
980
|
+
}]
|
|
981
|
+
},
|
|
982
|
+
'swarm://docs/stability': {
|
|
983
|
+
contents: [{
|
|
984
|
+
uri,
|
|
985
|
+
mimeType: 'text/markdown',
|
|
986
|
+
text: `# Stability Features (NO TIMEOUT VERSION)
|
|
987
|
+
|
|
988
|
+
## Auto-Restart Protection
|
|
989
|
+
The production version includes built-in crash protection:
|
|
990
|
+
|
|
991
|
+
- **Maximum restarts**: 10 attempts
|
|
992
|
+
- **Restart delay**: 1 second between attempts
|
|
993
|
+
- **Reset window**: 5 minutes (restart count resets)
|
|
994
|
+
- **Graceful shutdown**: SIGTERM/SIGINT handling
|
|
995
|
+
|
|
996
|
+
## š„ TIMEOUT REMOVAL FEATURES
|
|
997
|
+
|
|
998
|
+
### What Was Removed:
|
|
999
|
+
- ā **Connection intervals**: No periodic connection checks
|
|
1000
|
+
- ā **Connection timeouts**: No automatic disconnections
|
|
1001
|
+
- ā **Activity monitoring**: No idle timeout tracking
|
|
1002
|
+
- ā **Timeout environment variables**: MCP_CONNECTION_* vars removed
|
|
1003
|
+
|
|
1004
|
+
### What Was Preserved:
|
|
1005
|
+
- ā
**Security validation**: All security features intact
|
|
1006
|
+
- ā
**Error handling**: Proper error management
|
|
1007
|
+
- ā
**Process signals**: SIGTERM/SIGINT handling
|
|
1008
|
+
- ā
**Stability mode**: Auto-restart on crashes
|
|
1009
|
+
- ā
**Logging**: Full logging capability
|
|
1010
|
+
|
|
1011
|
+
## Usage
|
|
1012
|
+
\`\`\`bash
|
|
1013
|
+
# Enable stability mode (no timeouts)
|
|
1014
|
+
@sparkleideas/ruv-swarm mcp start --stability
|
|
1015
|
+
|
|
1016
|
+
# For Claude Code integration (no timeouts)
|
|
1017
|
+
claude mcp add @sparkleideas/ruv-swarm npx @sparkleideas/ruv-swarm mcp start --stability
|
|
1018
|
+
\`\`\`
|
|
1019
|
+
|
|
1020
|
+
## Features
|
|
1021
|
+
- Automatic process restart on crashes
|
|
1022
|
+
- Proper signal handling
|
|
1023
|
+
- Detailed logging of restart attempts
|
|
1024
|
+
- Circuit breaker pattern to prevent infinite loops
|
|
1025
|
+
- š„ **INFINITE RUNTIME**: Never disconnects due to timeout
|
|
1026
|
+
- š„ **BULLETPROOF STABILITY**: No timeout-related failures
|
|
1027
|
+
|
|
1028
|
+
## Security Notes
|
|
1029
|
+
- All security features from Issue #107 are preserved
|
|
1030
|
+
- Input validation and sanitization maintained
|
|
1031
|
+
- Command injection prevention intact
|
|
1032
|
+
- WASM integrity verification preserved
|
|
1033
|
+
- š„ **TIMEOUT VULNERABILITIES**: Eliminated by removing all timeout code`
|
|
1034
|
+
}]
|
|
1035
|
+
}
|
|
1036
|
+
};
|
|
1037
|
+
|
|
1038
|
+
const resource = resources[uri];
|
|
1039
|
+
if (!resource) {
|
|
1040
|
+
throw new Error(`Resource not found: ${uri}`);
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
return resource;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
async function handleMcpRequest(request, mcpTools, logger = null) {
|
|
1047
|
+
const response = {
|
|
1048
|
+
jsonrpc: '2.0',
|
|
1049
|
+
id: request.id
|
|
1050
|
+
};
|
|
1051
|
+
|
|
1052
|
+
// Use default logger if not provided
|
|
1053
|
+
if (!logger) {
|
|
1054
|
+
logger = await initializeLogger();
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
try {
|
|
1058
|
+
logger.debug('Processing MCP request (NO TIMEOUT VERSION)', {
|
|
1059
|
+
method: request.method,
|
|
1060
|
+
hasParams: !!request.params,
|
|
1061
|
+
requestId: request.id
|
|
1062
|
+
});
|
|
1063
|
+
|
|
1064
|
+
switch (request.method) {
|
|
1065
|
+
case 'initialize':
|
|
1066
|
+
const version = await getVersion();
|
|
1067
|
+
response.result = {
|
|
1068
|
+
protocolVersion: '2024-11-05',
|
|
1069
|
+
capabilities: {
|
|
1070
|
+
tools: {},
|
|
1071
|
+
resources: {
|
|
1072
|
+
list: true,
|
|
1073
|
+
read: true
|
|
1074
|
+
}
|
|
1075
|
+
},
|
|
1076
|
+
serverInfo: {
|
|
1077
|
+
name: 'ruv-swarm-no-timeout',
|
|
1078
|
+
version: version
|
|
1079
|
+
}
|
|
1080
|
+
};
|
|
1081
|
+
break;
|
|
1082
|
+
|
|
1083
|
+
case 'tools/list':
|
|
1084
|
+
response.result = {
|
|
1085
|
+
tools: [
|
|
1086
|
+
{
|
|
1087
|
+
name: 'swarm_init',
|
|
1088
|
+
description: 'Initialize a new swarm with specified topology (NO TIMEOUT VERSION)',
|
|
1089
|
+
inputSchema: {
|
|
1090
|
+
type: 'object',
|
|
1091
|
+
properties: {
|
|
1092
|
+
topology: { type: 'string', enum: ['mesh', 'hierarchical', 'ring', 'star'], description: 'Swarm topology type' },
|
|
1093
|
+
maxAgents: { type: 'number', minimum: 1, maximum: 100, default: 5, description: 'Maximum number of agents' },
|
|
1094
|
+
strategy: { type: 'string', enum: ['balanced', 'specialized', 'adaptive'], default: 'balanced', description: 'Distribution strategy' }
|
|
1095
|
+
},
|
|
1096
|
+
required: ['topology']
|
|
1097
|
+
}
|
|
1098
|
+
},
|
|
1099
|
+
{
|
|
1100
|
+
name: 'swarm_status',
|
|
1101
|
+
description: 'Get current swarm status and agent information (NO TIMEOUT VERSION)',
|
|
1102
|
+
inputSchema: {
|
|
1103
|
+
type: 'object',
|
|
1104
|
+
properties: {
|
|
1105
|
+
verbose: { type: 'boolean', default: false, description: 'Include detailed agent information' }
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
},
|
|
1109
|
+
{
|
|
1110
|
+
name: 'swarm_monitor',
|
|
1111
|
+
description: 'Monitor swarm activity in real-time (NO TIMEOUT VERSION)',
|
|
1112
|
+
inputSchema: {
|
|
1113
|
+
type: 'object',
|
|
1114
|
+
properties: {
|
|
1115
|
+
duration: { type: 'number', default: 10, description: 'Monitoring duration in seconds' },
|
|
1116
|
+
interval: { type: 'number', default: 1, description: 'Update interval in seconds' }
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
},
|
|
1120
|
+
{
|
|
1121
|
+
name: 'agent_spawn',
|
|
1122
|
+
description: 'Spawn a new agent in the swarm (NO TIMEOUT VERSION)',
|
|
1123
|
+
inputSchema: {
|
|
1124
|
+
type: 'object',
|
|
1125
|
+
properties: {
|
|
1126
|
+
type: { type: 'string', enum: ['researcher', 'coder', 'analyst', 'optimizer', 'coordinator'], description: 'Agent type' },
|
|
1127
|
+
name: { type: 'string', description: 'Custom agent name' },
|
|
1128
|
+
capabilities: { type: 'array', items: { type: 'string' }, description: 'Agent capabilities' }
|
|
1129
|
+
},
|
|
1130
|
+
required: ['type']
|
|
1131
|
+
}
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
name: 'agent_list',
|
|
1135
|
+
description: 'List all active agents in the swarm (NO TIMEOUT VERSION)',
|
|
1136
|
+
inputSchema: {
|
|
1137
|
+
type: 'object',
|
|
1138
|
+
properties: {
|
|
1139
|
+
filter: { type: 'string', enum: ['all', 'active', 'idle', 'busy'], default: 'all', description: 'Filter agents by status' }
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
},
|
|
1143
|
+
{
|
|
1144
|
+
name: 'agent_metrics',
|
|
1145
|
+
description: 'Get performance metrics for agents (NO TIMEOUT VERSION)',
|
|
1146
|
+
inputSchema: {
|
|
1147
|
+
type: 'object',
|
|
1148
|
+
properties: {
|
|
1149
|
+
agentId: { type: 'string', description: 'Specific agent ID (optional)' },
|
|
1150
|
+
metric: { type: 'string', enum: ['all', 'cpu', 'memory', 'tasks', 'performance'], default: 'all' }
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
},
|
|
1154
|
+
{
|
|
1155
|
+
name: 'task_orchestrate',
|
|
1156
|
+
description: 'Orchestrate a task across the swarm (NO TIMEOUT VERSION)',
|
|
1157
|
+
inputSchema: {
|
|
1158
|
+
type: 'object',
|
|
1159
|
+
properties: {
|
|
1160
|
+
task: { type: 'string', description: 'Task description or instructions' },
|
|
1161
|
+
strategy: { type: 'string', enum: ['parallel', 'sequential', 'adaptive'], default: 'adaptive', description: 'Execution strategy' },
|
|
1162
|
+
priority: { type: 'string', enum: ['low', 'medium', 'high', 'critical'], default: 'medium', description: 'Task priority' },
|
|
1163
|
+
maxAgents: { type: 'number', minimum: 1, maximum: 10, description: 'Maximum agents to use' }
|
|
1164
|
+
},
|
|
1165
|
+
required: ['task']
|
|
1166
|
+
}
|
|
1167
|
+
},
|
|
1168
|
+
{
|
|
1169
|
+
name: 'task_status',
|
|
1170
|
+
description: 'Check progress of running tasks (NO TIMEOUT VERSION)',
|
|
1171
|
+
inputSchema: {
|
|
1172
|
+
type: 'object',
|
|
1173
|
+
properties: {
|
|
1174
|
+
taskId: { type: 'string', description: 'Specific task ID (optional)' },
|
|
1175
|
+
detailed: { type: 'boolean', default: false, description: 'Include detailed progress' }
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
},
|
|
1179
|
+
{
|
|
1180
|
+
name: 'task_results',
|
|
1181
|
+
description: 'Retrieve results from completed tasks (NO TIMEOUT VERSION)',
|
|
1182
|
+
inputSchema: {
|
|
1183
|
+
type: 'object',
|
|
1184
|
+
properties: {
|
|
1185
|
+
taskId: { type: 'string', description: 'Task ID to retrieve results for' },
|
|
1186
|
+
format: { type: 'string', enum: ['summary', 'detailed', 'raw'], default: 'summary', description: 'Result format' }
|
|
1187
|
+
},
|
|
1188
|
+
required: ['taskId']
|
|
1189
|
+
}
|
|
1190
|
+
},
|
|
1191
|
+
{
|
|
1192
|
+
name: 'benchmark_run',
|
|
1193
|
+
description: 'Execute performance benchmarks (NO TIMEOUT VERSION)',
|
|
1194
|
+
inputSchema: {
|
|
1195
|
+
type: 'object',
|
|
1196
|
+
properties: {
|
|
1197
|
+
type: { type: 'string', enum: ['all', 'wasm', 'swarm', 'agent', 'task'], default: 'all', description: 'Benchmark type' },
|
|
1198
|
+
iterations: { type: 'number', minimum: 1, maximum: 100, default: 10, description: 'Number of iterations' }
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
},
|
|
1202
|
+
{
|
|
1203
|
+
name: 'features_detect',
|
|
1204
|
+
description: 'Detect runtime features and capabilities (NO TIMEOUT VERSION)',
|
|
1205
|
+
inputSchema: {
|
|
1206
|
+
type: 'object',
|
|
1207
|
+
properties: {
|
|
1208
|
+
category: { type: 'string', enum: ['all', 'wasm', 'simd', 'memory', 'platform'], default: 'all', description: 'Feature category' }
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
},
|
|
1212
|
+
{
|
|
1213
|
+
name: 'memory_usage',
|
|
1214
|
+
description: 'Get current memory usage statistics (NO TIMEOUT VERSION)',
|
|
1215
|
+
inputSchema: {
|
|
1216
|
+
type: 'object',
|
|
1217
|
+
properties: {
|
|
1218
|
+
detail: { type: 'string', enum: ['summary', 'detailed', 'by-agent'], default: 'summary', description: 'Detail level' }
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
},
|
|
1222
|
+
{
|
|
1223
|
+
name: 'neural_status',
|
|
1224
|
+
description: 'Get neural agent status and performance metrics (NO TIMEOUT VERSION)',
|
|
1225
|
+
inputSchema: {
|
|
1226
|
+
type: 'object',
|
|
1227
|
+
properties: {
|
|
1228
|
+
agentId: { type: 'string', description: 'Specific agent ID (optional)' }
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
},
|
|
1232
|
+
{
|
|
1233
|
+
name: 'neural_train',
|
|
1234
|
+
description: 'Train neural agents with sample tasks (NO TIMEOUT VERSION)',
|
|
1235
|
+
inputSchema: {
|
|
1236
|
+
type: 'object',
|
|
1237
|
+
properties: {
|
|
1238
|
+
agentId: { type: 'string', description: 'Specific agent ID to train (optional)' },
|
|
1239
|
+
iterations: { type: 'number', minimum: 1, maximum: 100, default: 10, description: 'Number of training iterations' }
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
},
|
|
1243
|
+
{
|
|
1244
|
+
name: 'neural_patterns',
|
|
1245
|
+
description: 'Get cognitive pattern information (NO TIMEOUT VERSION)',
|
|
1246
|
+
inputSchema: {
|
|
1247
|
+
type: 'object',
|
|
1248
|
+
properties: {
|
|
1249
|
+
pattern: { type: 'string', enum: ['all', 'convergent', 'divergent', 'lateral', 'systems', 'critical', 'abstract'], default: 'all', description: 'Cognitive pattern type' }
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
},
|
|
1253
|
+
// Add DAA tools
|
|
1254
|
+
...daaMcpTools.getToolDefinitions().map(tool => ({
|
|
1255
|
+
...tool,
|
|
1256
|
+
description: `${tool.description} (NO TIMEOUT VERSION)`
|
|
1257
|
+
}))
|
|
1258
|
+
]
|
|
1259
|
+
};
|
|
1260
|
+
break;
|
|
1261
|
+
|
|
1262
|
+
case 'tools/call':
|
|
1263
|
+
const toolName = request.params.name;
|
|
1264
|
+
const toolArgs = request.params.arguments || {};
|
|
1265
|
+
|
|
1266
|
+
logger.info('Tool call requested (NO TIMEOUT VERSION)', {
|
|
1267
|
+
tool: toolName,
|
|
1268
|
+
hasArgs: Object.keys(toolArgs).length > 0,
|
|
1269
|
+
requestId: request.id
|
|
1270
|
+
});
|
|
1271
|
+
|
|
1272
|
+
let result = null;
|
|
1273
|
+
let toolFound = false;
|
|
1274
|
+
const toolOpId = logger.startOperation(`tool-${toolName}`, {
|
|
1275
|
+
tool: toolName,
|
|
1276
|
+
requestId: request.id
|
|
1277
|
+
});
|
|
1278
|
+
|
|
1279
|
+
// Try regular MCP tools first (use mcpToolsEnhanced.tools)
|
|
1280
|
+
if (mcpToolsEnhanced.tools && typeof mcpToolsEnhanced.tools[toolName] === 'function') {
|
|
1281
|
+
try {
|
|
1282
|
+
logger.debug('Executing MCP tool (NO TIMEOUT VERSION)', { tool: toolName, args: toolArgs });
|
|
1283
|
+
result = await mcpToolsEnhanced.tools[toolName](toolArgs);
|
|
1284
|
+
toolFound = true;
|
|
1285
|
+
logger.endOperation(toolOpId, true, { resultType: typeof result });
|
|
1286
|
+
} catch (error) {
|
|
1287
|
+
logger.endOperation(toolOpId, false, { error });
|
|
1288
|
+
logger.error('MCP tool execution failed (NO TIMEOUT VERSION)', {
|
|
1289
|
+
tool: toolName,
|
|
1290
|
+
error,
|
|
1291
|
+
args: toolArgs
|
|
1292
|
+
});
|
|
1293
|
+
response.error = {
|
|
1294
|
+
code: -32603,
|
|
1295
|
+
message: `MCP tool error: ${error.message}`,
|
|
1296
|
+
data: { tool: toolName, error: error.message }
|
|
1297
|
+
};
|
|
1298
|
+
break;
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
// Try DAA tools if not found in regular tools
|
|
1302
|
+
else if (typeof daaMcpTools[toolName] === 'function') {
|
|
1303
|
+
try {
|
|
1304
|
+
logger.debug('Executing DAA tool (NO TIMEOUT VERSION)', { tool: toolName, args: toolArgs });
|
|
1305
|
+
result = await daaMcpTools[toolName](toolArgs);
|
|
1306
|
+
toolFound = true;
|
|
1307
|
+
logger.endOperation(toolOpId, true, { resultType: typeof result });
|
|
1308
|
+
} catch (error) {
|
|
1309
|
+
logger.endOperation(toolOpId, false, { error });
|
|
1310
|
+
logger.error('DAA tool execution failed (NO TIMEOUT VERSION)', {
|
|
1311
|
+
tool: toolName,
|
|
1312
|
+
error,
|
|
1313
|
+
args: toolArgs
|
|
1314
|
+
});
|
|
1315
|
+
response.error = {
|
|
1316
|
+
code: -32603,
|
|
1317
|
+
message: `DAA tool error: ${error.message}`,
|
|
1318
|
+
data: { tool: toolName, error: error.message }
|
|
1319
|
+
};
|
|
1320
|
+
break;
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
if (toolFound) {
|
|
1325
|
+
// Format response with content array as required by Claude Code
|
|
1326
|
+
response.result = {
|
|
1327
|
+
content: [{
|
|
1328
|
+
type: 'text',
|
|
1329
|
+
text: typeof result === 'string' ? result : JSON.stringify(result, null, 2)
|
|
1330
|
+
}]
|
|
1331
|
+
};
|
|
1332
|
+
} else {
|
|
1333
|
+
response.error = {
|
|
1334
|
+
code: -32601,
|
|
1335
|
+
message: 'Method not found',
|
|
1336
|
+
data: `Unknown tool: ${toolName}`
|
|
1337
|
+
};
|
|
1338
|
+
}
|
|
1339
|
+
break;
|
|
1340
|
+
|
|
1341
|
+
case 'resources/list':
|
|
1342
|
+
response.result = {
|
|
1343
|
+
resources: [
|
|
1344
|
+
{
|
|
1345
|
+
uri: 'swarm://docs/getting-started',
|
|
1346
|
+
name: 'Getting Started Guide (NO TIMEOUT VERSION)',
|
|
1347
|
+
description: 'Introduction to @sparkleideas/ruv-swarm and basic usage without timeouts',
|
|
1348
|
+
mimeType: 'text/markdown'
|
|
1349
|
+
},
|
|
1350
|
+
{
|
|
1351
|
+
uri: 'swarm://docs/stability',
|
|
1352
|
+
name: 'Stability Features (NO TIMEOUT VERSION)',
|
|
1353
|
+
description: 'Auto-restart and crash protection features without timeouts',
|
|
1354
|
+
mimeType: 'text/markdown'
|
|
1355
|
+
}
|
|
1356
|
+
]
|
|
1357
|
+
};
|
|
1358
|
+
break;
|
|
1359
|
+
|
|
1360
|
+
case 'resources/read':
|
|
1361
|
+
const resourceUri = request.params.uri;
|
|
1362
|
+
response.result = await getResourceContent(resourceUri);
|
|
1363
|
+
break;
|
|
1364
|
+
|
|
1365
|
+
default:
|
|
1366
|
+
response.error = {
|
|
1367
|
+
code: -32601,
|
|
1368
|
+
message: 'Method not found',
|
|
1369
|
+
data: `Unknown method: ${request.method}`
|
|
1370
|
+
};
|
|
1371
|
+
}
|
|
1372
|
+
} catch (error) {
|
|
1373
|
+
response.error = {
|
|
1374
|
+
code: -32603,
|
|
1375
|
+
message: 'Internal error',
|
|
1376
|
+
data: error.message
|
|
1377
|
+
};
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
return response;
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
async function handleHook(args) {
|
|
1384
|
+
// Hook handler for Claude Code integration
|
|
1385
|
+
const { main: hooksCLIMain } = await import('../src/hooks/cli.js');
|
|
1386
|
+
|
|
1387
|
+
// Pass through to hooks CLI with 'hook' already consumed
|
|
1388
|
+
process.argv = ['node', '@sparkleideas/ruv-swarm', 'hook', ...args];
|
|
1389
|
+
|
|
1390
|
+
return hooksCLIMain();
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
async function handleNeural(args) {
|
|
1394
|
+
const { neuralCLI } = await import('../src/neural.js');
|
|
1395
|
+
const subcommand = args[0] || 'help';
|
|
1396
|
+
|
|
1397
|
+
try {
|
|
1398
|
+
switch (subcommand) {
|
|
1399
|
+
case 'status':
|
|
1400
|
+
return await neuralCLI.status(args.slice(1));
|
|
1401
|
+
case 'train':
|
|
1402
|
+
return await neuralCLI.train(args.slice(1));
|
|
1403
|
+
case 'patterns':
|
|
1404
|
+
return await neuralCLI.patterns(args.slice(1));
|
|
1405
|
+
case 'export':
|
|
1406
|
+
return await neuralCLI.export(args.slice(1));
|
|
1407
|
+
case 'help':
|
|
1408
|
+
default:
|
|
1409
|
+
console.log(`Neural Network Commands (NO TIMEOUT VERSION):
|
|
1410
|
+
neural status Show neural network status
|
|
1411
|
+
neural train [options] Train neural models
|
|
1412
|
+
neural patterns [model] View learned patterns
|
|
1413
|
+
neural export [options] Export neural weights
|
|
1414
|
+
|
|
1415
|
+
Examples:
|
|
1416
|
+
@sparkleideas/ruv-swarm neural status
|
|
1417
|
+
@sparkleideas/ruv-swarm neural train --model attention --iterations 100
|
|
1418
|
+
@sparkleideas/ruv-swarm neural patterns --model attention
|
|
1419
|
+
@sparkleideas/ruv-swarm neural export --model all --output ./weights.json
|
|
1420
|
+
|
|
1421
|
+
š„ SPECIAL FEATURE: Infinite training runtime (no timeouts)`);
|
|
1422
|
+
break;
|
|
1423
|
+
}
|
|
1424
|
+
} catch (error) {
|
|
1425
|
+
console.error('ā Neural command error:', error.message);
|
|
1426
|
+
process.exit(1);
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
async function handleBenchmark(args) {
|
|
1431
|
+
const { benchmarkCLI } = await import('../src/benchmark.js');
|
|
1432
|
+
const subcommand = args[0] || 'help';
|
|
1433
|
+
|
|
1434
|
+
try {
|
|
1435
|
+
switch (subcommand) {
|
|
1436
|
+
case 'run':
|
|
1437
|
+
return await benchmarkCLI.run(args.slice(1));
|
|
1438
|
+
case 'compare':
|
|
1439
|
+
return await benchmarkCLI.compare(args.slice(1));
|
|
1440
|
+
case 'help':
|
|
1441
|
+
default:
|
|
1442
|
+
console.log(`Benchmark Commands (NO TIMEOUT VERSION):
|
|
1443
|
+
benchmark run [options] Run performance benchmarks
|
|
1444
|
+
benchmark compare [files] Compare benchmark results
|
|
1445
|
+
|
|
1446
|
+
Examples:
|
|
1447
|
+
@sparkleideas/ruv-swarm benchmark run --iterations 10
|
|
1448
|
+
@sparkleideas/ruv-swarm benchmark run --test swarm-coordination
|
|
1449
|
+
@sparkleideas/ruv-swarm benchmark compare results-1.json results-2.json
|
|
1450
|
+
|
|
1451
|
+
š„ SPECIAL FEATURE: Infinite benchmark runtime (no timeouts)`);
|
|
1452
|
+
break;
|
|
1453
|
+
}
|
|
1454
|
+
} catch (error) {
|
|
1455
|
+
console.error('ā Benchmark command error:', error.message);
|
|
1456
|
+
process.exit(1);
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
async function handlePerformance(args) {
|
|
1461
|
+
const { performanceCLI } = await import('../src/performance.js');
|
|
1462
|
+
const subcommand = args[0] || 'help';
|
|
1463
|
+
|
|
1464
|
+
try {
|
|
1465
|
+
switch (subcommand) {
|
|
1466
|
+
case 'analyze':
|
|
1467
|
+
return await performanceCLI.analyze(args.slice(1));
|
|
1468
|
+
case 'optimize':
|
|
1469
|
+
return await performanceCLI.optimize(args.slice(1));
|
|
1470
|
+
case 'suggest':
|
|
1471
|
+
return await performanceCLI.suggest(args.slice(1));
|
|
1472
|
+
case 'help':
|
|
1473
|
+
default:
|
|
1474
|
+
console.log(`Performance Commands (NO TIMEOUT VERSION):
|
|
1475
|
+
performance analyze [options] Analyze performance bottlenecks
|
|
1476
|
+
performance optimize [target] Optimize swarm configuration
|
|
1477
|
+
performance suggest Get optimization suggestions
|
|
1478
|
+
|
|
1479
|
+
Examples:
|
|
1480
|
+
@sparkleideas/ruv-swarm performance analyze --task-id recent
|
|
1481
|
+
@sparkleideas/ruv-swarm performance optimize --target speed
|
|
1482
|
+
@sparkleideas/ruv-swarm performance suggest
|
|
1483
|
+
|
|
1484
|
+
š„ SPECIAL FEATURE: Infinite analysis runtime (no timeouts)`);
|
|
1485
|
+
break;
|
|
1486
|
+
}
|
|
1487
|
+
} catch (error) {
|
|
1488
|
+
console.error('ā Performance command error:', error.message);
|
|
1489
|
+
process.exit(1);
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
async function handleDiagnose(args) {
|
|
1494
|
+
const { diagnosticsCLI } = await import('../src/cli-diagnostics.js');
|
|
1495
|
+
return diagnosticsCLI(args);
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
async function showHelp() {
|
|
1499
|
+
const version = await getVersion();
|
|
1500
|
+
console.log(`
|
|
1501
|
+
š @sparkleideas/ruv-swarm v${version} - NO TIMEOUT VERSION
|
|
1502
|
+
š„ Production-ready WASM-powered neural swarm orchestration with INFINITE RUNTIME
|
|
1503
|
+
|
|
1504
|
+
Usage: @sparkleideas/ruv-swarm <command> [options]
|
|
1505
|
+
|
|
1506
|
+
Commands:
|
|
1507
|
+
init [topology] [maxAgents] Initialize swarm (--claude for integration)
|
|
1508
|
+
Options for --claude:
|
|
1509
|
+
--force Overwrite existing CLAUDE.md (creates backup)
|
|
1510
|
+
--merge Merge with existing CLAUDE.md content
|
|
1511
|
+
--no-backup Disable automatic backup creation
|
|
1512
|
+
--no-interactive Skip interactive prompts (fail on conflicts)
|
|
1513
|
+
spawn <type> [name] Spawn an agent (researcher, coder, analyst, etc.)
|
|
1514
|
+
orchestrate <task> Orchestrate a task across agents
|
|
1515
|
+
status [--verbose] Show swarm status
|
|
1516
|
+
monitor [duration] Monitor swarm activity
|
|
1517
|
+
mcp <subcommand> MCP server management
|
|
1518
|
+
Options for mcp start:
|
|
1519
|
+
--stability Enable auto-restart on crashes
|
|
1520
|
+
hook <type> [options] Claude Code hooks integration
|
|
1521
|
+
claude-invoke <prompt> Invoke Claude with swarm integration
|
|
1522
|
+
neural <subcommand> Neural network training and analysis
|
|
1523
|
+
benchmark <subcommand> Performance benchmarking tools
|
|
1524
|
+
performance <subcommand> Performance analysis and optimization
|
|
1525
|
+
diagnose <subcommand> Run diagnostics and analyze logs
|
|
1526
|
+
version Show version information
|
|
1527
|
+
help Show this help message
|
|
1528
|
+
|
|
1529
|
+
Examples:
|
|
1530
|
+
@sparkleideas/ruv-swarm init mesh 5 --claude # Create CLAUDE.md (fails if exists)
|
|
1531
|
+
@sparkleideas/ruv-swarm init mesh 5 --claude --force # Overwrite CLAUDE.md (creates backup)
|
|
1532
|
+
@sparkleideas/ruv-swarm spawn researcher "AI Research Specialist"
|
|
1533
|
+
@sparkleideas/ruv-swarm orchestrate "Build a REST API with authentication"
|
|
1534
|
+
@sparkleideas/ruv-swarm mcp start --stability # Start with crash protection
|
|
1535
|
+
@sparkleideas/ruv-swarm hook pre-edit --file app.js --ensure-coordination
|
|
1536
|
+
@sparkleideas/ruv-swarm claude-invoke "Create a development swarm for my project"
|
|
1537
|
+
|
|
1538
|
+
š Security Features:
|
|
1539
|
+
⢠Input validation and sanitization
|
|
1540
|
+
⢠Explicit permission control for Claude invocation
|
|
1541
|
+
⢠Command injection prevention
|
|
1542
|
+
⢠WASM integrity verification
|
|
1543
|
+
|
|
1544
|
+
š”ļø Stability Features:
|
|
1545
|
+
⢠Auto-restart on crashes (--stability flag)
|
|
1546
|
+
⢠Circuit breaker pattern
|
|
1547
|
+
⢠Graceful shutdown handling
|
|
1548
|
+
⢠Process supervision
|
|
1549
|
+
|
|
1550
|
+
š„ NO TIMEOUT FEATURES:
|
|
1551
|
+
⢠INFINITE RUNTIME: No timeout mechanisms whatsoever
|
|
1552
|
+
⢠NO CONNECTION MONITORING: No periodic connection checks
|
|
1553
|
+
⢠NO DISCONNECTIONS: Bulletproof connection stability
|
|
1554
|
+
⢠NO TIMEOUTS: Runs forever without interruption
|
|
1555
|
+
⢠BULLETPROOF OPERATION: Maximum reliability
|
|
1556
|
+
|
|
1557
|
+
Production Features:
|
|
1558
|
+
š Automatic documentation generation
|
|
1559
|
+
š Cross-platform remote execution support
|
|
1560
|
+
š¤ Seamless Claude Code MCP integration
|
|
1561
|
+
š§ Advanced hooks for automation
|
|
1562
|
+
š§ Neural pattern learning
|
|
1563
|
+
š¾ Cross-session memory persistence
|
|
1564
|
+
š”ļø Security and stability hardening
|
|
1565
|
+
š„ INFINITE RUNTIME without timeout mechanisms
|
|
1566
|
+
|
|
1567
|
+
For detailed documentation, check .claude/commands/ after running init --claude
|
|
1568
|
+
`);
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
async function main() {
|
|
1572
|
+
const args = process.argv.slice(2);
|
|
1573
|
+
|
|
1574
|
+
// Handle --version flag
|
|
1575
|
+
if (args.includes('--version') || args.includes('-v')) {
|
|
1576
|
+
const version = await getVersion();
|
|
1577
|
+
console.log(version);
|
|
1578
|
+
return;
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
const command = args[0] || 'help';
|
|
1582
|
+
|
|
1583
|
+
try {
|
|
1584
|
+
switch (command) {
|
|
1585
|
+
case 'init':
|
|
1586
|
+
await handleInit(args.slice(1));
|
|
1587
|
+
break;
|
|
1588
|
+
case 'spawn':
|
|
1589
|
+
await handleSpawn(args.slice(1));
|
|
1590
|
+
break;
|
|
1591
|
+
case 'orchestrate':
|
|
1592
|
+
await handleOrchestrate(args.slice(1));
|
|
1593
|
+
break;
|
|
1594
|
+
case 'mcp':
|
|
1595
|
+
await handleMcp(args.slice(1));
|
|
1596
|
+
break;
|
|
1597
|
+
case 'status':
|
|
1598
|
+
await handleStatus(args.slice(1));
|
|
1599
|
+
break;
|
|
1600
|
+
case 'monitor':
|
|
1601
|
+
await handleMonitor(args.slice(1));
|
|
1602
|
+
break;
|
|
1603
|
+
case 'hook':
|
|
1604
|
+
await handleHook(args.slice(1));
|
|
1605
|
+
break;
|
|
1606
|
+
case 'claude-invoke':
|
|
1607
|
+
case 'claude':
|
|
1608
|
+
await handleClaudeInvoke(args.slice(1));
|
|
1609
|
+
break;
|
|
1610
|
+
case 'neural':
|
|
1611
|
+
await handleNeural(args.slice(1));
|
|
1612
|
+
break;
|
|
1613
|
+
case 'benchmark':
|
|
1614
|
+
await handleBenchmark(args.slice(1));
|
|
1615
|
+
break;
|
|
1616
|
+
case 'performance':
|
|
1617
|
+
await handlePerformance(args.slice(1));
|
|
1618
|
+
break;
|
|
1619
|
+
case 'diagnose':
|
|
1620
|
+
await handleDiagnose(args.slice(1));
|
|
1621
|
+
break;
|
|
1622
|
+
case 'version':
|
|
1623
|
+
const version = await getVersion();
|
|
1624
|
+
console.log('@sparkleideas/ruv-swarm v' + version + ' - NO TIMEOUT VERSION');
|
|
1625
|
+
console.log('Production-ready WASM-powered neural swarm orchestration');
|
|
1626
|
+
console.log('Security & Stability Enhanced Edition');
|
|
1627
|
+
console.log('\nš Security Features:');
|
|
1628
|
+
console.log(' ⢠Input validation and sanitization');
|
|
1629
|
+
console.log(' ⢠Explicit permission control for Claude invocation');
|
|
1630
|
+
console.log(' ⢠Command injection prevention');
|
|
1631
|
+
console.log(' ⢠WASM integrity verification');
|
|
1632
|
+
console.log('\nš”ļø Stability Features:');
|
|
1633
|
+
console.log(' ⢠Auto-restart on crashes (use --stability flag)');
|
|
1634
|
+
console.log(' ⢠Circuit breaker pattern');
|
|
1635
|
+
console.log(' ⢠Graceful shutdown handling');
|
|
1636
|
+
console.log(' ⢠Process supervision');
|
|
1637
|
+
console.log('\nš„ NO TIMEOUT FEATURES:');
|
|
1638
|
+
console.log(' ⢠INFINITE RUNTIME: No timeout mechanisms whatsoever');
|
|
1639
|
+
console.log(' ⢠NO CONNECTION MONITORING: No periodic connection checks');
|
|
1640
|
+
console.log(' ⢠NO DISCONNECTIONS: Bulletproof connection stability');
|
|
1641
|
+
console.log(' ⢠NO TIMEOUTS: Runs forever without interruption');
|
|
1642
|
+
console.log(' ⢠BULLETPROOF OPERATION: Maximum reliability');
|
|
1643
|
+
console.log('\nā
Security Status: All vulnerabilities from Issue #107 resolved');
|
|
1644
|
+
console.log('š Production Status: Ready for deployment');
|
|
1645
|
+
console.log('š„ TIMEOUT STATUS: ALL TIMEOUT MECHANISMS COMPLETELY REMOVED');
|
|
1646
|
+
break;
|
|
1647
|
+
case 'help':
|
|
1648
|
+
default:
|
|
1649
|
+
await showHelp();
|
|
1650
|
+
break;
|
|
1651
|
+
}
|
|
1652
|
+
} catch (error) {
|
|
1653
|
+
console.error('ā Error:', error.message);
|
|
1654
|
+
if (process.argv.includes('--debug')) {
|
|
1655
|
+
console.error(error.stack);
|
|
1656
|
+
}
|
|
1657
|
+
process.exit(1);
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
// Enhanced error handling with stability features - NO TIMEOUT MECHANISMS
|
|
1662
|
+
process.on('uncaughtException', (error) => {
|
|
1663
|
+
console.error('ā Uncaught Exception:', error.message);
|
|
1664
|
+
if (process.argv.includes('--debug')) {
|
|
1665
|
+
console.error(error.stack);
|
|
1666
|
+
}
|
|
1667
|
+
if (isStabilityMode) {
|
|
1668
|
+
stabilityLog(`Uncaught exception: ${error.message}`);
|
|
1669
|
+
stabilityLog('Stability mode will handle restart...');
|
|
1670
|
+
}
|
|
1671
|
+
process.exit(1);
|
|
1672
|
+
});
|
|
1673
|
+
|
|
1674
|
+
process.on('unhandledRejection', (reason, promise) => {
|
|
1675
|
+
console.error('ā Unhandled Rejection:', reason);
|
|
1676
|
+
if (process.argv.includes('--debug')) {
|
|
1677
|
+
console.error('Promise:', promise);
|
|
1678
|
+
}
|
|
1679
|
+
if (isStabilityMode) {
|
|
1680
|
+
stabilityLog(`Unhandled rejection: ${reason}`);
|
|
1681
|
+
stabilityLog('Stability mode will handle restart...');
|
|
1682
|
+
}
|
|
1683
|
+
process.exit(1);
|
|
1684
|
+
});
|
|
1685
|
+
|
|
1686
|
+
// In ES modules, this file is always the main module when run directly
|
|
1687
|
+
main();
|
|
1688
|
+
|
|
1689
|
+
export { main, initializeSystem };
|