pi-lens 4.4.11 → 4.5.0

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 (162) hide show
  1. package/CHANGELOG-USER.md +12 -12
  2. package/CHANGELOG.md +202 -0
  3. package/README.md +104 -217
  4. package/dist/{chunk-34RXPR7M.js → chunk-27JQHK7Y.js} +1 -1
  5. package/dist/{chunk-W6VLB6LL.js → chunk-2APSZHHI.js} +61 -3
  6. package/dist/{chunk-NLRKB32C.js → chunk-2H5GHZKC.js} +8 -8
  7. package/dist/{chunk-BJDB7PXU.js → chunk-2H7NFZ4Q.js} +11 -11
  8. package/dist/{chunk-OC4ZGVMH.js → chunk-37IDWT6O.js} +65 -19
  9. package/dist/{chunk-A4HKPAEN.js → chunk-3PAS2ERX.js} +8 -8
  10. package/dist/{chunk-DNB4ZQGN.js → chunk-3PO4YYOX.js} +9 -17
  11. package/dist/{chunk-SQBDX6IO.js → chunk-3QXFUP6T.js} +11 -11
  12. package/dist/{chunk-YVPB5YGO.js → chunk-3TSMQZG6.js} +32 -11
  13. package/dist/{chunk-3C6ZZAB2.js → chunk-4DAHGU3V.js} +16 -17
  14. package/dist/{chunk-BN36MQW5.js → chunk-4IZZEN63.js} +33 -36
  15. package/dist/{chunk-OYXD2MOM.js → chunk-5HBQL7DH.js} +2 -2
  16. package/dist/{chunk-B4FAFEBP.js → chunk-5JB4WENL.js} +1 -1
  17. package/dist/chunk-5YJXF2IS.js +56 -0
  18. package/dist/{chunk-AVOUHMCS.js → chunk-6CFSDLHE.js} +22 -18
  19. package/dist/{chunk-C4ICGFEO.js → chunk-6E5QLMWI.js} +24 -22
  20. package/dist/{chunk-WBXCIRVI.js → chunk-6GLMMGCX.js} +2 -2
  21. package/dist/{chunk-C2REOMPO.js → chunk-74AMPWNC.js} +2 -2
  22. package/dist/{chunk-K2GV34T2.js → chunk-7CLWC2UH.js} +26 -37
  23. package/dist/{chunk-NQFXN5U7.js → chunk-7DPXUPRF.js} +2 -2
  24. package/dist/{chunk-QAM2Q3VO.js → chunk-7U36VQL6.js} +2 -2
  25. package/dist/{chunk-2SD2CGVH.js → chunk-7WKVCZI4.js} +1 -1
  26. package/dist/{chunk-R2VUZZPJ.js → chunk-7ZVTFLCC.js} +10 -10
  27. package/dist/{chunk-IT7MFVGP.js → chunk-ADYQRETD.js} +2 -2
  28. package/dist/{chunk-532X3OCZ.js → chunk-ARTYCUGF.js} +28 -15
  29. package/dist/{chunk-DBAHJFBU.js → chunk-AXAR5ZW2.js} +228 -112
  30. package/dist/{chunk-KNP4ENFT.js → chunk-AZG5UJYY.js} +1 -1
  31. package/dist/{chunk-ITAPXBIB.js → chunk-B2OXE4AH.js} +60 -21
  32. package/dist/{chunk-PSUXESQ5.js → chunk-B42AIWPJ.js} +2 -2
  33. package/dist/{chunk-AJ62EQIQ.js → chunk-BBSDJTOV.js} +18 -16
  34. package/dist/{chunk-R2UF54ON.js → chunk-BKWFDWYM.js} +16 -16
  35. package/dist/{chunk-ZD4KVFXI.js → chunk-C5PLBTNR.js} +172 -3
  36. package/dist/{chunk-SRXYSLMW.js → chunk-CQY2HEH7.js} +1 -1
  37. package/dist/{chunk-7424ANRU.js → chunk-CXQYK4YT.js} +1 -1
  38. package/dist/{chunk-WXMUGUZV.js → chunk-CZJGAOKL.js} +8 -7
  39. package/dist/{chunk-QUZYRDT6.js → chunk-DCA2MXVQ.js} +11 -11
  40. package/dist/{chunk-HASJPQBC.js → chunk-DFKOA74L.js} +9 -9
  41. package/dist/{chunk-AYDE7RFV.js → chunk-DI4AZZNY.js} +2 -2
  42. package/dist/{chunk-GL6J5R34.js → chunk-G53LBDNU.js} +99 -5
  43. package/dist/chunk-GCSDF5IE.js +27 -0
  44. package/dist/{chunk-KBSC5Z3G.js → chunk-H5API74E.js} +6 -6
  45. package/dist/chunk-HBX55MWO.js +27 -0
  46. package/dist/{chunk-6RXMQYNU.js → chunk-HIJ4CHFF.js} +2 -2
  47. package/dist/{chunk-NWK7KKNO.js → chunk-HIRBC72R.js} +4 -4
  48. package/dist/{chunk-4WWPDMRA.js → chunk-HRLF35WL.js} +8 -8
  49. package/dist/{chunk-NR4KQOXZ.js → chunk-I2FYOZNW.js} +9 -9
  50. package/dist/{chunk-VDMF7Q2P.js → chunk-I3NZVAMN.js} +9 -9
  51. package/dist/{chunk-DPDA3ILA.js → chunk-INBK3HIT.js} +3 -3
  52. package/dist/{chunk-VI3BJMZO.js → chunk-J2ZB5MDS.js} +22 -24
  53. package/dist/{chunk-6XNVY3FW.js → chunk-JGUDT5KD.js} +4 -4
  54. package/dist/chunk-JOIKBUQN.js +88 -0
  55. package/dist/{chunk-VTXJAO5R.js → chunk-K4Z7MK6T.js} +169 -165
  56. package/dist/{chunk-GTNO6F6K.js → chunk-K7O6AHSJ.js} +10 -10
  57. package/dist/{chunk-WMCAEP2K.js → chunk-KNJH6WJQ.js} +6 -6
  58. package/dist/{chunk-SUIZOCSY.js → chunk-KNSOA43J.js} +1 -1
  59. package/dist/{chunk-OP5BMZKK.js → chunk-KXGTLAUW.js} +2 -2
  60. package/dist/{chunk-BLL4VYGZ.js → chunk-KZ732ZVW.js} +1 -1
  61. package/dist/{chunk-TRYOYWWU.js → chunk-L6BDRYUK.js} +19 -17
  62. package/dist/{chunk-FVEEEEIM.js → chunk-LGH2HHZG.js} +24 -6
  63. package/dist/{chunk-3R3Z54J7.js → chunk-LOEJFTF2.js} +1 -1
  64. package/dist/{chunk-HGEE5LDW.js → chunk-LQQNFCQJ.js} +1 -1
  65. package/dist/chunk-LVLPA32Q.js +810 -0
  66. package/dist/chunk-M2YMBT5G.js +73 -0
  67. package/dist/{chunk-KX4DF6XX.js → chunk-MJRGPEQ5.js} +11 -11
  68. package/dist/{chunk-3QCI3V6C.js → chunk-MOAVEPC4.js} +10 -10
  69. package/dist/{chunk-AFNPNHJV.js → chunk-NGNBJIUO.js} +7 -7
  70. package/dist/{chunk-AGEQRJ5A.js → chunk-NHA5K226.js} +1 -1
  71. package/dist/{chunk-HTUG7ZFK.js → chunk-NNEQOC3U.js} +31 -59
  72. package/dist/{chunk-6K4X7IIF.js → chunk-O2MHF7QM.js} +35 -38
  73. package/dist/{chunk-4HNBY7S7.js → chunk-OLWGYBYT.js} +15 -18
  74. package/dist/{chunk-IBEYUBCM.js → chunk-OZQQ3AIR.js} +17 -20
  75. package/dist/{chunk-LXE7JAMV.js → chunk-P5MSLVUW.js} +10 -10
  76. package/dist/{chunk-TBE4OLPA.js → chunk-PFJLYRO3.js} +37 -40
  77. package/dist/chunk-PKWEBMCA.js +2957 -0
  78. package/dist/{chunk-LHU6NG5Z.js → chunk-PPQHMSPH.js} +16 -15
  79. package/dist/{chunk-6EIV3H7O.js → chunk-PQF6YGYB.js} +12 -5
  80. package/dist/{chunk-BBJXIZ3X.js → chunk-PQXUZYTQ.js} +6 -35
  81. package/dist/{chunk-IJ55MYO6.js → chunk-Q7J3JYJ2.js} +13 -12
  82. package/dist/{chunk-BMMRLJA4.js → chunk-QE5DJ7MX.js} +27 -10
  83. package/dist/{chunk-E6Z3CJT2.js → chunk-QE7BJQ6K.js} +7 -7
  84. package/dist/{chunk-UY3WWW5R.js → chunk-QMWKSYWB.js} +4 -4
  85. package/dist/{chunk-QJ4T73J5.js → chunk-QV3JPCMK.js} +1 -1
  86. package/dist/{chunk-3NVGBFJS.js → chunk-R4L7KZ7R.js} +5 -5
  87. package/dist/{chunk-KDMJ2DJD.js → chunk-RIH3UBK4.js} +10 -10
  88. package/dist/{chunk-T5EGSBM2.js → chunk-RJ3APNIP.js} +3 -3
  89. package/dist/{chunk-D5L7Q57Z.js → chunk-S6MCMD27.js} +35 -12
  90. package/dist/{chunk-LPM6NKVI.js → chunk-SCU62JLX.js} +6 -6
  91. package/dist/{chunk-LHCDWFDB.js → chunk-SDYLT45T.js} +3 -3
  92. package/dist/chunk-TFKN5EIR.js +27 -0
  93. package/dist/{chunk-TPMBNWHO.js → chunk-TKOFTLGB.js} +34 -26
  94. package/dist/chunk-TQWRH25U.js +35 -0
  95. package/dist/{chunk-QBUSONNE.js → chunk-TWEOJE3D.js} +307 -74
  96. package/dist/{chunk-5RLEDUUE.js → chunk-UN72ZAJ5.js} +8 -8
  97. package/dist/{chunk-LIDFFCZZ.js → chunk-UNP6Y4JV.js} +16 -16
  98. package/dist/{chunk-HIUVHRLM.js → chunk-VGRGW4UL.js} +63 -57
  99. package/dist/{chunk-AOQKQWZU.js → chunk-VSQT6IHZ.js} +2 -2
  100. package/dist/{chunk-B4K6OSLL.js → chunk-VWEBZ2JV.js} +39 -40
  101. package/dist/chunk-W26QZ3OM.js +355 -0
  102. package/dist/{chunk-KDGKKK7A.js → chunk-XDNWR7SG.js} +2 -2
  103. package/dist/{chunk-TTGDTNSN.js → chunk-XSC3BCN3.js} +5 -5
  104. package/dist/{chunk-ME6MF2N2.js → chunk-YCR6ZYTE.js} +1 -1
  105. package/dist/{chunk-QDZ3ZZMY.js → chunk-ZI7YHV6I.js} +5 -5
  106. package/dist/{chunk-E3PNZDPH.js → chunk-ZQSSO7LO.js} +33 -1
  107. package/dist/{chunk-ECYUBKYX.js → chunk-ZULZS2I6.js} +391 -410
  108. package/dist/index.js +7314 -5703
  109. package/dist/mcp/analyze-cli.js +11 -13
  110. package/dist/mcp/cli.js +39 -40
  111. package/dist/mcp/server.js +618 -360
  112. package/dist/mcp/worker.js +57 -60
  113. package/dist/probes/installer.js +19 -17
  114. package/docs/agent-tools.md +54 -12
  115. package/docs/architecture.md +113 -0
  116. package/docs/ast-grep_rules_catalog.md +2 -2
  117. package/docs/ci.md +18 -4
  118. package/docs/configuration.md +3 -3
  119. package/docs/defect-shapes.md +41 -3
  120. package/docs/dependencies.md +10 -10
  121. package/docs/features.md +3 -3
  122. package/docs/globalconfig.md +8 -1
  123. package/docs/invariants/dispatch-runners.md +13 -1
  124. package/docs/invariants/lsp-trust-exec.md +26 -0
  125. package/docs/language-coverage.md +39 -0
  126. package/docs/lsp-capability-matrix.md +10 -4
  127. package/docs/lsp-idle-eviction.md +1 -1
  128. package/docs/mcp.md +2 -1
  129. package/docs/pi-lens-fixer.md +4 -0
  130. package/docs/pi-lens-merge-policy.md +1 -1
  131. package/docs/pi-lens-reviewer.md +4 -5
  132. package/docs/pi-lens-subagent.md +5 -2
  133. package/docs/prose-standard.md +112 -0
  134. package/docs/servercapabilities.md +1 -1
  135. package/docs/usage.md +51 -1
  136. package/package.json +1 -1
  137. package/rules/ast-grep-rules/rule-tests/array-callback-return-js-test.yml +23 -0
  138. package/rules/ast-grep-rules/rule-tests/array-callback-return-test.yml +23 -0
  139. package/rules/ast-grep-rules/rule-tests/no-negation-in-equality-check-js-test.yml +8 -0
  140. package/rules/ast-grep-rules/rule-tests/no-negation-in-equality-check-test.yml +8 -0
  141. package/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-js-test.yml +16 -0
  142. package/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-test.yml +16 -0
  143. package/rules/ast-grep-rules/rules/array-callback-return-js.yml +8 -0
  144. package/rules/ast-grep-rules/rules/array-callback-return.yml +8 -0
  145. package/rules/ast-grep-rules/rules/no-negation-in-equality-check-js.yml +17 -5
  146. package/rules/ast-grep-rules/rules/no-negation-in-equality-check.yml +17 -5
  147. package/rules/ast-grep-rules/rules/unchecked-throwing-call-js.yml +8 -1
  148. package/rules/ast-grep-rules/rules/unchecked-throwing-call.yml +8 -1
  149. package/rules/tree-sitter-queries/typescript/ts-react-antipatterns.yml +8 -0
  150. package/dist/chunk-3HZ6MNB2.js +0 -140
  151. package/dist/chunk-43KD3PPM.js +0 -162
  152. package/dist/chunk-5YTDZ5WP.js +0 -38
  153. package/dist/chunk-CKEQFGLT.js +0 -32
  154. package/dist/chunk-F37CCZUA.js +0 -27
  155. package/dist/chunk-JSQK5DH3.js +0 -256
  156. package/dist/chunk-R5BNSOIV.js +0 -29
  157. package/dist/chunk-RV5VX2XW.js +0 -29
  158. package/dist/chunk-UELHWF5I.js +0 -1037
  159. package/dist/chunk-UG4YLCJ5.js +0 -58
  160. package/dist/chunk-UQ6OZYTO.js +0 -91
  161. package/dist/chunk-V7IPIAE5.js +0 -74
  162. package/dist/chunk-YUF4DRYB.js +0 -2417
@@ -1,40 +1,26 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  resolveOpengrepConfig
4
- } from "./chunk-2SD2CGVH.js";
4
+ } from "./chunk-7WKVCZI4.js";
5
5
  import {
6
6
  PYTHON_COMPILE_VERDICT_SERVER_ID,
7
7
  augmentPythonEnvironment,
8
8
  detectPythonEnvironment,
9
9
  pythonEnvironmentToolCandidates
10
- } from "./chunk-NLRKB32C.js";
10
+ } from "./chunk-2H5GHZKC.js";
11
11
  import {
12
12
  scannerReportParentDir
13
- } from "./chunk-QJ4T73J5.js";
14
- import {
15
- hasCargoWorkspaceTable,
16
- readCargoWorkspaceExclude,
17
- readCargoWorkspaceMembers,
18
- readTextFileOrUndefined
19
- } from "./chunk-SUIZOCSY.js";
13
+ } from "./chunk-QV3JPCMK.js";
20
14
  import {
21
15
  getUserRuleRoot,
22
- ruleCorpusFingerprintForCycle
23
- } from "./chunk-5YTDZ5WP.js";
24
- import {
25
16
  load,
26
- resolvePackagePath
27
- } from "./chunk-E3PNZDPH.js";
28
- import {
29
- HOOK_WALL_BUDGET_MS
30
- } from "./chunk-CKEQFGLT.js";
17
+ resolvePackagePath,
18
+ ruleCorpusFingerprintForCycle
19
+ } from "./chunk-ZQSSO7LO.js";
31
20
  import {
32
21
  extensionsForLanguage,
33
22
  isTypeScriptFile
34
- } from "./chunk-AYDE7RFV.js";
35
- import {
36
- bounded
37
- } from "./chunk-3HZ6MNB2.js";
23
+ } from "./chunk-DI4AZZNY.js";
38
24
  import {
39
25
  ensureTool,
40
26
  findManagedToolBinary,
@@ -44,15 +30,21 @@ import {
44
30
  isZizmorAuditTarget,
45
31
  logSessionStart,
46
32
  resolveZizmorGitHubToken
47
- } from "./chunk-ITAPXBIB.js";
33
+ } from "./chunk-B2OXE4AH.js";
48
34
  import {
49
35
  resolveToolCwd
50
- } from "./chunk-JSQK5DH3.js";
36
+ } from "./chunk-LVLPA32Q.js";
51
37
  import {
52
38
  commandSearchReachesProject,
53
39
  findGlobalBinary,
54
40
  isProjectLocalBinPath
55
- } from "./chunk-FVEEEEIM.js";
41
+ } from "./chunk-LGH2HHZG.js";
42
+ import {
43
+ hasCargoWorkspaceTable,
44
+ readCargoWorkspaceExclude,
45
+ readCargoWorkspaceMembers,
46
+ readTextFileOrUndefined
47
+ } from "./chunk-KNSOA43J.js";
56
48
  import {
57
49
  classifyFinderFailure,
58
50
  classifyProbeFailure,
@@ -60,10 +52,10 @@ import {
60
52
  describeInstallAttempt,
61
53
  logAvailabilityDecision,
62
54
  startHostStallSampler
63
- } from "./chunk-WBXCIRVI.js";
55
+ } from "./chunk-6GLMMGCX.js";
64
56
  import {
65
57
  readDirEntriesSafeAsync
66
- } from "./chunk-C2REOMPO.js";
58
+ } from "./chunk-74AMPWNC.js";
67
59
  import {
68
60
  OWNER_TAG_ENV,
69
61
  SpawnFailureError,
@@ -92,13 +84,13 @@ import {
92
84
  safeSpawnAsync,
93
85
  statIsFile,
94
86
  trustScopedEnvironment
95
- } from "./chunk-DNB4ZQGN.js";
87
+ } from "./chunk-3PO4YYOX.js";
96
88
  import {
97
89
  DOTNET_CSHARP_ROOT_MARKERS,
98
90
  DOTNET_FSHARP_ROOT_MARKERS,
99
91
  KIND_EXTENSIONS,
100
92
  LEAN_ROOT_MARKERS
101
- } from "./chunk-SRXYSLMW.js";
93
+ } from "./chunk-CQY2HEH7.js";
102
94
  import {
103
95
  boundedKeyLabel,
104
96
  finalizeRecords,
@@ -110,7 +102,7 @@ import {
110
102
  reportPiLensConfigRecords,
111
103
  resolvePiLensConfig,
112
104
  summarizeConfigResolution
113
- } from "./chunk-6EIV3H7O.js";
105
+ } from "./chunk-PQF6YGYB.js";
114
106
  import {
115
107
  FRESHNESS_CADENCE_MS,
116
108
  LSP_NAMESPACE_KEY,
@@ -121,17 +113,19 @@ import {
121
113
  getDirectoryMarkers,
122
114
  getPiLensGlobalConfigPath,
123
115
  unknownDirMtimeRecords
124
- } from "./chunk-3R3Z54J7.js";
116
+ } from "./chunk-LOEJFTF2.js";
125
117
  import {
118
+ HOOK_WALL_BUDGET_MS,
119
+ bounded,
126
120
  getProjectTrustGeneration,
127
121
  getProjectTrustState
128
- } from "./chunk-43KD3PPM.js";
122
+ } from "./chunk-W26QZ3OM.js";
129
123
  import {
130
124
  getDegradationLedgerGeneration,
131
125
  incrementDegradationCount,
132
126
  logExtension,
133
127
  recordDegradationOnce
134
- } from "./chunk-AGEQRJ5A.js";
128
+ } from "./chunk-NHA5K226.js";
135
129
  import {
136
130
  claimPhaseOncePerSession,
137
131
  currentSessionRecordId,
@@ -142,7 +136,7 @@ import {
142
136
  logLatency,
143
137
  redactSecrets,
144
138
  releasePhaseClaim
145
- } from "./chunk-K2GV34T2.js";
139
+ } from "./chunk-7CLWC2UH.js";
146
140
  import {
147
141
  STAGE_TMP_PATTERN
148
142
  } from "./chunk-LJDODBBZ.js";
@@ -1008,8 +1002,7 @@ function recordUntrustedLspExecution(request, trust) {
1008
1002
  });
1009
1003
  }
1010
1004
  }
1011
- function refuseUntrustedLspExecution(request) {
1012
- const trust = getProjectTrustState();
1005
+ function refuseUntrustedLspExecution(request, trust = getProjectTrustState()) {
1013
1006
  const needsTrust = request.kind === "project-code-server" ? trust !== "trusted" : !admitProjectSuppliedTsserver(request.resolvedCommand, request.cwd, true);
1014
1007
  if (!needsTrust)
1015
1008
  return;
@@ -1313,6 +1306,9 @@ async function launchLSP(command, args = [], options = {}) {
1313
1306
  args
1314
1307
  };
1315
1308
  }
1309
+ async function launchViaNode(scriptPath, args = [], options = {}) {
1310
+ return launchLSP(process.execPath, [scriptPath, ...args], options);
1311
+ }
1316
1312
 
1317
1313
  // dist/clients/lsp/config.js
1318
1314
  function asRecord(value) {
@@ -2047,13 +2043,25 @@ var SERVER_DIAGNOSTIC_STRATEGIES = {
2047
2043
  // applies this flag to a native-ts7 instance.
2048
2044
  silentOnClean: true
2049
2045
  },
2050
- "rust-analyzer": {
2051
- seedFirstPush: false,
2052
- pullRetryBudgetMs: 500,
2053
- debounceMs: 150,
2054
- aggregateWaitMs: 3e3,
2055
- expectSemanticSecondPush: true
2056
- },
2046
+ // rust (rust-analyzer) has NO row on purpose (#5485). The row that stood
2047
+ // here was keyed `rust-analyzer`, the display name, not the registry id, so
2048
+ // it never applied and rust (a `mode=pull` server) waited on
2049
+ // DEFAULT_STRATEGY; its 3000 / 500 / second-push values were a design
2050
+ // guess (commit 3bf9ff93b), never measured. Re-keyed as they were, a cold
2051
+ // `lsp_touch_file` still reads clean: 0 of 5 cold touches returned the
2052
+ // fixture's type error at 3000 / 500 (and 0 of 5 on the default), because
2053
+ // rust-analyzer answers an EMPTY authoritative report for ~0.4 s and the
2054
+ // finding lands at 3.6-3.9 s. The `lsp_diagnostics` route differs only in
2055
+ // degree (review r1, default: 3 of 5 cold runs found it, 2 returned clean).
2056
+ // Only a pull-retry budget above that catches it (7000 / 6000: 3 of 3 on the
2057
+ // touch seam), and the retry loop cannot tell a clean file from a loading
2058
+ // one, so every clean touch then pays the whole budget (6.7-6.9 s vs 0.9 s
2059
+ // on the touch seam; 12.6-12.8 s vs 1.1-1.7 s on `lsp_diagnostics`). That
2060
+ // trade is a maintainer decision, not a key rename. #5487 closed the false
2061
+ // clean without it: the client asks rust-analyzer for
2062
+ // `experimental/serverStatus` and holds a pull to its `quiescent` flag, so
2063
+ // a cold touch is inconclusive (`server-loading`), never clean. Raw numbers:
2064
+ // tests/fixtures/lsp-wait-measurements/rust-5485.json.
2057
2065
  // PythonServer (pyright / basedpyright) — openFilesOnly mode: lazy per-file
2058
2066
  // analysis, startup similar to jedi. seedFirstPush: true because pyright's
2059
2067
  // first publishDiagnostics after didOpen is the complete result for that file.
@@ -2076,13 +2084,6 @@ var SERVER_DIAGNOSTIC_STRATEGIES = {
2076
2084
  aggregateWaitMs: 3e3,
2077
2085
  expectSemanticSecondPush: false
2078
2086
  },
2079
- eslint: {
2080
- seedFirstPush: true,
2081
- pullRetryBudgetMs: 0,
2082
- debounceMs: 200,
2083
- aggregateWaitMs: 2e3,
2084
- expectSemanticSecondPush: false
2085
- },
2086
2087
  // Opengrep security scanner (cross-language LSP). It pushes an EMPTY result
2087
2088
  // during the one-time rule-load window at startup, then the real scan after
2088
2089
  // `semgrep/rulesRefreshed` — so never seed the first push, and hold that
@@ -2357,6 +2358,35 @@ var SERVER_DIAGNOSTIC_STRATEGIES = {
2357
2358
  aggregateWaitMs: 6e3,
2358
2359
  expectSemanticSecondPush: false
2359
2360
  },
2361
+ // deno (the typescript alternate) is a PULL server (`mode=pull`,
2362
+ // docs/lsp-capability-matrix.md) that answers every cold touch, but the
2363
+ // answer can take longer than DEFAULT_STRATEGY's 1500ms: the pull is
2364
+ // abandoned and the touch reads `touched=0` (#5464). MEASURED over the
2365
+ // nightly tool-smoke `LSP handshake layer` row, spawn + initialize + pull:
2366
+ // * green 1.27, 1.59, 1.57, 3.80, 3.42s (five runs, 2026-11-06..08);
2367
+ // * red at the 1500 default: 4.60s (d8bd7a331) and 4.15s (242b2e3d2) —
2368
+ // same runner image and deno 2.9.8 on both sides, so the touch time
2369
+ // moved, not the code.
2370
+ // A CPU-starved local host (one core shared with 4 busy loops, cold HOME)
2371
+ // reproduced the red 3 of 3 at the default and completed in 3.86, 4.02 and
2372
+ // 5.49s once the cap was lifted (two further runs ran past an 8000ms pull
2373
+ // and are not covered by any budget under the gate's ceiling). Raw numbers:
2374
+ // tests/fixtures/lsp-wait-measurements/deno-5464.json, pinned by
2375
+ // tests/clients/lsp/server-strategies.test.ts. 7000 = 1.25 x the slowest
2376
+ // COMPLETED touch (5.49s). It is a ceiling, not a delay: a pull server that
2377
+ // answers returns at once, so a warm or fast touch pays nothing, and the
2378
+ // budget is only paid in full when deno never answers an uncapped call.
2379
+ // The CI runner was not instrumented for this row: the CI figures are
2380
+ // run-log timestamps, the starved ones are this host's.
2381
+ // Every other field is DEFAULT_STRATEGY's on purpose: nothing measured
2382
+ // deno's pull retry or debounce, so this entry moves the one field that was.
2383
+ deno: {
2384
+ seedFirstPush: false,
2385
+ pullRetryBudgetMs: 250,
2386
+ debounceMs: 150,
2387
+ aggregateWaitMs: 7e3,
2388
+ expectSemanticSecondPush: false
2389
+ },
2360
2390
  cue: {
2361
2391
  seedFirstPush: true,
2362
2392
  pullRetryBudgetMs: 0,
@@ -4011,12 +4041,45 @@ async function findTsserverPath(root, allowInstall, options) {
4011
4041
  }));
4012
4042
  return tsserverForTsc(repairedTsc);
4013
4043
  }
4044
+ function typeScriptMajor(version) {
4045
+ const majorText = version.split(".", 1)[0] ?? "";
4046
+ return /^\d+$/.test(majorText) ? Number(majorText) : Number.NaN;
4047
+ }
4048
+ async function findTypeScriptNativeAlias(nodeModulesDir) {
4049
+ const aliasDir = path8.join(nodeModulesDir, "@typescript", "native");
4050
+ let manifest;
4051
+ try {
4052
+ manifest = JSON.parse(await readFile(path8.join(aliasDir, "package.json"), "utf8"));
4053
+ } catch {
4054
+ return void 0;
4055
+ }
4056
+ if (typeof manifest !== "object" || manifest === null)
4057
+ return void 0;
4058
+ const { name, version, bin } = manifest;
4059
+ if (name !== "typescript")
4060
+ return void 0;
4061
+ if (typeof version !== "string" || !(typeScriptMajor(version) >= 7)) {
4062
+ return void 0;
4063
+ }
4064
+ const tsc = typeof bin === "object" && bin !== null ? bin.tsc : void 0;
4065
+ if (typeof tsc !== "string" || !tsc)
4066
+ return void 0;
4067
+ const command = path8.resolve(aliasDir, tsc);
4068
+ try {
4069
+ if (!(await stat(command)).isFile())
4070
+ return void 0;
4071
+ } catch {
4072
+ return void 0;
4073
+ }
4074
+ return { command, version };
4075
+ }
4014
4076
  async function findNativeTypeScriptLsp(root) {
4015
4077
  const home = realpathOrResolve(os6.homedir());
4016
4078
  for (const currentDir of walkUpDirs(root, { spelling: true })) {
4017
4079
  if (isAtOrAboveHomeDir(realpathOrResolve(currentDir), home))
4018
4080
  break;
4019
- const typescriptDir = path8.join(currentDir, "node_modules", "typescript");
4081
+ const nodeModulesDir = path8.join(currentDir, "node_modules");
4082
+ const typescriptDir = path8.join(nodeModulesDir, "typescript");
4020
4083
  const packageJsonPath = path8.join(typescriptDir, "package.json");
4021
4084
  let packageJsonText;
4022
4085
  try {
@@ -4043,11 +4106,14 @@ async function findNativeTypeScriptLsp(root) {
4043
4106
  } catch {
4044
4107
  return void 0;
4045
4108
  }
4046
- const majorText = version.split(".", 1)[0] ?? "";
4047
- const major = /^\d+$/.test(majorText) ? Number(majorText) : Number.NaN;
4048
- if (!Number.isFinite(major) || major < 7)
4109
+ const major = typeScriptMajor(version);
4110
+ if (!Number.isFinite(major))
4049
4111
  return void 0;
4050
- const localTsc = path8.join(currentDir, "node_modules", ".bin", "tsc");
4112
+ if (major < 7) {
4113
+ const alias = await findTypeScriptNativeAlias(nodeModulesDir);
4114
+ return alias && { ...alias, entry: "node-script", nodeModulesDir };
4115
+ }
4116
+ const localTsc = path8.join(nodeModulesDir, ".bin", "tsc");
4051
4117
  const candidates = process.platform === "win32" ? [`${localTsc}.cmd`, `${localTsc}.exe`, localTsc] : [localTsc];
4052
4118
  for (const command of candidates) {
4053
4119
  try {
@@ -4055,7 +4121,8 @@ async function findNativeTypeScriptLsp(root) {
4055
4121
  return {
4056
4122
  command,
4057
4123
  version,
4058
- nodeModulesDir: path8.join(currentDir, "node_modules")
4124
+ entry: "bin-link",
4125
+ nodeModulesDir
4059
4126
  };
4060
4127
  } catch {
4061
4128
  }
@@ -4064,6 +4131,59 @@ async function findNativeTypeScriptLsp(root) {
4064
4131
  }
4065
4132
  return void 0;
4066
4133
  }
4134
+ async function launchNativeTypeScript(nativeLsp, root, options) {
4135
+ if (!admitProjectSuppliedTsserver(nativeLsp.command, root, true, options?.projectCodeAllowed)) {
4136
+ return void 0;
4137
+ }
4138
+ const env = await getToolEnvironment();
4139
+ logSessionStart(`lsp typescript-native: version=${nativeLsp.version} command=${nativeLsp.command} entry=${nativeLsp.entry}`);
4140
+ const args = ["--lsp", "--stdio"];
4141
+ if (nativeLsp.entry !== "node-script") {
4142
+ const proc2 = await launchLSP(nativeLsp.command, args, { cwd: root, env });
4143
+ return { process: proc2, source: "direct", launchVariant: "native-ts7" };
4144
+ }
4145
+ const classicInstead = async (failure, why) => {
4146
+ const classic = await launchClassicTypeScript(root, options);
4147
+ if (!classic)
4148
+ return void 0;
4149
+ const detail = failure instanceof Error ? failure.message : String(failure);
4150
+ recordDegradationOnce({
4151
+ kind: "lsp-registry-decision",
4152
+ subject: `typescript-native-alias:g${getDegradationLedgerGeneration()}:${root}`,
4153
+ reason: `the @typescript/native alias failed to start, using the classic launch: ${detail}`,
4154
+ metadata: { field: "typescript-native-alias", launchVariant: "classic" }
4155
+ });
4156
+ logSessionStart(`lsp typescript-native: alias ${why}, falling back to classic: ${detail}`);
4157
+ return classic;
4158
+ };
4159
+ let proc;
4160
+ try {
4161
+ proc = await launchViaNode(nativeLsp.command, args, { cwd: root, env });
4162
+ } catch (launchFailure) {
4163
+ logSessionStart(`lsp typescript-native: alias failed to launch: ${launchFailure instanceof Error ? launchFailure.message : String(launchFailure)}`);
4164
+ const classic = await classicInstead(launchFailure, "failed to launch");
4165
+ if (classic)
4166
+ return classic;
4167
+ throw launchFailure;
4168
+ }
4169
+ return {
4170
+ process: proc,
4171
+ source: "direct",
4172
+ launchVariant: "native-ts7",
4173
+ initializeFallback: (failure) => classicInstead(failure, "failed to initialize")
4174
+ };
4175
+ }
4176
+ function recordEffectTsgoFallback(root, reason, failure) {
4177
+ recordDegradationOnce({
4178
+ kind: "lsp-registry-decision",
4179
+ subject: `effect-tsgo-launch:g${getDegradationLedgerGeneration()}:${root}`,
4180
+ reason: `${reason}: ${failure instanceof Error ? failure.message : String(failure)}`,
4181
+ metadata: {
4182
+ field: "effect-tsgo-launch",
4183
+ launchVariant: "effect-tsgo"
4184
+ }
4185
+ });
4186
+ }
4067
4187
  async function findEffectTsgoLsp(nodeModulesDir) {
4068
4188
  let release;
4069
4189
  try {
@@ -4232,6 +4352,44 @@ var TypeScriptRoot = withRootMarkers(DenoExcludeRoot(async (file) => {
4232
4352
  return projectRoot;
4233
4353
  return FileDirRoot(file);
4234
4354
  }), [...TS_CONFIG_MARKERS, ...TS_TOOLING_MARKERS]);
4355
+ async function launchClassicTypeScript(root, options) {
4356
+ let source = "direct";
4357
+ let lspPath = await findAncestorFileAmong(root, [
4358
+ ["node_modules", ".bin", "typescript-language-server.cmd"],
4359
+ ["node_modules", ".bin", "typescript-language-server"]
4360
+ ]);
4361
+ if (!lspPath) {
4362
+ lspPath = await ensureTool("typescript-language-server", {
4363
+ allowInstall: canInstall(options?.allowInstall)
4364
+ });
4365
+ if (lspPath)
4366
+ source = "managed";
4367
+ if (!lspPath) {
4368
+ return void 0;
4369
+ }
4370
+ }
4371
+ const tsserverPath = await findTsserverPath(root, options?.allowInstall, options);
4372
+ if (!tsserverPath) {
4373
+ admitProjectSuppliedTsserver(void 0, root, true, options?.projectCodeAllowed);
4374
+ return void 0;
4375
+ }
4376
+ if (tsserverPath)
4377
+ source = "managed";
4378
+ const env = await getToolEnvironment();
4379
+ const proc = await launchLSP(lspPath, ["--stdio"], {
4380
+ cwd: root,
4381
+ env: {
4382
+ ...env,
4383
+ TSSERVER_PATH: tsserverPath
4384
+ }
4385
+ });
4386
+ return {
4387
+ process: proc,
4388
+ source,
4389
+ initialization: { tsserver: { path: tsserverPath } },
4390
+ launchVariant: "classic"
4391
+ };
4392
+ }
4235
4393
  var TypeScriptServer = {
4236
4394
  id: "typescript",
4237
4395
  idleEviction: "transparent",
@@ -4251,72 +4409,30 @@ var TypeScriptServer = {
4251
4409
  const nativeLsp = await findNativeTypeScriptLsp(root);
4252
4410
  const effectLsp = nativeLsp ? await findEffectTsgoLsp(nativeLsp.nodeModulesDir) : void 0;
4253
4411
  if (nativeLsp && effectLsp && admitProjectSuppliedTsserver(effectLsp.command, root, true, options?.projectCodeAllowed)) {
4254
- const env2 = await getToolEnvironment();
4412
+ const env = await getToolEnvironment();
4255
4413
  try {
4256
- const proc2 = await launchLSP(effectLsp.command, ["tsc", "--lsp", "--stdio"], { cwd: root, env: env2 });
4414
+ const proc = await launchLSP(effectLsp.command, ["tsc", "--lsp", "--stdio"], { cwd: root, env });
4257
4415
  logSessionStart(`lsp typescript-effect-tsgo: version=${effectLsp.releaseTag} typescript=${nativeLsp.version} command=${effectLsp.command}`);
4258
4416
  return {
4259
- process: proc2,
4417
+ process: proc,
4260
4418
  source: "direct",
4261
- launchVariant: "effect-tsgo"
4419
+ launchVariant: "effect-tsgo",
4420
+ initializeFallback: async (failure) => {
4421
+ recordEffectTsgoFallback(root, "effect-tsgo failed to initialize, using the native launch", failure);
4422
+ logSessionStart(`lsp typescript-effect-tsgo: initialize failed, falling back to native: ${failure instanceof Error ? failure.message : String(failure)}`);
4423
+ return launchNativeTypeScript(nativeLsp, root, options);
4424
+ }
4262
4425
  };
4263
4426
  } catch (launchFailure) {
4264
- recordDegradationOnce({
4265
- kind: "lsp-registry-decision",
4266
- subject: `effect-tsgo-launch:g${getDegradationLedgerGeneration()}:${root}`,
4267
- reason: `effect-tsgo launch failed, using the native launch: ${launchFailure instanceof Error ? launchFailure.message : String(launchFailure)}`,
4268
- metadata: {
4269
- field: "effect-tsgo-launch",
4270
- launchVariant: "effect-tsgo"
4271
- }
4272
- });
4273
- }
4274
- }
4275
- if (nativeLsp && admitProjectSuppliedTsserver(nativeLsp.command, root, true, options?.projectCodeAllowed)) {
4276
- const env2 = await getToolEnvironment();
4277
- logSessionStart(`lsp typescript-native: version=${nativeLsp.version} command=${nativeLsp.command}`);
4278
- const proc2 = await launchLSP(nativeLsp.command, ["--lsp", "--stdio"], {
4279
- cwd: root,
4280
- env: env2
4281
- });
4282
- return { process: proc2, source: "direct", launchVariant: "native-ts7" };
4283
- }
4284
- let source = "direct";
4285
- let lspPath = await findAncestorFileAmong(root, [
4286
- ["node_modules", ".bin", "typescript-language-server.cmd"],
4287
- ["node_modules", ".bin", "typescript-language-server"]
4288
- ]);
4289
- if (!lspPath) {
4290
- lspPath = await ensureTool("typescript-language-server", {
4291
- allowInstall: canInstall(options?.allowInstall)
4292
- });
4293
- if (lspPath)
4294
- source = "managed";
4295
- if (!lspPath) {
4296
- return void 0;
4427
+ recordEffectTsgoFallback(root, "effect-tsgo launch failed, using the native launch", launchFailure);
4297
4428
  }
4298
4429
  }
4299
- const tsserverPath = await findTsserverPath(root, options?.allowInstall, options);
4300
- if (!tsserverPath) {
4301
- admitProjectSuppliedTsserver(void 0, root, true, options?.projectCodeAllowed);
4302
- return void 0;
4430
+ if (nativeLsp) {
4431
+ const native = await launchNativeTypeScript(nativeLsp, root, options);
4432
+ if (native)
4433
+ return native;
4303
4434
  }
4304
- if (tsserverPath)
4305
- source = "managed";
4306
- const env = await getToolEnvironment();
4307
- const proc = await launchLSP(lspPath, ["--stdio"], {
4308
- cwd: root,
4309
- env: {
4310
- ...env,
4311
- TSSERVER_PATH: tsserverPath
4312
- }
4313
- });
4314
- return {
4315
- process: proc,
4316
- source,
4317
- initialization: tsserverPath ? { tsserver: { path: tsserverPath } } : void 0,
4318
- launchVariant: "classic"
4319
- };
4435
+ return launchClassicTypeScript(root, options);
4320
4436
  }
4321
4437
  };
4322
4438
  var DenoServer = {
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  getGlobalPiLensDir
4
- } from "./chunk-DNB4ZQGN.js";
4
+ } from "./chunk-3PO4YYOX.js";
5
5
 
6
6
  // dist/clients/opengrep-rule-pack.js
7
7
  import * as fs from "node:fs";