@remcp/remcp 0.2.238 → 0.2.239

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.238",
3
+ "version": "0.2.239",
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",
@@ -40,13 +40,16 @@ export function linuxActiveServiceFile() {
40
40
  // even if systemctl --user enable --now reported success.
41
41
  export function ensureLinuxLinger() {
42
42
  if (process.platform !== 'linux') return;
43
- // Tests isolate HOME in a temporary fixture. Never mutate the real host's loginctl
44
- // configuration on behalf of that synthetic service installation.
45
- if (path.resolve(home) !== path.resolve(os.userInfo().homedir)) {
46
- if (process.env.NODE_ENV === 'test') return;
43
+ // Test-only synthetic HOME has no logind account and must never mutate the host.
44
+ // Guard before os.userInfo(): an isolated CI UID may not have a passwd entry.
45
+ if (process.env.NODE_ENV === 'test' && process.env.REMCP_TEST_PLATFORM === 'linux') return;
46
+ let account;
47
+ try { account = os.userInfo(); }
48
+ catch { throw new Error('ReMCP cannot resolve the current Linux account for persistent systemd supervision.'); }
49
+ if (path.resolve(home) !== path.resolve(account.homedir)) {
47
50
  throw new Error('Refusing a persistent Linux service with HOME different from the account home directory.');
48
51
  }
49
- const username = os.userInfo().username;
52
+ const username = account.username;
50
53
  const query = () => spawnSync('loginctl', ['show-user', username, '-p', 'Linger', '--value'],
51
54
  { encoding:'utf8', timeout:10000 });
52
55
  let state = query();
@@ -66,7 +66,9 @@ export function installLinuxService(cliPath = globalCliPath(), nodePath = proces
66
66
  const launcherFile = writeLinuxServiceLauncher(cliPath, nodePath);
67
67
  // Fresh root installs are boot services owned by PID 1. Legacy per-user units are
68
68
  // left under their existing supervisor, but must have linger enabled.
69
- const privileged = process.getuid?.() === 0 && path.resolve(home) === path.resolve(os.userInfo().homedir);
69
+ const syntheticLinuxFixture = process.env.NODE_ENV === 'test' && process.env.REMCP_TEST_PLATFORM === 'linux';
70
+ const privileged = !syntheticLinuxFixture && process.getuid?.() === 0
71
+ && path.resolve(home) === path.resolve(os.userInfo().homedir);
70
72
  if (privileged && fs.existsSync(linuxSystemServiceFile) && !linuxSystemAgentOwned()) {
71
73
  throw new Error('Refusing to replace an unmanaged systemd remcp-agent.service');
72
74
  }