@remcp/remcp 0.2.206 → 0.2.207
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 +1 -1
- package/src/cli/mac-native-temperature.mjs +23 -0
- package/src/cli/npm-global.mjs +17 -0
- package/src/cli.mjs +15 -0
package/package.json
CHANGED
|
@@ -3,12 +3,35 @@
|
|
|
3
3
|
// after verifying its installed manifest and on-disk path. No sudo or shell.
|
|
4
4
|
import fs from 'node:fs';
|
|
5
5
|
import path from 'node:path';
|
|
6
|
+
import process from 'node:process';
|
|
7
|
+
import { spawn } from 'node:child_process';
|
|
6
8
|
|
|
7
9
|
const SENSOR_NAME = 'macos-temperature-sensor';
|
|
8
10
|
const SENSOR_VERSION = '2.1.1';
|
|
9
11
|
const SCRIPT = 'node-gyp rebuild';
|
|
10
12
|
const BINARY = path.join('build', 'Release', 'mac_temp_native.node');
|
|
11
13
|
|
|
14
|
+
// Repair a module omitted by an old updater after starting the new agent.
|
|
15
|
+
export function scheduleMacTemperatureRepair({
|
|
16
|
+
platform = process.platform, runtimePackageName, nodeExecutable = process.execPath,
|
|
17
|
+
cliEntry = process.argv[1], environment = process.env,
|
|
18
|
+
spawnProcess = spawn, warn = console.error,
|
|
19
|
+
} = {}) {
|
|
20
|
+
if (platform !== 'darwin' || runtimePackageName !== '@remcp/runtime') return false;
|
|
21
|
+
if (!path.isAbsolute(nodeExecutable) || !path.isAbsolute(cliEntry || '')) return false;
|
|
22
|
+
try {
|
|
23
|
+
const child = spawnProcess(nodeExecutable, [cliEntry, '__repair-macos-temperature'], {
|
|
24
|
+
detached: true, stdio: ['ignore', 'inherit', 'inherit'], env: environment,
|
|
25
|
+
});
|
|
26
|
+
child.on?.('error', () => warn('ReMCP: optional macOS temperature repair could not start.'));
|
|
27
|
+
child.unref?.();
|
|
28
|
+
return true;
|
|
29
|
+
} catch {
|
|
30
|
+
warn('ReMCP: optional macOS temperature repair could not start.');
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
12
35
|
function checkedManifest(file) {
|
|
13
36
|
const stats = fs.lstatSync(file);
|
|
14
37
|
if (!stats.isFile() || stats.size > 16384) throw new Error('invalid manifest');
|
package/src/cli/npm-global.mjs
CHANGED
|
@@ -67,6 +67,23 @@ export function npmGlobalInstall(...specs) {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
// Called only by the post-start macOS helper: an older updater may have
|
|
71
|
+
// installed this version while leaving the optional native binary missing.
|
|
72
|
+
// The same version-pinned, path-checked installer is reused; no npm install
|
|
73
|
+
// or arbitrary dependency lifecycle scripts are permitted.
|
|
74
|
+
export function repairMacTemperatureAfterStart(runtimePackageName) {
|
|
75
|
+
if (servicePlatform() !== 'darwin' || runtimePackageName !== '@remcp/runtime') return false;
|
|
76
|
+
try {
|
|
77
|
+
return buildVettedMacTemperatureAddon({
|
|
78
|
+
runtimeRoot:globalPackagePath(assertSafeReMcpNpmPrefix(globalPrefix()), '@remcp/runtime'),
|
|
79
|
+
resolved:npm, runCommand:run,
|
|
80
|
+
});
|
|
81
|
+
} catch {
|
|
82
|
+
console.error('ReMCP: optional macOS temperature sensor unavailable; other tools remain functional.');
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
70
87
|
function pathEntryExists(file) {
|
|
71
88
|
try {
|
|
72
89
|
fs.lstatSync(file);
|
package/src/cli.mjs
CHANGED
|
@@ -12,6 +12,8 @@ import { assertRuntimeTrust, assertSecureServerUrl, pairWithDeviceCode } from '.
|
|
|
12
12
|
import { diagnoseLocalRuntime, installedVersion, runtimeAllowedRoots } from './cli/doctor.mjs';
|
|
13
13
|
import { configFile, npm, officialOrigin, runtimeConfigFile } from './cli/env.mjs';
|
|
14
14
|
import { currentInstallationInfo, ensureMacCliCommand, installPersistentAgent, persistentServiceState, servicePlatform, rememberCurrentInstallation, restartPersistentServiceIfInstalled, serviceInstallationInfo, uninstallPersistentService } from './cli/service.mjs';
|
|
15
|
+
import { scheduleMacTemperatureRepair } from './cli/mac-native-temperature.mjs';
|
|
16
|
+
import { repairMacTemperatureAfterStart } from './cli/npm-global.mjs';
|
|
15
17
|
import { run } from './cli/shell.mjs';
|
|
16
18
|
import { updateCommand } from './cli/update.mjs';
|
|
17
19
|
function fetchConfiguredServer(url, options) {
|
|
@@ -156,6 +158,9 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
156
158
|
console.log(`ReMCP is already running as a background service (${service.name}). Use \`remcp status\` to inspect it or \`remcp doctor\` to diagnose it.`);
|
|
157
159
|
return;
|
|
158
160
|
}
|
|
161
|
+
// Older updaters can leave the optional native binary absent. Repair via
|
|
162
|
+
// a separate, fixed-purpose process without delaying the relay connection.
|
|
163
|
+
scheduleMacTemperatureRepair({ runtimePackageName: cfg.runtime?.packageName });
|
|
159
164
|
const telemetry = telemetryState();
|
|
160
165
|
const agent = await runAgent({
|
|
161
166
|
...cfg,
|
|
@@ -179,6 +184,16 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
179
184
|
return;
|
|
180
185
|
}
|
|
181
186
|
|
|
187
|
+
if (command === '__repair-macos-temperature') {
|
|
188
|
+
// Only the pinned first-party sensor is eligible; no external script input.
|
|
189
|
+
if (servicePlatform() !== 'darwin') return;
|
|
190
|
+
const cfg = loadConfig(false);
|
|
191
|
+
if (repairMacTemperatureAfterStart(cfg?.runtime?.packageName)) {
|
|
192
|
+
console.log('ReMCP: vetted macOS temperature sensor is ready.');
|
|
193
|
+
}
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
|
|
182
197
|
if (command === 'auto-update') {
|
|
183
198
|
const action = String(positional[0] || 'status').toLowerCase();
|
|
184
199
|
const cfg = loadConfig(false) || {};
|