squad-openclaw 2026.2.1809 → 2026.2.1810
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 +39 -20
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1278,25 +1278,12 @@ var RelayClient = class {
|
|
|
1278
1278
|
if (!conn) return;
|
|
1279
1279
|
}
|
|
1280
1280
|
if (msg.type === "req" && msg.method === "connect") {
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1281
|
+
if (!conn.challengeNonce) {
|
|
1282
|
+
console.log(`[relay-client] Connect request for ${userId} deferred \u2014 waiting for challenge nonce`);
|
|
1283
|
+
conn.pendingConnect = msg;
|
|
1284
|
+
return;
|
|
1284
1285
|
}
|
|
1285
|
-
|
|
1286
|
-
const role = params.role ?? "operator";
|
|
1287
|
-
const scopes = params.scopes ?? [];
|
|
1288
|
-
params.device = signDeviceIdentity(
|
|
1289
|
-
this.deviceKeys,
|
|
1290
|
-
client.id ?? "cli",
|
|
1291
|
-
client.mode ?? "ui",
|
|
1292
|
-
role,
|
|
1293
|
-
scopes,
|
|
1294
|
-
this.config.operatorToken,
|
|
1295
|
-
conn.challengeNonce
|
|
1296
|
-
);
|
|
1297
|
-
msg.params = params;
|
|
1298
|
-
conn.connectHandshakeComplete = false;
|
|
1299
|
-
console.log(`[relay-client] Injected device identity for user ${userId}: ${this.deviceKeys.deviceId.substring(0, 12)}...`);
|
|
1286
|
+
this.injectDeviceIdentity(conn, msg);
|
|
1300
1287
|
}
|
|
1301
1288
|
if (conn.localWs.readyState === NodeWebSocket.CONNECTING) {
|
|
1302
1289
|
conn.localWs.once("open", () => {
|
|
@@ -1306,6 +1293,28 @@ var RelayClient = class {
|
|
|
1306
1293
|
}
|
|
1307
1294
|
conn.localWs.send(JSON.stringify(msg));
|
|
1308
1295
|
}
|
|
1296
|
+
/** Inject auth token and device identity into a connect request */
|
|
1297
|
+
injectDeviceIdentity(conn, msg) {
|
|
1298
|
+
const params = msg.params ?? {};
|
|
1299
|
+
if (this.config.operatorToken) {
|
|
1300
|
+
params.auth = { token: this.config.operatorToken };
|
|
1301
|
+
}
|
|
1302
|
+
const client = params.client ?? {};
|
|
1303
|
+
const role = params.role ?? "operator";
|
|
1304
|
+
const scopes = params.scopes ?? [];
|
|
1305
|
+
params.device = signDeviceIdentity(
|
|
1306
|
+
this.deviceKeys,
|
|
1307
|
+
client.id ?? "cli",
|
|
1308
|
+
client.mode ?? "ui",
|
|
1309
|
+
role,
|
|
1310
|
+
scopes,
|
|
1311
|
+
this.config.operatorToken,
|
|
1312
|
+
conn.challengeNonce
|
|
1313
|
+
);
|
|
1314
|
+
msg.params = params;
|
|
1315
|
+
conn.connectHandshakeComplete = false;
|
|
1316
|
+
console.log(`[relay-client] Injected device identity for ${conn.userId}: nonce=${conn.challengeNonce?.substring(0, 12)}...`);
|
|
1317
|
+
}
|
|
1309
1318
|
/** Create a local WS connection to the gateway for a specific user */
|
|
1310
1319
|
createUserConnection(userId) {
|
|
1311
1320
|
const existing = this.userConnections.get(userId);
|
|
@@ -1323,7 +1332,8 @@ var RelayClient = class {
|
|
|
1323
1332
|
userId,
|
|
1324
1333
|
e2e: null,
|
|
1325
1334
|
connectHandshakeComplete: false,
|
|
1326
|
-
challengeNonce: null
|
|
1335
|
+
challengeNonce: null,
|
|
1336
|
+
pendingConnect: null
|
|
1327
1337
|
};
|
|
1328
1338
|
this.userConnections.set(userId, conn);
|
|
1329
1339
|
localWs.on("open", () => {
|
|
@@ -1362,7 +1372,16 @@ var RelayClient = class {
|
|
|
1362
1372
|
const payload = parsed.payload;
|
|
1363
1373
|
if (payload?.nonce) {
|
|
1364
1374
|
conn.challengeNonce = payload.nonce;
|
|
1365
|
-
console.log(`[relay-client] Captured challenge nonce for
|
|
1375
|
+
console.log(`[relay-client] Captured challenge nonce for ${userId}: ${conn.challengeNonce.substring(0, 12)}...`);
|
|
1376
|
+
if (conn.pendingConnect) {
|
|
1377
|
+
const pending = conn.pendingConnect;
|
|
1378
|
+
conn.pendingConnect = null;
|
|
1379
|
+
console.log(`[relay-client] Flushing deferred connect for ${userId}`);
|
|
1380
|
+
this.injectDeviceIdentity(conn, pending);
|
|
1381
|
+
if (conn.localWs.readyState === NodeWebSocket.OPEN) {
|
|
1382
|
+
conn.localWs.send(JSON.stringify(pending));
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1366
1385
|
}
|
|
1367
1386
|
}
|
|
1368
1387
|
if (parsed.type === "res" && parsed.id === "connect-1" && parsed.ok) {
|
package/package.json
CHANGED