pi-lens 4.4.8 → 4.4.10

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 (169) hide show
  1. package/CHANGELOG-USER.md +31 -0
  2. package/CHANGELOG.md +258 -0
  3. package/README.md +4 -1
  4. package/config/dependency-cruiser-eager-allowlist.json +1 -1
  5. package/dist/{chunk-6YUNI7B5.js → chunk-2ADRLTM2.js} +14 -60
  6. package/dist/{chunk-4B2YFN4U.js → chunk-2LVJQU3I.js} +46 -33
  7. package/dist/{chunk-2453RRJ2.js → chunk-3FRI5H4T.js} +72 -23
  8. package/dist/{chunk-7MAD5ZAY.js → chunk-3HM4BUHR.js} +14 -16
  9. package/dist/chunk-3QWVOBZJ.js +73 -0
  10. package/dist/{chunk-PIQQM32Y.js → chunk-46TQJSUE.js} +4 -2
  11. package/dist/{chunk-RZG472YW.js → chunk-4ITEFRDH.js} +84 -46
  12. package/dist/{chunk-6FIRFP6A.js → chunk-4NCDHTFI.js} +10 -12
  13. package/dist/{chunk-7CGIDRIK.js → chunk-6I44EDNQ.js} +14 -16
  14. package/dist/{chunk-2BKUFQKR.js → chunk-6MDM5MQT.js} +554 -217
  15. package/dist/{chunk-BBET6HD6.js → chunk-7JX3RNG4.js} +1 -1
  16. package/dist/{chunk-JE6HKLC7.js → chunk-7WJ55KBN.js} +2 -4
  17. package/dist/{chunk-4BKU7PV3.js → chunk-A5TEJZGJ.js} +2 -1
  18. package/dist/{chunk-7ANZ7XDD.js → chunk-ACRJ2GZ5.js} +2 -2
  19. package/dist/{chunk-2ZE3AUJQ.js → chunk-ALIZWXHZ.js} +13 -15
  20. package/dist/{chunk-BQG2QFVO.js → chunk-AON2QIJF.js} +43 -55
  21. package/dist/chunk-B2YUE6YD.js +23 -0
  22. package/dist/{chunk-L4NEVZ4T.js → chunk-B6HXETWY.js} +25 -27
  23. package/dist/chunk-BDR5MEZY.js +25 -0
  24. package/dist/{chunk-HXFUTMX2.js → chunk-BGLS5SDN.js} +2 -2
  25. package/dist/{chunk-ZZDIOAAJ.js → chunk-BRESRQBE.js} +6 -6
  26. package/dist/{chunk-WXUDRAG6.js → chunk-C6AODRNU.js} +10 -12
  27. package/dist/{chunk-GMROJJRN.js → chunk-CB7PEVOJ.js} +9 -1
  28. package/dist/{chunk-BHWW6FAX.js → chunk-CTB5BAJI.js} +53 -22
  29. package/dist/{chunk-VN3L2JWZ.js → chunk-CYUJB552.js} +5 -5
  30. package/dist/{chunk-6GMGEKQN.js → chunk-CZAWWXP6.js} +39 -12
  31. package/dist/{chunk-G5GV2Q7K.js → chunk-CZCAZVTD.js} +16 -2
  32. package/dist/chunk-DBS736MA.js +57 -0
  33. package/dist/{chunk-OWTG6UMO.js → chunk-DOUAWKLO.js} +75 -22
  34. package/dist/{chunk-BOPDQ7AZ.js → chunk-DVRJBQOJ.js} +19 -21
  35. package/dist/{chunk-UHHLR2VY.js → chunk-E4VXKTBR.js} +38 -41
  36. package/dist/{chunk-X66YJ2SS.js → chunk-F6FT6BVQ.js} +33 -34
  37. package/dist/{chunk-GIRBSBGL.js → chunk-FCQSZQAT.js} +3 -3
  38. package/dist/{chunk-X35S7HSB.js → chunk-FOEPIX76.js} +41 -30
  39. package/dist/{chunk-MC6VB2E5.js → chunk-GMC4ZGYR.js} +17 -5
  40. package/dist/{chunk-7TNILKGY.js → chunk-GTTMQ6XB.js} +1 -1
  41. package/dist/{chunk-HHR7WGCI.js → chunk-GUGKKGG7.js} +3 -3
  42. package/dist/{chunk-OZWXLJMX.js → chunk-GVWIU7M7.js} +2 -2
  43. package/dist/{chunk-WMDUT4KH.js → chunk-H65TYP6V.js} +94 -90
  44. package/dist/{chunk-5F3XF3SX.js → chunk-HILZE4BQ.js} +9 -8
  45. package/dist/{chunk-PKSUMEPT.js → chunk-HSYFLOZY.js} +3 -3
  46. package/dist/{chunk-4QG55RRC.js → chunk-I32RSMH6.js} +10 -12
  47. package/dist/chunk-I74RQGKA.js +88 -0
  48. package/dist/{chunk-G6JKM4O7.js → chunk-IDCTDKIA.js} +10 -10
  49. package/dist/chunk-IK4YS3KC.js +25 -0
  50. package/dist/{chunk-O2ARHQKF.js → chunk-IL6PIV33.js} +2 -2
  51. package/dist/{chunk-L3CLUGDY.js → chunk-J6BR5XN2.js} +3 -3
  52. package/dist/chunk-JKOZ2Z4U.js +20 -0
  53. package/dist/{chunk-SP4TFY5F.js → chunk-JZQGRARR.js} +11 -13
  54. package/dist/{chunk-CUDD35TW.js → chunk-K6WIBVMK.js} +6 -5
  55. package/dist/{chunk-DIWK3LBC.js → chunk-KDCIG23C.js} +8 -10
  56. package/dist/{chunk-4NBWFYWW.js → chunk-KFRDFAOE.js} +8 -33
  57. package/dist/{chunk-I22THIHI.js → chunk-KJ3AHOCK.js} +10 -12
  58. package/dist/{chunk-VOP4PJKA.js → chunk-KSTQ4VXT.js} +7 -9
  59. package/dist/{chunk-RGGH6M34.js → chunk-LT62P654.js} +1 -1
  60. package/dist/chunk-MAD4QJTP.js +198 -0
  61. package/dist/{chunk-CM73PPGD.js → chunk-MN635QYA.js} +3 -4
  62. package/dist/{chunk-HUAM7QG3.js → chunk-NBM7PNBP.js} +25 -23
  63. package/dist/{chunk-DYRZGUMA.js → chunk-NE4EFHJX.js} +2 -2
  64. package/dist/{chunk-SQC7K3SP.js → chunk-NL5LSKVD.js} +2 -2
  65. package/dist/{chunk-JZRP4DGP.js → chunk-NPNFGYLV.js} +4 -2
  66. package/dist/{chunk-NM2NWH55.js → chunk-NUSXS6YB.js} +6 -5
  67. package/dist/{chunk-ZKLTNLAW.js → chunk-OPFNQBS5.js} +6 -6
  68. package/dist/{chunk-PPKECBPP.js → chunk-OTSTS7L2.js} +19 -1
  69. package/dist/{chunk-SFLHSL5R.js → chunk-PTSA6QKL.js} +18 -7
  70. package/dist/{chunk-OY7WZI7Q.js → chunk-Q2VCKC3X.js} +6 -6
  71. package/dist/{chunk-HKIL6DCL.js → chunk-QGITU23N.js} +1 -1
  72. package/dist/{chunk-3O5EII3W.js → chunk-QHOTTC4A.js} +2 -2
  73. package/dist/{chunk-35WKJWO5.js → chunk-QL37SGTS.js} +112 -20
  74. package/dist/{chunk-OC7VWJBZ.js → chunk-QMV2APEH.js} +35 -37
  75. package/dist/{chunk-BUZIQDFS.js → chunk-QSCZAP24.js} +3 -3
  76. package/dist/{chunk-O4N5BQ3T.js → chunk-QUPYLQA4.js} +8 -10
  77. package/dist/{chunk-A5GRLYPZ.js → chunk-QUQY3IME.js} +7 -13
  78. package/dist/{chunk-R2QQC33W.js → chunk-QWTHFFU6.js} +12 -14
  79. package/dist/{chunk-TV6RXRYH.js → chunk-RQRKIRFY.js} +8 -10
  80. package/dist/{chunk-ZFORSIED.js → chunk-S3WFVG5P.js} +15 -42
  81. package/dist/{chunk-5RNB4HVK.js → chunk-SG2JQ2YP.js} +1 -1
  82. package/dist/{chunk-KZ4ALBCH.js → chunk-SJQUWQR6.js} +2 -2
  83. package/dist/{chunk-T2S3FNNJ.js → chunk-SKVNHCT5.js} +41 -42
  84. package/dist/{chunk-SDFKOLSF.js → chunk-TJQSYX3J.js} +8 -6
  85. package/dist/{chunk-IYVYZQRL.js → chunk-TLWFZ66Y.js} +5 -7
  86. package/dist/{chunk-5T5A6YAJ.js → chunk-TN5CWX5D.js} +33 -34
  87. package/dist/chunk-TQHOKMVZ.js +28 -0
  88. package/dist/{chunk-XOMGO63G.js → chunk-TYHOEX4V.js} +19 -21
  89. package/dist/{chunk-6LJOJ6EO.js → chunk-UNBRHPHJ.js} +14 -16
  90. package/dist/{chunk-4LL2VRNY.js → chunk-UOO4D2TK.js} +16 -18
  91. package/dist/{chunk-AGGUWKRK.js → chunk-UY745U35.js} +1 -1
  92. package/dist/{chunk-LSFXZLPW.js → chunk-V7F7JHS5.js} +218 -253
  93. package/dist/{chunk-VLQ7UKZH.js → chunk-VCRVNLE7.js} +135 -2
  94. package/dist/{chunk-JPRDTY5S.js → chunk-VGTBLTPN.js} +8 -10
  95. package/dist/{chunk-JBP7KESM.js → chunk-VPFRU5IG.js} +1 -1
  96. package/dist/chunk-VS2L7QDI.js +25 -0
  97. package/dist/{chunk-4W52ZKZX.js → chunk-W4CUK5G6.js} +2 -2
  98. package/dist/{chunk-VPLBLWFO.js → chunk-W7TY6HYX.js} +1 -1
  99. package/dist/{chunk-JYLOYTZD.js → chunk-WAA63ZJV.js} +5 -1
  100. package/dist/{chunk-WC6WRNQT.js → chunk-WS3UFJOU.js} +2 -2
  101. package/dist/chunk-XAFZJEXY.js +50 -0
  102. package/dist/{chunk-XYLC35E4.js → chunk-XPGH5O74.js} +555 -336
  103. package/dist/{chunk-VOXTCULR.js → chunk-XVB3Q2PG.js} +2 -4
  104. package/dist/{chunk-FRLAUP2B.js → chunk-Y3EHLUPL.js} +4 -4
  105. package/dist/{chunk-CZL44WFN.js → chunk-YF4G5NN5.js} +2 -2
  106. package/dist/{chunk-XWIME22V.js → chunk-YQA34KAF.js} +11 -13
  107. package/dist/{chunk-FHEV6T4L.js → chunk-YT2VR4SL.js} +8 -10
  108. package/dist/chunk-ZD4KVFXI.js +234 -0
  109. package/dist/{chunk-NSPVR3FN.js → chunk-ZOPXB2KK.js} +17 -19
  110. package/dist/chunk-ZPFLHB3R.js +28 -0
  111. package/dist/{chunk-R4QWJQ2H.js → chunk-ZZDVGCGG.js} +9 -11
  112. package/dist/index.js +5398 -4438
  113. package/dist/mcp/analyze-cli.js +12 -17
  114. package/dist/mcp/cli.js +41 -42
  115. package/dist/mcp/server.js +1466 -663
  116. package/dist/mcp/worker.js +59 -60
  117. package/dist/probes/installer.js +17 -19
  118. package/docs/agent-guide.md +2 -1
  119. package/docs/agent-tools.md +53 -10
  120. package/docs/analysisall.md +1 -1
  121. package/docs/ci-bot-pr-checks.md +7 -5
  122. package/docs/configuration.md +60 -13
  123. package/docs/defect-shapes.md +67 -4
  124. package/docs/environment-variables.md +18 -1
  125. package/docs/features.md +23 -6
  126. package/docs/globalconfig.md +24 -3
  127. package/docs/invariants/language-config.md +9 -1
  128. package/docs/invariants/lsp-trust-exec.md +9 -2
  129. package/docs/invariants/session-telemetry.md +2 -2
  130. package/docs/language-coverage.md +67 -0
  131. package/docs/lsp-capability-matrix.md +121 -53
  132. package/docs/lsp-idle-eviction.md +20 -13
  133. package/docs/merge-queue-rollout.md +10 -8
  134. package/docs/module-report-read-symbol.md +34 -23
  135. package/docs/pi-lens-fixer.md +19 -7
  136. package/docs/pi-lens-investigator.md +3 -0
  137. package/docs/pi-lens-merge-policy.md +20 -8
  138. package/docs/pi-lens-release.md +3 -2
  139. package/docs/pi-lens-reviewer.md +53 -12
  140. package/docs/pi-lens-subagent.md +13 -0
  141. package/docs/public-api-stability.md +39 -5
  142. package/docs/release-qa-baseline.md +7 -4
  143. package/docs/schema/pi-lens-config-v1.json +11 -2
  144. package/docs/servercapabilities.md +3 -1
  145. package/docs/settings.md +9 -6
  146. package/docs/usage.md +1 -0
  147. package/docs/word-index.md +3 -2
  148. package/package.json +9 -4
  149. package/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +1 -2
  150. package/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +1 -2
  151. package/scripts/download-grammars.js +13 -2
  152. package/scripts/grammars.lock.json +7 -0
  153. package/skills/pi-lens-lsp-navigation/SKILL.md +5 -1
  154. package/vendor/grammars/tree-sitter-groovy.wasm +0 -0
  155. package/dist/chunk-2TS4GLOJ.js +0 -31
  156. package/dist/chunk-3JAHQBSY.js +0 -27
  157. package/dist/chunk-447YZL4S.js +0 -25
  158. package/dist/chunk-565VRUP4.js +0 -136
  159. package/dist/chunk-57X2CDRX.js +0 -49
  160. package/dist/chunk-GGYOZWHW.js +0 -27
  161. package/dist/chunk-IE5D3RA5.js +0 -58
  162. package/dist/chunk-LPYTPNOJ.js +0 -22
  163. package/dist/chunk-OFNMHPBT.js +0 -89
  164. package/dist/chunk-U3AS2FR6.js +0 -106
  165. package/dist/chunk-W3BGKBBK.js +0 -27
  166. package/dist/chunk-WQV6BI4Q.js +0 -48
  167. package/dist/chunk-YHGYAEFH.js +0 -443
  168. package/dist/chunk-ZONZ6YY3.js +0 -74
  169. package/dist/chunk-ZSM35JF4.js +0 -30
@@ -7,7 +7,7 @@ import {
7
7
  normalizeMessage,
8
8
  sanitizeCorrelationId,
9
9
  stableFindingId
10
- } from "./chunk-GIRBSBGL.js";
10
+ } from "./chunk-FCQSZQAT.js";
11
11
  import {
12
12
  mapWithConcurrency
13
13
  } from "./chunk-XIMYZ3JA.js";
@@ -38,25 +38,26 @@ import {
38
38
  resolveLspServerCwd,
39
39
  serverTraits,
40
40
  withLspProjectCodePermission
41
- } from "./chunk-XYLC35E4.js";
41
+ } from "./chunk-XPGH5O74.js";
42
42
  import {
43
43
  findLocalOpengrepConfig
44
- } from "./chunk-DYRZGUMA.js";
44
+ } from "./chunk-NE4EFHJX.js";
45
45
  import {
46
46
  emitBounded
47
- } from "./chunk-FHEV6T4L.js";
47
+ } from "./chunk-YT2VR4SL.js";
48
48
  import {
49
49
  loadProjectSnapshot,
50
50
  readJsonCache
51
- } from "./chunk-ZZDIOAAJ.js";
51
+ } from "./chunk-BRESRQBE.js";
52
52
  import {
53
53
  acquireWorkspaceSweepHold,
54
54
  configureLspServiceLifecycle,
55
55
  getOwnedLspService,
56
56
  peekOwnedLspService,
57
57
  resetOwnedLspService
58
- } from "./chunk-VOXTCULR.js";
58
+ } from "./chunk-XVB3Q2PG.js";
59
59
  import {
60
+ RUNTIME_CONFIG,
60
61
  collectForwardImportMtimes,
61
62
  exceedsLspSyncLimits,
62
63
  feedsJsTsGlobalScope,
@@ -69,46 +70,46 @@ import {
69
70
  lineTextAt,
70
71
  pathBirthtimeMs,
71
72
  scanDocumentContent
72
- } from "./chunk-35WKJWO5.js";
73
+ } from "./chunk-QL37SGTS.js";
73
74
  import {
74
75
  js_yaml_default
75
- } from "./chunk-HKIL6DCL.js";
76
+ } from "./chunk-QGITU23N.js";
76
77
  import {
77
78
  EXTENSION_TO_LSP_ID,
78
79
  lspLanguageId,
79
80
  resolveFilenameLanguage
80
- } from "./chunk-PPKECBPP.js";
81
+ } from "./chunk-OTSTS7L2.js";
81
82
  import {
82
83
  HOOK_WALL_BUDGET_MS
83
84
  } from "./chunk-CKEQFGLT.js";
84
- import {
85
- bounded,
86
- untilAborted,
87
- withDeadline,
88
- withTimeout
89
- } from "./chunk-JYLOYTZD.js";
90
85
  import {
91
86
  diagnosticsIpcPathForCwd,
92
87
  requestWarmCodeActions,
93
88
  requestWarmDiagnostics
94
- } from "./chunk-CZL44WFN.js";
89
+ } from "./chunk-YF4G5NN5.js";
95
90
  import {
96
91
  CONTENT_HASH_MAX_BYTES,
97
92
  hashContentBytes,
98
93
  hashFileBytes,
99
94
  stampContentBytes
100
- } from "./chunk-VPLBLWFO.js";
95
+ } from "./chunk-W7TY6HYX.js";
96
+ import {
97
+ bounded,
98
+ untilAborted,
99
+ withDeadline,
100
+ withTimeout
101
+ } from "./chunk-WAA63ZJV.js";
101
102
  import {
102
103
  findLocalZizmorConfig,
103
104
  logSessionStart
104
- } from "./chunk-BQG2QFVO.js";
105
+ } from "./chunk-AON2QIJF.js";
105
106
  import {
106
107
  findLocalBinUpwards,
107
108
  isProjectLocalBinPath
108
- } from "./chunk-VOP4PJKA.js";
109
+ } from "./chunk-KSTQ4VXT.js";
109
110
  import {
110
111
  getLspCapableKinds
111
- } from "./chunk-SDFKOLSF.js";
112
+ } from "./chunk-TJQSYX3J.js";
112
113
  import {
113
114
  createGenerationMap,
114
115
  createGenerationSource,
@@ -127,50 +128,48 @@ import {
127
128
  sampleProcessTreeCpuPercent,
128
129
  selectLivePeerInstances,
129
130
  windowsExe
130
- } from "./chunk-WMDUT4KH.js";
131
+ } from "./chunk-H65TYP6V.js";
131
132
  import {
132
133
  createSingleFlight
133
134
  } from "./chunk-AWQWXSW4.js";
134
135
  import {
135
136
  SPECIAL_FILENAMES,
136
- getLanguageId
137
- } from "./chunk-G5GV2Q7K.js";
137
+ getLanguageId,
138
+ isJstsFactFile
139
+ } from "./chunk-CZCAZVTD.js";
138
140
  import {
139
141
  PathKeyedMap,
140
142
  detectFileRole
141
- } from "./chunk-X35S7HSB.js";
143
+ } from "./chunk-FOEPIX76.js";
142
144
  import {
143
145
  assertInstallAllowed,
144
146
  isLspSpawnAllowedByTrust,
145
147
  projectTrustDenialReason,
146
148
  writeFileAtomic
147
- } from "./chunk-JE6HKLC7.js";
149
+ } from "./chunk-7WJ55KBN.js";
148
150
  import {
149
151
  compareOrdinal,
150
152
  incrementDegradationCount,
153
+ logExtension,
151
154
  recordDegradation,
152
155
  recordDegradationOnce,
153
156
  truncateForLedger
154
- } from "./chunk-2453RRJ2.js";
155
- import {
156
- logExtension
157
- } from "./chunk-WQV6BI4Q.js";
157
+ } from "./chunk-3FRI5H4T.js";
158
158
  import {
159
159
  freshnessFromMtime
160
160
  } from "./chunk-S26LC76R.js";
161
- import {
162
- logLatency,
163
- phaseFinished,
164
- phaseStarted
165
- } from "./chunk-565VRUP4.js";
166
161
  import {
167
162
  createNdjsonLogger,
168
163
  getGlobalPiLensLogDir,
169
164
  getMaxLogSizeMB,
170
165
  getProcessSingleton,
166
+ isLspInstallDisabled,
171
167
  isTestMode,
172
- nextModuleEvaluationOrdinal
173
- } from "./chunk-VLQ7UKZH.js";
168
+ logLatency,
169
+ nextModuleEvaluationOrdinal,
170
+ phaseFinished,
171
+ phaseStarted
172
+ } from "./chunk-VCRVNLE7.js";
174
173
  import {
175
174
  BoundedFifoMap,
176
175
  BoundedLruCache,
@@ -193,7 +192,7 @@ import {
193
192
  uriToDiskPath,
194
193
  uriToPath,
195
194
  walkUpDirs
196
- } from "./chunk-GMROJJRN.js";
195
+ } from "./chunk-CB7PEVOJ.js";
197
196
  import {
198
197
  __commonJS,
199
198
  __require,
@@ -2408,10 +2407,11 @@ var require_connection = __commonJS({
2408
2407
  } finally {
2409
2408
  if (result instanceof Promise) {
2410
2409
  result.then(() => {
2411
- inFlight--;
2412
- triggerMessageQueue();
2413
2410
  }).catch((error) => {
2414
2411
  logger.error(`Processing message queue failed: ${error.toString()}`);
2412
+ }).finally(() => {
2413
+ inFlight--;
2414
+ triggerMessageQueue();
2415
2415
  });
2416
2416
  } else {
2417
2417
  inFlight--;
@@ -3404,6 +3404,7 @@ var require_ril = __commonJS({
3404
3404
  "use strict";
3405
3405
  Object.defineProperty(exports, "__esModule", { value: true });
3406
3406
  var util_1 = __require("util");
3407
+ var crypto_1 = __require("crypto");
3407
3408
  var api_1 = require_api();
3408
3409
  var MessageBuffer = class _MessageBuffer extends api_1.AbstractMessageBuffer {
3409
3410
  static emptyBuffer = Buffer.allocUnsafe(0);
@@ -3427,7 +3428,7 @@ var require_ril = __commonJS({
3427
3428
  if (length === void 0) {
3428
3429
  return buffer instanceof Buffer ? buffer : Buffer.from(buffer);
3429
3430
  } else {
3430
- return buffer instanceof Buffer ? buffer.slice(0, length) : Buffer.from(buffer, 0, length);
3431
+ return buffer instanceof Buffer ? buffer.slice(0, length) : Buffer.from(buffer.subarray(0, length));
3431
3432
  }
3432
3433
  }
3433
3434
  allocNative(length) {
@@ -3494,6 +3495,9 @@ var require_ril = __commonJS({
3494
3495
  }
3495
3496
  };
3496
3497
  var _ril = Object.freeze({
3498
+ crypto: Object.freeze({
3499
+ randomUUID: () => (0, crypto_1.randomUUID)()
3500
+ }),
3497
3501
  messageBuffer: Object.freeze({
3498
3502
  create: (encoding) => new MessageBuffer(encoding)
3499
3503
  }),
@@ -3644,7 +3648,7 @@ var require_main = __commonJS({
3644
3648
  this.errorCount = 0;
3645
3649
  const eventEmitter = this.process;
3646
3650
  eventEmitter.on("error", (error) => this.fireError(error));
3647
- eventEmitter.on("close", () => this.fireClose);
3651
+ eventEmitter.on("close", () => this.fireClose());
3648
3652
  }
3649
3653
  write(msg) {
3650
3654
  try {
@@ -3677,7 +3681,7 @@ var require_main = __commonJS({
3677
3681
  constructor(port) {
3678
3682
  super();
3679
3683
  this.onData = new api_1.Emitter();
3680
- port.on("close", () => this.fireClose);
3684
+ port.on("close", () => this.fireClose());
3681
3685
  port.on("error", (error) => this.fireError(error));
3682
3686
  port.on("message", (message) => {
3683
3687
  this.onData.fire(message);
@@ -3786,6 +3790,9 @@ var require_main = __commonJS({
3786
3790
  resolve7({
3787
3791
  onConnected: () => {
3788
3792
  return connected;
3793
+ },
3794
+ close: () => {
3795
+ server.close();
3789
3796
  }
3790
3797
  });
3791
3798
  });
@@ -3824,6 +3831,9 @@ var require_main = __commonJS({
3824
3831
  port: () => boundPort,
3825
3832
  onConnected: () => {
3826
3833
  return connected;
3834
+ },
3835
+ close: () => {
3836
+ server.close();
3827
3837
  }
3828
3838
  });
3829
3839
  });
@@ -4042,7 +4052,7 @@ async function importTargetsToAnnounce(cwd, importers, onScope) {
4042
4052
  reason: `resolved the imports of ${CREATED_IMPORT_SCAN_MAX_FILES} of ${importers.length} files in one diagnostics call`
4043
4053
  });
4044
4054
  }
4045
- const { extractForwardImports } = await import("./chunk-BOPDQ7AZ.js");
4055
+ const { extractForwardImports } = await import("./chunk-DVRJBQOJ.js");
4046
4056
  const targets = /* @__PURE__ */ new Set();
4047
4057
  const reexports = /* @__PURE__ */ new Map();
4048
4058
  let resolved2 = 0;
@@ -5310,14 +5320,79 @@ function restoreLineEndings(text, ending) {
5310
5320
 
5311
5321
  // dist/clients/partial-edit-apply.js
5312
5322
  import { createHash as createHash3 } from "node:crypto";
5313
- import * as fs4 from "node:fs";
5323
+ import * as fs3 from "node:fs";
5324
+ var MAX_APPLIED_RECORDS_PER_FILE = 8;
5325
+ var MAX_APPLIED_RECORD_FILES = 64;
5326
+ function editPairDigest(oldText, newText) {
5327
+ return createHash3("sha256").update(JSON.stringify([oldText, newText ?? ""]), "utf8").digest("hex");
5328
+ }
5329
+ var PartialApplyRecordStore = class {
5330
+ // Bounded on the PathKeyedMap itself (#2442): the file axis used to
5331
+ // hand-roll `keys().next().value` here, which also evicted an unrelated
5332
+ // file when a path ALREADY in the map was re-recorded at capacity.
5333
+ files = new PathKeyedMap(normalizeMapKey, MAX_APPLIED_RECORD_FILES);
5334
+ find(filePath, oldText, newText) {
5335
+ if (!oldText)
5336
+ return void 0;
5337
+ const pairDigest = editPairDigest(oldText, newText);
5338
+ const records = this.files.get(filePath) ?? [];
5339
+ return records.find((r) => r.pairDigest === pairDigest);
5340
+ }
5341
+ record(filePath, oldText, newText, contentHash2) {
5342
+ if (!oldText)
5343
+ return;
5344
+ const pairDigest = editPairDigest(oldText, newText);
5345
+ const records = this.files.get(filePath) ?? [];
5346
+ const existing = records.findIndex((r) => r.pairDigest === pairDigest);
5347
+ if (existing >= 0)
5348
+ records.splice(existing, 1);
5349
+ const entry = {
5350
+ pairDigest,
5351
+ contentHash: contentHash2 ?? hashFile(filePath),
5352
+ appliedAtMs: Date.now()
5353
+ };
5354
+ if (records.length >= MAX_APPLIED_RECORDS_PER_FILE)
5355
+ records.shift();
5356
+ records.push(entry);
5357
+ this.files.set(filePath, records);
5358
+ }
5359
+ /**
5360
+ * Stamps the post-afterWrite file hash onto an existing record so a later
5361
+ * identical retry against the formatter-rewritten file is still recognized as
5362
+ * already-applied (#2402). No-op when the pair was never recorded.
5363
+ */
5364
+ noteAfterWriteHash(filePath, oldText, newText, afterWriteContentHash) {
5365
+ if (!oldText)
5366
+ return;
5367
+ const pairDigest = editPairDigest(oldText, newText);
5368
+ const record2 = this.files.get(filePath)?.find((r) => r.pairDigest === pairDigest);
5369
+ if (record2)
5370
+ record2.afterWriteContentHash = afterWriteContentHash;
5371
+ }
5372
+ clear() {
5373
+ this.files.clear();
5374
+ }
5375
+ get fileCount() {
5376
+ return this.files.size;
5377
+ }
5378
+ };
5379
+ function hashFile(filePath) {
5380
+ try {
5381
+ return createHash3("sha256").update(fs3.readFileSync(filePath)).digest("hex");
5382
+ } catch {
5383
+ return void 0;
5384
+ }
5385
+ }
5386
+
5387
+ // dist/clients/read-guard.js
5388
+ import { constants as bufferConstants } from "node:buffer";
5389
+ import * as fs5 from "node:fs";
5314
5390
 
5315
5391
  // dist/clients/file-time.js
5316
- import * as fs3 from "node:fs";
5392
+ import * as fs4 from "node:fs";
5317
5393
  import * as path4 from "node:path";
5318
5394
  var globalState = {
5319
- reads: /* @__PURE__ */ new Map(),
5320
- locks: /* @__PURE__ */ new Map()
5395
+ reads: /* @__PURE__ */ new Map()
5321
5396
  };
5322
5397
  var FileTime = class {
5323
5398
  sessionID;
@@ -5380,25 +5455,6 @@ Please read the file again before modifying it.`, absolutePath, "modified");
5380
5455
  const current = createStamp(absolutePath);
5381
5456
  return current.mtime !== recorded.mtime || current.ctime !== recorded.ctime || current.size !== recorded.size;
5382
5457
  }
5383
- /**
5384
- * Acquire exclusive lock on file
5385
- * Prevents concurrent modifications to same file
5386
- */
5387
- async withLock(filePath, fn) {
5388
- const absolutePath = path4.resolve(filePath);
5389
- while (globalState.locks.has(absolutePath)) {
5390
- const existing = globalState.locks.get(absolutePath);
5391
- if (existing)
5392
- await existing;
5393
- }
5394
- const lockPromise = fn().finally(() => {
5395
- globalState.locks.delete(absolutePath);
5396
- });
5397
- globalState.locks.set(absolutePath, lockPromise.then(() => {
5398
- }, () => {
5399
- }));
5400
- return lockPromise;
5401
- }
5402
5458
  /**
5403
5459
  * Clear all tracked files for this session
5404
5460
  */
@@ -5426,7 +5482,7 @@ var FileTimeError = class extends Error {
5426
5482
  };
5427
5483
  function createStamp(filePath) {
5428
5484
  try {
5429
- const stats = fs3.statSync(filePath);
5485
+ const stats = fs4.statSync(filePath);
5430
5486
  return {
5431
5487
  readAt: /* @__PURE__ */ new Date(),
5432
5488
  mtime: stats.mtime.getTime(),
@@ -5447,78 +5503,8 @@ function createFileTime(sessionID) {
5447
5503
  }
5448
5504
  function clearAllSessions() {
5449
5505
  globalState.reads.clear();
5450
- globalState.locks.clear();
5451
- }
5452
-
5453
- // dist/clients/partial-edit-apply.js
5454
- var MAX_APPLIED_RECORDS_PER_FILE = 8;
5455
- var MAX_APPLIED_RECORD_FILES = 64;
5456
- function editPairDigest(oldText, newText) {
5457
- return createHash3("sha256").update(JSON.stringify([oldText, newText ?? ""]), "utf8").digest("hex");
5458
- }
5459
- var PartialApplyRecordStore = class {
5460
- // Bounded on the PathKeyedMap itself (#2442): the file axis used to
5461
- // hand-roll `keys().next().value` here, which also evicted an unrelated
5462
- // file when a path ALREADY in the map was re-recorded at capacity.
5463
- files = new PathKeyedMap(normalizeMapKey, MAX_APPLIED_RECORD_FILES);
5464
- find(filePath, oldText, newText) {
5465
- if (!oldText)
5466
- return void 0;
5467
- const pairDigest = editPairDigest(oldText, newText);
5468
- const records = this.files.get(filePath) ?? [];
5469
- return records.find((r) => r.pairDigest === pairDigest);
5470
- }
5471
- record(filePath, oldText, newText, contentHash2) {
5472
- if (!oldText)
5473
- return;
5474
- const pairDigest = editPairDigest(oldText, newText);
5475
- const records = this.files.get(filePath) ?? [];
5476
- const existing = records.findIndex((r) => r.pairDigest === pairDigest);
5477
- if (existing >= 0)
5478
- records.splice(existing, 1);
5479
- const entry = {
5480
- pairDigest,
5481
- contentHash: contentHash2 ?? hashFile(filePath),
5482
- appliedAtMs: Date.now()
5483
- };
5484
- if (records.length >= MAX_APPLIED_RECORDS_PER_FILE)
5485
- records.shift();
5486
- records.push(entry);
5487
- this.files.set(filePath, records);
5488
- }
5489
- /**
5490
- * Stamps the post-afterWrite file hash onto an existing record so a later
5491
- * identical retry against the formatter-rewritten file is still recognized as
5492
- * already-applied (#2402). No-op when the pair was never recorded.
5493
- */
5494
- noteAfterWriteHash(filePath, oldText, newText, afterWriteContentHash) {
5495
- if (!oldText)
5496
- return;
5497
- const pairDigest = editPairDigest(oldText, newText);
5498
- const record2 = this.files.get(filePath)?.find((r) => r.pairDigest === pairDigest);
5499
- if (record2)
5500
- record2.afterWriteContentHash = afterWriteContentHash;
5501
- }
5502
- clear() {
5503
- this.files.clear();
5504
- }
5505
- get fileCount() {
5506
- return this.files.size;
5507
- }
5508
- };
5509
- var fileLock = createFileTime("partial-edit-apply");
5510
- function hashFile(filePath) {
5511
- try {
5512
- return createHash3("sha256").update(fs4.readFileSync(filePath)).digest("hex");
5513
- } catch {
5514
- return void 0;
5515
- }
5516
5506
  }
5517
5507
 
5518
- // dist/clients/read-guard.js
5519
- import { constants as bufferConstants } from "node:buffer";
5520
- import * as fs5 from "node:fs";
5521
-
5522
5508
  // dist/clients/eval-timestamp.js
5523
5509
  import { performance as performance2 } from "node:perf_hooks";
5524
5510
  var PI_LENS_EVAL_STARTED_MS = performance2.now();
@@ -7785,7 +7771,10 @@ function getProcessBridge(key, version) {
7785
7771
  return candidate;
7786
7772
  }
7787
7773
 
7788
- // dist/clients/bus-events-logger.js
7774
+ // dist/clients/recent-touches.js
7775
+ var RECENT_TOUCHES_FRESHNESS_MS = 15 * 60 * 1e3;
7776
+
7777
+ // dist/clients/live-bus-emitter.js
7789
7778
  import * as path6 from "node:path";
7790
7779
  var BUS_EVENTS_LOG_FILE = path6.join(getGlobalPiLensLogDir(), "bus-events.log");
7791
7780
  var writer = createNdjsonLogger({
@@ -7811,11 +7800,6 @@ function logBusEvent(entry) {
7811
7800
  }
7812
7801
  writer.log({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry });
7813
7802
  }
7814
-
7815
- // dist/clients/recent-touches.js
7816
- var RECENT_TOUCHES_FRESHNESS_MS = 15 * 60 * 1e3;
7817
-
7818
- // dist/clients/live-bus-emitter.js
7819
7803
  var STALE_CTX_MESSAGE = "This extension ctx is stale after session replacement";
7820
7804
  function recordStaleBusFailure(subject, error) {
7821
7805
  const reason = String(error);
@@ -7854,8 +7838,8 @@ function createLiveBusEmitter() {
7854
7838
  }
7855
7839
  };
7856
7840
  }
7857
- function resolveLiveBusEmitter(liveEmitter4, entry) {
7858
- const resolution = liveEmitter4.resolve();
7841
+ function resolveLiveBusEmitter(liveEmitter5, entry) {
7842
+ const resolution = liveEmitter5.resolve();
7859
7843
  if (resolution.outcome === "stale-session") {
7860
7844
  logBusEvent({
7861
7845
  ...entry(),
@@ -7866,12 +7850,117 @@ function resolveLiveBusEmitter(liveEmitter4, entry) {
7866
7850
  }
7867
7851
  return resolution;
7868
7852
  }
7853
+ function createBusPublisher(liveEmitter5, options) {
7854
+ let failureLogged = false;
7855
+ let unwiredLogged = false;
7856
+ let disabledLogged = false;
7857
+ return {
7858
+ publish(call) {
7859
+ const { event } = call;
7860
+ let normalized;
7861
+ const cwd = () => {
7862
+ normalized ??= normalizeFilePath(call.cwd);
7863
+ return normalized;
7864
+ };
7865
+ const extra = call.extra ?? {};
7866
+ if (call.enabled === false) {
7867
+ if (!disabledLogged) {
7868
+ disabledLogged = true;
7869
+ logBusEvent({
7870
+ event,
7871
+ outcome: "skipped_disabled",
7872
+ cwd: cwd(),
7873
+ ...extra
7874
+ });
7875
+ }
7876
+ return;
7877
+ }
7878
+ call.whenEnabled?.();
7879
+ const resolution = resolveLiveBusEmitter(liveEmitter5, () => ({
7880
+ event,
7881
+ cwd: cwd(),
7882
+ ...extra
7883
+ }));
7884
+ if (resolution.outcome === "stale-session")
7885
+ return;
7886
+ if (resolution.outcome === "unwired") {
7887
+ if (!unwiredLogged) {
7888
+ unwiredLogged = true;
7889
+ if (options.onUnwired)
7890
+ options.onUnwired(event);
7891
+ else {
7892
+ logBusEvent({
7893
+ event,
7894
+ outcome: "skipped_unwired",
7895
+ cwd: cwd(),
7896
+ ...extra
7897
+ });
7898
+ }
7899
+ }
7900
+ return;
7901
+ }
7902
+ try {
7903
+ const payload = call.build(cwd());
7904
+ resolution.emit(event, payload);
7905
+ failureLogged = false;
7906
+ logBusEvent({
7907
+ event,
7908
+ outcome: "emitted",
7909
+ cwd: cwd(),
7910
+ ...extra,
7911
+ ...call.emittedFields?.(payload)
7912
+ });
7913
+ } catch (err) {
7914
+ logBusEvent({
7915
+ event,
7916
+ outcome: "emit_failed",
7917
+ cwd: cwd(),
7918
+ ...extra,
7919
+ error: String(err),
7920
+ ctxSource: resolution.ctxSource
7921
+ });
7922
+ if (!failureLogged) {
7923
+ failureLogged = true;
7924
+ recordStaleBusFailure(event, err);
7925
+ call.dbg?.(`${options.module}: ${event} emit failed (further failures suppressed): ${err}`);
7926
+ }
7927
+ }
7928
+ },
7929
+ reset() {
7930
+ failureLogged = false;
7931
+ unwiredLogged = false;
7932
+ disabledLogged = false;
7933
+ }
7934
+ };
7935
+ }
7869
7936
 
7870
7937
  // dist/clients/bus-publish.js
7871
7938
  var liveEmitter = createLiveBusEmitter();
7939
+ var publisher = createBusPublisher(liveEmitter, {
7940
+ module: "bus-publish"
7941
+ });
7942
+ var _envCache;
7943
+ function isBusPublishEnabled() {
7944
+ if (_envCache === void 0) {
7945
+ _envCache = process.env.PI_LENS_BUS_PUBLISH !== "0";
7946
+ }
7947
+ return _envCache;
7948
+ }
7872
7949
 
7873
7950
  // dist/clients/format-events-publish.js
7874
7951
  var liveEmitter2 = createLiveBusEmitter();
7952
+ var queuedPublisher = createBusPublisher(liveEmitter2, {
7953
+ module: "format-events-publish"
7954
+ });
7955
+ var startPublisher = createBusPublisher(liveEmitter2, {
7956
+ module: "format-events-publish"
7957
+ });
7958
+ var donePublisher = createBusPublisher(liveEmitter2, {
7959
+ module: "format-events-publish"
7960
+ });
7961
+ var autofixStartPublisher = createBusPublisher(liveEmitter2, {
7962
+ module: "format-events-publish"
7963
+ });
7875
7964
 
7876
7965
  // dist/clients/mutation-bridge.js
7877
7966
  var MUTATION_BRIDGE_KEY = /* @__PURE__ */ Symbol.for("pi-lens:mutation-bridge");
@@ -7989,6 +8078,7 @@ function bookkeepLspMutation(context, files2, fileDetails) {
7989
8078
  context.dbg?.(`lsp mutation not recordable, skipping ${filePath}`);
7990
8079
  continue;
7991
8080
  }
8081
+ let accepted = true;
7992
8082
  if (sessionLive && context.readGuard) {
7993
8083
  try {
7994
8084
  context.readGuard.recordWritten(filePath, {
@@ -8010,6 +8100,7 @@ function bookkeepLspMutation(context, files2, fileDetails) {
8010
8100
  if (useBridgeFallback) {
8011
8101
  const bridge = getMutationBridge();
8012
8102
  if (!bridge) {
8103
+ accepted = false;
8013
8104
  recordDegradationOnce({
8014
8105
  kind: "lsp-mutation-bridge-unmounted",
8015
8106
  subject: "lsp-mutation:no-bridge",
@@ -8054,9 +8145,11 @@ function bookkeepLspMutation(context, files2, fileDetails) {
8054
8145
  }
8055
8146
  });
8056
8147
  if (!recorded) {
8148
+ accepted = false;
8057
8149
  context.dbg?.(`lsp mutation bridge dropped ${filePath} (recordMutation() returned false \u2014 see the mutation_bridge debug output for the reason: malformed entry, out-of-scope path, or a bookkeeping error)`);
8058
8150
  }
8059
8151
  } catch (err) {
8152
+ accepted = false;
8060
8153
  context.dbg?.(`lsp mutation bridge fallback failed for ${filePath}: ${err}`);
8061
8154
  }
8062
8155
  }
@@ -8108,6 +8201,8 @@ function bookkeepLspMutation(context, files2, fileDetails) {
8108
8201
  context.recordAutofix(filePath);
8109
8202
  }
8110
8203
  }
8204
+ if (accepted && context.acceptedFiles && !context.acceptedFiles.includes(filePath))
8205
+ context.acceptedFiles.push(filePath);
8111
8206
  }
8112
8207
  if (context.publishFilesTouched && files2.length > 0) {
8113
8208
  context.publishFilesTouched(files2);
@@ -8347,6 +8442,25 @@ function serverIdsForConfigFile(filePath) {
8347
8442
  return CONFIG_FILE_SERVERS.get(basename(filePath));
8348
8443
  }
8349
8444
 
8445
+ // dist/clients/lsp/request-timeout-error.js
8446
+ var timeoutBrand = /* @__PURE__ */ Symbol.for("pi-lens.LspRequestTimeoutError");
8447
+ var LspRequestTimeoutError = class extends Error {
8448
+ [timeoutBrand] = true;
8449
+ method;
8450
+ timeoutMs;
8451
+ elapsedMs;
8452
+ constructor(method, timeoutMs, elapsedMs) {
8453
+ super(`LSP request timed out: ${method} after ${elapsedMs}ms`);
8454
+ this.name = "LspRequestTimeoutError";
8455
+ this.method = method;
8456
+ this.timeoutMs = timeoutMs;
8457
+ this.elapsedMs = elapsedMs;
8458
+ }
8459
+ };
8460
+ function isLspRequestTimeoutError(err) {
8461
+ return err?.[timeoutBrand] === true;
8462
+ }
8463
+
8350
8464
  // dist/clients/lsp/grouping.js
8351
8465
  function aggregateServersForFile(filePath) {
8352
8466
  return getServersForFileWithConfig(filePath).flatMap((s) => isOptInAuxiliaryServerId(s.id) ? [] : [s]);
@@ -8523,7 +8637,7 @@ function resyncDocumentOnPastEof(filePath) {
8523
8637
  void (async () => {
8524
8638
  try {
8525
8639
  const [{ getOwnedLspService: getOwnedLspService2 }, content] = await Promise.all([
8526
- import("./chunk-CM73PPGD.js"),
8640
+ import("./chunk-MN635QYA.js"),
8527
8641
  fs7.promises.readFile(filePath, "utf-8")
8528
8642
  ]);
8529
8643
  await getOwnedLspService2().openFile(filePath, content, { preserveDiagnostics: false });
@@ -8578,6 +8692,48 @@ var WriteOrderingGuard = class {
8578
8692
  }
8579
8693
  };
8580
8694
 
8695
+ // dist/clients/inline-blocker-fields.js
8696
+ function inlineBlockerSourceOf(diagnostic) {
8697
+ return diagnostic.tool?.trim() || "unknown";
8698
+ }
8699
+ function inlineBlockerSources(blockers) {
8700
+ return [...new Set(blockers.map(inlineBlockerSourceOf))];
8701
+ }
8702
+ function inlineBlockerLines(blockers, filePath) {
8703
+ return inlineBlockerPlaces(blockers, filePath).map((place) => place.line);
8704
+ }
8705
+ function isCrossFileBlocker(d, filePath) {
8706
+ return !!d.filePath && normalizeEphemeralMapKey(d.filePath) !== normalizeEphemeralMapKey(filePath);
8707
+ }
8708
+ function inlineBlockerPlacement(blockers, filePath) {
8709
+ const places = [];
8710
+ let movedLine = 0;
8711
+ for (const d of blockers) {
8712
+ if (isCrossFileBlocker(d, filePath))
8713
+ continue;
8714
+ if (typeof d.line !== "number")
8715
+ continue;
8716
+ if (d.positionStale) {
8717
+ movedLine += 1;
8718
+ continue;
8719
+ }
8720
+ places.push({
8721
+ line: d.line,
8722
+ rule: d.rule?.trim() || inlineBlockerSourceOf(d)
8723
+ });
8724
+ }
8725
+ return {
8726
+ places,
8727
+ unplaced: {
8728
+ movedLine,
8729
+ noLineInThisFile: blockers.length - places.length - movedLine
8730
+ }
8731
+ };
8732
+ }
8733
+ function inlineBlockerPlaces(blockers, filePath) {
8734
+ return inlineBlockerPlacement(blockers, filePath).places;
8735
+ }
8736
+
8581
8737
  // dist/clients/diagnostic-dispositions.js
8582
8738
  import * as fs8 from "node:fs";
8583
8739
  import * as path9 from "node:path";
@@ -8596,6 +8752,9 @@ var writer2 = createNdjsonLogger({
8596
8752
 
8597
8753
  // dist/clients/disposition-publish.js
8598
8754
  var liveEmitter3 = createLiveBusEmitter();
8755
+ var publisher2 = createBusPublisher(liveEmitter3, {
8756
+ module: "disposition-publish"
8757
+ });
8599
8758
 
8600
8759
  // dist/clients/diagnostic-dispositions.js
8601
8760
  var deferredByCwd = /* @__PURE__ */ new Map();
@@ -8821,6 +8980,83 @@ async function dropStaleFiles(widget, savedAt) {
8821
8980
  };
8822
8981
  }
8823
8982
 
8983
+ // dist/clients/diagnostics-publish.js
8984
+ var BUS_DIAGNOSTICS_EVENT = "pilens:diagnostics";
8985
+ var BUS_DIAGNOSTICS_VERSION = 1;
8986
+ var MAX_DIAGNOSTICS_PER_FILE_EVENT = 12;
8987
+ var liveEmitter4 = createLiveBusEmitter();
8988
+ var publisher3 = createBusPublisher(liveEmitter4, {
8989
+ module: "diagnostics-publish"
8990
+ });
8991
+ var seqCounter = 0;
8992
+ var reportedDirtyPaths = /* @__PURE__ */ new Set();
8993
+ function capDiagnostics(diagnostics) {
8994
+ if (diagnostics.length <= MAX_DIAGNOSTICS_PER_FILE_EVENT) {
8995
+ return { capped: diagnostics, truncated: false };
8996
+ }
8997
+ const errors = diagnostics.filter((d) => d.severity === "error");
8998
+ const rest = diagnostics.filter((d) => d.severity !== "error");
8999
+ if (errors.length >= MAX_DIAGNOSTICS_PER_FILE_EVENT) {
9000
+ return {
9001
+ capped: errors.slice(0, MAX_DIAGNOSTICS_PER_FILE_EVENT),
9002
+ truncated: true
9003
+ };
9004
+ }
9005
+ return {
9006
+ capped: [
9007
+ ...errors,
9008
+ ...rest.slice(0, MAX_DIAGNOSTICS_PER_FILE_EVENT - errors.length)
9009
+ ],
9010
+ truncated: true
9011
+ };
9012
+ }
9013
+ function publishDiagnostics(args) {
9014
+ if (args.origin === "bus")
9015
+ return;
9016
+ if (args.files.length === 0)
9017
+ return;
9018
+ publisher3.publish({
9019
+ event: BUS_DIAGNOSTICS_EVENT,
9020
+ enabled: isBusPublishEnabled(),
9021
+ cwd: args.cwd,
9022
+ build: (cwd) => {
9023
+ const fileEntries = args.files.map((f) => {
9024
+ const normPath = normalizeFilePath(f.path);
9025
+ const { capped, truncated } = capDiagnostics(f.diagnostics);
9026
+ if (capped.length > 0) {
9027
+ reportedDirtyPaths.add(normPath);
9028
+ } else {
9029
+ reportedDirtyPaths.delete(normPath);
9030
+ }
9031
+ const entry = {
9032
+ path: normPath,
9033
+ diagnostics: capped
9034
+ };
9035
+ if (truncated)
9036
+ entry.truncated = true;
9037
+ return entry;
9038
+ });
9039
+ seqCounter += 1;
9040
+ return {
9041
+ v: BUS_DIAGNOSTICS_VERSION,
9042
+ source: "pi-lens",
9043
+ cwd,
9044
+ seq: seqCounter,
9045
+ ts: Date.now(),
9046
+ files: fileEntries
9047
+ };
9048
+ },
9049
+ emittedFields: (payload) => ({
9050
+ fileCount: payload.files.length,
9051
+ seq: payload.seq
9052
+ }),
9053
+ dbg: args.dbg
9054
+ });
9055
+ }
9056
+ function wasPreviouslyReportedDirty(path18) {
9057
+ return reportedDirtyPaths.has(normalizeFilePath(path18));
9058
+ }
9059
+
8824
9060
  // dist/clients/widget-state.js
8825
9061
  function fileMapKey(filePath) {
8826
9062
  return normalizeEphemeralMapKey(filePath);
@@ -8959,6 +9195,9 @@ function exportWidgetState() {
8959
9195
  allDiagnostics: rec.allDiagnostics,
8960
9196
  diagnosticCounts: rec.diagnosticCounts,
8961
9197
  hasFinalDiagnosticsSnapshot: rec.hasFinalDiagnosticsSnapshot,
9198
+ ...rec.uncheckedReason !== void 0 && {
9199
+ uncheckedReason: rec.uncheckedReason
9200
+ },
8962
9201
  touchedAt: rec.touchedAt
8963
9202
  }))
8964
9203
  };
@@ -8992,6 +9231,9 @@ function importWidgetState(state4) {
8992
9231
  allDiagnostics: migratedAllDiagnostics,
8993
9232
  diagnosticCounts: countDiagnostics(migratedAllDiagnostics),
8994
9233
  hasFinalDiagnosticsSnapshot: f.hasFinalDiagnosticsSnapshot ?? false,
9234
+ ...typeof f.uncheckedReason === "string" && {
9235
+ uncheckedReason: f.uncheckedReason
9236
+ },
8995
9237
  touchedAt: recordTouchedAt
8996
9238
  });
8997
9239
  }
@@ -9016,7 +9258,31 @@ var widgetStore = defineSessionStore({
9016
9258
  if (!state4?.files)
9017
9259
  return { itemsIn: 0, itemsKept: 0 };
9018
9260
  const fresh = await dropStaleFiles(state4, ctx.savedAt);
9261
+ if (!_scope.isLive())
9262
+ return { itemsIn: state4.files.length, itemsKept: 0 };
9019
9263
  importWidgetState(fresh);
9264
+ const files2 = getFileDiagnosticSummaries().map((f) => ({
9265
+ filePath: f.filePath,
9266
+ diagnostics: f.diagnostics.flatMap((d) => {
9267
+ const tier = classifyDiagnosticTier(d);
9268
+ if (d.stale === true || tier === void 0)
9269
+ return [];
9270
+ return [
9271
+ {
9272
+ severity: tier === "advisory" ? d.severity === "info" ? "info" : "hint" : tier,
9273
+ message: d.message,
9274
+ tool: d.tool ?? "unknown",
9275
+ ...d.rule !== void 0 && { ruleId: d.rule },
9276
+ ...d.line !== void 0 && { line: d.line },
9277
+ ...d.col !== void 0 && { col: d.col }
9278
+ }
9279
+ ];
9280
+ })
9281
+ }));
9282
+ publishDiagnostics({
9283
+ cwd: ctx.cwd,
9284
+ files: files2.filter((f) => f.diagnostics.length > 0 || wasPreviouslyReportedDirty(f.filePath)).map((f) => ({ path: f.filePath, diagnostics: f.diagnostics }))
9285
+ });
9020
9286
  return { itemsIn: state4.files.length, itemsKept: fresh.files.length };
9021
9287
  },
9022
9288
  reset: () => clearWidgetState(),
@@ -9045,7 +9311,7 @@ function widgetDiagnosticUri(filePath, line, column) {
9045
9311
  const base = pathToFileURL(filePath).href;
9046
9312
  return line != null ? `${base}#L${line}${column != null ? `:${column}` : ""}` : base;
9047
9313
  }
9048
- function recordDiagnostics(filePath, diagnostics, writeIndex, observedAt) {
9314
+ function recordDiagnostics(filePath, diagnostics, writeIndex, observedAt, unchecked) {
9049
9315
  const key = fileMapKey(filePath);
9050
9316
  if (!diagnosticsWriteGuard.shouldWrite(key, writeIndex))
9051
9317
  return false;
@@ -9053,6 +9319,10 @@ function recordDiagnostics(filePath, diagnostics, writeIndex, observedAt) {
9053
9319
  const observedTs = observedAt ?? Date.now();
9054
9320
  const rec = getOrCreate(filePath, key);
9055
9321
  commitDiagnostics(rec, filePath, normalizeDiagnostics(filePath, diagnostics, observedTs), observedTs, key);
9322
+ if (unchecked === void 0)
9323
+ delete rec.uncheckedReason;
9324
+ else
9325
+ rec.uncheckedReason = unchecked;
9056
9326
  return true;
9057
9327
  }
9058
9328
  function normalizeDiagnostics(filePath, diagnostics, observedTs) {
@@ -9067,7 +9337,8 @@ function normalizeDiagnostics(filePath, diagnostics, observedTs) {
9067
9337
  rule,
9068
9338
  tool: d.tool,
9069
9339
  uri: widgetDiagnosticUri(filePath, d.line, d.column),
9070
- observedAt: observedTs
9340
+ observedAt: observedTs,
9341
+ ...d.filePath !== void 0 && isCrossFileBlocker(d, filePath) ? { citedFile: d.filePath } : {}
9071
9342
  };
9072
9343
  });
9073
9344
  }
@@ -9213,7 +9484,8 @@ function reconcileCorrelatedScanDiagnostics(filePath, diagnostics, writeIndex, o
9213
9484
  ...diagnostic,
9214
9485
  observedAt: diagnostic.observedAt ?? observedTs
9215
9486
  }));
9216
- commitDiagnostics(getOrCreate(filePath, key), filePath, correlated, observedTs, key);
9487
+ const rec = getOrCreate(filePath, key);
9488
+ commitDiagnostics(rec, filePath, correlated, observedTs, key);
9217
9489
  }
9218
9490
  async function reconcileStaleWidgetFiles(onStaleFile) {
9219
9491
  const entries = [...files.entries()];
@@ -9426,6 +9698,28 @@ function getFileDiagnostics(filePath) {
9426
9698
  applyPastEofGate(rec);
9427
9699
  return rec.allDiagnostics.map((d) => ({ ...d }));
9428
9700
  }
9701
+ function citedRowKey(row) {
9702
+ return JSON.stringify([
9703
+ normalizeEphemeralMapKey(row.citedFile ?? ""),
9704
+ row.line ?? null,
9705
+ findingIdentity(row)
9706
+ ]);
9707
+ }
9708
+ function retireWidgetCitedRows(filePath, retired) {
9709
+ const rec = files.get(fileMapKey(filePath));
9710
+ if (!rec)
9711
+ return 0;
9712
+ const gone = new Set(normalizeDiagnostics(filePath, retired, 0).flatMap((row) => row.citedFile === void 0 ? [] : [citedRowKey(row)]));
9713
+ const kept = rec.allDiagnostics.filter((row) => !gone.has(citedRowKey(row)));
9714
+ const dropped = rec.allDiagnostics.length - kept.length;
9715
+ if (dropped === 0)
9716
+ return 0;
9717
+ rec.allDiagnostics = kept;
9718
+ rec.diagnostics = capStoredDiagnostics(kept);
9719
+ rec.diagnosticCounts = countDiagnostics(kept);
9720
+ requestRender();
9721
+ return dropped;
9722
+ }
9429
9723
  function recordLsp(serverId, root, status, durationMs) {
9430
9724
  const normalizedRoot = normalizeMapKey(root);
9431
9725
  const key = `${serverId}@${normalizedRoot}`;
@@ -9580,7 +9874,7 @@ async function raceToCompletion(promises3, shouldComplete, options = { timeoutMs
9580
9874
 
9581
9875
  // dist/clients/lsp/edits.js
9582
9876
  import fs10 from "node:fs/promises";
9583
- import { readFileSync as readFileSync8, realpathSync, statSync as statSync8 } from "node:fs";
9877
+ import { readFileSync as readFileSync8, realpathSync, statSync as statSync7 } from "node:fs";
9584
9878
  import path10 from "node:path";
9585
9879
  import { URL as URL2 } from "node:url";
9586
9880
 
@@ -10011,7 +10305,7 @@ function captureRenameExpectedContent(edit, cwd, requestedAtMs, readTrackedSend,
10011
10305
  try {
10012
10306
  realPath = realpathSync.native(diskPath);
10013
10307
  content = readFileSync8(realPath, "utf-8");
10014
- mtimeMs = statSync8(realPath).mtimeMs;
10308
+ mtimeMs = statSync7(realPath).mtimeMs;
10015
10309
  } catch {
10016
10310
  continue;
10017
10311
  }
@@ -12910,7 +13204,7 @@ async function clientWaitForDiagnostics(state4, filePath, timeoutMs, options = {
12910
13204
  let outcome = await clientRequestPullDiagnostics(state4, filePath, timeoutMs);
12911
13205
  if (outcome.status === "found") {
12912
13206
  logTypeScriptPullSettle(state4, normalizedPath, Date.now() - pullSettleStartedAt, pullSettleSource);
12913
- return;
13207
+ return "answered";
12914
13208
  }
12915
13209
  let sawClean = outcome.status === "clean";
12916
13210
  const strategy = getStrategy(state4.serverId, state4.launchVariant);
@@ -12923,32 +13217,33 @@ async function clientWaitForDiagnostics(state4, filePath, timeoutMs, options = {
12923
13217
  sawClean = true;
12924
13218
  }
12925
13219
  if (options.pullOnly) {
12926
- if (outcome.status === "found" || sawClean) {
13220
+ const answered = outcome.status === "found" || sawClean;
13221
+ if (answered) {
12927
13222
  logTypeScriptPullSettle(state4, normalizedPath, Date.now() - pullSettleStartedAt, pullSettleSource);
12928
13223
  }
12929
- return;
13224
+ return answered ? "answered" : "deadline-expired";
12930
13225
  }
12931
13226
  if (outcome.status === "found" || sawClean) {
12932
13227
  logTypeScriptPullSettle(state4, normalizedPath, Date.now() - pullSettleStartedAt, pullSettleSource);
12933
- return;
13228
+ return "answered";
12934
13229
  }
12935
13230
  }
12936
13231
  const laterReceiptPending = () => state4.pendingDiagnostics.has(normalizedPath);
12937
13232
  const storedAnswerSettles = () => hasFreshDiagnostics() && !isVersionStale() && getMergedDiagnosticsForPath(state4, normalizedPath).length > 0;
12938
13233
  if (storedAnswerSettles() && !laterReceiptPending()) {
12939
- return;
13234
+ return "answered";
12940
13235
  }
12941
13236
  const answerStored = () => hasFreshDiagnostics() && !isVersionStale() && (state4.pushDiagnostics.has(normalizedPath) || state4.documentPullDiagnostics.has(normalizedPath));
12942
13237
  return new Promise((resolve7) => {
12943
13238
  let debounceTimer;
12944
13239
  let settleDeferred = storedAnswerSettles();
12945
- const finish = () => {
13240
+ const finish = (outcome = "answered") => {
12946
13241
  if (debounceTimer)
12947
13242
  clearTimeout(debounceTimer);
12948
13243
  state4.diagnosticEmitter.off("diagnostics", onDiagnostics);
12949
13244
  state4.diagnosticEmitter.off(PENDING_RECEIPT_DROPPED, onReceiptDropped);
12950
13245
  clearTimeout(timeout);
12951
- resolve7();
13246
+ resolve7(outcome);
12952
13247
  };
12953
13248
  const onDiagnostics = (fp) => {
12954
13249
  if (normalizeMapKey(fp) !== normalizedPath)
@@ -12980,7 +13275,7 @@ async function clientWaitForDiagnostics(state4, filePath, timeoutMs, options = {
12980
13275
  };
12981
13276
  state4.diagnosticEmitter.on("diagnostics", onDiagnostics);
12982
13277
  state4.diagnosticEmitter.on(PENDING_RECEIPT_DROPPED, onReceiptDropped);
12983
- const timeout = setTimeout(finish, timeoutMs);
13278
+ const timeout = setTimeout(() => finish(answerStored() ? "answered" : "deadline-expired"), timeoutMs);
12984
13279
  });
12985
13280
  }
12986
13281
  function handleNotifyExternalChange(state4, filePath, type) {
@@ -13156,7 +13451,7 @@ async function handleNotifyOpenOnce(state4, filePath, content, languageId, prese
13156
13451
  });
13157
13452
  }
13158
13453
  enqueueWatchedChange(state4, normalizedPath, uri, watchedType, onDisk);
13159
- if (state4.customServer)
13454
+ if (state4.holdsOwnNoticeEcho)
13160
13455
  noteOwnNoticeQueued(state4, normalizedPath, uri, 0);
13161
13456
  }
13162
13457
  if (!isClientAlive(state4))
@@ -13273,9 +13568,19 @@ function handleNotifySave(state4, filePath, onlyIfOwed = false) {
13273
13568
  const normalizedPath = normalizeMapKey(filePath);
13274
13569
  return enqueueDocumentNotify(state4, normalizedPath, (_count, _saved, debtOnly) => sendDidSaveForHeldDocument(state4, normalizedPath, debtOnly), true, void 0, false, true, onlyIfOwed);
13275
13570
  }
13571
+ function toWireDocument(state4, content, contentHash2) {
13572
+ if (state4.serverId !== "powershell" || content.charCodeAt(0) !== 65279) {
13573
+ return { text: content, contentHash: contentHash2 };
13574
+ }
13575
+ return {
13576
+ text: ` ${content.slice(1)}`,
13577
+ contentHash: contentHash2 ?? hashDiagnosticContent(content)
13578
+ };
13579
+ }
13276
13580
  function handleNotifyOpen(state4, filePath, content, languageId, preserveDiagnostics = false, silent = false, saved = false, readStamp, contentHash2) {
13277
13581
  const normalizedPath = normalizeMapKey(filePath);
13278
- return enqueueDocumentNotify(state4, normalizedPath, (coalescedCount, queuedSaved) => handleNotifyOpenOnce(state4, filePath, content, languageId, preserveDiagnostics, silent, coalescedCount, queuedSaved, contentHash2), saved, readStamp);
13582
+ const wire = toWireDocument(state4, content, contentHash2);
13583
+ return enqueueDocumentNotify(state4, normalizedPath, (coalescedCount, queuedSaved) => handleNotifyOpenOnce(state4, filePath, wire.text, languageId, preserveDiagnostics, silent, coalescedCount, queuedSaved, wire.contentHash), saved, readStamp);
13279
13584
  }
13280
13585
  async function handleNotifyChangeOnce(state4, filePath, content, normalizedPath, coalescedCount = 0, saved = false, contentHash2) {
13281
13586
  if (!isClientAlive(state4))
@@ -13319,7 +13624,8 @@ async function handleNotifyChangeOnce(state4, filePath, content, normalizedPath,
13319
13624
  }
13320
13625
  function handleNotifyChange(state4, filePath, content, contentHash2) {
13321
13626
  const normalizedPath = normalizeMapKey(filePath);
13322
- return enqueueDocumentNotify(state4, normalizedPath, (coalescedCount, queuedSaved) => handleNotifyChangeOnce(state4, filePath, content, normalizedPath, coalescedCount, queuedSaved, contentHash2));
13627
+ const wire = toWireDocument(state4, content, contentHash2);
13628
+ return enqueueDocumentNotify(state4, normalizedPath, (coalescedCount, queuedSaved) => handleNotifyChangeOnce(state4, filePath, wire.text, normalizedPath, coalescedCount, queuedSaved, wire.contentHash));
13323
13629
  }
13324
13630
  async function closedAndGone(state4, filePath, normalizedPath) {
13325
13631
  if (!state4.closedDocuments?.has(normalizedPath))
@@ -13510,10 +13816,10 @@ async function navRequest(state4, method, params, staleCheckPath, timeoutMs = NA
13510
13816
  scope: normalizedPath,
13511
13817
  requestStartedAt
13512
13818
  });
13513
- return void 0;
13819
+ throw new LspRequestTimeoutError(method, timeoutMs, Date.now() - requestStartedAt);
13514
13820
  }
13515
13821
  if (err instanceof Error && err.message.startsWith("Timeout after")) {
13516
- return void 0;
13822
+ throw new LspRequestTimeoutError(method, timeoutMs, Date.now() - requestStartedAt);
13517
13823
  }
13518
13824
  throw err;
13519
13825
  });
@@ -13783,7 +14089,7 @@ function hasNotifyInFlightFor(state4, filePath) {
13783
14089
  }
13784
14090
  async function createLSPClient(options) {
13785
14091
  installCrashGuard();
13786
- const { serverId, process: lspProcess, root, sessionCwd, initialization, initializeTimeoutMs = INITIALIZE_TIMEOUT_MS, launchVariant, settingsSection, role, custom, onDiagnosticsPublished } = options;
14092
+ const { serverId, process: lspProcess, root, sessionCwd, initialization, initializeTimeoutMs = INITIALIZE_TIMEOUT_MS, launchVariant, settingsSection, role, custom, echoesOwnNotice, onDiagnosticsPublished } = options;
13787
14093
  void recordLspChild({
13788
14094
  pid: lspProcess.pid,
13789
14095
  serverId,
@@ -13850,7 +14156,9 @@ async function createLSPClient(options) {
13850
14156
  lspProcess.stdin.on("error", streamErrorHandler("stdin"));
13851
14157
  lspProcess.stdout.on("error", streamErrorHandler("stdout"));
13852
14158
  lspProcess.stderr.on("error", streamErrorHandler("stderr"));
13853
- const connection = (0, import_node.createMessageConnection)(new import_node.StreamMessageReader(lspProcess.stdout), new import_node.StreamMessageWriter(lspProcess.stdin));
14159
+ const reader = new import_node.StreamMessageReader(lspProcess.stdout);
14160
+ reader.partialMessageTimeout = 0;
14161
+ const connection = (0, import_node.createMessageConnection)(reader, new import_node.StreamMessageWriter(lspProcess.stdin));
13854
14162
  const diagnosticEmitter = new EventEmitter();
13855
14163
  diagnosticEmitter.setMaxListeners(50);
13856
14164
  const state4 = {
@@ -13896,8 +14204,9 @@ async function createLSPClient(options) {
13896
14204
  // #4764: the declared role, so a config-load failure gates only an
13897
14205
  // auxiliary scanner's empty publications.
13898
14206
  ...role !== void 0 && { serverRole: role },
13899
- // #5131 round 2: the echo hold reads a config-declared server only.
13900
- customServer: custom === true,
14207
+ // #5131 round 2: the echo hold reads a config-declared server, or a
14208
+ // built-in row that declares `echoesOwnNotice`.
14209
+ holdsOwnNoticeEcho: custom === true || echoesOwnNotice === true,
13901
14210
  // #3310: one-shot, per client session.
13902
14211
  emptyFirstPublishHoldSpent: false,
13903
14212
  rulesGeneration: 0,
@@ -15157,7 +15466,7 @@ var ClientRegistry = class {
15157
15466
  */
15158
15467
  async restartPrimaryClientsUnder(root) {
15159
15468
  const rootKey = normalizeMapKey(root);
15160
- const overlaps = (clientRoot) => clientRoot === rootKey || clientRoot.startsWith(`${rootKey}/`) || rootKey.startsWith(`${clientRoot}/`);
15469
+ const overlaps = (clientRoot) => isWithinForm(clientRoot, rootKey) || isWithinForm(rootKey, clientRoot);
15161
15470
  return this.withClientSpawnGate(async () => {
15162
15471
  if (this.isDestroyed)
15163
15472
  return [];
@@ -15456,7 +15765,7 @@ var ClientRegistry = class {
15456
15765
  shouldAllowInstall(serverId) {
15457
15766
  if (!assertInstallAllowed(`lsp install: ${serverId}`))
15458
15767
  return false;
15459
- return process.env.PI_LENS_DISABLE_LSP_INSTALL !== "1";
15768
+ return !isLspInstallDisabled();
15460
15769
  }
15461
15770
  /**
15462
15771
  * Internal: spawn a client for a server/root combination
@@ -15545,8 +15854,10 @@ var ClientRegistry = class {
15545
15854
  // #4764: the declared role travels with the client, so a failed server
15546
15855
  // config can gate an auxiliary scanner's empty publications only.
15547
15856
  role: server.role,
15548
- // #5131 round 2: the config-declared flag gates the echo hold.
15857
+ // #5131 round 2: the config-declared flag gates the echo hold; a
15858
+ // built-in row with the same behaviour declares `echoesOwnNotice`.
15549
15859
  custom: server.custom,
15860
+ echoesOwnNotice: server.echoesOwnNotice,
15550
15861
  onDiagnosticsPublished: (serverId) => {
15551
15862
  this.hooks.noteDiagnosticsPublished(serverId);
15552
15863
  }
@@ -16040,18 +16351,8 @@ function demoteEnvironmentGapDiagnostics(diagnostics, options) {
16040
16351
 
16041
16352
  // dist/clients/lsp/inferred-project.js
16042
16353
  var INFERRED_PROJECT_MARKER = "not in any tsconfig project \u2014 checked with inferred settings";
16043
- var TS_PROJECT_EXTENSIONS = /* @__PURE__ */ new Set([
16044
- ".ts",
16045
- ".tsx",
16046
- ".mts",
16047
- ".cts",
16048
- ".js",
16049
- ".jsx",
16050
- ".mjs",
16051
- ".cjs"
16052
- ]);
16053
16354
  function isTsProjectFile(filePath) {
16054
- return TS_PROJECT_EXTENSIONS.has(path16.extname(filePath).toLowerCase());
16355
+ return isJstsFactFile(filePath);
16055
16356
  }
16056
16357
  function suggestTsconfigInclude(filePath, cwd) {
16057
16358
  const relative2 = toProjectRelativePath(filePath, cwd);
@@ -16192,7 +16493,7 @@ function createLazyImport(load) {
16192
16493
  }
16193
16494
 
16194
16495
  // dist/clients/lsp-lazy.js
16195
- var lazyLsp = createLazyImport(() => import("./chunk-ZONZ6YY3.js"));
16496
+ var lazyLsp = createLazyImport(() => import("./chunk-3QWVOBZJ.js"));
16196
16497
  function warmLspService() {
16197
16498
  return lazyLsp.get();
16198
16499
  }
@@ -16504,11 +16805,11 @@ async function collectWorkspaceDiagnosticFiles(root, maxFiles = getMaxWorkspaceD
16504
16805
  continue;
16505
16806
  await walk(full);
16506
16807
  } else if (
16507
- // #1974: the getServersForFileWithConfig lookup (an in-memory
16508
- // extension/pathFilter match against the registered LSP servers) is
16509
- // cheap relative to isIgnored's per-call minimatch pattern compile,
16510
- // so it gates first — the same order-independent shape as the four
16511
- // walkers fixed for #1974.
16808
+ // #1974: the getServersForFileWithConfig lookup (an extension match
16809
+ // against the registered LSP servers; Bash's pathFilter also reads up
16810
+ // to 4 KB of the file from disk) still gates first, ahead of
16811
+ // isIgnored's per-call minimatch pattern compile — the same
16812
+ // order-independent shape as the four walkers fixed for #1974.
16512
16813
  entry.isFile() && getServersForFileWithConfig(full).length > 0 && !ignoreMatcher.isIgnored(full, false)
16513
16814
  ) {
16514
16815
  files2.push(full);
@@ -17691,7 +17992,7 @@ var LSPService = class _LSPService {
17691
17992
  const separator = key.indexOf(":");
17692
17993
  const serverId = separator >= 0 ? key.slice(0, separator) : key;
17693
17994
  const root = normalizeMapKey(client.root);
17694
- const sameOrNested = root === normalizedCwd || root.startsWith(`${normalizedCwd}/`) || normalizedCwd.startsWith(`${root}/`);
17995
+ const sameOrNested = isWithinForm(root, normalizedCwd) || isWithinForm(normalizedCwd, root);
17695
17996
  if (!sameOrNested)
17696
17997
  continue;
17697
17998
  entries.push({ clientKey: key, serverId, client });
@@ -19030,29 +19331,33 @@ var LSPService = class _LSPService {
19030
19331
  }
19031
19332
  }
19032
19333
  }
19334
+ const isSilentOnCleanServer = (entry) => {
19335
+ try {
19336
+ const snapshot = {
19337
+ serverId: entry.client.serverId,
19338
+ root: entry.client.root,
19339
+ operationSupport: entry.client.getOperationSupport(),
19340
+ workspaceDiagnosticsSupport: entry.client.getWorkspaceDiagnosticsSupport(),
19341
+ customServer: entry.info.custom,
19342
+ diagnosticsPublished: this.state.diagnosticsPublished.has(entry.info.id),
19343
+ diagnosticsUnsupported: this.state.diagnosticsUnsupported.has(entry.info.id),
19344
+ advertisedCommands: entry.client.getAdvertisedCommands(),
19345
+ rawCapabilityKeys: entry.client.getRawCapabilityKeys?.() ?? [],
19346
+ launchVariant: entry.client.getLaunchVariant?.()
19347
+ };
19348
+ return classifyServerWaitTier(entry.client.serverId, snapshot) === "tier3-silent";
19349
+ } catch {
19350
+ return false;
19351
+ }
19352
+ };
19033
19353
  const silentCleanWarmupServers = /* @__PURE__ */ new Set();
19034
19354
  if (options.warmupOverride && (options.warmupAttempt ?? 1) <= 1) {
19035
19355
  for (const entry of spawned) {
19036
19356
  const strategy = getStrategy(entry.client.serverId, entry.client.getLaunchVariant?.());
19037
19357
  if (strategy.workspaceIndexing !== true)
19038
19358
  continue;
19039
- try {
19040
- const snapshot = {
19041
- serverId: entry.client.serverId,
19042
- root: entry.client.root,
19043
- operationSupport: entry.client.getOperationSupport(),
19044
- workspaceDiagnosticsSupport: entry.client.getWorkspaceDiagnosticsSupport(),
19045
- customServer: entry.info.custom,
19046
- diagnosticsPublished: this.state.diagnosticsPublished.has(entry.info.id),
19047
- diagnosticsUnsupported: this.state.diagnosticsUnsupported.has(entry.info.id),
19048
- advertisedCommands: entry.client.getAdvertisedCommands(),
19049
- rawCapabilityKeys: entry.client.getRawCapabilityKeys?.() ?? [],
19050
- launchVariant: entry.client.getLaunchVariant?.()
19051
- };
19052
- if (classifyServerWaitTier(entry.client.serverId, snapshot) === "tier3-silent") {
19053
- silentCleanWarmupServers.add(entry.client.serverId);
19054
- }
19055
- } catch {
19359
+ if (isSilentOnCleanServer(entry)) {
19360
+ silentCleanWarmupServers.add(entry.client.serverId);
19056
19361
  }
19057
19362
  }
19058
19363
  }
@@ -19065,6 +19370,9 @@ var LSPService = class _LSPService {
19065
19370
  strategyWait = strategy.workspaceIndexingWarmWaitMs ?? Math.min(300, strategyWait);
19066
19371
  }
19067
19372
  if (callerCap !== void 0) {
19373
+ if (options.explicitQuery) {
19374
+ return Math.min(Math.max(callerCap, strategyWait > 0 ? strategyWait : 0), RUNTIME_CONFIG.pipeline.lspExplicitQueryMaxWaitMs);
19375
+ }
19068
19376
  if (options.warmupOverride) {
19069
19377
  if (silentCleanWarmupServers.has(serverId)) {
19070
19378
  return Math.min(callerCap, strategyWait > 0 ? strategyWait : callerCap);
@@ -19129,6 +19437,7 @@ var LSPService = class _LSPService {
19129
19437
  });
19130
19438
  const firstContactCutOffServerIds = /* @__PURE__ */ new Set();
19131
19439
  const firstContactErroredServerIds = /* @__PURE__ */ new Set();
19440
+ const expiredWaitServerIds = /* @__PURE__ */ new Set();
19132
19441
  const answeredForThisTouch = (entry) => {
19133
19442
  const baseline = diagnosticBaselines.get(entry.client);
19134
19443
  const currentPathVersion = readPathVersion(entry.client);
@@ -19161,7 +19470,7 @@ var LSPService = class _LSPService {
19161
19470
  const serverTimeout = perServerWaitTimeouts[entryIndex];
19162
19471
  const baseline = diagnosticBaselines.get(entry.client);
19163
19472
  const pullOnly = classifyServerWaitTier(entry.client.serverId, pressureSnapshots.find((snapshot) => snapshot.serverId === entry.client.serverId)) === "pull-capable";
19164
- const waitForDiagnostics = () => !notifySkippedServerIds.has(entry.info.id) && Number.isFinite(baseline) ? entry.client.waitForDiagnostics(filePath, serverTimeout, {
19473
+ const waitForDiagnostics = () => (!notifySkippedServerIds.has(entry.info.id) && Number.isFinite(baseline) ? entry.client.waitForDiagnostics(filePath, serverTimeout, {
19165
19474
  minVersion: baseline,
19166
19475
  ...pullOnly && { pullOnly: true },
19167
19476
  ...isWarmupTouch && { pullSettleSource: "pull-warmup" }
@@ -19170,7 +19479,12 @@ var LSPService = class _LSPService {
19170
19479
  ...isWarmupTouch && { pullSettleSource: "pull-warmup" }
19171
19480
  }) : isWarmupTouch ? entry.client.waitForDiagnostics(filePath, serverTimeout, {
19172
19481
  pullSettleSource: "pull-warmup"
19173
- }) : entry.client.waitForDiagnostics(filePath, serverTimeout);
19482
+ }) : entry.client.waitForDiagnostics(filePath, serverTimeout)).then((outcome) => {
19483
+ if (outcome === "deadline-expired" && !isAuxiliary(entry.info) && !isSilentOnCleanServer(entry)) {
19484
+ expiredWaitServerIds.add(entry.info.id);
19485
+ }
19486
+ return outcome;
19487
+ });
19174
19488
  const firstContact = entry.info.custom === true && !this.state.diagnosticsPublished.has(entry.info.id) && !this.state.diagnosticsUnsupported.has(entry.info.id) && entry.client.getWorkspaceDiagnosticsSupport().mode !== "pull";
19175
19489
  if (!firstContact)
19176
19490
  return waitForDiagnostics().catch(() => void 0);
@@ -19442,7 +19756,7 @@ var LSPService = class _LSPService {
19442
19756
  savedVsBudgetMs: Math.max(0, timeoutMs - waitedMs)
19443
19757
  }
19444
19758
  });
19445
- } else if (waitedMs + 20 >= timeoutMs || firstContactErroredServerIds.size > 0) {
19759
+ } else if (waitedMs + 20 >= timeoutMs || firstContactErroredServerIds.size > 0 || expiredWaitServerIds.size > 0) {
19446
19760
  const waited = spawned.filter((entry) => !deferredResyncServerIds.has(entry.info.id) && !diagnosticsUnsupportedServerIds.includes(entry.info.id));
19447
19761
  const unanswered2 = waited.filter((entry) => !answeredForThisTouch(entry));
19448
19762
  diagnosticsUnansweredServerIds = unanswered2.map((e) => e.info.id);
@@ -20038,14 +20352,15 @@ var LSPService = class _LSPService {
20038
20352
  const waitStart = Date.now();
20039
20353
  const launchVariant = entry.client.getLaunchVariant?.();
20040
20354
  const strategy = getStrategy(entry.info.id, launchVariant);
20041
- await entry.client.waitForDiagnostics(filePath, strategy.aggregateWaitMs);
20355
+ let outcome = await entry.client.waitForDiagnostics(filePath, strategy.aggregateWaitMs);
20042
20356
  let diagnostics = entry.client.getDiagnostics(filePath);
20043
20357
  const firstWaitMs = Date.now() - waitStart;
20044
20358
  if (strategy.expectSemanticSecondPush && diagnostics.length === 0 && firstWaitMs < DIAGNOSTICS_SEMANTIC_SETTLE_THRESHOLD_MS) {
20045
- await entry.client.waitForDiagnostics(filePath, DIAGNOSTICS_SEMANTIC_SETTLE_WAIT_MS);
20359
+ outcome = await entry.client.waitForDiagnostics(filePath, DIAGNOSTICS_SEMANTIC_SETTLE_WAIT_MS);
20046
20360
  diagnostics = entry.client.getDiagnostics(filePath);
20047
20361
  }
20048
20362
  return {
20363
+ answered: outcome === "answered" || diagnostics.length > 0,
20049
20364
  serverId: entry.info.id,
20050
20365
  launchVariant,
20051
20366
  waitMs: Date.now() - waitStart,
@@ -20074,6 +20389,7 @@ var LSPService = class _LSPService {
20074
20389
  const perServerFull = spawned.map((entry) => {
20075
20390
  const found = perServer.find((r) => r.serverId === entry.info.id);
20076
20391
  return found ?? {
20392
+ answered: false,
20077
20393
  serverId: entry.info.id,
20078
20394
  launchVariant: entry.client.getLaunchVariant?.(),
20079
20395
  waitMs: getStrategy(entry.info.id, entry.client.getLaunchVariant?.()).aggregateWaitMs,
@@ -20083,7 +20399,10 @@ var LSPService = class _LSPService {
20083
20399
  });
20084
20400
  const merged = [];
20085
20401
  const seen = /* @__PURE__ */ new Set();
20402
+ let answeredCount = 0;
20086
20403
  for (const entry of perServerFull) {
20404
+ if (entry.answered)
20405
+ answeredCount++;
20087
20406
  for (const diagnostic of entry.diagnostics) {
20088
20407
  const key = [
20089
20408
  diagnostic.range.start.line,
@@ -20098,12 +20417,15 @@ var LSPService = class _LSPService {
20098
20417
  }
20099
20418
  const rawCount = perServerFull.reduce((sum, entry) => sum + entry.diagnosticCount, 0);
20100
20419
  const serversWithDiagnostics = perServerFull.filter((entry) => entry.diagnosticCount > 0).length;
20101
- const failureKind = merged.length === 0 ? "ok_empty" : "success";
20102
20420
  const unanswered = unansweredPrimaries(spawned, resolvedPrimaryRoots, filePath);
20103
20421
  const unavailablePrimaryServerIds = unanswered.serverIds;
20422
+ const timedOut = answeredCount === 0;
20423
+ const partialTimeout = answeredCount > 0 && answeredCount < spawned.length;
20424
+ const failureKind = timedOut ? "timeout" : merged.length === 0 ? "ok_empty" : "success";
20104
20425
  this.lastDiagnosticsHealth.set(normalizedPath, {
20105
20426
  health: failureKind === "success" ? "ok" : "ok_empty",
20106
20427
  failureKind,
20428
+ partialTimeout,
20107
20429
  serverCountAttempted,
20108
20430
  serverCountReady: perServerFull.length,
20109
20431
  candidateServerIds,
@@ -20132,6 +20454,7 @@ var LSPService = class _LSPService {
20132
20454
  earlyUnblockedCount,
20133
20455
  diagnosticsMode,
20134
20456
  failureKind,
20457
+ partialTimeout,
20135
20458
  health: failureKind === "success" ? "ok" : "ok_empty",
20136
20459
  servers: perServerFull.map((entry) => ({
20137
20460
  id: entry.serverId,
@@ -20146,7 +20469,7 @@ var LSPService = class _LSPService {
20146
20469
  });
20147
20470
  if (merged.length > 0) {
20148
20471
  this.lastKnownDiagnostics.set(normalizedPath, merged);
20149
- } else {
20472
+ } else if (!timedOut && !partialTimeout) {
20150
20473
  this.lastKnownDiagnostics.delete(normalizedPath);
20151
20474
  }
20152
20475
  this.lastKnownContentHash.delete(normalizedPath);
@@ -20613,6 +20936,8 @@ var LSPService = class _LSPService {
20613
20936
  const priorityServerIds = getServersForFileWithConfig(oldFilePath).map((server) => server.id);
20614
20937
  const activeClients = this.activeClientsForCwd(cwd, priorityServerIds);
20615
20938
  const willRenameFailures = [];
20939
+ let firstTimeout;
20940
+ let allWillRenameTimedOut = true;
20616
20941
  const didRenameFailures = [];
20617
20942
  const willRenameClients = activeClients.filter(({ serverId, client }) => {
20618
20943
  if (client.getOperationSupport().willRenameFiles === true)
@@ -20634,6 +20959,11 @@ var LSPService = class _LSPService {
20634
20959
  failed: false
20635
20960
  };
20636
20961
  } catch (err) {
20962
+ const timeout = isLspRequestTimeoutError(err) ? err : void 0;
20963
+ if (timeout && !firstTimeout)
20964
+ firstTimeout = timeout;
20965
+ if (!timeout)
20966
+ allWillRenameTimedOut = false;
20637
20967
  willRenameFailures.push({
20638
20968
  serverId,
20639
20969
  error: err instanceof Error ? err.message : String(err)
@@ -20643,6 +20973,8 @@ var LSPService = class _LSPService {
20643
20973
  }));
20644
20974
  const successfulWillResults = willResults.filter((result) => !result.failed);
20645
20975
  if (willRenameClients.length > 0 && successfulWillResults.length === 0) {
20976
+ if (firstTimeout && allWillRenameTimedOut)
20977
+ throw firstTimeout;
20646
20978
  throw new Error(`workspace/willRenameFiles failed for all active LSP servers: ${willRenameFailures.map((failure) => `${failure.serverId}: ${failure.error}`).join("; ")}`);
20647
20979
  }
20648
20980
  const merged = mergeWorkspaceTextEditsByPriority(successfulWillResults);
@@ -21971,8 +22303,8 @@ export {
21971
22303
  drainPendingAuxCapEvictedCount,
21972
22304
  recordNapiFallbackCoverage,
21973
22305
  resetPendingAuxiliaryCoverage,
21974
- clearAllSessions,
21975
22306
  PartialApplyRecordStore,
22307
+ clearAllSessions,
21976
22308
  getActiveSessionId,
21977
22309
  beginScope,
21978
22310
  retireScope,
@@ -21983,10 +22315,8 @@ export {
21983
22315
  ReadGuard,
21984
22316
  resetOpaqueMutationState,
21985
22317
  resetObservedMutationNet,
21986
- logBusEvent,
21987
- recordStaleBusFailure,
21988
22318
  createLiveBusEmitter,
21989
- resolveLiveBusEmitter,
22319
+ createBusPublisher,
21990
22320
  getMutationBridge,
21991
22321
  resetLspMutationNoBridgeDbgLatch,
21992
22322
  newLspMutationCorrelationId,
@@ -22000,6 +22330,8 @@ export {
22000
22330
  warmAnswerBinding,
22001
22331
  readBoundToCurrentDisk,
22002
22332
  SERVER_CONFIG_FILE_NAMES,
22333
+ LspRequestTimeoutError,
22334
+ isLspRequestTimeoutError,
22003
22335
  groupFilesByPrimaryServer,
22004
22336
  runPerServerGroups,
22005
22337
  STALE_LINE_MARKER,
@@ -22009,6 +22341,10 @@ export {
22009
22341
  Text,
22010
22342
  writeOrderToken,
22011
22343
  WriteOrderingGuard,
22344
+ inlineBlockerSourceOf,
22345
+ inlineBlockerSources,
22346
+ inlineBlockerLines,
22347
+ isCrossFileBlocker,
22012
22348
  anchorsForDiagnostic,
22013
22349
  hasAnyDispositionMarks,
22014
22350
  hasStrictDispositionMarks,
@@ -22035,6 +22371,7 @@ export {
22035
22371
  getFileDiagnosticSummaries,
22036
22372
  getSuppressedDiagnostics,
22037
22373
  countRetainedSuppressedRows,
22374
+ retireWidgetCitedRows,
22038
22375
  captureRenameExpectedContent,
22039
22376
  summarizeWorkspaceEdit,
22040
22377
  applyWorkspaceEdit,