squad-openclaw 2026.2.1810 → 2026.2.1812
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/dist/index.js +22 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1257,9 +1257,9 @@ var RelayClient = class {
|
|
|
1257
1257
|
const msg = innerMsg;
|
|
1258
1258
|
if (msg.type === "event" && typeof msg.event === "string" && msg.event.startsWith("relay.")) {
|
|
1259
1259
|
if (msg.event === "relay.user.connected") {
|
|
1260
|
-
console.log(`[relay-client] User ${userId} connected via relay \u2014 creating local WS`);
|
|
1261
1260
|
const existing = this.userConnections.get(userId);
|
|
1262
|
-
if (!existing || existing.localWs.readyState
|
|
1261
|
+
if (!existing || existing.localWs.readyState >= NodeWebSocket.CLOSING) {
|
|
1262
|
+
console.log(`[relay-client] User ${userId} connected via relay \u2014 creating local WS`);
|
|
1263
1263
|
this.createUserConnection(userId);
|
|
1264
1264
|
}
|
|
1265
1265
|
}
|
|
@@ -1272,12 +1272,18 @@ var RelayClient = class {
|
|
|
1272
1272
|
return;
|
|
1273
1273
|
}
|
|
1274
1274
|
let conn = this.userConnections.get(userId);
|
|
1275
|
-
if (!conn || conn.localWs.readyState
|
|
1275
|
+
if (!conn || conn.localWs.readyState >= NodeWebSocket.CLOSING) {
|
|
1276
1276
|
this.createUserConnection(userId);
|
|
1277
1277
|
conn = this.userConnections.get(userId);
|
|
1278
1278
|
if (!conn) return;
|
|
1279
1279
|
}
|
|
1280
1280
|
if (msg.type === "req" && msg.method === "connect") {
|
|
1281
|
+
if (conn.connectHandshakeComplete) {
|
|
1282
|
+
console.log(`[relay-client] New connect from ${userId} \u2014 creating fresh local WS for handshake`);
|
|
1283
|
+
this.createUserConnection(userId);
|
|
1284
|
+
conn = this.userConnections.get(userId);
|
|
1285
|
+
if (!conn) return;
|
|
1286
|
+
}
|
|
1281
1287
|
if (!conn.challengeNonce) {
|
|
1282
1288
|
console.log(`[relay-client] Connect request for ${userId} deferred \u2014 waiting for challenge nonce`);
|
|
1283
1289
|
conn.pendingConnect = msg;
|
|
@@ -1285,6 +1291,10 @@ var RelayClient = class {
|
|
|
1285
1291
|
}
|
|
1286
1292
|
this.injectDeviceIdentity(conn, msg);
|
|
1287
1293
|
}
|
|
1294
|
+
if (!conn.connectHandshakeComplete) {
|
|
1295
|
+
conn.pendingMessages.push(msg);
|
|
1296
|
+
return;
|
|
1297
|
+
}
|
|
1288
1298
|
if (conn.localWs.readyState === NodeWebSocket.CONNECTING) {
|
|
1289
1299
|
conn.localWs.once("open", () => {
|
|
1290
1300
|
conn.localWs.send(JSON.stringify(msg));
|
|
@@ -1333,7 +1343,8 @@ var RelayClient = class {
|
|
|
1333
1343
|
e2e: null,
|
|
1334
1344
|
connectHandshakeComplete: false,
|
|
1335
1345
|
challengeNonce: null,
|
|
1336
|
-
pendingConnect: null
|
|
1346
|
+
pendingConnect: null,
|
|
1347
|
+
pendingMessages: []
|
|
1337
1348
|
};
|
|
1338
1349
|
this.userConnections.set(userId, conn);
|
|
1339
1350
|
localWs.on("open", () => {
|
|
@@ -1386,6 +1397,13 @@ var RelayClient = class {
|
|
|
1386
1397
|
}
|
|
1387
1398
|
if (parsed.type === "res" && parsed.id === "connect-1" && parsed.ok) {
|
|
1388
1399
|
conn.connectHandshakeComplete = true;
|
|
1400
|
+
if (conn.pendingMessages.length > 0) {
|
|
1401
|
+
console.log(`[relay-client] Flushing ${conn.pendingMessages.length} buffered messages for ${userId}`);
|
|
1402
|
+
for (const queued of conn.pendingMessages) {
|
|
1403
|
+
conn.localWs.send(JSON.stringify(queued));
|
|
1404
|
+
}
|
|
1405
|
+
conn.pendingMessages = [];
|
|
1406
|
+
}
|
|
1389
1407
|
}
|
|
1390
1408
|
let innerMsg = msg;
|
|
1391
1409
|
if (conn.e2e) {
|
package/package.json
CHANGED