@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openagents-org/agent-connector",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "Agent management CLI and library for OpenAgents — install, configure, and run AI coding agents",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/installer.js CHANGED
@@ -540,9 +540,21 @@ class Installer {
540
540
  */
541
541
  _resolveNpmCommand(args) {
542
542
  const systemNpm = whichBinary('npm');
543
- if (systemNpm) return `"${systemNpm}" ${args}`;
544
- // Last resort — npm should be on PATH after installNodejs()
545
- return `npm ${args}`;
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');