@nextclaw/remote 0.1.28 → 0.1.30
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/LICENSE +21 -0
- package/dist/index.js +1 -22
- package/package.json +10 -11
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NextClaw contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.js
CHANGED
|
@@ -728,9 +728,8 @@ function isTerminalRemoteConnectorError(error) {
|
|
|
728
728
|
|
|
729
729
|
// src/remote-connector-retry.utils.ts
|
|
730
730
|
var BASE_RECONNECT_DELAY_MS = 3e3;
|
|
731
|
-
var MAX_RECONNECT_DELAY_MS = 6e4;
|
|
731
|
+
var MAX_RECONNECT_DELAY_MS = 30 * 6e4;
|
|
732
732
|
var RECONNECT_JITTER_RATIO = 0.2;
|
|
733
|
-
var MAX_CONSECUTIVE_RECONNECT_FAILURES = 6;
|
|
734
733
|
function resolveReconnectDelayMs(attempt, random) {
|
|
735
734
|
const exponentialDelayMs = Math.min(
|
|
736
735
|
BASE_RECONNECT_DELAY_MS * 2 ** Math.max(0, attempt - 1),
|
|
@@ -746,9 +745,6 @@ function formatReconnectDelay(delayMs) {
|
|
|
746
745
|
const seconds = delayMs / 1e3;
|
|
747
746
|
return Number.isInteger(seconds) ? `${seconds}s` : `${seconds.toFixed(1)}s`;
|
|
748
747
|
}
|
|
749
|
-
function buildReconnectHaltedMessage(message) {
|
|
750
|
-
return `${message} Auto-reconnect stopped after ${MAX_CONSECUTIVE_RECONNECT_FAILURES} consecutive failures to avoid wasting remote requests. Use Remote Access repair or restart the service after checking platform/network availability.`;
|
|
751
|
-
}
|
|
752
748
|
|
|
753
749
|
// src/remote-connector-websocket-error.utils.ts
|
|
754
750
|
function readRemoteConnectorSocketErrorMessage(event) {
|
|
@@ -1026,23 +1022,6 @@ var RemoteConnector = class {
|
|
|
1026
1022
|
if (cycle.outcome === "aborted" || !context.autoReconnect || opts.signal?.aborted) {
|
|
1027
1023
|
break;
|
|
1028
1024
|
}
|
|
1029
|
-
if (cycle.retryFailure && consecutiveReconnectFailures >= MAX_CONSECUTIVE_RECONNECT_FAILURES) {
|
|
1030
|
-
const haltedMessage = buildReconnectHaltedMessage(
|
|
1031
|
-
cycle.lastError ?? "Remote connector websocket failed."
|
|
1032
|
-
);
|
|
1033
|
-
this.writeRemoteState(opts.statusStore, {
|
|
1034
|
-
enabled: true,
|
|
1035
|
-
state: "error",
|
|
1036
|
-
deviceId: device?.id,
|
|
1037
|
-
deviceName: context.displayName,
|
|
1038
|
-
platformBase: context.platformBase,
|
|
1039
|
-
localOrigin: context.localOrigin,
|
|
1040
|
-
lastError: haltedMessage
|
|
1041
|
-
});
|
|
1042
|
-
this.logger.error(`Remote connector error: ${haltedMessage}`);
|
|
1043
|
-
preserveRuntimeError = true;
|
|
1044
|
-
break;
|
|
1045
|
-
}
|
|
1046
1025
|
const reconnectDelayMs = resolveReconnectDelayMs(cycle.retryFailure ? consecutiveReconnectFailures : 1, this.random);
|
|
1047
1026
|
this.logger.warn(
|
|
1048
1027
|
`Remote connector disconnected. Reconnecting in ${formatReconnectDelay(reconnectDelayMs)}...`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextclaw/remote",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.30",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Remote access runtime for NextClaw device registration, relay bridging, and service-managed connectivity.",
|
|
6
6
|
"type": "module",
|
|
@@ -27,17 +27,11 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
|
-
"scripts": {
|
|
31
|
-
"build": "tsup src/index.ts --format esm --dts --out-dir dist",
|
|
32
|
-
"prepack": "pnpm run build",
|
|
33
|
-
"lint": "eslint .",
|
|
34
|
-
"tsc": "tsc -p tsconfig.json"
|
|
35
|
-
},
|
|
36
30
|
"dependencies": {
|
|
37
|
-
"@nextclaw/core": "workspace:*",
|
|
38
|
-
"@nextclaw/server": "workspace:*",
|
|
39
31
|
"commander": "^12.1.0",
|
|
40
|
-
"ws": "^8.18.0"
|
|
32
|
+
"ws": "^8.18.0",
|
|
33
|
+
"@nextclaw/core": "0.9.12",
|
|
34
|
+
"@nextclaw/server": "0.10.36"
|
|
41
35
|
},
|
|
42
36
|
"devDependencies": {
|
|
43
37
|
"@types/node": "^20.17.6",
|
|
@@ -45,5 +39,10 @@
|
|
|
45
39
|
"prettier": "^3.3.3",
|
|
46
40
|
"tsup": "^8.3.5",
|
|
47
41
|
"typescript": "^5.6.3"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsup src/index.ts --format esm --dts --out-dir dist",
|
|
45
|
+
"lint": "eslint .",
|
|
46
|
+
"tsc": "tsc -p tsconfig.json"
|
|
48
47
|
}
|
|
49
|
-
}
|
|
48
|
+
}
|