remotelink 0.4.5 → 0.4.6
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 +38 -18
- package/dist/index.js.map +1 -1
- package/package.json +2 -4
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 0.4.
|
|
56
|
+
In 0.4.6, 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. When the installed version is identified as an older release, 0.4.
|
|
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.6 performs a controlled handoff even when that older Agent still owns the execution lease: it stops the known Remote Arc worker and supervisor, waits for the lease to release, preserves pairing and policy, installs the replacement bundle, and verifies that the replacement worker owns execution. Unknown processes still fail closed instead of being killed automatically. 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
|
@@ -7339,19 +7339,11 @@ WantedBy=default.target
|
|
|
7339
7339
|
async function enableBackgroundAgent2(sourcePath, options2 = {}) {
|
|
7340
7340
|
const preserveCurrent = options2.preserveCurrent ?? false;
|
|
7341
7341
|
const before = await backgroundAgentStatus2();
|
|
7342
|
+
let upgradeHandoff = false;
|
|
7342
7343
|
if (before.workerPid && before.workerPid !== process.pid) {
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
participates = await leaseActive(AGENT_DIR);
|
|
7347
|
-
}
|
|
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
|
-
}
|
|
7344
|
+
const knownOlderRelease = before.enabled && isOlderRelease(before.version, options2.version);
|
|
7345
|
+
if (knownOlderRelease) {
|
|
7346
|
+
upgradeHandoff = true;
|
|
7355
7347
|
if (platform === "darwin") await disableMac(true);
|
|
7356
7348
|
else if (platform === "win32") await disableWindows(true);
|
|
7357
7349
|
else if (platform === "linux") await disableLinux(true);
|
|
@@ -7374,6 +7366,27 @@ WantedBy=default.target
|
|
|
7374
7366
|
"The older background Agent did not stop cleanly. Automatic upgrade was aborted before installing the new executor."
|
|
7375
7367
|
);
|
|
7376
7368
|
}
|
|
7369
|
+
let leaseReleased = !await leaseActive(AGENT_DIR);
|
|
7370
|
+
for (let attempt = 0; !leaseReleased && attempt < 60; attempt++) {
|
|
7371
|
+
await wait(250);
|
|
7372
|
+
leaseReleased = !await leaseActive(AGENT_DIR);
|
|
7373
|
+
}
|
|
7374
|
+
if (!leaseReleased) {
|
|
7375
|
+
throw new LegacyBackgroundAgentError(
|
|
7376
|
+
"The older background Agent stopped, but its execution lease did not release in time. Automatic upgrade was aborted before starting the replacement executor."
|
|
7377
|
+
);
|
|
7378
|
+
}
|
|
7379
|
+
} else {
|
|
7380
|
+
let participates = await leaseActive(AGENT_DIR);
|
|
7381
|
+
for (let attempt = 0; !participates && attempt < 6; attempt++) {
|
|
7382
|
+
await wait(500);
|
|
7383
|
+
participates = await leaseActive(AGENT_DIR);
|
|
7384
|
+
}
|
|
7385
|
+
if (!participates) {
|
|
7386
|
+
throw new LegacyBackgroundAgentError(
|
|
7387
|
+
"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."
|
|
7388
|
+
);
|
|
7389
|
+
}
|
|
7377
7390
|
}
|
|
7378
7391
|
}
|
|
7379
7392
|
if (platform === "darwin")
|
|
@@ -7383,11 +7396,17 @@ WantedBy=default.target
|
|
|
7383
7396
|
else if (platform === "linux")
|
|
7384
7397
|
await enableLinux(sourcePath, preserveCurrent, options2.version);
|
|
7385
7398
|
else return backgroundAgentStatus2();
|
|
7386
|
-
|
|
7399
|
+
const verifyAttempts = upgradeHandoff ? 80 : 20;
|
|
7400
|
+
for (let attempt = 0; attempt < verifyAttempts; attempt++) {
|
|
7387
7401
|
const status2 = await backgroundAgentStatus2();
|
|
7388
|
-
if (status2.enabled && status2.active)
|
|
7402
|
+
if (status2.enabled && status2.active) {
|
|
7403
|
+
if (!upgradeHandoff) return status2;
|
|
7404
|
+
const versionMatches = !options2.version || status2.version === options2.version;
|
|
7405
|
+
const workerOwnsLease = Boolean(status2.workerPid) && await leaseActive(AGENT_DIR);
|
|
7406
|
+
if (versionMatches && workerOwnsLease) return status2;
|
|
7407
|
+
}
|
|
7389
7408
|
if (!status2.supported) return status2;
|
|
7390
|
-
await wait(200);
|
|
7409
|
+
await wait(upgradeHandoff ? 250 : 200);
|
|
7391
7410
|
}
|
|
7392
7411
|
const status = await backgroundAgentStatus2();
|
|
7393
7412
|
throw new Error(
|
|
@@ -7414,7 +7433,7 @@ var {
|
|
|
7414
7433
|
} = createBackgroundController();
|
|
7415
7434
|
|
|
7416
7435
|
// src/index.ts
|
|
7417
|
-
var VERSION = "0.4.
|
|
7436
|
+
var VERSION = "0.4.6";
|
|
7418
7437
|
var DEFAULT_ORIGIN = "https://mcp.remotearc.app";
|
|
7419
7438
|
var CONFIG_DIR = path7.join(os4.homedir(), ".remotearc");
|
|
7420
7439
|
var CONFIG_PATH = path7.join(CONFIG_DIR, "config.json");
|
|
@@ -7539,7 +7558,7 @@ function logLine(level, message) {
|
|
|
7539
7558
|
function banner() {
|
|
7540
7559
|
process3.stdout.write("\n");
|
|
7541
7560
|
process3.stdout.write(bold("Remote Arc") + " " + dim(`v${VERSION}`) + "\n");
|
|
7542
|
-
process3.stdout.write(dim("
|
|
7561
|
+
process3.stdout.write(dim("Controlled remote access for AI") + "\n\n");
|
|
7543
7562
|
}
|
|
7544
7563
|
function argFlag(name) {
|
|
7545
7564
|
return process3.argv.includes(name);
|
|
@@ -7787,7 +7806,8 @@ async function connectAgent(config) {
|
|
|
7787
7806
|
recoveryEnabled: recovery?.enabled ?? false,
|
|
7788
7807
|
supervisorActive: recovery?.active,
|
|
7789
7808
|
supervisorPid: recovery?.pid,
|
|
7790
|
-
supervisorService: recovery?.service
|
|
7809
|
+
supervisorService: recovery?.service,
|
|
7810
|
+
recoveryVersion: recovery?.version ?? null
|
|
7791
7811
|
},
|
|
7792
7812
|
tools: [...tools.map((tool) => tool.name), ...internalTools],
|
|
7793
7813
|
capabilities: [
|