@openagents-org/agent-launcher 0.2.57 → 0.2.59
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 +12 -4
package/package.json
CHANGED
package/src/installer.js
CHANGED
|
@@ -42,7 +42,15 @@ class Installer {
|
|
|
42
42
|
const entry = this.registry.getEntry(agentType);
|
|
43
43
|
const npmPkg = entry && entry.install ? entry.install.npm_package : null;
|
|
44
44
|
const binary = entry && entry.install ? entry.install.binary : agentType;
|
|
45
|
-
|
|
45
|
+
// Extract actual npm package name from install command (e.g. "npm install -g @anthropic-ai/claude-code" → "@anthropic-ai/claude-code")
|
|
46
|
+
const installCmd = entry && entry.install ? this._getInstallCommand(entry.install) : null;
|
|
47
|
+
let npmPkgFromCmd = null;
|
|
48
|
+
if (!npmPkg && installCmd && installCmd.includes('npm install')) {
|
|
49
|
+
const match = installCmd.match(/npm install\s+(?:-g\s+)?(@?[\w-]+(?:\/[\w-]+)?)(?:@\S*)?$/);
|
|
50
|
+
if (match) npmPkgFromCmd = match[1];
|
|
51
|
+
}
|
|
52
|
+
const pkgName = npmPkg || npmPkgFromCmd || binary;
|
|
53
|
+
const pkgDir = path.join(globalModules, pkgName);
|
|
46
54
|
if (fs.existsSync(path.join(pkgDir, 'package.json'))) return true;
|
|
47
55
|
|
|
48
56
|
// Marker file alone is not enough — package may have been pruned
|
|
@@ -178,7 +186,7 @@ class Installer {
|
|
|
178
186
|
// Use bundled node/npm if system npm not available
|
|
179
187
|
if (cmd.startsWith('npm install')) {
|
|
180
188
|
const prefixDir = path.join(os.homedir(), '.openagents', 'nodejs');
|
|
181
|
-
const args = cmd.replace('npm install', 'install --ignore-scripts').replace(' -g ', ` --prefix "${prefixDir}" `);
|
|
189
|
+
const args = cmd.replace('npm install', 'install --ignore-scripts --no-save').replace(' -g ', ` --prefix "${prefixDir}" `);
|
|
182
190
|
cmd = this._resolveNpmCommand(args);
|
|
183
191
|
}
|
|
184
192
|
|
|
@@ -214,7 +222,7 @@ class Installer {
|
|
|
214
222
|
let cmd = rawCmd;
|
|
215
223
|
if (rawCmd.startsWith('npm install')) {
|
|
216
224
|
const prefixDir2 = path.join(os.homedir(), '.openagents', 'nodejs');
|
|
217
|
-
const args = rawCmd.replace('npm install', 'install --loglevel=verbose --ignore-scripts').replace(' -g ', ` --prefix "${prefixDir2}" `);
|
|
225
|
+
const args = rawCmd.replace('npm install', 'install --loglevel=verbose --ignore-scripts --no-save').replace(' -g ', ` --prefix "${prefixDir2}" `);
|
|
218
226
|
cmd = this._resolveNpmCommand(args);
|
|
219
227
|
} else if (rawCmd.startsWith('pip install') || rawCmd.startsWith('pipx install')) {
|
|
220
228
|
cmd = rawCmd; // pip commands stay as-is
|
|
@@ -307,7 +315,7 @@ class Installer {
|
|
|
307
315
|
// Resolve npm to use bundled node if system npm is not available
|
|
308
316
|
let cmd = rawCmd;
|
|
309
317
|
if (rawCmd.startsWith('npm uninstall')) {
|
|
310
|
-
const args = rawCmd.replace('npm uninstall', 'uninstall --loglevel=verbose');
|
|
318
|
+
const args = rawCmd.replace('npm uninstall', 'uninstall --loglevel=verbose --no-save');
|
|
311
319
|
cmd = this._resolveNpmCommand(args);
|
|
312
320
|
}
|
|
313
321
|
|