squad-openclaw 2026.2.196 → 2026.2.197

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -34
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -972,38 +972,21 @@ function readOperatorToken() {
972
972
  return null;
973
973
  }
974
974
  }
975
- function readClaimToken() {
976
- const tokenPath = path5.join(os.homedir(), ".squad", "claim-token");
975
+ var RELAY_STATE_PATH = path5.join(os.homedir(), ".squad", "relay.json");
976
+ function readRelayState() {
977
977
  try {
978
- const token = fs5.readFileSync(tokenPath, "utf-8").trim();
979
- return token || null;
980
- } catch {
981
- return null;
982
- }
983
- }
984
- function deleteClaimToken() {
985
- const tokenPath = path5.join(os.homedir(), ".squad", "claim-token");
986
- try {
987
- fs5.unlinkSync(tokenPath);
978
+ const raw = fs5.readFileSync(RELAY_STATE_PATH, "utf-8");
979
+ return JSON.parse(raw);
988
980
  } catch {
981
+ return {};
989
982
  }
990
983
  }
991
- function readRoomId() {
992
- const roomPath = path5.join(os.homedir(), ".squad", "relay-room-id");
993
- try {
994
- const id = fs5.readFileSync(roomPath, "utf-8").trim();
995
- return id || null;
996
- } catch {
997
- return null;
998
- }
999
- }
1000
- function writeRoomId(roomId) {
1001
- const roomPath = path5.join(os.homedir(), ".squad", "relay-room-id");
1002
- const dir = path5.dirname(roomPath);
984
+ function writeRelayState(state) {
985
+ const dir = path5.dirname(RELAY_STATE_PATH);
1003
986
  if (!fs5.existsSync(dir)) {
1004
987
  fs5.mkdirSync(dir, { recursive: true });
1005
988
  }
1006
- fs5.writeFileSync(roomPath, roomId, { mode: 384 });
989
+ fs5.writeFileSync(RELAY_STATE_PATH, JSON.stringify(state, null, 2), { mode: 384 });
1007
990
  }
1008
991
  function toBase64Url(buf) {
1009
992
  return buf.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
@@ -1064,14 +1047,15 @@ var RelayClient = class {
1064
1047
  /** Device keys for authenticating local WS connections to the gateway */
1065
1048
  deviceKeys;
1066
1049
  constructor(config) {
1050
+ const state = readRelayState();
1067
1051
  this.config = {
1068
1052
  relayUrl: config.relayUrl,
1069
1053
  localGatewayPort: config.localGatewayPort ?? 18789,
1070
1054
  operatorToken: config.operatorToken ?? readOperatorToken(),
1071
- claimToken: config.claimToken ?? null,
1072
- roomId: config.roomId ?? readRoomId()
1055
+ claimToken: config.claimToken ?? state.claimToken ?? null,
1056
+ roomId: config.roomId ?? state.roomId ?? null
1073
1057
  };
1074
- this.pendingClaimToken = this.config.claimToken ?? readClaimToken();
1058
+ this.pendingClaimToken = this.config.claimToken;
1075
1059
  this.deviceKeys = loadOrCreateDeviceKeys();
1076
1060
  }
1077
1061
  /** Start connecting to the relay */
@@ -1216,12 +1200,8 @@ var RelayClient = class {
1216
1200
  if (msg.roomId) {
1217
1201
  console.log(`[relay-client] Received room ID: ${msg.roomId.substring(0, 8)}...`);
1218
1202
  this.config.roomId = msg.roomId;
1219
- writeRoomId(msg.roomId);
1220
- if (this.pendingClaimToken) {
1221
- console.log("[relay-client] Claim token consumed, clearing");
1222
- this.pendingClaimToken = null;
1223
- deleteClaimToken();
1224
- }
1203
+ this.pendingClaimToken = null;
1204
+ writeRelayState({ roomId: msg.roomId });
1225
1205
  }
1226
1206
  }
1227
1207
  /** Route a message from the relay to the appropriate user's local WS */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squad-openclaw",
3
- "version": "2026.2.196",
3
+ "version": "2026.2.197",
4
4
  "description": "Entity registry, filesystem tools, and version management plugin for OpenClaw gateway",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",