@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.
Files changed (87) hide show
  1. package/README.md +1565 -0
  2. package/bin/ruv-swarm-clean.js +1872 -0
  3. package/bin/ruv-swarm-memory.js +119 -0
  4. package/bin/ruv-swarm-secure-heartbeat.js +1549 -0
  5. package/bin/ruv-swarm-secure.js +1689 -0
  6. package/package.json +221 -0
  7. package/src/agent.ts +342 -0
  8. package/src/benchmark.js +267 -0
  9. package/src/claude-flow-enhanced.js +839 -0
  10. package/src/claude-integration/advanced-commands.js +561 -0
  11. package/src/claude-integration/core.js +112 -0
  12. package/src/claude-integration/docs.js +1548 -0
  13. package/src/claude-integration/env-template.js +39 -0
  14. package/src/claude-integration/index.js +209 -0
  15. package/src/claude-integration/remote.js +408 -0
  16. package/src/cli-diagnostics.js +364 -0
  17. package/src/cognitive-pattern-evolution.js +1317 -0
  18. package/src/daa-cognition.js +977 -0
  19. package/src/daa-service.d.ts +298 -0
  20. package/src/daa-service.js +1116 -0
  21. package/src/diagnostics.js +533 -0
  22. package/src/errors.js +528 -0
  23. package/src/github-coordinator/README.md +193 -0
  24. package/src/github-coordinator/claude-hooks.js +162 -0
  25. package/src/github-coordinator/gh-cli-coordinator.js +260 -0
  26. package/src/hooks/cli.js +82 -0
  27. package/src/hooks/index.js +1900 -0
  28. package/src/index-enhanced.d.ts +371 -0
  29. package/src/index-enhanced.js +734 -0
  30. package/src/index.d.ts +287 -0
  31. package/src/index.js +405 -0
  32. package/src/index.ts +457 -0
  33. package/src/logger.js +182 -0
  34. package/src/logging-config.js +179 -0
  35. package/src/mcp-daa-tools.js +735 -0
  36. package/src/mcp-tools-benchmarks.js +328 -0
  37. package/src/mcp-tools-enhanced.js +2863 -0
  38. package/src/memory-config.js +42 -0
  39. package/src/meta-learning-framework.js +1359 -0
  40. package/src/neural-agent.js +830 -0
  41. package/src/neural-coordination-protocol.js +1363 -0
  42. package/src/neural-models/README.md +118 -0
  43. package/src/neural-models/autoencoder.js +543 -0
  44. package/src/neural-models/base.js +269 -0
  45. package/src/neural-models/cnn.js +497 -0
  46. package/src/neural-models/gnn.js +447 -0
  47. package/src/neural-models/gru.js +536 -0
  48. package/src/neural-models/index.js +273 -0
  49. package/src/neural-models/lstm.js +551 -0
  50. package/src/neural-models/neural-presets-complete.js +1306 -0
  51. package/src/neural-models/presets/graph.js +392 -0
  52. package/src/neural-models/presets/index.js +279 -0
  53. package/src/neural-models/presets/nlp.js +328 -0
  54. package/src/neural-models/presets/timeseries.js +368 -0
  55. package/src/neural-models/presets/vision.js +387 -0
  56. package/src/neural-models/resnet.js +534 -0
  57. package/src/neural-models/transformer.js +515 -0
  58. package/src/neural-models/vae.js +489 -0
  59. package/src/neural-network-manager.js +1938 -0
  60. package/src/neural-network.ts +296 -0
  61. package/src/neural.js +574 -0
  62. package/src/performance-benchmarks.js +898 -0
  63. package/src/performance.js +458 -0
  64. package/src/persistence-pooled.js +695 -0
  65. package/src/persistence.js +480 -0
  66. package/src/schemas.js +864 -0
  67. package/src/security.js +218 -0
  68. package/src/singleton-container.js +183 -0
  69. package/src/sqlite-pool.js +587 -0
  70. package/src/sqlite-worker.js +141 -0
  71. package/src/types.ts +164 -0
  72. package/src/utils.ts +286 -0
  73. package/src/wasm-loader.js +601 -0
  74. package/src/wasm-loader2.js +404 -0
  75. package/src/wasm-memory-optimizer.js +783 -0
  76. package/src/wasm-types.d.ts +63 -0
  77. package/wasm/README.md +347 -0
  78. package/wasm/neuro-divergent.wasm +0 -0
  79. package/wasm/package.json +18 -0
  80. package/wasm/ruv-fann.wasm +0 -0
  81. package/wasm/ruv_swarm_simd.wasm +0 -0
  82. package/wasm/ruv_swarm_wasm.d.ts +391 -0
  83. package/wasm/ruv_swarm_wasm.js +2164 -0
  84. package/wasm/ruv_swarm_wasm_bg.wasm +0 -0
  85. package/wasm/ruv_swarm_wasm_bg.wasm.d.ts +123 -0
  86. package/wasm/wasm-bindings-loader.mjs +435 -0
  87. package/wasm/wasm-updates.md +684 -0
@@ -0,0 +1,371 @@
1
+ /**
2
+ * TypeScript definitions for enhanced @sparkleideas/ruv-swarm NPX package
3
+ * Complete WASM integration with neural networks and forecasting
4
+ */
5
+
6
+ declare module '@sparkleideas/ruv-swarm' {
7
+ // Main RuvSwarm class
8
+ export class RuvSwarm {
9
+ constructor();
10
+
11
+ static initialize(options?: RuvSwarmOptions): Promise<RuvSwarm>;
12
+ static detectSIMDSupport(): boolean;
13
+ static getVersion(): string;
14
+ static getMemoryUsage(): MemoryUsage | null;
15
+ static getRuntimeFeatures(): RuntimeFeatures;
16
+
17
+ wasmLoader: WasmModuleLoader;
18
+ persistence: SwarmPersistence | null;
19
+ activeSwarms: Map<string, Swarm>;
20
+ globalAgents: Map<string, Agent>;
21
+ metrics: GlobalMetrics;
22
+ features: SwarmFeatures;
23
+
24
+ detectFeatures(useSIMD?: boolean): Promise<void>;
25
+ createSwarm(config: SwarmConfig): Promise<Swarm>;
26
+ getSwarmStatus(swarmId: string, detailed?: boolean): Promise<SwarmStatus>;
27
+ getAllSwarms(): Promise<SwarmInfo[]>;
28
+ getGlobalMetrics(): Promise<GlobalMetrics>;
29
+ }
30
+
31
+ // Configuration options
32
+ export interface RuvSwarmOptions {
33
+ wasmPath?: string;
34
+ loadingStrategy?: 'eager' | 'on-demand' | 'progressive';
35
+ enablePersistence?: boolean;
36
+ enableNeuralNetworks?: boolean;
37
+ enableForecasting?: boolean;
38
+ useSIMD?: boolean;
39
+ debug?: boolean;
40
+ }
41
+
42
+ // Swarm configuration
43
+ export interface SwarmConfig {
44
+ name?: string;
45
+ topology?: 'mesh' | 'star' | 'hierarchical' | 'ring';
46
+ strategy?: 'balanced' | 'specialized' | 'adaptive';
47
+ maxAgents?: number;
48
+ enableCognitiveDiversity?: boolean;
49
+ enableNeuralAgents?: boolean;
50
+ }
51
+
52
+ // Swarm class
53
+ export class Swarm {
54
+ id: string;
55
+ agents: Map<string, Agent>;
56
+ tasks: Map<string, Task>;
57
+
58
+ spawn(config: AgentConfig): Promise<Agent>;
59
+ orchestrate(taskConfig: TaskConfig): Promise<Task>;
60
+ getStatus(detailed?: boolean): Promise<SwarmStatus>;
61
+ monitor(duration?: number, interval?: number): Promise<MonitorResult>;
62
+ terminate(): Promise<void>;
63
+ }
64
+
65
+ // Agent configuration
66
+ export interface AgentConfig {
67
+ type?: 'researcher' | 'coder' | 'analyst' | 'optimizer' | 'coordinator';
68
+ name?: string;
69
+ capabilities?: string[];
70
+ enableNeuralNetwork?: boolean;
71
+ }
72
+
73
+ // Agent class
74
+ export class Agent {
75
+ id: string;
76
+ name: string;
77
+ type: string;
78
+ cognitivePattern: CognitivePattern;
79
+ capabilities: string[];
80
+ neuralNetworkId: string | null;
81
+ status: 'idle' | 'busy' | 'offline';
82
+
83
+ execute(task: any): Promise<TaskResult>;
84
+ getMetrics(): Promise<AgentMetrics>;
85
+ updateStatus(status: string): Promise<void>;
86
+ }
87
+
88
+ // Task configuration
89
+ export interface TaskConfig {
90
+ description: string;
91
+ priority?: 'low' | 'medium' | 'high' | 'critical';
92
+ dependencies?: string[];
93
+ maxAgents?: number;
94
+ estimatedDuration?: number;
95
+ }
96
+
97
+ // Task class
98
+ export class Task {
99
+ id: string;
100
+ description: string;
101
+ status: 'pending' | 'in_progress' | 'completed' | 'failed';
102
+ assignedAgents: string[];
103
+ result: any;
104
+
105
+ getStatus(): Promise<TaskStatus>;
106
+ getResults(): Promise<any>;
107
+ }
108
+
109
+ // WASM Module Loader
110
+ export class WasmModuleLoader {
111
+ modules: Map<string, WasmModule>;
112
+ loadingPromises: Map<string, Promise<WasmModule>>;
113
+ loadingStrategy: 'eager' | 'on-demand' | 'progressive';
114
+ moduleManifest: ModuleManifest;
115
+
116
+ initialize(strategy?: string): Promise<boolean>;
117
+ loadModule(moduleName: string): Promise<WasmModule>;
118
+ getModuleStatus(): ModuleStatusMap;
119
+ getTotalMemoryUsage(): number;
120
+ }
121
+
122
+ // Enhanced MCP Tools
123
+ export class EnhancedMCPTools {
124
+ constructor();
125
+
126
+ initialize(): Promise<RuvSwarm>;
127
+
128
+ // Core MCP tools
129
+ swarm_init(params: SwarmInitParams): Promise<SwarmInitResult>;
130
+ agent_spawn(params: AgentSpawnParams): Promise<AgentSpawnResult>;
131
+ task_orchestrate(params: TaskOrchestrateParams): Promise<TaskOrchestrateResult>;
132
+ swarm_status(params: SwarmStatusParams): Promise<SwarmStatusResult>;
133
+ benchmark_run(params: BenchmarkParams): Promise<BenchmarkResult>;
134
+ features_detect(params: FeaturesParams): Promise<FeaturesResult>;
135
+ memory_usage(params: MemoryParams): Promise<MemoryResult>;
136
+
137
+ // Neural network tools
138
+ neural_status(params: NeuralStatusParams): Promise<NeuralStatusResult>;
139
+ neural_train(params: NeuralTrainParams): Promise<NeuralTrainResult>;
140
+ neural_patterns(params: NeuralPatternsParams): Promise<NeuralPatternsResult>;
141
+ }
142
+
143
+ // Neural Network Manager
144
+ export class NeuralNetworkManager {
145
+ constructor(wasmLoader: WasmModuleLoader);
146
+
147
+ neuralNetworks: Map<string, NeuralNetwork>;
148
+ templates: NeuralTemplates;
149
+
150
+ createAgentNeuralNetwork(agentId: string, config?: NeuralConfig): Promise<NeuralNetwork>;
151
+ fineTuneNetwork(agentId: string, trainingData: TrainingData, options?: TrainingOptions): Promise<NeuralMetrics>;
152
+ enableCollaborativeLearning(agentIds: string[], options?: CollaborativeOptions): Promise<CollaborativeSession>;
153
+ getNetworkMetrics(agentId: string): NeuralMetrics | null;
154
+ saveNetworkState(agentId: string, filePath: string): Promise<boolean>;
155
+ loadNetworkState(agentId: string, filePath: string): Promise<boolean>;
156
+ }
157
+
158
+ // Types and interfaces
159
+ export interface SwarmFeatures {
160
+ neural_networks: boolean;
161
+ forecasting: boolean;
162
+ cognitive_diversity: boolean;
163
+ simd_support: boolean;
164
+ }
165
+
166
+ export interface GlobalMetrics {
167
+ totalSwarms: number;
168
+ totalAgents: number;
169
+ totalTasks: number;
170
+ memoryUsage: number;
171
+ performance: Record<string, any>;
172
+ features: SwarmFeatures;
173
+ wasm_modules: ModuleStatusMap;
174
+ timestamp: string;
175
+ }
176
+
177
+ export interface SwarmStatus {
178
+ id: string;
179
+ agents: {
180
+ total: number;
181
+ active: number;
182
+ idle: number;
183
+ };
184
+ tasks: {
185
+ total: number;
186
+ pending: number;
187
+ in_progress: number;
188
+ completed: number;
189
+ };
190
+ wasm_metrics?: WasmMetrics;
191
+ }
192
+
193
+ export interface AgentMetrics {
194
+ tasksCompleted: number;
195
+ averageExecutionTime: number;
196
+ successRate: number;
197
+ memoryUsage: number;
198
+ }
199
+
200
+ export interface NeuralConfig {
201
+ template?: string;
202
+ layers?: number[];
203
+ activation?: string;
204
+ learningRate?: number;
205
+ optimizer?: string;
206
+ }
207
+
208
+ export interface TrainingData {
209
+ samples: Array<{
210
+ input: number[];
211
+ target: number[];
212
+ }>;
213
+ }
214
+
215
+ export interface TrainingOptions {
216
+ epochs?: number;
217
+ batchSize?: number;
218
+ learningRate?: number;
219
+ freezeLayers?: number[];
220
+ }
221
+
222
+ export interface NeuralMetrics {
223
+ accuracy: number;
224
+ loss: number;
225
+ epochs_trained: number;
226
+ total_samples: number;
227
+ training_history?: Array<{ epoch: number; loss: number }>;
228
+ network_info?: {
229
+ layers: number[];
230
+ parameters: number;
231
+ };
232
+ }
233
+
234
+ export type CognitivePattern = 'convergent' | 'divergent' | 'lateral' | 'systems' | 'critical' | 'abstract' | 'adaptive';
235
+
236
+ export interface RuntimeFeatures {
237
+ webassembly: boolean;
238
+ simd: boolean;
239
+ workers: boolean;
240
+ shared_array_buffer: boolean;
241
+ bigint: boolean;
242
+ }
243
+
244
+ export interface MemoryUsage {
245
+ used: number;
246
+ total: number;
247
+ limit: number;
248
+ }
249
+
250
+ export interface ModuleManifest {
251
+ [moduleName: string]: {
252
+ path: string;
253
+ size: number;
254
+ priority: 'high' | 'medium' | 'low';
255
+ dependencies: string[];
256
+ };
257
+ }
258
+
259
+ export interface ModuleStatusMap {
260
+ [moduleName: string]: {
261
+ loaded: boolean;
262
+ loading: boolean;
263
+ size: number;
264
+ priority: string;
265
+ dependencies: string[];
266
+ isPlaceholder?: boolean;
267
+ };
268
+ }
269
+
270
+ export interface WasmModule {
271
+ instance: WebAssembly.Instance;
272
+ module: WebAssembly.Module;
273
+ exports: any;
274
+ memory: WebAssembly.Memory;
275
+ isPlaceholder?: boolean;
276
+ }
277
+
278
+ // MCP Tool Parameters and Results
279
+ export interface SwarmInitParams {
280
+ topology?: 'mesh' | 'star' | 'hierarchical' | 'ring';
281
+ maxAgents?: number;
282
+ strategy?: 'balanced' | 'specialized' | 'adaptive';
283
+ enableCognitiveDiversity?: boolean;
284
+ enableNeuralAgents?: boolean;
285
+ enableForecasting?: boolean;
286
+ }
287
+
288
+ export interface SwarmInitResult {
289
+ id: string;
290
+ message: string;
291
+ topology: string;
292
+ strategy: string;
293
+ maxAgents: number;
294
+ features: Record<string, boolean>;
295
+ created: string;
296
+ performance: {
297
+ initialization_time_ms: number;
298
+ memory_usage_mb: number;
299
+ };
300
+ }
301
+
302
+ export interface AgentSpawnParams {
303
+ type?: string;
304
+ name?: string;
305
+ capabilities?: string[];
306
+ cognitivePattern?: string;
307
+ neuralConfig?: any;
308
+ swarmId?: string;
309
+ }
310
+
311
+ export interface AgentSpawnResult {
312
+ agent: {
313
+ id: string;
314
+ name: string;
315
+ type: string;
316
+ cognitive_pattern: string;
317
+ capabilities: string[];
318
+ neural_network_id: string | null;
319
+ status: string;
320
+ };
321
+ swarm_info: {
322
+ id: string;
323
+ agent_count: number;
324
+ capacity: string;
325
+ };
326
+ message: string;
327
+ performance: {
328
+ spawn_time_ms: number;
329
+ memory_overhead_mb: number;
330
+ };
331
+ }
332
+
333
+ export interface TaskOrchestrateParams {
334
+ task: string;
335
+ priority?: string;
336
+ strategy?: string;
337
+ maxAgents?: number;
338
+ swarmId?: string;
339
+ requiredCapabilities?: string[];
340
+ estimatedDuration?: number;
341
+ }
342
+
343
+ export interface TaskOrchestrateResult {
344
+ taskId: string;
345
+ status: string;
346
+ description: string;
347
+ priority: string;
348
+ strategy: string;
349
+ assigned_agents: string[];
350
+ swarm_info: any;
351
+ orchestration: any;
352
+ performance: any;
353
+ message: string;
354
+ }
355
+
356
+ // Utility exports
357
+ export function consoleLog(message: string): void;
358
+ export function consoleError(message: string): void;
359
+ export function consoleWarn(message: string): void;
360
+ export function formatJsError(error: Error): string;
361
+
362
+ // Neural agent exports
363
+ export { NeuralAgent, NeuralAgentFactory, NeuralNetwork } from './neural-agent';
364
+ export const COGNITIVE_PATTERNS: Record<string, CognitivePattern>;
365
+ export const AGENT_COGNITIVE_PROFILES: Record<string, any>;
366
+
367
+ // Template exports
368
+ export const NeuralNetworkTemplates: {
369
+ getTemplate(templateName: string): NeuralConfig;
370
+ };
371
+ }