@nextclaw/remote 0.1.25 → 0.1.26
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
|
@@ -707,6 +707,19 @@ var RemoteAppAdapter = class {
|
|
|
707
707
|
}
|
|
708
708
|
};
|
|
709
709
|
|
|
710
|
+
// src/remote-connector-error.ts
|
|
711
|
+
var TERMINAL_REMOTE_ERROR_PATTERNS = [
|
|
712
|
+
/invalid or expired token/i,
|
|
713
|
+
/missing bearer token/i,
|
|
714
|
+
/token expired/i,
|
|
715
|
+
/token is invalid/i,
|
|
716
|
+
/run "nextclaw login"/i
|
|
717
|
+
];
|
|
718
|
+
function isTerminalRemoteConnectorError(error) {
|
|
719
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
720
|
+
return TERMINAL_REMOTE_ERROR_PATTERNS.some((pattern) => pattern.test(message));
|
|
721
|
+
}
|
|
722
|
+
|
|
710
723
|
// src/remote-connector.ts
|
|
711
724
|
var RemoteConnector = class {
|
|
712
725
|
constructor(deps) {
|
|
@@ -902,7 +915,7 @@ var RemoteConnector = class {
|
|
|
902
915
|
lastError: null
|
|
903
916
|
});
|
|
904
917
|
}
|
|
905
|
-
return { device,
|
|
918
|
+
return { device, outcome: outcome === "aborted" ? "aborted" : "retry" };
|
|
906
919
|
} catch (error) {
|
|
907
920
|
const message = error instanceof Error ? error.message : String(error);
|
|
908
921
|
this.writeRemoteState(params.opts.statusStore, {
|
|
@@ -915,7 +928,10 @@ var RemoteConnector = class {
|
|
|
915
928
|
lastError: message
|
|
916
929
|
});
|
|
917
930
|
this.logger.error(`Remote connector error: ${message}`);
|
|
918
|
-
return {
|
|
931
|
+
return {
|
|
932
|
+
device: params.device,
|
|
933
|
+
outcome: isTerminalRemoteConnectorError(error) ? "stop" : "retry"
|
|
934
|
+
};
|
|
919
935
|
}
|
|
920
936
|
}
|
|
921
937
|
async run(opts = {}) {
|
|
@@ -925,10 +941,15 @@ var RemoteConnector = class {
|
|
|
925
941
|
);
|
|
926
942
|
await relayBridge.ensureLocalUiHealthy();
|
|
927
943
|
let device = null;
|
|
944
|
+
let preserveRuntimeError = false;
|
|
928
945
|
while (!opts.signal?.aborted) {
|
|
929
946
|
const cycle = await this.runCycle({ device, context, relayBridge, opts });
|
|
930
947
|
device = cycle.device;
|
|
931
|
-
if (cycle.
|
|
948
|
+
if (cycle.outcome === "stop") {
|
|
949
|
+
preserveRuntimeError = true;
|
|
950
|
+
break;
|
|
951
|
+
}
|
|
952
|
+
if (cycle.outcome === "aborted" || !context.autoReconnect || opts.signal?.aborted) {
|
|
932
953
|
break;
|
|
933
954
|
}
|
|
934
955
|
this.logger.warn("Remote connector disconnected. Reconnecting in 3s...");
|
|
@@ -938,6 +959,9 @@ var RemoteConnector = class {
|
|
|
938
959
|
break;
|
|
939
960
|
}
|
|
940
961
|
}
|
|
962
|
+
if (preserveRuntimeError) {
|
|
963
|
+
return;
|
|
964
|
+
}
|
|
941
965
|
this.writeRemoteState(opts.statusStore, {
|
|
942
966
|
enabled: opts.mode === "service" ? true : Boolean(context.config.remote.enabled),
|
|
943
967
|
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.26",
|
|
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/
|
|
34
|
-
"@nextclaw/
|
|
33
|
+
"@nextclaw/server": "0.10.32",
|
|
34
|
+
"@nextclaw/core": "0.9.11"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^20.17.6",
|