@introspection-ai/cli 0.25.2 → 0.26.0

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.
@@ -100,7 +100,10 @@ function detectPackageManager({
100
100
 
101
101
  /**
102
102
  * Resolve the package-manager executable from the launcher's own installation
103
- * prefix. Never consult PATH: it may now point at another NVM/Corepack prefix.
103
+ * prefix. PATH is only eligible for a verified pnpm global-store layout,
104
+ * because pnpm package storage and its manager binary may be split (for
105
+ * example Homebrew pnpm with a separate PNPM_HOME). Other managers keep the
106
+ * strict same-prefix ownership rule.
104
107
  */
105
108
  function findOwningPackageManager(
106
109
  manager,
@@ -108,13 +111,15 @@ function findOwningPackageManager(
108
111
  entrypoint = __filename,
109
112
  invokedAs = process.argv[1],
110
113
  platform = process.platform,
111
- existsSync = fs.existsSync,
114
+ pathValue = process.env.PATH,
115
+ isRunnable = candidate => isRunnableFile(candidate, platform),
112
116
  realpathSync = fs.realpathSync,
113
117
  } = {}
114
118
  ) {
115
119
  if (!manager) return null;
116
120
  const executable = platform === "win32" ? `${manager}.cmd` : manager;
117
121
  const candidates = [];
122
+ let splitPrefixPnpm = false;
118
123
  const invokedSibling = invokedAs
119
124
  ? path.join(path.dirname(path.resolve(invokedAs)), executable)
120
125
  : null;
@@ -140,14 +145,37 @@ function findOwningPackageManager(
140
145
  addFromMarker("/lib/node_modules/", ["bin", executable]);
141
146
  addFromMarker("/node_modules/", [executable]);
142
147
  } else if (manager === "pnpm") {
148
+ const before = candidates.length;
143
149
  addFromMarker("/global/", [executable]);
150
+ splitPrefixPnpm ||= candidates.length > before;
144
151
  } else if (manager === "bun") {
145
152
  addFromMarker("/install/global/", ["bin", executable]);
146
153
  }
147
154
  }
148
155
  if (invokedSibling) candidates.push(invokedSibling);
149
156
 
150
- return candidates.find(candidate => existsSync(candidate)) || null;
157
+ const owned = candidates.find(candidate => isRunnable(candidate));
158
+ if (owned) return owned;
159
+ if (manager !== "pnpm" || !splitPrefixPnpm) return null;
160
+
161
+ return (pathValue || "")
162
+ .split(path.delimiter)
163
+ .filter(Boolean)
164
+ .map(dir => path.join(dir, executable))
165
+ .find(candidate => isRunnable(candidate)) || null;
166
+ }
167
+
168
+ function isRunnableFile(candidate, platform) {
169
+ try {
170
+ if (!fs.statSync(candidate).isFile()) return false;
171
+ fs.accessSync(
172
+ candidate,
173
+ platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK
174
+ );
175
+ return true;
176
+ } catch {
177
+ return false;
178
+ }
151
179
  }
152
180
 
153
181
  function resolveBinary() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@introspection-ai/cli",
3
- "version": "0.25.2",
3
+ "version": "0.26.0",
4
4
  "description": "CLI for operating agents on the Introspection platform",
5
5
  "keywords": [
6
6
  "introspection",
@@ -31,10 +31,10 @@
31
31
  "node": ">=18"
32
32
  },
33
33
  "optionalDependencies": {
34
- "@introspection-ai/cli-darwin-arm64": "0.25.2",
35
- "@introspection-ai/cli-darwin-x64": "0.25.2",
36
- "@introspection-ai/cli-linux-x64": "0.25.2",
37
- "@introspection-ai/cli-linux-arm64": "0.25.2",
38
- "@introspection-ai/cli-win32-x64": "0.25.2"
34
+ "@introspection-ai/cli-darwin-arm64": "0.26.0",
35
+ "@introspection-ai/cli-darwin-x64": "0.26.0",
36
+ "@introspection-ai/cli-linux-x64": "0.26.0",
37
+ "@introspection-ai/cli-linux-arm64": "0.26.0",
38
+ "@introspection-ai/cli-win32-x64": "0.26.0"
39
39
  }
40
40
  }