squad-openclaw 2026.2.1805 → 2026.2.1807
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 +25 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1016,7 +1016,7 @@ function ensureDevicePaired(keys, operatorToken) {
|
|
|
1016
1016
|
paired = JSON.parse(fs5.readFileSync(pairedPath, "utf-8"));
|
|
1017
1017
|
} catch {
|
|
1018
1018
|
}
|
|
1019
|
-
if (paired[keys.deviceId]) return;
|
|
1019
|
+
if (paired[keys.deviceId]) return false;
|
|
1020
1020
|
const now = Date.now();
|
|
1021
1021
|
const scopes = ["operator.admin", "operator.approvals", "operator.pairing"];
|
|
1022
1022
|
paired[keys.deviceId] = {
|
|
@@ -1039,6 +1039,7 @@ function ensureDevicePaired(keys, operatorToken) {
|
|
|
1039
1039
|
if (!fs5.existsSync(dir)) fs5.mkdirSync(dir, { recursive: true });
|
|
1040
1040
|
fs5.writeFileSync(pairedPath, JSON.stringify(paired, null, 2), { mode: 384 });
|
|
1041
1041
|
console.log(`[relay-client] Device pairing entry created in paired.json`);
|
|
1042
|
+
return true;
|
|
1042
1043
|
}
|
|
1043
1044
|
function signDeviceIdentity(keys, clientId, clientMode, role, scopes, token) {
|
|
1044
1045
|
const signedAtMs = Date.now();
|
|
@@ -1079,7 +1080,11 @@ var RelayClient = class {
|
|
|
1079
1080
|
};
|
|
1080
1081
|
this.pendingClaimToken = this.config.claimToken;
|
|
1081
1082
|
this.deviceKeys = loadOrCreateRelayDeviceKeys();
|
|
1082
|
-
ensureDevicePaired(this.deviceKeys, this.config.operatorToken);
|
|
1083
|
+
const newEntry = ensureDevicePaired(this.deviceKeys, this.config.operatorToken);
|
|
1084
|
+
if (newEntry) {
|
|
1085
|
+
console.log("[relay-client] New device pairing entry created \u2014 restarting gateway to reload pairing store...");
|
|
1086
|
+
setTimeout(() => process.exit(0), 2e3);
|
|
1087
|
+
}
|
|
1083
1088
|
}
|
|
1084
1089
|
/** Start connecting to the relay */
|
|
1085
1090
|
start() {
|
|
@@ -1249,19 +1254,23 @@ var RelayClient = class {
|
|
|
1249
1254
|
}
|
|
1250
1255
|
/** Route a message from the relay to the appropriate user's local WS */
|
|
1251
1256
|
routeToUser(userId, innerMsg) {
|
|
1257
|
+
const msg = innerMsg;
|
|
1258
|
+
if (msg.type === "event" && typeof msg.event === "string" && msg.event.startsWith("relay.")) {
|
|
1259
|
+
if (msg.event === "relay.user.connected") {
|
|
1260
|
+
console.log(`[relay-client] User ${userId} connected via relay \u2014 creating local WS`);
|
|
1261
|
+
const existing = this.userConnections.get(userId);
|
|
1262
|
+
if (!existing || existing.localWs.readyState !== NodeWebSocket.OPEN) {
|
|
1263
|
+
this.createUserConnection(userId);
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
return;
|
|
1267
|
+
}
|
|
1252
1268
|
let conn = this.userConnections.get(userId);
|
|
1253
1269
|
if (!conn || conn.localWs.readyState !== NodeWebSocket.OPEN) {
|
|
1254
1270
|
this.createUserConnection(userId);
|
|
1255
1271
|
conn = this.userConnections.get(userId);
|
|
1256
1272
|
if (!conn) return;
|
|
1257
1273
|
}
|
|
1258
|
-
if (conn.localWs.readyState === NodeWebSocket.CONNECTING) {
|
|
1259
|
-
conn.localWs.once("open", () => {
|
|
1260
|
-
conn.localWs.send(JSON.stringify(innerMsg));
|
|
1261
|
-
});
|
|
1262
|
-
return;
|
|
1263
|
-
}
|
|
1264
|
-
const msg = innerMsg;
|
|
1265
1274
|
if (msg.type === "req" && msg.method === "connect") {
|
|
1266
1275
|
const params = msg.params ?? {};
|
|
1267
1276
|
if (this.config.operatorToken) {
|
|
@@ -1280,6 +1289,13 @@ var RelayClient = class {
|
|
|
1280
1289
|
);
|
|
1281
1290
|
msg.params = params;
|
|
1282
1291
|
conn.connectHandshakeComplete = false;
|
|
1292
|
+
console.log(`[relay-client] Injected device identity for user ${userId}: ${this.deviceKeys.deviceId.substring(0, 12)}...`);
|
|
1293
|
+
}
|
|
1294
|
+
if (conn.localWs.readyState === NodeWebSocket.CONNECTING) {
|
|
1295
|
+
conn.localWs.once("open", () => {
|
|
1296
|
+
conn.localWs.send(JSON.stringify(msg));
|
|
1297
|
+
});
|
|
1298
|
+
return;
|
|
1283
1299
|
}
|
|
1284
1300
|
conn.localWs.send(JSON.stringify(msg));
|
|
1285
1301
|
}
|
package/package.json
CHANGED