echoclaw-relay-agent 0.2.1 → 0.2.3
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/main.js +25 -5
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -345,8 +345,20 @@ function connect() {
|
|
|
345
345
|
handleMessage(data.toString());
|
|
346
346
|
});
|
|
347
347
|
ws.on("close", (code, reason) => {
|
|
348
|
-
|
|
348
|
+
const reasonStr = reason.toString();
|
|
349
349
|
stopHeartbeat();
|
|
350
|
+
if (code === 4004) {
|
|
351
|
+
if (!_stopped) {
|
|
352
|
+
console.error("[relay-agent] \u274C Pairing code rejected by server. Session may have expired.");
|
|
353
|
+
console.error(" Please re-pair: npx echoclaw-relay-agent (without --code)");
|
|
354
|
+
sessionKey = null;
|
|
355
|
+
sessionId = null;
|
|
356
|
+
_stopped = true;
|
|
357
|
+
clearSession();
|
|
358
|
+
}
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
console.log(`[relay-agent] Disconnected (code=${code}${reasonStr ? `, reason=${reasonStr}` : ""})`);
|
|
350
362
|
scheduleReconnect();
|
|
351
363
|
});
|
|
352
364
|
ws.on("error", (err) => {
|
|
@@ -379,9 +391,17 @@ async function handleMessage(raw) {
|
|
|
379
391
|
sendRaw({ version: 1, session_id: msg.session_id, msg_id: makeId(), type: "PING", sender_role: "agent" });
|
|
380
392
|
break;
|
|
381
393
|
case "CLOSE":
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
394
|
+
if (msg.payload === "INVALID_CODE") {
|
|
395
|
+
console.error("[relay-agent] \u274C Session expired or pairing code is invalid.");
|
|
396
|
+
console.error(" Please re-pair with a new code from EchoClaw Desktop.");
|
|
397
|
+
sessionKey = null;
|
|
398
|
+
sessionId = null;
|
|
399
|
+
_stopped = true;
|
|
400
|
+
clearSession();
|
|
401
|
+
} else {
|
|
402
|
+
console.log("[relay-agent] Session closed by peer");
|
|
403
|
+
sessionKey = null;
|
|
404
|
+
}
|
|
385
405
|
break;
|
|
386
406
|
}
|
|
387
407
|
}
|
|
@@ -903,7 +923,7 @@ function isServiceInstalled() {
|
|
|
903
923
|
}
|
|
904
924
|
|
|
905
925
|
// src/main.ts
|
|
906
|
-
var VERSION = "0.2.
|
|
926
|
+
var VERSION = "0.2.3";
|
|
907
927
|
function parseArgs() {
|
|
908
928
|
const args = process.argv.slice(2);
|
|
909
929
|
const opts = {
|