@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,364 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Diagnostic CLI for @sparkleideas/ruv-swarm
|
|
4
|
+
* Usage: npx @sparkleideas/ruv-swarm diagnose [options]
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { diagnostics } from './diagnostics.js';
|
|
8
|
+
import { loggingConfig } from './logging-config.js';
|
|
9
|
+
import fs from 'fs';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
|
|
12
|
+
async function main() {
|
|
13
|
+
const args = process.argv.slice(2);
|
|
14
|
+
const command = args[0] || 'help';
|
|
15
|
+
|
|
16
|
+
// Initialize diagnostics logger
|
|
17
|
+
const logger = loggingConfig.getLogger('cli-diagnostics', { level: 'INFO' });
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
switch (command) {
|
|
21
|
+
case 'test':
|
|
22
|
+
await runDiagnosticTests(logger);
|
|
23
|
+
break;
|
|
24
|
+
|
|
25
|
+
case 'report':
|
|
26
|
+
await generateReport(args.slice(1), logger);
|
|
27
|
+
break;
|
|
28
|
+
|
|
29
|
+
case 'monitor':
|
|
30
|
+
await startMonitoring(args.slice(1), logger);
|
|
31
|
+
break;
|
|
32
|
+
|
|
33
|
+
case 'logs':
|
|
34
|
+
await analyzeLogs(args.slice(1), logger);
|
|
35
|
+
break;
|
|
36
|
+
|
|
37
|
+
case 'config':
|
|
38
|
+
showLoggingConfig(logger);
|
|
39
|
+
break;
|
|
40
|
+
|
|
41
|
+
case 'help':
|
|
42
|
+
default:
|
|
43
|
+
showHelp();
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
} catch (error) {
|
|
47
|
+
logger.error('Diagnostic command failed', { error, command });
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function runDiagnosticTests(logger) {
|
|
53
|
+
logger.info('Running diagnostic tests...');
|
|
54
|
+
|
|
55
|
+
const results = await diagnostics.runDiagnosticTests();
|
|
56
|
+
|
|
57
|
+
console.log('\nš Diagnostic Test Results:');
|
|
58
|
+
console.log('āāāāāāāāāāāāāāāāāāāāāāāāāāā\n');
|
|
59
|
+
|
|
60
|
+
results.tests.forEach(test => {
|
|
61
|
+
const icon = test.success ? 'ā
' : 'ā';
|
|
62
|
+
console.log(`${icon} ${test.name}`);
|
|
63
|
+
if (!test.success) {
|
|
64
|
+
console.log(` Error: ${test.error}`);
|
|
65
|
+
} else if (test.allocated) {
|
|
66
|
+
console.log(` Allocated: ${test.allocated}`);
|
|
67
|
+
} else if (test.path) {
|
|
68
|
+
console.log(` Path: ${test.path}`);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
console.log('\nš Summary:');
|
|
73
|
+
console.log(` Total Tests: ${results.summary.total}`);
|
|
74
|
+
console.log(` ā
Passed: ${results.summary.passed}`);
|
|
75
|
+
console.log(` ā Failed: ${results.summary.failed}`);
|
|
76
|
+
|
|
77
|
+
if (results.summary.failed > 0) {
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async function generateReport(args, logger) {
|
|
83
|
+
const outputPath = args.find(arg => arg.startsWith('--output='))?.split('=')[1];
|
|
84
|
+
const format = args.find(arg => arg.startsWith('--format='))?.split('=')[1] || 'json';
|
|
85
|
+
|
|
86
|
+
logger.info('Generating diagnostic report...');
|
|
87
|
+
|
|
88
|
+
// Enable diagnostics temporarily
|
|
89
|
+
diagnostics.enableAll();
|
|
90
|
+
|
|
91
|
+
// Wait a bit to collect some samples
|
|
92
|
+
await new Promise(resolve => setTimeout(resolve, 5000));
|
|
93
|
+
|
|
94
|
+
const report = await diagnostics.generateFullReport();
|
|
95
|
+
|
|
96
|
+
if (outputPath) {
|
|
97
|
+
const reportPath = path.resolve(outputPath);
|
|
98
|
+
|
|
99
|
+
if (format === 'json') {
|
|
100
|
+
fs.writeFileSync(reportPath, JSON.stringify(report, null, 2));
|
|
101
|
+
} else if (format === 'markdown') {
|
|
102
|
+
fs.writeFileSync(reportPath, formatReportAsMarkdown(report));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
console.log(`\nš Report saved to: ${reportPath}`);
|
|
106
|
+
} else {
|
|
107
|
+
console.log('\nš Diagnostic Report:');
|
|
108
|
+
console.log('āāāāāāāāāāāāāāāāāāāāāāā');
|
|
109
|
+
console.log(formatReportForConsole(report));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Disable diagnostics
|
|
113
|
+
diagnostics.disableAll();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async function startMonitoring(args, logger) {
|
|
117
|
+
const duration = parseInt(args.find(arg => arg.startsWith('--duration='))?.split('=')[1] || '60', 10);
|
|
118
|
+
const interval = parseInt(args.find(arg => arg.startsWith('--interval='))?.split('=')[1] || '1000', 10);
|
|
119
|
+
|
|
120
|
+
logger.info('Starting system monitoring...', { duration, interval });
|
|
121
|
+
|
|
122
|
+
console.log('\nš System Monitoring');
|
|
123
|
+
console.log('āāāāāāāāāāāāāāāāāāāāāāā');
|
|
124
|
+
console.log(`Duration: ${duration} seconds`);
|
|
125
|
+
console.log(`Interval: ${interval}ms`);
|
|
126
|
+
console.log('\nPress Ctrl+C to stop\n');
|
|
127
|
+
|
|
128
|
+
diagnostics.enableAll();
|
|
129
|
+
diagnostics.system.startMonitoring(interval);
|
|
130
|
+
|
|
131
|
+
// Update display periodically
|
|
132
|
+
const displayInterval = setInterval(() => {
|
|
133
|
+
const health = diagnostics.system.getSystemHealth();
|
|
134
|
+
const connection = diagnostics.connection.getConnectionSummary();
|
|
135
|
+
|
|
136
|
+
console.clear();
|
|
137
|
+
console.log('š System Monitoring');
|
|
138
|
+
console.log('āāāāāāāāāāāāāāāāāāāāāāā');
|
|
139
|
+
console.log(`\nš System Health: ${health.status.toUpperCase()}`);
|
|
140
|
+
|
|
141
|
+
if (health.issues.length > 0) {
|
|
142
|
+
console.log('\nā ļø Issues:');
|
|
143
|
+
health.issues.forEach(issue => console.log(` - ${issue}`));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
console.log('\nš¾ Metrics:');
|
|
147
|
+
Object.entries(health.metrics).forEach(([key, value]) => {
|
|
148
|
+
console.log(` ${key}: ${value}`);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
console.log('\nš Connections:');
|
|
152
|
+
console.log(` Active: ${connection.activeConnections}`);
|
|
153
|
+
console.log(` Total Events: ${connection.totalEvents}`);
|
|
154
|
+
console.log(` Failure Rate: ${(connection.failureRate * 100).toFixed(1)}%`);
|
|
155
|
+
|
|
156
|
+
console.log('\n\nPress Ctrl+C to stop');
|
|
157
|
+
}, 2000);
|
|
158
|
+
|
|
159
|
+
// Set up timeout
|
|
160
|
+
setTimeout(() => {
|
|
161
|
+
clearInterval(displayInterval);
|
|
162
|
+
diagnostics.disableAll();
|
|
163
|
+
console.log('\nā
Monitoring completed');
|
|
164
|
+
process.exit(0);
|
|
165
|
+
}, duration * 1000);
|
|
166
|
+
|
|
167
|
+
// Handle Ctrl+C
|
|
168
|
+
process.on('SIGINT', () => {
|
|
169
|
+
clearInterval(displayInterval);
|
|
170
|
+
diagnostics.disableAll();
|
|
171
|
+
console.log('\n\nā
Monitoring stopped');
|
|
172
|
+
process.exit(0);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
async function analyzeLogs(args, logger) {
|
|
177
|
+
const logDir = args.find(arg => arg.startsWith('--dir='))?.split('=')[1] || './logs';
|
|
178
|
+
const pattern = args.find(arg => arg.startsWith('--pattern='))?.split('=')[1] || 'error';
|
|
179
|
+
|
|
180
|
+
logger.info('Analyzing logs...', { logDir, pattern });
|
|
181
|
+
|
|
182
|
+
if (!fs.existsSync(logDir)) {
|
|
183
|
+
console.error(`ā Log directory not found: ${logDir}`);
|
|
184
|
+
process.exit(1);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const logFiles = fs.readdirSync(logDir).filter(f => f.endsWith('.log'));
|
|
188
|
+
|
|
189
|
+
console.log(`\nš Found ${logFiles.length} log files in ${logDir}`);
|
|
190
|
+
|
|
191
|
+
const results = {
|
|
192
|
+
totalLines: 0,
|
|
193
|
+
matches: 0,
|
|
194
|
+
files: {},
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const regex = new RegExp(pattern, 'i');
|
|
198
|
+
|
|
199
|
+
logFiles.forEach(file => {
|
|
200
|
+
const content = fs.readFileSync(path.join(logDir, file), 'utf8');
|
|
201
|
+
const lines = content.split('\n');
|
|
202
|
+
const matches = lines.filter(line => regex.test(line));
|
|
203
|
+
|
|
204
|
+
results.totalLines += lines.length;
|
|
205
|
+
results.matches += matches.length;
|
|
206
|
+
|
|
207
|
+
if (matches.length > 0) {
|
|
208
|
+
results.files[file] = {
|
|
209
|
+
matches: matches.length,
|
|
210
|
+
samples: matches.slice(0, 3),
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
console.log('\nš Analysis Results:');
|
|
216
|
+
console.log(` Total Lines: ${results.totalLines}`);
|
|
217
|
+
console.log(` Matches: ${results.matches}`);
|
|
218
|
+
console.log(` Pattern: ${pattern}`);
|
|
219
|
+
|
|
220
|
+
if (results.matches > 0) {
|
|
221
|
+
console.log('\nš Files with matches:');
|
|
222
|
+
Object.entries(results.files).forEach(([file, data]) => {
|
|
223
|
+
console.log(`\n ${file} (${data.matches} matches):`);
|
|
224
|
+
data.samples.forEach(sample => {
|
|
225
|
+
console.log(` ${sample.substring(0, 100)}...`);
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function showLoggingConfig(logger) {
|
|
232
|
+
console.log('\nāļø Logging Configuration');
|
|
233
|
+
console.log('āāāāāāāāāāāāāāāāāāāāāāāāāāā\n');
|
|
234
|
+
|
|
235
|
+
const config = loggingConfig.logConfiguration();
|
|
236
|
+
|
|
237
|
+
// Configuration is already logged to stderr by logConfiguration()
|
|
238
|
+
// Just add usage instructions
|
|
239
|
+
|
|
240
|
+
console.log('\nš Environment Variables:');
|
|
241
|
+
console.log(' LOG_LEVEL - Global log level (TRACE|DEBUG|INFO|WARN|ERROR|FATAL)');
|
|
242
|
+
console.log(' MCP_LOG_LEVEL - MCP server log level');
|
|
243
|
+
console.log(' TOOLS_LOG_LEVEL - MCP tools log level');
|
|
244
|
+
console.log(' SWARM_LOG_LEVEL - Swarm core log level');
|
|
245
|
+
console.log(' AGENT_LOG_LEVEL - Agent log level');
|
|
246
|
+
console.log(' NEURAL_LOG_LEVEL - Neural network log level');
|
|
247
|
+
console.log(' LOG_TO_FILE - Enable file logging (true|false)');
|
|
248
|
+
console.log(' LOG_FORMAT - Log format (text|json)');
|
|
249
|
+
console.log(' LOG_DIR - Log directory path');
|
|
250
|
+
|
|
251
|
+
console.log('\nš” Examples:');
|
|
252
|
+
console.log(' LOG_LEVEL=DEBUG npx @sparkleideas/ruv-swarm mcp start');
|
|
253
|
+
console.log(' MCP_LOG_LEVEL=TRACE TOOLS_LOG_LEVEL=DEBUG npx @sparkleideas/ruv-swarm mcp start');
|
|
254
|
+
console.log(' LOG_TO_FILE=true LOG_DIR=./mylogs npx @sparkleideas/ruv-swarm mcp start');
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function formatReportForConsole(report) {
|
|
258
|
+
const output = [];
|
|
259
|
+
|
|
260
|
+
// Connection section
|
|
261
|
+
output.push('š Connection Diagnostics:');
|
|
262
|
+
output.push(` Active Connections: ${report.connection.connections.activeConnections}`);
|
|
263
|
+
output.push(` Failure Rate: ${(report.connection.connections.failureRate * 100).toFixed(1)}%`);
|
|
264
|
+
output.push(` Total Events: ${report.connection.connections.totalEvents}`);
|
|
265
|
+
|
|
266
|
+
if (report.connection.patterns.recommendations.length > 0) {
|
|
267
|
+
output.push('\nā ļø Recommendations:');
|
|
268
|
+
report.connection.patterns.recommendations.forEach(rec => {
|
|
269
|
+
output.push(` [${rec.severity.toUpperCase()}] ${rec.issue}`);
|
|
270
|
+
output.push(` ā ${rec.suggestion}`);
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// System section
|
|
275
|
+
output.push('\nš» System Health:');
|
|
276
|
+
output.push(` Status: ${report.system.status.toUpperCase()}`);
|
|
277
|
+
if (report.system.metrics) {
|
|
278
|
+
Object.entries(report.system.metrics).forEach(([key, value]) => {
|
|
279
|
+
output.push(` ${key}: ${value}`);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return output.join('\n');
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function formatReportAsMarkdown(report) {
|
|
287
|
+
const lines = [
|
|
288
|
+
'# @sparkleideas/ruv-swarm Diagnostic Report',
|
|
289
|
+
'',
|
|
290
|
+
`Generated: ${report.timestamp}`,
|
|
291
|
+
'',
|
|
292
|
+
'## Connection Diagnostics',
|
|
293
|
+
'',
|
|
294
|
+
`- **Active Connections**: ${report.connection.connections.activeConnections}`,
|
|
295
|
+
`- **Failure Rate**: ${(report.connection.connections.failureRate * 100).toFixed(1)}%`,
|
|
296
|
+
`- **Total Events**: ${report.connection.connections.totalEvents}`,
|
|
297
|
+
'',
|
|
298
|
+
];
|
|
299
|
+
|
|
300
|
+
if (report.connection.patterns.recommendations.length > 0) {
|
|
301
|
+
lines.push('### Recommendations');
|
|
302
|
+
lines.push('');
|
|
303
|
+
report.connection.patterns.recommendations.forEach(rec => {
|
|
304
|
+
lines.push(`- **${rec.severity.toUpperCase()}**: ${rec.issue}`);
|
|
305
|
+
lines.push(` - ${rec.suggestion}`);
|
|
306
|
+
});
|
|
307
|
+
lines.push('');
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
lines.push('## System Health');
|
|
311
|
+
lines.push('');
|
|
312
|
+
lines.push(`- **Status**: ${report.system.status.toUpperCase()}`);
|
|
313
|
+
|
|
314
|
+
if (report.system.metrics) {
|
|
315
|
+
lines.push('');
|
|
316
|
+
lines.push('### Metrics');
|
|
317
|
+
lines.push('');
|
|
318
|
+
Object.entries(report.system.metrics).forEach(([key, value]) => {
|
|
319
|
+
lines.push(`- **${key}**: ${value}`);
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
return lines.join('\n');
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function showHelp() {
|
|
327
|
+
console.log(`
|
|
328
|
+
š @sparkleideas/ruv-swarm Diagnostics
|
|
329
|
+
|
|
330
|
+
Usage: npx @sparkleideas/ruv-swarm diagnose <command> [options]
|
|
331
|
+
|
|
332
|
+
Commands:
|
|
333
|
+
test Run diagnostic tests
|
|
334
|
+
report [options] Generate diagnostic report
|
|
335
|
+
--output=<path> Save report to file
|
|
336
|
+
--format=<json|md> Output format (default: json)
|
|
337
|
+
|
|
338
|
+
monitor [options] Start system monitoring
|
|
339
|
+
--duration=<seconds> Monitoring duration (default: 60)
|
|
340
|
+
--interval=<ms> Sample interval (default: 1000)
|
|
341
|
+
|
|
342
|
+
logs [options] Analyze log files
|
|
343
|
+
--dir=<path> Log directory (default: ./logs)
|
|
344
|
+
--pattern=<regex> Search pattern (default: error)
|
|
345
|
+
|
|
346
|
+
config Show logging configuration
|
|
347
|
+
help Show this help message
|
|
348
|
+
|
|
349
|
+
Examples:
|
|
350
|
+
npx @sparkleideas/ruv-swarm diagnose test
|
|
351
|
+
npx @sparkleideas/ruv-swarm diagnose report --output=report.json
|
|
352
|
+
npx @sparkleideas/ruv-swarm diagnose monitor --duration=120
|
|
353
|
+
npx @sparkleideas/ruv-swarm diagnose logs --pattern="connection.*failed"
|
|
354
|
+
npx @sparkleideas/ruv-swarm diagnose config
|
|
355
|
+
`);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// Export for use in main CLI
|
|
359
|
+
export { main as diagnosticsCLI };
|
|
360
|
+
|
|
361
|
+
// Run if called directly
|
|
362
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
363
|
+
main().catch(console.error);
|
|
364
|
+
}
|