pi-lens 4.5.0 → 4.5.2

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 (148) hide show
  1. package/CHANGELOG-USER.md +12 -12
  2. package/CHANGELOG.md +253 -0
  3. package/README.md +11 -2
  4. package/config/dependency-cruiser-eager-allowlist.json +1 -0
  5. package/dist/{chunk-ZULZS2I6.js → chunk-2ERVW2UF.js} +1115 -423
  6. package/dist/{chunk-BBSDJTOV.js → chunk-2K7BUOKS.js} +13 -13
  7. package/dist/{chunk-I2FYOZNW.js → chunk-3JJ4OAJI.js} +10 -10
  8. package/dist/{chunk-5JB4WENL.js → chunk-3UHGSUVL.js} +1 -1
  9. package/dist/{chunk-W26QZ3OM.js → chunk-463WN3VP.js} +10 -10
  10. package/dist/{chunk-4IZZEN63.js → chunk-4X3ML2UQ.js} +31 -34
  11. package/dist/{chunk-I3NZVAMN.js → chunk-5BI5YP57.js} +10 -10
  12. package/dist/{chunk-7U36VQL6.js → chunk-5Z4XLUFF.js} +3 -3
  13. package/dist/{chunk-DCA2MXVQ.js → chunk-62AJH3IN.js} +51 -29
  14. package/dist/{chunk-37IDWT6O.js → chunk-6F34GMP7.js} +16 -14
  15. package/dist/{chunk-VSQT6IHZ.js → chunk-6LIUVGOR.js} +28 -4
  16. package/dist/{chunk-27JQHK7Y.js → chunk-6REF4GCO.js} +1 -1
  17. package/dist/{chunk-INBK3HIT.js → chunk-7KRR24GO.js} +3 -3
  18. package/dist/{chunk-OZQQ3AIR.js → chunk-7OMOMBEQ.js} +9 -9
  19. package/dist/{chunk-ARTYCUGF.js → chunk-7ZFXICNN.js} +123 -20
  20. package/dist/{chunk-K4Z7MK6T.js → chunk-ABKRQVOY.js} +28 -52
  21. package/dist/{chunk-C5PLBTNR.js → chunk-ANSLRJBG.js} +1 -1
  22. package/dist/{chunk-HRLF35WL.js → chunk-AWMFBPGJ.js} +9 -9
  23. package/dist/{chunk-CXQYK4YT.js → chunk-BG7KHGNX.js} +2 -2
  24. package/dist/{chunk-ZI7YHV6I.js → chunk-BK2R2223.js} +10 -8
  25. package/dist/chunk-BXXC6KRR.js +107 -0
  26. package/dist/{chunk-QMWKSYWB.js → chunk-CKJS2AUI.js} +4 -4
  27. package/dist/{chunk-PPQHMSPH.js → chunk-COGU5KQJ.js} +15 -15
  28. package/dist/{chunk-NHA5K226.js → chunk-CQNXALZJ.js} +27 -6
  29. package/dist/{chunk-KZ732ZVW.js → chunk-CSZESDPP.js} +1 -1
  30. package/dist/chunk-CZ5TCJPB.js +98 -0
  31. package/dist/{chunk-LOEJFTF2.js → chunk-D2LFEA5U.js} +9 -2
  32. package/dist/chunk-D3KLF5CD.js +50 -0
  33. package/dist/{chunk-4DAHGU3V.js → chunk-ENJ2M76Y.js} +31 -29
  34. package/dist/{chunk-ZQSSO7LO.js → chunk-EQKF6BAK.js} +3 -3
  35. package/dist/{chunk-PFJLYRO3.js → chunk-F2SAP2FM.js} +40 -47
  36. package/dist/{chunk-ADYQRETD.js → chunk-F6QAJXQV.js} +2 -2
  37. package/dist/chunk-GR2QDWH5.js +25 -0
  38. package/dist/{chunk-LVLPA32Q.js → chunk-GVE5VZYQ.js} +48 -11
  39. package/dist/{chunk-AZG5UJYY.js → chunk-GWZZOJD2.js} +1 -1
  40. package/dist/chunk-GZS6VPIE.js +27 -0
  41. package/dist/chunk-H4B4SC7I.js +71 -0
  42. package/dist/{chunk-YCR6ZYTE.js → chunk-HA6TUJOE.js} +1 -1
  43. package/dist/{chunk-DI4AZZNY.js → chunk-HKPJTI47.js} +2 -2
  44. package/dist/{chunk-O6LCSHHI.js → chunk-HPKC55MA.js} +1 -1
  45. package/dist/{chunk-LQQNFCQJ.js → chunk-I65CQLCG.js} +1 -1
  46. package/dist/{chunk-P5MSLVUW.js → chunk-IDKLWVKY.js} +11 -11
  47. package/dist/chunk-IUM2Q7NF.js +25 -0
  48. package/dist/{chunk-L6BDRYUK.js → chunk-J24IS3KZ.js} +5 -5
  49. package/dist/{chunk-KNSOA43J.js → chunk-J2DAHH4T.js} +2 -2
  50. package/dist/{chunk-7ZVTFLCC.js → chunk-JBDZVOFL.js} +11 -11
  51. package/dist/{chunk-HIJ4CHFF.js → chunk-JC6NFC57.js} +3 -3
  52. package/dist/{chunk-K7O6AHSJ.js → chunk-JTHEUTW7.js} +11 -11
  53. package/dist/{chunk-KXGTLAUW.js → chunk-JWW3ODBN.js} +2 -2
  54. package/dist/{chunk-HIRBC72R.js → chunk-K3ZIYLHT.js} +4 -4
  55. package/dist/{chunk-6GLMMGCX.js → chunk-KDPZA2UE.js} +2 -3
  56. package/dist/{chunk-AXAR5ZW2.js → chunk-KMY2OU4T.js} +553 -434
  57. package/dist/{chunk-DFKOA74L.js → chunk-KQF7VT26.js} +10 -10
  58. package/dist/{chunk-S6MCMD27.js → chunk-KVGA7X76.js} +3 -3
  59. package/dist/{chunk-74AMPWNC.js → chunk-KW7O72AK.js} +2 -2
  60. package/dist/{chunk-UN72ZAJ5.js → chunk-LEQTVRSV.js} +9 -9
  61. package/dist/{chunk-B42AIWPJ.js → chunk-LKPSBM6S.js} +3 -3
  62. package/dist/{chunk-R4L7KZ7R.js → chunk-LKW2HFSZ.js} +9 -9
  63. package/dist/{chunk-3PO4YYOX.js → chunk-LURFD4HD.js} +4240 -3734
  64. package/dist/{chunk-PQXUZYTQ.js → chunk-M6ELTECW.js} +4 -4
  65. package/dist/{chunk-3QXFUP6T.js → chunk-MGVVYYKW.js} +12 -12
  66. package/dist/{chunk-CZJGAOKL.js → chunk-MQBKGRSB.js} +7 -7
  67. package/dist/{chunk-NNEQOC3U.js → chunk-MVG2ZEAO.js} +9 -7
  68. package/dist/{chunk-VWEBZ2JV.js → chunk-MY4XNNTX.js} +39 -41
  69. package/dist/{chunk-RIH3UBK4.js → chunk-N4AJVFRF.js} +11 -11
  70. package/dist/{chunk-TKOFTLGB.js → chunk-OFKKMXWM.js} +31 -36
  71. package/dist/{chunk-3PAS2ERX.js → chunk-OFZE4ANN.js} +8 -8
  72. package/dist/chunk-OLXBUTJR.js +61 -0
  73. package/dist/{chunk-6CFSDLHE.js → chunk-OZGEHOSG.js} +38 -17
  74. package/dist/{chunk-3TSMQZG6.js → chunk-PKGOROPQ.js} +40 -2
  75. package/dist/{chunk-OLWGYBYT.js → chunk-Q6D5QKRG.js} +17 -17
  76. package/dist/{chunk-QE7BJQ6K.js → chunk-QECLJFHI.js} +12 -17
  77. package/dist/{chunk-RJ3APNIP.js → chunk-QJA33VD5.js} +4 -4
  78. package/dist/{chunk-MOAVEPC4.js → chunk-R5XVJ6AN.js} +11 -11
  79. package/dist/{chunk-ZRQMENT4.js → chunk-REZL4OM4.js} +1 -1
  80. package/dist/{chunk-PKWEBMCA.js → chunk-RK5RBREN.js} +251 -201
  81. package/dist/chunk-RP5ZQTHO.js +86 -0
  82. package/dist/{chunk-J2ZB5MDS.js → chunk-RURPX2YV.js} +23 -23
  83. package/dist/chunk-TB5MGZLS.js +53 -0
  84. package/dist/chunk-TC63XRYP.js +27 -0
  85. package/dist/chunk-TJOYHAXJ.js +69 -0
  86. package/dist/{chunk-Q7J3JYJ2.js → chunk-TRXKDCBP.js} +13 -13
  87. package/dist/{chunk-6E5QLMWI.js → chunk-TTK37D7R.js} +22 -23
  88. package/dist/{chunk-XDNWR7SG.js → chunk-UH3QHLR5.js} +2 -2
  89. package/dist/{chunk-SCU62JLX.js → chunk-UNTJJ7GN.js} +7 -7
  90. package/dist/{chunk-O2MHF7QM.js → chunk-UPAFSETJ.js} +58 -63
  91. package/dist/{chunk-PQF6YGYB.js → chunk-UX75PTQW.js} +50 -31
  92. package/dist/{chunk-TWEOJE3D.js → chunk-V353PYMK.js} +1233 -576
  93. package/dist/{chunk-CQY2HEH7.js → chunk-V4TFQY5G.js} +2 -2
  94. package/dist/{chunk-B2OXE4AH.js → chunk-VC3W54G3.js} +446 -293
  95. package/dist/{chunk-JGUDT5KD.js → chunk-VSBCJVPC.js} +5 -5
  96. package/dist/{chunk-5HBQL7DH.js → chunk-WAQQGXVV.js} +3 -3
  97. package/dist/{chunk-7DPXUPRF.js → chunk-WLEVWR7Y.js} +2 -2
  98. package/dist/{chunk-QE5DJ7MX.js → chunk-WPMPVP5I.js} +4 -4
  99. package/dist/{chunk-KNJH6WJQ.js → chunk-WXNLFOC2.js} +7 -7
  100. package/dist/{chunk-XSC3BCN3.js → chunk-Y3ZNOZZS.js} +6 -6
  101. package/dist/{chunk-VGRGW4UL.js → chunk-YL6JQTWC.js} +29 -32
  102. package/dist/{chunk-7CLWC2UH.js → chunk-YVE5Q2UU.js} +86 -217
  103. package/dist/{chunk-LGH2HHZG.js → chunk-YZNARDMM.js} +42 -28
  104. package/dist/{chunk-NGNBJIUO.js → chunk-ZDWNFZJ2.js} +8 -8
  105. package/dist/{chunk-X33QECRJ.js → chunk-ZEUF7BIN.js} +2 -2
  106. package/dist/{chunk-2H5GHZKC.js → chunk-ZIF4WLWR.js} +45 -25
  107. package/dist/{chunk-WLD6BGON.js → chunk-ZSPVF7KI.js} +231 -24
  108. package/dist/{chunk-SDYLT45T.js → chunk-ZX6OKBVO.js} +2 -2
  109. package/dist/index.js +10566 -6819
  110. package/dist/mcp/analyze-cli.js +8 -8
  111. package/dist/mcp/cli.js +39 -41
  112. package/dist/mcp/server.js +1083 -685
  113. package/dist/mcp/worker.js +68 -59
  114. package/dist/probes/installer.js +21 -22
  115. package/docs/ci-bot-pr-checks.md +18 -9
  116. package/docs/ci.md +7 -0
  117. package/docs/configuration.md +24 -10
  118. package/docs/defect-shapes.md +61 -30
  119. package/docs/environment-variables.md +18 -9
  120. package/docs/globalconfig.md +17 -0
  121. package/docs/invariants/dispatch-runners.md +22 -0
  122. package/docs/invariants/lsp-trust-exec.md +33 -3
  123. package/docs/lsp-capability-matrix.md +23 -10
  124. package/docs/lsp-idle-eviction.md +7 -1
  125. package/docs/module-report-read-symbol.md +6 -2
  126. package/docs/pi-lens-merge-policy.md +3 -2
  127. package/docs/pi-lens-orchestration.md +2 -1
  128. package/docs/pi-lens-subagent.md +2 -1
  129. package/docs/release-qa-baseline.md +22 -17
  130. package/docs/servercapabilities.md +1 -1
  131. package/docs/settings.md +10 -2
  132. package/docs/tools.md +1 -1
  133. package/docs/usage.md +1 -0
  134. package/package.json +3 -3
  135. package/dist/chunk-2H7NFZ4Q.js +0 -25
  136. package/dist/chunk-5YJXF2IS.js +0 -56
  137. package/dist/chunk-7WKVCZI4.js +0 -69
  138. package/dist/chunk-BKWFDWYM.js +0 -46
  139. package/dist/chunk-G53LBDNU.js +0 -255
  140. package/dist/chunk-GCSDF5IE.js +0 -27
  141. package/dist/chunk-H5API74E.js +0 -67
  142. package/dist/chunk-HBX55MWO.js +0 -27
  143. package/dist/chunk-JOIKBUQN.js +0 -88
  144. package/dist/chunk-M2YMBT5G.js +0 -73
  145. package/dist/chunk-MJRGPEQ5.js +0 -25
  146. package/dist/chunk-QV3JPCMK.js +0 -17
  147. package/dist/chunk-TFKN5EIR.js +0 -27
  148. package/dist/chunk-UNP6Y4JV.js +0 -38
@@ -2,39 +2,41 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
2
2
  import {
3
3
  createAvailabilityProbeFlight,
4
4
  probeToolAsync
5
- } from "./chunk-KXGTLAUW.js";
6
- import {
7
- registerBackgroundWriteDrain
8
- } from "./chunk-UYXV5NIS.js";
5
+ } from "./chunk-JWW3ODBN.js";
9
6
  import {
10
7
  classifyFinderFailure,
11
8
  createAvailabilityLatch,
12
9
  isTransientDecision,
13
10
  logAvailabilityDecision,
14
11
  startHostStallSampler
15
- } from "./chunk-6GLMMGCX.js";
12
+ } from "./chunk-KDPZA2UE.js";
13
+ import {
14
+ registerBackgroundWriteDrain
15
+ } from "./chunk-UYXV5NIS.js";
16
16
  import {
17
17
  NODE_MODULES_BIN_DIRS,
18
18
  createGenerationSource,
19
19
  isUntrustedProjectPath,
20
20
  projectLocalBinDirs,
21
+ projectSearchJudge,
21
22
  recordProjectCommandRefusal,
22
- safeSpawnAsync
23
- } from "./chunk-3PO4YYOX.js";
23
+ safeSpawnAsync,
24
+ sessionRepositoryJudge
25
+ } from "./chunk-LURFD4HD.js";
24
26
  import {
25
27
  getProjectTrustState,
26
28
  withDeadline
27
- } from "./chunk-W26QZ3OM.js";
29
+ } from "./chunk-463WN3VP.js";
28
30
  import {
29
31
  logExtension,
30
32
  recordDegradationOnce
31
- } from "./chunk-NHA5K226.js";
33
+ } from "./chunk-CQNXALZJ.js";
32
34
  import {
33
35
  isAtOrAboveHomeDir,
34
36
  isUnderDir,
35
37
  realpathOrResolve,
36
38
  walkUpDirs
37
- } from "./chunk-WLD6BGON.js";
39
+ } from "./chunk-ZSPVF7KI.js";
38
40
 
39
41
  // dist/clients/package-manager.js
40
42
  import * as fs from "node:fs";
@@ -206,10 +208,10 @@ async function globalBinDirsFor(pm) {
206
208
  if (cached)
207
209
  return cached;
208
210
  const generation = packageManagerCacheGeneration.capture();
209
- const shared = globalBinDirProbeFlights.run(key, () => probeGlobalBinDirs(pm, key, scoped, generation));
211
+ const shared = globalBinDirProbeFlights.run(key, () => probeGlobalBinDirs(pm, key, generation));
210
212
  return shared.promise;
211
213
  }
212
- async function probeGlobalBinDirs(pm, key, scoped, generation) {
214
+ async function probeGlobalBinDirs(pm, key, generation) {
213
215
  if (pm === "bun") {
214
216
  const base = process.env.BUN_INSTALL || path.join(os.homedir(), ".bun");
215
217
  const dirs2 = [path.join(base, "bin")];
@@ -221,7 +223,7 @@ async function probeGlobalBinDirs(pm, key, scoped, generation) {
221
223
  const query = pm === "npm" ? ["config", "get", "prefix"] : pm === "pnpm" ? ["bin", "-g"] : ["global", "bin"];
222
224
  const res = await safeSpawnAsync(pmBinary(pm), query, {
223
225
  timeout: 5e3,
224
- ...scoped && { cwd: os.homedir() }
226
+ cwd: os.homedir()
225
227
  });
226
228
  if (res.status !== 0 || res.error)
227
229
  return [];
@@ -241,7 +243,7 @@ async function allAvailableGlobalBinDirs(onTransient) {
241
243
  if (!await isAvailable(pm, onTransient))
242
244
  continue;
243
245
  for (const dir of await globalBinDirsFor(pm)) {
244
- const normalized = path.resolve(dir);
246
+ const normalized = path.resolve(os.homedir(), dir);
245
247
  if (seen.has(normalized))
246
248
  continue;
247
249
  seen.add(normalized);
@@ -311,15 +313,27 @@ function isProjectLocalBinPath(resolvedCommand, cwd) {
311
313
  return false;
312
314
  }
313
315
  function commandSearchReachesProject(cwd) {
314
- const posix = process.platform !== "win32";
315
- return (process.env.PATH ?? "").split(path.delimiter).some((entry) => entry === "" ? posix : !path.isAbsolute(entry) || isUnderDir(entry, cwd) || isProjectLocalBinPath(entry, cwd));
316
- }
317
- function expandCandidateNames(tools, windowsExt, isWindows) {
318
- return isWindows && windowsExt !== "" ? tools.flatMap((tool) => [`${tool}${windowsExt}`, tool]) : [...tools];
316
+ const reaches = projectSearchJudge(cwd);
317
+ const stripped = getProjectTrustState() === "trusted" ? void 0 : sessionRepositoryJudge();
318
+ return (process.env.PATH ?? "").split(path.delimiter).some((entry) => reaches(entry) && !(path.isAbsolute(entry) && stripped?.(entry) === true));
319
319
  }
320
- function* matchesInDir(dir, names, binDirs) {
321
- for (const name of names) {
322
- for (const binDir of binDirs) {
320
+ function* matchesInDir(dir, tools, binDirs, windowsExt, binDirWindowsExt, isWindows) {
321
+ const extsByDir = binDirs.map((binDir) => isWindows ? [
322
+ ...new Set([binDirWindowsExt?.[binDir], windowsExt].flatMap((ext) => ext ? [ext] : []))
323
+ ] : []);
324
+ const rounds = Math.max(0, ...extsByDir.map((exts) => exts.length));
325
+ for (const tool of tools) {
326
+ const candidates = [];
327
+ for (let round = 0; round < rounds; round++) {
328
+ for (const [i, binDir] of binDirs.entries()) {
329
+ const ext = extsByDir[i]?.[round];
330
+ if (ext !== void 0)
331
+ candidates.push([binDir, tool + ext]);
332
+ }
333
+ }
334
+ for (const binDir of binDirs)
335
+ candidates.push([binDir, tool]);
336
+ for (const [binDir, name] of candidates) {
323
337
  const full = path.join(dir, binDir, name);
324
338
  if (fs.existsSync(full))
325
339
  yield full;
@@ -327,15 +341,14 @@ function* matchesInDir(dir, names, binDirs) {
327
341
  }
328
342
  }
329
343
  function* localBinMatches(tools, startDir, options) {
330
- const { windowsExt = ".cmd", homeDir = os.homedir(), binDirs = NODE_MODULES_BIN_DIRS, isWindows = onWindows(), ceiling = true } = options;
331
- const names = expandCandidateNames(tools, windowsExt, isWindows);
344
+ const { windowsExt = ".cmd", homeDir = os.homedir(), binDirs = NODE_MODULES_BIN_DIRS, binDirWindowsExt, isWindows = onWindows(), ceiling = true } = options;
332
345
  const home = ceiling ? realpathOrResolve(homeDir) : homeDir;
333
346
  let startIsReal;
334
347
  for (const dir of walkUpDirs(startDir, { spelling: true })) {
335
348
  startIsReal ??= ceiling && realpathOrResolve(dir) === dir;
336
349
  if (ceiling && isAtOrAboveHomeDir(startIsReal ? dir : realpathOrResolve(dir), home))
337
350
  return;
338
- yield* matchesInDir(dir, names, binDirs);
351
+ yield* matchesInDir(dir, tools, binDirs, windowsExt, binDirWindowsExt, isWindows);
339
352
  }
340
353
  }
341
354
  function findLocalBinUpwards(tool, startDir, options = {}) {
@@ -347,9 +360,10 @@ function findLocalBinUpwards(tool, startDir, options = {}) {
347
360
  return match;
348
361
  }
349
362
  function findLocalBinsAt(tools, dir, options = {}) {
350
- const { windowsExt = ".cmd", binDirs = NODE_MODULES_BIN_DIRS, isWindows = onWindows() } = options;
351
- const names = expandCandidateNames(tools, windowsExt, isWindows);
352
- const matches = [...matchesInDir(path.resolve(dir), names, binDirs)];
363
+ const { windowsExt = ".cmd", binDirs = NODE_MODULES_BIN_DIRS, binDirWindowsExt, isWindows = onWindows() } = options;
364
+ const matches = [
365
+ ...matchesInDir(path.resolve(dir), tools, binDirs, windowsExt, binDirWindowsExt, isWindows)
366
+ ];
353
367
  if (matches.length === 0 || getProjectTrustState() === "trusted")
354
368
  return matches;
355
369
  return [refuseLocalBin(tools.join(","), dir)];
@@ -7,17 +7,17 @@ import {
7
7
  loadCallGraph,
8
8
  parseSymbolKey,
9
9
  saveCallGraph
10
- } from "./chunk-7U36VQL6.js";
10
+ } from "./chunk-5Z4XLUFF.js";
11
11
  import "./chunk-3MED75HT.js";
12
- import "./chunk-3PO4YYOX.js";
13
- import "./chunk-PQF6YGYB.js";
14
- import "./chunk-LOEJFTF2.js";
15
- import "./chunk-W26QZ3OM.js";
16
- import "./chunk-NHA5K226.js";
12
+ import "./chunk-LURFD4HD.js";
13
+ import "./chunk-UX75PTQW.js";
14
+ import "./chunk-D2LFEA5U.js";
15
+ import "./chunk-463WN3VP.js";
16
+ import "./chunk-CQNXALZJ.js";
17
17
  import "./chunk-S26LC76R.js";
18
- import "./chunk-7CLWC2UH.js";
18
+ import "./chunk-YVE5Q2UU.js";
19
19
  import "./chunk-LJDODBBZ.js";
20
- import "./chunk-WLD6BGON.js";
20
+ import "./chunk-ZSPVF7KI.js";
21
21
  import "./chunk-NXL4FFQQ.js";
22
22
  export {
23
23
  CALL_GRAPH_CACHE_VERSION,
@@ -4,8 +4,8 @@ import {
4
4
  MAX_SESSION_FACT_RECORDS,
5
5
  getFactStoreEvictionReporter,
6
6
  setFactStoreEvictionReporter
7
- } from "./chunk-O6LCSHHI.js";
8
- import "./chunk-WLD6BGON.js";
7
+ } from "./chunk-HPKC55MA.js";
8
+ import "./chunk-ZSPVF7KI.js";
9
9
  import "./chunk-NXL4FFQQ.js";
10
10
  export {
11
11
  FactStore,
@@ -1,27 +1,28 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  parseJsonc
4
- } from "./chunk-CXQYK4YT.js";
4
+ } from "./chunk-BG7KHGNX.js";
5
5
  import {
6
6
  resolveLanguage
7
- } from "./chunk-DI4AZZNY.js";
7
+ } from "./chunk-HKPJTI47.js";
8
8
  import {
9
9
  extractTomlTableSection,
10
10
  hasTomlTable,
11
11
  parseTomlScalarString,
12
12
  parseTomlStringArray
13
- } from "./chunk-KNSOA43J.js";
13
+ } from "./chunk-J2DAHH4T.js";
14
14
  import {
15
15
  getProjectTrustState
16
- } from "./chunk-W26QZ3OM.js";
16
+ } from "./chunk-463WN3VP.js";
17
17
  import {
18
18
  incrementDegradationCount,
19
19
  logExtension,
20
20
  recordDegradationOnce
21
- } from "./chunk-NHA5K226.js";
21
+ } from "./chunk-CQNXALZJ.js";
22
22
  import {
23
+ isTestMode,
23
24
  logLatency
24
- } from "./chunk-7CLWC2UH.js";
25
+ } from "./chunk-YVE5Q2UU.js";
25
26
  import {
26
27
  UV_WORKSPACE_EXCLUDE_DIALECT,
27
28
  UV_WORKSPACE_MEMBERS_DIALECT,
@@ -29,7 +30,16 @@ import {
29
30
  realpathOrResolve,
30
31
  relativeInside,
31
32
  walkUpDirs
32
- } from "./chunk-WLD6BGON.js";
33
+ } from "./chunk-ZSPVF7KI.js";
34
+
35
+ // dist/clients/scanner-temp-root.js
36
+ import * as os from "node:os";
37
+ function scannerReportParentDir() {
38
+ if (!isTestMode() && process.env.PI_LENS_TEST_SCANNER_HARNESS !== "1")
39
+ return os.tmpdir();
40
+ const override = process.env.PI_LENS_TEST_SCANNER_TMPDIR?.trim();
41
+ return override && override.length > 0 ? override : os.tmpdir();
42
+ }
33
43
 
34
44
  // dist/clients/bounded-telemetry.js
35
45
  var MAX_TRACKED_TURN_CAPS = 64;
@@ -105,8 +115,25 @@ function resetBoundedTelemetry() {
105
115
 
106
116
  // dist/clients/python-environment.js
107
117
  import { access, readFile } from "node:fs/promises";
108
- import os from "node:os";
109
- import path, { dirname, join } from "node:path";
118
+ import os2 from "node:os";
119
+ import path, { dirname, join as join2 } from "node:path";
120
+
121
+ // dist/clients/python-ambient-environment.js
122
+ import { join, posix, win32 } from "node:path";
123
+ var AMBIENT_ENVIRONMENT_VARIABLES = {
124
+ "uv-project-environment": "UV_PROJECT_ENVIRONMENT",
125
+ "virtual-env": "VIRTUAL_ENV",
126
+ conda: "CONDA_PREFIX"
127
+ };
128
+ var AMBIENT_PYTHON_ENVIRONMENT_VARIABLES = Object.values(AMBIENT_ENVIRONMENT_VARIABLES);
129
+ function hasAmbientPythonEnvironment(env = process.env) {
130
+ return AMBIENT_PYTHON_ENVIRONMENT_VARIABLES.some((name) => Boolean(env[name]));
131
+ }
132
+ function pythonEnvironmentBinDir(root, platform = process.platform) {
133
+ return join(root, platform === "win32" ? "Scripts" : "bin");
134
+ }
135
+
136
+ // dist/clients/python-environment.js
110
137
  var UV_WORKSPACE_TABLE = "tool\\.uv\\.workspace";
111
138
  async function findUvWorkspace(startDir, homeDir) {
112
139
  let walkStart;
@@ -163,15 +190,7 @@ var PROJECT_VENV_DIRS = [
163
190
  { dir: "venv", source: "project-venv" }
164
191
  ];
165
192
  var PROJECT_VENV_DIR_NAMES = PROJECT_VENV_DIRS.map((venv) => venv.dir);
166
- var AMBIENT_ENVIRONMENT_VARIABLES = {
167
- "uv-project-environment": "UV_PROJECT_ENVIRONMENT",
168
- "virtual-env": "VIRTUAL_ENV",
169
- conda: "CONDA_PREFIX"
170
- };
171
- function hasAmbientPythonEnvironment(env = process.env) {
172
- return Object.values(AMBIENT_ENVIRONMENT_VARIABLES).some((name) => Boolean(env[name]));
173
- }
174
- async function detectPythonEnvironment(projectRoot, homeDir = os.homedir(), options = {}) {
193
+ async function detectPythonEnvironment(projectRoot, homeDir = os2.homedir(), options = {}) {
175
194
  const root = realpathOrResolve(projectRoot);
176
195
  const uvWorkspace = await findUvWorkspace(root, homeDir);
177
196
  const isProjectRoot = uvWorkspace?.isStartDir === true;
@@ -224,7 +243,7 @@ async function detectPythonEnvironment(projectRoot, homeDir = os.homedir(), opti
224
243
  }
225
244
  continue;
226
245
  }
227
- const binDir = path.join(candidate.root, process.platform === "win32" ? "Scripts" : "bin");
246
+ const binDir = pythonEnvironmentBinDir(candidate.root);
228
247
  const pythonPath = path.join(binDir, process.platform === "win32" ? "python.exe" : "python");
229
248
  try {
230
249
  await access(pythonPath);
@@ -376,7 +395,7 @@ async function readRuffTier(dir, pyproject, pyprojectPath) {
376
395
  let configPath;
377
396
  let config;
378
397
  for (const name of [".ruff.toml", "ruff.toml"]) {
379
- const candidatePath = join(dir, name);
398
+ const candidatePath = join2(dir, name);
380
399
  config = await readDeclarationFile(candidatePath);
381
400
  if (config !== void 0) {
382
401
  configPath = candidatePath;
@@ -400,7 +419,7 @@ async function readRuffTier(dir, pyproject, pyprojectPath) {
400
419
  };
401
420
  }
402
421
  async function readPyrightTier(dir, pyproject, pyprojectPath) {
403
- const configPath = join(dir, "pyrightconfig.json");
422
+ const configPath = join2(dir, "pyrightconfig.json");
404
423
  const config = await readDeclarationFile(configPath);
405
424
  if (config !== void 0) {
406
425
  return {
@@ -430,7 +449,7 @@ function readRequiresPythonTier(pyproject, pyprojectPath) {
430
449
  };
431
450
  }
432
451
  async function readVersionFileTier(dir) {
433
- const levelFilePath = join(dir, ".python-version");
452
+ const levelFilePath = join2(dir, ".python-version");
434
453
  const content = await readDeclarationFile(levelFilePath);
435
454
  if (content === void 0)
436
455
  return { declaration: void 0, owned: false };
@@ -447,7 +466,7 @@ var PYTHON_DECLARATION_SOURCES = [
447
466
  "python-version-file"
448
467
  ];
449
468
  async function readPythonDeclarationInDirectory(dir, open) {
450
- const pyprojectPath = join(dir, "pyproject.toml");
469
+ const pyprojectPath = join2(dir, "pyproject.toml");
451
470
  const pyproject = await readDeclarationFile(pyprojectPath);
452
471
  const tiers = [
453
472
  ["ruff-target-version", () => readRuffTier(dir, pyproject, pyprojectPath)],
@@ -473,7 +492,7 @@ async function readPythonDeclarationInDirectory(dir, open) {
473
492
  }
474
493
  return { declaration: void 0, closed };
475
494
  }
476
- async function detectPythonTargetVersion(filePath, homeDir = os.homedir()) {
495
+ async function detectPythonTargetVersion(filePath, homeDir = os2.homedir()) {
477
496
  if (resolveLanguage(filePath)?.id !== "python")
478
497
  return void 0;
479
498
  const open = new Set(PYTHON_DECLARATION_SOURCES);
@@ -492,10 +511,11 @@ async function detectPythonTargetVersion(filePath, homeDir = os.homedir()) {
492
511
  }
493
512
 
494
513
  export {
514
+ scannerReportParentDir,
495
515
  emitBounded,
496
516
  resetBoundedTelemetry,
497
- PROJECT_VENV_DIR_NAMES,
498
517
  hasAmbientPythonEnvironment,
518
+ PROJECT_VENV_DIR_NAMES,
499
519
  detectPythonEnvironment,
500
520
  augmentPythonEnvironment,
501
521
  pythonEnvironmentToolCandidates,