pi-lens 4.4.12 → 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 (155) hide show
  1. package/CHANGELOG-USER.md +6 -6
  2. package/CHANGELOG.md +172 -0
  3. package/README.md +103 -217
  4. package/dist/{chunk-KXDQD34C.js → chunk-27JQHK7Y.js} +1 -1
  5. package/dist/{chunk-W6VLB6LL.js → chunk-2APSZHHI.js} +61 -3
  6. package/dist/{chunk-5EEWCJG7.js → chunk-2H5GHZKC.js} +8 -8
  7. package/dist/{chunk-TS5EIWEF.js → chunk-2H7NFZ4Q.js} +11 -11
  8. package/dist/{chunk-6GWCYEP7.js → chunk-37IDWT6O.js} +64 -16
  9. package/dist/{chunk-OEPWTSUG.js → chunk-3PAS2ERX.js} +8 -8
  10. package/dist/{chunk-ET3DSSFZ.js → chunk-3PO4YYOX.js} +9 -17
  11. package/dist/{chunk-C6V2DSZZ.js → chunk-3QXFUP6T.js} +11 -11
  12. package/dist/{chunk-HWMNTQBJ.js → chunk-3TSMQZG6.js} +32 -11
  13. package/dist/{chunk-QY6J2FTK.js → chunk-4DAHGU3V.js} +15 -14
  14. package/dist/{chunk-PCREZ4HJ.js → chunk-4IZZEN63.js} +33 -34
  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-GHATCG2A.js → chunk-6CFSDLHE.js} +22 -18
  19. package/dist/{chunk-FVQKX5KI.js → chunk-6E5QLMWI.js} +24 -22
  20. package/dist/{chunk-AVBEPUCD.js → chunk-6GLMMGCX.js} +2 -2
  21. package/dist/{chunk-YTXFNCVN.js → chunk-74AMPWNC.js} +2 -2
  22. package/dist/{chunk-K2GV34T2.js → chunk-7CLWC2UH.js} +26 -37
  23. package/dist/{chunk-MOEWCPMC.js → chunk-7DPXUPRF.js} +2 -2
  24. package/dist/{chunk-7BEADGAZ.js → chunk-7U36VQL6.js} +2 -2
  25. package/dist/{chunk-PPYUBO6Y.js → chunk-7WKVCZI4.js} +1 -1
  26. package/dist/{chunk-ILC2B7IJ.js → chunk-7ZVTFLCC.js} +10 -10
  27. package/dist/{chunk-IT7MFVGP.js → chunk-ADYQRETD.js} +2 -2
  28. package/dist/{chunk-NCDH2JB7.js → chunk-ARTYCUGF.js} +25 -10
  29. package/dist/{chunk-Z6WTLVUL.js → chunk-AXAR5ZW2.js} +225 -104
  30. package/dist/{chunk-PK3GDU4M.js → chunk-AZG5UJYY.js} +1 -1
  31. package/dist/{chunk-NRVWLTOY.js → chunk-B2OXE4AH.js} +60 -21
  32. package/dist/{chunk-ORYQGVC3.js → chunk-B42AIWPJ.js} +2 -2
  33. package/dist/{chunk-IC4L65U7.js → chunk-BBSDJTOV.js} +12 -13
  34. package/dist/{chunk-HJWF7CGW.js → chunk-BKWFDWYM.js} +16 -16
  35. package/dist/{chunk-D2ZYRI7M.js → chunk-C5PLBTNR.js} +1 -1
  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-HYR25MV3.js → chunk-CZJGAOKL.js} +8 -7
  39. package/dist/{chunk-DIIDMDZU.js → chunk-DCA2MXVQ.js} +11 -11
  40. package/dist/{chunk-K2LD6YNH.js → chunk-DFKOA74L.js} +9 -9
  41. package/dist/{chunk-AYDE7RFV.js → chunk-DI4AZZNY.js} +2 -2
  42. package/dist/{chunk-6EXGCXM5.js → chunk-G53LBDNU.js} +99 -5
  43. package/dist/chunk-GCSDF5IE.js +27 -0
  44. package/dist/{chunk-5KLRCUDT.js → chunk-H5API74E.js} +6 -6
  45. package/dist/chunk-HBX55MWO.js +27 -0
  46. package/dist/{chunk-JRSS6KM4.js → chunk-HIJ4CHFF.js} +2 -2
  47. package/dist/{chunk-3MHY4BQY.js → chunk-HIRBC72R.js} +4 -4
  48. package/dist/{chunk-F7AMFFVK.js → chunk-HRLF35WL.js} +8 -8
  49. package/dist/{chunk-HSTN27NR.js → chunk-I2FYOZNW.js} +9 -9
  50. package/dist/{chunk-5FDUKJZO.js → chunk-I3NZVAMN.js} +9 -9
  51. package/dist/{chunk-NZINZCHB.js → chunk-INBK3HIT.js} +3 -3
  52. package/dist/{chunk-PXGVB2CY.js → chunk-J2ZB5MDS.js} +20 -18
  53. package/dist/{chunk-HYDJUVOE.js → chunk-JGUDT5KD.js} +4 -4
  54. package/dist/chunk-JOIKBUQN.js +88 -0
  55. package/dist/{chunk-AZXTLZHE.js → chunk-K4Z7MK6T.js} +169 -165
  56. package/dist/{chunk-WTSQKJAR.js → chunk-K7O6AHSJ.js} +10 -10
  57. package/dist/{chunk-S6ZQFPOX.js → chunk-KNJH6WJQ.js} +6 -6
  58. package/dist/{chunk-SUIZOCSY.js → chunk-KNSOA43J.js} +1 -1
  59. package/dist/{chunk-3QMLB4TI.js → chunk-KXGTLAUW.js} +2 -2
  60. package/dist/{chunk-OHEUOWYT.js → chunk-KZ732ZVW.js} +1 -1
  61. package/dist/{chunk-G3LR6V6N.js → chunk-L6BDRYUK.js} +19 -17
  62. package/dist/{chunk-OVPR3GQ6.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-Z2W5YJBW.js → chunk-MJRGPEQ5.js} +11 -11
  68. package/dist/{chunk-3EIZMRXI.js → chunk-MOAVEPC4.js} +10 -10
  69. package/dist/{chunk-TOOXNL6M.js → chunk-NGNBJIUO.js} +7 -7
  70. package/dist/{chunk-AGEQRJ5A.js → chunk-NHA5K226.js} +1 -1
  71. package/dist/{chunk-YLW26OHX.js → chunk-NNEQOC3U.js} +31 -59
  72. package/dist/{chunk-ZWZD4TJ5.js → chunk-O2MHF7QM.js} +35 -36
  73. package/dist/{chunk-PTJXMYRY.js → chunk-OLWGYBYT.js} +15 -16
  74. package/dist/{chunk-JKAVKTMY.js → chunk-OZQQ3AIR.js} +17 -20
  75. package/dist/{chunk-6JLNZ6DP.js → chunk-P5MSLVUW.js} +10 -10
  76. package/dist/{chunk-OF2YGDUE.js → chunk-PFJLYRO3.js} +37 -38
  77. package/dist/chunk-PKWEBMCA.js +2957 -0
  78. package/dist/{chunk-JLMS7EMD.js → chunk-PPQHMSPH.js} +16 -15
  79. package/dist/{chunk-6EIV3H7O.js → chunk-PQF6YGYB.js} +12 -5
  80. package/dist/{chunk-VU2PRGRI.js → chunk-PQXUZYTQ.js} +4 -4
  81. package/dist/{chunk-MV6ST2KT.js → chunk-Q7J3JYJ2.js} +13 -12
  82. package/dist/{chunk-BMMRLJA4.js → chunk-QE5DJ7MX.js} +27 -10
  83. package/dist/{chunk-IZ36G463.js → chunk-QE7BJQ6K.js} +7 -7
  84. package/dist/{chunk-E5SSUV2A.js → chunk-QMWKSYWB.js} +4 -4
  85. package/dist/{chunk-QJ4T73J5.js → chunk-QV3JPCMK.js} +1 -1
  86. package/dist/{chunk-3PMLYGJN.js → chunk-R4L7KZ7R.js} +5 -5
  87. package/dist/{chunk-7ZVEFWOE.js → chunk-RIH3UBK4.js} +10 -10
  88. package/dist/{chunk-T5EGSBM2.js → chunk-RJ3APNIP.js} +3 -3
  89. package/dist/{chunk-AAIVSSUU.js → chunk-S6MCMD27.js} +35 -12
  90. package/dist/{chunk-SF7KSXB5.js → chunk-SCU62JLX.js} +6 -6
  91. package/dist/{chunk-FDLGJFAE.js → chunk-SDYLT45T.js} +3 -3
  92. package/dist/chunk-TFKN5EIR.js +27 -0
  93. package/dist/{chunk-Y7XMKBFP.js → chunk-TKOFTLGB.js} +34 -26
  94. package/dist/chunk-TQWRH25U.js +35 -0
  95. package/dist/{chunk-DZSQXG66.js → chunk-TWEOJE3D.js} +277 -62
  96. package/dist/{chunk-R67WQ5RY.js → chunk-UN72ZAJ5.js} +8 -8
  97. package/dist/{chunk-AD7JDEI6.js → chunk-UNP6Y4JV.js} +16 -16
  98. package/dist/{chunk-D6ANA6YU.js → chunk-VGRGW4UL.js} +63 -55
  99. package/dist/{chunk-DFAY7JUN.js → chunk-VSQT6IHZ.js} +2 -2
  100. package/dist/{chunk-7T64QA5D.js → chunk-VWEBZ2JV.js} +39 -38
  101. package/dist/{chunk-HRQTYU2T.js → chunk-W26QZ3OM.js} +1 -1
  102. package/dist/{chunk-2HWVG3IM.js → chunk-XDNWR7SG.js} +2 -2
  103. package/dist/{chunk-75TVYCQW.js → chunk-XSC3BCN3.js} +5 -5
  104. package/dist/{chunk-ME6MF2N2.js → chunk-YCR6ZYTE.js} +1 -1
  105. package/dist/{chunk-LD7SXICE.js → chunk-ZI7YHV6I.js} +5 -5
  106. package/dist/{chunk-E3PNZDPH.js → chunk-ZQSSO7LO.js} +33 -1
  107. package/dist/{chunk-T6PPK3T6.js → chunk-ZULZS2I6.js} +385 -407
  108. package/dist/index.js +6508 -5413
  109. package/dist/mcp/analyze-cli.js +9 -9
  110. package/dist/mcp/cli.js +39 -38
  111. package/dist/mcp/server.js +602 -345
  112. package/dist/mcp/worker.js +57 -58
  113. package/dist/probes/installer.js +19 -17
  114. package/docs/architecture.md +113 -0
  115. package/docs/ast-grep_rules_catalog.md +2 -2
  116. package/docs/ci.md +18 -4
  117. package/docs/defect-shapes.md +41 -3
  118. package/docs/dependencies.md +10 -10
  119. package/docs/features.md +3 -3
  120. package/docs/invariants/dispatch-runners.md +13 -1
  121. package/docs/invariants/lsp-trust-exec.md +19 -0
  122. package/docs/language-coverage.md +39 -0
  123. package/docs/lsp-capability-matrix.md +10 -4
  124. package/docs/lsp-idle-eviction.md +1 -1
  125. package/docs/pi-lens-fixer.md +4 -0
  126. package/docs/pi-lens-merge-policy.md +1 -1
  127. package/docs/pi-lens-reviewer.md +4 -5
  128. package/docs/pi-lens-subagent.md +5 -2
  129. package/docs/prose-standard.md +112 -0
  130. package/docs/servercapabilities.md +1 -1
  131. package/docs/usage.md +50 -0
  132. package/package.json +1 -1
  133. package/rules/ast-grep-rules/rule-tests/array-callback-return-js-test.yml +23 -0
  134. package/rules/ast-grep-rules/rule-tests/array-callback-return-test.yml +23 -0
  135. package/rules/ast-grep-rules/rule-tests/no-negation-in-equality-check-js-test.yml +8 -0
  136. package/rules/ast-grep-rules/rule-tests/no-negation-in-equality-check-test.yml +8 -0
  137. package/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-js-test.yml +16 -0
  138. package/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-test.yml +16 -0
  139. package/rules/ast-grep-rules/rules/array-callback-return-js.yml +8 -0
  140. package/rules/ast-grep-rules/rules/array-callback-return.yml +8 -0
  141. package/rules/ast-grep-rules/rules/no-negation-in-equality-check-js.yml +17 -5
  142. package/rules/ast-grep-rules/rules/no-negation-in-equality-check.yml +17 -5
  143. package/rules/ast-grep-rules/rules/unchecked-throwing-call-js.yml +8 -1
  144. package/rules/ast-grep-rules/rules/unchecked-throwing-call.yml +8 -1
  145. package/rules/tree-sitter-queries/typescript/ts-react-antipatterns.yml +8 -0
  146. package/dist/chunk-3VWEZ6H2.js +0 -72
  147. package/dist/chunk-7KWI5UHL.js +0 -28
  148. package/dist/chunk-7M64NTAK.js +0 -38
  149. package/dist/chunk-BEIPWPVR.js +0 -1037
  150. package/dist/chunk-D7OEGXDX.js +0 -2417
  151. package/dist/chunk-KUDUKKQE.js +0 -89
  152. package/dist/chunk-TM3A3K7T.js +0 -28
  153. package/dist/chunk-VD7MQFEV.js +0 -56
  154. package/dist/chunk-YLHJWAQS.js +0 -256
  155. package/dist/chunk-YULIERZW.js +0 -27
@@ -1,34 +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-PPYUBO6Y.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-5EEWCJG7.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-7M64NTAK.js";
24
- import {
25
16
  load,
26
- resolvePackagePath
27
- } from "./chunk-E3PNZDPH.js";
17
+ resolvePackagePath,
18
+ ruleCorpusFingerprintForCycle
19
+ } from "./chunk-ZQSSO7LO.js";
28
20
  import {
29
21
  extensionsForLanguage,
30
22
  isTypeScriptFile
31
- } from "./chunk-AYDE7RFV.js";
23
+ } from "./chunk-DI4AZZNY.js";
32
24
  import {
33
25
  ensureTool,
34
26
  findManagedToolBinary,
@@ -38,15 +30,21 @@ import {
38
30
  isZizmorAuditTarget,
39
31
  logSessionStart,
40
32
  resolveZizmorGitHubToken
41
- } from "./chunk-NRVWLTOY.js";
33
+ } from "./chunk-B2OXE4AH.js";
42
34
  import {
43
35
  resolveToolCwd
44
- } from "./chunk-YLHJWAQS.js";
36
+ } from "./chunk-LVLPA32Q.js";
45
37
  import {
46
38
  commandSearchReachesProject,
47
39
  findGlobalBinary,
48
40
  isProjectLocalBinPath
49
- } from "./chunk-OVPR3GQ6.js";
41
+ } from "./chunk-LGH2HHZG.js";
42
+ import {
43
+ hasCargoWorkspaceTable,
44
+ readCargoWorkspaceExclude,
45
+ readCargoWorkspaceMembers,
46
+ readTextFileOrUndefined
47
+ } from "./chunk-KNSOA43J.js";
50
48
  import {
51
49
  classifyFinderFailure,
52
50
  classifyProbeFailure,
@@ -54,10 +52,10 @@ import {
54
52
  describeInstallAttempt,
55
53
  logAvailabilityDecision,
56
54
  startHostStallSampler
57
- } from "./chunk-AVBEPUCD.js";
55
+ } from "./chunk-6GLMMGCX.js";
58
56
  import {
59
57
  readDirEntriesSafeAsync
60
- } from "./chunk-YTXFNCVN.js";
58
+ } from "./chunk-74AMPWNC.js";
61
59
  import {
62
60
  OWNER_TAG_ENV,
63
61
  SpawnFailureError,
@@ -86,13 +84,13 @@ import {
86
84
  safeSpawnAsync,
87
85
  statIsFile,
88
86
  trustScopedEnvironment
89
- } from "./chunk-ET3DSSFZ.js";
87
+ } from "./chunk-3PO4YYOX.js";
90
88
  import {
91
89
  DOTNET_CSHARP_ROOT_MARKERS,
92
90
  DOTNET_FSHARP_ROOT_MARKERS,
93
91
  KIND_EXTENSIONS,
94
92
  LEAN_ROOT_MARKERS
95
- } from "./chunk-SRXYSLMW.js";
93
+ } from "./chunk-CQY2HEH7.js";
96
94
  import {
97
95
  boundedKeyLabel,
98
96
  finalizeRecords,
@@ -104,7 +102,7 @@ import {
104
102
  reportPiLensConfigRecords,
105
103
  resolvePiLensConfig,
106
104
  summarizeConfigResolution
107
- } from "./chunk-6EIV3H7O.js";
105
+ } from "./chunk-PQF6YGYB.js";
108
106
  import {
109
107
  FRESHNESS_CADENCE_MS,
110
108
  LSP_NAMESPACE_KEY,
@@ -115,19 +113,19 @@ import {
115
113
  getDirectoryMarkers,
116
114
  getPiLensGlobalConfigPath,
117
115
  unknownDirMtimeRecords
118
- } from "./chunk-3R3Z54J7.js";
116
+ } from "./chunk-LOEJFTF2.js";
119
117
  import {
120
118
  HOOK_WALL_BUDGET_MS,
121
119
  bounded,
122
120
  getProjectTrustGeneration,
123
121
  getProjectTrustState
124
- } from "./chunk-HRQTYU2T.js";
122
+ } from "./chunk-W26QZ3OM.js";
125
123
  import {
126
124
  getDegradationLedgerGeneration,
127
125
  incrementDegradationCount,
128
126
  logExtension,
129
127
  recordDegradationOnce
130
- } from "./chunk-AGEQRJ5A.js";
128
+ } from "./chunk-NHA5K226.js";
131
129
  import {
132
130
  claimPhaseOncePerSession,
133
131
  currentSessionRecordId,
@@ -138,7 +136,7 @@ import {
138
136
  logLatency,
139
137
  redactSecrets,
140
138
  releasePhaseClaim
141
- } from "./chunk-K2GV34T2.js";
139
+ } from "./chunk-7CLWC2UH.js";
142
140
  import {
143
141
  STAGE_TMP_PATTERN
144
142
  } from "./chunk-LJDODBBZ.js";
@@ -1308,6 +1306,9 @@ async function launchLSP(command, args = [], options = {}) {
1308
1306
  args
1309
1307
  };
1310
1308
  }
1309
+ async function launchViaNode(scriptPath, args = [], options = {}) {
1310
+ return launchLSP(process.execPath, [scriptPath, ...args], options);
1311
+ }
1311
1312
 
1312
1313
  // dist/clients/lsp/config.js
1313
1314
  function asRecord(value) {
@@ -2042,13 +2043,25 @@ var SERVER_DIAGNOSTIC_STRATEGIES = {
2042
2043
  // applies this flag to a native-ts7 instance.
2043
2044
  silentOnClean: true
2044
2045
  },
2045
- "rust-analyzer": {
2046
- seedFirstPush: false,
2047
- pullRetryBudgetMs: 500,
2048
- debounceMs: 150,
2049
- aggregateWaitMs: 3e3,
2050
- expectSemanticSecondPush: true
2051
- },
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.
2052
2065
  // PythonServer (pyright / basedpyright) — openFilesOnly mode: lazy per-file
2053
2066
  // analysis, startup similar to jedi. seedFirstPush: true because pyright's
2054
2067
  // first publishDiagnostics after didOpen is the complete result for that file.
@@ -2071,13 +2084,6 @@ var SERVER_DIAGNOSTIC_STRATEGIES = {
2071
2084
  aggregateWaitMs: 3e3,
2072
2085
  expectSemanticSecondPush: false
2073
2086
  },
2074
- eslint: {
2075
- seedFirstPush: true,
2076
- pullRetryBudgetMs: 0,
2077
- debounceMs: 200,
2078
- aggregateWaitMs: 2e3,
2079
- expectSemanticSecondPush: false
2080
- },
2081
2087
  // Opengrep security scanner (cross-language LSP). It pushes an EMPTY result
2082
2088
  // during the one-time rule-load window at startup, then the real scan after
2083
2089
  // `semgrep/rulesRefreshed` — so never seed the first push, and hold that
@@ -2352,6 +2358,35 @@ var SERVER_DIAGNOSTIC_STRATEGIES = {
2352
2358
  aggregateWaitMs: 6e3,
2353
2359
  expectSemanticSecondPush: false
2354
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
+ },
2355
2390
  cue: {
2356
2391
  seedFirstPush: true,
2357
2392
  pullRetryBudgetMs: 0,
@@ -4006,12 +4041,45 @@ async function findTsserverPath(root, allowInstall, options) {
4006
4041
  }));
4007
4042
  return tsserverForTsc(repairedTsc);
4008
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
+ }
4009
4076
  async function findNativeTypeScriptLsp(root) {
4010
4077
  const home = realpathOrResolve(os6.homedir());
4011
4078
  for (const currentDir of walkUpDirs(root, { spelling: true })) {
4012
4079
  if (isAtOrAboveHomeDir(realpathOrResolve(currentDir), home))
4013
4080
  break;
4014
- const typescriptDir = path8.join(currentDir, "node_modules", "typescript");
4081
+ const nodeModulesDir = path8.join(currentDir, "node_modules");
4082
+ const typescriptDir = path8.join(nodeModulesDir, "typescript");
4015
4083
  const packageJsonPath = path8.join(typescriptDir, "package.json");
4016
4084
  let packageJsonText;
4017
4085
  try {
@@ -4038,11 +4106,14 @@ async function findNativeTypeScriptLsp(root) {
4038
4106
  } catch {
4039
4107
  return void 0;
4040
4108
  }
4041
- const majorText = version.split(".", 1)[0] ?? "";
4042
- const major = /^\d+$/.test(majorText) ? Number(majorText) : Number.NaN;
4043
- if (!Number.isFinite(major) || major < 7)
4109
+ const major = typeScriptMajor(version);
4110
+ if (!Number.isFinite(major))
4044
4111
  return void 0;
4045
- 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");
4046
4117
  const candidates = process.platform === "win32" ? [`${localTsc}.cmd`, `${localTsc}.exe`, localTsc] : [localTsc];
4047
4118
  for (const command of candidates) {
4048
4119
  try {
@@ -4050,7 +4121,8 @@ async function findNativeTypeScriptLsp(root) {
4050
4121
  return {
4051
4122
  command,
4052
4123
  version,
4053
- nodeModulesDir: path8.join(currentDir, "node_modules")
4124
+ entry: "bin-link",
4125
+ nodeModulesDir
4054
4126
  };
4055
4127
  } catch {
4056
4128
  }
@@ -4059,6 +4131,59 @@ async function findNativeTypeScriptLsp(root) {
4059
4131
  }
4060
4132
  return void 0;
4061
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
+ }
4062
4187
  async function findEffectTsgoLsp(nodeModulesDir) {
4063
4188
  let release;
4064
4189
  try {
@@ -4227,6 +4352,44 @@ var TypeScriptRoot = withRootMarkers(DenoExcludeRoot(async (file) => {
4227
4352
  return projectRoot;
4228
4353
  return FileDirRoot(file);
4229
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
+ }
4230
4393
  var TypeScriptServer = {
4231
4394
  id: "typescript",
4232
4395
  idleEviction: "transparent",
@@ -4246,72 +4409,30 @@ var TypeScriptServer = {
4246
4409
  const nativeLsp = await findNativeTypeScriptLsp(root);
4247
4410
  const effectLsp = nativeLsp ? await findEffectTsgoLsp(nativeLsp.nodeModulesDir) : void 0;
4248
4411
  if (nativeLsp && effectLsp && admitProjectSuppliedTsserver(effectLsp.command, root, true, options?.projectCodeAllowed)) {
4249
- const env2 = await getToolEnvironment();
4412
+ const env = await getToolEnvironment();
4250
4413
  try {
4251
- 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 });
4252
4415
  logSessionStart(`lsp typescript-effect-tsgo: version=${effectLsp.releaseTag} typescript=${nativeLsp.version} command=${effectLsp.command}`);
4253
4416
  return {
4254
- process: proc2,
4417
+ process: proc,
4255
4418
  source: "direct",
4256
- 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
+ }
4257
4425
  };
4258
4426
  } catch (launchFailure) {
4259
- recordDegradationOnce({
4260
- kind: "lsp-registry-decision",
4261
- subject: `effect-tsgo-launch:g${getDegradationLedgerGeneration()}:${root}`,
4262
- reason: `effect-tsgo launch failed, using the native launch: ${launchFailure instanceof Error ? launchFailure.message : String(launchFailure)}`,
4263
- metadata: {
4264
- field: "effect-tsgo-launch",
4265
- launchVariant: "effect-tsgo"
4266
- }
4267
- });
4427
+ recordEffectTsgoFallback(root, "effect-tsgo launch failed, using the native launch", launchFailure);
4268
4428
  }
4269
4429
  }
4270
- if (nativeLsp && admitProjectSuppliedTsserver(nativeLsp.command, root, true, options?.projectCodeAllowed)) {
4271
- const env2 = await getToolEnvironment();
4272
- logSessionStart(`lsp typescript-native: version=${nativeLsp.version} command=${nativeLsp.command}`);
4273
- const proc2 = await launchLSP(nativeLsp.command, ["--lsp", "--stdio"], {
4274
- cwd: root,
4275
- env: env2
4276
- });
4277
- return { process: proc2, source: "direct", launchVariant: "native-ts7" };
4430
+ if (nativeLsp) {
4431
+ const native = await launchNativeTypeScript(nativeLsp, root, options);
4432
+ if (native)
4433
+ return native;
4278
4434
  }
4279
- let source = "direct";
4280
- let lspPath = await findAncestorFileAmong(root, [
4281
- ["node_modules", ".bin", "typescript-language-server.cmd"],
4282
- ["node_modules", ".bin", "typescript-language-server"]
4283
- ]);
4284
- if (!lspPath) {
4285
- lspPath = await ensureTool("typescript-language-server", {
4286
- allowInstall: canInstall(options?.allowInstall)
4287
- });
4288
- if (lspPath)
4289
- source = "managed";
4290
- if (!lspPath) {
4291
- return void 0;
4292
- }
4293
- }
4294
- const tsserverPath = await findTsserverPath(root, options?.allowInstall, options);
4295
- if (!tsserverPath) {
4296
- admitProjectSuppliedTsserver(void 0, root, true, options?.projectCodeAllowed);
4297
- return void 0;
4298
- }
4299
- if (tsserverPath)
4300
- source = "managed";
4301
- const env = await getToolEnvironment();
4302
- const proc = await launchLSP(lspPath, ["--stdio"], {
4303
- cwd: root,
4304
- env: {
4305
- ...env,
4306
- TSSERVER_PATH: tsserverPath
4307
- }
4308
- });
4309
- return {
4310
- process: proc,
4311
- source,
4312
- initialization: tsserverPath ? { tsserver: { path: tsserverPath } } : void 0,
4313
- launchVariant: "classic"
4314
- };
4435
+ return launchClassicTypeScript(root, options);
4315
4436
  }
4316
4437
  };
4317
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-ET3DSSFZ.js";
4
+ } from "./chunk-3PO4YYOX.js";
5
5
 
6
6
  // dist/clients/opengrep-rule-pack.js
7
7
  import * as fs from "node:fs";