squad-openclaw 2026.2.181 → 2026.2.192
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 +31 -2
- package/package.json +6 -1
package/dist/index.js
CHANGED
|
@@ -981,6 +981,22 @@ function deriveGatewayId() {
|
|
|
981
981
|
}
|
|
982
982
|
return os.hostname().replace(/\.local$/, "");
|
|
983
983
|
}
|
|
984
|
+
function readClaimToken() {
|
|
985
|
+
const tokenPath = path5.join(os.homedir(), ".squad", "claim-token");
|
|
986
|
+
try {
|
|
987
|
+
const token = fs5.readFileSync(tokenPath, "utf-8").trim();
|
|
988
|
+
return token || null;
|
|
989
|
+
} catch {
|
|
990
|
+
return null;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
function deleteClaimToken() {
|
|
994
|
+
const tokenPath = path5.join(os.homedir(), ".squad", "claim-token");
|
|
995
|
+
try {
|
|
996
|
+
fs5.unlinkSync(tokenPath);
|
|
997
|
+
} catch {
|
|
998
|
+
}
|
|
999
|
+
}
|
|
984
1000
|
var RelayClient = class {
|
|
985
1001
|
config;
|
|
986
1002
|
relayWs = null;
|
|
@@ -990,13 +1006,17 @@ var RelayClient = class {
|
|
|
990
1006
|
reconnectTimer = null;
|
|
991
1007
|
shouldReconnect = true;
|
|
992
1008
|
destroyed = false;
|
|
1009
|
+
/** Pending claim token — sent on first successful connect, then cleared */
|
|
1010
|
+
pendingClaimToken = null;
|
|
993
1011
|
constructor(config) {
|
|
994
1012
|
this.config = {
|
|
995
1013
|
relayUrl: config.relayUrl,
|
|
996
1014
|
gatewayId: config.gatewayId ?? deriveGatewayId(),
|
|
997
1015
|
localGatewayPort: config.localGatewayPort ?? 18789,
|
|
998
|
-
operatorToken: config.operatorToken ?? readOperatorToken()
|
|
1016
|
+
operatorToken: config.operatorToken ?? readOperatorToken(),
|
|
1017
|
+
claimToken: config.claimToken ?? null
|
|
999
1018
|
};
|
|
1019
|
+
this.pendingClaimToken = this.config.claimToken ?? readClaimToken();
|
|
1000
1020
|
}
|
|
1001
1021
|
/** Start connecting to the relay */
|
|
1002
1022
|
start() {
|
|
@@ -1030,7 +1050,11 @@ var RelayClient = class {
|
|
|
1030
1050
|
// ── Relay Connection ──
|
|
1031
1051
|
connectToRelay() {
|
|
1032
1052
|
if (this.destroyed) return;
|
|
1033
|
-
|
|
1053
|
+
let wsUrl = `${this.config.relayUrl}/gw/${this.config.gatewayId}`;
|
|
1054
|
+
if (this.pendingClaimToken) {
|
|
1055
|
+
wsUrl += `?claim=${encodeURIComponent(this.pendingClaimToken)}`;
|
|
1056
|
+
console.log(`[relay-client] Attaching claim token to connection`);
|
|
1057
|
+
}
|
|
1034
1058
|
console.log(`[relay-client] Connecting to ${wsUrl}`);
|
|
1035
1059
|
try {
|
|
1036
1060
|
this.relayWs = new NodeWebSocket(wsUrl);
|
|
@@ -1042,6 +1066,11 @@ var RelayClient = class {
|
|
|
1042
1066
|
this.relayWs.on("open", () => {
|
|
1043
1067
|
console.log("[relay-client] Connected to relay");
|
|
1044
1068
|
this.reconnectAttempts = 0;
|
|
1069
|
+
if (this.pendingClaimToken) {
|
|
1070
|
+
console.log("[relay-client] Claim token sent, clearing");
|
|
1071
|
+
this.pendingClaimToken = null;
|
|
1072
|
+
deleteClaimToken();
|
|
1073
|
+
}
|
|
1045
1074
|
});
|
|
1046
1075
|
this.relayWs.on("message", (data) => {
|
|
1047
1076
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "squad-openclaw",
|
|
3
|
-
"version": "2026.2.
|
|
3
|
+
"version": "2026.2.192",
|
|
4
4
|
"description": "Entity registry, filesystem tools, and version management plugin for OpenClaw gateway",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
"build": "tsup",
|
|
25
25
|
"prepublishOnly": "npm run build"
|
|
26
26
|
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/WorldBrain/squad.git",
|
|
30
|
+
"directory": "extensions/squad-openclaw"
|
|
31
|
+
},
|
|
27
32
|
"keywords": [
|
|
28
33
|
"openclaw",
|
|
29
34
|
"openclaw-plugin",
|