@ruvector/edge-net 0.1.2 → 0.1.4
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 +160 -0
- package/agents.js +965 -0
- package/package.json +27 -3
- package/real-agents.js +706 -0
- package/sync.js +799 -0
package/README.md
CHANGED
|
@@ -44,6 +44,7 @@ A distributed computing platform that enables collective resource sharing for AI
|
|
|
44
44
|
- [Exotic AI Capabilities](#exotic-ai-capabilities)
|
|
45
45
|
- [Core Architecture & Capabilities](#core-architecture--capabilities)
|
|
46
46
|
- [Self-Learning Hooks & MCP Integration](#self-learning-hooks--mcp-integration)
|
|
47
|
+
- [Distributed AI Agents & Workers](#distributed-ai-agents--workers)
|
|
47
48
|
|
|
48
49
|
---
|
|
49
50
|
|
|
@@ -1238,6 +1239,165 @@ ruvector hooks remember <content> -t <type> # Store memory
|
|
|
1238
1239
|
ruvector hooks recall <query> # Semantic search
|
|
1239
1240
|
```
|
|
1240
1241
|
|
|
1242
|
+
---
|
|
1243
|
+
|
|
1244
|
+
## Distributed AI Agents & Workers
|
|
1245
|
+
|
|
1246
|
+
Edge-net enables spawning AI agents and distributed worker pools across the collective compute network. This transforms passive compute contribution into active distributed AI execution.
|
|
1247
|
+
|
|
1248
|
+
### Architecture
|
|
1249
|
+
|
|
1250
|
+
```
|
|
1251
|
+
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
1252
|
+
│ DISTRIBUTED AI AGENT SYSTEM │
|
|
1253
|
+
├─────────────────────────────────────────────────────────────────────────────┤
|
|
1254
|
+
│ │
|
|
1255
|
+
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
|
|
1256
|
+
│ │ AgentSpawner │ │ WorkerPool │ │ TaskOrchestrator│ │
|
|
1257
|
+
│ │ │ │ │ │ │ │
|
|
1258
|
+
│ │ • Type routing │ │ • Load balance │ │ • Workflows │ │
|
|
1259
|
+
│ │ • rUv costing │ │ • Auto-scaling │ │ • Dependencies │ │
|
|
1260
|
+
│ │ • Priority mgmt │ │ • Fault tolerant│ │ • Parallel exec │ │
|
|
1261
|
+
│ └────────┬────────┘ └────────┬────────┘ └────────┬────────┘ │
|
|
1262
|
+
│ │ │ │ │
|
|
1263
|
+
│ └───────────────────────┼───────────────────────┘ │
|
|
1264
|
+
│ │ │
|
|
1265
|
+
│ ┌────────────┴────────────┐ │
|
|
1266
|
+
│ │ Edge-Net P2P Network │ │
|
|
1267
|
+
│ │ (WebRTC Data Channels) │ │
|
|
1268
|
+
│ └──────────────────────────┘ │
|
|
1269
|
+
│ │
|
|
1270
|
+
│ Agent Types: researcher | coder | reviewer | tester | analyst | │
|
|
1271
|
+
│ optimizer | coordinator | embedder │
|
|
1272
|
+
│ │
|
|
1273
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
1274
|
+
```
|
|
1275
|
+
|
|
1276
|
+
### Agent Types
|
|
1277
|
+
|
|
1278
|
+
| Type | Capabilities | Base rUv | Use Cases |
|
|
1279
|
+
|------|-------------|----------|-----------|
|
|
1280
|
+
| **researcher** | search, analyze, summarize, extract | 10 | Codebase analysis, documentation research |
|
|
1281
|
+
| **coder** | code, refactor, debug, test | 15 | Feature implementation, bug fixes |
|
|
1282
|
+
| **reviewer** | review, audit, validate, suggest | 12 | Code review, security audit |
|
|
1283
|
+
| **tester** | test, benchmark, validate, report | 10 | Test creation, coverage analysis |
|
|
1284
|
+
| **analyst** | analyze, metrics, report, visualize | 8 | Performance analysis, data insights |
|
|
1285
|
+
| **optimizer** | optimize, profile, benchmark, improve | 15 | Performance tuning, efficiency |
|
|
1286
|
+
| **coordinator** | orchestrate, route, schedule, monitor | 20 | Multi-agent workflows |
|
|
1287
|
+
| **embedder** | embed, vectorize, similarity, search | 5 | Vector operations, semantic search |
|
|
1288
|
+
|
|
1289
|
+
### CLI Commands
|
|
1290
|
+
|
|
1291
|
+
```bash
|
|
1292
|
+
# Show Edge-Net information
|
|
1293
|
+
ruvector edge-net info
|
|
1294
|
+
|
|
1295
|
+
# Spawn a distributed AI agent
|
|
1296
|
+
ruvector edge-net spawn researcher "Analyze the authentication system"
|
|
1297
|
+
ruvector edge-net spawn coder "Implement user profile feature" --max-ruv 50 --priority high
|
|
1298
|
+
|
|
1299
|
+
# Create and use worker pools
|
|
1300
|
+
ruvector edge-net pool create --size 10 --capabilities compute,embed
|
|
1301
|
+
ruvector edge-net pool execute "Process batch embeddings"
|
|
1302
|
+
|
|
1303
|
+
# Run multi-agent workflows
|
|
1304
|
+
ruvector edge-net workflow code-review
|
|
1305
|
+
ruvector edge-net workflow feature-dev
|
|
1306
|
+
ruvector edge-net workflow optimization
|
|
1307
|
+
|
|
1308
|
+
# Check network status
|
|
1309
|
+
ruvector edge-net status
|
|
1310
|
+
```
|
|
1311
|
+
|
|
1312
|
+
### MCP Tools
|
|
1313
|
+
|
|
1314
|
+
The following MCP tools are available when `ruvector` is configured as an MCP server:
|
|
1315
|
+
|
|
1316
|
+
| Tool | Description | Parameters |
|
|
1317
|
+
|------|-------------|------------|
|
|
1318
|
+
| `edge_net_info` | Get Edge-Net information | - |
|
|
1319
|
+
| `edge_net_spawn` | Spawn distributed agent | type, task, max_ruv, priority |
|
|
1320
|
+
| `edge_net_pool_create` | Create worker pool | min_workers, max_workers |
|
|
1321
|
+
| `edge_net_pool_execute` | Execute on pool | task, pool_id |
|
|
1322
|
+
| `edge_net_workflow` | Run workflow | name (code-review, feature-dev, etc.) |
|
|
1323
|
+
| `edge_net_status` | Network status | - |
|
|
1324
|
+
|
|
1325
|
+
### Workflows
|
|
1326
|
+
|
|
1327
|
+
Pre-built multi-agent workflows:
|
|
1328
|
+
|
|
1329
|
+
| Workflow | Steps | Est. rUv | Description |
|
|
1330
|
+
|----------|-------|----------|-------------|
|
|
1331
|
+
| **code-review** | analyst → reviewer → tester → optimizer | 45 | Comprehensive code analysis |
|
|
1332
|
+
| **feature-dev** | researcher → coder → tester → reviewer | 60 | Full feature development cycle |
|
|
1333
|
+
| **bug-fix** | analyst → coder → tester | 35 | Bug diagnosis and fix |
|
|
1334
|
+
| **optimization** | analyst → optimizer → coder → tester | 50 | Performance improvement |
|
|
1335
|
+
| **research** | researcher → analyst → embedder | 30 | Deep research with embeddings |
|
|
1336
|
+
|
|
1337
|
+
### JavaScript API
|
|
1338
|
+
|
|
1339
|
+
```javascript
|
|
1340
|
+
import { AgentSpawner, WorkerPool, TaskOrchestrator, AGENT_TYPES } from '@ruvector/edge-net/agents';
|
|
1341
|
+
|
|
1342
|
+
// Spawn a distributed agent
|
|
1343
|
+
const spawner = new AgentSpawner(edgeNetNode);
|
|
1344
|
+
const agent = await spawner.spawn('coder', 'Implement authentication', {
|
|
1345
|
+
maxRuv: 30,
|
|
1346
|
+
priority: 'high'
|
|
1347
|
+
});
|
|
1348
|
+
|
|
1349
|
+
// Create a worker pool
|
|
1350
|
+
const pool = new WorkerPool(edgeNetNode, {
|
|
1351
|
+
minWorkers: 5,
|
|
1352
|
+
maxWorkers: 20,
|
|
1353
|
+
capabilities: ['compute', 'embed', 'analyze']
|
|
1354
|
+
});
|
|
1355
|
+
await pool.scale(10);
|
|
1356
|
+
|
|
1357
|
+
// Execute tasks on the pool
|
|
1358
|
+
const result = await pool.execute({
|
|
1359
|
+
type: 'parallel',
|
|
1360
|
+
task: 'Process batch data',
|
|
1361
|
+
data: largeDataset
|
|
1362
|
+
});
|
|
1363
|
+
|
|
1364
|
+
// Run multi-agent workflow
|
|
1365
|
+
const orchestrator = new TaskOrchestrator(edgeNetNode, spawner);
|
|
1366
|
+
await orchestrator.runWorkflow('feature-dev', 'Add user authentication');
|
|
1367
|
+
```
|
|
1368
|
+
|
|
1369
|
+
### Event System
|
|
1370
|
+
|
|
1371
|
+
Agents and workers emit events for monitoring:
|
|
1372
|
+
|
|
1373
|
+
```javascript
|
|
1374
|
+
agent.on('started', ({ id, type }) => console.log(`Agent ${id} started`));
|
|
1375
|
+
agent.on('progress', ({ progress }) => console.log(`Progress: ${progress}%`));
|
|
1376
|
+
agent.on('completed', ({ result }) => console.log('Done:', result));
|
|
1377
|
+
agent.on('error', ({ error }) => console.error('Error:', error));
|
|
1378
|
+
|
|
1379
|
+
pool.on('scaled', ({ workers }) => console.log(`Pool scaled to ${workers}`));
|
|
1380
|
+
pool.on('task_completed', ({ taskId }) => console.log(`Task ${taskId} done`));
|
|
1381
|
+
```
|
|
1382
|
+
|
|
1383
|
+
### rUv Economics for Agents
|
|
1384
|
+
|
|
1385
|
+
| Factor | Impact |
|
|
1386
|
+
|--------|--------|
|
|
1387
|
+
| **Base Cost** | Agent type determines base rUv per task |
|
|
1388
|
+
| **Task Complexity** | Longer/complex tasks cost more |
|
|
1389
|
+
| **Priority** | High priority = 1.5x cost, Critical = 2x |
|
|
1390
|
+
| **Network Load** | Dynamic pricing based on availability |
|
|
1391
|
+
| **Early Adopter** | 10x multiplier during genesis phase |
|
|
1392
|
+
|
|
1393
|
+
### Security Considerations
|
|
1394
|
+
|
|
1395
|
+
- All agent communications are encrypted via DTLS
|
|
1396
|
+
- Task execution sandboxed in WebWorkers
|
|
1397
|
+
- rUv spending limits prevent runaway costs
|
|
1398
|
+
- Input validation on all MCP tools
|
|
1399
|
+
- Rate limiting on agent spawning
|
|
1400
|
+
|
|
1241
1401
|
### Claude Code Hook Events
|
|
1242
1402
|
|
|
1243
1403
|
| Event | Trigger | Action |
|