@remcp/remcp 0.2.119 → 0.2.121
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/service.mjs +21 -1
package/package.json
CHANGED
package/src/cli/service.mjs
CHANGED
|
@@ -572,6 +572,23 @@ function packageVersionForCli(cliPath, packageName) {
|
|
|
572
572
|
return versionFromPackageJson(path.join(prefix, 'node_modules', ...String(packageName).split('/'), 'package.json'));
|
|
573
573
|
}
|
|
574
574
|
|
|
575
|
+
function exactPackageSpecVersion(packageName, packageSpec) {
|
|
576
|
+
const prefix = `${String(packageName || '')}@`;
|
|
577
|
+
const spec = String(packageSpec || '');
|
|
578
|
+
return prefix !== '@' && spec.startsWith(prefix) ? spec.slice(prefix.length) : '';
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
// A PowerShell bootstrap already installs the exact client/runtime pair before it starts pairing.
|
|
582
|
+
// Reusing that verified pair avoids a second registry mutation during `connect --install` while
|
|
583
|
+
// preserving the normal npm path for partial, stale, custom-runtime and non-bootstrap installs.
|
|
584
|
+
export function releasePairPresentAtCli(cliPath, config) {
|
|
585
|
+
const runtimePackageName = String(config?.runtime?.packageName || '');
|
|
586
|
+
const expectedRuntimeVersion = exactPackageSpecVersion(runtimePackageName, config?.runtime?.packageSpec);
|
|
587
|
+
if (!cliPath || !runtimePackageName || !expectedRuntimeVersion) return false;
|
|
588
|
+
return packageVersionForCli(cliPath, PACKAGE_NAME) === VERSION
|
|
589
|
+
&& packageVersionForCli(cliPath, runtimePackageName) === expectedRuntimeVersion;
|
|
590
|
+
}
|
|
591
|
+
|
|
575
592
|
export function installationVersionsAtCliPath(cliPath, runtimePackageName) {
|
|
576
593
|
if (!cliPath) return { cliVersion:null, runtimeVersion:null, cliPath:null };
|
|
577
594
|
let resolvedCliPath = cliPath;
|
|
@@ -714,7 +731,10 @@ export function installPersistentAgent(config) {
|
|
|
714
731
|
const platform = servicePlatform();
|
|
715
732
|
if (!['linux', 'darwin', 'win32'].includes(platform)) throw new Error(`Automatic background service installation is not supported on ${platform}`);
|
|
716
733
|
console.log(`Installing ReMCP ${VERSION}…`);
|
|
717
|
-
|
|
734
|
+
const runningCli = process.argv[1] || '';
|
|
735
|
+
if (!releasePairPresentAtCli(runningCli, config)) {
|
|
736
|
+
npmGlobalInstall(`${PACKAGE_NAME}@${VERSION}`, config.runtime.packageSpec);
|
|
737
|
+
}
|
|
718
738
|
const cliPath = globalCliPath();
|
|
719
739
|
const cliScript = resolvedCliScript(cliPath);
|
|
720
740
|
const nodePath = process.execPath;
|