@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,63 @@
1
+ // Auto-generated TypeScript definitions for WASM module
2
+ // Generated by build script
3
+
4
+ export interface WASMExports {
5
+ memory: WebAssembly.Memory;
6
+ init(): void;
7
+ get_version(): string;
8
+ has_simd_support(): boolean;
9
+
10
+ // Runtime features
11
+ RuntimeFeatures: {
12
+ new(): RuntimeFeatures;
13
+ };
14
+
15
+ // Swarm class
16
+ RuvSwarm: {
17
+ new(config: any): RuvSwarm;
18
+ };
19
+
20
+ // Agent class
21
+ JsAgent: {
22
+ readonly prototype: JsAgent;
23
+ };
24
+
25
+ // Utility functions
26
+ console_log(message: string): void;
27
+ console_error(message: string): void;
28
+ console_warn(message: string): void;
29
+ format_js_error(error: any): string;
30
+ get_wasm_memory_usage(): bigint;
31
+
32
+ // Array conversion utilities
33
+ js_array_to_vec_f32(array: any): Float32Array;
34
+ vec_f32_to_js_array(vec: Float32Array): any;
35
+ }
36
+
37
+ export interface RuntimeFeatures {
38
+ readonly simd_available: boolean;
39
+ readonly threads_available: boolean;
40
+ readonly memory_limit: bigint;
41
+ get_features_json(): string;
42
+ }
43
+
44
+ export interface RuvSwarm {
45
+ readonly name: string;
46
+ readonly agent_count: number;
47
+ readonly max_agents: number;
48
+ spawn(config: any): Promise<JsAgent>;
49
+ orchestrate(task: any): Promise<any>;
50
+ get_agents(): string[];
51
+ get_status(): any;
52
+ }
53
+
54
+ export interface JsAgent {
55
+ readonly id: string;
56
+ readonly agent_type: string;
57
+ readonly status: string;
58
+ readonly tasks_completed: number;
59
+ execute(task: any): Promise<any>;
60
+ get_metrics(): any;
61
+ get_capabilities(): string[];
62
+ reset(): void;
63
+ }
package/wasm/README.md ADDED
@@ -0,0 +1,347 @@
1
+ # ruv-swarm-wasm
2
+
3
+ High-performance WebAssembly neural network orchestration with SIMD optimization for browser and Node.js environments.
4
+
5
+ ## Introduction
6
+
7
+ ruv-swarm-wasm is a cutting-edge WebAssembly implementation of the ruv-swarm neural network orchestration engine, specifically designed for maximum performance in web browsers and Node.js environments. By leveraging SIMD (Single Instruction, Multiple Data) optimizations and WebAssembly's near-native performance, this crate delivers unprecedented speed for neural network operations in JavaScript environments.
8
+
9
+ ## Key Features
10
+
11
+ ### ⚡ WebAssembly Performance Optimization
12
+ - **SIMD-accelerated operations**: 2-4x performance improvement over scalar implementations
13
+ - **Near-native performance**: WebAssembly execution with optimized memory management
14
+ - **Browser compatibility**: Supports all modern browsers with WebAssembly SIMD
15
+ - **Optimized bundle size**: < 800KB compressed WASM module
16
+
17
+ ### 🚀 SIMD Capabilities
18
+ - **Vector operations**: Dot product, addition, scaling with f32x4 SIMD registers
19
+ - **Matrix operations**: Optimized matrix-vector and matrix-matrix multiplication
20
+ - **Activation functions**: SIMD-accelerated ReLU, Sigmoid, and Tanh implementations
21
+ - **Performance benchmarking**: Built-in tools to measure SIMD vs scalar performance
22
+
23
+ ### 🧠 Neural Network Operations
24
+ - **Fast inference**: < 20ms agent spawning with full neural network setup
25
+ - **Parallel processing**: Web Workers integration for true parallelism
26
+ - **Memory efficiency**: < 5MB per agent neural network
27
+ - **Batch processing**: Optimized for multiple simultaneous operations
28
+
29
+ ### 🌐 Cross-Platform Compatibility
30
+ - **Browser support**: Chrome, Firefox, Safari, Edge with WebAssembly SIMD
31
+ - **Node.js compatibility**: Full support for server-side neural processing
32
+ - **Mobile optimization**: Efficient performance on mobile browsers
33
+ - **TypeScript support**: Complete type definitions included
34
+
35
+ ## Installation
36
+
37
+ ### Web Browser (ES Modules)
38
+
39
+ ```bash
40
+ npm install ruv-swarm-wasm
41
+ ```
42
+
43
+ ```javascript
44
+ import init, {
45
+ WasmSwarmOrchestrator,
46
+ SimdVectorOps,
47
+ SimdMatrixOps
48
+ } from 'ruv-swarm-wasm';
49
+
50
+ // Initialize the WASM module
51
+ await init();
52
+ ```
53
+
54
+ ### Node.js Environment
55
+
56
+ ```bash
57
+ npm install ruv-swarm-wasm
58
+ ```
59
+
60
+ ```javascript
61
+ import init, {
62
+ WasmSwarmOrchestrator,
63
+ SimdVectorOps
64
+ } from 'ruv-swarm-wasm';
65
+
66
+ // Initialize with Node.js specific optimizations
67
+ await init();
68
+ ```
69
+
70
+ ### CDN Usage (Browser)
71
+
72
+ ```html
73
+ <script type="module">
74
+ import init, { SimdVectorOps } from 'https://unpkg.com/ruv-swarm-wasm/ruv_swarm_wasm.js';
75
+
76
+ await init();
77
+ const vectorOps = new SimdVectorOps();
78
+ </script>
79
+ ```
80
+
81
+ ## Usage Examples
82
+
83
+ ### Basic SIMD Vector Operations
84
+
85
+ ```javascript
86
+ import init, { SimdVectorOps } from 'ruv-swarm-wasm';
87
+
88
+ await init();
89
+
90
+ const vectorOps = new SimdVectorOps();
91
+
92
+ // High-performance vector operations
93
+ const vecA = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0];
94
+ const vecB = [2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0];
95
+
96
+ // SIMD-accelerated dot product (2-4x faster)
97
+ const dotProduct = vectorOps.dot_product(vecA, vecB);
98
+
99
+ // SIMD vector addition
100
+ const vectorSum = vectorOps.vector_add(vecA, vecB);
101
+
102
+ // SIMD activation functions
103
+ const reluResult = vectorOps.apply_activation(vecA, 'relu');
104
+ const sigmoidResult = vectorOps.apply_activation(vecA, 'sigmoid');
105
+ ```
106
+
107
+ ### Neural Network Inference
108
+
109
+ ```javascript
110
+ import init, { WasmNeuralNetwork, ActivationFunction } from 'ruv-swarm-wasm';
111
+
112
+ await init();
113
+
114
+ // Create a high-performance neural network
115
+ const layers = [784, 256, 128, 10]; // MNIST-like architecture
116
+ const network = new WasmNeuralNetwork(layers, ActivationFunction.ReLU);
117
+ network.randomize_weights(-1.0, 1.0);
118
+
119
+ // Lightning-fast inference (< 5ms typical)
120
+ const input = new Array(784).fill(0).map(() => Math.random());
121
+ const output = network.run(input);
122
+
123
+ console.log('Classification result:', output);
124
+ ```
125
+
126
+ ### Swarm Orchestration with Performance Monitoring
127
+
128
+ ```javascript
129
+ import init, {
130
+ WasmSwarmOrchestrator,
131
+ SimdBenchmark
132
+ } from 'ruv-swarm-wasm';
133
+
134
+ await init();
135
+
136
+ // Create high-performance swarm orchestrator
137
+ const orchestrator = new WasmSwarmOrchestrator();
138
+
139
+ // Configure swarm for optimal performance
140
+ const swarmConfig = {
141
+ name: "Performance Swarm",
142
+ topology_type: "mesh",
143
+ max_agents: 10,
144
+ enable_cognitive_diversity: true,
145
+ simd_optimization: true
146
+ };
147
+
148
+ const swarm = orchestrator.create_swarm(swarmConfig);
149
+
150
+ // Benchmark SIMD performance
151
+ const benchmark = new SimdBenchmark();
152
+ const dotProductBench = benchmark.benchmark_dot_product(10000, 100);
153
+ const activationBench = benchmark.benchmark_activation(10000, 100, 'relu');
154
+
155
+ console.log('SIMD Performance:', JSON.parse(dotProductBench));
156
+ console.log('Activation Performance:', JSON.parse(activationBench));
157
+ ```
158
+
159
+ ### Advanced Matrix Operations
160
+
161
+ ```javascript
162
+ import init, { SimdMatrixOps } from 'ruv-swarm-wasm';
163
+
164
+ await init();
165
+
166
+ const matrixOps = new SimdMatrixOps();
167
+
168
+ // High-performance matrix operations
169
+ const matrix = new Float32Array([
170
+ 1.0, 2.0, 3.0,
171
+ 4.0, 5.0, 6.0
172
+ ]); // 2x3 matrix
173
+
174
+ const vector = new Float32Array([1.0, 2.0, 3.0]);
175
+
176
+ // SIMD-optimized matrix-vector multiplication
177
+ const result = matrixOps.matrix_vector_multiply(matrix, vector, 2, 3);
178
+ console.log('Matrix-vector result:', result); // [14, 32]
179
+
180
+ // Matrix-matrix multiplication for neural layers
181
+ const matrixA = new Float32Array([1.0, 2.0, 3.0, 4.0]); // 2x2
182
+ const matrixB = new Float32Array([5.0, 6.0, 7.0, 8.0]); // 2x2
183
+ const matMulResult = matrixOps.matrix_multiply(matrixA, matrixB, 2, 2, 2);
184
+ console.log('Matrix multiplication:', matMulResult); // [19, 22, 43, 50]
185
+ ```
186
+
187
+ ## Performance Benchmarks
188
+
189
+ ### SIMD vs Scalar Performance
190
+
191
+ | Operation | Vector Size | SIMD Time | Scalar Time | Speedup |
192
+ |-----------|-------------|-----------|-------------|---------|
193
+ | Dot Product | 1,000 | 0.12ms | 0.48ms | **4.0x** |
194
+ | Vector Add | 1,000 | 0.08ms | 0.24ms | **3.0x** |
195
+ | ReLU Activation | 1,000 | 0.05ms | 0.18ms | **3.6x** |
196
+ | Sigmoid Activation | 1,000 | 0.15ms | 0.45ms | **3.0x** |
197
+ | Matrix-Vector Mult | 1000x1000 | 2.1ms | 8.4ms | **4.0x** |
198
+
199
+ ### Neural Network Inference Performance
200
+
201
+ | Network Architecture | SIMD Time | Scalar Time | Speedup |
202
+ |---------------------|-----------|-------------|---------|
203
+ | [784, 256, 128, 10] | 1.2ms | 4.8ms | **4.0x** |
204
+ | [512, 512, 256, 64] | 0.8ms | 2.4ms | **3.0x** |
205
+ | [1024, 512, 256, 128] | 2.1ms | 6.3ms | **3.0x** |
206
+
207
+ ### Browser Compatibility
208
+
209
+ | Browser | SIMD Support | Performance Gain |
210
+ |---------|--------------|------------------|
211
+ | Chrome 91+ | ✅ Full | 3.5-4.0x |
212
+ | Firefox 89+ | ✅ Full | 3.0-3.5x |
213
+ | Safari 14.1+ | ✅ Full | 2.8-3.2x |
214
+ | Edge 91+ | ✅ Full | 3.5-4.0x |
215
+
216
+ ## SIMD Feature Detection
217
+
218
+ ```javascript
219
+ import init, { detect_simd_capabilities } from 'ruv-swarm-wasm';
220
+
221
+ await init();
222
+
223
+ // Check runtime SIMD capabilities
224
+ const capabilities = JSON.parse(detect_simd_capabilities());
225
+ console.log('SIMD Capabilities:', capabilities);
226
+
227
+ // Example output:
228
+ // {
229
+ // "simd128": true,
230
+ // "feature_simd": true,
231
+ // "runtime_detection": "supported"
232
+ // }
233
+ ```
234
+
235
+ ## Building from Source
236
+
237
+ ### Prerequisites
238
+
239
+ ```bash
240
+ # Install Rust and wasm-pack
241
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
242
+ curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
243
+
244
+ # Install Node.js dependencies
245
+ npm install
246
+ ```
247
+
248
+ ### Build Commands
249
+
250
+ ```bash
251
+ # Build optimized WASM module with SIMD support
252
+ wasm-pack build --target web --out-dir pkg --release
253
+
254
+ # Build for Node.js
255
+ wasm-pack build --target nodejs --out-dir pkg-node --release
256
+
257
+ # Build with specific SIMD features
258
+ RUSTFLAGS="-C target-feature=+simd128" wasm-pack build --target web
259
+
260
+ # Run performance tests
261
+ wasm-pack test --headless --chrome --release
262
+ ```
263
+
264
+ ### Development Build
265
+
266
+ ```bash
267
+ # Development build with debug symbols
268
+ wasm-pack build --target web --dev
269
+
270
+ # Run SIMD verification suite
271
+ ./verify_simd.sh
272
+ ```
273
+
274
+ ## API Reference
275
+
276
+ ### SimdVectorOps
277
+
278
+ High-performance SIMD vector operations:
279
+
280
+ - `dot_product(a: Float32Array, b: Float32Array): number`
281
+ - `vector_add(a: Float32Array, b: Float32Array): Float32Array`
282
+ - `vector_scale(vec: Float32Array, scalar: number): Float32Array`
283
+ - `apply_activation(vec: Float32Array, activation: string): Float32Array`
284
+
285
+ ### SimdMatrixOps
286
+
287
+ SIMD-accelerated matrix operations:
288
+
289
+ - `matrix_vector_multiply(matrix: Float32Array, vector: Float32Array, rows: number, cols: number): Float32Array`
290
+ - `matrix_multiply(a: Float32Array, b: Float32Array, a_rows: number, a_cols: number, b_cols: number): Float32Array`
291
+
292
+ ### WasmNeuralNetwork
293
+
294
+ Complete neural network implementation:
295
+
296
+ - `new(layers: number[], activation: ActivationFunction)`
297
+ - `run(input: Float32Array): Float32Array`
298
+ - `randomize_weights(min: number, max: number): void`
299
+ - `get_weights(): Float32Array`
300
+ - `set_weights(weights: Float32Array): void`
301
+
302
+ ### SimdBenchmark
303
+
304
+ Performance benchmarking utilities:
305
+
306
+ - `benchmark_dot_product(size: number, iterations: number): string`
307
+ - `benchmark_activation(size: number, iterations: number, activation: string): string`
308
+
309
+ ## Memory Management
310
+
311
+ The WASM module uses efficient memory management:
312
+
313
+ - **Linear memory**: Shared between JS and WASM for zero-copy operations
314
+ - **Memory pools**: Reusable memory allocation for frequent operations
315
+ - **Garbage collection**: Automatic cleanup of completed computations
316
+ - **Memory usage**: Typically < 5MB per neural network instance
317
+
318
+ ## Contributing
319
+
320
+ We welcome contributions to improve ruv-swarm-wasm! Areas of focus:
321
+
322
+ - SIMD optimization improvements
323
+ - Additional neural network architectures
324
+ - Performance benchmarking
325
+ - Browser compatibility testing
326
+ - Documentation and examples
327
+
328
+ ## Links
329
+
330
+ - **Main Repository**: [https://github.com/ruvnet/ruv-FANN](https://github.com/ruvnet/ruv-FANN)
331
+ - **Documentation**: [https://docs.rs/ruv-swarm-wasm](https://docs.rs/ruv-swarm-wasm)
332
+ - **NPM Package**: [https://www.npmjs.com/package/ruv-swarm-wasm](https://www.npmjs.com/package/ruv-swarm-wasm)
333
+ - **Examples**: [examples/](examples/)
334
+ - **Benchmarks**: [SIMD Performance Demo](examples/simd_demo.js)
335
+
336
+ ## License
337
+
338
+ This project is licensed under either of
339
+
340
+ - Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0))
341
+ - MIT License ([LICENSE-MIT](LICENSE-MIT) or [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT))
342
+
343
+ at your option.
344
+
345
+ ---
346
+
347
+ **Created by rUv** - Pushing the boundaries of neural network performance in web environments.
Binary file
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "ruv-swarm-wasm",
3
+ "type": "module",
4
+ "collaborators": [
5
+ "rUv Contributors"
6
+ ],
7
+ "description": "WebAssembly bindings for ruv-swarm neural network orchestration",
8
+ "version": "1.0.5",
9
+ "license": "MIT OR Apache-2.0",
10
+ "files": [
11
+ "ruv_swarm_wasm_bg.wasm",
12
+ "ruv_swarm_wasm.js"
13
+ ],
14
+ "main": "ruv_swarm_wasm.js",
15
+ "sideEffects": [
16
+ "./snippets/*"
17
+ ]
18
+ }
Binary file
Binary file