@nextclaw/remote 0.1.20 → 0.1.23
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 +27 -3
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -739,6 +739,19 @@ var RemoteAppAdapter = class {
|
|
|
739
739
|
}
|
|
740
740
|
};
|
|
741
741
|
|
|
742
|
+
// src/remote-connector-error.ts
|
|
743
|
+
var TERMINAL_REMOTE_ERROR_PATTERNS = [
|
|
744
|
+
/invalid or expired token/i,
|
|
745
|
+
/missing bearer token/i,
|
|
746
|
+
/token expired/i,
|
|
747
|
+
/token is invalid/i,
|
|
748
|
+
/run "nextclaw login"/i
|
|
749
|
+
];
|
|
750
|
+
function isTerminalRemoteConnectorError(error) {
|
|
751
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
752
|
+
return TERMINAL_REMOTE_ERROR_PATTERNS.some((pattern) => pattern.test(message));
|
|
753
|
+
}
|
|
754
|
+
|
|
742
755
|
// src/remote-connector.ts
|
|
743
756
|
var RemoteConnector = class {
|
|
744
757
|
constructor(deps) {
|
|
@@ -934,7 +947,7 @@ var RemoteConnector = class {
|
|
|
934
947
|
lastError: null
|
|
935
948
|
});
|
|
936
949
|
}
|
|
937
|
-
return { device,
|
|
950
|
+
return { device, outcome: outcome === "aborted" ? "aborted" : "retry" };
|
|
938
951
|
} catch (error) {
|
|
939
952
|
const message = error instanceof Error ? error.message : String(error);
|
|
940
953
|
this.writeRemoteState(params.opts.statusStore, {
|
|
@@ -947,7 +960,10 @@ var RemoteConnector = class {
|
|
|
947
960
|
lastError: message
|
|
948
961
|
});
|
|
949
962
|
this.logger.error(`Remote connector error: ${message}`);
|
|
950
|
-
return {
|
|
963
|
+
return {
|
|
964
|
+
device: params.device,
|
|
965
|
+
outcome: isTerminalRemoteConnectorError(error) ? "stop" : "retry"
|
|
966
|
+
};
|
|
951
967
|
}
|
|
952
968
|
}
|
|
953
969
|
async run(opts = {}) {
|
|
@@ -957,10 +973,15 @@ var RemoteConnector = class {
|
|
|
957
973
|
);
|
|
958
974
|
await relayBridge.ensureLocalUiHealthy();
|
|
959
975
|
let device = null;
|
|
976
|
+
let preserveRuntimeError = false;
|
|
960
977
|
while (!opts.signal?.aborted) {
|
|
961
978
|
const cycle = await this.runCycle({ device, context, relayBridge, opts });
|
|
962
979
|
device = cycle.device;
|
|
963
|
-
if (cycle.
|
|
980
|
+
if (cycle.outcome === "stop") {
|
|
981
|
+
preserveRuntimeError = true;
|
|
982
|
+
break;
|
|
983
|
+
}
|
|
984
|
+
if (cycle.outcome === "aborted" || !context.autoReconnect || opts.signal?.aborted) {
|
|
964
985
|
break;
|
|
965
986
|
}
|
|
966
987
|
this.logger.warn("Remote connector disconnected. Reconnecting in 3s...");
|
|
@@ -970,6 +991,9 @@ var RemoteConnector = class {
|
|
|
970
991
|
break;
|
|
971
992
|
}
|
|
972
993
|
}
|
|
994
|
+
if (preserveRuntimeError) {
|
|
995
|
+
return;
|
|
996
|
+
}
|
|
973
997
|
this.writeRemoteState(opts.statusStore, {
|
|
974
998
|
enabled: opts.mode === "service" ? true : Boolean(context.config.remote.enabled),
|
|
975
999
|
state: opts.signal?.aborted ? "disconnected" : "disabled",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/remote",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.23",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Remote access runtime for NextClaw device registration, relay bridging, and service-managed connectivity.",
|
|
6
6
|
"type": "module",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"commander": "^12.1.0",
|
|
32
32
|
"ws": "^8.18.0",
|
|
33
|
-
"@nextclaw/server": "0.10.
|
|
34
|
-
"@nextclaw/core": "0.9.
|
|
33
|
+
"@nextclaw/server": "0.10.27",
|
|
34
|
+
"@nextclaw/core": "0.9.10"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^20.17.6",
|