pi-lens 4.4.7 → 4.4.8

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 (167) hide show
  1. package/CHANGELOG.md +149 -0
  2. package/README.md +12 -2
  3. package/config/markdownlint/run-no-fix.mjs +36 -0
  4. package/dist/{chunk-WME2OQST.js → chunk-2453RRJ2.js} +11 -6
  5. package/dist/{chunk-FZKFVUEC.js → chunk-2BKUFQKR.js} +276 -208
  6. package/dist/chunk-2TS4GLOJ.js +31 -0
  7. package/dist/{chunk-QHSNL7B2.js → chunk-2ZE3AUJQ.js} +12 -14
  8. package/dist/{chunk-MPKRJBPK.js → chunk-35WKJWO5.js} +28 -30
  9. package/dist/chunk-3JAHQBSY.js +27 -0
  10. package/dist/{chunk-4LM3VAZH.js → chunk-3O5EII3W.js} +2 -2
  11. package/dist/chunk-447YZL4S.js +25 -0
  12. package/dist/{chunk-H7OR7DFZ.js → chunk-4B2YFN4U.js} +25 -21
  13. package/dist/{chunk-OSTKYB55.js → chunk-4BKU7PV3.js} +1 -1
  14. package/dist/{chunk-RRV3FNNM.js → chunk-4LL2VRNY.js} +27 -28
  15. package/dist/{chunk-BZARLRJW.js → chunk-4NBWFYWW.js} +9 -9
  16. package/dist/{chunk-KKCK636N.js → chunk-4QG55RRC.js} +12 -12
  17. package/dist/{chunk-RQS4QQSD.js → chunk-4W52ZKZX.js} +2 -2
  18. package/dist/{chunk-Z2XAOKHK.js → chunk-565VRUP4.js} +2 -2
  19. package/dist/{chunk-HWDAVBFU.js → chunk-57X2CDRX.js} +23 -23
  20. package/dist/{chunk-MB6PXBUA.js → chunk-5F3XF3SX.js} +7 -15
  21. package/dist/{chunk-O4BJFESU.js → chunk-5RNB4HVK.js} +1 -1
  22. package/dist/{chunk-ZMAUPOMG.js → chunk-5T5A6YAJ.js} +35 -34
  23. package/dist/{chunk-4ZYJHQMB.js → chunk-6FIRFP6A.js} +12 -12
  24. package/dist/{chunk-4YHYPW2G.js → chunk-6GMGEKQN.js} +9 -5
  25. package/dist/{chunk-4LOE5R5P.js → chunk-6LJOJ6EO.js} +20 -15
  26. package/dist/{chunk-3YY7IXIL.js → chunk-6YUNI7B5.js} +3 -3
  27. package/dist/{chunk-PKES3ISE.js → chunk-7ANZ7XDD.js} +2 -2
  28. package/dist/{chunk-FB5SCCPT.js → chunk-7CGIDRIK.js} +16 -15
  29. package/dist/{chunk-L3CMBQMH.js → chunk-7MAD5ZAY.js} +16 -17
  30. package/dist/{chunk-WDBICWH3.js → chunk-7TNILKGY.js} +1 -1
  31. package/dist/{chunk-RORGS5II.js → chunk-A5GRLYPZ.js} +9 -9
  32. package/dist/{chunk-MNJIXFX4.js → chunk-AGGUWKRK.js} +1 -1
  33. package/dist/{chunk-ABPKUVA4.js → chunk-BBET6HD6.js} +1 -1
  34. package/dist/{chunk-L5JYIU47.js → chunk-BHWW6FAX.js} +14 -13
  35. package/dist/{chunk-URCQWAQ4.js → chunk-BOPDQ7AZ.js} +23 -21
  36. package/dist/{chunk-KDX35VXP.js → chunk-BQG2QFVO.js} +158 -133
  37. package/dist/{chunk-CB4WHS4H.js → chunk-BUZIQDFS.js} +3 -3
  38. package/dist/{chunk-2PHMIAKO.js → chunk-CM73PPGD.js} +4 -4
  39. package/dist/{chunk-DH5JPM3K.js → chunk-CUDD35TW.js} +10 -9
  40. package/dist/{chunk-AWDSEDER.js → chunk-CZL44WFN.js} +2 -2
  41. package/dist/{chunk-N5WSK2K7.js → chunk-DIWK3LBC.js} +12 -15
  42. package/dist/{chunk-24BILSZW.js → chunk-DYRZGUMA.js} +2 -2
  43. package/dist/{chunk-PR6PO3ES.js → chunk-FHEV6T4L.js} +22 -18
  44. package/dist/{chunk-DQZFQSR5.js → chunk-FRLAUP2B.js} +4 -4
  45. package/dist/{chunk-RZOXUSPC.js → chunk-G5GV2Q7K.js} +2 -2
  46. package/dist/{chunk-EKWX4WD3.js → chunk-G6JKM4O7.js} +7 -7
  47. package/dist/chunk-GGYOZWHW.js +27 -0
  48. package/dist/{chunk-XT2HTCJ5.js → chunk-GIRBSBGL.js} +6 -5
  49. package/dist/{chunk-PQJFG24Z.js → chunk-GMROJJRN.js} +1292 -946
  50. package/dist/{chunk-U6VN4NVL.js → chunk-HHR7WGCI.js} +3 -3
  51. package/dist/{chunk-TIQJPRDD.js → chunk-HKIL6DCL.js} +3 -2
  52. package/dist/{chunk-SNDXCFRS.js → chunk-HUAM7QG3.js} +11 -11
  53. package/dist/{chunk-QOE342SU.js → chunk-HXFUTMX2.js} +2 -2
  54. package/dist/{chunk-U7BD2QL7.js → chunk-I22THIHI.js} +12 -12
  55. package/dist/chunk-IE5D3RA5.js +58 -0
  56. package/dist/{chunk-DPGEAHZT.js → chunk-IYVYZQRL.js} +10 -16
  57. package/dist/{chunk-3F6BMY53.js → chunk-JBP7KESM.js} +1 -1
  58. package/dist/{chunk-U5HPROLA.js → chunk-JE6HKLC7.js} +2 -2
  59. package/dist/{chunk-ZE3KXHS7.js → chunk-JPRDTY5S.js} +85 -3
  60. package/dist/{chunk-HO6LWE2E.js → chunk-JYLOYTZD.js} +17 -1
  61. package/dist/{chunk-KW5JQPO5.js → chunk-JZRP4DGP.js} +2 -2
  62. package/dist/{chunk-CPSR3AVL.js → chunk-KZ4ALBCH.js} +2 -2
  63. package/dist/{chunk-6IR3ZYIB.js → chunk-L3CLUGDY.js} +3 -3
  64. package/dist/{chunk-LV4UMYVH.js → chunk-L4NEVZ4T.js} +28 -27
  65. package/dist/chunk-LPYTPNOJ.js +22 -0
  66. package/dist/{chunk-WGRJOXED.js → chunk-LSFXZLPW.js} +1016 -636
  67. package/dist/{chunk-LBLBAFG3.js → chunk-MC6VB2E5.js} +4 -4
  68. package/dist/{chunk-U2SDMG7C.js → chunk-NM2NWH55.js} +5 -5
  69. package/dist/{chunk-T7A2HK2B.js → chunk-NSPVR3FN.js} +19 -18
  70. package/dist/{chunk-ZGSJDWQU.js → chunk-O2ARHQKF.js} +2 -2
  71. package/dist/{chunk-OXOI55RU.js → chunk-O4N5BQ3T.js} +10 -10
  72. package/dist/{chunk-3FRLWYBG.js → chunk-OC7VWJBZ.js} +39 -40
  73. package/dist/chunk-OFNMHPBT.js +89 -0
  74. package/dist/{chunk-HR3OJ3TH.js → chunk-OWTG6UMO.js} +21 -21
  75. package/dist/{chunk-75GAYVNO.js → chunk-OY7WZI7Q.js} +6 -6
  76. package/dist/{chunk-ZJTT47IG.js → chunk-OZWXLJMX.js} +2 -2
  77. package/dist/{chunk-F6X3YJWD.js → chunk-PIQQM32Y.js} +2 -2
  78. package/dist/chunk-PKLB2XJL.js +8 -0
  79. package/dist/{chunk-EAOK7MIZ.js → chunk-PKSUMEPT.js} +17 -4
  80. package/dist/{chunk-YISME6ON.js → chunk-PPKECBPP.js} +1 -1
  81. package/dist/{chunk-4L36HG27.js → chunk-R2QQC33W.js} +14 -14
  82. package/dist/{chunk-LUBPZN36.js → chunk-R4QWJQ2H.js} +11 -11
  83. package/dist/{chunk-V63BC55Q.js → chunk-RGGH6M34.js} +1 -1
  84. package/dist/{chunk-Y7F7IEE3.js → chunk-RZG472YW.js} +65 -7
  85. package/dist/{chunk-PUZ3E2J4.js → chunk-SDFKOLSF.js} +6 -6
  86. package/dist/{chunk-YHC2O2WO.js → chunk-SFLHSL5R.js} +9 -9
  87. package/dist/{chunk-CCV2EU7T.js → chunk-SP4TFY5F.js} +14 -13
  88. package/dist/{chunk-J6JP25XU.js → chunk-SQC7K3SP.js} +4 -3
  89. package/dist/{chunk-3K2F6UDZ.js → chunk-T2S3FNNJ.js} +44 -42
  90. package/dist/{chunk-2TF6RXWB.js → chunk-TV6RXRYH.js} +10 -10
  91. package/dist/{chunk-GNSIWBAT.js → chunk-U3AS2FR6.js} +3 -3
  92. package/dist/{chunk-F7K5IBZG.js → chunk-UHHLR2VY.js} +40 -40
  93. package/dist/chunk-UYXV5NIS.js +20 -0
  94. package/dist/{chunk-VSFLRN5Y.js → chunk-VLQ7UKZH.js} +1 -1
  95. package/dist/{chunk-VUZWQ7UG.js → chunk-VN3L2JWZ.js} +46 -72
  96. package/dist/{chunk-NA7SEXHE.js → chunk-VOP4PJKA.js} +7 -7
  97. package/dist/{chunk-F5Z6URKM.js → chunk-VOXTCULR.js} +2 -2
  98. package/dist/{chunk-LLS45EWB.js → chunk-VPLBLWFO.js} +6 -8
  99. package/dist/chunk-W3BGKBBK.js +27 -0
  100. package/dist/{chunk-ZKXQKGWZ.js → chunk-WC6WRNQT.js} +4 -3
  101. package/dist/{chunk-YVHBNSME.js → chunk-WMDUT4KH.js} +1148 -1132
  102. package/dist/{chunk-KXF5R4UN.js → chunk-WQV6BI4Q.js} +1 -1
  103. package/dist/chunk-WXUDRAG6.js +24 -0
  104. package/dist/{chunk-KPPJTH44.js → chunk-X35S7HSB.js} +28 -10
  105. package/dist/{chunk-JMEKXFOL.js → chunk-X66YJ2SS.js} +40 -34
  106. package/dist/{chunk-CE6VMBCB.js → chunk-XOMGO63G.js} +22 -21
  107. package/dist/{chunk-LS3QJRUB.js → chunk-XWIME22V.js} +13 -13
  108. package/dist/{chunk-R5MOQM2H.js → chunk-XYLC35E4.js} +119 -87
  109. package/dist/{chunk-OE5ZBP7F.js → chunk-YHGYAEFH.js} +18 -18
  110. package/dist/{chunk-7E2563GA.js → chunk-ZFORSIED.js} +13 -13
  111. package/dist/{chunk-E7HJ56Y7.js → chunk-ZKLTNLAW.js} +64 -73
  112. package/dist/chunk-ZONZ6YY3.js +74 -0
  113. package/dist/chunk-ZSM35JF4.js +30 -0
  114. package/dist/{chunk-RC2Z6K47.js → chunk-ZZDIOAAJ.js} +15 -6
  115. package/dist/index.js +6993 -5396
  116. package/dist/mcp/analyze-cli.js +10 -10
  117. package/dist/mcp/cli.js +44 -42
  118. package/dist/mcp/server.js +1627 -504
  119. package/dist/mcp/worker.js +62 -61
  120. package/dist/probes/installer.js +20 -19
  121. package/docs/adr/0003-git-guard-latch-writer.md +11 -6
  122. package/docs/agent-tools.md +18 -8
  123. package/docs/alignment-families.md +29 -0
  124. package/docs/ast-grep_rules_catalog.md +6 -4
  125. package/docs/ci-bot-pr-checks.md +126 -0
  126. package/docs/configuration.md +99 -3
  127. package/docs/defect-shapes.md +55 -12
  128. package/docs/engineering-principles.md +27 -2
  129. package/docs/features.md +2 -2
  130. package/docs/invariants/git-guard-host.md +7 -3
  131. package/docs/invariants/language-config.md +15 -4
  132. package/docs/invariants/lsp-trust-exec.md +16 -2
  133. package/docs/invariants/paths-os.md +4 -2
  134. package/docs/lsp-capability-matrix.md +119 -39
  135. package/docs/merge-queue-rollout.md +1 -1
  136. package/docs/pi-lens-fixer.md +24 -17
  137. package/docs/pi-lens-merge-policy.md +20 -11
  138. package/docs/pi-lens-monitor.md +9 -0
  139. package/docs/pi-lens-orchestration.md +4 -1
  140. package/docs/pi-lens-reviewer.md +5 -5
  141. package/docs/pi-lens-subagent.md +6 -3
  142. package/docs/public-api-stability.md +18 -2
  143. package/docs/schema/pi-lens-config-v1.json +10 -0
  144. package/docs/settings.md +10 -6
  145. package/docs/word-index.md +17 -5
  146. package/package.json +5 -3
  147. package/rules/ast-grep-rules/rule-tests/no-accumulating-spread-js-test.yml +37 -0
  148. package/rules/ast-grep-rules/rule-tests/ts-redundant-filter-map-test.yml +12 -1
  149. package/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-js-test.yml +12 -0
  150. package/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-test.yml +25 -0
  151. package/rules/ast-grep-rules/rules/no-accumulating-spread-js.yml +49 -1
  152. package/rules/ast-grep-rules/rules/ts-redundant-filter-map.yml +9 -1
  153. package/rules/ast-grep-rules/rules-disabled/filter-then-map-js.yml +17 -0
  154. package/rules/ast-grep-rules/rules-disabled/filter-then-map.yml +36 -0
  155. package/rules/ast-grep-rules/self-scan-baseline.json +1 -1
  156. package/dist/chunk-46TNM7XZ.js +0 -88
  157. package/dist/chunk-72OKUXSD.js +0 -31
  158. package/dist/chunk-7GLOLOSH.js +0 -57
  159. package/dist/chunk-AKUUMGD5.js +0 -26
  160. package/dist/chunk-ASUXV767.js +0 -22
  161. package/dist/chunk-CTADOKYM.js +0 -25
  162. package/dist/chunk-JJ2RRESP.js +0 -58
  163. package/dist/chunk-LSC3VADM.js +0 -23
  164. package/dist/chunk-SHLDT3OI.js +0 -27
  165. package/dist/chunk-UF7RTZSO.js +0 -27
  166. package/dist/chunk-W4WP2ERB.js +0 -30
  167. package/dist/chunk-YES5CACN.js +0 -73
@@ -7,7 +7,7 @@ import {
7
7
  normalizeMessage,
8
8
  sanitizeCorrelationId,
9
9
  stableFindingId
10
- } from "./chunk-XT2HTCJ5.js";
10
+ } from "./chunk-GIRBSBGL.js";
11
11
  import {
12
12
  mapWithConcurrency
13
13
  } from "./chunk-XIMYZ3JA.js";
@@ -38,24 +38,24 @@ import {
38
38
  resolveLspServerCwd,
39
39
  serverTraits,
40
40
  withLspProjectCodePermission
41
- } from "./chunk-R5MOQM2H.js";
41
+ } from "./chunk-XYLC35E4.js";
42
42
  import {
43
43
  findLocalOpengrepConfig
44
- } from "./chunk-24BILSZW.js";
44
+ } from "./chunk-DYRZGUMA.js";
45
45
  import {
46
46
  emitBounded
47
- } from "./chunk-PR6PO3ES.js";
47
+ } from "./chunk-FHEV6T4L.js";
48
48
  import {
49
49
  loadProjectSnapshot,
50
50
  readJsonCache
51
- } from "./chunk-RC2Z6K47.js";
51
+ } from "./chunk-ZZDIOAAJ.js";
52
52
  import {
53
53
  acquireWorkspaceSweepHold,
54
54
  configureLspServiceLifecycle,
55
55
  getOwnedLspService,
56
56
  peekOwnedLspService,
57
57
  resetOwnedLspService
58
- } from "./chunk-F5Z6URKM.js";
58
+ } from "./chunk-VOXTCULR.js";
59
59
  import {
60
60
  collectForwardImportMtimes,
61
61
  exceedsLspSyncLimits,
@@ -69,45 +69,46 @@ import {
69
69
  lineTextAt,
70
70
  pathBirthtimeMs,
71
71
  scanDocumentContent
72
- } from "./chunk-MPKRJBPK.js";
72
+ } from "./chunk-35WKJWO5.js";
73
73
  import {
74
74
  js_yaml_default
75
- } from "./chunk-TIQJPRDD.js";
75
+ } from "./chunk-HKIL6DCL.js";
76
76
  import {
77
77
  EXTENSION_TO_LSP_ID,
78
78
  lspLanguageId,
79
79
  resolveFilenameLanguage
80
- } from "./chunk-YISME6ON.js";
80
+ } from "./chunk-PPKECBPP.js";
81
81
  import {
82
82
  HOOK_WALL_BUDGET_MS
83
83
  } from "./chunk-CKEQFGLT.js";
84
84
  import {
85
85
  bounded,
86
+ untilAborted,
86
87
  withDeadline,
87
88
  withTimeout
88
- } from "./chunk-HO6LWE2E.js";
89
+ } from "./chunk-JYLOYTZD.js";
89
90
  import {
90
91
  diagnosticsIpcPathForCwd,
91
92
  requestWarmCodeActions,
92
93
  requestWarmDiagnostics
93
- } from "./chunk-AWDSEDER.js";
94
+ } from "./chunk-CZL44WFN.js";
94
95
  import {
95
96
  CONTENT_HASH_MAX_BYTES,
96
97
  hashContentBytes,
97
98
  hashFileBytes,
98
99
  stampContentBytes
99
- } from "./chunk-LLS45EWB.js";
100
+ } from "./chunk-VPLBLWFO.js";
100
101
  import {
101
102
  findLocalZizmorConfig,
102
103
  logSessionStart
103
- } from "./chunk-KDX35VXP.js";
104
+ } from "./chunk-BQG2QFVO.js";
104
105
  import {
105
106
  findLocalBinUpwards,
106
107
  isProjectLocalBinPath
107
- } from "./chunk-NA7SEXHE.js";
108
+ } from "./chunk-VOP4PJKA.js";
108
109
  import {
109
110
  getLspCapableKinds
110
- } from "./chunk-PUZ3E2J4.js";
111
+ } from "./chunk-SDFKOLSF.js";
111
112
  import {
112
113
  createGenerationMap,
113
114
  createGenerationSource,
@@ -124,35 +125,36 @@ import {
124
125
  releaseOwnChildPid,
125
126
  removeLspChild,
126
127
  sampleProcessTreeCpuPercent,
127
- selectLivePeerInstances
128
- } from "./chunk-YVHBNSME.js";
128
+ selectLivePeerInstances,
129
+ windowsExe
130
+ } from "./chunk-WMDUT4KH.js";
129
131
  import {
130
132
  createSingleFlight
131
133
  } from "./chunk-AWQWXSW4.js";
132
134
  import {
133
135
  SPECIAL_FILENAMES,
134
136
  getLanguageId
135
- } from "./chunk-RZOXUSPC.js";
137
+ } from "./chunk-G5GV2Q7K.js";
136
138
  import {
137
139
  PathKeyedMap,
138
140
  detectFileRole
139
- } from "./chunk-KPPJTH44.js";
141
+ } from "./chunk-X35S7HSB.js";
140
142
  import {
141
143
  assertInstallAllowed,
142
144
  isLspSpawnAllowedByTrust,
143
145
  projectTrustDenialReason,
144
146
  writeFileAtomic
145
- } from "./chunk-U5HPROLA.js";
147
+ } from "./chunk-JE6HKLC7.js";
146
148
  import {
147
149
  compareOrdinal,
148
150
  incrementDegradationCount,
149
151
  recordDegradation,
150
152
  recordDegradationOnce,
151
153
  truncateForLedger
152
- } from "./chunk-WME2OQST.js";
154
+ } from "./chunk-2453RRJ2.js";
153
155
  import {
154
156
  logExtension
155
- } from "./chunk-KXF5R4UN.js";
157
+ } from "./chunk-WQV6BI4Q.js";
156
158
  import {
157
159
  freshnessFromMtime
158
160
  } from "./chunk-S26LC76R.js";
@@ -160,7 +162,7 @@ import {
160
162
  logLatency,
161
163
  phaseFinished,
162
164
  phaseStarted
163
- } from "./chunk-Z2XAOKHK.js";
165
+ } from "./chunk-565VRUP4.js";
164
166
  import {
165
167
  createNdjsonLogger,
166
168
  getGlobalPiLensLogDir,
@@ -168,7 +170,7 @@ import {
168
170
  getProcessSingleton,
169
171
  isTestMode,
170
172
  nextModuleEvaluationOrdinal
171
- } from "./chunk-VSFLRN5Y.js";
173
+ } from "./chunk-VLQ7UKZH.js";
172
174
  import {
173
175
  BoundedFifoMap,
174
176
  BoundedLruCache,
@@ -176,6 +178,7 @@ import {
176
178
  isAtOrAboveHomeDir,
177
179
  isUnderDir,
178
180
  isWindowsPath,
181
+ isWithinForm,
179
182
  kernelPathIdentityAsync,
180
183
  minimatch,
181
184
  normalizeEphemeralMapKey,
@@ -184,11 +187,13 @@ import {
184
187
  pathsEqual,
185
188
  realpathOrResolve,
186
189
  realpathOrResolveAsync,
190
+ relativeInside,
187
191
  toPosix,
188
192
  toProjectRelativePath,
189
193
  uriToDiskPath,
190
- uriToPath
191
- } from "./chunk-PQJFG24Z.js";
194
+ uriToPath,
195
+ walkUpDirs
196
+ } from "./chunk-GMROJJRN.js";
192
197
  import {
193
198
  __commonJS,
194
199
  __require,
@@ -1411,8 +1416,8 @@ var require_semaphore = __commonJS({
1411
1416
  this._waiting = [];
1412
1417
  }
1413
1418
  lock(thunk) {
1414
- return new Promise((resolve8, reject) => {
1415
- this._waiting.push({ thunk, resolve: resolve8, reject });
1419
+ return new Promise((resolve7, reject) => {
1420
+ this._waiting.push({ thunk, resolve: resolve7, reject });
1416
1421
  this.runNext();
1417
1422
  });
1418
1423
  }
@@ -3038,9 +3043,9 @@ ${JSON.stringify(message, null, 4)}`);
3038
3043
  if (typeof cancellationStrategy.sender.enableCancellation === "function") {
3039
3044
  cancellationStrategy.sender.enableCancellation(requestMessage);
3040
3045
  }
3041
- return new Promise(async (resolve8, reject) => {
3046
+ return new Promise(async (resolve7, reject) => {
3042
3047
  const resolveWithCleanup = (r) => {
3043
- resolve8(r);
3048
+ resolve7(r);
3044
3049
  cancellationStrategy.sender.cleanup(id);
3045
3050
  disposable?.dispose();
3046
3051
  };
@@ -3469,10 +3474,10 @@ var require_ril = __commonJS({
3469
3474
  return api_1.Disposable.create(() => this.stream.off("end", listener));
3470
3475
  }
3471
3476
  write(data, encoding) {
3472
- return new Promise((resolve8, reject) => {
3477
+ return new Promise((resolve7, reject) => {
3473
3478
  const callback = (error) => {
3474
3479
  if (error === void 0 || error === null) {
3475
- resolve8();
3480
+ resolve7();
3476
3481
  } else {
3477
3482
  reject(error);
3478
3483
  }
@@ -3764,10 +3769,10 @@ var require_main = __commonJS({
3764
3769
  }
3765
3770
  function createClientPipeTransport(pipeName, encoding = "utf-8") {
3766
3771
  let connectResolve;
3767
- const connected = new Promise((resolve8, _reject) => {
3768
- connectResolve = resolve8;
3772
+ const connected = new Promise((resolve7, _reject) => {
3773
+ connectResolve = resolve7;
3769
3774
  });
3770
- return new Promise((resolve8, reject) => {
3775
+ return new Promise((resolve7, reject) => {
3771
3776
  const server = (0, net_1.createServer)((socket) => {
3772
3777
  server.close();
3773
3778
  connectResolve([
@@ -3778,7 +3783,7 @@ var require_main = __commonJS({
3778
3783
  server.on("error", reject);
3779
3784
  server.listen(pipeName, () => {
3780
3785
  server.removeListener("error", reject);
3781
- resolve8({
3786
+ resolve7({
3782
3787
  onConnected: () => {
3783
3788
  return connected;
3784
3789
  }
@@ -3795,10 +3800,10 @@ var require_main = __commonJS({
3795
3800
  }
3796
3801
  function createClientSocketTransport(port, encoding = "utf-8") {
3797
3802
  let connectResolve;
3798
- const connected = new Promise((resolve8, _reject) => {
3799
- connectResolve = resolve8;
3803
+ const connected = new Promise((resolve7, _reject) => {
3804
+ connectResolve = resolve7;
3800
3805
  });
3801
- return new Promise((resolve8, reject) => {
3806
+ return new Promise((resolve7, reject) => {
3802
3807
  const server = (0, net_1.createServer)((socket) => {
3803
3808
  server.close();
3804
3809
  connectResolve([
@@ -3815,7 +3820,7 @@ var require_main = __commonJS({
3815
3820
  return;
3816
3821
  }
3817
3822
  const boundPort = address.port;
3818
- resolve8({
3823
+ resolve7({
3819
3824
  port: () => boundPort,
3820
3825
  onConnected: () => {
3821
3826
  return connected;
@@ -3967,6 +3972,9 @@ function noteWorkspaceFileCreated(serverId, root, paths, at = Date.now()) {
3967
3972
  function noteWorkspaceFilesChangedOnDisk(root, paths, at = Date.now()) {
3968
3973
  noteWorkspaceFileCreated("", root, paths, at);
3969
3974
  }
3975
+ function noteWorkspaceDependenciesChanged(at = Date.now()) {
3976
+ _allFilesChangedAt = Math.max(_allFilesChangedAt, at);
3977
+ }
3970
3978
  function workspaceFileCreatedAtFor(fromServer, holds, counts = () => true) {
3971
3979
  let latest = _allFilesChangedAt;
3972
3980
  for (const creation of _fileCreations.values()) {
@@ -4034,7 +4042,7 @@ async function importTargetsToAnnounce(cwd, importers, onScope) {
4034
4042
  reason: `resolved the imports of ${CREATED_IMPORT_SCAN_MAX_FILES} of ${importers.length} files in one diagnostics call`
4035
4043
  });
4036
4044
  }
4037
- const { extractForwardImports } = await import("./chunk-URCQWAQ4.js");
4045
+ const { extractForwardImports } = await import("./chunk-BOPDQ7AZ.js");
4038
4046
  const targets = /* @__PURE__ */ new Set();
4039
4047
  const reexports = /* @__PURE__ */ new Map();
4040
4048
  let resolved2 = 0;
@@ -4349,10 +4357,10 @@ function isRuleIgnoredForPath(filePath, root, patterns) {
4349
4357
  if (!patterns || patterns.length === 0)
4350
4358
  return false;
4351
4359
  const pathApi = isWindowsPath(root) || isWindowsPath(filePath) ? path3.win32 : path3.posix;
4352
- const relative3 = pathApi.relative(root, filePath);
4353
- const outsideRoot = relative3 !== "" && (relative3 === ".." || relative3.startsWith(`..${pathApi.sep}`) || pathApi.isAbsolute(relative3));
4354
- const displayPath = toPosix(outsideRoot ? filePath : relative3);
4355
- return patterns.some((pattern) => (!outsideRoot || !pattern.replaceAll("\\", "/").endsWith("/**")) && minimatch(displayPath, pattern, { dot: true }));
4360
+ const relative2 = relativeInside(root, filePath, pathApi);
4361
+ const outsideRoot = relative2 === void 0;
4362
+ const displayPath = toPosix(outsideRoot ? filePath : relative2);
4363
+ return patterns.some((pattern) => (!outsideRoot || !toPosix(pattern).endsWith("/**")) && minimatch(displayPath, pattern, { dot: true }));
4356
4364
  }
4357
4365
  function loadRuleIgnorePatterns(root) {
4358
4366
  const patterns = /* @__PURE__ */ new Map();
@@ -8273,6 +8281,17 @@ function composeBoundToCurrentDisk(values) {
8273
8281
  }
8274
8282
  return true;
8275
8283
  }
8284
+ function warmAnswerBinding(answer) {
8285
+ const wire = answer.binding;
8286
+ const fields = typeof wire === "object" && wire !== null ? wire : {};
8287
+ const verdict = fields.boundToCurrentDisk;
8288
+ return {
8289
+ ...typeof fields.contentHash === "string" && {
8290
+ contentHash: fields.contentHash
8291
+ },
8292
+ boundToCurrentDisk: verdict === true || verdict === false || verdict === "unknown" ? verdict : false
8293
+ };
8294
+ }
8276
8295
  function bindingStateLabel(value) {
8277
8296
  if (value === true)
8278
8297
  return "bound";
@@ -8280,6 +8299,9 @@ function bindingStateLabel(value) {
8280
8299
  return "mismatch";
8281
8300
  return "unknown";
8282
8301
  }
8302
+ function readBoundToCurrentDisk(rawDiags) {
8303
+ return rawDiags?.binding?.boundToCurrentDisk;
8304
+ }
8283
8305
  var DISK_BINDING_MEMO_MAX = 4096;
8284
8306
  function createDiskBindingCache() {
8285
8307
  const diskHashByPath = new PathKeyedMap(normalizeEphemeralMapKey);
@@ -8501,7 +8523,7 @@ function resyncDocumentOnPastEof(filePath) {
8501
8523
  void (async () => {
8502
8524
  try {
8503
8525
  const [{ getOwnedLspService: getOwnedLspService2 }, content] = await Promise.all([
8504
- import("./chunk-2PHMIAKO.js"),
8526
+ import("./chunk-CM73PPGD.js"),
8505
8527
  fs7.promises.readFile(filePath, "utf-8")
8506
8528
  ]);
8507
8529
  await getOwnedLspService2().openFile(filePath, content, { preserveDiagnostics: false });
@@ -9480,14 +9502,14 @@ async function raceToCompletion(promises3, shouldComplete, options = { timeoutMs
9480
9502
  const languageCount = promises3.length - auxIndices.size;
9481
9503
  let languageRemaining = languageCount;
9482
9504
  let auxGraceStarted = false;
9483
- return new Promise((resolve8) => {
9505
+ return new Promise((resolve7) => {
9484
9506
  const timeout = setTimeout(() => {
9485
9507
  completed = true;
9486
9508
  if (graceTimer)
9487
9509
  clearTimeout(graceTimer);
9488
9510
  if (auxGraceTimer)
9489
9511
  clearTimeout(auxGraceTimer);
9490
- resolve8(results.filter((r) => r !== void 0));
9512
+ resolve7(results.filter((r) => r !== void 0));
9491
9513
  }, options.timeoutMs);
9492
9514
  const finalize = () => {
9493
9515
  if (completed)
@@ -9498,7 +9520,7 @@ async function raceToCompletion(promises3, shouldComplete, options = { timeoutMs
9498
9520
  clearTimeout(graceTimer);
9499
9521
  if (auxGraceTimer)
9500
9522
  clearTimeout(auxGraceTimer);
9501
- resolve8(results.filter((r) => r !== void 0));
9523
+ resolve7(results.filter((r) => r !== void 0));
9502
9524
  };
9503
9525
  const startAuxGrace = () => {
9504
9526
  if (auxGraceStarted || completed)
@@ -10154,7 +10176,7 @@ function planWorkspaceEdit(edit, trackOrigins = false) {
10154
10176
  }
10155
10177
  function relativeToCwd(filePath, cwd) {
10156
10178
  const rel = path10.relative(cwd, filePath) || path10.basename(filePath);
10157
- return rel.replace(/\\/g, "/");
10179
+ return toPosix(rel);
10158
10180
  }
10159
10181
  var IMPORT_RELEVANT_LINE = /^\s*import\b|^\s*export\s[^;]*\bfrom\s|\bfrom\s+['"]/;
10160
10182
  function importsSignature(text) {
@@ -10205,19 +10227,17 @@ async function isSameFsEntry(a, b) {
10205
10227
  return Boolean(statA && statB && isSameFsIdentity(statA, statB));
10206
10228
  }
10207
10229
  async function assertParentIsUsable(filePath, stateFor) {
10208
- let current = path10.dirname(filePath);
10209
- while (true) {
10230
+ for (const current of walkUpDirs(path10.dirname(filePath), {
10231
+ spelling: true
10232
+ })) {
10210
10233
  const known = await stateFor(current);
10211
10234
  if (known.exists) {
10212
10235
  if (!known.directory)
10213
10236
  throw new Error(`resource parent is not a directory: ${current}`);
10214
10237
  return;
10215
10238
  }
10216
- const parent = path10.dirname(current);
10217
- if (parent === current)
10218
- throw new Error(`resource parent does not exist: ${filePath}`);
10219
- current = parent;
10220
10239
  }
10240
+ throw new Error(`resource parent does not exist: ${filePath}`);
10221
10241
  }
10222
10242
  async function requireKernelIdentity(filePath, subject) {
10223
10243
  const identity = await kernelPathIdentityAsync(filePath);
@@ -10369,7 +10389,7 @@ async function preflightWorkspaceEdit(planned, cwd, options) {
10369
10389
  const newPath = await confine(op.newUri);
10370
10390
  const oldDisk = uriToDiskPath(op.oldUri);
10371
10391
  const newDisk = uriToDiskPath(op.newUri);
10372
- if (path10.resolve(oldDisk).replace(/\\/g, "/") === path10.resolve(newDisk).replace(/\\/g, "/")) {
10392
+ if (toPosix(path10.resolve(oldDisk)) === toPosix(path10.resolve(newDisk))) {
10373
10393
  throw new Error("rename source and destination must differ");
10374
10394
  }
10375
10395
  const source = await stateFor(oldPath);
@@ -10956,21 +10976,14 @@ function clearWorkspaceDiagnosticsCacheAtAndAbove(cwd, ceiling = process.cwd())
10956
10976
  const root = path12.resolve(cwd);
10957
10977
  const workspaceRoot = path12.resolve(ceiling);
10958
10978
  clearWorkspaceDiagnosticsCache(root);
10959
- const relative3 = path12.relative(workspaceRoot, root);
10960
- if (relative3.startsWith(".." + path12.sep) || relative3 === ".." || path12.isAbsolute(relative3)) {
10979
+ if (relativeInside(workspaceRoot, root) === void 0)
10961
10980
  return;
10962
- }
10963
10981
  if (normalizeMapKey(root) === normalizeMapKey(workspaceRoot))
10964
10982
  return;
10965
- let ancestor = path12.dirname(root);
10966
- while (true) {
10983
+ for (const ancestor of walkUpDirs(path12.dirname(root), { spelling: true })) {
10967
10984
  clearWorkspaceDiagnosticsCache(ancestor);
10968
10985
  if (normalizeMapKey(ancestor) === normalizeMapKey(workspaceRoot))
10969
10986
  return;
10970
- const parent = path12.dirname(ancestor);
10971
- if (parent === ancestor)
10972
- return;
10973
- ancestor = parent;
10974
10987
  }
10975
10988
  }
10976
10989
  var _cacheEpochs = createGenerationMap("workspace-diagnostics-cache", {
@@ -11494,7 +11507,7 @@ async function killProcessTree(proc, pid, options = {}) {
11494
11507
  return;
11495
11508
  }
11496
11509
  try {
11497
- const taskkill = `${process.env.SystemRoot ?? "C:\\Windows"}\\System32\\taskkill.exe`;
11510
+ const taskkill = windowsExe("taskkill.exe");
11498
11511
  const killer = nodeSpawn(taskkill, ["/F", "/T", "/PID", String(pid)], {
11499
11512
  shell: false,
11500
11513
  windowsHide: true,
@@ -11506,8 +11519,8 @@ async function killProcessTree(proc, pid, options = {}) {
11506
11519
  proc.unref?.();
11507
11520
  return;
11508
11521
  }
11509
- await new Promise((resolve8) => {
11510
- killer.once("close", () => resolve8());
11522
+ await new Promise((resolve7) => {
11523
+ killer.once("close", () => resolve7());
11511
11524
  killer.once("error", (err) => {
11512
11525
  logLatency({
11513
11526
  type: "phase",
@@ -11516,7 +11529,7 @@ async function killProcessTree(proc, pid, options = {}) {
11516
11529
  durationMs: 0,
11517
11530
  metadata: { pid, platform: "win32", taskkillError: String(err) }
11518
11531
  });
11519
- resolve8();
11532
+ resolve7();
11520
11533
  });
11521
11534
  });
11522
11535
  } catch (err) {
@@ -11574,18 +11587,18 @@ async function killProcessTree(proc, pid, options = {}) {
11574
11587
  proc.unref?.();
11575
11588
  return;
11576
11589
  }
11577
- const exitedInTime = await new Promise((resolve8) => {
11590
+ const exitedInTime = await new Promise((resolve7) => {
11578
11591
  if (proc.exitCode != null || proc.signalCode != null) {
11579
- resolve8(true);
11592
+ resolve7(true);
11580
11593
  return;
11581
11594
  }
11582
11595
  const onExit = () => {
11583
11596
  clearTimeout(timer);
11584
- resolve8(true);
11597
+ resolve7(true);
11585
11598
  };
11586
11599
  const timer = setTimeout(() => {
11587
11600
  proc.off?.("exit", onExit);
11588
- resolve8(false);
11601
+ resolve7(false);
11589
11602
  }, 1500);
11590
11603
  proc.once?.("exit", onExit);
11591
11604
  });
@@ -11775,7 +11788,49 @@ function publicationCountsForPath(state4, normalizedPath) {
11775
11788
  function diagnosticsVersionForPath(state4, normalizedPath) {
11776
11789
  return state4.diagnosticsVersionsByPath?.get(normalizedPath) ?? 0;
11777
11790
  }
11791
+ function diagnosticsPublishedAtForPath(state4, normalizedPath) {
11792
+ const ts = Math.max(state4.pushDiagnosticTimestamps?.get(normalizedPath) ?? 0, state4.documentPullDiagnosticTimestamps?.get(normalizedPath) ?? 0);
11793
+ return ts > 0 ? ts : void 0;
11794
+ }
11778
11795
  var PENDING_RECEIPT_DROPPED = "pending-receipt-dropped";
11796
+ function noteOwnNoticeQueued(state4, normalizedPath, uri, sentVersion) {
11797
+ (state4.ownNoticeEchoes ??= /* @__PURE__ */ new Map()).set(normalizedPath, {
11798
+ uri,
11799
+ sentVersion,
11800
+ flushed: false,
11801
+ sawNonEmpty: false
11802
+ });
11803
+ }
11804
+ function noteOwnNoticeFlushed(state4, changes) {
11805
+ const echoes = state4.ownNoticeEchoes;
11806
+ if (!echoes)
11807
+ return;
11808
+ for (const [normalizedPath, echo] of echoes) {
11809
+ if (!echo.flushed && changes.length === 1 && changes[0]?.uri === echo.uri)
11810
+ echo.flushed = true;
11811
+ else
11812
+ echoes.delete(normalizedPath);
11813
+ }
11814
+ }
11815
+ function holdEmptyEchoOfOwnNotice(state4, normalizedPath, diagnosticCount, docVersion) {
11816
+ const echo = state4.ownNoticeEchoes?.get(normalizedPath);
11817
+ if (!echo || docVersion !== void 0 || echo.sentVersion !== state4.documentVersions.get(normalizedPath))
11818
+ return false;
11819
+ if (diagnosticCount > 0) {
11820
+ echo.sawNonEmpty = true;
11821
+ return false;
11822
+ }
11823
+ if (!echo.flushed || !echo.sawNonEmpty)
11824
+ return false;
11825
+ state4.ownNoticeEchoes?.delete(normalizedPath);
11826
+ countPublication(state4, normalizedPath);
11827
+ incrementDegradationCount({
11828
+ kind: "lsp-watched-echo-held",
11829
+ subject: state4.serverId,
11830
+ reason: "an empty version-less publish followed the client's own watched-files notice for a document the server had already reported on"
11831
+ });
11832
+ return true;
11833
+ }
11779
11834
  function clearDiagnosticsForPath(state4, normalizedPath) {
11780
11835
  const legacy = state4;
11781
11836
  state4.pushDiagnostics?.delete(normalizedPath);
@@ -11790,6 +11845,7 @@ function clearDiagnosticsForPath(state4, normalizedPath) {
11790
11845
  state4.documentPullDiagnosticTimestamps?.delete(normalizedPath);
11791
11846
  state4.diagnosticDocVersions?.delete(normalizedPath);
11792
11847
  state4.nonEmptyAnswerPhases?.delete(normalizedPath);
11848
+ state4.ownNoticeEchoes?.delete(normalizedPath);
11793
11849
  state4.diagnosticBindings?.delete(normalizedPath);
11794
11850
  state4.diagnosticsVersionsByPath?.delete(normalizedPath);
11795
11851
  for (const key of pullSourceKeysForPath(state4, normalizedPath)) {
@@ -12149,6 +12205,9 @@ function setupIncomingHandlers(state4, initialization, onDiagnosticsPublished) {
12149
12205
  }
12150
12206
  return;
12151
12207
  }
12208
+ if (holdEmptyEchoOfOwnNotice(state4, normalizedPath, newDiags.length, docVersion)) {
12209
+ return;
12210
+ }
12152
12211
  if (PUB_DEBUG) {
12153
12212
  logExtension({
12154
12213
  subsystem: "lsp-pub",
@@ -12858,7 +12917,7 @@ async function clientWaitForDiagnostics(state4, filePath, timeoutMs, options = {
12858
12917
  const retryBudgetMs = strategy.pullRetryBudgetMs > 0 ? Math.min(timeoutMs, strategy.pullRetryBudgetMs) : 0;
12859
12918
  const startedAt = Date.now();
12860
12919
  while (outcome.status !== "found" && Date.now() - startedAt < retryBudgetMs) {
12861
- await new Promise((resolve8) => setTimeout(resolve8, PULL_DIAGNOSTICS_RETRY_INTERVAL_MS));
12920
+ await new Promise((resolve7) => setTimeout(resolve7, PULL_DIAGNOSTICS_RETRY_INTERVAL_MS));
12862
12921
  outcome = await clientRequestPullDiagnostics(state4, filePath, Math.max(0, retryBudgetMs - (Date.now() - startedAt)));
12863
12922
  if (outcome.status === "clean")
12864
12923
  sawClean = true;
@@ -12880,7 +12939,7 @@ async function clientWaitForDiagnostics(state4, filePath, timeoutMs, options = {
12880
12939
  return;
12881
12940
  }
12882
12941
  const answerStored = () => hasFreshDiagnostics() && !isVersionStale() && (state4.pushDiagnostics.has(normalizedPath) || state4.documentPullDiagnostics.has(normalizedPath));
12883
- return new Promise((resolve8) => {
12942
+ return new Promise((resolve7) => {
12884
12943
  let debounceTimer;
12885
12944
  let settleDeferred = storedAnswerSettles();
12886
12945
  const finish = () => {
@@ -12889,7 +12948,7 @@ async function clientWaitForDiagnostics(state4, filePath, timeoutMs, options = {
12889
12948
  state4.diagnosticEmitter.off("diagnostics", onDiagnostics);
12890
12949
  state4.diagnosticEmitter.off(PENDING_RECEIPT_DROPPED, onReceiptDropped);
12891
12950
  clearTimeout(timeout);
12892
- resolve8();
12951
+ resolve7();
12893
12952
  };
12894
12953
  const onDiagnostics = (fp) => {
12895
12954
  if (normalizeMapKey(fp) !== normalizedPath)
@@ -13097,6 +13156,8 @@ async function handleNotifyOpenOnce(state4, filePath, content, languageId, prese
13097
13156
  });
13098
13157
  }
13099
13158
  enqueueWatchedChange(state4, normalizedPath, uri, watchedType, onDisk);
13159
+ if (state4.customServer)
13160
+ noteOwnNoticeQueued(state4, normalizedPath, uri, 0);
13100
13161
  }
13101
13162
  if (!isClientAlive(state4))
13102
13163
  return false;
@@ -13128,9 +13189,9 @@ function enqueueDocumentNotify(state4, normalizedPath, run, saved = false, readS
13128
13189
  queue = { running: false, active: void 0 };
13129
13190
  state4.notifyChangeQueues.set(normalizedPath, queue);
13130
13191
  }
13131
- return new Promise((resolve8, reject) => {
13192
+ return new Promise((resolve7, reject) => {
13132
13193
  if (queue.closing && !close) {
13133
- resolve8(false);
13194
+ resolve7(false);
13134
13195
  return;
13135
13196
  }
13136
13197
  const previous = queue?.pending;
@@ -13144,7 +13205,7 @@ function enqueueDocumentNotify(state4, normalizedPath, run, saved = false, readS
13144
13205
  const before = (a, b) => a !== void 0 && b !== void 0 && a < b;
13145
13206
  const stale = previous !== void 0 && (saveOnly || before(readStamp, previous.readStamp) || before(readStamp, lastSent));
13146
13207
  const heldStamp = before(previous?.readStamp, lastSent) ? void 0 : previous?.readStamp;
13147
- waiters.push({ resolve: resolve8, reject, stale });
13208
+ waiters.push({ resolve: resolve7, reject, stale });
13148
13209
  queue.pending = {
13149
13210
  run: stale ? previous.run : run,
13150
13211
  saveOnly: stale ? previous.saveOnly : saveOnly,
@@ -13722,7 +13783,7 @@ function hasNotifyInFlightFor(state4, filePath) {
13722
13783
  }
13723
13784
  async function createLSPClient(options) {
13724
13785
  installCrashGuard();
13725
- const { serverId, process: lspProcess, root, sessionCwd, initialization, initializeTimeoutMs = INITIALIZE_TIMEOUT_MS, launchVariant, settingsSection, role, onDiagnosticsPublished } = options;
13786
+ const { serverId, process: lspProcess, root, sessionCwd, initialization, initializeTimeoutMs = INITIALIZE_TIMEOUT_MS, launchVariant, settingsSection, role, custom, onDiagnosticsPublished } = options;
13726
13787
  void recordLspChild({
13727
13788
  pid: lspProcess.pid,
13728
13789
  serverId,
@@ -13835,6 +13896,8 @@ async function createLSPClient(options) {
13835
13896
  // #4764: the declared role, so a config-load failure gates only an
13836
13897
  // auxiliary scanner's empty publications.
13837
13898
  ...role !== void 0 && { serverRole: role },
13899
+ // #5131 round 2: the echo hold reads a config-declared server only.
13900
+ customServer: custom === true,
13838
13901
  // #3310: one-shot, per client session.
13839
13902
  emptyFirstPublishHoldSpent: false,
13840
13903
  rulesGeneration: 0,
@@ -13870,6 +13933,7 @@ async function createLSPClient(options) {
13870
13933
  (changes) => {
13871
13934
  if (!isClientAlive(state4))
13872
13935
  return;
13936
+ noteOwnNoticeFlushed(state4, changes);
13873
13937
  void safeSendNotification(state4.connection, "workspace/didChangeWatchedFiles", { changes });
13874
13938
  },
13875
13939
  void 0,
@@ -14026,6 +14090,9 @@ async function createLSPClient(options) {
14026
14090
  getDiagnosticsVersionForPath(filePath) {
14027
14091
  return diagnosticsVersionForPath(state4, normalizeMapKey(filePath));
14028
14092
  },
14093
+ getDiagnosticsPublishedAt(filePath) {
14094
+ return diagnosticsPublishedAtForPath(state4, normalizeMapKey(filePath));
14095
+ },
14029
14096
  getPublicationCountsForPath(filePath) {
14030
14097
  return publicationCountsForPath(state4, normalizeMapKey(filePath));
14031
14098
  },
@@ -14038,7 +14105,7 @@ async function createLSPClient(options) {
14038
14105
  for (const key of keys) {
14039
14106
  result.set(key, {
14040
14107
  diags: getMergedDiagnosticsForPath(state4, key),
14041
- ts: Math.max(state4.pushDiagnosticTimestamps.get(key) ?? 0, state4.documentPullDiagnosticTimestamps.get(key) ?? 0),
14108
+ ts: diagnosticsPublishedAtForPath(state4, key) ?? 0,
14042
14109
  binding: state4.diagnosticBindings.get(key)
14043
14110
  });
14044
14111
  }
@@ -14060,7 +14127,7 @@ async function createLSPClient(options) {
14060
14127
  ]);
14061
14128
  for (const key of keys) {
14062
14129
  const diags = getMergedDiagnosticsForPath(state4, key);
14063
- const ts = Math.max(state4.pushDiagnosticTimestamps.get(key) ?? 0, state4.documentPullDiagnosticTimestamps.get(key) ?? 0);
14130
+ const ts = diagnosticsPublishedAtForPath(state4, key) ?? 0;
14064
14131
  if (!predicate(key, ts, diags))
14065
14132
  continue;
14066
14133
  clearDiagnosticsForPath(state4, key);
@@ -14376,8 +14443,8 @@ async function safeSendRequest(connection, method, params, signal, settlement, r
14376
14443
  if (signal) {
14377
14444
  tokenSource = new import_node.CancellationTokenSource();
14378
14445
  if (releaseOnAbort) {
14379
- released = new Promise((resolve8) => {
14380
- release = () => resolve8(RELEASED_ON_ABORT);
14446
+ released = new Promise((resolve7) => {
14447
+ release = () => resolve7(RELEASED_ON_ABORT);
14381
14448
  });
14382
14449
  }
14383
14450
  onAbort = () => {
@@ -14601,7 +14668,7 @@ function fileOperationUriCandidates(uri) {
14601
14668
  return [];
14602
14669
  let uriPath;
14603
14670
  try {
14604
- uriPath = decodeURIComponent(parsed.pathname).replace(/\\/g, "/");
14671
+ uriPath = toPosix(decodeURIComponent(parsed.pathname));
14605
14672
  } catch {
14606
14673
  return [];
14607
14674
  }
@@ -14712,8 +14779,6 @@ var ClientRegistry = class {
14712
14779
  hooks;
14713
14780
  sessionCwd;
14714
14781
  workspaceProbeLogged = /* @__PURE__ */ new Set();
14715
- /** Per-service immutable root-boundary verdicts; root detectors cache hits too. */
14716
- projectBoundaryCache = /* @__PURE__ */ new Map();
14717
14782
  /** Foreign roots are recorded once per normalized root for this service/session. */
14718
14783
  warmStartLogged = /* @__PURE__ */ new Set();
14719
14784
  optionalFailureLogged = /* @__PURE__ */ new Set();
@@ -14913,32 +14978,23 @@ var ClientRegistry = class {
14913
14978
  if (!key.startsWith(prefix))
14914
14979
  continue;
14915
14980
  const ancestorKey = key.slice(prefix.length);
14916
- const pathApi = isWindowsPath(ancestorKey) || isWindowsPath(rootKey) ? path13.win32 : path13;
14917
- const relative3 = pathApi.relative(ancestorKey, rootKey);
14918
- if (relative3 === "" || relative3.startsWith("..") || pathApi.isAbsolute(relative3)) {
14981
+ if (ancestorKey === rootKey || !isWithinForm(rootKey, ancestorKey))
14919
14982
  continue;
14920
- }
14921
14983
  if (!nearestAncestor || ancestorKey.length > nearestAncestor.length) {
14922
14984
  nearestAncestor = ancestorKey;
14923
14985
  }
14924
14986
  }
14925
14987
  if (!nearestAncestor)
14926
14988
  return root;
14927
- const boundaryKey = `${server.id}:${rootKey}`;
14928
- let boundary = this.projectBoundaryCache.get(boundaryKey);
14929
- if (!boundary) {
14930
- boundary = hasProjectBoundaryMarker(root, server);
14931
- this.projectBoundaryCache.set(boundaryKey, boundary);
14932
- }
14933
- if (await boundary)
14989
+ if (await hasProjectBoundaryMarker(root, server))
14934
14990
  return root;
14935
14991
  return this.clients.get(`${server.id}:${nearestAncestor}`)?.root ?? nearestAncestor;
14936
14992
  }
14937
14993
  async withClientSpawnGate(operation) {
14938
14994
  const previous = this.clientSpawnGate;
14939
14995
  let release;
14940
- this.clientSpawnGate = new Promise((resolve8) => {
14941
- release = resolve8;
14996
+ this.clientSpawnGate = new Promise((resolve7) => {
14997
+ release = resolve7;
14942
14998
  });
14943
14999
  await previous;
14944
15000
  try {
@@ -15489,6 +15545,8 @@ var ClientRegistry = class {
15489
15545
  // #4764: the declared role travels with the client, so a failed server
15490
15546
  // config can gate an auxiliary scanner's empty publications only.
15491
15547
  role: server.role,
15548
+ // #5131 round 2: the config-declared flag gates the echo hold.
15549
+ custom: server.custom,
15492
15550
  onDiagnosticsPublished: (serverId) => {
15493
15551
  this.hooks.noteDiagnosticsPublished(serverId);
15494
15552
  }
@@ -15858,8 +15916,9 @@ function admitPackageName(names, name) {
15858
15916
  }
15859
15917
  function declaredPackageNames(startDir) {
15860
15918
  const names = /* @__PURE__ */ new Set();
15861
- let dir = path15.resolve(startDir);
15862
- for (let level = 0; level < ENV_NODE_MODULES_WALK_MAX_LEVELS; level++) {
15919
+ for (const dir of walkUpDirs(startDir, {
15920
+ maxDepth: ENV_NODE_MODULES_WALK_MAX_LEVELS
15921
+ })) {
15863
15922
  try {
15864
15923
  const manifest = JSON.parse(fs12.readFileSync(path15.join(dir, "package.json"), "utf8"));
15865
15924
  for (const field of DECLARING_FIELDS) {
@@ -15878,10 +15937,6 @@ function declaredPackageNames(startDir) {
15878
15937
  }
15879
15938
  } catch {
15880
15939
  }
15881
- const parent = path15.dirname(dir);
15882
- if (parent === dir)
15883
- break;
15884
- dir = parent;
15885
15940
  }
15886
15941
  return names;
15887
15942
  }
@@ -15907,8 +15962,11 @@ function environmentGapKind(diagnostic) {
15907
15962
  return name !== void 0 && NODE_GLOBALS.has(name) ? { code } : void 0;
15908
15963
  }
15909
15964
  function hasResolvableNodeModules(startDir, stat3 = (candidate) => fs12.statSync(candidate)) {
15910
- let dir = path15.resolve(startDir);
15911
- for (let level = 0; level < ENV_NODE_MODULES_WALK_MAX_LEVELS; level++) {
15965
+ let last;
15966
+ for (const dir of walkUpDirs(startDir, {
15967
+ maxDepth: ENV_NODE_MODULES_WALK_MAX_LEVELS
15968
+ })) {
15969
+ last = dir;
15912
15970
  try {
15913
15971
  stat3(path15.join(dir, "node_modules"));
15914
15972
  return true;
@@ -15917,12 +15975,8 @@ function hasResolvableNodeModules(startDir, stat3 = (candidate) => fs12.statSync
15917
15975
  return true;
15918
15976
  }
15919
15977
  }
15920
- const parent = path15.dirname(dir);
15921
- if (parent === dir)
15922
- return false;
15923
- dir = parent;
15924
15978
  }
15925
- return true;
15979
+ return last === void 0 || path15.dirname(last) !== last;
15926
15980
  }
15927
15981
  function demoteEnvironmentGapDiagnostics(diagnostics, options) {
15928
15982
  const candidates = /* @__PURE__ */ new Map();
@@ -15933,7 +15987,7 @@ function demoteEnvironmentGapDiagnostics(diagnostics, options) {
15933
15987
  }
15934
15988
  if (candidates.size === 0)
15935
15989
  return diagnostics;
15936
- const startDir = options.startDir ?? path15.dirname(options.filePath);
15990
+ const startDir = options.startDir ?? path15.dirname(realpathOrResolve(options.filePath));
15937
15991
  if (hasResolvableNodeModules(startDir, options.stat))
15938
15992
  return diagnostics;
15939
15993
  let declared;
@@ -16000,13 +16054,13 @@ function isTsProjectFile(filePath) {
16000
16054
  return TS_PROJECT_EXTENSIONS.has(path16.extname(filePath).toLowerCase());
16001
16055
  }
16002
16056
  function suggestTsconfigInclude(filePath, cwd) {
16003
- const relative3 = toProjectRelativePath(filePath, cwd);
16004
- if (path16.posix.isAbsolute(relative3) || /^[A-Za-z]:/.test(relative3)) {
16005
- const dir = relative3.slice(0, relative3.lastIndexOf("/"));
16006
- return dir ? `${dir}/**` : relative3;
16057
+ const relative2 = toProjectRelativePath(filePath, cwd);
16058
+ if (path16.posix.isAbsolute(relative2) || /^[A-Za-z]:/.test(relative2)) {
16059
+ const dir = relative2.slice(0, relative2.lastIndexOf("/"));
16060
+ return dir ? `${dir}/**` : relative2;
16007
16061
  }
16008
- const segments = relative3.split("/").filter(Boolean);
16009
- return segments.length > 1 ? `${segments[0]}/**` : relative3;
16062
+ const segments = relative2.split("/").filter(Boolean);
16063
+ return segments.length > 1 ? `${segments[0]}/**` : relative2;
16010
16064
  }
16011
16065
  function inferredProjectNotice(filePath, cwd) {
16012
16066
  return `[${INFERRED_PROJECT_MARKER}; add ${suggestTsconfigInclude(filePath, cwd)} to a tsconfig for authoritative checking]`;
@@ -16138,7 +16192,7 @@ function createLazyImport(load) {
16138
16192
  }
16139
16193
 
16140
16194
  // dist/clients/lsp-lazy.js
16141
- var lazyLsp = createLazyImport(() => import("./chunk-YES5CACN.js"));
16195
+ var lazyLsp = createLazyImport(() => import("./chunk-ZONZ6YY3.js"));
16142
16196
  function warmLspService() {
16143
16197
  return lazyLsp.get();
16144
16198
  }
@@ -16321,12 +16375,23 @@ var DIAGNOSTICS_SEMANTIC_SETTLE_THRESHOLD_MS = Math.max(0, Number.parseInt(proce
16321
16375
  var DIAGNOSTICS_SEMANTIC_SETTLE_WAIT_MS = Math.max(0, Number.parseInt(process.env.PI_LENS_LSP_DIAGNOSTICS_SEMANTIC_SETTLE_MS ?? "400", 10) || 400);
16322
16376
  var EARLY_UNBLOCK_GRACE_MS = Math.max(0, Number.parseInt(process.env.PI_LENS_LSP_EARLY_UNBLOCK_GRACE_MS ?? "400", 10) || 400);
16323
16377
  function unansweredPrimaries(spawned, resolvedPrimaryRoots, filePath) {
16324
- if (spawned.some((entry) => !isAuxiliary(entry.info)))
16325
- return { serverIds: [], disabledServerIds: [], cause: "unstarted" };
16326
16378
  const { disabledServerIds, fallbackServerIds } = disabledPrimaries(filePath);
16327
- const serverIds = [
16328
- .../* @__PURE__ */ new Set([...resolvedPrimaryRoots.keys(), ...disabledServerIds])
16329
- ];
16379
+ const standIns = new Set(fallbackServerIds);
16380
+ const acquired = /* @__PURE__ */ new Set();
16381
+ for (const entry of spawned) {
16382
+ if (isAuxiliary(entry.info))
16383
+ continue;
16384
+ if (entry.info.fallbackFor === void 0 || standIns.has(entry.info.id))
16385
+ return { serverIds: [], disabledServerIds: [], cause: "unstarted" };
16386
+ acquired.add(entry.info.id);
16387
+ }
16388
+ const missing = /* @__PURE__ */ new Set();
16389
+ for (const id of resolvedPrimaryRoots.keys())
16390
+ if (!acquired.has(id))
16391
+ missing.add(id);
16392
+ for (const id of disabledServerIds)
16393
+ missing.add(id);
16394
+ const serverIds = [...missing];
16330
16395
  return {
16331
16396
  serverIds,
16332
16397
  disabledServerIds,
@@ -16470,7 +16535,7 @@ var LSPService = class _LSPService {
16470
16535
  /**
16471
16536
  * One first-contact diagnostic wait per custom server in this service
16472
16537
  * generation. Concurrent touches share the probe; a hook cutoff never arms
16473
- * the navigation-only latch, so the next touch can try again.
16538
+ * the diagnostics-unsupported latch, so the next touch can try again.
16474
16539
  */
16475
16540
  firstContactWaits = /* @__PURE__ */ new Map();
16476
16541
  /** Session-scoped adaptive demotion for budget-hitting auxiliaries. */
@@ -16649,6 +16714,7 @@ var LSPService = class _LSPService {
16649
16714
  },
16650
16715
  noteDiagnosticsPublished: (serverId) => {
16651
16716
  this.state.diagnosticsPublished.add(serverId);
16717
+ this.state.diagnosticsUnsupported.delete(serverId);
16652
16718
  }
16653
16719
  }, generationHandoff, sessionCwd);
16654
16720
  this.state = {
@@ -16663,6 +16729,25 @@ var LSPService = class _LSPService {
16663
16729
  diagnosticsUnsupported: /* @__PURE__ */ new Set()
16664
16730
  };
16665
16731
  }
16732
+ /**
16733
+ * Latch a custom push-only server diagnostics-unsupported after silence
16734
+ * through its first-contact wait. The one writer of the latch, so `published`
16735
+ * implies `!unsupported` holds at the add as well as at the publish (#5128):
16736
+ * a publish for another file that landed during this file's wait proves the
16737
+ * server pushes, so the silence is a timeout and no latch is set. Returns
16738
+ * whether the server is now latched.
16739
+ */
16740
+ latchDiagnosticsUnsupported(serverId) {
16741
+ if (this.state.diagnosticsPublished.has(serverId))
16742
+ return false;
16743
+ this.state.diagnosticsUnsupported.add(serverId);
16744
+ recordDegradationOnce({
16745
+ kind: "lsp-diagnostics-unsupported",
16746
+ subject: serverId,
16747
+ reason: "custom server has no pull provider and no publish evidence after first contact wait"
16748
+ });
16749
+ return true;
16750
+ }
16666
16751
  isAuxiliaryWaitDemoted(serverId, root) {
16667
16752
  return this.demotedAuxiliaryServerIds.has(`${serverId}:${normalizeMapKey(root ?? "")}`);
16668
16753
  }
@@ -17481,8 +17566,8 @@ var LSPService = class _LSPService {
17481
17566
  return { outstandingMs: 0 };
17482
17567
  }
17483
17568
  let resolveSettled;
17484
- const settled = new Promise((resolve8) => {
17485
- resolveSettled = resolve8;
17569
+ const settled = new Promise((resolve7) => {
17570
+ resolveSettled = resolve7;
17486
17571
  });
17487
17572
  const token = {
17488
17573
  startedAt: Date.now(),
@@ -17696,8 +17781,8 @@ var LSPService = class _LSPService {
17696
17781
  const effectiveMaxWaitMs = hardCapMs !== void 0 ? serverBaseMs > 0 ? Math.min(serverBaseMs, hardCapMs) : hardCapMs : serverBaseMs;
17697
17782
  let knownSlowResolve;
17698
17783
  const knownSlowSentinel = /* @__PURE__ */ Symbol("lsp-client-wait-known-slow");
17699
- const knownSlow = new Promise((resolve8) => {
17700
- knownSlowResolve = () => resolve8(knownSlowSentinel);
17784
+ const knownSlow = new Promise((resolve7) => {
17785
+ knownSlowResolve = () => resolve7(knownSlowSentinel);
17701
17786
  });
17702
17787
  const noteSpawnInFlight = (serverId) => {
17703
17788
  const knownDurationMs = getSuccessfulLspSpawnDurationMs(serverId);
@@ -17788,8 +17873,8 @@ var LSPService = class _LSPService {
17788
17873
  waitResult = await Promise.race([
17789
17874
  withBudget(),
17790
17875
  knownSlow,
17791
- new Promise((resolve8) => {
17792
- waitTimer = setTimeout(() => resolve8(timeoutSentinel), effectiveMaxWaitMs);
17876
+ new Promise((resolve7) => {
17877
+ waitTimer = setTimeout(() => resolve7(timeoutSentinel), effectiveMaxWaitMs);
17793
17878
  })
17794
17879
  ]);
17795
17880
  } finally {
@@ -19091,41 +19176,17 @@ var LSPService = class _LSPService {
19091
19176
  return waitForDiagnostics().catch(() => void 0);
19092
19177
  let shared = this.firstContactWaits.get(entry.info.id);
19093
19178
  if (!shared) {
19094
- let removeShutdownListener;
19095
- const shutdown = new Promise((resolve8) => {
19096
- const onShutdown = () => resolve8("shutdown");
19097
- if (this.shutdownController.signal.aborted) {
19098
- onShutdown();
19099
- return;
19100
- }
19101
- this.shutdownController.signal.addEventListener("abort", onShutdown, {
19102
- once: true
19103
- });
19104
- removeShutdownListener = () => this.shutdownController.signal.removeEventListener("abort", onShutdown);
19105
- });
19106
- const probe = Promise.race([
19107
- waitForDiagnostics().then(() => "completed", () => "errored"),
19108
- shutdown
19109
- ]);
19110
- const completed = withDeadline(probe, {
19111
- ms: serverTimeout,
19112
- onTimeout: "undefined"
19113
- });
19179
+ const probe = waitForDiagnostics().then(() => "completed", () => "errored");
19180
+ const completed = withDeadline(untilAborted(probe, this.shutdownController.signal, "shutdown"), { ms: serverTimeout, onTimeout: "undefined" });
19114
19181
  shared = completed.then((outcome) => {
19115
19182
  if (outcome === "errored" || outcome === "shutdown") {
19116
19183
  return "errored";
19117
19184
  }
19118
19185
  if (answeredForThisTouch(entry))
19119
19186
  return "answered";
19120
- this.state.diagnosticsUnsupported.add(entry.info.id);
19121
- recordDegradationOnce({
19122
- kind: "lsp-diagnostics-unsupported",
19123
- subject: entry.info.id,
19124
- reason: "custom server has no pull provider and no publish evidence after first contact wait"
19125
- });
19187
+ this.latchDiagnosticsUnsupported(entry.info.id);
19126
19188
  return "silent";
19127
19189
  }).catch(() => "errored").finally(() => {
19128
- removeShutdownListener?.();
19129
19190
  if (this.firstContactWaits.get(entry.info.id) === shared) {
19130
19191
  this.firstContactWaits.delete(entry.info.id);
19131
19192
  }
@@ -19180,8 +19241,8 @@ var LSPService = class _LSPService {
19180
19241
  };
19181
19242
  }
19182
19243
  let timer;
19183
- const timeout = new Promise((resolve8) => {
19184
- timer = setTimeout(() => resolve8(false), budgetMs);
19244
+ const timeout = new Promise((resolve7) => {
19245
+ timer = setTimeout(() => resolve7(false), budgetMs);
19185
19246
  if (typeof timer === "object" && "unref" in timer) {
19186
19247
  timer.unref?.();
19187
19248
  }
@@ -19279,8 +19340,8 @@ var LSPService = class _LSPService {
19279
19340
  const graceMs = readTsserverSyncGraceMs();
19280
19341
  const primaryClient = spawned[0].client;
19281
19342
  const syncRacer = (async () => {
19282
- await new Promise((resolve8) => {
19283
- const timer = setTimeout(resolve8, graceMs);
19343
+ await new Promise((resolve7) => {
19344
+ const timer = setTimeout(resolve7, graceMs);
19284
19345
  timer.unref?.();
19285
19346
  });
19286
19347
  const publishedAt = primaryClient.getAllDiagnostics?.().get(normalizedPath)?.ts;
@@ -19316,13 +19377,9 @@ var LSPService = class _LSPService {
19316
19377
  const entry = spawned.find((candidate) => candidate.info.id === serverId);
19317
19378
  if (!entry || answeredForThisTouch(entry))
19318
19379
  continue;
19319
- this.state.diagnosticsUnsupported.add(serverId);
19380
+ if (!this.latchDiagnosticsUnsupported(serverId))
19381
+ continue;
19320
19382
  diagnosticsUnsupportedServerIds.push(serverId);
19321
- recordDegradationOnce({
19322
- kind: "lsp-diagnostics-unsupported",
19323
- subject: serverId,
19324
- reason: "custom server has no pull provider and no publish evidence after first contact wait"
19325
- });
19326
19383
  }
19327
19384
  for (const entry of spawned) {
19328
19385
  if (entry.info.custom === true && this.state.diagnosticsUnsupported.has(entry.info.id)) {
@@ -19469,6 +19526,13 @@ var LSPService = class _LSPService {
19469
19526
  ...uncoveredDeferredServerIds,
19470
19527
  ...staleWriteAuxiliaryServerIds
19471
19528
  ]);
19529
+ const answerAtMerge = options.collectDiagnostics ? new Map(spawned.map((entry) => [
19530
+ entry.client,
19531
+ {
19532
+ pathVersion: readPathVersion(entry.client),
19533
+ publishedAt: entry.client.getDiagnosticsPublishedAt?.(filePath)
19534
+ }
19535
+ ])) : void 0;
19472
19536
  let collected = options.collectDiagnostics ? tsserverSyncConfirmed !== void 0 ? mergeLspDiagnostics(attributeDiagnostics(spawned[0]?.info.id ?? "unknown", tsserverSyncConfirmed)) : mergeLspDiagnostics([
19473
19537
  // #1459: a DEFERRED server's cache still holds the PREVIOUS
19474
19538
  // content's findings — the resync that would have cleared it never
@@ -19694,6 +19758,27 @@ var LSPService = class _LSPService {
19694
19758
  );
19695
19759
  result.binding = binding;
19696
19760
  }
19761
+ if (collected !== void 0 && !syncConfirmed) {
19762
+ let reusedAnswer;
19763
+ for (const entry of spawned) {
19764
+ if (isAuxiliary(entry.info))
19765
+ continue;
19766
+ if (notifyWriteTimedOutServerIds.includes(entry.info.id))
19767
+ continue;
19768
+ const versionBeforeTouch = diagnosticBaselines.get(entry.client);
19769
+ const merged = answerAtMerge?.get(entry.client);
19770
+ if (versionBeforeTouch !== void 0 && merged?.pathVersion !== void 0 && merged.pathVersion > versionBeforeTouch)
19771
+ continue;
19772
+ const publishedAt = merged?.publishedAt;
19773
+ if (publishedAt === void 0)
19774
+ continue;
19775
+ if (reusedAnswer === void 0 || publishedAt < reusedAnswer.publishedAt) {
19776
+ reusedAnswer = { serverId: entry.info.id, publishedAt };
19777
+ }
19778
+ }
19779
+ if (reusedAnswer)
19780
+ result.reusedAnswer = reusedAnswer;
19781
+ }
19697
19782
  const lateDeliveryPending = unconfirmedServerIds.filter((serverId) => (lateDeliveryServerIds ?? []).includes(serverId));
19698
19783
  if (lateDeliveryPending.length > 0) {
19699
19784
  result.deferredServerIds = lateDeliveryPending;
@@ -20685,8 +20770,8 @@ var LSPService = class _LSPService {
20685
20770
  }
20686
20771
  throw err;
20687
20772
  }
20688
- const relOld = path17.relative(cwd, oldFilePath).replace(/\\/g, "/") || path17.basename(oldFilePath);
20689
- const relNew = path17.relative(cwd, newFilePath).replace(/\\/g, "/") || path17.basename(newFilePath);
20773
+ const relOld = toPosix(path17.relative(cwd, oldFilePath)) || path17.basename(oldFilePath);
20774
+ const relNew = toPosix(path17.relative(cwd, newFilePath)) || path17.basename(newFilePath);
20690
20775
  const renameDescription = `Renamed ${relOld} \u2192 ${relNew}`;
20691
20776
  await Promise.all(activeClients.map(async ({ clientKey, serverId, client }) => {
20692
20777
  if (client.getOperationSupport().didRenameFiles !== true) {
@@ -20996,24 +21081,10 @@ var LSPService = class _LSPService {
20996
21081
  // `warmupAttempt` doc on `LSPTouchFileOptions`.
20997
21082
  warmupAttempt: attempt
20998
21083
  });
20999
- await (options.signal ? Promise.race([
21000
- withDeadline(warmupAttempt, {
21001
- ms: timeoutMs,
21002
- onTimeout: "undefined"
21003
- }),
21004
- new Promise((resolve8) => {
21005
- if (options.signal.aborted) {
21006
- resolve8();
21007
- return;
21008
- }
21009
- options.signal.addEventListener("abort", () => resolve8(), {
21010
- once: true
21011
- });
21012
- })
21013
- ]) : withDeadline(warmupAttempt, {
21084
+ await untilAborted(withDeadline(warmupAttempt, {
21014
21085
  ms: timeoutMs,
21015
21086
  onTimeout: "undefined"
21016
- }));
21087
+ }), options.signal);
21017
21088
  const coldServerIds = stillColdServerIds();
21018
21089
  logLatency({
21019
21090
  type: "phase",
@@ -21035,13 +21106,10 @@ var LSPService = class _LSPService {
21035
21106
  if (failedServerIds.length > 0 && !options.signal?.aborted) {
21036
21107
  const backoffMs = warmupRetryBackoffMs();
21037
21108
  if (backoffMs > 0) {
21038
- await new Promise((resolve8) => {
21039
- const timer = setTimeout(resolve8, backoffMs);
21109
+ await untilAborted(new Promise((resolve7) => {
21110
+ const timer = setTimeout(resolve7, backoffMs);
21040
21111
  timer.unref?.();
21041
- options.signal?.addEventListener("abort", () => resolve8(), {
21042
- once: true
21043
- });
21044
- });
21112
+ }), options.signal);
21045
21113
  }
21046
21114
  if (!options.signal?.aborted) {
21047
21115
  await runWarmupTouch(2);
@@ -21224,18 +21292,7 @@ var LSPService = class _LSPService {
21224
21292
  }
21225
21293
  }
21226
21294
  })(), { ms: perFileMs, onTimeout: "undefined" });
21227
- await (signal ? Promise.race([
21228
- preOpenAttempt,
21229
- new Promise((resolve8) => {
21230
- if (signal.aborted) {
21231
- resolve8();
21232
- return;
21233
- }
21234
- signal.addEventListener("abort", () => resolve8(), {
21235
- once: true
21236
- });
21237
- })
21238
- ]) : preOpenAttempt);
21295
+ await untilAborted(preOpenAttempt, signal);
21239
21296
  }
21240
21297
  };
21241
21298
  const markServiceDestroyed = (remainingFiles) => {
@@ -21287,7 +21344,10 @@ var LSPService = class _LSPService {
21287
21344
  // the same false clean this change closes on the local route.
21288
21345
  ...answer.unconfirmedServerIds !== void 0 && {
21289
21346
  unconfirmedServerIds: answer.unconfirmedServerIds
21290
- }
21347
+ },
21348
+ // #5030: the incumbent's content binding, read below as a local
21349
+ // touch's is. An incumbent that sends none reads as not current.
21350
+ binding: warmAnswerBinding(answer)
21291
21351
  } : await withDeadline(this.touchFile(filePath, content, {
21292
21352
  diagnostics: "document",
21293
21353
  collectDiagnostics: true,
@@ -21504,6 +21564,9 @@ var LSPService = class _LSPService {
21504
21564
  if (result.error || result.timedOut || (result.unconfirmedServerIds?.length ?? 0) > 0 || scannedAt === void 0) {
21505
21565
  continue;
21506
21566
  }
21567
+ if (result.boundToCurrentDisk === false && result.contentHash === void 0) {
21568
+ continue;
21569
+ }
21507
21570
  if (pullAnsweredFiles.has(result.filePath) && result.contentHash === void 0) {
21508
21571
  workspaceDiagnosticsCacheCtx.forget(result.filePath);
21509
21572
  continue;
@@ -21872,6 +21935,8 @@ async function hasAuxiliaryLspPublishedForRoot(serverId, filePath) {
21872
21935
 
21873
21936
  export {
21874
21937
  resetWorkspaceDiagnosticsCacheSession,
21938
+ noteWorkspaceFilesChangedOnDisk,
21939
+ noteWorkspaceDependenciesChanged,
21875
21940
  importTargetsToAnnounce,
21876
21941
  goPackageFilesToAnnounce,
21877
21942
  getLspBudgetIdleTimeoutMs,
@@ -21932,6 +21997,9 @@ export {
21932
21997
  touchCoverageGap,
21933
21998
  touchCompletedConfirmationPolicy,
21934
21999
  hashDiagnosticContent,
22000
+ warmAnswerBinding,
22001
+ readBoundToCurrentDisk,
22002
+ SERVER_CONFIG_FILE_NAMES,
21935
22003
  groupFilesByPrimaryServer,
21936
22004
  runPerServerGroups,
21937
22005
  STALE_LINE_MARKER,