@openagents-org/agent-launcher 0.2.47 → 0.2.49

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-launcher",
3
- "version": "0.2.47",
3
+ "version": "0.2.49",
4
4
  "description": "OpenAgents Launcher — install, configure, and run AI coding agents from your terminal",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -460,6 +460,7 @@ class OpenClawAdapter extends BaseAdapter {
460
460
  // This is the proper way to add custom LLM endpoints to OpenClaw.
461
461
  // See: https://docs.openclaw.ai/concepts/model-providers
462
462
  try {
463
+ fs.mkdirSync(OPENCLAW_STATE_DIR, { recursive: true });
463
464
  let config = {};
464
465
  try { config = JSON.parse(fs.readFileSync(configFile, 'utf-8')); } catch {}
465
466
 
@@ -478,6 +479,20 @@ class OpenClawAdapter extends BaseAdapter {
478
479
 
479
480
  fs.writeFileSync(configFile, JSON.stringify(config, null, 2), 'utf-8');
480
481
  } catch {}
482
+
483
+ // Also write auth-profiles.json for the custom provider
484
+ try {
485
+ const agentDir = path.join(OPENCLAW_STATE_DIR, 'agents', 'main', 'agent');
486
+ fs.mkdirSync(agentDir, { recursive: true });
487
+ const authFile = path.join(agentDir, 'auth-profiles.json');
488
+ let authData = { version: 1, profiles: {} };
489
+ try { authData = JSON.parse(fs.readFileSync(authFile, 'utf-8')); } catch {}
490
+ authData.profiles = authData.profiles || {};
491
+ authData.profiles['custom:manual'] = { type: 'token', provider: 'custom', token: apiKey };
492
+ authData.lastGood = authData.lastGood || {};
493
+ authData.lastGood.custom = 'custom:manual';
494
+ fs.writeFileSync(authFile, JSON.stringify(authData, null, 2), 'utf-8');
495
+ } catch {}
481
496
  }
482
497
  }
483
498
  }
package/src/installer.js CHANGED
@@ -170,7 +170,8 @@ class Installer {
170
170
 
171
171
  // Use bundled node/npm if system npm not available
172
172
  if (cmd.startsWith('npm install')) {
173
- const args = cmd.replace('npm install', 'install --ignore-scripts');
173
+ const prefixDir = path.join(os.homedir(), '.openagents', 'nodejs');
174
+ const args = cmd.replace('npm install', 'install --ignore-scripts').replace(' -g ', ` --prefix "${prefixDir}" `);
174
175
  cmd = this._resolveNpmCommand(args);
175
176
  }
176
177
 
@@ -205,7 +206,8 @@ class Installer {
205
206
  // Resolve npm command
206
207
  let cmd = rawCmd;
207
208
  if (rawCmd.startsWith('npm install')) {
208
- const args = rawCmd.replace('npm install', 'install --loglevel=verbose --ignore-scripts');
209
+ const prefixDir2 = path.join(os.homedir(), '.openagents', 'nodejs');
210
+ const args = rawCmd.replace('npm install', 'install --loglevel=verbose --ignore-scripts').replace(' -g ', ` --prefix "${prefixDir2}" `);
209
211
  cmd = this._resolveNpmCommand(args);
210
212
  } else if (rawCmd.startsWith('pip install') || rawCmd.startsWith('pipx install')) {
211
213
  cmd = rawCmd; // pip commands stay as-is
@@ -345,10 +347,11 @@ class Installer {
345
347
  _deriveUninstallCommand(installCmd) {
346
348
  if (!installCmd) return null;
347
349
 
348
- // npm install -g <pkg> → npm uninstall -g <pkg>
350
+ // npm install -g <pkg> → npm uninstall --prefix <dir> <pkg>
349
351
  if (installCmd.includes('npm install')) {
352
+ const prefixDir = path.join(os.homedir(), '.openagents', 'nodejs');
350
353
  return installCmd
351
- .replace('npm install -g', 'npm uninstall -g')
354
+ .replace('npm install -g', `npm uninstall --prefix "${prefixDir}"`)
352
355
  .replace('npm install', 'npm uninstall')
353
356
  .replace(/@latest/g, '')
354
357
  .replace(/@[\d.]+/g, '');