remotelink 0.4.4 → 0.4.5
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/README.md +2 -2
- package/dist/index.js +53 -6
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ npx remotelink --help Show help
|
|
|
53
53
|
|
|
54
54
|
The package also exposes the aliases `remote-link` and `remote-arc`.
|
|
55
55
|
|
|
56
|
-
In
|
|
56
|
+
In 0.4.5, background recovery and Relay reconnect are separate. A normal npx remotelink@latest launch can safely hand off a known older background Agent to the current release without creating two executors.
|
|
57
57
|
Recovery installs a user service (macOS/Linux) or a hidden login supervisor
|
|
58
58
|
(Windows), which takes over when the executing Agent ends. Only one updated
|
|
59
59
|
Agent owns execution; additional terminals follow its operation log and offer
|
|
@@ -62,7 +62,7 @@ execution lease. Turning recovery off preserves current execution. Explicit
|
|
|
62
62
|
Stop background Agent also ends that Agent's work. Windows recovery needs the
|
|
63
63
|
supervisor to remain running; killing it requires a local relaunch or login.
|
|
64
64
|
Sleep/power loss still makes the device unavailable. All concurrent instances
|
|
65
|
-
must be updated; pre-0.4.4 Agents do not participate in the execution lease.
|
|
65
|
+
must be updated; pre-0.4.4 Agents do not participate in the execution lease. When the installed version is identified as an older release, 0.4.5 stops that legacy background process, preserves pairing and policy, installs the replacement bundle, and verifies the replacement service. Unknown legacy processes still fail closed instead of being killed automatically.
|
|
66
66
|
|
|
67
67
|
## Native execution core
|
|
68
68
|
|
package/dist/index.js
CHANGED
|
@@ -6959,6 +6959,20 @@ import fs6 from "fs/promises";
|
|
|
6959
6959
|
import { spawn as spawn4 } from "child_process";
|
|
6960
6960
|
var LegacyBackgroundAgentError = class extends Error {
|
|
6961
6961
|
};
|
|
6962
|
+
function parseReleaseVersion(value) {
|
|
6963
|
+
if (!value) return null;
|
|
6964
|
+
const match = value.trim().match(/^(\d+)\.(\d+)\.(\d+)$/);
|
|
6965
|
+
if (!match) return null;
|
|
6966
|
+
return [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
6967
|
+
}
|
|
6968
|
+
function isOlderRelease(current, target) {
|
|
6969
|
+
const a = parseReleaseVersion(current);
|
|
6970
|
+
const b = parseReleaseVersion(target);
|
|
6971
|
+
if (!a || !b) return false;
|
|
6972
|
+
if (a[0] !== b[0]) return a[0] < b[0];
|
|
6973
|
+
if (a[1] !== b[1]) return a[1] < b[1];
|
|
6974
|
+
return a[2] < b[2];
|
|
6975
|
+
}
|
|
6962
6976
|
function windowsSupervisorLaunchScript(node, bundle) {
|
|
6963
6977
|
const quote = (value) => "'" + value.replaceAll("'", "''") + "'";
|
|
6964
6978
|
return "Start-Process -FilePath " + quote(node) + " -ArgumentList " + quote('"' + bundle + '" --supervise') + " -WindowStyle Hidden | Out-Null";
|
|
@@ -7331,10 +7345,36 @@ WantedBy=default.target
|
|
|
7331
7345
|
await wait(500);
|
|
7332
7346
|
participates = await leaseActive(AGENT_DIR);
|
|
7333
7347
|
}
|
|
7334
|
-
if (!participates)
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7348
|
+
if (!participates) {
|
|
7349
|
+
const canUpgradeLegacy = isOlderRelease(before.version, options2.version) && before.enabled;
|
|
7350
|
+
if (!canUpgradeLegacy) {
|
|
7351
|
+
throw new LegacyBackgroundAgentError(
|
|
7352
|
+
"An existing background Agent does not hold the execution lease and cannot be identified as a safe older release. Stop it locally before retrying; this launch will not create a competing executor."
|
|
7353
|
+
);
|
|
7354
|
+
}
|
|
7355
|
+
if (platform === "darwin") await disableMac(true);
|
|
7356
|
+
else if (platform === "win32") await disableWindows(true);
|
|
7357
|
+
else if (platform === "linux") await disableLinux(true);
|
|
7358
|
+
else {
|
|
7359
|
+
throw new LegacyBackgroundAgentError(
|
|
7360
|
+
"The existing background Agent is older, but automatic handoff is not supported on this operating system."
|
|
7361
|
+
);
|
|
7362
|
+
}
|
|
7363
|
+
let stopped = false;
|
|
7364
|
+
for (let attempt = 0; attempt < 40; attempt++) {
|
|
7365
|
+
const status2 = await backgroundAgentStatus2();
|
|
7366
|
+
if (!status2.workerPid) {
|
|
7367
|
+
stopped = true;
|
|
7368
|
+
break;
|
|
7369
|
+
}
|
|
7370
|
+
await wait(250);
|
|
7371
|
+
}
|
|
7372
|
+
if (!stopped) {
|
|
7373
|
+
throw new LegacyBackgroundAgentError(
|
|
7374
|
+
"The older background Agent did not stop cleanly. Automatic upgrade was aborted before installing the new executor."
|
|
7375
|
+
);
|
|
7376
|
+
}
|
|
7377
|
+
}
|
|
7338
7378
|
}
|
|
7339
7379
|
if (platform === "darwin")
|
|
7340
7380
|
await enableMac(sourcePath, preserveCurrent, options2.version);
|
|
@@ -7374,7 +7414,7 @@ var {
|
|
|
7374
7414
|
} = createBackgroundController();
|
|
7375
7415
|
|
|
7376
7416
|
// src/index.ts
|
|
7377
|
-
var VERSION = "0.4.
|
|
7417
|
+
var VERSION = "0.4.5";
|
|
7378
7418
|
var DEFAULT_ORIGIN = "https://mcp.remotearc.app";
|
|
7379
7419
|
var CONFIG_DIR = path7.join(os4.homedir(), ".remotearc");
|
|
7380
7420
|
var CONFIG_PATH = path7.join(CONFIG_DIR, "config.json");
|
|
@@ -7499,7 +7539,7 @@ function logLine(level, message) {
|
|
|
7499
7539
|
function banner() {
|
|
7500
7540
|
process3.stdout.write("\n");
|
|
7501
7541
|
process3.stdout.write(bold("Remote Arc") + " " + dim(`v${VERSION}`) + "\n");
|
|
7502
|
-
process3.stdout.write(dim("
|
|
7542
|
+
process3.stdout.write(dim("Persistent agent runtime for your computers") + "\n\n");
|
|
7503
7543
|
}
|
|
7504
7544
|
function argFlag(name) {
|
|
7505
7545
|
return process3.argv.includes(name);
|
|
@@ -8032,6 +8072,13 @@ async function main() {
|
|
|
8032
8072
|
if (agentMode && config.backgroundEnabled !== true) return;
|
|
8033
8073
|
if (!agentMode && !foregroundMode && config.backgroundEnabled === true) {
|
|
8034
8074
|
try {
|
|
8075
|
+
const existing = await backgroundAgentStatus().catch(() => null);
|
|
8076
|
+
if (existing?.active && existing.version && existing.version !== VERSION) {
|
|
8077
|
+
logLine(
|
|
8078
|
+
"info",
|
|
8079
|
+
`Background Agent v${existing.version} detected \xB7 checking safe handoff to v${VERSION}\u2026`
|
|
8080
|
+
);
|
|
8081
|
+
}
|
|
8035
8082
|
const status = await enableBackgroundAgent(SELF_PATH, { version: VERSION });
|
|
8036
8083
|
if (status.supported && status.enabled && status.active) {
|
|
8037
8084
|
banner();
|