@remcp/remcp 0.2.208 → 0.2.209

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.208",
3
+ "version": "0.2.209",
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",
@@ -2,7 +2,6 @@
2
2
  // the server uses to recognise this computer across pairings.
3
3
  import fs from 'node:fs';
4
4
  import path from 'node:path';
5
- import process from 'node:process';
6
5
  import { randomUUID } from 'node:crypto';
7
6
  import { normalizeRuntime } from '../runtime.mjs';
8
7
 
@@ -79,13 +78,12 @@ export function writeJsonFile(file, value) {
79
78
  fs.chmodSync(file, 0o600);
80
79
  }
81
80
 
82
- export function autoUpdateEnabled(config, platform = process.platform) {
83
- // Linux often runs unrelated applications through the same global npm prefix. Never
84
- // mutate that prefix implicitly: require `remcp auto-update on` for Linux agents.
85
- // Keep the historical preference for existing explicit opt-ins and other platforms.
86
- if (config?.autoUpdate === true) return true;
87
- if (config?.autoUpdate === false) return false;
88
- return platform !== 'linux';
81
+ export function autoUpdateEnabled(config) {
82
+ // This preference controls the two first-party ReMCP npm packages only. It never
83
+ // upgrades the Node.js interpreter or npm itself. All supported OSes keep the
84
+ // historical default of automatic ReMCP releases unless the owner opts out.
85
+ // Updates use the verified managed service prefix, not a shared global prefix.
86
+ return config?.autoUpdate !== false;
89
87
  }
90
88
 
91
89
  export function flagEnabled(value) {
package/src/cli.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import fs from 'node:fs';
1
2
  import os from 'node:os';
2
3
  import path from 'node:path';
3
4
  import process from 'node:process';
@@ -36,7 +37,20 @@ function parse(argv) {
36
37
  }
37
38
 
38
39
  function printHelp() {
39
- console.log(`ReMCP ${VERSION}\n\nCommands:\n remcp connect [--no-qr]\n remcp start\n remcp status\n remcp doctor\n remcp update\n remcp install\n remcp uninstall\n remcp uninstall --purge\n remcp telemetry [status|on|off]\n remcp godmode [status|on|off]\n remcp --version\n\nPairing commands are generated in the ReMCP workspace.\n\nUsage metrics are opt-out (tool names, timings, outcomes only, sent to your own ReMCP\naccount through the paired agent). Disable them at any time with: remcp telemetry off\n\nUnrestricted mode (remcp godmode on) lifts the access roots and the command guardrails for this\ncomputer only. The MCP configuration tool cannot enable it; protect remote terminal access.`);
40
+ console.log(`ReMCP ${VERSION}\n\nCommands:\n remcp connect [--no-qr]\n remcp start\n remcp status\n remcp doctor\n remcp update\n remcp auto-update [status|on|off]\n remcp install\n remcp uninstall\n remcp uninstall --purge\n remcp telemetry [status|on|off]\n remcp godmode [status|on|off]\n remcp --version\n\nPairing commands are generated in the ReMCP workspace.\n\nUsage metrics are opt-out (tool names, timings, outcomes only, sent to your own ReMCP\naccount through the paired agent). Disable them at any time with: remcp telemetry off\n\nUnrestricted mode (remcp godmode on) lifts the access roots and the command guardrails for this\ncomputer only. The MCP configuration tool cannot enable it; protect remote terminal access.`);
41
+ }
42
+
43
+ // The running agent snapshots update policy at startup. A saved toggle alone does not
44
+ // change its six-hour polling loop, so reload a managed service after a policy change.
45
+ // Defer Linux handoff to avoid terminating a remote command before it returns.
46
+ export function applyAutoUpdatePreference(cfg, enabled, {
47
+ persist = saveConfig,
48
+ restart = restartPersistentServiceIfInstalled,
49
+ } = {}) {
50
+ const changed = autoUpdateEnabled(cfg) !== enabled;
51
+ const updated = { ...cfg, autoUpdate: enabled };
52
+ persist(updated);
53
+ return changed ? restart(updated, { deferLinux:true }) : null;
40
54
  }
41
55
 
42
56
  export async function main(argv = process.argv.slice(2)) {
@@ -201,8 +215,15 @@ export async function main(argv = process.argv.slice(2)) {
201
215
  console.log(JSON.stringify({ autoUpdate: autoUpdateEnabled(cfg), checkIntervalHours: 6 }, null, 2));
202
216
  return;
203
217
  }
204
- if (action === 'on' || action === 'enable') { saveConfig({ ...cfg, autoUpdate: true }); console.log('Auto-update enabled.'); return; }
205
- if (action === 'off' || action === 'disable') { saveConfig({ ...cfg, autoUpdate: false }); console.log('Auto-update disabled. Run `remcp update` yourself when you want a new version.'); return; }
218
+ if (['on', 'enable', 'off', 'disable'].includes(action)) {
219
+ const enabled = action === 'on' || action === 'enable';
220
+ const changed = autoUpdateEnabled(cfg) !== enabled;
221
+ const restarted = applyAutoUpdatePreference(cfg, enabled);
222
+ console.log(enabled ? 'Auto-update enabled.' : 'Auto-update disabled. Run `remcp update` yourself when you want a new version.');
223
+ if (restarted) console.log(`ReMCP agent ${restarted} to apply the update policy.`);
224
+ else if (changed) console.log('Restart any manually managed ReMCP agent to apply the update policy.');
225
+ return;
226
+ }
206
227
  throw new Error('Usage: remcp auto-update [status|on|off]');
207
228
  }
208
229
 
@@ -284,11 +305,15 @@ export async function main(argv = process.argv.slice(2)) {
284
305
  const targetClient = String(advertised?.cliVersion || '').trim() || null;
285
306
  const targetRuntime = String(advertised?.runtime || '').trim() || null;
286
307
  const configuredRuntime = String(cfg.runtime.packageSpec || '');
308
+ // The history also records CLI paths from old Node.js environments. An entry for
309
+ // a no-longer-existing path is not an additional installed package or agent.
287
310
  const installationPaths = new Set([
288
311
  currentInstall.cliPath,
289
312
  serviceInstall.cliPath,
290
313
  ...(Array.isArray(cfg.installations) ? cfg.installations.map(item => item?.cliPath) : []),
291
- ].filter(Boolean));
314
+ ].filter(file => typeof file === 'string' && fs.existsSync(file)).map(file => {
315
+ try { return fs.realpathSync(file); } catch { return file; }
316
+ }));
292
317
  const multipleInstallations = installationPaths.size > 1;
293
318
  const knownCliVersions = [VERSION, serviceInstall.cliVersion].filter(Boolean);
294
319
  const knownRuntimeVersions = [installedRuntime, serviceInstall.runtimeVersion].filter(Boolean);