@openagents-org/agent-launcher 0.2.52 → 0.2.54

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/installer.js +11 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openagents-org/agent-launcher",
3
- "version": "0.2.52",
3
+ "version": "0.2.54",
4
4
  "description": "OpenAgents Launcher — install, configure, and run AI coding agents from your terminal",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/installer.js CHANGED
@@ -39,21 +39,22 @@ class Installer {
39
39
  // Fast check: marker file
40
40
  if (this._hasMarker(agentType)) return true;
41
41
 
42
- // Check if binary exists on PATH
43
- const binaryPath = this._whichBinary(agentType);
44
- if (!binaryPath) return false;
45
-
46
- // Verify it's not a stale shim — check the actual package exists
47
- // npm shims point to node_modules/<pkg>/ — if the package dir is gone, the shim is stale
42
+ // Definitive check: does the package exist in our node_modules?
43
+ const portableDir = path.join(os.homedir(), '.openagents', 'nodejs');
44
+ const globalModules = path.join(portableDir, 'node_modules');
48
45
  const entry = this.registry.getEntry(agentType);
49
46
  const npmPkg = entry && entry.install ? entry.install.npm_package : null;
50
47
  const binary = entry && entry.install ? entry.install.binary : agentType;
51
- const portableDir = path.join(os.homedir(), '.openagents', 'nodejs');
52
- const globalModules = path.join(portableDir, 'node_modules');
48
+ const pkgDir = path.join(globalModules, npmPkg || binary);
49
+ if (fs.existsSync(path.join(pkgDir, 'package.json'))) return true;
50
+
51
+ // Fallback: check if binary exists on PATH (system install)
52
+ const binaryPath = this._whichBinary(agentType);
53
+ if (!binaryPath) return false;
53
54
 
54
- // If the binary is in our portable dir, verify the package exists
55
+ // Verify it's not a stale shim — if binary is in our portable dir,
56
+ // check the actual package exists (reuse variables from above)
55
57
  if (binaryPath.startsWith(portableDir)) {
56
- const pkgDir = path.join(globalModules, npmPkg || binary);
57
58
  if (!fs.existsSync(path.join(pkgDir, 'package.json'))) {
58
59
  // Stale shim — clean it up from all possible locations
59
60
  for (const dir of [portableDir, path.join(globalModules, '.bin')]) {