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
@@ -7,10 +7,11 @@ import {
7
7
  getReadGuardCorrelationId,
8
8
  logReadGuardEvent,
9
9
  messageIsCutWhenDisplayed,
10
+ messageWithoutRulePrefix,
10
11
  normalizeMessage,
11
12
  sanitizeCorrelationId,
12
13
  stableFindingId
13
- } from "./chunk-35UJUF27.js";
14
+ } from "./chunk-6LIUVGOR.js";
14
15
  import {
15
16
  mapWithConcurrency
16
17
  } from "./chunk-XIMYZ3JA.js";
@@ -22,6 +23,7 @@ import {
22
23
  declinesProjectlessRoot,
23
24
  disabledPrimaries,
24
25
  enforceLspRootCeiling,
26
+ findLocalOpengrepConfig,
25
27
  findLocalTyposConfig,
26
28
  getAstGrepRuleSources,
27
29
  getServerById,
@@ -42,20 +44,17 @@ import {
42
44
  resolveLspServerCwd,
43
45
  serverTraits,
44
46
  withLspProjectCodePermission
45
- } from "./chunk-YIEHUKX2.js";
46
- import {
47
- findLocalOpengrepConfig
48
- } from "./chunk-J7VNGHLN.js";
47
+ } from "./chunk-KMY2OU4T.js";
49
48
  import {
50
49
  emitBounded
51
- } from "./chunk-AB26NAHA.js";
50
+ } from "./chunk-ZIF4WLWR.js";
52
51
  import {
53
52
  acquireWorkspaceSweepHold,
54
53
  configureLspServiceLifecycle,
55
54
  getOwnedLspService,
56
55
  peekOwnedLspService,
57
56
  resetOwnedLspService
58
- } from "./chunk-B2QO7GHY.js";
57
+ } from "./chunk-I65CQLCG.js";
59
58
  import {
60
59
  RUNTIME_CONFIG,
61
60
  collectForwardImportMtimes,
@@ -70,37 +69,43 @@ import {
70
69
  lineTextAt,
71
70
  pathBirthtimeMs,
72
71
  scanDocumentContent
73
- } from "./chunk-S7KUDW73.js";
72
+ } from "./chunk-7ZFXICNN.js";
74
73
  import {
75
74
  js_yaml_default
76
- } from "./chunk-2DWNYVUN.js";
75
+ } from "./chunk-EQKF6BAK.js";
77
76
  import {
78
77
  loadProjectSnapshot
79
- } from "./chunk-MET776XM.js";
78
+ } from "./chunk-MVG2ZEAO.js";
80
79
  import {
81
80
  EXTENSION_TO_LSP_ID,
82
81
  lspLanguageId,
83
82
  resolveFilenameLanguage
84
- } from "./chunk-NAACKIKT.js";
83
+ } from "./chunk-HKPJTI47.js";
85
84
  import {
86
85
  diagnosticsIpcPathForCwd,
87
86
  requestWarmCodeActions,
88
87
  requestWarmDiagnostics
89
- } from "./chunk-6MDWNZ7E.js";
88
+ } from "./chunk-PKGOROPQ.js";
90
89
  import {
91
90
  semanticFor
92
91
  } from "./chunk-2APSZHHI.js";
92
+ import {
93
+ CONTENT_HASH_MAX_BYTES,
94
+ hashContentBytes,
95
+ hashFileBytes,
96
+ stampContentBytes
97
+ } from "./chunk-CIA7X2PZ.js";
93
98
  import {
94
99
  findLocalZizmorConfig,
95
100
  logSessionStart
96
- } from "./chunk-YOMLAKU6.js";
101
+ } from "./chunk-VC3W54G3.js";
97
102
  import {
98
103
  findLocalBinUpwards,
99
104
  isProjectLocalBinPath
100
- } from "./chunk-25CAONWT.js";
105
+ } from "./chunk-YZNARDMM.js";
101
106
  import {
102
107
  getLspCapableKinds
103
- } from "./chunk-HOWHAKXO.js";
108
+ } from "./chunk-Y3ZNOZZS.js";
104
109
  import {
105
110
  readJsonCache
106
111
  } from "./chunk-TQWRH25U.js";
@@ -122,25 +127,19 @@ import {
122
127
  sampleProcessTreeCpuPercent,
123
128
  selectLivePeerInstances,
124
129
  windowsExe
125
- } from "./chunk-M3QGXGY4.js";
130
+ } from "./chunk-LURFD4HD.js";
126
131
  import {
127
132
  createSingleFlight
128
- } from "./chunk-GIK6VUCY.js";
133
+ } from "./chunk-3UHGSUVL.js";
129
134
  import {
130
135
  PathKeyedMap,
131
136
  detectFileRole
132
- } from "./chunk-N2U644ZW.js";
137
+ } from "./chunk-UX75PTQW.js";
133
138
  import {
134
139
  SPECIAL_FILENAMES,
135
140
  getLanguageId,
136
141
  isJstsFactFile
137
- } from "./chunk-SL4G67AP.js";
138
- import {
139
- CONTENT_HASH_MAX_BYTES,
140
- hashContentBytes,
141
- hashFileBytes,
142
- stampContentBytes
143
- } from "./chunk-CIA7X2PZ.js";
142
+ } from "./chunk-V4TFQY5G.js";
144
143
  import {
145
144
  HOOK_WALL_BUDGET_MS,
146
145
  assertInstallAllowed,
@@ -151,7 +150,7 @@ import {
151
150
  untilAborted,
152
151
  withDeadline,
153
152
  writeFileAtomic
154
- } from "./chunk-EKQDQPX6.js";
153
+ } from "./chunk-463WN3VP.js";
155
154
  import {
156
155
  compareOrdinal,
157
156
  incrementDegradationCount,
@@ -160,7 +159,7 @@ import {
160
159
  recordDegradationOnce,
161
160
  spawnAbortScope,
162
161
  truncateForLedger
163
- } from "./chunk-P7EV5ISR.js";
162
+ } from "./chunk-CQNXALZJ.js";
164
163
  import {
165
164
  freshnessFromMtime
166
165
  } from "./chunk-S26LC76R.js";
@@ -177,7 +176,7 @@ import {
177
176
  nonNegativeIntEnv,
178
177
  phaseFinished,
179
178
  phaseStarted
180
- } from "./chunk-HUWW77QY.js";
179
+ } from "./chunk-YVE5Q2UU.js";
181
180
  import {
182
181
  BoundedFifoMap,
183
182
  BoundedLruCache,
@@ -202,7 +201,7 @@ import {
202
201
  uriToDiskPath,
203
202
  uriToPath,
204
203
  walkUpDirs
205
- } from "./chunk-6MWX2J5H.js";
204
+ } from "./chunk-ZSPVF7KI.js";
206
205
  import {
207
206
  __commonJS,
208
207
  __require,
@@ -1425,8 +1424,8 @@ var require_semaphore = __commonJS({
1425
1424
  this._waiting = [];
1426
1425
  }
1427
1426
  lock(thunk) {
1428
- return new Promise((resolve7, reject) => {
1429
- this._waiting.push({ thunk, resolve: resolve7, reject });
1427
+ return new Promise((resolve8, reject) => {
1428
+ this._waiting.push({ thunk, resolve: resolve8, reject });
1430
1429
  this.runNext();
1431
1430
  });
1432
1431
  }
@@ -3053,9 +3052,9 @@ ${JSON.stringify(message, null, 4)}`);
3053
3052
  if (typeof cancellationStrategy.sender.enableCancellation === "function") {
3054
3053
  cancellationStrategy.sender.enableCancellation(requestMessage);
3055
3054
  }
3056
- return new Promise(async (resolve7, reject) => {
3055
+ return new Promise(async (resolve8, reject) => {
3057
3056
  const resolveWithCleanup = (r) => {
3058
- resolve7(r);
3057
+ resolve8(r);
3059
3058
  cancellationStrategy.sender.cleanup(id);
3060
3059
  disposable?.dispose();
3061
3060
  };
@@ -3485,10 +3484,10 @@ var require_ril = __commonJS({
3485
3484
  return api_1.Disposable.create(() => this.stream.off("end", listener));
3486
3485
  }
3487
3486
  write(data, encoding) {
3488
- return new Promise((resolve7, reject) => {
3487
+ return new Promise((resolve8, reject) => {
3489
3488
  const callback = (error) => {
3490
3489
  if (error === void 0 || error === null) {
3491
- resolve7();
3490
+ resolve8();
3492
3491
  } else {
3493
3492
  reject(error);
3494
3493
  }
@@ -3627,7 +3626,7 @@ var require_main = __commonJS({
3627
3626
  exports.createMessageConnection = createMessageConnection2;
3628
3627
  var ril_1 = __importDefault(require_ril());
3629
3628
  ril_1.default.install();
3630
- var path18 = __importStar(__require("path"));
3629
+ var path19 = __importStar(__require("path"));
3631
3630
  var os3 = __importStar(__require("os"));
3632
3631
  var fs14 = __importStar(__require("fs"));
3633
3632
  var crypto_1 = __require("crypto");
@@ -3779,14 +3778,14 @@ var require_main = __commonJS({
3779
3778
  throw new Error(`Unable to generate a random pipe name with ${randomLength} characters.`);
3780
3779
  }
3781
3780
  const randomSuffix = (0, crypto_1.randomBytes)(Math.floor(randomLength / 2)).toString("hex");
3782
- return path18.join(tmpDir, `lsp-${randomSuffix}.sock`);
3781
+ return path19.join(tmpDir, `lsp-${randomSuffix}.sock`);
3783
3782
  }
3784
3783
  function createClientPipeTransport(pipeName, encoding = "utf-8") {
3785
3784
  let connectResolve;
3786
- const connected = new Promise((resolve7, _reject) => {
3787
- connectResolve = resolve7;
3785
+ const connected = new Promise((resolve8, _reject) => {
3786
+ connectResolve = resolve8;
3788
3787
  });
3789
- return new Promise((resolve7, reject) => {
3788
+ return new Promise((resolve8, reject) => {
3790
3789
  const server = (0, net_1.createServer)((socket) => {
3791
3790
  server.close();
3792
3791
  connectResolve([
@@ -3797,7 +3796,7 @@ var require_main = __commonJS({
3797
3796
  server.on("error", reject);
3798
3797
  server.listen(pipeName, () => {
3799
3798
  server.removeListener("error", reject);
3800
- resolve7({
3799
+ resolve8({
3801
3800
  onConnected: () => {
3802
3801
  return connected;
3803
3802
  },
@@ -3817,10 +3816,10 @@ var require_main = __commonJS({
3817
3816
  }
3818
3817
  function createClientSocketTransport(port, encoding = "utf-8") {
3819
3818
  let connectResolve;
3820
- const connected = new Promise((resolve7, _reject) => {
3821
- connectResolve = resolve7;
3819
+ const connected = new Promise((resolve8, _reject) => {
3820
+ connectResolve = resolve8;
3822
3821
  });
3823
- return new Promise((resolve7, reject) => {
3822
+ return new Promise((resolve8, reject) => {
3824
3823
  const server = (0, net_1.createServer)((socket) => {
3825
3824
  server.close();
3826
3825
  connectResolve([
@@ -3837,7 +3836,7 @@ var require_main = __commonJS({
3837
3836
  return;
3838
3837
  }
3839
3838
  const boundPort = address.port;
3840
- resolve7({
3839
+ resolve8({
3841
3840
  port: () => boundPort,
3842
3841
  onConnected: () => {
3843
3842
  return connected;
@@ -3885,7 +3884,7 @@ var CASCADE_DIAGNOSTICS_TTL_MS = 24e4;
3885
3884
  import * as nodeFs2 from "node:fs";
3886
3885
  import fs13 from "node:fs/promises";
3887
3886
  import os2 from "node:os";
3888
- import path17 from "node:path";
3887
+ import path18 from "node:path";
3889
3888
  import { pathToFileURL as pathToFileURL3, URL as URL3 } from "node:url";
3890
3889
 
3891
3890
  // dist/clients/lsp/watch-queue.js
@@ -4062,7 +4061,7 @@ async function importTargetsToAnnounce(cwd, importers, onScope) {
4062
4061
  reason: `resolved the imports of ${CREATED_IMPORT_SCAN_MAX_FILES} of ${importers.length} files in one diagnostics call`
4063
4062
  });
4064
4063
  }
4065
- const { extractForwardImports } = await import("./chunk-3IWMNN2S.js");
4064
+ const { extractForwardImports } = await import("./chunk-Q6D5QKRG.js");
4066
4065
  const targets = /* @__PURE__ */ new Set();
4067
4066
  const reexports = /* @__PURE__ */ new Map();
4068
4067
  let resolved2 = 0;
@@ -5441,14 +5440,9 @@ var SMART_DOUBLE_QUOTES_RE = charClass(HOST_SMART_DOUBLE_QUOTES);
5441
5440
  var UNICODE_DASHES_RE = charClass(HOST_UNICODE_DASHES);
5442
5441
  var SPECIAL_SPACES_RE = charClass(HOST_SPECIAL_SPACES);
5443
5442
  var BOM = String.fromCharCode(HOST_BOM_CODE_POINT);
5444
- function detectLineEnding(content) {
5445
- const crlfIdx = content.indexOf("\r\n");
5446
- const lfIdx = content.indexOf("\n");
5447
- if (lfIdx === -1)
5448
- return "\n";
5449
- if (crlfIdx === -1)
5450
- return "\n";
5451
- return crlfIdx < lfIdx ? "\r\n" : "\n";
5443
+ function lineEndingAtLine(lines, line) {
5444
+ const terminated = line < lines.length - 1 ? line : line - 1;
5445
+ return lines[terminated]?.endsWith("\r") ? "\r\n" : "\n";
5452
5446
  }
5453
5447
  function normalizeToLF(text) {
5454
5448
  return text.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
@@ -7827,15 +7821,8 @@ function recordBaselineLoss(cause) {
7827
7821
  reason: BASELINE_LOSS_REASONS[cause]
7828
7822
  });
7829
7823
  }
7830
- var globalStoreSymbol = /* @__PURE__ */ Symbol.for("pi-lens:opaque-snapshot-store");
7831
- var globalSlot = globalThis;
7832
7824
  function getOpaqueBaselineStore() {
7833
- const existing = globalSlot[globalStoreSymbol]?.store;
7834
- if (existing)
7835
- return existing;
7836
- const created = new OpaqueBaselineStore();
7837
- globalSlot[globalStoreSymbol] = { store: created };
7838
- return created;
7825
+ return getProcessSingleton("opaque-baseline-store", 1, () => new OpaqueBaselineStore());
7839
7826
  }
7840
7827
  var gitRepoMemo = /* @__PURE__ */ new Map();
7841
7828
  var overCapRootMemo = new BoundedFifoMap(16);
@@ -8740,6 +8727,14 @@ function recordLspMutationOutcome(context, status) {
8740
8727
  // dist/clients/lsp/diagnostic-binding.js
8741
8728
  import { createHash as createHash4 } from "node:crypto";
8742
8729
  import * as fs6 from "node:fs";
8730
+ var TOUCH_INCONCLUSIVE_REASON_PHRASE = {
8731
+ "notify-write": "the document write did not finish within its budget",
8732
+ "diagnostics-wait": "no document diagnostics arrived within the wait budget",
8733
+ "server-loading": "the language server is still loading",
8734
+ "server-load-failed": "the language server failed to load",
8735
+ mixed: "the document write and diagnostics wait did not both finish",
8736
+ "primary-unavailable": "no primary language server answered"
8737
+ };
8743
8738
  function resolveTouchVerdict(input) {
8744
8739
  const unavailableIds = [...new Set(input.unavailablePrimaryServerIds ?? [])];
8745
8740
  if (unavailableIds.length > 0) {
@@ -8953,7 +8948,7 @@ async function runPerServerGroups(groups, concurrency, processGroup, signal) {
8953
8948
  }
8954
8949
 
8955
8950
  // dist/clients/lsp/client-registry.js
8956
- import path13 from "node:path";
8951
+ import path14 from "node:path";
8957
8952
 
8958
8953
  // dist/clients/widget-state.js
8959
8954
  import { readFileSync as readFileSync7 } from "node:fs";
@@ -9086,7 +9081,7 @@ function resyncDocumentOnPastEof(filePath) {
9086
9081
  void (async () => {
9087
9082
  try {
9088
9083
  const [{ getOwnedLspService: getOwnedLspService2 }, content] = await Promise.all([
9089
- import("./chunk-EBXCYEII.js"),
9084
+ import("./chunk-WAQQGXVV.js"),
9090
9085
  fs7.promises.readFile(filePath, "utf-8")
9091
9086
  ]);
9092
9087
  await getOwnedLspService2().openFile(filePath, content, { preserveDiagnostics: false });
@@ -9142,6 +9137,7 @@ var WriteOrderingGuard = class {
9142
9137
  };
9143
9138
 
9144
9139
  // dist/clients/inline-blocker-fields.js
9140
+ import { isAbsolute, resolve as resolve5 } from "node:path";
9145
9141
  function inlineBlockerSourceOf(diagnostic) {
9146
9142
  return diagnostic.tool?.trim() || "unknown";
9147
9143
  }
@@ -9151,8 +9147,11 @@ function inlineBlockerSources(blockers) {
9151
9147
  function inlineBlockerLines(blockers, filePath) {
9152
9148
  return inlineBlockerPlaces(blockers, filePath).map((place) => place.line);
9153
9149
  }
9154
- function isCrossFileBlocker(d, filePath) {
9155
- return !!d.filePath && normalizeEphemeralMapKey(d.filePath) !== normalizeEphemeralMapKey(filePath);
9150
+ function isCrossFileBlocker(d, filePath, root) {
9151
+ if (!d.filePath)
9152
+ return false;
9153
+ const cited = root !== void 0 && !isAbsolute(d.filePath) ? resolve5(root, d.filePath) : d.filePath;
9154
+ return normalizeEphemeralMapKey(cited) !== normalizeEphemeralMapKey(filePath);
9156
9155
  }
9157
9156
  function inlineBlockerPlacement(blockers, filePath) {
9158
9157
  const places = [];
@@ -9333,33 +9332,55 @@ function getDisposition(cwd, anchor) {
9333
9332
  function resetDeferredDispositions() {
9334
9333
  deferredByCwd.clear();
9335
9334
  }
9336
- function displayFormAliases(candidates) {
9337
- const cut = /* @__PURE__ */ new Map();
9335
+ function aliasSpellings(candidate) {
9336
+ const spellings = [];
9337
+ if (messageIsCutWhenDisplayed(candidate.message)) {
9338
+ spellings.push(displayedMessage(candidate.message));
9339
+ }
9340
+ if (candidate.semantic !== "blocking")
9341
+ return spellings;
9342
+ for (const spelling of [candidate.message, ...spellings]) {
9343
+ const bare = messageWithoutRulePrefix(spelling, candidate.rule);
9344
+ if (bare !== void 0)
9345
+ spellings.push(bare);
9346
+ }
9347
+ return spellings;
9348
+ }
9349
+ function messageAliases(candidates) {
9350
+ const spelled = /* @__PURE__ */ new Map();
9338
9351
  const owners = /* @__PURE__ */ new Map();
9352
+ const keyOf = (identity, message) => [identity.tool ?? "", identity.rule ?? "", normalizeMessage2(message)].join("\0");
9353
+ const ownerOf = (candidate) => keyOf(candidate.finding ?? candidate, candidate.message);
9339
9354
  for (const candidate of candidates) {
9340
- if (!messageIsCutWhenDisplayed(candidate.message))
9355
+ const spellings = aliasSpellings(candidate);
9356
+ if (spellings.length === 0)
9341
9357
  continue;
9342
- const form = displayedMessage(candidate.message);
9343
- cut.set(candidate, form);
9344
- const key = normalizeMessage2(form);
9345
- const owner = owners.get(key);
9346
- const message = normalizeMessage2(candidate.message);
9347
- if (owner === void 0)
9348
- owners.set(key, /* @__PURE__ */ new Set([message]));
9349
- else
9350
- owner.add(message);
9358
+ spelled.set(candidate, spellings);
9359
+ const owner = ownerOf(candidate);
9360
+ for (const spelling of spellings) {
9361
+ const key = keyOf(candidate, spelling);
9362
+ const known = owners.get(key);
9363
+ if (known === void 0)
9364
+ owners.set(key, /* @__PURE__ */ new Set([owner]));
9365
+ else
9366
+ known.add(owner);
9367
+ }
9351
9368
  }
9352
- if (cut.size === 0)
9369
+ if (spelled.size === 0)
9353
9370
  return /* @__PURE__ */ new Map();
9354
9371
  for (const candidate of candidates) {
9355
- const message = normalizeMessage2(candidate.message);
9356
- owners.get(message)?.add(message);
9372
+ owners.get(keyOf(candidate, candidate.message))?.add(ownerOf(candidate));
9357
9373
  }
9358
9374
  const aliases = /* @__PURE__ */ new Map();
9359
- for (const [candidate, form] of cut) {
9360
- if ((owners.get(normalizeMessage2(form))?.size ?? 0) === 1) {
9361
- aliases.set(candidate, form);
9375
+ for (const [candidate, spellings] of spelled) {
9376
+ const kept = [];
9377
+ for (const spelling of spellings) {
9378
+ if ((owners.get(keyOf(candidate, spelling))?.size ?? 0) === 1) {
9379
+ kept.push(spelling);
9380
+ }
9362
9381
  }
9382
+ if (kept.length > 0)
9383
+ aliases.set(candidate, kept);
9363
9384
  }
9364
9385
  return aliases;
9365
9386
  }
@@ -9370,27 +9391,20 @@ function applyDispositions(diagnostics, cwd, filePath, content) {
9370
9391
  if (nothingToApply(dispositions, cwd))
9371
9392
  return diagnostics;
9372
9393
  const deferred = deferredAnchorsFor(cwd);
9373
- const aliases = displayFormAliases(diagnostics);
9394
+ const aliases = messageAliases(diagnostics);
9374
9395
  return diagnostics.filter((d) => {
9375
- const { strict, weak } = anchorsForDiagnostic(cwd, filePath, d, content);
9376
9396
  const isBlocking2 = d.semantic === "blocking";
9377
- const alias = aliases.get(d);
9378
- let aliasStrict;
9379
- let aliasWeak;
9380
- if (alias !== void 0) {
9381
- const aliasAnchors = anchorsForDiagnostic(cwd, filePath, { ...d, message: alias }, content);
9382
- aliasStrict = aliasAnchors.strict;
9383
- if (!isBlocking2)
9384
- aliasWeak = aliasAnchors.weak;
9385
- }
9386
- if (!isBlocking2 && (deferred?.has(weak) || aliasWeak !== void 0 && deferred?.has(aliasWeak))) {
9387
- return false;
9388
- }
9389
- if (dispositions?.[strict]?.disposition === "false-positive" || aliasStrict !== void 0 && dispositions?.[aliasStrict]?.disposition === "false-positive") {
9390
- return false;
9391
- }
9392
- if (!isBlocking2 && (dispositions?.[weak]?.disposition === "suppress" || aliasWeak !== void 0 && dispositions?.[aliasWeak]?.disposition === "suppress")) {
9393
- return false;
9397
+ const messages = [d.message, ...aliases.get(d) ?? []];
9398
+ for (const message of messages) {
9399
+ const { strict, weak } = anchorsForDiagnostic(cwd, filePath, message === d.message ? d : { ...d, message }, content);
9400
+ if (!isBlocking2 && deferred?.has(weak))
9401
+ return false;
9402
+ if (dispositions?.[strict]?.disposition === "false-positive") {
9403
+ return false;
9404
+ }
9405
+ if (!isBlocking2 && dispositions?.[weak]?.disposition === "suppress") {
9406
+ return false;
9407
+ }
9394
9408
  }
9395
9409
  return true;
9396
9410
  });
@@ -9492,6 +9506,13 @@ function filterPerFileGroup(diagnostics, cwd, filePathOf, applyGroup) {
9492
9506
 
9493
9507
  // dist/clients/session-state-store.js
9494
9508
  import { promises as fs9 } from "node:fs";
9509
+ import * as path10 from "node:path";
9510
+ function sessionsDir(cwd) {
9511
+ return path10.join(getProjectDataDir(cwd), "sessions");
9512
+ }
9513
+ function sessionStateFileName(sessionId) {
9514
+ return `${sessionId.replace(/[^A-Za-z0-9._-]/g, "_").slice(0, 200)}.json`;
9515
+ }
9495
9516
  async function dropStaleFiles(widget, savedAt) {
9496
9517
  const checked = await Promise.all(widget.files.map(async (file) => {
9497
9518
  try {
@@ -9584,8 +9605,8 @@ function publishDiagnostics(args) {
9584
9605
  dbg: args.dbg
9585
9606
  });
9586
9607
  }
9587
- function wasPreviouslyReportedDirty(path18) {
9588
- return reportedDirtyPaths.has(normalizeFilePath(path18));
9608
+ function wasPreviouslyReportedDirty(path19) {
9609
+ return reportedDirtyPaths.has(normalizeFilePath(path19));
9589
9610
  }
9590
9611
 
9591
9612
  // dist/clients/widget-state.js
@@ -9755,6 +9776,7 @@ function clearWidgetState() {
9755
9776
  lspServers.clear();
9756
9777
  sessionLanguages = [];
9757
9778
  requestRenderFn = null;
9779
+ resetClearHide();
9758
9780
  diagnosticsWriteGuard.clear();
9759
9781
  runnerWriteGuard.clear();
9760
9782
  nextInactivePruneSize = MAX_INACTIVE_FILE_RECORDS + 1;
@@ -10321,6 +10343,14 @@ function recordLsp(serverId, root, status, durationMs) {
10321
10343
  lspServers.set(key, { serverId, root, status: mapped, durationMs });
10322
10344
  requestRender();
10323
10345
  }
10346
+ var clearSinceMs = null;
10347
+ var clearHideTimer = null;
10348
+ function resetClearHide() {
10349
+ if (clearHideTimer !== null)
10350
+ clearTimeout(clearHideTimer);
10351
+ clearHideTimer = null;
10352
+ clearSinceMs = null;
10353
+ }
10324
10354
  function classifyFileTier(rec) {
10325
10355
  if (rec.diagnosticCounts.blocking > 0)
10326
10356
  return "blocking";
@@ -10399,14 +10429,14 @@ async function raceToCompletion(promises4, shouldComplete, options = { timeoutMs
10399
10429
  const languageCount = promises4.length - auxIndices.size;
10400
10430
  let languageRemaining = languageCount;
10401
10431
  let auxGraceStarted = false;
10402
- return new Promise((resolve7) => {
10432
+ return new Promise((resolve8) => {
10403
10433
  const timeout = setTimeout(() => {
10404
10434
  completed = true;
10405
10435
  if (graceTimer)
10406
10436
  clearTimeout(graceTimer);
10407
10437
  if (auxGraceTimer)
10408
10438
  clearTimeout(auxGraceTimer);
10409
- resolve7(results.filter((r) => r !== void 0));
10439
+ resolve8(results.filter((r) => r !== void 0));
10410
10440
  }, options.timeoutMs);
10411
10441
  const finalize = () => {
10412
10442
  if (completed)
@@ -10417,7 +10447,7 @@ async function raceToCompletion(promises4, shouldComplete, options = { timeoutMs
10417
10447
  clearTimeout(graceTimer);
10418
10448
  if (auxGraceTimer)
10419
10449
  clearTimeout(auxGraceTimer);
10420
- resolve7(results.filter((r) => r !== void 0));
10450
+ resolve8(results.filter((r) => r !== void 0));
10421
10451
  };
10422
10452
  const startAuxGrace = () => {
10423
10453
  if (auxGraceStarted || completed)
@@ -10478,7 +10508,7 @@ async function raceToCompletion(promises4, shouldComplete, options = { timeoutMs
10478
10508
  // dist/clients/lsp/edits.js
10479
10509
  import fs10 from "node:fs/promises";
10480
10510
  import { readFileSync as readFileSync8, realpathSync, statSync as statSync8 } from "node:fs";
10481
- import path10 from "node:path";
10511
+ import path11 from "node:path";
10482
10512
  import { URL as URL2 } from "node:url";
10483
10513
 
10484
10514
  // dist/clients/lsp/position-encoding.js
@@ -10735,7 +10765,6 @@ function utf16Position(content, position, encoding) {
10735
10765
  function normalizeTextEditsForContent(content, edits, encoding) {
10736
10766
  const lines = content.split("\n");
10737
10767
  const lastLine = Math.max(0, lines.length - 1);
10738
- const ending = detectLineEnding(content);
10739
10768
  const clamp = (position) => {
10740
10769
  if (position.line >= lines.length) {
10741
10770
  return { line: lastLine, character: (lines[lastLine] ?? "").length };
@@ -10750,7 +10779,7 @@ function normalizeTextEditsForContent(content, edits, encoding) {
10750
10779
  return {
10751
10780
  ...edit,
10752
10781
  range: { start, end },
10753
- newText: restoreLineEndings(normalizeToLF(edit.newText), ending)
10782
+ newText: restoreLineEndings(normalizeToLF(edit.newText), lineEndingAtLine(lines, start.line))
10754
10783
  };
10755
10784
  });
10756
10785
  return validateTextEdits(converted);
@@ -11009,7 +11038,7 @@ function planWorkspaceEdit(edit, trackOrigins = false) {
11009
11038
  set.add(key);
11010
11039
  descendants.set(current, set);
11011
11040
  ancestors.push(current);
11012
- const parent = path10.dirname(current);
11041
+ const parent = path11.dirname(current);
11013
11042
  if (parent === current)
11014
11043
  break;
11015
11044
  current = parent;
@@ -11109,7 +11138,7 @@ function planWorkspaceEdit(edit, trackOrigins = false) {
11109
11138
  return ops;
11110
11139
  }
11111
11140
  function relativeToCwd(filePath, cwd) {
11112
- const rel = path10.relative(cwd, filePath) || path10.basename(filePath);
11141
+ const rel = path11.relative(cwd, filePath) || path11.basename(filePath);
11113
11142
  return toPosix(rel);
11114
11143
  }
11115
11144
  var IMPORT_RELEVANT_LINE = /^\s*import\b|^\s*export\s[^;]*\bfrom\s|\bfrom\s+['"]/;
@@ -11161,7 +11190,7 @@ async function isSameFsEntry(a, b) {
11161
11190
  return Boolean(statA && statB && isSameFsIdentity(statA, statB));
11162
11191
  }
11163
11192
  async function assertParentIsUsable(filePath, stateFor) {
11164
- for (const current of walkUpDirs(path10.dirname(filePath), {
11193
+ for (const current of walkUpDirs(path11.dirname(filePath), {
11165
11194
  spelling: true
11166
11195
  })) {
11167
11196
  const known = await stateFor(current);
@@ -11191,7 +11220,7 @@ async function createWorkspaceUriConfiner(cwd) {
11191
11220
  } catch (err) {
11192
11221
  throw new Error(`invalid workspace edit URI ${uri}: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
11193
11222
  }
11194
- if (!path10.isAbsolute(filePath))
11223
+ if (!path11.isAbsolute(filePath))
11195
11224
  throw new Error(`workspace edit path escapes workspace: ${uri}`);
11196
11225
  const resolved2 = await requireKernelIdentity(filePath, uri);
11197
11226
  if (!isUnderDir(resolved2, root))
@@ -11217,8 +11246,8 @@ async function preflightWorkspaceEdit(planned, cwd, options) {
11217
11246
  for (let index = virtualMoves.length - 1; index >= 0; index--) {
11218
11247
  const move = virtualMoves[index];
11219
11248
  if (isUnderDir(resolved2, move.to) && (move.directory || pathsEqual(resolved2, move.to))) {
11220
- const suffix = path10.relative(move.to, resolved2);
11221
- resolved2 = suffix ? path10.join(move.from, suffix) : move.from;
11249
+ const suffix = path11.relative(move.to, resolved2);
11250
+ resolved2 = suffix ? path11.join(move.from, suffix) : move.from;
11222
11251
  continue;
11223
11252
  }
11224
11253
  if (isUnderDir(resolved2, move.from) && (move.directory || pathsEqual(resolved2, move.from))) {
@@ -11323,7 +11352,7 @@ async function preflightWorkspaceEdit(planned, cwd, options) {
11323
11352
  const newPath = await confine(op.newUri);
11324
11353
  const oldDisk = uriToDiskPath(op.oldUri);
11325
11354
  const newDisk = uriToDiskPath(op.newUri);
11326
- if (toPosix(path10.resolve(oldDisk)) === toPosix(path10.resolve(newDisk))) {
11355
+ if (toPosix(path11.resolve(oldDisk)) === toPosix(path11.resolve(newDisk))) {
11327
11356
  throw new Error("rename source and destination must differ");
11328
11357
  }
11329
11358
  const source = await stateFor(oldPath);
@@ -11496,7 +11525,7 @@ async function applyWorkspaceEdit(edit, cwd, options = {}) {
11496
11525
  } else if (op.kind === "create") {
11497
11526
  const filePath = uriToPath(op.uri);
11498
11527
  const diskPath = uriToDiskPath(op.uri);
11499
- await fs10.mkdir(path10.dirname(diskPath), { recursive: true });
11528
+ await fs10.mkdir(path11.dirname(diskPath), { recursive: true });
11500
11529
  if (op.options?.overwrite)
11501
11530
  await fs10.writeFile(diskPath, "", "utf-8");
11502
11531
  else
@@ -11516,7 +11545,7 @@ async function applyWorkspaceEdit(edit, cwd, options = {}) {
11516
11545
  const newPath = uriToPath(op.newUri);
11517
11546
  const oldDisk = uriToDiskPath(op.oldUri);
11518
11547
  const newDisk = uriToDiskPath(op.newUri);
11519
- await fs10.mkdir(path10.dirname(newDisk), { recursive: true });
11548
+ await fs10.mkdir(path11.dirname(newDisk), { recursive: true });
11520
11549
  if (op.options?.overwrite)
11521
11550
  await fs10.rm(newDisk, { recursive: true, force: true });
11522
11551
  await fs10.rename(oldDisk, newDisk);
@@ -11763,10 +11792,10 @@ async function attemptTsserverSyncDiagnostics(file, svc) {
11763
11792
 
11764
11793
  // dist/clients/lsp/workspace-diagnostics-cache.js
11765
11794
  import * as fs11 from "node:fs";
11766
- import * as path12 from "node:path";
11795
+ import * as path13 from "node:path";
11767
11796
 
11768
11797
  // dist/clients/reverse-deps.js
11769
- import * as path11 from "node:path";
11798
+ import * as path12 from "node:path";
11770
11799
  function rankFilesByReverseDependencyCentrality(index) {
11771
11800
  const files2 = /* @__PURE__ */ new Set([
11772
11801
  ...Object.keys(index.imports),
@@ -11813,7 +11842,7 @@ function filePathForNode(graph, nodeId) {
11813
11842
  }
11814
11843
  function buildReverseDependencyIndexFromGraph(args) {
11815
11844
  const index = {
11816
- projectRoot: normalizeMapKey(path11.resolve(args.cwd)),
11845
+ projectRoot: normalizeMapKey(path12.resolve(args.cwd)),
11817
11846
  generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
11818
11847
  seq: args.seq,
11819
11848
  imports: {},
@@ -11889,7 +11918,7 @@ function loadReverseDependencyIndexFromSnapshot(args) {
11889
11918
  return buildReverseDependencyIndexFromSnapshot(snapshot);
11890
11919
  }
11891
11920
  function getReverseDepsFromIndex(index, filePath) {
11892
- return sortedUnique(index.importedBy[normalizeMapKey(path11.resolve(filePath))] ?? []);
11921
+ return sortedUnique(index.importedBy[normalizeMapKey(path12.resolve(filePath))] ?? []);
11893
11922
  }
11894
11923
 
11895
11924
  // dist/clients/lsp/workspace-diagnostics-cache.js
@@ -11897,7 +11926,7 @@ var WORKSPACE_DIAGNOSTICS_CACHE_VERSION = 4;
11897
11926
  var RELEASED_OLDER_CACHE_VERSIONS = /* @__PURE__ */ new Set([1, 2, 3]);
11898
11927
  var CACHE_FILE = "lsp-workspace-diagnostics.json";
11899
11928
  function cachePath(cwd) {
11900
- return path12.join(getProjectDataDir(cwd), "cache", CACHE_FILE);
11929
+ return path13.join(getProjectDataDir(cwd), "cache", CACHE_FILE);
11901
11930
  }
11902
11931
  var MAX_REGISTERED_CWDS = 64;
11903
11932
  var _registeredCwds = /* @__PURE__ */ new Set();
@@ -11907,14 +11936,14 @@ function clearAllWorkspaceDiagnosticsCaches() {
11907
11936
  }
11908
11937
  }
11909
11938
  function clearWorkspaceDiagnosticsCacheAtAndAbove(cwd, ceiling = process.cwd()) {
11910
- const root = path12.resolve(cwd);
11911
- const workspaceRoot = path12.resolve(ceiling);
11939
+ const root = path13.resolve(cwd);
11940
+ const workspaceRoot = path13.resolve(ceiling);
11912
11941
  clearWorkspaceDiagnosticsCache(root);
11913
11942
  if (relativeInside(workspaceRoot, root) === void 0)
11914
11943
  return;
11915
11944
  if (normalizeMapKey(root) === normalizeMapKey(workspaceRoot))
11916
11945
  return;
11917
- for (const ancestor of walkUpDirs(path12.dirname(root), { spelling: true })) {
11946
+ for (const ancestor of walkUpDirs(path13.dirname(root), { spelling: true })) {
11918
11947
  clearWorkspaceDiagnosticsCache(ancestor);
11919
11948
  if (normalizeMapKey(ancestor) === normalizeMapKey(workspaceRoot))
11920
11949
  return;
@@ -11932,7 +11961,7 @@ function loadWorkspaceDiagnosticsCache(cwd) {
11932
11961
  if (RELEASED_OLDER_CACHE_VERSIONS.has(cache.version)) {
11933
11962
  recordDegradationOnce({
11934
11963
  kind: "lsp-workspace-cache-migration",
11935
- subject: path12.resolve(cwd),
11964
+ subject: path13.resolve(cwd),
11936
11965
  reason: `rejected v${cache.version} cache with ${cache.entries && typeof cache.entries === "object" ? Object.keys(cache.entries).length : 0} entries during cache version migration`
11937
11966
  });
11938
11967
  }
@@ -11954,13 +11983,13 @@ function loadWorkspaceDiagnosticsCache(cwd) {
11954
11983
  }
11955
11984
  function saveWorkspaceDiagnosticsCache(cwd, cache) {
11956
11985
  const filePath = cachePath(cwd);
11957
- fs11.mkdirSync(path12.dirname(filePath), { recursive: true });
11986
+ fs11.mkdirSync(path13.dirname(filePath), { recursive: true });
11958
11987
  writeFileAtomic(filePath, JSON.stringify(cache, null, 2), {
11959
11988
  bestEffort: false
11960
11989
  });
11961
11990
  }
11962
11991
  function clearWorkspaceDiagnosticsCache(cwd) {
11963
- const root = path12.resolve(cwd);
11992
+ const root = path13.resolve(cwd);
11964
11993
  _cacheEpochs.bump(root);
11965
11994
  try {
11966
11995
  saveWorkspaceDiagnosticsCache(root, {
@@ -12038,7 +12067,7 @@ function buildProbeScopeKey(clientScope, configDisabledServerIds) {
12038
12067
  return off.length === 0 ? base : `${base}off=${off.join(",")}`;
12039
12068
  }
12040
12069
  function createWorkspaceDiagnosticsCacheContext(cwd) {
12041
- const root = path12.resolve(cwd);
12070
+ const root = path13.resolve(cwd);
12042
12071
  if (_registeredCwds.size < MAX_REGISTERED_CWDS || _registeredCwds.has(root)) {
12043
12072
  _registeredCwds.add(root);
12044
12073
  }
@@ -12112,7 +12141,7 @@ function createWorkspaceDiagnosticsCacheContext(cwd) {
12112
12141
  const goPackageChangedSince = (key, scannedAt) => {
12113
12142
  if (!isGoSourceFile(key))
12114
12143
  return false;
12115
- const dir = path12.posix.dirname(key);
12144
+ const dir = path13.posix.dirname(key);
12116
12145
  if (!goPackageChangedAtByDir.has(dir)) {
12117
12146
  goPackageChangedAtByDir.set(dir, goPackageChangedAt(dir));
12118
12147
  }
@@ -12271,6 +12300,63 @@ function createWorkspaceDiagnosticsCacheContext(cwd) {
12271
12300
  };
12272
12301
  }
12273
12302
 
12303
+ // dist/clients/lsp/crash-output.js
12304
+ import { writeSync } from "node:fs";
12305
+ var CRASH_STACK_MAX_BYTES = 16 * 1024;
12306
+ var CRASH_WRITE_DEADLINE_MS = 1e3;
12307
+ var CRASH_WRITE_RETRY_MS = 10;
12308
+ function writeLspCrashStack(failure) {
12309
+ let text;
12310
+ try {
12311
+ text = failure instanceof Error ? String(failure.stack ?? failure.message ?? failure.name) : String(failure);
12312
+ } catch {
12313
+ text = "[lsp-crash] unprintable failure";
12314
+ }
12315
+ try {
12316
+ logExtension({
12317
+ subsystem: "lsp-crash",
12318
+ message: "crash guard terminating"
12319
+ });
12320
+ } catch {
12321
+ }
12322
+ try {
12323
+ void process.stderr;
12324
+ const output = boundedReport(text);
12325
+ const deadline = Date.now() + CRASH_WRITE_DEADLINE_MS;
12326
+ let offset = 0;
12327
+ while (offset < output.byteLength) {
12328
+ let written;
12329
+ try {
12330
+ written = writeSync(2, output, offset, output.byteLength - offset);
12331
+ } catch (writeFailure) {
12332
+ const code = writeFailure.code;
12333
+ if (code !== "EAGAIN" && code !== "EWOULDBLOCK")
12334
+ break;
12335
+ if (Date.now() >= deadline)
12336
+ break;
12337
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, CRASH_WRITE_RETRY_MS);
12338
+ continue;
12339
+ }
12340
+ if (written <= 0)
12341
+ break;
12342
+ offset += written;
12343
+ }
12344
+ } catch {
12345
+ }
12346
+ }
12347
+ function boundedReport(text) {
12348
+ const head = Buffer.from(text.slice(0, CRASH_STACK_MAX_BYTES));
12349
+ if (text.length <= CRASH_STACK_MAX_BYTES && head.byteLength <= CRASH_STACK_MAX_BYTES)
12350
+ return Buffer.from(`${text}
12351
+ `);
12352
+ return Buffer.concat([
12353
+ head.subarray(0, CRASH_STACK_MAX_BYTES),
12354
+ Buffer.from(`
12355
+ [lsp-crash] crash report truncated at ${CRASH_STACK_MAX_BYTES} bytes
12356
+ `)
12357
+ ]);
12358
+ }
12359
+
12274
12360
  // dist/clients/lsp/client.js
12275
12361
  var PUB_DEBUG = Boolean(process.env.PILENS_PUB_DEBUG);
12276
12362
  function extractSpawnMarker(args) {
@@ -12388,33 +12474,46 @@ var LSP_CRASH_CODES = /* @__PURE__ */ new Set([
12388
12474
  "EPIPE",
12389
12475
  "ECONNRESET"
12390
12476
  ]);
12391
- var crashGuardInstalled = false;
12477
+ var crashGuardState = getProcessSingleton("lsp-crash-guard", 1, () => ({ installed: false }));
12392
12478
  function isIgnorableLspRuntimeCrash(err) {
12393
12479
  if (!(err instanceof Error))
12394
12480
  return false;
12395
- const code = err.code;
12396
- if (code && LSP_CRASH_CODES.has(code))
12397
- return true;
12398
- const msg = err.message.toLowerCase();
12399
- const stack = (err.stack ?? "").toLowerCase();
12400
- return msg.includes("stream") || msg.includes("write after end") || stack.includes("vscode-jsonrpc/lib/node/ril.js");
12481
+ try {
12482
+ const code = err.code;
12483
+ if (code && LSP_CRASH_CODES.has(code))
12484
+ return true;
12485
+ const msg = err.message.toLowerCase();
12486
+ const stack = (err.stack ?? "").toLowerCase();
12487
+ return msg.includes("stream") || msg.includes("write after end") || stack.includes("vscode-jsonrpc/lib/node/ril.js");
12488
+ } catch {
12489
+ return false;
12490
+ }
12401
12491
  }
12402
12492
  function installCrashGuard() {
12403
- if (crashGuardInstalled)
12493
+ if (crashGuardState.installed)
12404
12494
  return;
12405
- crashGuardInstalled = true;
12406
- process.on("uncaughtException", (err) => {
12495
+ crashGuardState.installed = true;
12496
+ const onUncaughtException = (err) => {
12407
12497
  if (isIgnorableLspRuntimeCrash(err)) {
12408
12498
  return;
12409
12499
  }
12410
- throw err;
12411
- });
12412
- process.on("unhandledRejection", (reason) => {
12500
+ if (process.listeners("uncaughtException").some((listener) => listener !== onUncaughtException)) {
12501
+ return;
12502
+ }
12503
+ writeLspCrashStack(err);
12504
+ process.exit(1);
12505
+ };
12506
+ process.prependListener("uncaughtException", onUncaughtException);
12507
+ const onUnhandledRejection = (reason) => {
12413
12508
  if (isIgnorableLspRuntimeCrash(reason)) {
12414
12509
  return;
12415
12510
  }
12416
- throw reason instanceof Error ? reason : new Error(String(reason));
12417
- });
12511
+ if (process.listeners("unhandledRejection").some((listener) => listener !== onUnhandledRejection)) {
12512
+ return;
12513
+ }
12514
+ throw reason;
12515
+ };
12516
+ process.prependListener("unhandledRejection", onUnhandledRejection);
12418
12517
  }
12419
12518
  var MAX_INCREMENTAL_TEXT_RETAINED_ENTRIES = 128;
12420
12519
  var MAX_INCREMENTAL_TEXT_RETAINED_BYTES = 64 * 1024 * 1024;
@@ -12465,8 +12564,8 @@ async function killProcessTree(proc, pid, options = {}) {
12465
12564
  proc.unref?.();
12466
12565
  return;
12467
12566
  }
12468
- await new Promise((resolve7) => {
12469
- killer.once("close", () => resolve7());
12567
+ await new Promise((resolve8) => {
12568
+ killer.once("close", () => resolve8());
12470
12569
  killer.once("error", (err) => {
12471
12570
  logLatency({
12472
12571
  type: "phase",
@@ -12475,7 +12574,7 @@ async function killProcessTree(proc, pid, options = {}) {
12475
12574
  durationMs: 0,
12476
12575
  metadata: { pid, platform: "win32", taskkillError: String(err) }
12477
12576
  });
12478
- resolve7();
12577
+ resolve8();
12479
12578
  });
12480
12579
  });
12481
12580
  } catch (err) {
@@ -12533,18 +12632,18 @@ async function killProcessTree(proc, pid, options = {}) {
12533
12632
  proc.unref?.();
12534
12633
  return;
12535
12634
  }
12536
- const exitedInTime = await new Promise((resolve7) => {
12635
+ const exitedInTime = await new Promise((resolve8) => {
12537
12636
  if (proc.exitCode != null || proc.signalCode != null) {
12538
- resolve7(true);
12637
+ resolve8(true);
12539
12638
  return;
12540
12639
  }
12541
12640
  const onExit = () => {
12542
12641
  clearTimeout(timer);
12543
- resolve7(true);
12642
+ resolve8(true);
12544
12643
  };
12545
12644
  const timer = setTimeout(() => {
12546
12645
  proc.off?.("exit", onExit);
12547
- resolve7(false);
12646
+ resolve8(false);
12548
12647
  }, 1500);
12549
12648
  proc.once?.("exit", onExit);
12550
12649
  });
@@ -13762,6 +13861,9 @@ async function clientRequestWorkspaceDiagnostics(state4, budgetMs) {
13762
13861
  return void 0;
13763
13862
  if (!state4.workspaceDiagnosticsSupport.workspaceDiagnostics)
13764
13863
  return void 0;
13864
+ const abortSignal = getAmbientAbortSignal();
13865
+ if (abortSignal?.aborted)
13866
+ return void 0;
13765
13867
  if (state4.abandonedPullRequests?.has(WORKSPACE_PULL_SCOPE))
13766
13868
  return void 0;
13767
13869
  const previousResultIds = Array.from(state4.workspacePullResultCache.values()).map((entry) => ({ uri: entry.uri, value: entry.resultId }));
@@ -13787,9 +13889,12 @@ async function clientRequestWorkspaceDiagnostics(state4, budgetMs) {
13787
13889
  const workspacePullSettlement = { cancelled: false };
13788
13890
  const workspaceRequestPromise = safeSendRequest(state4.connection, "workspace/diagnostic", { previousResultIds }, workspacePullAbort.signal, workspacePullSettlement);
13789
13891
  try {
13790
- const report = await withDeadline(workspaceRequestPromise, {
13791
- ms: workspacePullTimeoutMs
13792
- });
13892
+ const report = await withDeadline(untilAborted(workspaceRequestPromise, abortSignal, PULL_ABORTED), { ms: workspacePullTimeoutMs });
13893
+ if (report === PULL_ABORTED) {
13894
+ trackAbandonedPullRequest(state4, WORKSPACE_PULL_SCOPE, workspaceRequestPromise);
13895
+ workspacePullAbort.abort();
13896
+ return void 0;
13897
+ }
13793
13898
  if (!report || !Array.isArray(report.items))
13794
13899
  return void 0;
13795
13900
  const out = [];
@@ -13890,11 +13995,11 @@ function waitForQuiescence(state4, budgetMs) {
13890
13995
  return Promise.resolve(true);
13891
13996
  if (budgetMs <= 0 || !isClientAlive(state4))
13892
13997
  return Promise.resolve(false);
13893
- return new Promise((resolve7) => {
13998
+ return new Promise((resolve8) => {
13894
13999
  const finish = (ready) => {
13895
14000
  clearTimeout(timer);
13896
14001
  state4.diagnosticEmitter.off(SERVER_STATUS_CHANGED, onChange);
13897
- resolve7(ready);
14002
+ resolve8(ready);
13898
14003
  };
13899
14004
  const onChange = () => {
13900
14005
  if (!isClientAlive(state4))
@@ -13963,7 +14068,7 @@ async function pullDiagnosticsWhenReady(state4, filePath, budgetMs, deadlineAt)
13963
14068
  if (remainingMs <= 0)
13964
14069
  return PULL_UNSETTLED;
13965
14070
  if (retryAfterBeat) {
13966
- await new Promise((resolve7) => setTimeout(resolve7, Math.min(PULL_DIAGNOSTICS_RETRY_INTERVAL_MS, remainingMs)));
14071
+ await new Promise((resolve8) => setTimeout(resolve8, Math.min(PULL_DIAGNOSTICS_RETRY_INTERVAL_MS, remainingMs)));
13967
14072
  }
13968
14073
  requestBudgetMs = deadlineAt - Date.now();
13969
14074
  }
@@ -14027,7 +14132,7 @@ async function clientWaitForDiagnostics(state4, filePath, timeoutMs, options = {
14027
14132
  const retryBudgetMs = strategy.pullRetryBudgetMs > 0 ? Math.min(timeoutMs, strategy.pullRetryBudgetMs) : 0;
14028
14133
  const startedAt = Date.now();
14029
14134
  while (outcome.status !== "found" && Date.now() - startedAt < retryBudgetMs) {
14030
- await new Promise((resolve7) => setTimeout(resolve7, PULL_DIAGNOSTICS_RETRY_INTERVAL_MS));
14135
+ await new Promise((resolve8) => setTimeout(resolve8, PULL_DIAGNOSTICS_RETRY_INTERVAL_MS));
14031
14136
  outcome = await clientRequestPullDiagnostics(state4, filePath, Math.max(0, retryBudgetMs - (Date.now() - startedAt)));
14032
14137
  if (outcome.status === "clean")
14033
14138
  sawClean = true;
@@ -14053,7 +14158,7 @@ async function clientWaitForDiagnostics(state4, filePath, timeoutMs, options = {
14053
14158
  return "answered";
14054
14159
  }
14055
14160
  const answerStored = () => hasFreshDiagnostics() && !isVersionStale() && (state4.pushDiagnostics.has(normalizedPath) || state4.documentPullDiagnostics.has(normalizedPath));
14056
- return new Promise((resolve7) => {
14161
+ return new Promise((resolve8) => {
14057
14162
  let debounceTimer;
14058
14163
  let settleDeferred = storedAnswerSettles();
14059
14164
  const finish = (outcome = "answered") => {
@@ -14062,7 +14167,7 @@ async function clientWaitForDiagnostics(state4, filePath, timeoutMs, options = {
14062
14167
  state4.diagnosticEmitter.off("diagnostics", onDiagnostics);
14063
14168
  state4.diagnosticEmitter.off(PENDING_RECEIPT_DROPPED, onReceiptDropped);
14064
14169
  clearTimeout(timeout);
14065
- resolve7(outcome);
14170
+ resolve8(outcome);
14066
14171
  };
14067
14172
  const onDiagnostics = (fp) => {
14068
14173
  if (normalizeMapKey(fp) !== normalizedPath)
@@ -14212,6 +14317,7 @@ async function handleNotifyOpenOnce(state4, filePath, content, languageId, prese
14212
14317
  if (state4.openDocuments.has(normalizedPath) || state4.pendingOpens.has(normalizedPath)) {
14213
14318
  const version = (state4.documentVersions.get(normalizedPath) ?? 0) + 1;
14214
14319
  state4.documentVersions.set(normalizedPath, version);
14320
+ noteDocumentSent(state4, normalizedPath);
14215
14321
  if (!preserveDiagnostics) {
14216
14322
  clearDiagnosticsForPath(state4, normalizedPath);
14217
14323
  }
@@ -14282,6 +14388,7 @@ async function handleNotifyOpenOnce(state4, filePath, content, languageId, prese
14282
14388
  state4.openDocuments.add(normalizedPath);
14283
14389
  state4.closedDocuments?.delete(normalizedPath);
14284
14390
  state4.openDocumentUris?.set(normalizedPath, uri);
14391
+ enforceOpenDocumentCap(state4);
14285
14392
  if (saved && openSent)
14286
14393
  await sendDidSave(state4, normalizedPath, uri, content);
14287
14394
  void probeTsserverProjectIdentity({
@@ -14303,9 +14410,9 @@ function enqueueDocumentNotify(state4, normalizedPath, run, saved = false, readS
14303
14410
  queue = { running: false, active: void 0 };
14304
14411
  state4.notifyChangeQueues.set(normalizedPath, queue);
14305
14412
  }
14306
- return new Promise((resolve7, reject) => {
14413
+ return new Promise((resolve8, reject) => {
14307
14414
  if (queue.closing && !close) {
14308
- resolve7(false);
14415
+ resolve8(false);
14309
14416
  return;
14310
14417
  }
14311
14418
  const previous = queue?.pending;
@@ -14319,7 +14426,7 @@ function enqueueDocumentNotify(state4, normalizedPath, run, saved = false, readS
14319
14426
  const before = (a, b) => a !== void 0 && b !== void 0 && a < b;
14320
14427
  const stale = previous !== void 0 && (saveOnly || before(readStamp, previous.readStamp) || before(readStamp, lastSent));
14321
14428
  const heldStamp = before(previous?.readStamp, lastSent) ? void 0 : previous?.readStamp;
14322
- waiters.push({ resolve: resolve7, reject, stale });
14429
+ waiters.push({ resolve: resolve8, reject, stale });
14323
14430
  queue.pending = {
14324
14431
  run: stale ? previous.run : run,
14325
14432
  saveOnly: stale ? previous.saveOnly : saveOnly,
@@ -14424,12 +14531,14 @@ async function handleNotifyChangeOnce(state4, filePath, content, normalizedPath,
14424
14531
  state4.openDocuments.add(normalizedPath);
14425
14532
  state4.closedDocuments?.delete(normalizedPath);
14426
14533
  state4.openDocumentUris?.set(normalizedPath, uri);
14534
+ enforceOpenDocumentCap(state4);
14427
14535
  if (saved && fallbackOpenSent)
14428
14536
  await sendDidSave(state4, normalizedPath, uri, content);
14429
14537
  return fallbackOpenSent;
14430
14538
  }
14431
14539
  const version = (state4.documentVersions.get(normalizedPath) ?? 0) + 1;
14432
14540
  state4.documentVersions.set(normalizedPath, version);
14541
+ noteDocumentSent(state4, normalizedPath);
14433
14542
  clearDiagnosticsForPath(state4, normalizedPath);
14434
14543
  const changeSent = await sendFenced(state4, normalizedPath, uri, "textDocument/didChange", {
14435
14544
  textDocument: { uri, version },
@@ -14456,13 +14565,52 @@ async function closedAndGone(state4, filePath, normalizedPath) {
14456
14565
  return true;
14457
14566
  }
14458
14567
  }
14568
+ function noteDocumentSent(state4, normalizedPath) {
14569
+ if (state4.openDocuments.delete(normalizedPath))
14570
+ state4.openDocuments.add(normalizedPath);
14571
+ }
14572
+ function recordCapCloseFailure(state4, victim, err) {
14573
+ emitBounded("lsp_open_document_cap_close_failed", `${state4.serverId}:close-failed`, {
14574
+ filePath: victim,
14575
+ durationMs: 0,
14576
+ metadata: { serverId: state4.serverId, reason: String(err) }
14577
+ }, {
14578
+ ledgerKind: "lsp-open-document-cap-close-failed",
14579
+ risingEdgePer: "identity",
14580
+ reason: "a didClose past the cap failed; the document stays open"
14581
+ });
14582
+ }
14583
+ function enforceOpenDocumentCap(state4) {
14584
+ const cap = state4.openDocumentCap;
14585
+ if (cap === void 0)
14586
+ return;
14587
+ let excess = state4.openDocuments.size - (state4.budgetClosesQueued ?? 0) - cap;
14588
+ if (excess <= 0)
14589
+ return;
14590
+ for (const victim of state4.openDocuments) {
14591
+ if (excess <= 0)
14592
+ break;
14593
+ if (state4.notifyChangeQueues.has(victim) || state4.pendingDiagnostics.has(victim))
14594
+ continue;
14595
+ excess -= 1;
14596
+ state4.budgetClosesQueued = (state4.budgetClosesQueued ?? 0) + 1;
14597
+ void enqueueDocumentNotify(state4, victim, () => closeDocumentOnce(state4, victim, victim, true)).catch((err) => recordCapCloseFailure(state4, victim, err)).finally(() => {
14598
+ state4.budgetClosesQueued = Math.max(0, (state4.budgetClosesQueued ?? 1) - 1);
14599
+ });
14600
+ recordDegradationOnce({
14601
+ kind: "lsp-open-document-cap",
14602
+ subject: state4.serverId,
14603
+ reason: `closed the least recently sent documents past the cap of ${cap}; their last findings stay readable, marked closed, until the next touch opens them again`
14604
+ });
14605
+ }
14606
+ }
14459
14607
  async function closeDocument(state4, filePath) {
14460
14608
  if (!isClientAlive(state4))
14461
14609
  return;
14462
14610
  const normalizedPath = normalizeMapKey(filePath);
14463
14611
  await enqueueDocumentNotify(state4, normalizedPath, () => closeDocumentOnce(state4, filePath, normalizedPath), false, void 0, true);
14464
14612
  }
14465
- async function closeDocumentOnce(state4, filePath, normalizedPath) {
14613
+ async function closeDocumentOnce(state4, filePath, normalizedPath, retainFindings = false) {
14466
14614
  if (!isClientAlive(state4))
14467
14615
  return;
14468
14616
  if (!state4.openDocuments.has(normalizedPath)) {
@@ -14490,7 +14638,17 @@ async function closeDocumentOnce(state4, filePath, normalizedPath) {
14490
14638
  state4.incrementalTextBearingPaths?.delete(normalizedPath);
14491
14639
  }
14492
14640
  state4.documentContentHashes.delete(normalizedPath);
14493
- clearDiagnosticsForPath(state4, normalizedPath);
14641
+ if (!retainFindings)
14642
+ clearDiagnosticsForPath(state4, normalizedPath);
14643
+ else {
14644
+ const pending2 = state4.pendingDiagnostics?.get(normalizedPath);
14645
+ if (pending2) {
14646
+ clearTimeout(pending2);
14647
+ countPublication(state4, normalizedPath);
14648
+ }
14649
+ state4.pendingDiagnostics?.delete(normalizedPath);
14650
+ bumpPullGeneration(state4, normalizedPath);
14651
+ }
14494
14652
  }
14495
14653
  function isAtLeastAsAggressiveShutdown(existing, requested) {
14496
14654
  return !!existing.fast >= !!requested.fast && !!existing.processExiting >= !!requested.processExiting;
@@ -14587,15 +14745,6 @@ async function clientShutdownOnce(state4, options) {
14587
14745
  shutdownOutcome: options.fast ? "fast" : shutdownRequestTimedOut || exitNotifyTimedOut || shutdownRequestUndelivered || exitNotifyUndelivered ? "forced" : "graceful"
14588
14746
  }
14589
14747
  });
14590
- void removeLspChild(pid, extractSpawnMarker(state4.lspProcess.args)).catch((err) => {
14591
- logLatency({
14592
- type: "phase",
14593
- phase: "lsp_registry_write_failed",
14594
- filePath: "",
14595
- durationMs: 0,
14596
- metadata: { op: "remove", pid, error: String(err) }
14597
- });
14598
- });
14599
14748
  await killProcessTree(state4.lspProcess.process, pid, options);
14600
14749
  }
14601
14750
  }
@@ -14802,8 +14951,12 @@ async function runReadOnlyServerCommand(state4, command, args, timeoutMs = PROBE
14802
14951
  reason: `command "${command}" is not advertised by the ${state4.serverId} server`
14803
14952
  };
14804
14953
  }
14954
+ const abortSignal = getAmbientAbortSignal();
14805
14955
  try {
14806
- const result = await safeSendRequest(state4.connection, "workspace/executeCommand", { command, arguments: args ?? [] }, void 0, void 0, { timeoutMs, cancel: true });
14956
+ const result = await safeSendRequest(state4.connection, "workspace/executeCommand", { command, arguments: args ?? [] }, abortSignal, void 0, { timeoutMs, cancel: true });
14957
+ if (result === void 0 && abortSignal?.aborted) {
14958
+ return { executed: false, reason: "aborted" };
14959
+ }
14807
14960
  return { executed: true, result };
14808
14961
  } catch (err) {
14809
14962
  if (err instanceof Error && err.message.startsWith("Timeout after")) {
@@ -14923,6 +15076,21 @@ async function createLSPClient(options) {
14923
15076
  metadata: { op: "record", pid: lspProcess.pid, error: String(err) }
14924
15077
  });
14925
15078
  });
15079
+ const forgetChild = () => {
15080
+ void removeLspChild(lspProcess.pid, extractSpawnMarker(lspProcess.args)).catch((err) => {
15081
+ logLatency({
15082
+ type: "phase",
15083
+ phase: "lsp_registry_write_failed",
15084
+ filePath: "",
15085
+ durationMs: 0,
15086
+ metadata: { op: "remove", pid: lspProcess.pid, error: String(err) }
15087
+ });
15088
+ });
15089
+ };
15090
+ if (lspProcess.process.exitCode != null || lspProcess.process.signalCode != null)
15091
+ forgetChild();
15092
+ else
15093
+ lspProcess.process.on("exit", forgetChild);
14926
15094
  const startupState = {
14927
15095
  exitCode: null,
14928
15096
  exitSignal: null,
@@ -15026,6 +15194,9 @@ async function createLSPClient(options) {
15026
15194
  rulesGeneration: 0,
15027
15195
  diagnosticFences: /* @__PURE__ */ new Map(),
15028
15196
  closedDocuments: /* @__PURE__ */ new Set(),
15197
+ ...options.openDocumentCap !== void 0 && {
15198
+ openDocumentCap: options.openDocumentCap
15199
+ },
15029
15200
  openDocumentUris: /* @__PURE__ */ new Map(),
15030
15201
  pendingOpens: /* @__PURE__ */ new Set(),
15031
15202
  projectIdentityProbedFiles: /* @__PURE__ */ new Set(),
@@ -15084,15 +15255,6 @@ async function createLSPClient(options) {
15084
15255
  state4.shutdownRequested = true;
15085
15256
  const pid = lspProcess.pid;
15086
15257
  void killProcessTree(lspProcess.process, pid);
15087
- void removeLspChild(pid, extractSpawnMarker(lspProcess.args)).catch((err2) => {
15088
- logLatency({
15089
- type: "phase",
15090
- phase: "lsp_registry_write_failed",
15091
- filePath: "",
15092
- durationMs: 0,
15093
- metadata: { op: "remove", pid, error: String(err2) }
15094
- });
15095
- });
15096
15258
  setTimeout(() => {
15097
15259
  if (lspProcess.process.exitCode === null && lspProcess.process.signalCode === null && process.platform !== "win32") {
15098
15260
  lspProcess.process.kill("SIGKILL");
@@ -15231,7 +15393,10 @@ async function createLSPClient(options) {
15231
15393
  result.set(key, {
15232
15394
  diags: getMergedDiagnosticsForPath(state4, key),
15233
15395
  ts: diagnosticsPublishedAtForPath(state4, key) ?? 0,
15234
- binding: state4.diagnosticBindings.get(key)
15396
+ binding: state4.diagnosticBindings.get(key),
15397
+ // #5700: the open-document cap closed it; the server no longer
15398
+ // re-checks it, so these are its last findings, not live ones.
15399
+ ...state4.closedDocuments?.has(key) && { closed: true }
15235
15400
  });
15236
15401
  }
15237
15402
  return result;
@@ -15575,8 +15740,8 @@ async function safeSendRequest(connection, method, params, signal, settlement, b
15575
15740
  if (signal || bound?.cancel)
15576
15741
  tokenSource = new import_node.CancellationTokenSource();
15577
15742
  if (bound) {
15578
- released = new Promise((resolve7) => {
15579
- release = resolve7;
15743
+ released = new Promise((resolve8) => {
15744
+ release = resolve8;
15580
15745
  });
15581
15746
  timer = setTimeout(() => {
15582
15747
  timeoutError = new Error(`Timeout after ${bound.timeoutMs}ms`);
@@ -15880,6 +16045,7 @@ var RUNTIME_EXIT_WINDOW_UPTIME_CEILING_MS = 10 * 6e4;
15880
16045
  var OPTIONAL_LSP_RETRY_COOLDOWN_MS = 5 * 6e4;
15881
16046
  var OPTIONAL_LSP_SERVER_IDS = /* @__PURE__ */ new Set();
15882
16047
  var DEFAULT_LSP_CLIENT_CEILING = 24;
16048
+ var DEFAULT_LSP_OPEN_DOCUMENT_CAP = 256;
15883
16049
  var DEFAULT_IDLE_EVICT_MS = 20 * 6e4;
15884
16050
  var DEFAULT_EPHEMERAL_IDLE_EVICT_MS = 6e4;
15885
16051
  function getLspIdleEvictMs() {
@@ -15904,6 +16070,10 @@ function getLspClientCeiling() {
15904
16070
  const parsed = Number.parseInt(process.env.PI_LENS_LSP_CLIENT_CEILING ?? "", 10);
15905
16071
  return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : DEFAULT_LSP_CLIENT_CEILING;
15906
16072
  }
16073
+ function getLspOpenDocumentCap() {
16074
+ const parsed = Number.parseInt(process.env.PI_LENS_LSP_OPEN_DOCUMENT_CAP ?? "", 10);
16075
+ return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : DEFAULT_LSP_OPEN_DOCUMENT_CAP;
16076
+ }
15907
16077
  var ClientRegistry = class {
15908
16078
  /** Live clients, key "serverId:normalizedRoot". Shared with `LSPState.clients`. */
15909
16079
  clients = /* @__PURE__ */ new Map();
@@ -16143,8 +16313,8 @@ var ClientRegistry = class {
16143
16313
  async withClientSpawnGate(operation) {
16144
16314
  const previous = this.clientSpawnGate;
16145
16315
  let release;
16146
- this.clientSpawnGate = new Promise((resolve7) => {
16147
- release = resolve7;
16316
+ this.clientSpawnGate = new Promise((resolve8) => {
16317
+ release = resolve8;
16148
16318
  });
16149
16319
  await previous;
16150
16320
  try {
@@ -16250,11 +16420,11 @@ var ClientRegistry = class {
16250
16420
  this.hooks.forgetNotifyBacklog(key);
16251
16421
  }
16252
16422
  scheduleIdleEviction(key, server) {
16253
- if (server.idleEviction !== "transparent" && !this.adoptedClientKeys.has(key)) {
16423
+ if (server.idleEviction === "resident" && !this.adoptedClientKeys.has(key)) {
16254
16424
  recordDegradationOnce({
16255
16425
  kind: "lsp-idle-eviction-declined",
16256
16426
  subject: server.id,
16257
- reason: `no idle-eviction timer: declared ${server.idleEviction ?? "unmeasured"}`
16427
+ reason: "no idle-eviction timer: declared resident"
16258
16428
  });
16259
16429
  return;
16260
16430
  }
@@ -16425,7 +16595,7 @@ var ClientRegistry = class {
16425
16595
  const adopted = this.analysisRootModeForFile(filePath) === "adopted";
16426
16596
  if (adopted) {
16427
16597
  const localCommand = server.command ?? server.projectLocalCommand ?? server.availabilityKey;
16428
- const localBinary = localCommand ? path13.isAbsolute(localCommand) ? isProjectLocalBinPath(localCommand, root) ? localCommand : void 0 : findLocalBinUpwards(localCommand, root) : void 0;
16598
+ const localBinary = localCommand ? path14.isAbsolute(localCommand) ? isProjectLocalBinPath(localCommand, root) ? localCommand : void 0 : findLocalBinUpwards(localCommand, root) : void 0;
16429
16599
  if (localBinary) {
16430
16600
  recordDegradationOnce({
16431
16601
  kind: "lsp-registry-decision",
@@ -16720,7 +16890,9 @@ var ClientRegistry = class {
16720
16890
  echoesOwnNotice: server.echoesOwnNotice,
16721
16891
  onDiagnosticsPublished: (serverId) => {
16722
16892
  this.hooks.noteDiagnosticsPublished(serverId);
16723
- }
16893
+ },
16894
+ // #5700: the registry's resident budget, read per spawn.
16895
+ openDocumentCap: getLspOpenDocumentCap()
16724
16896
  });
16725
16897
  };
16726
16898
  let client;
@@ -16993,7 +17165,7 @@ var ClientRegistry = class {
16993
17165
  };
16994
17166
 
16995
17167
  // dist/clients/lsp/language.js
16996
- import path14 from "node:path";
17168
+ import path15 from "node:path";
16997
17169
  var LANGUAGE_EXTENSIONS = EXTENSION_TO_LSP_ID;
16998
17170
  var BASENAME_LANGUAGE_PATTERNS = (() => {
16999
17171
  const lspCapableKinds = new Set(getLspCapableKinds());
@@ -17009,11 +17181,11 @@ function getLanguageId2(filePath) {
17009
17181
  const declared = resolveFilenameLanguage(filePath);
17010
17182
  if (declared)
17011
17183
  return lspLanguageId(declared);
17012
- const ext = path14.extname(filePath).toLowerCase();
17184
+ const ext = path15.extname(filePath).toLowerCase();
17013
17185
  if (ext && LANGUAGE_EXTENSIONS[ext]) {
17014
17186
  return LANGUAGE_EXTENSIONS[ext];
17015
17187
  }
17016
- const base = path14.basename(filePath);
17188
+ const base = path15.basename(filePath);
17017
17189
  return LANGUAGE_EXTENSIONS[base] ?? LANGUAGE_EXTENSIONS[base.toLowerCase()] ?? getBasenameLanguageId(base);
17018
17190
  }
17019
17191
 
@@ -17042,12 +17214,12 @@ function auxWaitBudgetMs(serverId, isCold, configuredCeilingMs, declaredWaitMs)
17042
17214
  }
17043
17215
 
17044
17216
  // dist/clients/lsp/inferred-project.js
17045
- import * as path16 from "node:path";
17217
+ import * as path17 from "node:path";
17046
17218
 
17047
17219
  // dist/clients/lsp/environment-gap.js
17048
17220
  import * as fs12 from "node:fs";
17049
17221
  import { isBuiltin } from "node:module";
17050
- import * as path15 from "node:path";
17222
+ import * as path16 from "node:path";
17051
17223
  var ENVIRONMENT_GAP_MARKER = "no dependency install resolved for this workspace";
17052
17224
  var ENVIRONMENT_GAP_NOTICE = `[${ENVIRONMENT_GAP_MARKER}; install the project's dependencies (npm ci, pnpm install, \u2026) and the server picks them up on its next restart]`;
17053
17225
  var TYPESCRIPT_DIAGNOSTIC_SOURCES = /* @__PURE__ */ new Set(["typescript", "ts", "tsserver"]);
@@ -17109,7 +17281,7 @@ function declaredPackageNames(startDir) {
17109
17281
  maxDepth: ENV_NODE_MODULES_WALK_MAX_LEVELS
17110
17282
  })) {
17111
17283
  try {
17112
- const manifest = JSON.parse(fs12.readFileSync(path15.join(dir, "package.json"), "utf8"));
17284
+ const manifest = JSON.parse(fs12.readFileSync(path16.join(dir, "package.json"), "utf8"));
17113
17285
  for (const field of DECLARING_FIELDS) {
17114
17286
  const declared = manifest[field];
17115
17287
  if (typeof declared !== "object" || declared === null)
@@ -17157,7 +17329,7 @@ function hasResolvableNodeModules(startDir, stat3 = (candidate) => fs12.statSync
17157
17329
  })) {
17158
17330
  last = dir;
17159
17331
  try {
17160
- stat3(path15.join(dir, "node_modules"));
17332
+ stat3(path16.join(dir, "node_modules"));
17161
17333
  return true;
17162
17334
  } catch (err) {
17163
17335
  if (err?.code !== "ENOENT") {
@@ -17165,7 +17337,7 @@ function hasResolvableNodeModules(startDir, stat3 = (candidate) => fs12.statSync
17165
17337
  }
17166
17338
  }
17167
17339
  }
17168
- return last === void 0 || path15.dirname(last) !== last;
17340
+ return last === void 0 || path16.dirname(last) !== last;
17169
17341
  }
17170
17342
  function demoteEnvironmentGapDiagnostics(diagnostics, options) {
17171
17343
  const candidates = /* @__PURE__ */ new Map();
@@ -17176,7 +17348,7 @@ function demoteEnvironmentGapDiagnostics(diagnostics, options) {
17176
17348
  }
17177
17349
  if (candidates.size === 0)
17178
17350
  return diagnostics;
17179
- const startDir = options.startDir ?? path15.dirname(realpathOrResolve(options.filePath));
17351
+ const startDir = options.startDir ?? path16.dirname(realpathOrResolve(options.filePath));
17180
17352
  if (hasResolvableNodeModules(startDir, options.stat))
17181
17353
  return diagnostics;
17182
17354
  let declared;
@@ -17234,7 +17406,7 @@ function isTsProjectFile(filePath) {
17234
17406
  }
17235
17407
  function suggestTsconfigInclude(filePath, cwd) {
17236
17408
  const relative2 = toProjectRelativePath(filePath, cwd);
17237
- if (path16.posix.isAbsolute(relative2) || /^[A-Za-z]:/.test(relative2)) {
17409
+ if (path17.posix.isAbsolute(relative2) || /^[A-Za-z]:/.test(relative2)) {
17238
17410
  const dir = relative2.slice(0, relative2.lastIndexOf("/"));
17239
17411
  return dir ? `${dir}/**` : relative2;
17240
17412
  }
@@ -17371,7 +17543,7 @@ function createLazyImport(load) {
17371
17543
  }
17372
17544
 
17373
17545
  // dist/clients/lsp-lazy.js
17374
- var lazyLsp = createLazyImport(() => import("./chunk-EH6EHFW2.js"));
17546
+ var lazyLsp = createLazyImport(() => import("./chunk-H4B4SC7I.js"));
17375
17547
  function warmLspService() {
17376
17548
  return lazyLsp.get();
17377
17549
  }
@@ -17463,8 +17635,8 @@ function destinationUriPreservingSpelling(oldUri, oldFilePath, newFilePath) {
17463
17635
  return canonical.href;
17464
17636
  }
17465
17637
  const canonicalDestination = () => `${original.protocol}//${authority}${canonical.pathname}`;
17466
- const oldParent = path17.resolve(path17.dirname(oldFilePath));
17467
- const newParent = path17.resolve(path17.dirname(newFilePath));
17638
+ const oldParent = path18.resolve(path18.dirname(oldFilePath));
17639
+ const newParent = path18.resolve(path18.dirname(newFilePath));
17468
17640
  if (normalizeMapKey(oldParent) !== normalizeMapKey(newParent)) {
17469
17641
  return canonicalDestination();
17470
17642
  }
@@ -17474,7 +17646,7 @@ function destinationUriPreservingSpelling(oldUri, oldFilePath, newFilePath) {
17474
17646
  let rawName = canonical.pathname.slice(canonical.pathname.lastIndexOf("/") + 1);
17475
17647
  const oldRawName = original.pathname.slice(slash + 1);
17476
17648
  const oldName = decodeURIComponent(oldRawName);
17477
- const expectedOldName = path17.basename(oldFilePath);
17649
+ const expectedOldName = path18.basename(oldFilePath);
17478
17650
  if (oldName.toLowerCase() !== expectedOldName.toLowerCase()) {
17479
17651
  return canonicalDestination();
17480
17652
  }
@@ -17675,7 +17847,7 @@ async function collectWorkspaceDiagnosticFiles(root, maxFiles = getMaxWorkspaceD
17675
17847
  return;
17676
17848
  if (entry.isSymbolicLink())
17677
17849
  continue;
17678
- const full = path17.join(current, entry.name);
17850
+ const full = path18.join(current, entry.name);
17679
17851
  if (entry.isDirectory()) {
17680
17852
  if (isExcludedDirName(entry.name))
17681
17853
  continue;
@@ -18746,8 +18918,8 @@ var LSPService = class _LSPService {
18746
18918
  return { outstandingMs: 0 };
18747
18919
  }
18748
18920
  let resolveSettled;
18749
- const settled = new Promise((resolve7) => {
18750
- resolveSettled = resolve7;
18921
+ const settled = new Promise((resolve8) => {
18922
+ resolveSettled = resolve8;
18751
18923
  });
18752
18924
  const token = {
18753
18925
  startedAt: Date.now(),
@@ -18961,8 +19133,8 @@ var LSPService = class _LSPService {
18961
19133
  const effectiveMaxWaitMs = hardCapMs !== void 0 ? serverBaseMs > 0 ? Math.min(serverBaseMs, hardCapMs) : hardCapMs : serverBaseMs;
18962
19134
  let knownSlowResolve;
18963
19135
  const knownSlowSentinel = /* @__PURE__ */ Symbol("lsp-client-wait-known-slow");
18964
- const knownSlow = new Promise((resolve7) => {
18965
- knownSlowResolve = () => resolve7(knownSlowSentinel);
19136
+ const knownSlow = new Promise((resolve8) => {
19137
+ knownSlowResolve = () => resolve8(knownSlowSentinel);
18966
19138
  });
18967
19139
  const noteSpawnInFlight = (serverId) => {
18968
19140
  const knownDurationMs = getSuccessfulLspSpawnDurationMs(serverId);
@@ -19053,8 +19225,8 @@ var LSPService = class _LSPService {
19053
19225
  waitResult = await Promise.race([
19054
19226
  withBudget(),
19055
19227
  knownSlow,
19056
- new Promise((resolve7) => {
19057
- waitTimer = setTimeout(() => resolve7(timeoutSentinel), effectiveMaxWaitMs);
19228
+ new Promise((resolve8) => {
19229
+ waitTimer = setTimeout(() => resolve8(timeoutSentinel), effectiveMaxWaitMs);
19058
19230
  })
19059
19231
  ]);
19060
19232
  } finally {
@@ -19664,7 +19836,7 @@ var LSPService = class _LSPService {
19664
19836
  const targets = /* @__PURE__ */ new Set();
19665
19837
  const changed = /* @__PURE__ */ new Map();
19666
19838
  for (const changedPath of changedPaths) {
19667
- const resolved2 = path17.resolve(changedPath);
19839
+ const resolved2 = path18.resolve(changedPath);
19668
19840
  for (const server of this.serversWithLiveReaderRoots(resolved2)) {
19669
19841
  const root = await this.clientRegistry.resolveServerRoot(server, resolved2);
19670
19842
  if (!root)
@@ -20043,7 +20215,7 @@ var LSPService = class _LSPService {
20043
20215
  }
20044
20216
  const languageId = getLanguageId2(filePath) ?? "plaintext";
20045
20217
  const silent = options.silent ?? false;
20046
- const notifySkippedServerIds = new Set(spawned.filter((entry) => this.shouldSkipNotify(filePath, contentHash2, entry.info.id, entry.client)).map((entry) => entry.info.id));
20218
+ const notifySkippedServerIds = new Set(spawned.filter((entry) => !(options.resendUnchanged === true && serverTraits(entry.info).resendRecheck === "rechecks") && this.shouldSkipNotify(filePath, contentHash2, entry.info.id, entry.client)).map((entry) => entry.info.id));
20047
20219
  const notifySkipped = spawned.length > 0 && notifySkippedServerIds.size === spawned.length;
20048
20220
  const savedServerIds = spawned.flatMap((entry) => notifySkippedServerIds.has(entry.info.id) ? this.saveDebouncedPush(filePath, entry, options.saved === true, contentHash2) ?? [] : []);
20049
20221
  const readPathVersion = (client) => client.getDiagnosticsVersionForPath?.(filePath);
@@ -20447,8 +20619,8 @@ var LSPService = class _LSPService {
20447
20619
  };
20448
20620
  }
20449
20621
  let timer;
20450
- const timeout = new Promise((resolve7) => {
20451
- timer = setTimeout(() => resolve7(false), budgetMs);
20622
+ const timeout = new Promise((resolve8) => {
20623
+ timer = setTimeout(() => resolve8(false), budgetMs);
20452
20624
  if (typeof timer === "object" && "unref" in timer) {
20453
20625
  timer.unref?.();
20454
20626
  }
@@ -20546,8 +20718,8 @@ var LSPService = class _LSPService {
20546
20718
  const graceMs = readTsserverSyncGraceMs();
20547
20719
  const primaryClient = spawned[0].client;
20548
20720
  const syncRacer = (async () => {
20549
- await new Promise((resolve7) => {
20550
- const timer = setTimeout(resolve7, graceMs);
20721
+ await new Promise((resolve8) => {
20722
+ const timer = setTimeout(resolve8, graceMs);
20551
20723
  timer.unref?.();
20552
20724
  });
20553
20725
  const publishedAt = primaryClient.getAllDiagnostics?.().get(normalizedPath)?.ts;
@@ -20932,6 +21104,9 @@ var LSPService = class _LSPService {
20932
21104
  if (verdict.disabledPrimaryServerIds) {
20933
21105
  result.disabledPrimaryServerIds = verdict.disabledPrimaryServerIds;
20934
21106
  }
21107
+ if (auxCoveredAtMerge.size > 0) {
21108
+ result.answeredServerIds = [...auxCoveredAtMerge];
21109
+ }
20935
21110
  if (verdict.primaryUnavailableCause) {
20936
21111
  result.primaryUnavailableCause = verdict.primaryUnavailableCause;
20937
21112
  }
@@ -20987,7 +21162,13 @@ var LSPService = class _LSPService {
20987
21162
  if (publishedAt === void 0)
20988
21163
  continue;
20989
21164
  if (reusedAnswer === void 0 || publishedAt < reusedAnswer.publishedAt) {
20990
- reusedAnswer = { serverId: entry.info.id, publishedAt };
21165
+ reusedAnswer = {
21166
+ serverId: entry.info.id,
21167
+ publishedAt,
21168
+ ...serverTraits(entry.info).resendRecheck === "rechecks" && {
21169
+ rechecks: true
21170
+ }
21171
+ };
20991
21172
  }
20992
21173
  }
20993
21174
  if (reusedAnswer)
@@ -21115,7 +21296,7 @@ var LSPService = class _LSPService {
21115
21296
  if (this.clientRegistry.analysisRootModeForFile(filePath) === "adopted")
21116
21297
  return void 0;
21117
21298
  const candidates = await Promise.all(this.serversWithLiveReaderRoots(filePath).map((server) => server.root(filePath)));
21118
- return candidates.find((candidate) => Boolean(candidate));
21299
+ return candidates.find((candidate) => typeof candidate === "string" && candidate !== "");
21119
21300
  }
21120
21301
  /**
21121
21302
  * #2052: one bounded record per normalized foreign root per session.
@@ -22006,8 +22187,8 @@ var LSPService = class _LSPService {
22006
22187
  }
22007
22188
  throw err;
22008
22189
  }
22009
- const relOld = toPosix(path17.relative(cwd, oldFilePath)) || path17.basename(oldFilePath);
22010
- const relNew = toPosix(path17.relative(cwd, newFilePath)) || path17.basename(newFilePath);
22190
+ const relOld = toPosix(path18.relative(cwd, oldFilePath)) || path18.basename(oldFilePath);
22191
+ const relNew = toPosix(path18.relative(cwd, newFilePath)) || path18.basename(newFilePath);
22011
22192
  const renameDescription = `Renamed ${relOld} \u2192 ${relNew}`;
22012
22193
  await Promise.all(activeClients.map(async ({ clientKey, serverId, client }) => {
22013
22194
  if (client.getOperationSupport().didRenameFiles !== true) {
@@ -22342,8 +22523,8 @@ var LSPService = class _LSPService {
22342
22523
  if (failedServerIds.length > 0 && !options.signal?.aborted) {
22343
22524
  const backoffMs = warmupRetryBackoffMs();
22344
22525
  if (backoffMs > 0) {
22345
- await untilAborted(new Promise((resolve7) => {
22346
- const timer = setTimeout(resolve7, backoffMs);
22526
+ await untilAborted(new Promise((resolve8) => {
22527
+ const timer = setTimeout(resolve8, backoffMs);
22347
22528
  timer.unref?.();
22348
22529
  }), options.signal);
22349
22530
  }
@@ -22377,7 +22558,7 @@ var LSPService = class _LSPService {
22377
22558
  }
22378
22559
  async runWorkspaceDiagnosticsSwept(cwd, options = {}) {
22379
22560
  const startedAt = Date.now();
22380
- const root = path17.resolve(cwd);
22561
+ const root = path18.resolve(cwd);
22381
22562
  const sweepExcludedServerIds = /* @__PURE__ */ new Set([
22382
22563
  ...WORKSPACE_SWEEP_EXCLUDED_SERVER_IDS,
22383
22564
  ...options.excludeServerIds ?? []
@@ -22930,8 +23111,14 @@ var LSPService = class _LSPService {
22930
23111
  ...attributed
22931
23112
  ]);
22932
23113
  existing.ts = Math.max(existing.ts, entry.ts);
23114
+ if (!entry.closed)
23115
+ delete existing.closed;
22933
23116
  } else {
22934
- all.set(filePath, { diags: attributed, ts: entry.ts });
23117
+ all.set(filePath, {
23118
+ diags: attributed,
23119
+ ts: entry.ts,
23120
+ ...entry.closed && { closed: true }
23121
+ });
22935
23122
  }
22936
23123
  const list = bindingsByPath.get(filePath) ?? [];
22937
23124
  list.push(entry.binding);
@@ -23229,6 +23416,7 @@ export {
23229
23416
  resetLspMutationNoBridgeDbgLatch,
23230
23417
  newLspMutationCorrelationId,
23231
23418
  recordLspMutationOutcome,
23419
+ TOUCH_INCONCLUSIVE_REASON_PHRASE,
23232
23420
  PRIMARY_UNAVAILABLE_CAUSE,
23233
23421
  primaryUnavailableCause,
23234
23422
  combinePrimaryUnavailableCauses,
@@ -23265,6 +23453,8 @@ export {
23265
23453
  applyWeakDispositionsMultiFile,
23266
23454
  trustedCitedOwnerContent,
23267
23455
  cachedAnchorMarks,
23456
+ sessionsDir,
23457
+ sessionStateFileName,
23268
23458
  isBlocking,
23269
23459
  setSessionLanguages,
23270
23460
  recordRunner,