pi-lens 4.5.1 → 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 (139) hide show
  1. package/CHANGELOG-USER.md +6 -6
  2. package/CHANGELOG.md +121 -0
  3. package/README.md +9 -2
  4. package/dist/{chunk-ZVQUYCBU.js → chunk-2ERVW2UF.js} +161 -100
  5. package/dist/{chunk-AFSG6YUB.js → chunk-2K7BUOKS.js} +13 -13
  6. package/dist/{chunk-BJGWP4UX.js → chunk-3JJ4OAJI.js} +10 -10
  7. package/dist/{chunk-GIK6VUCY.js → chunk-3UHGSUVL.js} +1 -1
  8. package/dist/{chunk-EKQDQPX6.js → chunk-463WN3VP.js} +1 -1
  9. package/dist/{chunk-F7BFIENK.js → chunk-4X3ML2UQ.js} +29 -32
  10. package/dist/{chunk-7JMEPY6P.js → chunk-5BI5YP57.js} +10 -10
  11. package/dist/{chunk-MKW7ZUTT.js → chunk-5Z4XLUFF.js} +3 -3
  12. package/dist/{chunk-NIZKGBOU.js → chunk-62AJH3IN.js} +12 -14
  13. package/dist/{chunk-4GLSO2EM.js → chunk-6F34GMP7.js} +12 -12
  14. package/dist/{chunk-35UJUF27.js → chunk-6LIUVGOR.js} +13 -3
  15. package/dist/{chunk-WJ7GY5WJ.js → chunk-6REF4GCO.js} +1 -1
  16. package/dist/{chunk-HFIFEH46.js → chunk-7KRR24GO.js} +3 -3
  17. package/dist/{chunk-WAK2AXQQ.js → chunk-7OMOMBEQ.js} +9 -9
  18. package/dist/{chunk-S7KUDW73.js → chunk-7ZFXICNN.js} +15 -15
  19. package/dist/{chunk-VEF3GFOL.js → chunk-ABKRQVOY.js} +28 -52
  20. package/dist/{chunk-Y2LIOCA7.js → chunk-ANSLRJBG.js} +1 -1
  21. package/dist/{chunk-ARTCVE6I.js → chunk-AWMFBPGJ.js} +9 -9
  22. package/dist/{chunk-H6DNTQ4V.js → chunk-BG7KHGNX.js} +2 -2
  23. package/dist/{chunk-FD4LJQ6Y.js → chunk-BK2R2223.js} +10 -8
  24. package/dist/{chunk-TWAQFMLW.js → chunk-BXXC6KRR.js} +31 -34
  25. package/dist/{chunk-S247BOH2.js → chunk-CKJS2AUI.js} +4 -4
  26. package/dist/{chunk-GNK2IHVG.js → chunk-COGU5KQJ.js} +15 -15
  27. package/dist/{chunk-P7EV5ISR.js → chunk-CQNXALZJ.js} +12 -6
  28. package/dist/{chunk-IO6P3NBP.js → chunk-CSZESDPP.js} +1 -1
  29. package/dist/chunk-CZ5TCJPB.js +98 -0
  30. package/dist/{chunk-DLGJYQML.js → chunk-D2LFEA5U.js} +9 -2
  31. package/dist/chunk-D3KLF5CD.js +50 -0
  32. package/dist/{chunk-W2JPGW7Q.js → chunk-ENJ2M76Y.js} +20 -20
  33. package/dist/{chunk-2DWNYVUN.js → chunk-EQKF6BAK.js} +3 -3
  34. package/dist/{chunk-KIQSNH3F.js → chunk-F2SAP2FM.js} +38 -45
  35. package/dist/{chunk-BYIEU4E4.js → chunk-F6QAJXQV.js} +2 -2
  36. package/dist/chunk-GR2QDWH5.js +25 -0
  37. package/dist/{chunk-T2D2WWP6.js → chunk-GVE5VZYQ.js} +5 -5
  38. package/dist/{chunk-HMXWZUQW.js → chunk-GWZZOJD2.js} +1 -1
  39. package/dist/chunk-GZS6VPIE.js +27 -0
  40. package/dist/chunk-H4B4SC7I.js +71 -0
  41. package/dist/{chunk-2RQREVGO.js → chunk-HA6TUJOE.js} +1 -1
  42. package/dist/{chunk-NAACKIKT.js → chunk-HKPJTI47.js} +2 -2
  43. package/dist/{chunk-NHHS5T52.js → chunk-HPKC55MA.js} +1 -1
  44. package/dist/{chunk-B2QO7GHY.js → chunk-I65CQLCG.js} +1 -1
  45. package/dist/{chunk-BQ72NQQM.js → chunk-IDKLWVKY.js} +11 -11
  46. package/dist/chunk-IUM2Q7NF.js +25 -0
  47. package/dist/{chunk-PVV27TOX.js → chunk-J24IS3KZ.js} +5 -5
  48. package/dist/{chunk-DKXIUGNA.js → chunk-J2DAHH4T.js} +2 -2
  49. package/dist/{chunk-CDAJQBKJ.js → chunk-JBDZVOFL.js} +11 -11
  50. package/dist/{chunk-T7KHGEJ5.js → chunk-JC6NFC57.js} +3 -3
  51. package/dist/{chunk-BWGNVM33.js → chunk-JTHEUTW7.js} +11 -11
  52. package/dist/{chunk-WWZLT6AM.js → chunk-JWW3ODBN.js} +2 -2
  53. package/dist/{chunk-Q32RJDYC.js → chunk-K3ZIYLHT.js} +4 -4
  54. package/dist/{chunk-LDPY22FS.js → chunk-KDPZA2UE.js} +2 -3
  55. package/dist/{chunk-YIEHUKX2.js → chunk-KMY2OU4T.js} +489 -285
  56. package/dist/{chunk-WH6O4IFD.js → chunk-KQF7VT26.js} +10 -10
  57. package/dist/{chunk-OG3UCAHV.js → chunk-KVGA7X76.js} +3 -3
  58. package/dist/{chunk-TABDCX35.js → chunk-KW7O72AK.js} +2 -2
  59. package/dist/{chunk-AOEVZXR6.js → chunk-LEQTVRSV.js} +9 -9
  60. package/dist/{chunk-7BWPQZHE.js → chunk-LKPSBM6S.js} +3 -3
  61. package/dist/{chunk-WA6U2URH.js → chunk-LKW2HFSZ.js} +6 -6
  62. package/dist/{chunk-M3QGXGY4.js → chunk-LURFD4HD.js} +624 -97
  63. package/dist/{chunk-2YQ5LI7R.js → chunk-M6ELTECW.js} +4 -4
  64. package/dist/{chunk-OHTHVILU.js → chunk-MGVVYYKW.js} +12 -12
  65. package/dist/{chunk-W2YHHNY3.js → chunk-MQBKGRSB.js} +7 -7
  66. package/dist/{chunk-MET776XM.js → chunk-MVG2ZEAO.js} +6 -6
  67. package/dist/{chunk-2XALJI2K.js → chunk-MY4XNNTX.js} +39 -41
  68. package/dist/{chunk-GFCPPCNR.js → chunk-N4AJVFRF.js} +11 -11
  69. package/dist/{chunk-UARVPNAU.js → chunk-OFKKMXWM.js} +31 -36
  70. package/dist/{chunk-DHFJS2I4.js → chunk-OFZE4ANN.js} +8 -8
  71. package/dist/chunk-OLXBUTJR.js +61 -0
  72. package/dist/{chunk-SJ2SR432.js → chunk-OZGEHOSG.js} +38 -17
  73. package/dist/{chunk-6MDWNZ7E.js → chunk-PKGOROPQ.js} +40 -2
  74. package/dist/{chunk-3IWMNN2S.js → chunk-Q6D5QKRG.js} +17 -17
  75. package/dist/{chunk-JGCBMCCS.js → chunk-QECLJFHI.js} +12 -17
  76. package/dist/{chunk-KXKM2DFP.js → chunk-QJA33VD5.js} +4 -4
  77. package/dist/{chunk-YV7XVYSJ.js → chunk-R5XVJ6AN.js} +11 -11
  78. package/dist/{chunk-62PIU4TO.js → chunk-REZL4OM4.js} +1 -1
  79. package/dist/{chunk-NNDZ7DOP.js → chunk-RK5RBREN.js} +74 -107
  80. package/dist/chunk-RP5ZQTHO.js +86 -0
  81. package/dist/{chunk-HKRESBMC.js → chunk-RURPX2YV.js} +23 -23
  82. package/dist/chunk-TB5MGZLS.js +53 -0
  83. package/dist/chunk-TC63XRYP.js +27 -0
  84. package/dist/chunk-TJOYHAXJ.js +69 -0
  85. package/dist/{chunk-NZ7NSKIW.js → chunk-TRXKDCBP.js} +13 -13
  86. package/dist/{chunk-7WAQ3K26.js → chunk-TTK37D7R.js} +22 -23
  87. package/dist/{chunk-ALTHJUZO.js → chunk-UH3QHLR5.js} +2 -2
  88. package/dist/{chunk-6MZLS6CK.js → chunk-UNTJJ7GN.js} +7 -7
  89. package/dist/{chunk-XRLZ75YY.js → chunk-UPAFSETJ.js} +54 -59
  90. package/dist/{chunk-N2U644ZW.js → chunk-UX75PTQW.js} +50 -17
  91. package/dist/{chunk-EXHSWN3P.js → chunk-V353PYMK.js} +423 -233
  92. package/dist/{chunk-SL4G67AP.js → chunk-V4TFQY5G.js} +2 -2
  93. package/dist/{chunk-YOMLAKU6.js → chunk-VC3W54G3.js} +289 -138
  94. package/dist/{chunk-KSQJBGRO.js → chunk-VSBCJVPC.js} +5 -5
  95. package/dist/{chunk-EBXCYEII.js → chunk-WAQQGXVV.js} +3 -3
  96. package/dist/{chunk-7ORBRDFY.js → chunk-WLEVWR7Y.js} +2 -2
  97. package/dist/{chunk-Q4UQNTLB.js → chunk-WPMPVP5I.js} +4 -4
  98. package/dist/{chunk-TQKWR5AZ.js → chunk-WXNLFOC2.js} +7 -7
  99. package/dist/{chunk-HOWHAKXO.js → chunk-Y3ZNOZZS.js} +6 -6
  100. package/dist/{chunk-DNJJVKJZ.js → chunk-YL6JQTWC.js} +29 -32
  101. package/dist/{chunk-HUWW77QY.js → chunk-YVE5Q2UU.js} +86 -217
  102. package/dist/{chunk-25CAONWT.js → chunk-YZNARDMM.js} +12 -9
  103. package/dist/{chunk-HERQPNY6.js → chunk-ZDWNFZJ2.js} +8 -8
  104. package/dist/{chunk-MKQFSW2Q.js → chunk-ZEUF7BIN.js} +2 -2
  105. package/dist/{chunk-AB26NAHA.js → chunk-ZIF4WLWR.js} +45 -25
  106. package/dist/{chunk-6MWX2J5H.js → chunk-ZSPVF7KI.js} +227 -24
  107. package/dist/{chunk-QQGZY2BR.js → chunk-ZX6OKBVO.js} +2 -2
  108. package/dist/index.js +6455 -5243
  109. package/dist/mcp/analyze-cli.js +8 -8
  110. package/dist/mcp/cli.js +39 -41
  111. package/dist/mcp/server.js +870 -559
  112. package/dist/mcp/worker.js +68 -59
  113. package/dist/probes/installer.js +19 -20
  114. package/docs/configuration.md +24 -10
  115. package/docs/defect-shapes.md +18 -2
  116. package/docs/environment-variables.md +18 -9
  117. package/docs/globalconfig.md +16 -0
  118. package/docs/invariants/dispatch-runners.md +7 -0
  119. package/docs/invariants/lsp-trust-exec.md +33 -3
  120. package/docs/lsp-capability-matrix.md +23 -10
  121. package/docs/lsp-idle-eviction.md +8 -3
  122. package/docs/release-qa-baseline.md +22 -17
  123. package/docs/servercapabilities.md +1 -1
  124. package/docs/settings.md +9 -2
  125. package/docs/tools.md +1 -1
  126. package/package.json +3 -3
  127. package/dist/chunk-3UTDLQWO.js +0 -88
  128. package/dist/chunk-3Z7Z3B7V.js +0 -27
  129. package/dist/chunk-4E4OCW3L.js +0 -38
  130. package/dist/chunk-5HVDD7IA.js +0 -17
  131. package/dist/chunk-BKJ6WZKP.js +0 -255
  132. package/dist/chunk-D3UQWOCB.js +0 -46
  133. package/dist/chunk-EH6EHFW2.js +0 -73
  134. package/dist/chunk-J7VNGHLN.js +0 -69
  135. package/dist/chunk-L3Q72QGQ.js +0 -25
  136. package/dist/chunk-TFSBHRL2.js +0 -25
  137. package/dist/chunk-UWBD3JMH.js +0 -56
  138. package/dist/chunk-XWWFESYZ.js +0 -27
  139. package/dist/chunk-XZSXSM4K.js +0 -27
@@ -1,26 +1,24 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
- import {
3
- resolveOpengrepConfig
4
- } from "./chunk-J7VNGHLN.js";
5
2
  import {
6
3
  PYTHON_COMPILE_VERDICT_SERVER_ID,
7
4
  augmentPythonEnvironment,
8
5
  detectPythonEnvironment,
9
- pythonEnvironmentToolCandidates
10
- } from "./chunk-AB26NAHA.js";
11
- import {
6
+ pythonEnvironmentToolCandidates,
12
7
  scannerReportParentDir
13
- } from "./chunk-5HVDD7IA.js";
8
+ } from "./chunk-ZIF4WLWR.js";
14
9
  import {
15
10
  getUserRuleRoot,
16
11
  load,
17
12
  resolvePackagePath,
18
13
  ruleCorpusFingerprintForCycle
19
- } from "./chunk-2DWNYVUN.js";
14
+ } from "./chunk-EQKF6BAK.js";
15
+ import {
16
+ resolveOpengrepRulePack
17
+ } from "./chunk-GWZZOJD2.js";
20
18
  import {
21
19
  extensionsForLanguage,
22
20
  isTypeScriptFile
23
- } from "./chunk-NAACKIKT.js";
21
+ } from "./chunk-HKPJTI47.js";
24
22
  import {
25
23
  ensureTool,
26
24
  findManagedToolBinary,
@@ -30,29 +28,29 @@ import {
30
28
  isZizmorAuditTarget,
31
29
  logSessionStart,
32
30
  resolveZizmorGitHubToken
33
- } from "./chunk-YOMLAKU6.js";
31
+ } from "./chunk-VC3W54G3.js";
34
32
  import {
35
33
  resolveToolCwd
36
- } from "./chunk-T2D2WWP6.js";
34
+ } from "./chunk-GVE5VZYQ.js";
37
35
  import {
38
36
  commandSearchReachesProject,
39
37
  findGlobalBinary,
40
38
  isProjectLocalBinPath
41
- } from "./chunk-25CAONWT.js";
39
+ } from "./chunk-YZNARDMM.js";
42
40
  import {
43
41
  hasCargoWorkspaceTable,
44
42
  readCargoWorkspaceExclude,
45
43
  readCargoWorkspaceMembers,
46
44
  readTextFileOrUndefined
47
- } from "./chunk-DKXIUGNA.js";
45
+ } from "./chunk-J2DAHH4T.js";
48
46
  import {
49
47
  classifyProbeFailure,
50
48
  describeInstallAttempt,
51
49
  logAvailabilityDecision
52
- } from "./chunk-LDPY22FS.js";
50
+ } from "./chunk-KDPZA2UE.js";
53
51
  import {
54
52
  readDirEntriesSafeAsync
55
- } from "./chunk-TABDCX35.js";
53
+ } from "./chunk-KW7O72AK.js";
56
54
  import {
57
55
  OWNER_TAG_ENV,
58
56
  SpawnFailureError,
@@ -72,6 +70,7 @@ import {
72
70
  isUntrustedProjectPath,
73
71
  mergeWindowsEnvironment,
74
72
  ownerTagForChildren,
73
+ projectSearchJudge,
75
74
  recordProjectCommandRefusal,
76
75
  resolveGitCheckout,
77
76
  resolveLinkedWorktreeOwner,
@@ -80,8 +79,9 @@ import {
80
79
  safeSpawn,
81
80
  safeSpawnAsync,
82
81
  statIsFile,
83
- trustScopedEnvironment
84
- } from "./chunk-M3QGXGY4.js";
82
+ trustScopedEnvironment,
83
+ withUnadmittedRootSpawns
84
+ } from "./chunk-LURFD4HD.js";
85
85
  import {
86
86
  boundedKeyLabel,
87
87
  finalizeRecords,
@@ -93,13 +93,13 @@ import {
93
93
  reportPiLensConfigRecords,
94
94
  resolvePiLensConfig,
95
95
  summarizeConfigResolution
96
- } from "./chunk-N2U644ZW.js";
96
+ } from "./chunk-UX75PTQW.js";
97
97
  import {
98
98
  DOTNET_CSHARP_ROOT_MARKERS,
99
99
  DOTNET_FSHARP_ROOT_MARKERS,
100
100
  KIND_EXTENSIONS,
101
101
  LEAN_ROOT_MARKERS
102
- } from "./chunk-SL4G67AP.js";
102
+ } from "./chunk-V4TFQY5G.js";
103
103
  import {
104
104
  FRESHNESS_CADENCE_MS,
105
105
  LSP_NAMESPACE_KEY,
@@ -110,19 +110,19 @@ import {
110
110
  getDirectoryMarkers,
111
111
  getPiLensGlobalConfigPath,
112
112
  unknownDirMtimeRecords
113
- } from "./chunk-DLGJYQML.js";
113
+ } from "./chunk-D2LFEA5U.js";
114
114
  import {
115
115
  HOOK_WALL_BUDGET_MS,
116
116
  bounded,
117
117
  getProjectTrustGeneration,
118
118
  getProjectTrustState
119
- } from "./chunk-EKQDQPX6.js";
119
+ } from "./chunk-463WN3VP.js";
120
120
  import {
121
121
  getDegradationLedgerGeneration,
122
122
  incrementDegradationCount,
123
123
  logExtension,
124
124
  recordDegradationOnce
125
- } from "./chunk-P7EV5ISR.js";
125
+ } from "./chunk-CQNXALZJ.js";
126
126
  import {
127
127
  claimPhaseOncePerSession,
128
128
  currentSessionRecordId,
@@ -133,7 +133,7 @@ import {
133
133
  logLatency,
134
134
  redactSecrets,
135
135
  releasePhaseClaim
136
- } from "./chunk-HUWW77QY.js";
136
+ } from "./chunk-YVE5Q2UU.js";
137
137
  import {
138
138
  STAGE_TMP_PATTERN
139
139
  } from "./chunk-LJDODBBZ.js";
@@ -160,7 +160,64 @@ import {
160
160
  toPosix,
161
161
  toProjectRelativePath,
162
162
  walkUpDirs
163
- } from "./chunk-6MWX2J5H.js";
163
+ } from "./chunk-ZSPVF7KI.js";
164
+
165
+ // dist/clients/opengrep-config.js
166
+ import * as path from "node:path";
167
+ var LOCAL_OPENGREP_CONFIG_NAMES = [
168
+ ".opengrep.yml",
169
+ ".opengrep.yaml",
170
+ "opengrep.yml",
171
+ "opengrep.yaml",
172
+ ".semgrep.yml",
173
+ ".semgrep.yaml",
174
+ "semgrep.yml",
175
+ "semgrep.yaml"
176
+ ];
177
+ function findLocalOpengrepConfig(startDir) {
178
+ return findLocalToolConfig(startDir, LOCAL_OPENGREP_CONFIG_NAMES);
179
+ }
180
+ function isRegistryOrAutoConfig(config) {
181
+ return config === "auto" || config.startsWith("p/") || config.startsWith("r/");
182
+ }
183
+ function normalizeOpengrepConfigArg(config, cwd) {
184
+ if (!config)
185
+ return void 0;
186
+ const trimmed = config.trim();
187
+ if (!trimmed)
188
+ return void 0;
189
+ if (isRegistryOrAutoConfig(trimmed))
190
+ return trimmed;
191
+ return path.isAbsolute(trimmed) ? trimmed : path.resolve(cwd, trimmed);
192
+ }
193
+ function resolveOpengrepConfig(cwd, flags) {
194
+ const localConfig = findLocalOpengrepConfig(cwd);
195
+ const flagConfig = typeof flags?.config === "string" && flags.config.trim() ? flags.config.trim() : void 0;
196
+ if (flags?.enabled || flagConfig) {
197
+ const explicit = normalizeOpengrepConfigArg(flagConfig ?? localConfig, cwd);
198
+ if (explicit) {
199
+ return {
200
+ enabled: true,
201
+ configArg: explicit,
202
+ source: localConfig && !flagConfig ? "local" : "flag"
203
+ };
204
+ }
205
+ const pack = resolveOpengrepRulePack();
206
+ return pack ? { enabled: true, configArg: pack, source: "pack" } : { enabled: true, configArg: "auto", source: "flag" };
207
+ }
208
+ if (localConfig) {
209
+ return {
210
+ enabled: true,
211
+ configArg: localConfig,
212
+ source: "local"
213
+ };
214
+ }
215
+ return {
216
+ enabled: false,
217
+ source: "disabled",
218
+ reason: "no local opengrep config (.opengrep.yml) and --lens-opengrep not set"
219
+ };
220
+ }
164
221
 
165
222
  // dist/clients/analysis-root.js
166
223
  import * as fs from "node:fs";
@@ -329,11 +386,11 @@ function serverTraits(declaration) {
329
386
  }
330
387
 
331
388
  // dist/clients/lsp/file-server-match.js
332
- import path from "node:path";
389
+ import path2 from "node:path";
333
390
  function fileMatchKeys(filePath) {
334
391
  return {
335
- ext: path.extname(filePath).toLowerCase(),
336
- base: path.basename(filePath).toLowerCase()
392
+ ext: path2.extname(filePath).toLowerCase(),
393
+ base: path2.basename(filePath).toLowerCase()
337
394
  };
338
395
  }
339
396
  function fileMatchReason(server, filePath, ext, base) {
@@ -357,14 +414,14 @@ function registeredServers(config, catalog) {
357
414
  }
358
415
 
359
416
  // dist/clients/lsp/server.js
360
- import { existsSync as existsSync3, mkdirSync as mkdirSync2, statSync as statSync4 } from "node:fs";
417
+ import { existsSync as existsSync3, mkdirSync as mkdirSync2, readdirSync as readdirSync5, statSync as statSync4 } from "node:fs";
361
418
  import { access, readFile, readdir, realpath, stat } from "node:fs/promises";
362
419
  import os6 from "node:os";
363
- import path8 from "node:path";
420
+ import path9 from "node:path";
364
421
 
365
422
  // dist/clients/shell-dialect.js
366
423
  import * as fs2 from "node:fs";
367
- import * as path2 from "node:path";
424
+ import * as path3 from "node:path";
368
425
  var SHELLCHECK_SUPPORTED_DIALECTS = [
369
426
  "sh",
370
427
  "bash",
@@ -417,7 +474,7 @@ function resolveShellFileDialect(filePath) {
417
474
  }
418
475
  const directive = parseShellDirective(content);
419
476
  const shebang = parseShebang(content);
420
- const parsed = directive ?? shebang ?? (path2.extname(filePath).toLowerCase() === ".zsh" ? "zsh" : null);
477
+ const parsed = directive ?? shebang ?? (path3.extname(filePath).toLowerCase() === ".zsh" ? "zsh" : null);
421
478
  return {
422
479
  shebang,
423
480
  directive,
@@ -428,22 +485,22 @@ function resolveShellFileDialect(filePath) {
428
485
  // dist/clients/sgconfig.js
429
486
  import { createHash } from "node:crypto";
430
487
  import * as fs3 from "node:fs";
431
- import * as path3 from "node:path";
488
+ import * as path4 from "node:path";
432
489
  var SGCONFIG_NAMES = ["sgconfig.yml", "sgconfig.yaml"];
433
490
  function findLocalSgconfig(startDir) {
434
491
  return findLocalToolConfig(startDir, SGCONFIG_NAMES);
435
492
  }
436
493
  function getAstGrepRuleSources(projectRoot = process.cwd()) {
437
- const root = path3.resolve(projectRoot || process.cwd());
494
+ const root = path4.resolve(projectRoot || process.cwd());
438
495
  const packageRoot = resolvePackagePath(import.meta.url);
439
496
  const candidates = [];
440
497
  if (realpathOrResolve(root) !== realpathOrResolve(packageRoot)) {
441
498
  candidates.push({
442
- dir: path3.join(root, "rules", "ast-grep-rules", "rules"),
499
+ dir: path4.join(root, "rules", "ast-grep-rules", "rules"),
443
500
  origin: "project",
444
501
  tier: "primary"
445
502
  }, {
446
- dir: path3.join(root, "rules", "ast-grep-rules", "coderabbit", "rules"),
503
+ dir: path4.join(root, "rules", "ast-grep-rules", "coderabbit", "rules"),
447
504
  origin: "project",
448
505
  tier: "secondary"
449
506
  });
@@ -451,21 +508,21 @@ function getAstGrepRuleSources(projectRoot = process.cwd()) {
451
508
  const userRoot = getUserRuleRoot();
452
509
  if (realpathOrResolve(userRoot) !== realpathOrResolve(root)) {
453
510
  candidates.push({
454
- dir: path3.join(userRoot, "ast-grep-rules", "rules"),
511
+ dir: path4.join(userRoot, "ast-grep-rules", "rules"),
455
512
  origin: "user",
456
513
  tier: "primary"
457
514
  }, {
458
- dir: path3.join(userRoot, "ast-grep-rules", "coderabbit", "rules"),
515
+ dir: path4.join(userRoot, "ast-grep-rules", "coderabbit", "rules"),
459
516
  origin: "user",
460
517
  tier: "secondary"
461
518
  });
462
519
  }
463
520
  candidates.push({
464
- dir: path3.join(packageRoot, "rules", "ast-grep-rules", "rules"),
521
+ dir: path4.join(packageRoot, "rules", "ast-grep-rules", "rules"),
465
522
  origin: "bundled",
466
523
  tier: "primary"
467
524
  }, {
468
- dir: path3.join(packageRoot, "rules", "ast-grep-rules", "coderabbit", "rules"),
525
+ dir: path4.join(packageRoot, "rules", "ast-grep-rules", "coderabbit", "rules"),
469
526
  origin: "bundled",
470
527
  tier: "secondary"
471
528
  });
@@ -489,7 +546,7 @@ function findYamlFiles(dir) {
489
546
  return files;
490
547
  }
491
548
  for (const entry of entries) {
492
- const full = path3.join(dir, entry.name);
549
+ const full = path4.join(dir, entry.name);
493
550
  if (entry.isDirectory()) {
494
551
  files.push(...findYamlFiles(full));
495
552
  } else if (entry.isFile() && /\.ya?ml$/i.test(entry.name)) {
@@ -531,7 +588,7 @@ function snapshotRuleSource(source) {
531
588
  const hash = createHash("sha256");
532
589
  const files = [];
533
590
  for (const file of findYamlFiles(source.dir)) {
534
- const relativePath = path3.relative(source.dir, file);
591
+ const relativePath = path4.relative(source.dir, file);
535
592
  hash.update(relativePath);
536
593
  hash.update("\0");
537
594
  let content;
@@ -574,7 +631,7 @@ function sourceFingerprint(sources) {
574
631
  return hash.digest("hex");
575
632
  }
576
633
  function getAstGrepRuleFingerprint(projectRoot = process.cwd(), options = {}) {
577
- const root = path3.resolve(projectRoot || process.cwd());
634
+ const root = path4.resolve(projectRoot || process.cwd());
578
635
  return ruleCorpusFingerprintForCycle("ast-grep", root, (fingerprintRoot) => sourceFingerprint(getAstGrepRuleSources(fingerprintRoot).map(snapshotRuleSource)), options.force);
579
636
  }
580
637
  function materializeMergedRuleDir(sources, mergedDir) {
@@ -594,7 +651,7 @@ function materializeMergedRuleDir(sources, mergedDir) {
594
651
  });
595
652
  if (survivingDocuments.length === 0)
596
653
  continue;
597
- const destination = path3.join(mergedDir, `source${sourceIndex}-${String(fileIndex).padStart(5, "0")}.yml`);
654
+ const destination = path4.join(mergedDir, `source${sourceIndex}-${String(fileIndex).padStart(5, "0")}.yml`);
598
655
  if (survivingDocuments.length === file.documents.length) {
599
656
  fs3.copyFileSync(file.file, destination);
600
657
  } else {
@@ -611,7 +668,7 @@ function rootArtifactKey(root) {
611
668
  return createHash("sha256").update(root).digest("hex").slice(0, 12);
612
669
  }
613
670
  function resolveBaselineSgconfig(projectRoot = process.cwd()) {
614
- const root = realpathOrResolve(path3.resolve(projectRoot || process.cwd()));
671
+ const root = realpathOrResolve(path4.resolve(projectRoot || process.cwd()));
615
672
  const fingerprint = getAstGrepRuleFingerprint(root, { force: true });
616
673
  const cached = cachedBaselines.get(root);
617
674
  if (cached?.fingerprint === fingerprint && fs3.existsSync(cached.path) && fs3.existsSync(cached.mergedDir)) {
@@ -620,11 +677,11 @@ function resolveBaselineSgconfig(projectRoot = process.cwd()) {
620
677
  const sources = getAstGrepRuleSources(root).map(snapshotRuleSource);
621
678
  if (sources.length === 0)
622
679
  return void 0;
623
- const dir = path3.join(scannerReportParentDir(), "pi-lens-ast-grep");
680
+ const dir = path4.join(scannerReportParentDir(), "pi-lens-ast-grep");
624
681
  fs3.mkdirSync(dir, { recursive: true });
625
682
  const artifactKey = rootArtifactKey(root);
626
- const file = path3.join(dir, `baseline-${process.pid}-${artifactKey}.sgconfig.yml`);
627
- const mergedDir = path3.join(dir, `baseline-${process.pid}-${artifactKey}.rules`);
683
+ const file = path4.join(dir, `baseline-${process.pid}-${artifactKey}.sgconfig.yml`);
684
+ const mergedDir = path4.join(dir, `baseline-${process.pid}-${artifactKey}.rules`);
628
685
  const protectedArtifacts = /* @__PURE__ */ new Set([file, mergedDir]);
629
686
  for (const baseline of cachedBaselines.values()) {
630
687
  protectedArtifacts.add(baseline.path);
@@ -632,7 +689,7 @@ function resolveBaselineSgconfig(projectRoot = process.cwd()) {
632
689
  }
633
690
  cleanupStaleBaselines(dir, protectedArtifacts);
634
691
  materializeMergedRuleDir(sources, mergedDir);
635
- const ruleDirForYaml = mergedDir.split(path3.sep).join("/");
692
+ const ruleDirForYaml = mergedDir.split(path4.sep).join("/");
636
693
  fs3.writeFileSync(file, `ruleDirs:
637
694
  - ${JSON.stringify(ruleDirForYaml)}
638
695
  `);
@@ -654,7 +711,7 @@ function enforceBaselineEntryCap(dir, keep) {
654
711
  const isMergedDir = /^baseline-\d+(?:-[a-f0-9]+)?\.rules$/.test(name);
655
712
  if (!isConfig && !isMergedDir)
656
713
  continue;
657
- const full = path3.join(dir, name);
714
+ const full = path4.join(dir, name);
658
715
  if (keep.has(full))
659
716
  continue;
660
717
  try {
@@ -702,7 +759,7 @@ function cleanupStaleBaselines(dir, keep) {
702
759
  const isMergedDir = /^baseline-\d+(?:-[a-f0-9]+)?\.rules$/.test(name);
703
760
  if (!isConfig && !isMergedDir)
704
761
  continue;
705
- const full = path3.join(dir, name);
762
+ const full = path4.join(dir, name);
706
763
  if (keep.has(full))
707
764
  continue;
708
765
  try {
@@ -729,7 +786,7 @@ function findLocalTyposConfig(startDir) {
729
786
 
730
787
  // dist/clients/lsp/config.js
731
788
  import * as os3 from "node:os";
732
- import path5 from "node:path";
789
+ import path6 from "node:path";
733
790
 
734
791
  // dist/clients/dispatch/known-runner-ids.js
735
792
  var knownRunnerIds = /* @__PURE__ */ new Set();
@@ -748,7 +805,7 @@ import { AsyncLocalStorage } from "node:async_hooks";
748
805
  import { spawn as nodeSpawn } from "node:child_process";
749
806
  import fs5 from "node:fs";
750
807
  import os2 from "node:os";
751
- import path4 from "node:path";
808
+ import path5 from "node:path";
752
809
 
753
810
  // dist/clients/lsp/ruby-drive-dirs.js
754
811
  import * as fs4 from "node:fs";
@@ -792,15 +849,99 @@ async function getRubyVersionDirNamesAsync(driveRoot) {
792
849
  // dist/clients/lsp/launch.js
793
850
  var isWindows = process.platform === "win32";
794
851
  var OWNER_TAG_READ_MS = 5e3;
795
- function computeNeedsShell(resolvedCommand) {
796
- return isWindows && (resolvedCommand.includes(" ") || /\.(cmd|bat)$/i.test(resolvedCommand) || !/\.(exe|cmd|bat)$/i.test(resolvedCommand));
852
+ function planServerLaunch(command, args, cwd, env) {
853
+ if (!isWindows)
854
+ return { command, args, shell: false, script: false };
855
+ const file = resolveWindowsCommandForEnvironment(command, cwd, env)?.resolvedPath ?? command;
856
+ if (/\.(exe|com)$/i.test(file)) {
857
+ return { command: file, args, shell: false, script: false };
858
+ }
859
+ const shim = /\.(cmd|bat)$/i.test(file) ? resolveNpmCmdShim(file, cwd, env) : void 0;
860
+ if (shim) {
861
+ return {
862
+ command: shim.program,
863
+ args: [shim.script, ...args],
864
+ shell: false,
865
+ script: true
866
+ };
867
+ }
868
+ return { command: file, args, shell: true, script: true };
869
+ }
870
+ var NPM_CMD_SHIM_HEAD = [
871
+ "@ECHO off",
872
+ "GOTO start",
873
+ ":find_dp0",
874
+ "SET dp0=%~dp0",
875
+ "EXIT /b",
876
+ ":start",
877
+ "SETLOCAL",
878
+ "CALL :find_dp0",
879
+ 'IF EXIST "%dp0%\\node.exe" (',
880
+ 'SET "_prog=%dp0%\\node.exe"',
881
+ ") ELSE (",
882
+ 'SET "_prog=node"'
883
+ ];
884
+ var NPM_CMD_SHIM_TEMPLATES = [
885
+ {
886
+ tail: ["SET PATHEXT=%PATHEXT:;.JS;=;%", ")"],
887
+ run: /^endLocal & goto #_undefined_# 2>NUL \|\| title %COMSPEC% & "%_prog%"\s+"%dp0%\\([^"%]+)"\s+%\*$/
888
+ },
889
+ {
890
+ tail: [")"],
891
+ run: /^set PATHEXT=%PATHEXT:;\.JS;=;% & "%_prog%"\s+"%dp0%\\([^"%]+)"\s+%\*$/
892
+ }
893
+ ];
894
+ function parseNpmCmdShim(content) {
895
+ const lines = content.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0);
896
+ for (const template of NPM_CMD_SHIM_TEMPLATES) {
897
+ const head = [...NPM_CMD_SHIM_HEAD, ...template.tail];
898
+ if (lines.length !== head.length + 1)
899
+ continue;
900
+ if (!head.every((line, index) => lines[index] === line))
901
+ continue;
902
+ const target = template.run.exec(lines[head.length] ?? "")?.[1];
903
+ if (target !== void 0)
904
+ return target;
905
+ }
906
+ return void 0;
907
+ }
908
+ function resolveNpmCmdShim(shimFile, cwd, env) {
909
+ const recordUncontained = (why) => {
910
+ recordDegradationOnce({
911
+ kind: "lsp-server-uncontained",
912
+ subject: shimFile,
913
+ reason: `${path5.basename(shimFile)} runs behind cmd.exe, so its server outlives a pi that is killed: ${why}`
914
+ });
915
+ return void 0;
916
+ };
917
+ let content;
918
+ try {
919
+ content = fs5.readFileSync(shimFile, "utf-8");
920
+ } catch (cause) {
921
+ recordUncontained(`the shim could not be read (${String(cause)})`);
922
+ return void 0;
923
+ }
924
+ const target = parseNpmCmdShim(content);
925
+ if (target === void 0)
926
+ return recordUncontained("not an npm cmd-shim template");
927
+ const dir = path5.dirname(shimFile);
928
+ const script = path5.resolve(dir, target.replace(/[/\\]/g, path5.sep));
929
+ if (!statIsFile(script))
930
+ return recordUncontained(`its script is not a file: ${script}`);
931
+ const besideShim = path5.join(dir, "node.exe");
932
+ const program = statIsFile(besideShim) ? besideShim : resolveWindowsCommandForEnvironment("node", cwd, env)?.resolvedPath;
933
+ if (program === void 0)
934
+ return recordUncontained("no node.exe beside it or on the child's PATH");
935
+ if (!/\.exe$/i.test(program))
936
+ return recordUncontained(`node is not an .exe: ${program}`);
937
+ return { program, script };
797
938
  }
798
939
  var DEFAULT_STARTUP_FAILURE_WINDOW_MS = 50;
799
940
  var WINDOWS_NAV_STARTUP_FAILURE_WINDOW_MS = 500;
800
941
  var SESSIONSTART_LOG_DIR = getGlobalPiLensLogDir();
801
- var SESSIONSTART_LOG = path4.join(SESSIONSTART_LOG_DIR, "sessionstart.log");
802
- var PI_LENS_BIN_DIR = path4.join(getGlobalPiLensDir(), "bin");
803
- var PI_LENS_TOOLS_BIN_DIR = path4.join(getGlobalPiLensDir(), "tools", "node_modules", ".bin");
942
+ var SESSIONSTART_LOG = path5.join(SESSIONSTART_LOG_DIR, "sessionstart.log");
943
+ var PI_LENS_BIN_DIR = path5.join(getGlobalPiLensDir(), "bin");
944
+ var PI_LENS_TOOLS_BIN_DIR = path5.join(getGlobalPiLensDir(), "tools", "node_modules", ".bin");
804
945
  function logSessionStart2(msg) {
805
946
  if (isTestMode()) {
806
947
  return;
@@ -829,8 +970,8 @@ function splitPathEntries(value, delimiter) {
829
970
  }
830
971
  function normalizePathEntry(entry, platform) {
831
972
  if (platform !== "win32")
832
- return path4.posix.normalize(entry);
833
- return path4.win32.normalize(entry).toLowerCase();
973
+ return path5.posix.normalize(entry);
974
+ return path5.win32.normalize(entry).toLowerCase();
834
975
  }
835
976
  function combinePathValuesForPlatform(values, platform = process.platform) {
836
977
  const unique = [];
@@ -873,27 +1014,27 @@ function getLiveWindowsPath() {
873
1014
  }
874
1015
  async function buildAugmentedPath(basePath) {
875
1016
  const candidates = [];
876
- const nodeDir = path4.dirname(process.execPath);
1017
+ const nodeDir = path5.dirname(process.execPath);
877
1018
  if (nodeDir) {
878
1019
  candidates.push(nodeDir);
879
1020
  }
880
1021
  if (isWindows) {
881
1022
  const home = os2.homedir();
882
- const driveRoot = path4.parse(home).root;
883
- candidates.push(path4.join(home, ".cargo", "bin"));
884
- candidates.push(path4.join(home, "go", "bin"));
885
- candidates.push(path4.join(home, ".dotnet", "tools"));
1023
+ const driveRoot = path5.parse(home).root;
1024
+ candidates.push(path5.join(home, ".cargo", "bin"));
1025
+ candidates.push(path5.join(home, "go", "bin"));
1026
+ candidates.push(path5.join(home, ".dotnet", "tools"));
886
1027
  candidates.push(PI_LENS_BIN_DIR);
887
1028
  candidates.push(PI_LENS_TOOLS_BIN_DIR);
888
- candidates.push(path4.join(driveRoot, "Program Files", "Go", "bin"));
889
- candidates.push(path4.join(driveRoot, "Go", "bin"));
1029
+ candidates.push(path5.join(driveRoot, "Program Files", "Go", "bin"));
1030
+ candidates.push(path5.join(driveRoot, "Go", "bin"));
890
1031
  for (const entry of await getRubyVersionDirNamesAsync(driveRoot)) {
891
- candidates.push(path4.join(driveRoot, entry, "bin"));
1032
+ candidates.push(path5.join(driveRoot, entry, "bin"));
892
1033
  }
893
1034
  }
894
1035
  const effectiveBase = isWindows ? combinePathValuesForPlatform([basePath, getLiveWindowsPath()]) : basePath;
895
1036
  const existing = /* @__PURE__ */ new Set();
896
- for (const entry of splitPathEntries(effectiveBase, path4.delimiter)) {
1037
+ for (const entry of splitPathEntries(effectiveBase, path5.delimiter)) {
897
1038
  if (!entry)
898
1039
  continue;
899
1040
  existing.add(normalizePathEntry(entry, process.platform));
@@ -911,18 +1052,18 @@ async function buildAugmentedPath(basePath) {
911
1052
  if (toAppend.length === 0)
912
1053
  return basePath ?? "";
913
1054
  if (!basePath)
914
- return toAppend.join(path4.delimiter);
915
- return `${basePath}${path4.delimiter}${toAppend.join(path4.delimiter)}`;
1055
+ return toAppend.join(path5.delimiter);
1056
+ return `${basePath}${path5.delimiter}${toAppend.join(path5.delimiter)}`;
916
1057
  }
917
1058
  function isCmdShimValid(cmdPath, cwd) {
918
- const shimFile = cwd === void 0 ? cmdPath : path4.resolve(cwd, cmdPath);
1059
+ const shimFile = cwd === void 0 ? cmdPath : path5.resolve(cwd, cmdPath);
919
1060
  try {
920
1061
  const content = fs5.readFileSync(shimFile, "utf-8");
921
1062
  const match = content.match(/"%~dp0[/\\]\.\.[/\\]((?:[\w./@-]|\\)+\.(?:mjs|cjs|js))"/i);
922
1063
  if (!match)
923
1064
  return true;
924
- const relPath = match[1].replace(/[/\\]/g, path4.sep);
925
- const target = path4.resolve(path4.dirname(shimFile), "..", relPath);
1065
+ const relPath = match[1].replace(/[/\\]/g, path5.sep);
1066
+ const target = path5.resolve(path5.dirname(shimFile), "..", relPath);
926
1067
  return fs5.existsSync(target);
927
1068
  } catch {
928
1069
  return statIsFile(shimFile);
@@ -949,19 +1090,18 @@ function isMissingWindowsStartupCommand(spawnCommand, presence, cwd) {
949
1090
  function bypassPs1OnWindows(ps1Path, args) {
950
1091
  const cmdPath = `${ps1Path.slice(0, -4)}.cmd`;
951
1092
  if (fs5.existsSync(cmdPath)) {
952
- return { command: cmdPath, args, needsShell: true };
1093
+ return { command: cmdPath, args };
953
1094
  }
954
1095
  try {
955
1096
  const content = fs5.readFileSync(ps1Path, "utf-8");
956
1097
  const match = content.match(/"\$basedir[/\\]\.\.[/\\]((?:[\w./@-]|\\)+\.(?:mjs|cjs|js))"/i);
957
1098
  if (match) {
958
- const relPath = match[1].replace(/[/\\]/g, path4.sep);
959
- const jsPath = path4.resolve(path4.dirname(ps1Path), "..", relPath);
1099
+ const relPath = match[1].replace(/[/\\]/g, path5.sep);
1100
+ const jsPath = path5.resolve(path5.dirname(ps1Path), "..", relPath);
960
1101
  if (fs5.existsSync(jsPath)) {
961
1102
  return {
962
1103
  command: process.execPath,
963
- args: [jsPath, ...args],
964
- needsShell: false
1104
+ args: [jsPath, ...args]
965
1105
  };
966
1106
  }
967
1107
  }
@@ -979,10 +1119,13 @@ var lspProjectCodePermission = new AsyncLocalStorage();
979
1119
  function withLspProjectCodePermission(allowed, spawn) {
980
1120
  return lspProjectCodePermission.run(allowed, spawn);
981
1121
  }
1122
+ function isLspProjectCodeAdmitted(projectCodeAllowed = lspProjectCodePermission.getStore() ?? false) {
1123
+ return projectCodeAllowed && getProjectTrustState() === "trusted";
1124
+ }
982
1125
  var unknownProjectLocalNoticeGeneration = -1;
983
1126
  function recordUntrustedLspExecution(request, trust) {
984
1127
  const generation = getDegradationLedgerGeneration();
985
- const subject = request.kind === "project-code-server" ? `project-code-server:g${generation}:${request.serverId}:${request.root}` : `project-local-binary:g${generation}:${path4.basename(request.command)}`;
1128
+ const subject = request.kind === "project-code-server" ? `project-code-server:g${generation}:${request.serverId}:${request.root}` : `project-local-binary:g${generation}:${path5.basename(request.command)}`;
986
1129
  const metadata = request.kind === "project-code-server" ? {
987
1130
  field: request.kind,
988
1131
  serverId: request.serverId,
@@ -1019,7 +1162,7 @@ function refuseUntrustedLspExecution(request, trust = getProjectTrustState()) {
1019
1162
  }
1020
1163
  function admitProjectSuppliedTsserver(tsserverPath, cwd, projectSupplied, projectCodeAllowed = lspProjectCodePermission.getStore() ?? false) {
1021
1164
  const trust = getProjectTrustState();
1022
- if (tsserverPath && (!projectSupplied || projectCodeAllowed && trust === "trusted"))
1165
+ if (tsserverPath && (!projectSupplied || isLspProjectCodeAdmitted(projectCodeAllowed)))
1023
1166
  return tsserverPath;
1024
1167
  if (!tsserverPath) {
1025
1168
  recordUnresolvedTypeScriptCompiler(cwd, trust);
@@ -1061,19 +1204,24 @@ function sessionRepositoryHoldsCompiler(cwd) {
1061
1204
  function isProjectLocalLspBinary(resolvedCommand, cwd) {
1062
1205
  return isProjectLocalBinPath(resolvedCommand, cwd);
1063
1206
  }
1064
- function refuseProjectLookup(command, spawnCommand, cwd, env) {
1207
+ function refuseProjectLookup(command, spawnCommand, cwd, env, reachesRoot) {
1065
1208
  const unresolved = spawnCommand === command;
1066
1209
  if (unresolved && !isWindows)
1067
1210
  return;
1068
1211
  const owned = unresolved ? resolveWindowsCommandForEnvironment(command, cwd, mergeWindowsEnvironment(env, { PATH: cwd }))?.resolvedPath : spawnCommand;
1069
- if (owned === void 0 || !isUntrustedProjectPath(owned))
1212
+ if (owned === void 0)
1213
+ return;
1214
+ const inRoot = reachesRoot?.(path5.dirname(realpathOrResolve(owned))) === true;
1215
+ if (!inRoot && !isUntrustedProjectPath(owned))
1070
1216
  return;
1071
1217
  recordProjectCommandRefusal(owned);
1072
1218
  throw new SpawnFailureError("trust-refused", `LSP lookup refused: ${command} resolved inside the project and project trust is ${getProjectTrustState()}`, new Error(`project trust is ${getProjectTrustState()}`));
1073
1219
  }
1074
- function trySpawn(command, args, cwd, env, needsShell) {
1220
+ function trySpawn(spawnCommand, spawnArgs, cwd, env) {
1221
+ const plan = planServerLaunch(spawnCommand, spawnArgs, cwd, env);
1222
+ const { command, args } = plan;
1075
1223
  let proc;
1076
- if (needsShell) {
1224
+ if (plan.shell) {
1077
1225
  const escapeCmdArg = (s) => {
1078
1226
  const escaped = s.replace(/([&|<>^()!])/g, "^$1");
1079
1227
  return /[\s"]/.test(escaped) ? `"${escaped.replace(/"/g, '""')}"` : escaped;
@@ -1099,8 +1247,8 @@ function trySpawn(command, args, cwd, env, needsShell) {
1099
1247
  if (!proc.stdin || !proc.stdout || !proc.stderr) {
1100
1248
  throw new Error(`Failed to spawn LSP server: ${command}`);
1101
1249
  }
1102
- holdOwnChildPid(proc.pid, "lsp-spawn");
1103
- return proc;
1250
+ holdOwnChildPid(proc, "lsp-spawn");
1251
+ return { proc, plan };
1104
1252
  }
1105
1253
  function unrefLspProcessHandles(proc) {
1106
1254
  try {
@@ -1153,27 +1301,26 @@ async function launchLSP(command, args = [], options = {}) {
1153
1301
  const mergedEnv = { ...process.env, ...options.env };
1154
1302
  const augmentedPath = await buildAugmentedPath(resolvePathValue(mergedEnv));
1155
1303
  const ownerTag = await ownerTagForChildren({ timeoutMs: OWNER_TAG_READ_MS });
1304
+ const reachesRoot = isLspProjectCodeAdmitted() ? void 0 : projectSearchJudge(cwd);
1156
1305
  const env = trustScopedEnvironment({
1157
1306
  ...mergedEnv,
1158
1307
  PATH: augmentedPath,
1159
1308
  ...isWindows ? { Path: augmentedPath } : {}
1160
- }, cwd);
1309
+ }, cwd, reachesRoot);
1161
1310
  if (ownerTag === void 0)
1162
1311
  delete env[OWNER_TAG_ENV];
1163
1312
  else
1164
1313
  env[OWNER_TAG_ENV] = ownerTag;
1165
- const isBareCommand = !isFullyQualified(command) && !command.includes(path4.sep) && !command.includes("/");
1166
- const isRelativePath = !isFullyQualified(command) && (command.includes(path4.sep) || command.includes("/"));
1167
- const explicitCommand = isRelativePath ? path4.resolve(cwd, command) : command;
1314
+ const isBareCommand = !isFullyQualified(command) && !command.includes(path5.sep) && !command.includes("/");
1315
+ const isRelativePath = !isFullyQualified(command) && (command.includes(path5.sep) || command.includes("/"));
1316
+ const explicitCommand = isRelativePath ? path5.resolve(cwd, command) : command;
1168
1317
  const scannedCommandPath = isBareCommand ? findBinaryOnPath(command, env, cwd) : void 0;
1169
1318
  const resolvedCommand = scannedCommandPath ?? explicitCommand;
1170
- let needsShell = computeNeedsShell(resolvedCommand);
1171
1319
  let spawnCommand = resolvedCommand;
1172
1320
  if (isBareCommand) {
1173
1321
  const globalBinPath = await findGlobalBinary(command);
1174
1322
  if (globalBinPath) {
1175
1323
  spawnCommand = globalBinPath;
1176
- needsShell = computeNeedsShell(spawnCommand);
1177
1324
  }
1178
1325
  }
1179
1326
  const commandPresence = isWindows ? windowsCommandPresence({
@@ -1184,7 +1331,7 @@ async function launchLSP(command, args = [], options = {}) {
1184
1331
  cwd,
1185
1332
  env
1186
1333
  }) : "absent";
1187
- if (isProjectLocalLspBinary(spawnCommand, cwd)) {
1334
+ if ((isBareCommand || fs5.existsSync(spawnCommand) || commandPresence === "present") && isProjectLocalLspBinary(spawnCommand, cwd)) {
1188
1335
  refuseUntrustedLspExecution({
1189
1336
  kind: "project-local-binary",
1190
1337
  command,
@@ -1193,7 +1340,7 @@ async function launchLSP(command, args = [], options = {}) {
1193
1340
  });
1194
1341
  }
1195
1342
  if (isBareCommand)
1196
- refuseProjectLookup(command, spawnCommand, cwd, env);
1343
+ refuseProjectLookup(command, spawnCommand, cwd, env, reachesRoot);
1197
1344
  if (isWindows && /\.(cmd|bat)$/i.test(spawnCommand) && !isCmdShimValid(spawnCommand, cwd)) {
1198
1345
  logSessionStart2(`lsp cmd-shim-invalid: ${spawnCommand} target missing \u2014 skipping candidate`);
1199
1346
  const cause = Object.assign(new Error(`LSP .cmd shim target not found: ${spawnCommand}`), { code: "ENOENT" });
@@ -1202,23 +1349,21 @@ async function launchLSP(command, args = [], options = {}) {
1202
1349
  if (isWindows && /\.ps1$/i.test(spawnCommand)) {
1203
1350
  const bypass = bypassPs1OnWindows(spawnCommand, args);
1204
1351
  if (bypass) {
1205
- logSessionStart2(`lsp ps1-bypass: ${spawnCommand} \u2192 ${bypass.command} shell=${bypass.needsShell}`);
1352
+ logSessionStart2(`lsp ps1-bypass: ${spawnCommand} \u2192 ${bypass.command}`);
1206
1353
  spawnCommand = bypass.command;
1207
1354
  args = bypass.args;
1208
- needsShell = bypass.needsShell;
1209
1355
  } else {
1210
1356
  logSessionStart2(`lsp ps1-bypass: no .cmd or JS entry found for ${spawnCommand}, spawn may hang`);
1211
1357
  }
1212
1358
  }
1213
- let proc;
1359
+ let launched;
1214
1360
  try {
1215
- proc = trySpawn(spawnCommand, args, cwd, env, needsShell);
1361
+ launched = trySpawn(spawnCommand, args, cwd, env);
1216
1362
  } catch (err) {
1217
1363
  if (isBareCommand) {
1218
1364
  const globalBinPath = await findGlobalBinary(command);
1219
1365
  if (globalBinPath && globalBinPath !== spawnCommand) {
1220
- const needsShellGlobal = computeNeedsShell(globalBinPath);
1221
- proc = trySpawn(globalBinPath, args, cwd, env, needsShellGlobal);
1366
+ launched = trySpawn(globalBinPath, args, cwd, env);
1222
1367
  } else {
1223
1368
  throw await classifySpawnFailure(err, { command, cwd });
1224
1369
  }
@@ -1226,6 +1371,7 @@ async function launchLSP(command, args = [], options = {}) {
1226
1371
  throw await classifySpawnFailure(err, { command, cwd });
1227
1372
  }
1228
1373
  }
1374
+ const { proc, plan } = launched;
1229
1375
  if (!proc.stdin || !proc.stdout || !proc.stderr) {
1230
1376
  throw new Error(`Failed to spawn LSP server: ${command}`);
1231
1377
  }
@@ -1237,7 +1383,7 @@ async function launchLSP(command, args = [], options = {}) {
1237
1383
  }
1238
1384
  throw failure;
1239
1385
  }
1240
- logSessionStart2(`lsp launch: command=${command} resolved=${spawnCommand} args=${JSON.stringify(args)} cwd=${cwd} shell=${needsShell ? "true" : "false"} pid=${proc.pid ?? 0}`);
1386
+ logSessionStart2(`lsp launch: command=${command} resolved=${plan.command} args=${JSON.stringify(plan.args)} cwd=${cwd} shell=${plan.shell ? "true" : "false"} pid=${proc.pid ?? 0}`);
1241
1387
  const formatStartupStderr = (stderr) => {
1242
1388
  const normalized = compactLogValue(stderr);
1243
1389
  if (!normalized)
@@ -1252,7 +1398,7 @@ async function launchLSP(command, args = [], options = {}) {
1252
1398
  };
1253
1399
  proc.stderr?.on("data", onStartupStderr);
1254
1400
  try {
1255
- await new Promise((resolve4, reject) => {
1401
+ await new Promise((resolve5, reject) => {
1256
1402
  let settled = false;
1257
1403
  proc.on("error", (err) => {
1258
1404
  if (!settled) {
@@ -1281,7 +1427,7 @@ async function launchLSP(command, args = [], options = {}) {
1281
1427
  if (options?.startupFailureWindowMs) {
1282
1428
  return options.startupFailureWindowMs;
1283
1429
  }
1284
- if (isWindows && needsShell) {
1430
+ if (plan.script) {
1285
1431
  return WINDOWS_NAV_STARTUP_FAILURE_WINDOW_MS;
1286
1432
  }
1287
1433
  return DEFAULT_STARTUP_FAILURE_WINDOW_MS;
@@ -1289,7 +1435,7 @@ async function launchLSP(command, args = [], options = {}) {
1289
1435
  setTimeout(() => {
1290
1436
  if (!settled) {
1291
1437
  settled = true;
1292
- resolve4();
1438
+ resolve5();
1293
1439
  }
1294
1440
  }, startupFailureWindowMs);
1295
1441
  });
@@ -1297,8 +1443,8 @@ async function launchLSP(command, args = [], options = {}) {
1297
1443
  proc.stderr?.off("data", onStartupStderr);
1298
1444
  }
1299
1445
  _attachErrorHandler(proc, command, {
1300
- command: spawnCommand,
1301
- args,
1446
+ command: plan.command,
1447
+ args: plan.args,
1302
1448
  cwd,
1303
1449
  pid: proc.pid ?? 0
1304
1450
  });
@@ -1309,8 +1455,8 @@ async function launchLSP(command, args = [], options = {}) {
1309
1455
  stdout: proc.stdout,
1310
1456
  stderr: proc.stderr,
1311
1457
  pid: proc.pid ?? 0,
1312
- command: spawnCommand,
1313
- args
1458
+ command: plan.command,
1459
+ args: plan.args
1314
1460
  };
1315
1461
  }
1316
1462
  async function launchViaNode(scriptPath, args = [], options = {}) {
@@ -1323,7 +1469,7 @@ function asRecord(value) {
1323
1469
  }
1324
1470
  var CONFIG_RESOLVED_PHASE = "config_resolved";
1325
1471
  function configResolutionKey(cwd) {
1326
- return normalizeFilePath(path5.resolve(normalizeFilePath(cwd)));
1472
+ return normalizeFilePath(path6.resolve(normalizeFilePath(cwd)));
1327
1473
  }
1328
1474
  function publishConfigResolutionPending(cwd) {
1329
1475
  logSessionStart(`session_start config_resolution_pending session=${currentSessionRecordId()} root=${configResolutionKey(cwd)}`);
@@ -1600,7 +1746,7 @@ var EMPTY_CONFIG = {
1600
1746
  };
1601
1747
  var configInFlight = /* @__PURE__ */ new Map();
1602
1748
  function normalizeWorkspacePath(cwd) {
1603
- return path5.resolve(cwd);
1749
+ return path6.resolve(cwd);
1604
1750
  }
1605
1751
  var unknownTrustNoticeGeneration = -1;
1606
1752
  var serversForFileOverride;
@@ -1791,7 +1937,7 @@ var OVERRIDE_COPY_TRAITS = {
1791
1937
  },
1792
1938
  idleEviction: {
1793
1939
  keep: false,
1794
- why: "Reset to unmeasured (never evicted): 'transparent' needs per-server evidence."
1940
+ why: "Reset to unmeasured: 'transparent' needs per-server evidence, and a 'resident' opt-out names the catalog binary, not the override."
1795
1941
  },
1796
1942
  replyOrdering: {
1797
1943
  keep: false,
@@ -2559,14 +2705,14 @@ function classifyCascadeWaitTier(lspService, filePath, snapshots) {
2559
2705
  // dist/clients/lsp/lombok.js
2560
2706
  import * as fs6 from "node:fs";
2561
2707
  import * as os4 from "node:os";
2562
- import * as path6 from "node:path";
2708
+ import * as path7 from "node:path";
2563
2709
  var LOMBOK_ENV_KEYS = ["PI_LENS_LOMBOK_JAR", "LOMBOK_JAR"];
2564
2710
  var LOMBOK_PROJECT_FILES = [
2565
2711
  "lombok.config",
2566
2712
  "pom.xml",
2567
2713
  "build.gradle",
2568
2714
  "build.gradle.kts",
2569
- path6.join("gradle", "libs.versions.toml")
2715
+ path7.join("gradle", "libs.versions.toml")
2570
2716
  ];
2571
2717
  function fileExists(filePath) {
2572
2718
  if (!filePath)
@@ -2591,13 +2737,13 @@ function containsLombokDependency(text) {
2591
2737
  return /\borg\.projectlombok\b/i.test(text) || /<artifactId>\s*lombok\s*<\/artifactId>/i.test(text) || /\b(annotationProcessor|compileOnly|testCompileOnly|testAnnotationProcessor)\b[^\n]*\blombok\b/i.test(text);
2592
2738
  }
2593
2739
  function hasLombokProject(root) {
2594
- const lombokConfig = path6.join(root, "lombok.config");
2740
+ const lombokConfig = path7.join(root, "lombok.config");
2595
2741
  if (fileExists(lombokConfig))
2596
2742
  return true;
2597
2743
  for (const name of LOMBOK_PROJECT_FILES) {
2598
2744
  if (name === "lombok.config")
2599
2745
  continue;
2600
- const text = readTextIfSmall(path6.join(root, name));
2746
+ const text = readTextIfSmall(path7.join(root, name));
2601
2747
  if (text && containsLombokDependency(text))
2602
2748
  return true;
2603
2749
  }
@@ -2607,16 +2753,16 @@ function envJarCandidate(env) {
2607
2753
  for (const key of LOMBOK_ENV_KEYS) {
2608
2754
  const value = env[key]?.trim();
2609
2755
  if (fileExists(value))
2610
- return path6.resolve(value);
2756
+ return path7.resolve(value);
2611
2757
  }
2612
2758
  return void 0;
2613
2759
  }
2614
2760
  function localJarCandidates(root) {
2615
2761
  return [
2616
- path6.join(root, "lombok.jar"),
2617
- path6.join(root, ".lombok", "lombok.jar"),
2618
- path6.join(root, "lib", "lombok.jar"),
2619
- path6.join(root, "libs", "lombok.jar")
2762
+ path7.join(root, "lombok.jar"),
2763
+ path7.join(root, ".lombok", "lombok.jar"),
2764
+ path7.join(root, "lib", "lombok.jar"),
2765
+ path7.join(root, "libs", "lombok.jar")
2620
2766
  ];
2621
2767
  }
2622
2768
  function newestExistingJar(candidates) {
@@ -2635,17 +2781,17 @@ function newestExistingJar(candidates) {
2635
2781
  return best?.filePath;
2636
2782
  }
2637
2783
  function mavenLocalLombokJar(home = os4.homedir()) {
2638
- const base = path6.join(home, ".m2", "repository", "org", "projectlombok", "lombok");
2784
+ const base = path7.join(home, ".m2", "repository", "org", "projectlombok", "lombok");
2639
2785
  let versions = [];
2640
2786
  try {
2641
2787
  versions = fs6.readdirSync(base);
2642
2788
  } catch {
2643
2789
  return void 0;
2644
2790
  }
2645
- return newestExistingJar(versions.map((version) => path6.join(base, version, `lombok-${version}.jar`)));
2791
+ return newestExistingJar(versions.map((version) => path7.join(base, version, `lombok-${version}.jar`)));
2646
2792
  }
2647
2793
  function gradleCacheLombokJar(home = os4.homedir()) {
2648
- const base = path6.join(home, ".gradle", "caches", "modules-2", "files-2.1", "org.projectlombok", "lombok");
2794
+ const base = path7.join(home, ".gradle", "caches", "modules-2", "files-2.1", "org.projectlombok", "lombok");
2649
2795
  const candidates = [];
2650
2796
  let versions = [];
2651
2797
  try {
@@ -2654,7 +2800,7 @@ function gradleCacheLombokJar(home = os4.homedir()) {
2654
2800
  return void 0;
2655
2801
  }
2656
2802
  for (const version of versions) {
2657
- const versionDir = path6.join(base, version);
2803
+ const versionDir = path7.join(base, version);
2658
2804
  let hashes = [];
2659
2805
  try {
2660
2806
  hashes = fs6.readdirSync(versionDir);
@@ -2662,7 +2808,7 @@ function gradleCacheLombokJar(home = os4.homedir()) {
2662
2808
  continue;
2663
2809
  }
2664
2810
  for (const hash of hashes) {
2665
- candidates.push(path6.join(versionDir, hash, `lombok-${version}.jar`));
2811
+ candidates.push(path7.join(versionDir, hash, `lombok-${version}.jar`));
2666
2812
  }
2667
2813
  }
2668
2814
  return newestExistingJar(candidates);
@@ -2695,14 +2841,14 @@ function createLombokJdtlsArgs(root, baseEnv = process.env) {
2695
2841
  // dist/clients/lsp/jvm-runtime.js
2696
2842
  import { existsSync as existsSync2, readdirSync as readdirSync4 } from "node:fs";
2697
2843
  import os5 from "node:os";
2698
- import path7 from "node:path";
2844
+ import path8 from "node:path";
2699
2845
  var JAVA_EXE = process.platform === "win32" ? "java.exe" : "java";
2700
2846
  var MIN_JAVA_MAJOR = 17;
2701
2847
  function jdkHomeFrom(dir) {
2702
- if (existsSync2(path7.join(dir, "bin", JAVA_EXE)))
2848
+ if (existsSync2(path8.join(dir, "bin", JAVA_EXE)))
2703
2849
  return dir;
2704
- const macHome = path7.join(dir, "Contents", "Home");
2705
- if (existsSync2(path7.join(macHome, "bin", JAVA_EXE)))
2850
+ const macHome = path8.join(dir, "Contents", "Home");
2851
+ if (existsSync2(path8.join(macHome, "bin", JAVA_EXE)))
2706
2852
  return macHome;
2707
2853
  return void 0;
2708
2854
  }
@@ -2715,7 +2861,7 @@ function parseMajorVersion(name) {
2715
2861
  }
2716
2862
  function childDirs(base) {
2717
2863
  try {
2718
- return readdirSync4(base, { withFileTypes: true }).filter((e) => e.isDirectory() || e.isSymbolicLink()).map((e) => path7.join(base, e.name));
2864
+ return readdirSync4(base, { withFileTypes: true }).filter((e) => e.isDirectory() || e.isSymbolicLink()).map((e) => path8.join(base, e.name));
2719
2865
  } catch {
2720
2866
  return [];
2721
2867
  }
@@ -2723,26 +2869,26 @@ function childDirs(base) {
2723
2869
  function candidateRoots() {
2724
2870
  const home = os5.homedir();
2725
2871
  const roots = [];
2726
- roots.push(path7.join(home, ".jdks"));
2727
- roots.push(path7.join(getGlobalPiLensDir(), "tools"));
2872
+ roots.push(path8.join(home, ".jdks"));
2873
+ roots.push(path8.join(getGlobalPiLensDir(), "tools"));
2728
2874
  if (process.platform === "win32") {
2729
2875
  const progFiles = [
2730
2876
  process.env.ProgramFiles,
2731
2877
  process.env["ProgramFiles(x86)"],
2732
2878
  process.env.ProgramW6432,
2733
- path7.join(process.env.LOCALAPPDATA ?? path7.join(home, "AppData", "Local"), "Programs")
2879
+ path8.join(process.env.LOCALAPPDATA ?? path8.join(home, "AppData", "Local"), "Programs")
2734
2880
  ].filter((p) => Boolean(p));
2735
2881
  for (const base of progFiles) {
2736
- roots.push(path7.join(base, "Eclipse Adoptium"));
2737
- roots.push(path7.join(base, "Java"));
2738
- roots.push(path7.join(base, "Microsoft"));
2739
- roots.push(path7.join(base, "Zulu"));
2740
- roots.push(path7.join(base, "Amazon Corretto"));
2741
- roots.push(path7.join(base, "BellSoft"));
2882
+ roots.push(path8.join(base, "Eclipse Adoptium"));
2883
+ roots.push(path8.join(base, "Java"));
2884
+ roots.push(path8.join(base, "Microsoft"));
2885
+ roots.push(path8.join(base, "Zulu"));
2886
+ roots.push(path8.join(base, "Amazon Corretto"));
2887
+ roots.push(path8.join(base, "BellSoft"));
2742
2888
  }
2743
2889
  } else if (process.platform === "darwin") {
2744
2890
  roots.push("/Library/Java/JavaVirtualMachines");
2745
- roots.push(path7.join(home, "Library", "Java", "JavaVirtualMachines"));
2891
+ roots.push(path8.join(home, "Library", "Java", "JavaVirtualMachines"));
2746
2892
  roots.push("/opt/homebrew/opt");
2747
2893
  roots.push("/usr/local/opt");
2748
2894
  } else {
@@ -2766,7 +2912,7 @@ function discoverJdkHome(roots = candidateRoots(), javaHome = process.env.JAVA_H
2766
2912
  continue;
2767
2913
  found.push({
2768
2914
  home: resolved,
2769
- major: parseMajorVersion(path7.basename(dir))
2915
+ major: parseMajorVersion(path8.basename(dir))
2770
2916
  });
2771
2917
  }
2772
2918
  }
@@ -2781,7 +2927,7 @@ var probeModule;
2781
2927
  async function resolveJavaRuntimeEnv() {
2782
2928
  if (_cachedEnv?.trustGeneration === getProjectTrustGeneration())
2783
2929
  return _cachedEnv.value;
2784
- const { toolOnPath } = probeModule ??= await import("./chunk-TWAQFMLW.js");
2930
+ const { toolOnPath } = probeModule ??= await import("./chunk-BXXC6KRR.js");
2785
2931
  const trustGeneration = getProjectTrustGeneration();
2786
2932
  const javaOnPath = await toolOnPath("java");
2787
2933
  if (javaOnPath === true) {
@@ -2790,12 +2936,12 @@ async function resolveJavaRuntimeEnv() {
2790
2936
  }
2791
2937
  const home = discoverJdkHome();
2792
2938
  if (home) {
2793
- const binDir = path7.join(home, "bin");
2939
+ const binDir = path8.join(home, "bin");
2794
2940
  const currentPath = process.env.PATH ?? process.env.Path ?? "";
2795
2941
  _cachedEnv = {
2796
2942
  value: {
2797
2943
  JAVA_HOME: home,
2798
- PATH: binDir + path7.delimiter + currentPath
2944
+ PATH: binDir + path8.delimiter + currentPath
2799
2945
  },
2800
2946
  trustGeneration
2801
2947
  };
@@ -2808,6 +2954,7 @@ async function resolveJavaRuntimeEnv() {
2808
2954
  }
2809
2955
 
2810
2956
  // dist/clients/lsp/server.js
2957
+ var LSP_ROOT_DECLINED = /* @__PURE__ */ Symbol("pi-lens.lsp-root-declined");
2811
2958
  function withRootMarkers(root, markers) {
2812
2959
  root.rootMarkers = markers;
2813
2960
  return root;
@@ -2838,13 +2985,16 @@ async function resolveLspServerCwd(server, filePath, sessionCwd, onRootFailure,
2838
2985
  let serverRoot;
2839
2986
  let rootFailed = false;
2840
2987
  try {
2841
- serverRoot = await server.root(filePath);
2988
+ const verdict = await server.root(filePath);
2989
+ if (verdict === LSP_ROOT_DECLINED)
2990
+ return void 0;
2991
+ serverRoot = verdict;
2842
2992
  } catch (error) {
2843
2993
  const reason = error instanceof Error ? error.message : String(error);
2844
2994
  rootFailed = true;
2845
2995
  onRootFailure?.(reason);
2846
2996
  }
2847
- const isFileDirFallback = serverRoot !== void 0 && rootMarkers?.length && path8.resolve(serverRoot) === path8.resolve(path8.dirname(filePath));
2997
+ const isFileDirFallback = serverRoot !== void 0 && rootMarkers?.length && path9.resolve(serverRoot) === path9.resolve(path9.dirname(filePath));
2848
2998
  if (!serverRoot || isFileDirFallback) {
2849
2999
  const probedMarker = onRootFallback && !rootFailed && rootMarkers?.length ? resolveToolCwd("lsp", server.id, filePath, {
2850
3000
  cwd: sessionCwd,
@@ -2853,7 +3003,7 @@ async function resolveLspServerCwd(server, filePath, sessionCwd, onRootFailure,
2853
3003
  }).marker : void 0;
2854
3004
  const refusedMarker = probedMarker !== void 0 && rootMarkers?.includes(probedMarker) ? probedMarker : void 0;
2855
3005
  const fallbackCwd = rootMarkers?.length ? resolveToolCwd("lsp", server.id, filePath, {
2856
- cwd: path8.dirname(path8.resolve(filePath)),
3006
+ cwd: path9.dirname(path9.resolve(filePath)),
2857
3007
  rootMarkers
2858
3008
  }) : void 0;
2859
3009
  if (!serverRoot) {
@@ -2936,17 +3086,17 @@ var PYTHON_EXTENSIONS = new Set(extensionsForLanguage("python"));
2936
3086
  var loggedRootCeilingClamps = /* @__PURE__ */ new Set();
2937
3087
  var posixCaseInsensitiveByPath = /* @__PURE__ */ new Map();
2938
3088
  function posixFilesystemIsCaseInsensitive(root) {
2939
- const resolved = path8.resolve(root);
3089
+ const resolved = path9.resolve(root);
2940
3090
  const cached = posixCaseInsensitiveByPath.get(resolved);
2941
3091
  if (cached !== void 0)
2942
3092
  return cached;
2943
3093
  if (!existsSync3(resolved)) {
2944
3094
  return false;
2945
3095
  }
2946
- const name = path8.basename(resolved);
3096
+ const name = path9.basename(resolved);
2947
3097
  const alternate = name.toLowerCase() === name ? name.toUpperCase() : name.toLowerCase();
2948
3098
  let insensitive = false;
2949
- const alternatePath = path8.join(path8.dirname(resolved), alternate);
3099
+ const alternatePath = path9.join(path9.dirname(resolved), alternate);
2950
3100
  if (alternate !== name && existsSync3(alternatePath)) {
2951
3101
  try {
2952
3102
  const actual = statSync4(resolved);
@@ -2964,7 +3114,7 @@ function resetLSPCaseSensitivityState() {
2964
3114
  }
2965
3115
  function isSameOrWithin(ancestor, candidate, deps = {}) {
2966
3116
  const windowsShaped = isWindowsPath(ancestor) || isWindowsPath(candidate);
2967
- const pathApi = windowsShaped ? path8.win32 : path8;
3117
+ const pathApi = windowsShaped ? path9.win32 : path9;
2968
3118
  const resolvedAncestor = pathApi.resolve(ancestor);
2969
3119
  const resolvedCandidate = pathApi.resolve(candidate);
2970
3120
  let caseInsensitive = false;
@@ -2988,7 +3138,7 @@ function isSameOrWithin(ancestor, candidate, deps = {}) {
2988
3138
  }
2989
3139
  function enforceLspRootCeiling(root, sessionCwd, filePath) {
2990
3140
  const windowsShaped = isWindowsPath(root) || isWindowsPath(sessionCwd);
2991
- const pathApi = windowsShaped ? path8.win32 : path8;
3141
+ const pathApi = windowsShaped ? path9.win32 : path9;
2992
3142
  const resolvedRoot = pathApi.resolve(root);
2993
3143
  const resolvedCwd = pathApi.resolve(sessionCwd);
2994
3144
  if (filePath && !isSameOrWithin(resolvedCwd, pathApi.resolve(filePath))) {
@@ -3015,8 +3165,8 @@ async function hasProjectBoundaryMarker(dir, server) {
3015
3165
  return false;
3016
3166
  }
3017
3167
  function pathSegments(dir) {
3018
- const parsed = path8.parse(path8.resolve(dir));
3019
- return path8.relative(parsed.root, path8.resolve(dir)).split(path8.sep).filter(Boolean).map((segment) => segment.toLowerCase());
3168
+ const parsed = path9.parse(path9.resolve(dir));
3169
+ return path9.relative(parsed.root, path9.resolve(dir)).split(path9.sep).filter(Boolean).map((segment) => segment.toLowerCase());
3020
3170
  }
3021
3171
  function hasFixtureConvention(dir) {
3022
3172
  const segments = pathSegments(dir);
@@ -3047,7 +3197,7 @@ async function findGitBoundary(dir, memo) {
3047
3197
  return found;
3048
3198
  }
3049
3199
  async function isExcludedLspRoot(dir, gitBoundaries) {
3050
- const candidate = path8.resolve(dir);
3200
+ const candidate = path9.resolve(dir);
3051
3201
  if (hasFixtureConvention(candidate) || hasAtomicStageSegment(candidate))
3052
3202
  return true;
3053
3203
  const gitRoot = await findGitBoundary(candidate, gitBoundaries);
@@ -3058,8 +3208,8 @@ async function isExcludedLspRoot(dir, gitBoundaries) {
3058
3208
  return isPathIgnoredByProject(candidate, gitRoot, true);
3059
3209
  }
3060
3210
  async function nearestNonExcludedFallbackRoot(candidate, stopDir) {
3061
- const startDir = path8.resolve(candidate);
3062
- const fsRoot = path8.parse(startDir).root;
3211
+ const startDir = path9.resolve(candidate);
3212
+ const fsRoot = path9.parse(startDir).root;
3063
3213
  let nearestAllowed;
3064
3214
  const gitBoundaries = /* @__PURE__ */ new Map();
3065
3215
  for (const current of walkUpDirs(startDir, { spelling: true })) {
@@ -3111,7 +3261,7 @@ async function installEvidenceForLaunch(toolId, installed, attempt) {
3111
3261
  const confirmedManagedPath = await findManagedToolBinary(toolId);
3112
3262
  return {
3113
3263
  ...evidence,
3114
- binary: path8.basename(installed),
3264
+ binary: path9.basename(installed),
3115
3265
  ...confirmedManagedPath !== void 0 && pathsEqual(confirmedManagedPath, installed) && {
3116
3266
  source: "managed-dir"
3117
3267
  }
@@ -3164,7 +3314,30 @@ function markDirectLspCommandUnavailable(command) {
3164
3314
  directLspCommandUnavailableUntil.set(command, Date.now() + DIRECT_LSP_NEGATIVE_TTL_MS);
3165
3315
  directLspCommandSkipLoggedUntil.delete(command);
3166
3316
  }
3167
- var PI_LENS_BIN_DIR2 = path8.join(getGlobalPiLensDir(), "bin");
3317
+ var PI_LENS_BIN_DIR2 = path9.join(getGlobalPiLensDir(), "bin");
3318
+ function bareLookupReachesUnadmittedRoot(cwd, refusals) {
3319
+ return !isLspProjectCodeAdmitted() && (refusals?.bareRefused === true || commandSearchReachesProject(cwd));
3320
+ }
3321
+ async function lookupManagedTool(toolId, cwd, refusals, ...ensureOptions) {
3322
+ const storeOnly = bareLookupReachesUnadmittedRoot(cwd, refusals);
3323
+ if (storeOnly) {
3324
+ const trigger = refusals?.bareRefused === true ? "a bare candidate resolved into the project and was refused" : "a PATH entry reaches a project not admitted for project code";
3325
+ recordDegradationOnce({
3326
+ kind: "lsp-registry-decision",
3327
+ subject: `store-only-repair:${toolId}`,
3328
+ reason: `LSP repair read only the pi-lens tool store: ${trigger}, so nothing was probed on PATH or installed`,
3329
+ metadata: { field: "store-only-repair", tool: toolId }
3330
+ });
3331
+ }
3332
+ logSessionStart(`lsp launch ensure-tool start tool=${toolId} cwd=${cwd} storeOnly=${storeOnly}`);
3333
+ return {
3334
+ found: await (storeOnly ? getToolPath(toolId, { storeOnly: true }) : spawnsJudgedAgainstRoot(cwd, () => ensureTool(toolId, ...ensureOptions))),
3335
+ storeOnly
3336
+ };
3337
+ }
3338
+ function spawnsJudgedAgainstRoot(cwd, lookup) {
3339
+ return isLspProjectCodeAdmitted() ? lookup() : withUnadmittedRootSpawns(cwd, lookup);
3340
+ }
3168
3341
  async function resolveAndLaunch(spec, allowInstall) {
3169
3342
  const generation = lspLaunchAvailabilityGeneration.capture();
3170
3343
  const toolLabel = spec.managedToolId ?? spec.candidates[spec.candidates.length - 1] ?? "unknown";
@@ -3229,7 +3402,7 @@ async function resolveAndLaunch(spec, allowInstall) {
3229
3402
  producer: "lsp-launch",
3230
3403
  classifiedBy: "probe",
3231
3404
  evidence: {
3232
- binary: path8.basename(managedCandidate),
3405
+ binary: path9.basename(managedCandidate),
3233
3406
  source: "managed-dir",
3234
3407
  correctsLatchedRow: false
3235
3408
  }
@@ -3260,6 +3433,14 @@ async function resolveAndLaunch(spec, allowInstall) {
3260
3433
  logSessionStart(`lsp launch candidate failed tool=${toolLabel} idx=${failure.index} command=${failure.command} error=${failure.message}`);
3261
3434
  trackRuntimeFailure(failure.err);
3262
3435
  }
3436
+ const refusals = spec.refusals ?? { refused: false, bareRefused: false };
3437
+ for (const failure of candidateFailures) {
3438
+ if (!hasSpawnFailureKind(failure.err, "trust-refused"))
3439
+ continue;
3440
+ refusals.refused = true;
3441
+ if (isSimpleCommand(failure.command))
3442
+ refusals.bareRefused = true;
3443
+ }
3263
3444
  const hasOnlyRepairableCandidateFailures = candidateFailures.every((failure) => hasSpawnFailureKind(failure.err, "tool-not-found") || hasSpawnFailureKind(failure.err, "trust-refused"));
3264
3445
  if (!hasOnlyRepairableCandidateFailures) {
3265
3446
  if (lastRuntimeFailure)
@@ -3279,13 +3460,8 @@ async function resolveAndLaunch(spec, allowInstall) {
3279
3460
  globalInstallDisabled: isLspInstallDisabled()
3280
3461
  }
3281
3462
  });
3282
- if (lastRuntimeFailure)
3283
- throw lastRuntimeFailure;
3284
3463
  return void 0;
3285
3464
  }
3286
- const isRefusal = (failure) => hasSpawnFailureKind(failure.err, "trust-refused");
3287
- const trustRefused = candidateFailures.some(isRefusal);
3288
- const storeOnly = trustRefused && (candidateFailures.some((failure) => isRefusal(failure) && isSimpleCommand(failure.command)) || commandSearchReachesProject(spec.cwd));
3289
3465
  if (spec.managedToolId) {
3290
3466
  const failedCandidate = candidateFailures.at(-1);
3291
3467
  const classifiedFailure = classifyProbeFailure({
@@ -3305,17 +3481,8 @@ async function resolveAndLaunch(spec, allowInstall) {
3305
3481
  producer: "lsp-launch",
3306
3482
  evidence: classifiedFailure.evidence
3307
3483
  });
3308
- if (storeOnly) {
3309
- recordDegradationOnce({
3310
- kind: "lsp-registry-decision",
3311
- subject: `store-only-repair:${spec.managedToolId}`,
3312
- reason: "LSP repair read only the pi-lens tool store: after a trust refusal a bare-name lookup reaches the project, so nothing was probed on PATH or installed",
3313
- metadata: { field: "store-only-repair", tool: spec.managedToolId }
3314
- });
3315
- }
3316
- logSessionStart(`lsp launch ensure-tool start tool=${spec.managedToolId} cwd=${spec.cwd} storeOnly=${storeOnly}`);
3317
3484
  const installStartedAt = Date.now();
3318
- const installed = await (storeOnly ? getToolPath(spec.managedToolId, { storeOnly: true }) : ensureTool(spec.managedToolId));
3485
+ const { found: installed, storeOnly } = await lookupManagedTool(spec.managedToolId, spec.cwd, refusals);
3319
3486
  const installAttempt = storeOnly ? void 0 : captureInstallAttempt(spec.managedToolId);
3320
3487
  if (staleLaunch(generation, `${toolLabel}:ensureTool`)) {
3321
3488
  return void 0;
@@ -3446,13 +3613,13 @@ async function resolveAndLaunch(spec, allowInstall) {
3446
3613
  }
3447
3614
  }
3448
3615
  }
3449
- const runtimeInstall = trustRefused ? void 0 : spec.runtimeInstall;
3616
+ const runtimeInstall = refusals.refused || bareLookupReachesUnadmittedRoot(spec.cwd, refusals) ? void 0 : spec.runtimeInstall;
3450
3617
  const runtimeAvailable = runtimeInstall ? await isCommandAvailableAsync(runtimeInstall.runtimeCommand) : false;
3451
3618
  if (staleLaunch(generation, `${toolLabel}:runtimeAvailability`)) {
3452
3619
  return void 0;
3453
3620
  }
3454
3621
  if (runtimeInstall && runtimeAvailable) {
3455
- const ok = await runtimeInstall.install();
3622
+ const ok = await spawnsJudgedAgainstRoot(spec.cwd, () => runtimeInstall.install());
3456
3623
  if (staleLaunch(generation, `${toolLabel}:runtimeInstall`)) {
3457
3624
  return void 0;
3458
3625
  }
@@ -3535,7 +3702,7 @@ async function resolveAndLaunchTreeBinary(spec, allowInstall) {
3535
3702
  return void 0;
3536
3703
  }
3537
3704
  const suffix = process.platform === "win32" ? ".exe" : "";
3538
- const binPath = path8.join(bundleDir, ...spec.binRelPath.split("/")) + suffix;
3705
+ const binPath = path9.join(bundleDir, ...spec.binRelPath.split("/")) + suffix;
3539
3706
  try {
3540
3707
  const proc = await launchLSP(binPath, spec.args, {
3541
3708
  cwd: spec.cwd,
@@ -3550,7 +3717,7 @@ async function resolveAndLaunchTreeBinary(spec, allowInstall) {
3550
3717
  }
3551
3718
  }
3552
3719
  function nodeBinLocalCandidates(root, baseName) {
3553
- const localBase = path8.join(root, "node_modules", ".bin", baseName);
3720
+ const localBase = path9.join(root, "node_modules", ".bin", baseName);
3554
3721
  if (process.platform === "win32") {
3555
3722
  return [`${localBase}.cmd`, `${localBase}.exe`];
3556
3723
  }
@@ -3560,7 +3727,7 @@ function nodeBinCandidates(root, baseName) {
3560
3727
  return [...nodeBinLocalCandidates(root, baseName), baseName];
3561
3728
  }
3562
3729
  function piAgentExtensionsRootKey(file) {
3563
- const dirKey = normalizeEphemeralMapKey(path8.dirname(path8.resolve(file)));
3730
+ const dirKey = normalizeEphemeralMapKey(path9.dirname(path9.resolve(file)));
3564
3731
  const marker = "/.pi/agent/extensions";
3565
3732
  const index = dirKey.indexOf(marker);
3566
3733
  if (index === -1)
@@ -3573,7 +3740,7 @@ function IgnoreHomeRoot(primary) {
3573
3740
  const root = await primary(file);
3574
3741
  if (!root)
3575
3742
  return void 0;
3576
- return normalizeEphemeralMapKey(path8.resolve(root)) === homeKey ? void 0 : root;
3743
+ return normalizeEphemeralMapKey(path9.resolve(root)) === homeKey ? void 0 : root;
3577
3744
  }, primary.rootMarkers ?? []);
3578
3745
  }
3579
3746
  function rubyBinCandidates(baseName) {
@@ -3581,13 +3748,13 @@ function rubyBinCandidates(baseName) {
3581
3748
  const home = os6.homedir();
3582
3749
  const isWin = process.platform === "win32";
3583
3750
  const ext = isWin ? ".bat" : "";
3584
- candidates.push(path8.join(home, ".local", "share", "mise", "installs", "ruby", "bin", `${baseName}${ext}`));
3585
- candidates.push(path8.join(home, ".asdf", "installs", "ruby", "bin", `${baseName}${ext}`));
3751
+ candidates.push(path9.join(home, ".local", "share", "mise", "installs", "ruby", "bin", `${baseName}${ext}`));
3752
+ candidates.push(path9.join(home, ".asdf", "installs", "ruby", "bin", `${baseName}${ext}`));
3586
3753
  if (isWin) {
3587
- const driveRoot = path8.parse(home).root;
3754
+ const driveRoot = path9.parse(home).root;
3588
3755
  for (const entry of getRubyVersionDirNamesSync(driveRoot)) {
3589
- candidates.push(path8.join(driveRoot, entry, "bin", `${baseName}.bat`));
3590
- candidates.push(path8.join(driveRoot, entry, "bin", baseName));
3756
+ candidates.push(path9.join(driveRoot, entry, "bin", `${baseName}.bat`));
3757
+ candidates.push(path9.join(driveRoot, entry, "bin", baseName));
3591
3758
  }
3592
3759
  }
3593
3760
  return candidates;
@@ -3608,6 +3775,9 @@ function createInteractiveServer(spec) {
3608
3775
  fallbackFor: spec.fallbackFor,
3609
3776
  requiresProjectRoot: spec.requiresProjectRoot,
3610
3777
  executesProjectCode: spec.executesProjectCode,
3778
+ ...spec.resendRecheck !== void 0 && {
3779
+ resendRecheck: spec.resendRecheck
3780
+ },
3611
3781
  availabilityKey: typeof spec.command === "string" && isSimpleCommand(spec.command) ? spec.command : void 0,
3612
3782
  async spawn(root) {
3613
3783
  const command = typeof spec.command === "function" ? spec.command(root) : spec.command;
@@ -3635,8 +3805,8 @@ function createInteractiveServer(spec) {
3635
3805
  function PriorityRoot(markerGroups, excludePatterns, stopDir) {
3636
3806
  const resolvers = markerGroups.map((markers) => NearestRoot(markers, excludePatterns, stopDir));
3637
3807
  return withRootMarkers(async (file) => {
3638
- for (const resolve4 of resolvers) {
3639
- const root = await resolve4(file);
3808
+ for (const resolve5 of resolvers) {
3809
+ const root = await resolve5(file);
3640
3810
  if (root)
3641
3811
  return root;
3642
3812
  }
@@ -3644,7 +3814,7 @@ function PriorityRoot(markerGroups, excludePatterns, stopDir) {
3644
3814
  }, markerGroups.flat());
3645
3815
  }
3646
3816
  var FileDirRoot = async (file) => {
3647
- const candidate = path8.resolve(path8.dirname(file));
3817
+ const candidate = path9.resolve(path9.dirname(file));
3648
3818
  return nearestNonExcludedFallbackRoot(candidate, piAgentExtensionsRootKey(file));
3649
3819
  };
3650
3820
  function declinesLooseFileRoot(server, root) {
@@ -3670,7 +3840,7 @@ async function declinesProjectlessRoot(server, root) {
3670
3840
  if (visited + queue.length + 1 >= PROJECT_FILE_SEARCH_MAX_DIRS)
3671
3841
  break;
3672
3842
  if (entry.isDirectory() && !isExcludedDirName(entry.name)) {
3673
- queue.push(path8.join(dir, entry.name));
3843
+ queue.push(path9.join(dir, entry.name));
3674
3844
  }
3675
3845
  }
3676
3846
  }
@@ -3695,16 +3865,16 @@ function markerProbeDir(dir, pattern) {
3695
3865
  const normalized = toPosix(pattern);
3696
3866
  const slash = normalized.lastIndexOf("/");
3697
3867
  const parentPattern = slash >= 0 ? normalized.slice(0, slash) : "";
3698
- return parentPattern ? path8.join(dir, ...parentPattern.split("/").filter(Boolean)) : dir;
3868
+ return parentPattern ? path9.join(dir, ...parentPattern.split("/").filter(Boolean)) : dir;
3699
3869
  }
3700
3870
  async function markerExists(dir, pattern) {
3701
3871
  if (!pattern.includes("*")) {
3702
3872
  try {
3703
- await stat(path8.join(dir, pattern));
3873
+ await stat(path9.join(dir, pattern));
3704
3874
  return true;
3705
3875
  } catch (err) {
3706
3876
  if (isPermissionFsError(err)) {
3707
- logSessionStart(`lsp root marker skipped: permission error stat ${path8.join(dir, pattern)}`);
3877
+ logSessionStart(`lsp root marker skipped: permission error stat ${path9.join(dir, pattern)}`);
3708
3878
  }
3709
3879
  return false;
3710
3880
  }
@@ -3741,7 +3911,7 @@ function NearestRoot(includePatterns, excludePatterns, stopDir) {
3741
3911
  }
3742
3912
  return withRootMarkers(async (file) => {
3743
3913
  const identity = realpathOrResolve(file);
3744
- const startDir = path8.dirname(identity);
3914
+ const startDir = path9.dirname(identity);
3745
3915
  const dirKey = normalizeEphemeralMapKey(startDir);
3746
3916
  const cached = cache.get(dirKey);
3747
3917
  if (cached !== void 0 && Date.now() - cached.walkedAt < FRESHNESS_CADENCE_MS && await bounded(dirMtimesStillFreshAsync(cached.probedDirs), rootMtimeBound("lsp-root-memo-freshness")) === true)
@@ -3752,7 +3922,7 @@ function NearestRoot(includePatterns, excludePatterns, stopDir) {
3752
3922
  const probedDirs = [];
3753
3923
  const walkedAt = Date.now();
3754
3924
  const promise = (async () => {
3755
- const fsRoot = path8.parse(startDir).root;
3925
+ const fsRoot = path9.parse(startDir).root;
3756
3926
  const stop = stopDir ? realpathOrResolve(stopDir) : fsRoot;
3757
3927
  for (const currentDir of walkUpDirs(startDir)) {
3758
3928
  if (stop !== fsRoot && relativeInside(stop, currentDir) === void 0) {
@@ -3826,7 +3996,7 @@ async function findAncestorFileAmong(startDir, candidateSegmentLists) {
3826
3996
  if (isAtOrAboveHomeDir(realpathOrResolve(currentDir), home))
3827
3997
  break;
3828
3998
  for (const segments of candidateSegmentLists) {
3829
- const candidate = path8.join(currentDir, ...segments);
3999
+ const candidate = path9.join(currentDir, ...segments);
3830
4000
  try {
3831
4001
  await fs7.access(candidate);
3832
4002
  return candidate;
@@ -3845,21 +4015,21 @@ function resetClassicTsRepairGuard() {
3845
4015
  classicTsRepairState().attempted = false;
3846
4016
  }
3847
4017
  function typescriptDirsForTsc(tscPath) {
3848
- const binDir = path8.dirname(tscPath);
4018
+ const binDir = path9.dirname(tscPath);
3849
4019
  return [
3850
- path8.join(binDir, "..", "typescript"),
3851
- path8.join(binDir, "..", "..", "typescript"),
4020
+ path9.join(binDir, "..", "typescript"),
4021
+ path9.join(binDir, "..", "..", "typescript"),
3852
4022
  // Windows npm-global: `<prefix>/tsc.cmd` beside `<prefix>/node_modules`.
3853
- path8.join(binDir, "node_modules", "typescript")
4023
+ path9.join(binDir, "node_modules", "typescript")
3854
4024
  ];
3855
4025
  }
3856
4026
  async function typescriptVersionForTsc(tscPath) {
3857
- if (!path8.isAbsolute(tscPath))
4027
+ if (!path9.isAbsolute(tscPath))
3858
4028
  return void 0;
3859
4029
  for (const dir of typescriptDirsForTsc(tscPath)) {
3860
4030
  let manifest;
3861
4031
  try {
3862
- manifest = await readFile(path8.join(dir, "package.json"), "utf8");
4032
+ manifest = await readFile(path9.join(dir, "package.json"), "utf8");
3863
4033
  } catch {
3864
4034
  continue;
3865
4035
  }
@@ -3889,20 +4059,20 @@ async function hasTypescriptPackageDir(tscPath) {
3889
4059
  return false;
3890
4060
  }
3891
4061
  async function absoluteCommandPath(command) {
3892
- if (!command || path8.isAbsolute(command))
4062
+ if (!command || path9.isAbsolute(command))
3893
4063
  return command;
3894
4064
  const found = await findCommandAsync(command);
3895
4065
  return found ? realpath(found).catch(() => void 0) : void 0;
3896
4066
  }
3897
4067
  async function findTsserverPath(root, allowInstall, options) {
3898
4068
  const fs7 = await import("node:fs/promises");
3899
- const projectRoots = await Promise.all([root, options?.sessionRoot ?? process.cwd(), process.cwd()].map((dir) => fs7.realpath(dir).catch(() => path8.resolve(dir))));
4069
+ const projectRoots = await Promise.all([root, options?.sessionRoot ?? process.cwd(), process.cwd()].map((dir) => fs7.realpath(dir).catch(() => path9.resolve(dir))));
3900
4070
  const admitCandidate = async (candidate, projectSupplied) => {
3901
4071
  try {
3902
4072
  const real = await fs7.realpath(candidate);
3903
- if (path8.basename(real) !== "tsserver.js" || !(await fs7.stat(real)).isFile())
4073
+ if (path9.basename(real) !== "tsserver.js" || !(await fs7.stat(real)).isFile())
3904
4074
  return void 0;
3905
- const manifest = JSON.parse(await fs7.readFile(path8.join(path8.dirname(real), "..", "package.json"), "utf8"));
4075
+ const manifest = JSON.parse(await fs7.readFile(path9.join(path9.dirname(real), "..", "package.json"), "utf8"));
3906
4076
  if (typeof manifest?.version !== "string" || !manifest.version)
3907
4077
  return void 0;
3908
4078
  return admitProjectSuppliedTsserver(real, options?.sessionRoot ?? process.cwd(), projectSupplied || projectRoots.some((dir) => isUnderDir(real, dir)), options?.projectCodeAllowed);
@@ -3916,7 +4086,7 @@ async function findTsserverPath(root, allowInstall, options) {
3916
4086
  if (admittedAncestor)
3917
4087
  return admittedAncestor;
3918
4088
  }
3919
- const cwdCandidate = path8.join(process.cwd(), "node_modules", "typescript", "lib", "tsserver.js");
4089
+ const cwdCandidate = path9.join(process.cwd(), "node_modules", "typescript", "lib", "tsserver.js");
3920
4090
  try {
3921
4091
  await fs7.access(cwdCandidate);
3922
4092
  const admittedCwd = await admitCandidate(cwdCandidate, false);
@@ -3928,7 +4098,7 @@ async function findTsserverPath(root, allowInstall, options) {
3928
4098
  if (!tscPath)
3929
4099
  return void 0;
3930
4100
  for (const dir of typescriptDirsForTsc(tscPath)) {
3931
- const candidate = path8.join(dir, "lib", "tsserver.js");
4101
+ const candidate = path9.join(dir, "lib", "tsserver.js");
3932
4102
  try {
3933
4103
  const admitted = await admitCandidate(candidate, false);
3934
4104
  if (admitted)
@@ -3939,7 +4109,9 @@ async function findTsserverPath(root, allowInstall, options) {
3939
4109
  return void 0;
3940
4110
  };
3941
4111
  const installAllowed = canInstall(allowInstall);
3942
- const discoveredTsc = await absoluteCommandPath(await ensureTool("typescript", { allowInstall: installAllowed }));
4112
+ const discoveredTsc = await absoluteCommandPath((await lookupManagedTool("typescript", root, void 0, {
4113
+ allowInstall: installAllowed
4114
+ })).found);
3943
4115
  const discoveredTsserver = await tsserverForTsc(discoveredTsc);
3944
4116
  if (discoveredTsserver || !discoveredTsc || !installAllowed || classicTsRepairState().attempted) {
3945
4117
  return discoveredTsserver;
@@ -3950,10 +4122,10 @@ async function findTsserverPath(root, allowInstall, options) {
3950
4122
  return void 0;
3951
4123
  classicTsRepairState().attempted = true;
3952
4124
  logSessionStart(shim ? `lsp typescript: ${discoveredTsc} has no TypeScript package beside it; installing pinned classic fallback` : `lsp typescript: managed compiler resolved to TypeScript ${discoveredVersion?.version}, which ships no tsserver.js; reinstalling pinned classic fallback`);
3953
- const repairedTsc = await absoluteCommandPath(await ensureTool("typescript", {
4125
+ const repairedTsc = await absoluteCommandPath((await lookupManagedTool("typescript", root, void 0, {
3954
4126
  allowInstall: true,
3955
4127
  forceReinstall: true
3956
- }));
4128
+ })).found);
3957
4129
  return tsserverForTsc(repairedTsc);
3958
4130
  }
3959
4131
  function typeScriptMajor(version) {
@@ -3961,10 +4133,10 @@ function typeScriptMajor(version) {
3961
4133
  return /^\d+$/.test(majorText) ? Number(majorText) : Number.NaN;
3962
4134
  }
3963
4135
  async function findTypeScriptNativeAlias(nodeModulesDir) {
3964
- const aliasDir = path8.join(nodeModulesDir, "@typescript", "native");
4136
+ const aliasDir = path9.join(nodeModulesDir, "@typescript", "native");
3965
4137
  let manifest;
3966
4138
  try {
3967
- manifest = JSON.parse(await readFile(path8.join(aliasDir, "package.json"), "utf8"));
4139
+ manifest = JSON.parse(await readFile(path9.join(aliasDir, "package.json"), "utf8"));
3968
4140
  } catch {
3969
4141
  return void 0;
3970
4142
  }
@@ -3979,7 +4151,7 @@ async function findTypeScriptNativeAlias(nodeModulesDir) {
3979
4151
  const tsc = typeof bin === "object" && bin !== null ? bin.tsc : void 0;
3980
4152
  if (typeof tsc !== "string" || !tsc)
3981
4153
  return void 0;
3982
- const command = path8.resolve(aliasDir, tsc);
4154
+ const command = path9.resolve(aliasDir, tsc);
3983
4155
  try {
3984
4156
  if (!(await stat(command)).isFile())
3985
4157
  return void 0;
@@ -3993,9 +4165,9 @@ async function findNativeTypeScriptLsp(root) {
3993
4165
  for (const currentDir of walkUpDirs(root, { spelling: true })) {
3994
4166
  if (isAtOrAboveHomeDir(realpathOrResolve(currentDir), home))
3995
4167
  break;
3996
- const nodeModulesDir = path8.join(currentDir, "node_modules");
3997
- const typescriptDir = path8.join(nodeModulesDir, "typescript");
3998
- const packageJsonPath = path8.join(typescriptDir, "package.json");
4168
+ const nodeModulesDir = path9.join(currentDir, "node_modules");
4169
+ const typescriptDir = path9.join(nodeModulesDir, "typescript");
4170
+ const packageJsonPath = path9.join(typescriptDir, "package.json");
3999
4171
  let packageJsonText;
4000
4172
  try {
4001
4173
  packageJsonText = await readFile(packageJsonPath, "utf8");
@@ -4028,7 +4200,7 @@ async function findNativeTypeScriptLsp(root) {
4028
4200
  const alias = await findTypeScriptNativeAlias(nodeModulesDir);
4029
4201
  return alias && { ...alias, entry: "node-script", nodeModulesDir };
4030
4202
  }
4031
- const localTsc = path8.join(nodeModulesDir, ".bin", "tsc");
4203
+ const localTsc = path9.join(nodeModulesDir, ".bin", "tsc");
4032
4204
  const candidates = process.platform === "win32" ? [`${localTsc}.cmd`, `${localTsc}.exe`, localTsc] : [localTsc];
4033
4205
  for (const command of candidates) {
4034
4206
  try {
@@ -4102,14 +4274,14 @@ function recordEffectTsgoFallback(root, reason, failure) {
4102
4274
  async function findEffectTsgoLsp(nodeModulesDir) {
4103
4275
  let release;
4104
4276
  try {
4105
- const manifest = JSON.parse(await readFile(path8.join(nodeModulesDir, "@effect", "tsgo", "package.json"), "utf8"));
4277
+ const manifest = JSON.parse(await readFile(path9.join(nodeModulesDir, "@effect", "tsgo", "package.json"), "utf8"));
4106
4278
  release = typeof manifest === "object" && manifest !== null && "version" in manifest ? manifest.version : void 0;
4107
4279
  } catch {
4108
4280
  return void 0;
4109
4281
  }
4110
4282
  if (typeof release !== "string" || !release)
4111
4283
  return void 0;
4112
- const localBin = path8.join(nodeModulesDir, ".bin", "effect-tsgo");
4284
+ const localBin = path9.join(nodeModulesDir, ".bin", "effect-tsgo");
4113
4285
  const candidates = process.platform === "win32" ? [`${localBin}.cmd`, `${localBin}.exe`, localBin] : [localBin];
4114
4286
  for (const command of candidates) {
4115
4287
  try {
@@ -4123,32 +4295,52 @@ async function findEffectTsgoLsp(nodeModulesDir) {
4123
4295
  function dotnetToolCandidates(tool) {
4124
4296
  const home = os6.homedir();
4125
4297
  return [
4126
- path8.join(PI_LENS_BIN_DIR2, `${tool}.exe`),
4127
- path8.join(PI_LENS_BIN_DIR2, tool),
4128
- path8.join(home, ".dotnet", "tools", `${tool}.exe`),
4129
- path8.join(home, ".dotnet", "tools", tool),
4298
+ path9.join(PI_LENS_BIN_DIR2, `${tool}.exe`),
4299
+ path9.join(PI_LENS_BIN_DIR2, tool),
4300
+ path9.join(home, ".dotnet", "tools", `${tool}.exe`),
4301
+ path9.join(home, ".dotnet", "tools", tool),
4130
4302
  tool
4131
4303
  ].filter(Boolean);
4132
4304
  }
4133
4305
  function binExeVariants(dir, tool) {
4134
- const variants = process.platform === "win32" ? [path8.join(dir, `${tool}.exe`), path8.join(dir, tool)] : [path8.join(dir, tool)];
4306
+ const win32 = process.platform === "win32";
4307
+ const bare = path9.join(dir, tool);
4308
+ const variants = win32 ? [path9.join(dir, `${tool}.exe`), bare] : [bare];
4135
4309
  const admitted = [];
4136
4310
  for (const candidate of variants) {
4137
4311
  if (existsSync3(candidate) && isUntrustedProjectPath(candidate)) {
4138
4312
  recordProjectCommandRefusal(candidate);
4139
4313
  continue;
4140
4314
  }
4315
+ if (win32 && candidate === bare && isUntrustedProjectPath(bare)) {
4316
+ const sibling = pathextSibling(dir, tool);
4317
+ if (sibling)
4318
+ recordProjectCommandRefusal(sibling);
4319
+ continue;
4320
+ }
4141
4321
  admitted.push(candidate);
4142
4322
  }
4143
4323
  return admitted;
4144
4324
  }
4325
+ function pathextSibling(dir, tool) {
4326
+ const wanted = tool.toLowerCase();
4327
+ try {
4328
+ const name = readdirSync5(dir).find((entry) => {
4329
+ const lower = entry.toLowerCase();
4330
+ return lower === wanted || lower.startsWith(`${wanted}.`);
4331
+ });
4332
+ return name === void 0 ? void 0 : path9.join(dir, name);
4333
+ } catch {
4334
+ return void 0;
4335
+ }
4336
+ }
4145
4337
  function goBinCandidates(tool) {
4146
- const gopath = process.env.GOPATH?.split(path8.delimiter)[0] || path8.join(os6.homedir(), "go");
4147
- return [tool, ...binExeVariants(path8.join(gopath, "bin"), tool)];
4338
+ const gopath = process.env.GOPATH?.split(path9.delimiter)[0] || path9.join(os6.homedir(), "go");
4339
+ return [tool, ...binExeVariants(path9.join(gopath, "bin"), tool)];
4148
4340
  }
4149
4341
  function cargoBinCandidates(tool) {
4150
- const cargoHome = process.env.CARGO_HOME || path8.join(os6.homedir(), ".cargo");
4151
- return [tool, ...binExeVariants(path8.join(cargoHome, "bin"), tool)];
4342
+ const cargoHome = process.env.CARGO_HOME || path9.join(os6.homedir(), ".cargo");
4343
+ return [tool, ...binExeVariants(path9.join(cargoHome, "bin"), tool)];
4152
4344
  }
4153
4345
  async function tryGemInstall(gem) {
4154
4346
  const { join: join4 } = await import("node:path");
@@ -4170,7 +4362,7 @@ function DenoExcludeRoot(primary) {
4170
4362
  return async (file) => {
4171
4363
  const denoRoot = await denoDetector(file);
4172
4364
  if (denoRoot)
4173
- return void 0;
4365
+ return LSP_ROOT_DECLINED;
4174
4366
  return primary(file);
4175
4367
  };
4176
4368
  }
@@ -4206,31 +4398,31 @@ async function findExtensionBoundedRoot(file, extensionRootKey) {
4206
4398
  const identity = realpathOrResolve(file);
4207
4399
  const insideBoundary = isUnderDir(identity, extensionRootKey);
4208
4400
  const boundaryKey = insideBoundary ? normalizeEphemeralMapKey(realpathOrResolve(extensionRootKey)) : extensionRootKey;
4209
- const start = path8.dirname(insideBoundary ? identity : path8.resolve(file));
4401
+ const start = path9.dirname(insideBoundary ? identity : path9.resolve(file));
4210
4402
  const configMarkers = tsConfigMarkersForFile(file);
4211
4403
  for (const currentDir of walkUpDirs(start, { spelling: true })) {
4212
4404
  for (const pattern of configMarkers) {
4213
4405
  try {
4214
- await stat(path8.join(currentDir, pattern));
4406
+ await stat(path9.join(currentDir, pattern));
4215
4407
  return currentDir;
4216
4408
  } catch {
4217
4409
  }
4218
4410
  }
4219
4411
  for (const pattern of TS_TOOLING_MARKERS) {
4220
4412
  try {
4221
- await stat(path8.join(currentDir, pattern));
4413
+ await stat(path9.join(currentDir, pattern));
4222
4414
  return currentDir;
4223
4415
  } catch {
4224
4416
  }
4225
4417
  }
4226
- const currentKey = normalizeEphemeralMapKey(path8.resolve(currentDir));
4418
+ const currentKey = normalizeEphemeralMapKey(path9.resolve(currentDir));
4227
4419
  if (currentKey === boundaryKey)
4228
4420
  return void 0;
4229
4421
  }
4230
4422
  return void 0;
4231
4423
  }
4232
4424
  async function classifyAgentLevelMarker(extensionRootKey, file) {
4233
- const agentDir = path8.dirname(extensionRootKey);
4425
+ const agentDir = path9.dirname(extensionRootKey);
4234
4426
  if (!agentDir || agentDir === extensionRootKey)
4235
4427
  return void 0;
4236
4428
  const configMarkers = tsConfigMarkersForFile(file);
@@ -4240,7 +4432,7 @@ async function classifyAgentLevelMarker(extensionRootKey, file) {
4240
4432
  ...TS_TOOLING_MARKERS
4241
4433
  ]) {
4242
4434
  try {
4243
- await stat(path8.join(agentDir, pattern));
4435
+ await stat(path9.join(agentDir, pattern));
4244
4436
  return configMarkers.includes(pattern) ? "config" : "other";
4245
4437
  } catch {
4246
4438
  }
@@ -4255,7 +4447,7 @@ var TypeScriptRoot = withRootMarkers(DenoExcludeRoot(async (file) => {
4255
4447
  return extensionRoot;
4256
4448
  const agentMarker = await classifyAgentLevelMarker(extensionRootKey, file);
4257
4449
  if (agentMarker === "config") {
4258
- return realpathOrResolve(path8.dirname(extensionRootKey));
4450
+ return realpathOrResolve(path9.dirname(extensionRootKey));
4259
4451
  }
4260
4452
  if (agentMarker === "other") {
4261
4453
  return FileDirRoot(file);
@@ -4274,9 +4466,7 @@ async function launchClassicTypeScript(root, options) {
4274
4466
  ["node_modules", ".bin", "typescript-language-server"]
4275
4467
  ]);
4276
4468
  if (!lspPath) {
4277
- lspPath = await ensureTool("typescript-language-server", {
4278
- allowInstall: canInstall(options?.allowInstall)
4279
- });
4469
+ ({ found: lspPath } = await lookupManagedTool("typescript-language-server", root, void 0, { allowInstall: canInstall(options?.allowInstall) }));
4280
4470
  if (lspPath)
4281
4471
  source = "managed";
4282
4472
  if (!lspPath) {
@@ -4403,6 +4593,7 @@ var PythonServer = {
4403
4593
  const toolEnvironment = await getToolEnvironment();
4404
4594
  const env = augmentPythonEnvironment(toolEnvironment, pythonEnvironment);
4405
4595
  let source = "direct";
4596
+ const refusals = { refused: false, bareRefused: false };
4406
4597
  const projectPyright = await resolveAndLaunch({
4407
4598
  candidates: [
4408
4599
  ...pythonEnvironmentToolCandidates(pythonEnvironment, "pyright-langserver"),
@@ -4412,7 +4603,8 @@ var PythonServer = {
4412
4603
  ],
4413
4604
  args: ["--stdio"],
4414
4605
  cwd: root,
4415
- env
4606
+ env,
4607
+ refusals
4416
4608
  }, false);
4417
4609
  if (projectPyright) {
4418
4610
  return {
@@ -4425,7 +4617,8 @@ var PythonServer = {
4425
4617
  candidates: pythonEnvironmentToolCandidates(pythonEnvironment, "ty"),
4426
4618
  args: ["server"],
4427
4619
  cwd: root,
4428
- env
4620
+ env,
4621
+ refusals
4429
4622
  }, false);
4430
4623
  if (projectTy) {
4431
4624
  return { process: projectTy.process, source: projectTy.source };
@@ -4434,7 +4627,8 @@ var PythonServer = {
4434
4627
  candidates: ["pyright-langserver", "basedpyright-langserver"],
4435
4628
  args: ["--stdio"],
4436
4629
  cwd: root,
4437
- env
4630
+ env,
4631
+ refusals
4438
4632
  }, false);
4439
4633
  if (pathPyright) {
4440
4634
  return {
@@ -4447,24 +4641,23 @@ var PythonServer = {
4447
4641
  candidates: ["ty"],
4448
4642
  args: ["server"],
4449
4643
  cwd: root,
4450
- env
4644
+ env,
4645
+ refusals
4451
4646
  }, false);
4452
4647
  if (pathTy) {
4453
4648
  return { process: pathTy.process, source: pathTy.source };
4454
4649
  }
4455
- const pyrightPath = await ensureTool("pyright", {
4456
- allowInstall: canInstall(options?.allowInstall)
4457
- });
4650
+ const { found: pyrightPath } = await lookupManagedTool("pyright", root, refusals, { allowInstall: canInstall(options?.allowInstall) });
4458
4651
  if (!pyrightPath)
4459
4652
  return void 0;
4460
4653
  source = "managed";
4461
- const binDir = path8.dirname(pyrightPath);
4654
+ const binDir = path9.dirname(pyrightPath);
4462
4655
  const isWindows2 = process.platform === "win32";
4463
4656
  const managedCandidates = isWindows2 ? [
4464
- path8.join(binDir, "pyright-langserver.cmd"),
4465
- path8.join(binDir, "pyright-langserver"),
4657
+ path9.join(binDir, "pyright-langserver.cmd"),
4658
+ path9.join(binDir, "pyright-langserver"),
4466
4659
  "pyright-langserver"
4467
- ] : [path8.join(binDir, "pyright-langserver"), "pyright-langserver"];
4660
+ ] : [path9.join(binDir, "pyright-langserver"), "pyright-langserver"];
4468
4661
  const resolved = await resolveAndLaunch({ candidates: managedCandidates, args: ["--stdio"], cwd: root, env }, false);
4469
4662
  if (!resolved)
4470
4663
  return void 0;
@@ -4498,13 +4691,15 @@ var PythonJediServer = {
4498
4691
  const toolEnvironment = await getToolEnvironment();
4499
4692
  const env = augmentPythonEnvironment(toolEnvironment, pythonEnvironment);
4500
4693
  const initialization = pythonEnvironment ? { workspace: { environmentPath: pythonEnvironment.pythonPath } } : {};
4694
+ const refusals = { refused: false, bareRefused: false };
4501
4695
  if (pythonEnvironment) {
4502
4696
  try {
4503
4697
  const projectLaunched = await resolveAndLaunch({
4504
4698
  candidates: pythonEnvironmentToolCandidates(pythonEnvironment, "jedi-language-server"),
4505
4699
  args: [],
4506
4700
  cwd: root,
4507
- env
4701
+ env,
4702
+ refusals
4508
4703
  }, options?.allowInstall);
4509
4704
  if (projectLaunched)
4510
4705
  return { ...projectLaunched, initialization };
@@ -4522,7 +4717,8 @@ var PythonJediServer = {
4522
4717
  args: [],
4523
4718
  cwd: root,
4524
4719
  env: toolEnvironment,
4525
- managedToolId: "jedi-language-server"
4720
+ managedToolId: "jedi-language-server",
4721
+ refusals
4526
4722
  }, options?.allowInstall);
4527
4723
  if (!launched)
4528
4724
  return void 0;
@@ -4569,7 +4765,7 @@ function cargoWorkspaceDeclaresMember(workspaceContent, parentDir, childDir) {
4569
4765
  return readCargoWorkspaceMembers(workspaceContent).some(matches);
4570
4766
  }
4571
4767
  function sessionHoistCeiling(sessionCwd, file) {
4572
- return isSameOrWithin(path8.resolve(sessionCwd), path8.resolve(file)) ? path8.resolve(sessionCwd) : void 0;
4768
+ return isSameOrWithin(path9.resolve(sessionCwd), path9.resolve(file)) ? path9.resolve(sessionCwd) : void 0;
4573
4769
  }
4574
4770
  function RustWorkspaceRoot() {
4575
4771
  const crateRoot = createRootDetector(["Cargo.toml", "Cargo.lock"]);
@@ -4579,14 +4775,14 @@ function RustWorkspaceRoot() {
4579
4775
  return void 0;
4580
4776
  const sessionCwd = process.cwd();
4581
4777
  const stop = sessionHoistCeiling(sessionCwd, file);
4582
- const fsRoot = path8.parse(root).root;
4778
+ const fsRoot = path9.parse(root).root;
4583
4779
  for (const current of walkUpDirs(root, { spelling: true })) {
4584
4780
  if (stop !== void 0 && current === stop)
4585
4781
  break;
4586
- const parent = path8.dirname(current);
4782
+ const parent = path9.dirname(current);
4587
4783
  if (parent === current || parent === fsRoot)
4588
4784
  break;
4589
- const parentCargoPath = path8.join(parent, "Cargo.toml");
4785
+ const parentCargoPath = path9.join(parent, "Cargo.toml");
4590
4786
  const parentCargoContent = await readTextFileOrUndefined(parentCargoPath);
4591
4787
  if (parentCargoContent !== void 0 && hasCargoWorkspaceTable(parentCargoContent)) {
4592
4788
  if (cargoWorkspaceDeclaresMember(parentCargoContent, parent, root)) {
@@ -4613,9 +4809,9 @@ async function declaresMavenModule(parentDir, parentPomPath, childDir) {
4613
4809
  const modulesBlock = content.match(/<modules>([\s\S]*?)<\/modules>/);
4614
4810
  if (!modulesBlock)
4615
4811
  return false;
4616
- const resolvedChild = path8.resolve(childDir);
4812
+ const resolvedChild = path9.resolve(childDir);
4617
4813
  for (const match of modulesBlock[1].matchAll(/<module>\s*([^<]+?)\s*<\/module>/g)) {
4618
- if (pathsEqual(path8.resolve(parentDir, match[1]), resolvedChild))
4814
+ if (pathsEqual(path9.resolve(parentDir, match[1]), resolvedChild))
4619
4815
  return true;
4620
4816
  }
4621
4817
  return false;
@@ -4638,16 +4834,16 @@ function JavaWorkspaceRoot() {
4638
4834
  const sessionCwd = process.cwd();
4639
4835
  const stop = sessionHoistCeiling(sessionCwd, file);
4640
4836
  let lastHop = root;
4641
- const fsRoot = path8.parse(root).root;
4837
+ const fsRoot = path9.parse(root).root;
4642
4838
  for (const current of walkUpDirs(root, { spelling: true })) {
4643
4839
  if (stop !== void 0 && current === stop)
4644
4840
  break;
4645
- const parent = path8.dirname(current);
4841
+ const parent = path9.dirname(current);
4646
4842
  if (parent === current || parent === fsRoot)
4647
4843
  break;
4648
4844
  if (!await markerExists(parent, "pom.xml"))
4649
4845
  continue;
4650
- const parentPom = path8.join(parent, "pom.xml");
4846
+ const parentPom = path9.join(parent, "pom.xml");
4651
4847
  if (!await declaresMavenModule(parent, parentPom, lastHop))
4652
4848
  break;
4653
4849
  lastHop = parent;
@@ -4657,7 +4853,7 @@ function JavaWorkspaceRoot() {
4657
4853
  }
4658
4854
  var RustServer = {
4659
4855
  id: "rust",
4660
- idleEviction: "unmeasured",
4856
+ idleEviction: "resident",
4661
4857
  role: "language",
4662
4858
  // Measured (#3750): rust-analyzer answers an empty result for a detached file.
4663
4859
  requiresProjectRoot: true,
@@ -4750,17 +4946,17 @@ var PHPServer = {
4750
4946
  return {
4751
4947
  ...result,
4752
4948
  initialization: {
4753
- storagePath: path8.join(getGlobalPiLensDir(), "intelephense")
4949
+ storagePath: path9.join(getGlobalPiLensDir(), "intelephense")
4754
4950
  }
4755
4951
  };
4756
4952
  }
4757
4953
  };
4758
4954
  function buildPsesArgs(bundleDir) {
4759
- const script = path8.join(bundleDir, "PowerShellEditorServices", "Start-EditorServices.ps1");
4760
- const sessionDir = path8.join(getGlobalPiLensDir(), "pses", `${process.pid}-${Date.now()}`);
4955
+ const script = path9.join(bundleDir, "PowerShellEditorServices", "Start-EditorServices.ps1");
4956
+ const sessionDir = path9.join(getGlobalPiLensDir(), "pses", `${process.pid}-${Date.now()}`);
4761
4957
  mkdirSync2(sessionDir, { recursive: true });
4762
- const logPath = path8.join(sessionDir, "pses.log");
4763
- const sessionDetailsPath = path8.join(sessionDir, "session.json");
4958
+ const logPath = path9.join(sessionDir, "pses.log");
4959
+ const sessionDetailsPath = path9.join(sessionDir, "session.json");
4764
4960
  return [
4765
4961
  "-NoLogo",
4766
4962
  "-NoProfile",
@@ -4791,7 +4987,7 @@ function buildPsesArgs(bundleDir) {
4791
4987
  }
4792
4988
  var PowerShellServer = {
4793
4989
  id: "powershell",
4794
- idleEviction: "unmeasured",
4990
+ idleEviction: "resident",
4795
4991
  role: "language",
4796
4992
  name: "PowerShell Editor Services",
4797
4993
  executesProjectCode: true,
@@ -4884,11 +5080,17 @@ var JavaServer = createInteractiveServer({
4884
5080
  language: "java",
4885
5081
  command: () => process.env.JDTLS_PATH || "jdtls",
4886
5082
  args: (root) => createLombokJdtlsArgs(root),
4887
- runtime: "java"
5083
+ runtime: "java",
5084
+ // #5675: jdtls 1.63.0 (Temurin 25.0.5+8) answers a didChange that carries
5085
+ // the bytes it already holds: the cascade's re-send of an importer at
5086
+ // 19.331 was published for the new version at 19.847 (+516 ms, docVersion 1)
5087
+ // and republished the other importer at 19.855, 3/3 on the real smoke row
5088
+ // (see LspResendRecheck; transcripts in the PR body).
5089
+ resendRecheck: "rechecks"
4888
5090
  });
4889
5091
  var KotlinServer = {
4890
5092
  id: "kotlin",
4891
- idleEviction: "unmeasured",
5093
+ idleEviction: "resident",
4892
5094
  role: "language",
4893
5095
  name: "Kotlin Language Server",
4894
5096
  executesProjectCode: true,
@@ -4933,7 +5135,7 @@ var GroovyServer = {
4933
5135
  if (viaLauncher)
4934
5136
  return viaLauncher;
4935
5137
  const jar = process.env[GROOVY_LANGUAGE_SERVER_JAR_ENV];
4936
- const resolvedJar = jar ? path8.resolve(jar) : void 0;
5138
+ const resolvedJar = jar ? path9.resolve(jar) : void 0;
4937
5139
  const jarIsFile = resolvedJar ? statSync4(resolvedJar, { throwIfNoEntry: false })?.isFile() ?? false : false;
4938
5140
  if (resolvedJar && jarIsFile) {
4939
5141
  try {
@@ -5071,7 +5273,7 @@ var ElixirServer = createInteractiveServer({
5071
5273
  });
5072
5274
  var ElixirExpertServer = {
5073
5275
  id: "expert",
5074
- idleEviction: "unmeasured",
5276
+ idleEviction: "resident",
5075
5277
  role: "language",
5076
5278
  name: "Expert",
5077
5279
  executesProjectCode: true,
@@ -5473,8 +5675,8 @@ var VueServer = {
5473
5675
  initializeTimeoutMs: 3e4,
5474
5676
  async spawn(root, options) {
5475
5677
  const tsserverPath = await findTsserverPath(root, options?.allowInstall, options);
5476
- const hasPackageJson = existsSync3(path8.join(root, "package.json"));
5477
- const hasNodeModules = existsSync3(path8.join(root, "node_modules"));
5678
+ const hasPackageJson = existsSync3(path9.join(root, "package.json"));
5679
+ const hasNodeModules = existsSync3(path9.join(root, "node_modules"));
5478
5680
  if (hasPackageJson && !hasNodeModules) {
5479
5681
  logSessionStart(`lsp vue: node_modules missing in ${root} \u2014 Vue navigation may be limited. Run: npm install (or pnpm/yarn install) in this project.`);
5480
5682
  }
@@ -5489,14 +5691,14 @@ var VueServer = {
5489
5691
  return {
5490
5692
  process: proc.process,
5491
5693
  source: proc.source,
5492
- initialization: tsserverPath ? { typescript: { tsdk: path8.dirname(tsserverPath) } } : void 0
5694
+ initialization: tsserverPath ? { typescript: { tsdk: path9.dirname(tsserverPath) } } : void 0
5493
5695
  };
5494
5696
  }
5495
5697
  };
5496
5698
  var SvelteServer = {
5497
5699
  id: "svelte",
5498
5700
  executesProjectCode: true,
5499
- idleEviction: "unmeasured",
5701
+ idleEviction: "resident",
5500
5702
  role: "language",
5501
5703
  name: "Svelte Language Server",
5502
5704
  extensions: [".svelte"],
@@ -5531,7 +5733,7 @@ var SvelteServer = {
5531
5733
  return {
5532
5734
  process: proc.process,
5533
5735
  source: proc.source,
5534
- initialization: tsserverPath ? { typescript: { tsdk: path8.dirname(tsserverPath) } } : void 0
5736
+ initialization: tsserverPath ? { typescript: { tsdk: path9.dirname(tsserverPath) } } : void 0
5535
5737
  };
5536
5738
  }
5537
5739
  };
@@ -5856,7 +6058,7 @@ function getServerById(id) {
5856
6058
  }
5857
6059
 
5858
6060
  // dist/clients/lsp/session-roots.js
5859
- import path9 from "node:path";
6061
+ import path10 from "node:path";
5860
6062
  var SESSION_ROOT_CAP = 128;
5861
6063
  var sessionRoots = new BoundedFifoMap(SESSION_ROOT_CAP);
5862
6064
  function noteEvictedRoots(evicted) {
@@ -5871,16 +6073,16 @@ function noteEvictedRoots(evicted) {
5871
6073
  return roots;
5872
6074
  }
5873
6075
  function registerSessionRoot(cwd) {
5874
- const root = path9.resolve(cwd);
6076
+ const root = path10.resolve(cwd);
5875
6077
  if (sessionRoots.has(root))
5876
6078
  return [];
5877
6079
  return noteEvictedRoots(sessionRoots.set(root, void 0));
5878
6080
  }
5879
6081
  function setSessionRootConfig(cwd, config) {
5880
- return noteEvictedRoots(sessionRoots.set(path9.resolve(cwd), config));
6082
+ return noteEvictedRoots(sessionRoots.set(path10.resolve(cwd), config));
5881
6083
  }
5882
6084
  function sessionRootConfigForFile(filePath) {
5883
- const resolvedFilePath = path9.resolve(filePath);
6085
+ const resolvedFilePath = path10.resolve(filePath);
5884
6086
  let bestMatch;
5885
6087
  for (const [root, config] of sessionRoots) {
5886
6088
  if (config === void 0)
@@ -5907,16 +6109,16 @@ function disabledPrimaries(filePath) {
5907
6109
  };
5908
6110
  }
5909
6111
  function isSessionRootRegistered(cwd) {
5910
- return sessionRoots.has(path9.resolve(cwd));
6112
+ return sessionRoots.has(path10.resolve(cwd));
5911
6113
  }
5912
6114
  function shouldInitializeSessionRoot(cwd, readyRoots) {
5913
- const normalized = path9.resolve(cwd);
6115
+ const normalized = path10.resolve(cwd);
5914
6116
  return !readyRoots.has(normalized) || !isSessionRootRegistered(normalized);
5915
6117
  }
5916
6118
  function isOutsideAllSessionRoots(filePath) {
5917
6119
  if (sessionRoots.size === 0)
5918
6120
  return false;
5919
- const resolved = path9.resolve(filePath);
6121
+ const resolved = path10.resolve(filePath);
5920
6122
  for (const root of sessionRoots.keys()) {
5921
6123
  if (isSameOrWithin(root, resolved))
5922
6124
  return false;
@@ -5928,6 +6130,8 @@ function getSessionRootsForTelemetry(limit = 4) {
5928
6130
  }
5929
6131
 
5930
6132
  export {
6133
+ findLocalOpengrepConfig,
6134
+ resolveOpengrepConfig,
5931
6135
  findLocalTyposConfig,
5932
6136
  getAstGrepRuleSources,
5933
6137
  getAstGrepRuleFingerprint,