@openagents-org/agent-connector 0.3.6 → 0.3.7
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/installer.js +15 -3
- package/src/paths.js +1 -0
package/package.json
CHANGED
package/src/installer.js
CHANGED
|
@@ -540,9 +540,21 @@ class Installer {
|
|
|
540
540
|
*/
|
|
541
541
|
_resolveNpmCommand(args) {
|
|
542
542
|
const systemNpm = whichBinary('npm');
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
543
|
+
const npmBin = systemNpm ? `"${systemNpm}"` : 'npm';
|
|
544
|
+
|
|
545
|
+
// On macOS/Linux, use a user-writable prefix to avoid sudo for global installs
|
|
546
|
+
if (process.platform !== 'win32' && args.includes('-g')) {
|
|
547
|
+
const globalDir = path.join(this.configDir, 'npm-global');
|
|
548
|
+
fs.mkdirSync(globalDir, { recursive: true });
|
|
549
|
+
// Add the bin dir to PATH so installed binaries are found
|
|
550
|
+
const binDir = path.join(globalDir, 'bin');
|
|
551
|
+
if (!(process.env.PATH || '').includes(binDir)) {
|
|
552
|
+
process.env.PATH = binDir + ':' + (process.env.PATH || '');
|
|
553
|
+
}
|
|
554
|
+
return `${npmBin} --prefix "${globalDir}" ${args}`;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
return `${npmBin} ${args}`;
|
|
546
558
|
}
|
|
547
559
|
|
|
548
560
|
_execShell(cmd, timeoutMs = 300000) {
|
package/src/paths.js
CHANGED
|
@@ -172,6 +172,7 @@ function _addUnixPaths(dirs) {
|
|
|
172
172
|
|
|
173
173
|
// npm global (varies by install method)
|
|
174
174
|
_push(dirs, path.join(HOME, '.npm-global', 'bin'));
|
|
175
|
+
_push(dirs, path.join(HOME, '.openagents', 'npm-global', 'bin'));
|
|
175
176
|
|
|
176
177
|
// nvm
|
|
177
178
|
const nvmDir = process.env.NVM_DIR || path.join(HOME, '.nvm');
|