agent-comms 1.28.0 → 1.28.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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +1 -1
- package/dist/core/comms-store.d.ts +4 -37
- package/dist/core/comms-store.d.ts.map +1 -1
- package/dist/core/comms-store.js +3 -3
- package/dist/core/mesh-store.d.ts +12 -3
- package/dist/core/mesh-store.d.ts.map +1 -1
- package/dist/core/mesh-store.js +52 -33
- package/dist/core/mesh-store.js.map +1 -1
- package/dist/core/store.d.ts +1 -27
- package/dist/core/store.d.ts.map +1 -1
- package/dist/core/store.js +0 -62
- package/dist/core/store.js.map +1 -1
- package/dist/core/tls-transport.d.ts +12 -9
- package/dist/core/tls-transport.d.ts.map +1 -1
- package/dist/core/tls-transport.js +62 -25
- package/dist/core/tls-transport.js.map +1 -1
- package/dist/core/tool.d.ts +34 -5
- package/dist/core/tool.d.ts.map +1 -1
- package/dist/core/tool.js +41 -0
- package/dist/core/tool.js.map +1 -1
- package/dist/core/wire-protocol.d.ts +3 -2
- package/dist/core/wire-protocol.d.ts.map +1 -1
- package/dist/core/wire-protocol.js +3 -2
- package/dist/core/wire-protocol.js.map +1 -1
- package/dist/test/approval.integration.test.js +320 -285
- package/dist/test/approval.integration.test.js.map +1 -1
- package/dist/test/become-coordinator-actual-port.integration.test.js +0 -19
- package/dist/test/become-coordinator-actual-port.integration.test.js.map +1 -1
- package/dist/test/coordinator-socket-error.integration.test.js +2 -0
- package/dist/test/coordinator-socket-error.integration.test.js.map +1 -1
- package/dist/test/delivery-receipt.helper.js +15 -0
- package/dist/test/delivery-receipt.helper.js.map +1 -1
- package/dist/test/downtime-replay.test.js +5 -2
- package/dist/test/downtime-replay.test.js.map +1 -1
- package/dist/test/federation.integration.test.js +2 -0
- package/dist/test/federation.integration.test.js.map +1 -1
- package/dist/test/listener-policy.integration.test.js +214 -158
- package/dist/test/listener-policy.integration.test.js.map +1 -1
- package/dist/test/mesh-e2e.integration.test.js +2 -0
- package/dist/test/mesh-e2e.integration.test.js.map +1 -1
- package/dist/test/mesh-smoke.integration.test.d.ts +2 -4
- package/dist/test/mesh-smoke.integration.test.d.ts.map +1 -1
- package/dist/test/mesh-smoke.integration.test.js +28 -5
- package/dist/test/mesh-smoke.integration.test.js.map +1 -1
- package/dist/test/state-sync-convergence.test.js +5 -2
- package/dist/test/state-sync-convergence.test.js.map +1 -1
- package/dist/test/test-transport.d.ts +8 -0
- package/dist/test/test-transport.d.ts.map +1 -0
- package/dist/test/test-transport.js +29 -0
- package/dist/test/test-transport.js.map +1 -0
- package/dist/test/visibility.integration.test.js +6 -0
- package/dist/test/visibility.integration.test.js.map +1 -1
- package/package.json +2 -2
- package/dist/core/tcp-transport.d.ts +0 -85
- package/dist/core/tcp-transport.d.ts.map +0 -1
- package/dist/core/tcp-transport.js +0 -659
- package/dist/core/tcp-transport.js.map +0 -1
- package/dist/core/ws-transport.d.ts +0 -79
- package/dist/core/ws-transport.d.ts.map +0 -1
- package/dist/core/ws-transport.js +0 -622
- package/dist/core/ws-transport.js.map +0 -1
- package/dist/test/ws-broadcast-window.integration.test.d.ts +0 -7
- package/dist/test/ws-broadcast-window.integration.test.d.ts.map +0 -1
- package/dist/test/ws-broadcast-window.integration.test.js +0 -94
- package/dist/test/ws-broadcast-window.integration.test.js.map +0 -1
|
@@ -1,622 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WebSocketTransport — WebSocket transport for the peer mesh.
|
|
3
|
-
*
|
|
4
|
-
* Carries the same wire protocol as TcpTransport but over WebSocket frames.
|
|
5
|
-
* Each WS frame is a complete JSON message — no newline delimiter or
|
|
6
|
-
* MessageBuffer needed. This enables browser-based peers (PWAs) to
|
|
7
|
-
* participate in the mesh.
|
|
8
|
-
*
|
|
9
|
-
* The transport is a drop-in replacement for TcpTransport. Same interface,
|
|
10
|
-
* same wire protocol, same event callbacks. MeshStore cannot tell the
|
|
11
|
-
* difference.
|
|
12
|
-
*/
|
|
13
|
-
import { WebSocket, WebSocketServer } from "ws";
|
|
14
|
-
import { isMeshMessage } from "./wire-protocol.js";
|
|
15
|
-
import { attachWsHandshake } from "./handshake.js";
|
|
16
|
-
// ---------------------------------------------------------------------------
|
|
17
|
-
// Constants
|
|
18
|
-
// ---------------------------------------------------------------------------
|
|
19
|
-
/** Timeout for connecting to the coordinator before giving up. */
|
|
20
|
-
const CONNECT_TIMEOUT_MS = 2000;
|
|
21
|
-
// ---------------------------------------------------------------------------
|
|
22
|
-
// Async WS send helper (not exported)
|
|
23
|
-
// ---------------------------------------------------------------------------
|
|
24
|
-
/**
|
|
25
|
-
* Safety valve so a dial that never completes cannot grow its outbound queue
|
|
26
|
-
* unbounded; oldest entries are dropped first (#23).
|
|
27
|
-
*/
|
|
28
|
-
const MAX_PENDING_PER_PEER = 100;
|
|
29
|
-
function sendAsync(ws, data) {
|
|
30
|
-
return new Promise((resolve, reject) => {
|
|
31
|
-
if (ws.readyState !== WebSocket.OPEN) {
|
|
32
|
-
resolve();
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
ws.send(data, (err) => {
|
|
36
|
-
if (err)
|
|
37
|
-
reject(err);
|
|
38
|
-
else
|
|
39
|
-
resolve();
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
// ---------------------------------------------------------------------------
|
|
44
|
-
// WebSocketTransport
|
|
45
|
-
// ---------------------------------------------------------------------------
|
|
46
|
-
export class WebSocketTransport {
|
|
47
|
-
// -- Data server (accepts incoming peer data connections) --
|
|
48
|
-
dataServer;
|
|
49
|
-
_dataPort = 0;
|
|
50
|
-
// -- Coordinator server (accepts introductions from new peers) --
|
|
51
|
-
coordinatorServer;
|
|
52
|
-
_isCoordinator = false;
|
|
53
|
-
// -- Coordinator client socket (connection to the coordinator) --
|
|
54
|
-
coordinatorWs;
|
|
55
|
-
// -- Coordinator introduction handshake (resolved on the peer list) --
|
|
56
|
-
resolveCoordinatorHandshake;
|
|
57
|
-
coordinatorHandshakeTimer;
|
|
58
|
-
// -- Peer data connections (peer ID → WebSocket) --
|
|
59
|
-
peerConnections = new Map();
|
|
60
|
-
// -- Messages queued for peers whose dial is still in flight (#23) --
|
|
61
|
-
pendingOutbound = new Map();
|
|
62
|
-
// -- All WS connections accepted by the data server (for shutdown cleanup) --
|
|
63
|
-
dataServerSockets = new Set();
|
|
64
|
-
// -- All WS connections accepted by the coordinator server (for shutdown cleanup) --
|
|
65
|
-
coordinatorServerSockets = new Set();
|
|
66
|
-
// -- Coordinator introduction connections (handle ID → WebSocket) --
|
|
67
|
-
// Maps the introducing peer's ID to the coordinator server WS, so
|
|
68
|
-
// MeshStore can send the peer_list response via transport.send().
|
|
69
|
-
introConnections = new Map();
|
|
70
|
-
// -- Pending connections awaiting approval (handle ID → WS + request info) --
|
|
71
|
-
pendingConnections = new Map();
|
|
72
|
-
// -- Shutdown sentinel — prevents callbacks after shutdown() --
|
|
73
|
-
shutDown = false;
|
|
74
|
-
// -- This peer's ID (set during connectToCoordinator or becomeCoordinator) --
|
|
75
|
-
_peerId = "";
|
|
76
|
-
events;
|
|
77
|
-
constructor(events) {
|
|
78
|
-
this.events = events;
|
|
79
|
-
}
|
|
80
|
-
// -- Public getters for interface properties --
|
|
81
|
-
get dataPort() {
|
|
82
|
-
return this._dataPort;
|
|
83
|
-
}
|
|
84
|
-
get isCoordinator() {
|
|
85
|
-
return this._isCoordinator;
|
|
86
|
-
}
|
|
87
|
-
get hasCoordinatorConnection() {
|
|
88
|
-
return this.coordinatorWs?.readyState === WebSocket.OPEN;
|
|
89
|
-
}
|
|
90
|
-
// -----------------------------------------------------------------------
|
|
91
|
-
// MeshTransport — Data server
|
|
92
|
-
// -----------------------------------------------------------------------
|
|
93
|
-
async startDataServer() {
|
|
94
|
-
await new Promise((resolve, reject) => {
|
|
95
|
-
// WebSocketServer needs an underlying HTTP server to get an
|
|
96
|
-
// OS-assigned port via port 0.
|
|
97
|
-
this.dataServer = new WebSocketServer({ port: 0, host: "0.0.0.0" });
|
|
98
|
-
this.dataServer.on("error", reject);
|
|
99
|
-
this.dataServer.on("listening", () => {
|
|
100
|
-
const addr = this.dataServer?.address();
|
|
101
|
-
if (typeof addr === "object" && addr !== null) {
|
|
102
|
-
this._dataPort = addr.port;
|
|
103
|
-
}
|
|
104
|
-
resolve();
|
|
105
|
-
});
|
|
106
|
-
this.dataServer.on("connection", (ws) => {
|
|
107
|
-
this.handleIncomingDataConnection(ws);
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
// -----------------------------------------------------------------------
|
|
112
|
-
// MeshTransport — Coordinator connection (client side)
|
|
113
|
-
// -----------------------------------------------------------------------
|
|
114
|
-
async connectToCoordinator(host, port, peerId, localDataPort) {
|
|
115
|
-
this._peerId = peerId;
|
|
116
|
-
await new Promise((resolve, reject) => {
|
|
117
|
-
const url = `ws://${host}:${String(port)}`;
|
|
118
|
-
const ws = new WebSocket(url);
|
|
119
|
-
const timer = setTimeout(() => {
|
|
120
|
-
ws.terminate();
|
|
121
|
-
reject(new Error("Coordinator connection timeout"));
|
|
122
|
-
}, CONNECT_TIMEOUT_MS);
|
|
123
|
-
ws.on("unexpected-response", () => {
|
|
124
|
-
clearTimeout(timer);
|
|
125
|
-
ws.terminate();
|
|
126
|
-
reject(new Error("Coordinator connection rejected"));
|
|
127
|
-
});
|
|
128
|
-
ws.on("open", () => {
|
|
129
|
-
this.coordinatorWs = ws;
|
|
130
|
-
// Wire up the protocol handshake first (client role: attachWsHandshake sends its own binary frame immediately) so the introduction below lands after it on the wire, not before, and not duplicated.
|
|
131
|
-
attachWsHandshake(ws, "client", (raw) => {
|
|
132
|
-
const msg = parseMessage(raw);
|
|
133
|
-
if (msg !== undefined) {
|
|
134
|
-
this.dispatchCoordinatorClientMessage(msg);
|
|
135
|
-
}
|
|
136
|
-
}, (error) => this.events.onError?.(error));
|
|
137
|
-
// Send introduction
|
|
138
|
-
const intro = {
|
|
139
|
-
method: "introduce",
|
|
140
|
-
peerId,
|
|
141
|
-
dataPort: localDataPort,
|
|
142
|
-
};
|
|
143
|
-
ws.send(JSON.stringify(intro));
|
|
144
|
-
ws.on("error", () => {
|
|
145
|
-
/* ignore late errors on coordinator connection */
|
|
146
|
-
});
|
|
147
|
-
clearTimeout(timer);
|
|
148
|
-
// Resolve on the coordinator's peer list rather than on sending the
|
|
149
|
-
// introduction: MeshStore.init() then returns only after the post-join
|
|
150
|
-
// peer dials have started, so the first broadcasts are queued for the
|
|
151
|
-
// dialling peers instead of dropped (#23). A timeout keeps today's
|
|
152
|
-
// degraded behaviour for a coordinator that never answers.
|
|
153
|
-
this.resolveCoordinatorHandshake = resolve;
|
|
154
|
-
this.coordinatorHandshakeTimer = setTimeout(() => {
|
|
155
|
-
this.resolveCoordinatorHandshake = undefined;
|
|
156
|
-
resolve();
|
|
157
|
-
}, CONNECT_TIMEOUT_MS);
|
|
158
|
-
});
|
|
159
|
-
ws.on("error", (err) => {
|
|
160
|
-
clearTimeout(timer);
|
|
161
|
-
ws.terminate();
|
|
162
|
-
reject(err);
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
// -----------------------------------------------------------------------
|
|
167
|
-
// MeshTransport — Connect to remote coordinator with approval
|
|
168
|
-
// -----------------------------------------------------------------------
|
|
169
|
-
async connectToRemote(host, port, peerId, _localDataPort, name, fingerprint) {
|
|
170
|
-
this._peerId = peerId;
|
|
171
|
-
await new Promise((resolve, reject) => {
|
|
172
|
-
const url = `ws://${host}:${String(port)}`;
|
|
173
|
-
const ws = new WebSocket(url);
|
|
174
|
-
const timer = setTimeout(() => {
|
|
175
|
-
ws.terminate();
|
|
176
|
-
reject(new Error("Remote connection timeout"));
|
|
177
|
-
}, CONNECT_TIMEOUT_MS);
|
|
178
|
-
ws.on("unexpected-response", () => {
|
|
179
|
-
clearTimeout(timer);
|
|
180
|
-
ws.terminate();
|
|
181
|
-
reject(new Error("Remote connection rejected"));
|
|
182
|
-
});
|
|
183
|
-
ws.on("open", () => {
|
|
184
|
-
this.coordinatorWs = ws;
|
|
185
|
-
// Wire up the protocol handshake first (client role) so connect_request below lands after it on the wire, not duplicated. Wait for connect_accepted or connect_rejected.
|
|
186
|
-
let approved = false;
|
|
187
|
-
attachWsHandshake(ws, "client", (raw) => {
|
|
188
|
-
const msg = parseMessage(raw);
|
|
189
|
-
if (msg === undefined)
|
|
190
|
-
return;
|
|
191
|
-
if (!approved) {
|
|
192
|
-
if (msg.method === "connect_accepted") {
|
|
193
|
-
approved = true;
|
|
194
|
-
clearTimeout(timer);
|
|
195
|
-
resolve();
|
|
196
|
-
}
|
|
197
|
-
else if (msg.method === "connect_rejected") {
|
|
198
|
-
clearTimeout(timer);
|
|
199
|
-
ws.terminate();
|
|
200
|
-
reject(new Error(`Connection rejected: ${msg.reason}`));
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
this.dispatchCoordinatorClientMessage(msg);
|
|
206
|
-
}
|
|
207
|
-
}, (error) => this.events.onError?.(error));
|
|
208
|
-
// Send connect_request instead of introduce
|
|
209
|
-
const req = {
|
|
210
|
-
method: "connect_request",
|
|
211
|
-
peerId,
|
|
212
|
-
dataPort: _localDataPort,
|
|
213
|
-
name,
|
|
214
|
-
fingerprint,
|
|
215
|
-
};
|
|
216
|
-
ws.send(JSON.stringify(req));
|
|
217
|
-
ws.on("error", () => {
|
|
218
|
-
/* ignore late errors on coordinator connection */
|
|
219
|
-
});
|
|
220
|
-
});
|
|
221
|
-
ws.on("error", (err) => {
|
|
222
|
-
clearTimeout(timer);
|
|
223
|
-
ws.terminate();
|
|
224
|
-
reject(err);
|
|
225
|
-
});
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
// -----------------------------------------------------------------------
|
|
229
|
-
// MeshTransport — Become coordinator (server side)
|
|
230
|
-
// -----------------------------------------------------------------------
|
|
231
|
-
async becomeCoordinator(host, port) {
|
|
232
|
-
await new Promise((resolve, reject) => {
|
|
233
|
-
this.coordinatorServer = new WebSocketServer({ host, port });
|
|
234
|
-
this.coordinatorServer.on("error", (err) => {
|
|
235
|
-
reject(err instanceof Error ? err : new Error(String(err)));
|
|
236
|
-
});
|
|
237
|
-
this.coordinatorServer.on("listening", () => {
|
|
238
|
-
this._isCoordinator = true;
|
|
239
|
-
resolve();
|
|
240
|
-
});
|
|
241
|
-
this.coordinatorServer.on("connection", (ws) => {
|
|
242
|
-
this.handleCoordinatorServerConnection(ws);
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
// -----------------------------------------------------------------------
|
|
247
|
-
// MeshTransport — Connect to a peer's data server
|
|
248
|
-
// -----------------------------------------------------------------------
|
|
249
|
-
async connectToPeer(peer, ownPeerId) {
|
|
250
|
-
if (this.peerConnections.has(peer.id))
|
|
251
|
-
return;
|
|
252
|
-
// Queue broadcasts until the connection registers: messages sent in the
|
|
253
|
-
// dial window previously had nowhere to go and were silently dropped.
|
|
254
|
-
this.pendingOutbound.set(peer.id, this.pendingOutbound.get(peer.id) ?? []);
|
|
255
|
-
await new Promise((resolve) => {
|
|
256
|
-
const url = `ws://127.0.0.1:${String(peer.port)}`;
|
|
257
|
-
const ws = new WebSocket(url);
|
|
258
|
-
ws.on("open", () => {
|
|
259
|
-
this.peerConnections.set(peer.id, ws);
|
|
260
|
-
// Wire up the protocol handshake first (client role) so everything below lands after it on the wire, not duplicated.
|
|
261
|
-
attachWsHandshake(ws, "client", (raw) => {
|
|
262
|
-
const msg = parseMessage(raw);
|
|
263
|
-
if (msg !== undefined) {
|
|
264
|
-
const handle = { id: peer.id };
|
|
265
|
-
this.dispatchDataMessage(handle, msg);
|
|
266
|
-
}
|
|
267
|
-
}, (error) => this.events.onError?.(error));
|
|
268
|
-
// Identify ourselves
|
|
269
|
-
const pong = { method: "pong", peerId: ownPeerId };
|
|
270
|
-
ws.send(JSON.stringify(pong));
|
|
271
|
-
void this.flushPending(peer.id, ws);
|
|
272
|
-
resolve();
|
|
273
|
-
});
|
|
274
|
-
const handle = { id: peer.id };
|
|
275
|
-
let disconnected = false;
|
|
276
|
-
const onDisconnect = () => {
|
|
277
|
-
if (disconnected)
|
|
278
|
-
return;
|
|
279
|
-
disconnected = true;
|
|
280
|
-
const wasConnected = this.peerConnections.has(peer.id);
|
|
281
|
-
this.peerConnections.delete(peer.id);
|
|
282
|
-
if (wasConnected && !this.shutDown) {
|
|
283
|
-
this.events.onPeerDisconnected(handle);
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
ws.on("close", onDisconnect);
|
|
287
|
-
ws.on("error", () => {
|
|
288
|
-
this.pendingOutbound.delete(peer.id);
|
|
289
|
-
onDisconnect();
|
|
290
|
-
ws.terminate();
|
|
291
|
-
resolve();
|
|
292
|
-
});
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
// -----------------------------------------------------------------------
|
|
296
|
-
// MeshTransport — Send / broadcast
|
|
297
|
-
// -----------------------------------------------------------------------
|
|
298
|
-
async send(handle, message) {
|
|
299
|
-
const data = JSON.stringify(message);
|
|
300
|
-
// Check data connections first
|
|
301
|
-
const peerWs = this.peerConnections.get(handle.id);
|
|
302
|
-
if (peerWs) {
|
|
303
|
-
await sendAsync(peerWs, data);
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
// Check coordinator introduction connections
|
|
307
|
-
const introWs = this.introConnections.get(handle.id);
|
|
308
|
-
if (introWs) {
|
|
309
|
-
await sendAsync(introWs, data);
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
throw new Error(`No connection for handle ${handle.id}`);
|
|
313
|
-
}
|
|
314
|
-
async acceptConnection(handle) {
|
|
315
|
-
const pending = this.pendingConnections.get(handle.id);
|
|
316
|
-
if (!pending) {
|
|
317
|
-
throw new Error(`No pending connection for handle ${handle.id}`);
|
|
318
|
-
}
|
|
319
|
-
this.pendingConnections.delete(handle.id);
|
|
320
|
-
const { ws, peerId, dataPort } = pending;
|
|
321
|
-
// Move to introConnections so send() can reach this peer
|
|
322
|
-
this.introConnections.set(peerId, ws);
|
|
323
|
-
// Send acceptance to the connecting peer
|
|
324
|
-
const accepted = {
|
|
325
|
-
method: "connect_accepted",
|
|
326
|
-
peerId: this._peerId,
|
|
327
|
-
dataPort: this._dataPort,
|
|
328
|
-
};
|
|
329
|
-
await sendAsync(ws, JSON.stringify(accepted));
|
|
330
|
-
// Fire onIntroduction so MeshStore processes the new peer normally
|
|
331
|
-
const connHandle = { id: peerId };
|
|
332
|
-
this.events.onIntroduction(connHandle, { peerId, dataPort });
|
|
333
|
-
}
|
|
334
|
-
async rejectConnection(handle, reason) {
|
|
335
|
-
const pending = this.pendingConnections.get(handle.id);
|
|
336
|
-
if (!pending) {
|
|
337
|
-
throw new Error(`No pending connection for handle ${handle.id}`);
|
|
338
|
-
}
|
|
339
|
-
this.pendingConnections.delete(handle.id);
|
|
340
|
-
const { ws } = pending;
|
|
341
|
-
const rejected = {
|
|
342
|
-
method: "connect_rejected",
|
|
343
|
-
peerId: handle.id,
|
|
344
|
-
reason,
|
|
345
|
-
};
|
|
346
|
-
await sendAsync(ws, JSON.stringify(rejected));
|
|
347
|
-
ws.terminate();
|
|
348
|
-
}
|
|
349
|
-
async broadcast(message) {
|
|
350
|
-
const data = JSON.stringify(message);
|
|
351
|
-
const writes = [];
|
|
352
|
-
for (const [, ws] of this.peerConnections) {
|
|
353
|
-
writes.push(sendAsync(ws, data).catch(() => {
|
|
354
|
-
/* broken connection — cleanup handled by close/error listeners */
|
|
355
|
-
}));
|
|
356
|
-
}
|
|
357
|
-
for (const queue of this.pendingOutbound.values()) {
|
|
358
|
-
queue.push(message);
|
|
359
|
-
if (queue.length > MAX_PENDING_PER_PEER)
|
|
360
|
-
queue.shift();
|
|
361
|
-
}
|
|
362
|
-
await Promise.all(writes);
|
|
363
|
-
}
|
|
364
|
-
/** Send messages queued while the peer's connection was being dialled. */
|
|
365
|
-
async flushPending(peerId, ws) {
|
|
366
|
-
const queue = this.pendingOutbound.get(peerId);
|
|
367
|
-
this.pendingOutbound.delete(peerId);
|
|
368
|
-
if (queue === undefined)
|
|
369
|
-
return;
|
|
370
|
-
for (const message of queue) {
|
|
371
|
-
const sent = await sendAsync(ws, JSON.stringify(message)).then(() => true, () => false);
|
|
372
|
-
if (!sent)
|
|
373
|
-
return; // connection is dying; close listeners clean up
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
// -----------------------------------------------------------------------
|
|
377
|
-
// MeshTransport — Listener management (not supported over WebSocket)
|
|
378
|
-
// -----------------------------------------------------------------------
|
|
379
|
-
addListener() {
|
|
380
|
-
throw new Error("WebSocketTransport does not support listener management");
|
|
381
|
-
}
|
|
382
|
-
removeListener() {
|
|
383
|
-
throw new Error("WebSocketTransport does not support listener management");
|
|
384
|
-
}
|
|
385
|
-
listListeners() {
|
|
386
|
-
return [];
|
|
387
|
-
}
|
|
388
|
-
// -----------------------------------------------------------------------
|
|
389
|
-
// MeshTransport — Shutdown / unref
|
|
390
|
-
// -----------------------------------------------------------------------
|
|
391
|
-
shutdown() {
|
|
392
|
-
this.shutDown = true;
|
|
393
|
-
if (this.coordinatorHandshakeTimer !== undefined) {
|
|
394
|
-
clearTimeout(this.coordinatorHandshakeTimer);
|
|
395
|
-
this.coordinatorHandshakeTimer = undefined;
|
|
396
|
-
}
|
|
397
|
-
this.resolveCoordinatorHandshake = undefined;
|
|
398
|
-
// Destroy the coordinator client socket
|
|
399
|
-
this.coordinatorWs?.terminate();
|
|
400
|
-
this.coordinatorWs = undefined;
|
|
401
|
-
// Destroy all identified peer connections
|
|
402
|
-
for (const [, ws] of this.peerConnections) {
|
|
403
|
-
ws.terminate();
|
|
404
|
-
}
|
|
405
|
-
this.peerConnections.clear();
|
|
406
|
-
// Destroy all data server accepted sockets (including unidentified)
|
|
407
|
-
for (const ws of this.dataServerSockets) {
|
|
408
|
-
ws.terminate();
|
|
409
|
-
}
|
|
410
|
-
this.dataServerSockets.clear();
|
|
411
|
-
// Destroy all coordinator server accepted sockets
|
|
412
|
-
for (const ws of this.coordinatorServerSockets) {
|
|
413
|
-
ws.terminate();
|
|
414
|
-
}
|
|
415
|
-
this.coordinatorServerSockets.clear();
|
|
416
|
-
// Clear introduction connection tracking
|
|
417
|
-
this.introConnections.clear();
|
|
418
|
-
// Clear pending connections
|
|
419
|
-
for (const [, pending] of this.pendingConnections) {
|
|
420
|
-
pending.ws.terminate();
|
|
421
|
-
}
|
|
422
|
-
this.pendingConnections.clear();
|
|
423
|
-
// Close servers — stop accepting new connections
|
|
424
|
-
this.dataServer?.close();
|
|
425
|
-
this.dataServer = undefined;
|
|
426
|
-
this.coordinatorServer?.close();
|
|
427
|
-
this.coordinatorServer = undefined;
|
|
428
|
-
this._isCoordinator = false;
|
|
429
|
-
return Promise.resolve();
|
|
430
|
-
}
|
|
431
|
-
unref() {
|
|
432
|
-
// WebSocketServer doesn't have an unref() method the way net.Server
|
|
433
|
-
// does. The servers will be closed on shutdown(). Peer WS connections
|
|
434
|
-
// are cleaned up on shutdown() as well.
|
|
435
|
-
}
|
|
436
|
-
// -----------------------------------------------------------------------
|
|
437
|
-
// Internal — Coordinator client message dispatch
|
|
438
|
-
// -----------------------------------------------------------------------
|
|
439
|
-
/**
|
|
440
|
-
* Handles messages received on the coordinator client socket (the
|
|
441
|
-
* connection from this peer TO the coordinator). Fires the appropriate
|
|
442
|
-
* TransportEvents for peer_list, peer_joined, and become_coordinator.
|
|
443
|
-
*/
|
|
444
|
-
dispatchCoordinatorClientMessage(msg) {
|
|
445
|
-
if (this.shutDown)
|
|
446
|
-
return;
|
|
447
|
-
if (msg.method === "peer_list") {
|
|
448
|
-
// Fire onPeerList first: it starts the post-join dials (and their
|
|
449
|
-
// broadcast queues) before init() resolves.
|
|
450
|
-
this.events.onPeerList(msg.peers);
|
|
451
|
-
this.completeCoordinatorHandshake();
|
|
452
|
-
}
|
|
453
|
-
else if (msg.method === "peer_joined") {
|
|
454
|
-
this.events.onPeerJoined(msg.peer);
|
|
455
|
-
}
|
|
456
|
-
else if (msg.method === "become_coordinator") {
|
|
457
|
-
this.events.onBecomeCoordinator(msg.peerList);
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
/** Complete connectToCoordinator's handshake after the peer list arrives. */
|
|
461
|
-
completeCoordinatorHandshake() {
|
|
462
|
-
if (this.coordinatorHandshakeTimer !== undefined) {
|
|
463
|
-
clearTimeout(this.coordinatorHandshakeTimer);
|
|
464
|
-
this.coordinatorHandshakeTimer = undefined;
|
|
465
|
-
}
|
|
466
|
-
this.resolveCoordinatorHandshake?.();
|
|
467
|
-
this.resolveCoordinatorHandshake = undefined;
|
|
468
|
-
}
|
|
469
|
-
// -----------------------------------------------------------------------
|
|
470
|
-
// Internal — Data message dispatch
|
|
471
|
-
// -----------------------------------------------------------------------
|
|
472
|
-
/**
|
|
473
|
-
* Routes a message received on a peer data connection to the
|
|
474
|
-
* appropriate event. become_coordinator has its own event; all
|
|
475
|
-
* other messages fire onMessage for MeshStore to handle.
|
|
476
|
-
*/
|
|
477
|
-
dispatchDataMessage(handle, msg) {
|
|
478
|
-
if (this.shutDown)
|
|
479
|
-
return;
|
|
480
|
-
if (msg.method === "become_coordinator") {
|
|
481
|
-
this.events.onBecomeCoordinator(msg.peerList);
|
|
482
|
-
}
|
|
483
|
-
else {
|
|
484
|
-
this.events.onMessage(handle, msg);
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
// -----------------------------------------------------------------------
|
|
488
|
-
// Internal — Coordinator server connection handling
|
|
489
|
-
// -----------------------------------------------------------------------
|
|
490
|
-
/**
|
|
491
|
-
* Accepts a new connection on the coordinator server. Reads
|
|
492
|
-
* introduce messages and fires onIntroduction so MeshStore can
|
|
493
|
-
* respond with the peer list and broadcast the arrival.
|
|
494
|
-
*/
|
|
495
|
-
handleCoordinatorServerConnection(ws) {
|
|
496
|
-
if (this.shutDown) {
|
|
497
|
-
ws.terminate();
|
|
498
|
-
return;
|
|
499
|
-
}
|
|
500
|
-
this.coordinatorServerSockets.add(ws);
|
|
501
|
-
ws.on("close", () => this.coordinatorServerSockets.delete(ws));
|
|
502
|
-
ws.on("error", () => this.coordinatorServerSockets.delete(ws));
|
|
503
|
-
attachWsHandshake(ws, "server", (raw) => {
|
|
504
|
-
const msg = parseMessage(raw);
|
|
505
|
-
if (msg === undefined)
|
|
506
|
-
return;
|
|
507
|
-
if (msg.method === "introduce") {
|
|
508
|
-
const handle = { id: msg.peerId };
|
|
509
|
-
this.introConnections.set(handle.id, ws);
|
|
510
|
-
this.events.onIntroduction(handle, {
|
|
511
|
-
peerId: msg.peerId,
|
|
512
|
-
dataPort: msg.dataPort,
|
|
513
|
-
});
|
|
514
|
-
}
|
|
515
|
-
else if (msg.method === "connect_request") {
|
|
516
|
-
const handle = { id: msg.peerId };
|
|
517
|
-
this.pendingConnections.set(handle.id, {
|
|
518
|
-
ws,
|
|
519
|
-
peerId: msg.peerId,
|
|
520
|
-
dataPort: msg.dataPort,
|
|
521
|
-
name: msg.name,
|
|
522
|
-
fingerprint: msg.fingerprint,
|
|
523
|
-
});
|
|
524
|
-
this.events.onConnectionRequest(handle, {
|
|
525
|
-
peerId: msg.peerId,
|
|
526
|
-
dataPort: msg.dataPort,
|
|
527
|
-
name: msg.name,
|
|
528
|
-
fingerprint: msg.fingerprint,
|
|
529
|
-
});
|
|
530
|
-
}
|
|
531
|
-
}, (error) => this.events.onError?.(error));
|
|
532
|
-
}
|
|
533
|
-
// -----------------------------------------------------------------------
|
|
534
|
-
// Internal — Incoming data connection handling
|
|
535
|
-
// -----------------------------------------------------------------------
|
|
536
|
-
/**
|
|
537
|
-
* Accepts a new connection on the data server. Reads the initial
|
|
538
|
-
* pong to identify the peer, then fires onMessage for subsequent
|
|
539
|
-
* messages. Tracks the connection for cleanup on close/error.
|
|
540
|
-
*/
|
|
541
|
-
handleIncomingDataConnection(ws) {
|
|
542
|
-
if (this.shutDown) {
|
|
543
|
-
ws.terminate();
|
|
544
|
-
return;
|
|
545
|
-
}
|
|
546
|
-
this.dataServerSockets.add(ws);
|
|
547
|
-
ws.on("close", () => this.dataServerSockets.delete(ws));
|
|
548
|
-
let remotePeerId;
|
|
549
|
-
let disconnected = false;
|
|
550
|
-
attachWsHandshake(ws, "server", (raw) => {
|
|
551
|
-
const msg = parseMessage(raw);
|
|
552
|
-
if (msg === undefined)
|
|
553
|
-
return;
|
|
554
|
-
if (msg.method === "pong") {
|
|
555
|
-
const peerId = msg.peerId;
|
|
556
|
-
remotePeerId = peerId;
|
|
557
|
-
if (!this.peerConnections.has(peerId)) {
|
|
558
|
-
this.peerConnections.set(peerId, ws);
|
|
559
|
-
}
|
|
560
|
-
void this.flushPending(peerId, ws);
|
|
561
|
-
const handle = { id: peerId };
|
|
562
|
-
const info = {
|
|
563
|
-
id: peerId,
|
|
564
|
-
port: 0,
|
|
565
|
-
startedAt: new Date().toISOString(),
|
|
566
|
-
};
|
|
567
|
-
this.events.onPeerConnected(handle, info);
|
|
568
|
-
}
|
|
569
|
-
else if (remotePeerId !== undefined) {
|
|
570
|
-
const handle = { id: remotePeerId };
|
|
571
|
-
this.dispatchDataMessage(handle, msg);
|
|
572
|
-
}
|
|
573
|
-
}, (error) => this.events.onError?.(error));
|
|
574
|
-
const onDisconnect = () => {
|
|
575
|
-
if (disconnected)
|
|
576
|
-
return;
|
|
577
|
-
disconnected = true;
|
|
578
|
-
if (remotePeerId !== undefined) {
|
|
579
|
-
this.peerConnections.delete(remotePeerId);
|
|
580
|
-
if (!this.shutDown) {
|
|
581
|
-
this.events.onPeerDisconnected({ id: remotePeerId });
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
};
|
|
585
|
-
ws.on("close", onDisconnect);
|
|
586
|
-
ws.on("error", onDisconnect);
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
// ---------------------------------------------------------------------------
|
|
590
|
-
// Message parsing (not exported)
|
|
591
|
-
// ---------------------------------------------------------------------------
|
|
592
|
-
/**
|
|
593
|
-
* Parse a raw WS message into a MeshMessage, returning undefined for
|
|
594
|
-
* malformed data. Unlike TCP, each WS frame is a complete message —
|
|
595
|
-
* no newline delimiter or buffer splitting required.
|
|
596
|
-
*/
|
|
597
|
-
function parseMessage(raw) {
|
|
598
|
-
if (raw === undefined)
|
|
599
|
-
return undefined;
|
|
600
|
-
// WS data arrives as Buffer in Node, string in browsers
|
|
601
|
-
let text;
|
|
602
|
-
if (typeof raw === "string") {
|
|
603
|
-
text = raw;
|
|
604
|
-
}
|
|
605
|
-
else if (raw instanceof Buffer || ArrayBuffer.isView(raw)) {
|
|
606
|
-
text = new TextDecoder().decode(raw instanceof Buffer ? raw : new Uint8Array(raw.buffer));
|
|
607
|
-
}
|
|
608
|
-
else if (raw instanceof ArrayBuffer) {
|
|
609
|
-
text = new TextDecoder().decode(raw);
|
|
610
|
-
}
|
|
611
|
-
else {
|
|
612
|
-
return undefined;
|
|
613
|
-
}
|
|
614
|
-
try {
|
|
615
|
-
const parsed = JSON.parse(text);
|
|
616
|
-
return isMeshMessage(parsed) ? parsed : undefined;
|
|
617
|
-
}
|
|
618
|
-
catch {
|
|
619
|
-
return undefined;
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
//# sourceMappingURL=ws-transport.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ws-transport.js","sourceRoot":"","sources":["../../src/core/ws-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AASnD,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,kEAAkE;AAClE,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEhC,8EAA8E;AAC9E,sCAAsC;AACtC,8EAA8E;AAE9E;;;GAGG;A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AC;QAC5D,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAC7B,GAAG,YAAY,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CACzD,CAAC;IACJ,CAAC;SAAM,IAAI,GAAG,YAAY,WAAW,EAAE,CAAC;QACtC,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;SAAM,CAAC;QACN,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzC,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IACpD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration test for the WebSocket transport's broadcast queue: state patches broadcast before the WS data connections are established must be queued and flushed on registration, not dropped (#23).
|
|
3
|
-
*
|
|
4
|
-
* Mirrors broadcast-window.integration.test.ts over TlsTransport; the queue logic is implemented per transport, so each needs its own coverage.
|
|
5
|
-
*/
|
|
6
|
-
export {};
|
|
7
|
-
//# sourceMappingURL=ws-broadcast-window.integration.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ws-broadcast-window.integration.test.d.ts","sourceRoot":"","sources":["../../src/test/ws-broadcast-window.integration.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|