@ruvector/edge-net 0.2.1 → 0.4.0
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/cli.js +113 -0
- package/dht.js +790 -0
- package/firebase-setup.js +435 -0
- package/firebase-signaling.js +788 -0
- package/genesis.js +858 -0
- package/p2p.js +702 -0
- package/package.json +49 -4
- package/webrtc.js +37 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ruvector/edge-net",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Distributed compute intelligence network with AI agents and workers - contribute browser compute, spawn distributed AI agents, earn credits. Features Time Crystal coordination, Neural DAG attention, P2P swarm intelligence, ONNX inference, WebRTC signaling, CRDT ledger, and multi-agent workflows.",
|
|
6
6
|
"main": "ruvector_edge_net.js",
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
"bin": {
|
|
10
10
|
"edge-net": "./cli.js",
|
|
11
11
|
"ruvector-edge": "./cli.js",
|
|
12
|
-
"edge-net-join": "./join.js"
|
|
12
|
+
"edge-net-join": "./join.js",
|
|
13
|
+
"edge-net-genesis": "./genesis.js",
|
|
14
|
+
"edge-net-firebase-setup": "./firebase-setup.js"
|
|
13
15
|
},
|
|
14
16
|
"keywords": [
|
|
15
17
|
"wasm",
|
|
@@ -43,7 +45,17 @@
|
|
|
43
45
|
"signaling",
|
|
44
46
|
"scheduler",
|
|
45
47
|
"monitoring",
|
|
46
|
-
"qdag"
|
|
48
|
+
"qdag",
|
|
49
|
+
"dht",
|
|
50
|
+
"kademlia",
|
|
51
|
+
"genesis-node",
|
|
52
|
+
"turn-server",
|
|
53
|
+
"nat-traversal",
|
|
54
|
+
"google-cloud",
|
|
55
|
+
"firebase",
|
|
56
|
+
"gcloud",
|
|
57
|
+
"firestore",
|
|
58
|
+
"realtime-database"
|
|
47
59
|
],
|
|
48
60
|
"author": "RuVector Team <team@ruvector.dev>",
|
|
49
61
|
"license": "MIT",
|
|
@@ -79,6 +91,11 @@
|
|
|
79
91
|
"ledger.js",
|
|
80
92
|
"scheduler.js",
|
|
81
93
|
"monitor.js",
|
|
94
|
+
"dht.js",
|
|
95
|
+
"genesis.js",
|
|
96
|
+
"p2p.js",
|
|
97
|
+
"firebase-signaling.js",
|
|
98
|
+
"firebase-setup.js",
|
|
82
99
|
"README.md",
|
|
83
100
|
"LICENSE"
|
|
84
101
|
],
|
|
@@ -128,6 +145,21 @@
|
|
|
128
145
|
},
|
|
129
146
|
"./monitor": {
|
|
130
147
|
"import": "./monitor.js"
|
|
148
|
+
},
|
|
149
|
+
"./dht": {
|
|
150
|
+
"import": "./dht.js"
|
|
151
|
+
},
|
|
152
|
+
"./genesis": {
|
|
153
|
+
"import": "./genesis.js"
|
|
154
|
+
},
|
|
155
|
+
"./p2p": {
|
|
156
|
+
"import": "./p2p.js"
|
|
157
|
+
},
|
|
158
|
+
"./firebase-signaling": {
|
|
159
|
+
"import": "./firebase-signaling.js"
|
|
160
|
+
},
|
|
161
|
+
"./firebase-setup": {
|
|
162
|
+
"import": "./firebase-setup.js"
|
|
131
163
|
}
|
|
132
164
|
},
|
|
133
165
|
"sideEffects": [
|
|
@@ -147,11 +179,24 @@
|
|
|
147
179
|
"peers": "node join.js --peers",
|
|
148
180
|
"history": "node join.js --history",
|
|
149
181
|
"signaling": "node -e \"import('./signaling.js').then(m => new m.SignalingServer().start())\"",
|
|
150
|
-
"
|
|
182
|
+
"genesis": "node genesis.js",
|
|
183
|
+
"genesis:start": "node genesis.js --port 8787",
|
|
184
|
+
"p2p": "node -e \"import('./p2p.js').then(m => m.createP2PNetwork({ nodeId: 'test' }))\"",
|
|
185
|
+
"monitor": "node -e \"import('./monitor.js').then(m => { const mon = new m.Monitor(); mon.start(); setInterval(() => console.log(JSON.stringify(mon.generateReport(), null, 2)), 5000); })\"",
|
|
186
|
+
"firebase:setup": "node firebase-setup.js",
|
|
187
|
+
"firebase:check": "node firebase-setup.js --check"
|
|
151
188
|
},
|
|
152
189
|
"dependencies": {
|
|
153
190
|
"@ruvector/ruvllm": "^0.2.3",
|
|
154
191
|
"@xenova/transformers": "^2.17.2",
|
|
155
192
|
"ws": "^8.18.3"
|
|
193
|
+
},
|
|
194
|
+
"peerDependencies": {
|
|
195
|
+
"firebase": "^10.0.0"
|
|
196
|
+
},
|
|
197
|
+
"peerDependenciesMeta": {
|
|
198
|
+
"firebase": {
|
|
199
|
+
"optional": true
|
|
200
|
+
}
|
|
156
201
|
}
|
|
157
202
|
}
|
package/webrtc.js
CHANGED
|
@@ -20,18 +20,43 @@ import { createHash, randomBytes } from 'crypto';
|
|
|
20
20
|
// WebRTC Configuration
|
|
21
21
|
export const WEBRTC_CONFIG = {
|
|
22
22
|
iceServers: [
|
|
23
|
+
// STUN servers (free, for NAT discovery)
|
|
23
24
|
{ urls: 'stun:stun.l.google.com:19302' },
|
|
24
25
|
{ urls: 'stun:stun1.l.google.com:19302' },
|
|
25
26
|
{ urls: 'stun:stun.cloudflare.com:3478' },
|
|
26
27
|
{ urls: 'stun:stun.services.mozilla.com:3478' },
|
|
28
|
+
// Free TURN servers for NAT traversal (relay)
|
|
29
|
+
{
|
|
30
|
+
urls: 'turn:openrelay.metered.ca:80',
|
|
31
|
+
username: 'openrelayproject',
|
|
32
|
+
credential: 'openrelayproject',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
urls: 'turn:openrelay.metered.ca:443',
|
|
36
|
+
username: 'openrelayproject',
|
|
37
|
+
credential: 'openrelayproject',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
urls: 'turn:openrelay.metered.ca:443?transport=tcp',
|
|
41
|
+
username: 'openrelayproject',
|
|
42
|
+
credential: 'openrelayproject',
|
|
43
|
+
},
|
|
44
|
+
// Alternative free TURN
|
|
45
|
+
{
|
|
46
|
+
urls: 'turn:relay.metered.ca:80',
|
|
47
|
+
username: 'e8a437a4c4d4e5f6a7b8c9d0',
|
|
48
|
+
credential: 'freePublicTurnServer',
|
|
49
|
+
},
|
|
27
50
|
],
|
|
28
|
-
// Signaling server endpoints
|
|
51
|
+
// Signaling server endpoints (priority order)
|
|
29
52
|
signalingServers: [
|
|
30
|
-
'
|
|
31
|
-
'
|
|
53
|
+
'ws://localhost:8787', // Local signaling server first
|
|
54
|
+
'ws://127.0.0.1:8787', // Local alternative
|
|
55
|
+
'wss://edge-net-signal.ruvector.dev', // Production (when deployed)
|
|
32
56
|
],
|
|
33
|
-
// Fallback to local
|
|
34
|
-
fallbackToSimulation:
|
|
57
|
+
// Fallback to local DHT if no signaling available
|
|
58
|
+
fallbackToSimulation: false,
|
|
59
|
+
fallbackToDHT: true,
|
|
35
60
|
// Connection timeouts
|
|
36
61
|
connectionTimeout: 30000,
|
|
37
62
|
reconnectDelay: 5000,
|
|
@@ -44,6 +69,13 @@ export const WEBRTC_CONFIG = {
|
|
|
44
69
|
// Heartbeat for connection health
|
|
45
70
|
heartbeatInterval: 5000,
|
|
46
71
|
heartbeatTimeout: 15000,
|
|
72
|
+
// DHT configuration
|
|
73
|
+
dht: {
|
|
74
|
+
bootstrapNodes: [],
|
|
75
|
+
kBucketSize: 20,
|
|
76
|
+
alpha: 3, // Parallel lookups
|
|
77
|
+
refreshInterval: 60000,
|
|
78
|
+
},
|
|
47
79
|
};
|
|
48
80
|
|
|
49
81
|
/**
|