@remcp/remcp 0.2.225 → 0.2.227

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remcp/remcp",
3
- "version": "0.2.225",
3
+ "version": "0.2.227",
4
4
  "description": "ReMCP device client: pair a computer with ReMCP and run the outbound-only agent that hosts the local MCP runtime.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -18,7 +18,7 @@
18
18
  "README.md"
19
19
  ],
20
20
  "scripts": {
21
- "check": "node --check bin/remcp.mjs && node --check src/agent-deploy-reconnect.mjs && node --check src/agent-network-probe-client.mjs && node --check src/agent-relay-connection.mjs && node --check src/agent-responder.mjs && node --check src/agent-runtime-capabilities.mjs && node --check src/agent-update-monitor.mjs && node --check src/agent-update.mjs && node --check src/agent-utilities.mjs && node --check src/agent.mjs && node --check src/cli.mjs && node --check src/cli/config.mjs && node --check src/cli/connect.mjs && node --check src/cli/doctor.mjs && node --check src/cli/env.mjs && node --check src/cli/installation-audit.mjs && node --check src/cli/mac-native-temperature.mjs && node --check src/cli/npm-global.mjs && node --check src/cli/pairing-qr.mjs && node --check src/cli/service-inventory.mjs && node --check src/cli/service-macos.mjs && node --check src/cli/service-paths.mjs && node --check src/cli/service.mjs && node --check src/cli/shell.mjs && node --check src/cli/update.mjs && node --check src/cli/windows-owned-job-source.mjs && node --check src/cli/windows-owned-job.mjs && node --check src/cli/windows-supervisor.mjs && node --check src/cli/windows-update-lock.mjs && node --check src/cli/windows-user-supervisor.mjs && node --check src/fetch-update-manifest.mjs && node --check src/fs-access.mjs && node --check src/npm.mjs && node --check src/runtime.mjs && node --check src/version.mjs",
21
+ "check": "node --check bin/remcp.mjs && node --check src/agent-deploy-reconnect.mjs && node --check src/agent-network-probe-client.mjs && node --check src/agent-relay-connection.mjs && node --check src/agent-responder.mjs && node --check src/agent-runtime-capabilities.mjs && node --check src/agent-update-monitor.mjs && node --check src/agent-update.mjs && node --check src/agent-utilities.mjs && node --check src/agent.mjs && node --check src/cli.mjs && node --check src/cli/config.mjs && node --check src/cli/connect.mjs && node --check src/cli/doctor.mjs && node --check src/cli/env.mjs && node --check src/cli/installation-audit.mjs && node --check src/cli/mac-native-temperature.mjs && node --check src/cli/npm-global.mjs && node --check src/cli/pairing-qr.mjs && node --check src/cli/service-inventory.mjs && node --check src/cli/service-macos.mjs && node --check src/cli/service-paths.mjs && node --check src/cli/service.mjs && node --check src/cli/shell.mjs && node --check src/cli/supervised-agent-lifecycle.mjs && node --check src/cli/update.mjs && node --check src/cli/windows-owned-job-source.mjs && node --check src/cli/windows-owned-job.mjs && node --check src/cli/windows-supervisor.mjs && node --check src/cli/windows-update-lock.mjs && node --check src/cli/windows-user-supervisor.mjs && node --check src/fetch-update-manifest.mjs && node --check src/fs-access.mjs && node --check src/npm.mjs && node --check src/runtime.mjs && node --check src/version.mjs",
22
22
  "test": "node --test test/*.test.mjs"
23
23
  },
24
24
  "dependencies": {
@@ -0,0 +1,21 @@
1
+ import process from 'node:process';
2
+
3
+ // Node IPC is present only for a spawn/fork with an 'ipc' stdio channel.
4
+ // Windows CreateProcessW under an owned Job Object has no Node IPC at all:
5
+ // a missing channel is expected, not evidence that the owner died.
6
+ export function guardSupervisorDisconnect(agent, childProcess = process) {
7
+ if (typeof childProcess.send !== 'function') return false;
8
+ let stopping = false;
9
+ const stopOrphan = () => {
10
+ if (stopping) return;
11
+ stopping = true;
12
+ void Promise.resolve().then(() => agent.stop()).then(
13
+ () => childProcess.exit(0),
14
+ () => childProcess.exit(1),
15
+ );
16
+ };
17
+ childProcess.once('disconnect', stopOrphan);
18
+ // A connected IPC channel may have closed while runAgent was starting.
19
+ if (!childProcess.connected) stopOrphan();
20
+ return true;
21
+ }
@@ -266,7 +266,9 @@ export async function updateCommand(flags) {
266
266
 
267
267
  // Legacy Scheduled Task /End can orphan an already running agent. Refuse the
268
268
  // update before touching npm or package state until ownership is verifiable.
269
- if (serviceExpected) assertWindowsUpdateLifecycleSafe();
269
+ // An old task may survive an explicit service opt-out. Its ownership must be
270
+ // checked independently of that preference before replacing either package.
271
+ assertWindowsUpdateLifecycleSafe();
270
272
  const before = { cli: VERSION, runtime: installedVersion(cfg.runtime.packageName) };
271
273
  console.log(`Updating ReMCP to ${targets.clientSpec} with ${targets.runtimeSpec}…`);
272
274
  npmGlobalUpdate([PACKAGE_NAME, cfg.runtime.packageName], targets.clientSpec, targets.runtimeSpec);
package/src/cli.mjs CHANGED
@@ -15,6 +15,7 @@ import { configFile, npm, officialOrigin, runtimeConfigFile } from './cli/env.mj
15
15
  import { currentInstallationInfo, ensureMacCliCommand, installPersistentAgent, persistentServiceState, servicePlatform, rememberCurrentInstallation, restartPersistentServiceIfInstalled, serviceInstallationInfo, uninstallPersistentService } from './cli/service.mjs';
16
16
  import { auditKnownInstallations } from './cli/installation-audit.mjs';
17
17
  import { scheduleMacTemperatureRepair } from './cli/mac-native-temperature.mjs';
18
+ import { guardSupervisorDisconnect } from './cli/supervised-agent-lifecycle.mjs';
18
19
  import { repairMacTemperatureAfterStart } from './cli/npm-global.mjs';
19
20
  import { run } from './cli/shell.mjs';
20
21
  import { updateCommand } from './cli/update.mjs';
@@ -188,13 +189,10 @@ export async function main(argv = process.argv.slice(2)) {
188
189
  installSpec: `${PACKAGE_NAME}@${VERSION}`,
189
190
  persistState: patch => saveConfig({ ...cfg, ...patch }),
190
191
  });
191
- // The per-user Windows supervisor owns this child through a private Node IPC
192
- // handle. If the supervisor dies, the agent must close its runtime rather than
193
- // remain orphaned and create duplicates at the next interactive logon.
192
+ // Legacy Node supervisors use IPC; the Windows Job Object launcher does not.
193
+ // On Windows, the kernel job terminates the process tree when its owner exits.
194
194
  if (supervised && process.env.REMCP_USER_STARTUP_SUPERVISOR === '1') {
195
- const closeOrphan = () => void agent.stop().finally(() => process.exit(0));
196
- process.once('disconnect', closeOrphan);
197
- if (!process.connected) closeOrphan();
195
+ guardSupervisorDisconnect(agent);
198
196
  }
199
197
  return;
200
198
  }