pi-lens 4.4.4 → 4.4.5

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 (179) hide show
  1. package/CHANGELOG.md +440 -0
  2. package/README.md +13 -3
  3. package/config/dependency-cruiser-eager-allowlist.json +1 -0
  4. package/dist/chunk-22Y2BM7H.js +23 -0
  5. package/dist/{chunk-ATKJFDQN.js → chunk-27VWVB23.js} +12 -14
  6. package/dist/{chunk-S2HEXIWI.js → chunk-2FYKETQJ.js} +10 -6
  7. package/dist/{chunk-SRYEJNES.js → chunk-2LDMXL2M.js} +2 -2
  8. package/dist/{chunk-ZHH37KZL.js → chunk-2SDHYHHO.js} +17 -17
  9. package/dist/chunk-2Y6OJRSI.js +38 -0
  10. package/dist/chunk-3SNDVPOR.js +507 -0
  11. package/dist/{chunk-5OFV52AM.js → chunk-3WCEHYOI.js} +1 -1
  12. package/dist/chunk-44X7VIKR.js +73 -0
  13. package/dist/{chunk-DEL2U6CM.js → chunk-4FHUGDKU.js} +16 -14
  14. package/dist/{chunk-CT4MN5IU.js → chunk-4ODSZ35Z.js} +353 -359
  15. package/dist/{chunk-ZIVJBOO3.js → chunk-4U7GDSZQ.js} +2 -2
  16. package/dist/chunk-54NIOJJZ.js +25 -0
  17. package/dist/{chunk-N5FLEO7W.js → chunk-5DKE4HGX.js} +37 -37
  18. package/dist/{chunk-P63GXC37.js → chunk-5LRUKYFA.js} +31 -4
  19. package/dist/{chunk-HRNHZA3N.js → chunk-63NMUNYP.js} +12 -16
  20. package/dist/{chunk-HWCCCQNX.js → chunk-6XSESGWD.js} +13 -6
  21. package/dist/{chunk-UMS2MFPZ.js → chunk-72J27ICO.js} +2 -3
  22. package/dist/{chunk-ED36RF6Y.js → chunk-7FLRUH6B.js} +1 -1
  23. package/dist/chunk-7IYC4ENJ.js +297 -0
  24. package/dist/chunk-7WWQAW5P.js +30 -0
  25. package/dist/{chunk-3DA2JDOL.js → chunk-7ZS7MC24.js} +551 -203
  26. package/dist/{chunk-WMYE35PX.js → chunk-AHWA4AKM.js} +7 -5
  27. package/dist/{chunk-JW3YWBVB.js → chunk-AI3GP74G.js} +17 -19
  28. package/dist/{chunk-AGSS7277.js → chunk-APFJKOP6.js} +6 -23
  29. package/dist/{chunk-ZVUL7QYY.js → chunk-ASRAO7KG.js} +29 -32
  30. package/dist/{chunk-BW5KFIQC.js → chunk-AWQWXSW4.js} +1 -0
  31. package/dist/{chunk-TLX72JTG.js → chunk-CG5V25HX.js} +1 -1
  32. package/dist/chunk-CKEQFGLT.js +32 -0
  33. package/dist/{chunk-Y6GZHWSJ.js → chunk-COOUUC5W.js} +6 -6
  34. package/dist/{chunk-XTBDCR27.js → chunk-CPZ5JJW6.js} +4 -4
  35. package/dist/{chunk-RKKOYPRA.js → chunk-DS2USX5G.js} +13 -15
  36. package/dist/chunk-EA2ZRG44.js +27 -0
  37. package/dist/{chunk-GSLNCYGG.js → chunk-EDMLIW6W.js} +13 -14
  38. package/dist/{chunk-2EECBNC5.js → chunk-EIKRZ32J.js} +75 -0
  39. package/dist/chunk-EKNWOL2I.js +27 -0
  40. package/dist/{chunk-R3T7CLQ2.js → chunk-ELZRSR5N.js} +41 -41
  41. package/dist/{chunk-GMX5OS7B.js → chunk-EN5AM7PX.js} +11 -12
  42. package/dist/{chunk-3RKP3FMS.js → chunk-EWXXLS26.js} +226 -24
  43. package/dist/chunk-EX4EXBW7.js +37 -0
  44. package/dist/{chunk-XHJBS436.js → chunk-EXVXBSGN.js} +25 -25
  45. package/dist/{chunk-MZGQNL3Y.js → chunk-F7BO6FWH.js} +12 -13
  46. package/dist/{chunk-V35JG4JB.js → chunk-FEDWAYDS.js} +152 -334
  47. package/dist/{chunk-J64T55EI.js → chunk-FWZRGGGY.js} +73 -9
  48. package/dist/{chunk-T57LYLZT.js → chunk-G224FADB.js} +1 -1
  49. package/dist/chunk-G5UCJFT7.js +26 -0
  50. package/dist/{chunk-LLJNQKQW.js → chunk-GLW3YDZZ.js} +20 -13
  51. package/dist/{chunk-GXFV6MYU.js → chunk-GTDSYEA2.js} +72 -39
  52. package/dist/{chunk-DUO2TU77.js → chunk-GYRZ72R4.js} +10 -4
  53. package/dist/chunk-HYVXA3BB.js +49 -0
  54. package/dist/{chunk-W66O5E25.js → chunk-IEBJF3PN.js} +13 -15
  55. package/dist/{chunk-GAQ7OQG6.js → chunk-IL7K66ZQ.js} +83 -94
  56. package/dist/{chunk-T7FEBKXN.js → chunk-JWOVP5BL.js} +7 -9
  57. package/dist/{chunk-UBOQLVT2.js → chunk-K2GUZ4DN.js} +4 -4
  58. package/dist/{chunk-5VSF4UUQ.js → chunk-K4SZB56V.js} +34 -39
  59. package/dist/{chunk-7D6L4MTX.js → chunk-KCBRHV5E.js} +3 -3
  60. package/dist/{chunk-GSM5UU7A.js → chunk-KFXCL4OV.js} +38 -28
  61. package/dist/{chunk-J6MPGQTS.js → chunk-KJJAVH3X.js} +81 -15
  62. package/dist/{chunk-BWD5EPKO.js → chunk-KPVLQHCZ.js} +4 -6
  63. package/dist/{chunk-MPNJLASA.js → chunk-KX56K73G.js} +10 -13
  64. package/dist/{chunk-AWSCPCN2.js → chunk-LMCTHJ2H.js} +19 -19
  65. package/dist/{chunk-IWDLU6K3.js → chunk-MEFLGBCS.js} +4 -6
  66. package/dist/{chunk-TOY6QKOH.js → chunk-MKPCELNI.js} +17 -17
  67. package/dist/{chunk-POMLXPMY.js → chunk-N3PLNNCW.js} +1 -1
  68. package/dist/chunk-N5FBM25N.js +22 -0
  69. package/dist/{chunk-CYRKQRPM.js → chunk-NFNVDDGB.js} +2 -4
  70. package/dist/{chunk-RMLC67LF.js → chunk-NLIVE7L6.js} +2 -30
  71. package/dist/{chunk-24AKHFGP.js → chunk-OMJ3OFBJ.js} +6 -6
  72. package/dist/{chunk-IQWN5JCP.js → chunk-OZNCKLOX.js} +13 -14
  73. package/dist/chunk-P5XUGPIX.js +31 -0
  74. package/dist/{chunk-2KXTHF3M.js → chunk-PJXNTPB2.js} +253 -33
  75. package/dist/chunk-PKOXJIVT.js +88 -0
  76. package/dist/{chunk-DGUKIYSI.js → chunk-PP2A5V2T.js} +8 -10
  77. package/dist/{chunk-KAPJINKN.js → chunk-Q42LJANT.js} +2 -2
  78. package/dist/{chunk-UZ2XCLYS.js → chunk-Q4BKKOVC.js} +8 -8
  79. package/dist/{chunk-TIQ2PKDW.js → chunk-QT66NEYN.js} +4 -4
  80. package/dist/{chunk-U44DJXQP.js → chunk-RCHO5W7M.js} +15 -18
  81. package/dist/{chunk-YH5MVY2U.js → chunk-RG3MXTRI.js} +7 -7
  82. package/dist/chunk-RG7OODGM.js +57 -0
  83. package/dist/{chunk-OHKJ7PQF.js → chunk-RU34BA4D.js} +43 -39
  84. package/dist/{chunk-JMYYOTQG.js → chunk-S26LC76R.js} +13 -1
  85. package/dist/{chunk-XBJVAEEO.js → chunk-S55TEC7I.js} +3 -2
  86. package/dist/{chunk-RVK72CZX.js → chunk-SJHC3BCZ.js} +1397 -481
  87. package/dist/{chunk-IYNJ6YPZ.js → chunk-SNEUMLM7.js} +4 -4
  88. package/dist/{chunk-S67KYG37.js → chunk-T4NGVFYI.js} +2 -2
  89. package/dist/{chunk-YCWYO6TQ.js → chunk-THEXI2QO.js} +48 -45
  90. package/dist/{chunk-AMERCH6V.js → chunk-TL2TCJYL.js} +15 -16
  91. package/dist/{chunk-KUA4OJ5Y.js → chunk-TPYYEDP5.js} +823 -350
  92. package/dist/{chunk-YNE3RP52.js → chunk-TVZRLTG6.js} +8 -1
  93. package/dist/{chunk-ROYSX2S5.js → chunk-UCVMSOXF.js} +2 -2
  94. package/dist/chunk-UL5SXQVX.js +32 -0
  95. package/dist/{chunk-7HXE67BN.js → chunk-UO66IMVP.js} +2 -2
  96. package/dist/{chunk-VOOAPROD.js → chunk-UVY4TOJH.js} +3 -3
  97. package/dist/{chunk-RKBXZN3A.js → chunk-VIDEKABZ.js} +2 -2
  98. package/dist/{chunk-2FN63LPV.js → chunk-VITFDI3O.js} +13 -14
  99. package/dist/{chunk-6DLWKFEX.js → chunk-VUAVE3QC.js} +41 -42
  100. package/dist/{chunk-FM4RDMKT.js → chunk-WUY4BZEP.js} +10 -12
  101. package/dist/{chunk-SD4I7ZO4.js → chunk-X3UTCXAA.js} +43 -53
  102. package/dist/chunk-XHDBJODR.js +45 -0
  103. package/dist/{chunk-5IUSNGOC.js → chunk-XHLK33VM.js} +28 -21
  104. package/dist/{chunk-3KAZU3VR.js → chunk-XI34NWDI.js} +2 -2
  105. package/dist/{chunk-QBFBRV2B.js → chunk-XWFIHYCH.js} +4 -2
  106. package/dist/{chunk-JUKMK5Y4.js → chunk-Y2TPADJR.js} +10 -11
  107. package/dist/{chunk-EBC36LNN.js → chunk-Y5KTA2OB.js} +17 -17
  108. package/dist/{chunk-HYGZEMX6.js → chunk-YKVDBNPO.js} +11 -5
  109. package/dist/{chunk-KN35K52N.js → chunk-YSDPVDFC.js} +3 -3
  110. package/dist/chunk-YWNO5Q4R.js +44 -0
  111. package/dist/{chunk-US7ECLD7.js → chunk-YWWG4AQA.js} +119 -28
  112. package/dist/{chunk-O4NWQT6I.js → chunk-YXDCRUKQ.js} +4 -4
  113. package/dist/{chunk-XYURS6EN.js → chunk-YXGRRORB.js} +15 -17
  114. package/dist/{chunk-IUE7SSKV.js → chunk-ZAPSUBLU.js} +13 -7
  115. package/dist/{chunk-EUXZEFTV.js → chunk-ZPJM7DID.js} +3 -3
  116. package/dist/{chunk-5HSRT26B.js → chunk-ZSUX7KEM.js} +16 -15
  117. package/dist/index.js +37155 -32210
  118. package/dist/mcp/analyze-cli.js +11 -12
  119. package/dist/mcp/cli.js +46 -45
  120. package/dist/mcp/server.js +1210 -574
  121. package/dist/mcp/worker.js +65 -65
  122. package/dist/probes/installer.js +21 -23
  123. package/docs/adr/0010-trace-validation-session-lifecycle.md +390 -0
  124. package/docs/adr/README.md +1 -0
  125. package/docs/ast-grep_rules_catalog.md +5 -3
  126. package/docs/configuration.md +9 -0
  127. package/docs/engineering-principles.md +12 -0
  128. package/docs/environment-variables.md +20 -0
  129. package/docs/features.md +16 -1
  130. package/docs/globalconfig.md +37 -8
  131. package/docs/lsp-capability-matrix.md +105 -12
  132. package/docs/lsp-idle-eviction.md +37 -18
  133. package/docs/pi-lens-fixer.md +22 -1
  134. package/docs/pi-lens-investigator.md +14 -0
  135. package/docs/pi-lens-merge-policy.md +23 -10
  136. package/docs/pi-lens-monitor.md +64 -8
  137. package/docs/pi-lens-retro.md +2 -2
  138. package/docs/pi-lens-reviewer.md +48 -1
  139. package/docs/pi-lens-subagent.md +8 -1
  140. package/docs/release-qa-baseline.md +19 -7
  141. package/docs/servercapabilities.md +47 -47
  142. package/docs/settings.md +9 -5
  143. package/docs/subagent-compat.md +1 -1
  144. package/docs/usage.md +1 -0
  145. package/package.json +6 -4
  146. package/rules/ast-grep-rules/rule-tests/no-return-value-in-generator-test.yml +17 -0
  147. package/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-js-test.yml +86 -0
  148. package/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-test.yml +86 -0
  149. package/rules/ast-grep-rules/rule-tests/unchecked-numeric-parse-python-test.yml +15 -0
  150. package/rules/ast-grep-rules/rules/no-return-value-in-generator.yml +9 -4
  151. package/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +119 -0
  152. package/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +119 -0
  153. package/rules/ast-grep-rules/rules/unchecked-numeric-parse-python.yml +13 -2
  154. package/rules/rule-catalog.json +25 -1
  155. package/scripts/analyze-pi-lens-logs.mjs +15 -5
  156. package/scripts/lib/is-main-module.mjs +27 -0
  157. package/scripts/lib/scratch-home-env.mjs +21 -0
  158. package/scripts/rpc-load-check.mjs +4 -6
  159. package/scripts/warm-loader-cache.mjs +2 -5
  160. package/dist/chunk-3PTHXJXR.js +0 -28
  161. package/dist/chunk-3QED2P4V.js +0 -31
  162. package/dist/chunk-5WRPDP2A.js +0 -47
  163. package/dist/chunk-ABBOA7UD.js +0 -157
  164. package/dist/chunk-CUHSHSB6.js +0 -273
  165. package/dist/chunk-GL5LUMZE.js +0 -51
  166. package/dist/chunk-HAD7QRQI.js +0 -30
  167. package/dist/chunk-JORED7EX.js +0 -44
  168. package/dist/chunk-KYUB6QDC.js +0 -72
  169. package/dist/chunk-LZSEQW6A.js +0 -57
  170. package/dist/chunk-M2IFVFWU.js +0 -79
  171. package/dist/chunk-M2UD3LPU.js +0 -88
  172. package/dist/chunk-MBKQHGA7.js +0 -39
  173. package/dist/chunk-R7YOCSNV.js +0 -23
  174. package/dist/chunk-SKAMFC7A.js +0 -28
  175. package/dist/chunk-SYE6T2EB.js +0 -28
  176. package/dist/chunk-TRETHTQO.js +0 -26
  177. package/dist/chunk-UA7ZXYDR.js +0 -184
  178. package/dist/chunk-XTFDJI3T.js +0 -24
  179. package/dist/chunk-Z3CCVDUB.js +0 -76
@@ -2,10 +2,10 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
2
2
  import {
3
3
  getGlobalPiLensDir,
4
4
  safeSpawnAsync
5
- } from "./chunk-KUA4OJ5Y.js";
5
+ } from "./chunk-TPYYEDP5.js";
6
6
  import {
7
7
  createSingleFlight
8
- } from "./chunk-BW5KFIQC.js";
8
+ } from "./chunk-AWQWXSW4.js";
9
9
 
10
10
  // dist/clients/tool-probe.js
11
11
  import * as fs from "node:fs";
@@ -5,10 +5,10 @@ import {
5
5
  getMaxLogSizeMB,
6
6
  getTurnId,
7
7
  isTestMode
8
- } from "./chunk-YNE3RP52.js";
8
+ } from "./chunk-TVZRLTG6.js";
9
9
  import {
10
10
  normalizeLoggedPath
11
- } from "./chunk-3RKP3FMS.js";
11
+ } from "./chunk-EWXXLS26.js";
12
12
 
13
13
  // dist/clients/latency-logger.js
14
14
  import * as path from "node:path";
@@ -33,6 +33,7 @@ var LAST_PHASE_EXCLUDED = /* @__PURE__ */ new Set([
33
33
  "turn_end_test_selection",
34
34
  "lsp_aux_wait_outcome",
35
35
  "tool_set_mutation",
36
+ "tool_set_decision",
36
37
  "availability_decision",
37
38
  "finding_dead_path_drop",
38
39
  "finding_stale_line_demote",
@@ -54,6 +55,7 @@ var LAST_PHASE_EXCLUDED = /* @__PURE__ */ new Set([
54
55
  "session_handoff_adopt",
55
56
  "session_store_action",
56
57
  "session_end_fence_rollup",
58
+ "session_handoff_turn_state",
57
59
  "format_late_resync_chained",
58
60
  "lsp_created_import_scan_rollup"
59
61
  ]);
@@ -1,20 +1,19 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  getProjectDataDir
4
- } from "./chunk-KUA4OJ5Y.js";
5
- import "./chunk-J6MPGQTS.js";
6
- import "./chunk-5HSRT26B.js";
7
- import "./chunk-2EECBNC5.js";
8
- import "./chunk-J64T55EI.js";
9
- import "./chunk-POMLXPMY.js";
10
- import "./chunk-JMYYOTQG.js";
11
- import "./chunk-QBFBRV2B.js";
4
+ } from "./chunk-TPYYEDP5.js";
5
+ import "./chunk-KJJAVH3X.js";
6
+ import "./chunk-ZSUX7KEM.js";
7
+ import "./chunk-EIKRZ32J.js";
8
+ import "./chunk-FWZRGGGY.js";
9
+ import "./chunk-N3PLNNCW.js";
10
+ import "./chunk-S26LC76R.js";
11
+ import "./chunk-XWFIHYCH.js";
12
12
  import {
13
13
  redactSecrets
14
- } from "./chunk-YNE3RP52.js";
14
+ } from "./chunk-TVZRLTG6.js";
15
15
  import "./chunk-LJDODBBZ.js";
16
- import "./chunk-ABBOA7UD.js";
17
- import "./chunk-3RKP3FMS.js";
16
+ import "./chunk-EWXXLS26.js";
18
17
  import "./chunk-NXL4FFQQ.js";
19
18
 
20
19
  // dist/clients/fix-worklog.js
@@ -1,27 +1,14 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  createToolchainAvailability
4
- } from "./chunk-HYGZEMX6.js";
4
+ } from "./chunk-YKVDBNPO.js";
5
5
  import {
6
6
  createSubsystemLogger
7
- } from "./chunk-POMLXPMY.js";
7
+ } from "./chunk-N3PLNNCW.js";
8
8
 
9
9
  // dist/clients/rust-client.js
10
10
  import * as path from "node:path";
11
- var CARGO_WINDOWS_PATHS = [
12
- path.join(process.env.USERPROFILE || "", ".cargo", "bin", "cargo.exe"),
13
- path.join(process.env.SYSTEMDRIVE || "C:", "\\cargo", "bin", "cargo.exe"),
14
- "cargo.exe"
15
- // PATH
16
- ];
17
11
  var PROBE_TIMEOUT_MS = 3e3;
18
- var CARGO_UNIX_PATHS = [
19
- path.join(process.env.HOME || "", ".cargo", "bin", "cargo"),
20
- "/usr/local/cargo/bin/cargo",
21
- "/usr/bin/cargo",
22
- "cargo"
23
- // PATH
24
- ];
25
12
  var RustClient = class {
26
13
  /**
27
14
  * Availability lifecycle, behind the shared transient-aware latch (#1476).
@@ -37,8 +24,21 @@ var RustClient = class {
37
24
  this.availability = createToolchainAvailability({
38
25
  tool: "cargo",
39
26
  label: "Cargo",
40
- windowsPaths: CARGO_WINDOWS_PATHS,
41
- unixPaths: CARGO_UNIX_PATHS,
27
+ // Common install paths, read when the client is built rather than at
28
+ // import, so the home they name is the one the client runs under.
29
+ windowsPaths: [
30
+ path.join(process.env.USERPROFILE || "", ".cargo", "bin", "cargo.exe"),
31
+ path.join(process.env.SYSTEMDRIVE || "C:", "\\cargo", "bin", "cargo.exe"),
32
+ "cargo.exe"
33
+ // PATH
34
+ ],
35
+ unixPaths: [
36
+ path.join(process.env.HOME || "", ".cargo", "bin", "cargo"),
37
+ "/usr/local/cargo/bin/cargo",
38
+ "/usr/bin/cargo",
39
+ "cargo"
40
+ // PATH
41
+ ],
42
42
  probeArgs: ["--version"],
43
43
  budgetMs: PROBE_TIMEOUT_MS,
44
44
  log: (msg) => this.log(msg)
@@ -2,19 +2,21 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
2
2
  import {
3
3
  createAvailabilityProbeFlight,
4
4
  probeToolAsync
5
- } from "./chunk-3KAZU3VR.js";
5
+ } from "./chunk-XI34NWDI.js";
6
6
  import {
7
7
  classifyProbeFailure,
8
8
  createAvailabilityLatch,
9
9
  logAvailabilityDecision,
10
10
  startHostStallSampler
11
- } from "./chunk-P63GXC37.js";
11
+ } from "./chunk-5LRUKYFA.js";
12
12
  import {
13
- createGenerationSource
14
- } from "./chunk-KUA4OJ5Y.js";
13
+ createGenerationSource,
14
+ isUntrustedProjectPath,
15
+ recordProjectCommandRefusal
16
+ } from "./chunk-TPYYEDP5.js";
15
17
  import {
16
18
  createSingleFlight
17
- } from "./chunk-BW5KFIQC.js";
19
+ } from "./chunk-AWQWXSW4.js";
18
20
 
19
21
  // dist/clients/dispatch/runners/utils/candidate-probe.js
20
22
  import * as fs from "node:fs";
@@ -27,6 +29,10 @@ async function probeAvailabilityCandidates(candidates, probeArgs, timeoutMs) {
27
29
  try {
28
30
  if (candidate.includes("\\") || candidate.includes("/")) {
29
31
  if (fs.existsSync(candidate)) {
32
+ if (isUntrustedProjectPath(candidate)) {
33
+ recordProjectCommandRefusal(candidate);
34
+ continue;
35
+ }
30
36
  return {
31
37
  foundPath: candidate,
32
38
  sawTransient,
@@ -3,13 +3,13 @@ import {
3
3
  findModuleForPath,
4
4
  getDownstreamModules,
5
5
  getModuleSourceFiles
6
- } from "./chunk-XTBDCR27.js";
6
+ } from "./chunk-CPZ5JJW6.js";
7
7
  import {
8
8
  detectFileRole
9
- } from "./chunk-J6MPGQTS.js";
9
+ } from "./chunk-KJJAVH3X.js";
10
10
  import {
11
11
  normalizeMapKey
12
- } from "./chunk-3RKP3FMS.js";
12
+ } from "./chunk-EWXXLS26.js";
13
13
 
14
14
  // dist/clients/review-graph/query.js
15
15
  function dedupe(items) {
@@ -0,0 +1,44 @@
1
+ import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
+ import {
3
+ DEAD_CODE_DELTA_MAX_SHOWN,
4
+ PythonDeadCodeClient,
5
+ deadCodeIssueCount,
6
+ deadCodeIssueKey,
7
+ deadCodeIssues,
8
+ formatDeadCodeDelta,
9
+ getDeadCodeClients,
10
+ parseVultureOutput,
11
+ stableFindingKey
12
+ } from "./chunk-DS2USX5G.js";
13
+ import "./chunk-7U2IDNXN.js";
14
+ import "./chunk-VIDEKABZ.js";
15
+ import "./chunk-T4NGVFYI.js";
16
+ import "./chunk-KPVLQHCZ.js";
17
+ import "./chunk-KX56K73G.js";
18
+ import "./chunk-K4SZB56V.js";
19
+ import "./chunk-XI34NWDI.js";
20
+ import "./chunk-5LRUKYFA.js";
21
+ import "./chunk-TPYYEDP5.js";
22
+ import "./chunk-AWQWXSW4.js";
23
+ import "./chunk-KJJAVH3X.js";
24
+ import "./chunk-ZSUX7KEM.js";
25
+ import "./chunk-EIKRZ32J.js";
26
+ import "./chunk-FWZRGGGY.js";
27
+ import "./chunk-N3PLNNCW.js";
28
+ import "./chunk-S26LC76R.js";
29
+ import "./chunk-XWFIHYCH.js";
30
+ import "./chunk-TVZRLTG6.js";
31
+ import "./chunk-LJDODBBZ.js";
32
+ import "./chunk-EWXXLS26.js";
33
+ import "./chunk-NXL4FFQQ.js";
34
+ export {
35
+ DEAD_CODE_DELTA_MAX_SHOWN,
36
+ PythonDeadCodeClient,
37
+ deadCodeIssueCount,
38
+ deadCodeIssueKey,
39
+ deadCodeIssues,
40
+ formatDeadCodeDelta,
41
+ getDeadCodeClients,
42
+ parseVultureOutput,
43
+ stableFindingKey
44
+ };
@@ -3,32 +3,35 @@ import {
3
3
  resolveWebTreeSitterPackageDir
4
4
  } from "./chunk-Z54ZSOBZ.js";
5
5
  import {
6
- EXTENSION_TO_GRAMMAR,
7
6
  getUserRuleRoot,
8
7
  ruleCorpusFingerprintForCycle
9
- } from "./chunk-GXFV6MYU.js";
8
+ } from "./chunk-2Y6OJRSI.js";
10
9
  import {
11
10
  getPackageRoot,
12
11
  js_yaml_default,
13
12
  resolvePackagePath
14
- } from "./chunk-FM4RDMKT.js";
13
+ } from "./chunk-WUY4BZEP.js";
14
+ import {
15
+ EXTENSION_TO_GRAMMAR
16
+ } from "./chunk-GTDSYEA2.js";
17
+ import {
18
+ withTimeout
19
+ } from "./chunk-NLIVE7L6.js";
15
20
  import {
16
21
  transientRetryDelayMs
17
- } from "./chunk-P63GXC37.js";
22
+ } from "./chunk-5LRUKYFA.js";
18
23
  import {
19
24
  getProjectIgnoreMatcher,
20
25
  isExcludedDirName
21
- } from "./chunk-KUA4OJ5Y.js";
26
+ } from "./chunk-TPYYEDP5.js";
22
27
  import {
23
28
  notifyUserDegradation
24
- } from "./chunk-J6MPGQTS.js";
29
+ } from "./chunk-KJJAVH3X.js";
25
30
  import {
26
31
  assertInstallAllowed,
27
- getProjectTrustGeneration
28
- } from "./chunk-M2IFVFWU.js";
29
- import {
32
+ getProjectTrustGeneration,
30
33
  writeFileAtomic
31
- } from "./chunk-2EECBNC5.js";
34
+ } from "./chunk-EIKRZ32J.js";
32
35
  import {
33
36
  compareOrdinal,
34
37
  escapeRegExp,
@@ -36,20 +39,21 @@ import {
36
39
  incrementDegradationCount,
37
40
  recordDegradation,
38
41
  recordDegradationOnce
39
- } from "./chunk-J64T55EI.js";
42
+ } from "./chunk-FWZRGGGY.js";
43
+ import {
44
+ logLatency
45
+ } from "./chunk-XWFIHYCH.js";
40
46
  import {
41
47
  createNdjsonLogger,
42
48
  getGlobalPiLensLogDir,
43
49
  getMaxLogSizeMB,
44
50
  isTestMode
45
- } from "./chunk-YNE3RP52.js";
46
- import {
47
- BoundedFifoMap
48
- } from "./chunk-ABBOA7UD.js";
51
+ } from "./chunk-TVZRLTG6.js";
49
52
  import {
53
+ BoundedFifoMap,
50
54
  normalizeFilePath,
51
55
  normalizeLoggedPath
52
- } from "./chunk-3RKP3FMS.js";
56
+ } from "./chunk-EWXXLS26.js";
53
57
 
54
58
  // dist/clients/tree-sitter-logger.js
55
59
  import * as path from "node:path";
@@ -372,6 +376,7 @@ async function downloadGrammarDetailed(destDir, filename, options = {}) {
372
376
  }
373
377
  }
374
378
  var GRAMMAR_STALL_MS = 15e3;
379
+ var GRAMMAR_LOAD_TIMEOUT_MS = 3e4;
375
380
  function armStallBound(ms) {
376
381
  const controller = new AbortController();
377
382
  const timer = setTimeout(() => controller.abort(), ms);
@@ -1520,7 +1525,18 @@ function getBundledQueriesRootHealth() {
1520
1525
  const generation = getDegradationLedgerGeneration();
1521
1526
  if (cachedBundledQueriesRootHealth === void 0 || cachedBundledQueriesRootHealthGeneration !== generation) {
1522
1527
  cachedBundledQueriesRootHealthGeneration = generation;
1523
- cachedBundledQueriesRootHealth = classifyBundledResourceDir(BUNDLED_QUERIES_ROOT);
1528
+ const health = classifyBundledResourceDir(BUNDLED_QUERIES_ROOT);
1529
+ cachedBundledQueriesRootHealth = health;
1530
+ logLatency({
1531
+ type: "phase",
1532
+ phase: "tree_sitter_queries_root_checked",
1533
+ filePath: BUNDLED_QUERIES_ROOT,
1534
+ durationMs: 0,
1535
+ metadata: {
1536
+ status: health.status,
1537
+ entryCount: health.status === "healthy" ? health.entryCount : 0
1538
+ }
1539
+ });
1524
1540
  }
1525
1541
  return cachedBundledQueriesRootHealth;
1526
1542
  }
@@ -2017,6 +2033,9 @@ function createParserCounters() {
2017
2033
  parserFailures: 0
2018
2034
  };
2019
2035
  }
2036
+ function isGrammarLoadTimeout(err) {
2037
+ return err instanceof Error && err.message === `Timeout after ${GRAMMAR_LOAD_TIMEOUT_MS}ms`;
2038
+ }
2020
2039
  function grammarWriteBlockedReason(dir) {
2021
2040
  let probe = dir;
2022
2041
  while (!fs5.existsSync(probe)) {
@@ -3023,7 +3042,7 @@ var TreeSitterClient = class _TreeSitterClient {
3023
3042
  this.grammarFailureAttempts.set(grammarFile, attempts);
3024
3043
  const retryDelayMs = retryable ? transientRetryDelayMs(attempts, "probe-timeout") : void 0;
3025
3044
  this.grammarRetryAtMs.set(grammarFile, retryDelayMs === void 0 ? Number.POSITIVE_INFINITY : Date.now() + retryDelayMs);
3026
- const remedy = cause === "write-dir-unresolvable" ? `This is a packaging/module-resolution fault, not a download problem: reinstall pi-lens so its web-tree-sitter dependency is present, or drop the wasm into pi-lens's own grammars/ directory.` : cause === "write-dir-unwritable" ? `This is a filesystem-permission fault, not a download problem: make that directory writable for the user pi-lens runs as, or reinstall pi-lens as that user.` : retryable ? `if the problem persists, allow the package manager's build scripts (pnpm approve-builds / bun trustedDependencies) or restore network access.` : `Fix: reinstall with a manager that runs postinstall, allow its build scripts (pnpm approve-builds / bun trustedDependencies), or restore network access.`;
3045
+ const remedy = cause === "write-dir-unresolvable" ? `This is a packaging/module-resolution fault, not a download problem: reinstall pi-lens so its web-tree-sitter dependency is present, or drop the wasm into pi-lens's own grammars/ directory.` : cause === "write-dir-unwritable" ? `This is a filesystem-permission fault, not a download problem: make that directory writable for the user pi-lens runs as, or reinstall pi-lens as that user.` : cause === "load-timed-out" ? `This is a local hang while loading the grammar, not a download problem: if it keeps timing out, restart pi and attach the tree-sitter log to a bug report.` : retryable ? `if the problem persists, allow the package manager's build scripts (pnpm approve-builds / bun trustedDependencies) or restore network access.` : `Fix: reinstall with a manager that runs postinstall, allow its build scripts (pnpm approve-builds / bun trustedDependencies), or restore network access.`;
3027
3046
  const unavailable = `tree-sitter grammar '${grammarFile}' is unavailable \u2014 symbol search, module reports and structural rules for this language will be degraded. ${detail} ` + (retryable ? `pi-lens will retry automatically in ${Math.round(retryDelayMs / 1e3)}s; ` : `The grammar source reports it does not exist (not a network problem), so this will not resolve on retry. `) + remedy;
3028
3047
  logTreeSitterDiagnostic({
3029
3048
  subsystem: "tree-sitter-client",
@@ -3049,7 +3068,8 @@ var TreeSitterClient = class _TreeSitterClient {
3049
3068
  // failures used to share one string, so the ledger could not tell an
3050
3069
  // offline laptop from a captive portal serving HTML — the two need
3051
3070
  // different user actions, and the ledger is what a bug report shows.
3052
- reason: retryable ? `runtime grammar download failed \u2014 retryable (${detail.trim()})` : `runtime grammar download failed \u2014 durable (${detail.trim()})`
3071
+ // A hung load of a file already on disk is not a download failure (#4224).
3072
+ reason: cause === "load-timed-out" ? `grammar load timed out \u2014 retryable (${detail.trim()})` : retryable ? `runtime grammar download failed \u2014 retryable (${detail.trim()})` : `runtime grammar download failed \u2014 durable (${detail.trim()})`
3053
3073
  });
3054
3074
  this.refreshGrammarSessionLatches();
3055
3075
  const notifyKey = retryDelayMs ?? -1;
@@ -3087,7 +3107,7 @@ var TreeSitterClient = class _TreeSitterClient {
3087
3107
  * redownload land the identical bytes and spin the ladder against a file
3088
3108
  * that can never pass.
3089
3109
  */
3090
- recordGrammarLoadFailure(grammarPath, grammarFile, err) {
3110
+ recordGrammarLoadFailure(grammarPath, grammarFile, err, cause) {
3091
3111
  const stamp = grammarFileStamp(grammarPath);
3092
3112
  this.verifiedGrammarPaths.delete(grammarPath);
3093
3113
  if (stamp)
@@ -3096,16 +3116,73 @@ var TreeSitterClient = class _TreeSitterClient {
3096
3116
  logTreeSitterDiagnostic({
3097
3117
  subsystem: "tree-sitter-client",
3098
3118
  level: "warn",
3099
- message: `Language.load failed for ${grammarPath} even though the wasm preamble check passed (${message}) \u2014 most likely a truncated download (#1564). Treating the grammar as missing so the next demand re-fetches it.`,
3119
+ message: cause === "load-timed-out" ? `Language.load did not settle for ${grammarPath} (${message}) \u2014 a hang in the local load of a file that passed the wasm preamble check, with no sign of a truncated download. Treating the grammar as missing so the next demand re-fetches it.` : `Language.load failed for ${grammarPath} even though the wasm preamble check passed (${message}) \u2014 most likely a truncated download (#1564). Treating the grammar as missing so the next demand re-fetches it.`,
3100
3120
  metadata: { grammarFile, path: grammarPath, outcome: "load-failed" }
3101
3121
  });
3102
3122
  this.recordGrammarFailure(
3103
3123
  grammarFile,
3104
3124
  `Language.load failed on a resolved grammar file (${message}).`,
3105
3125
  /* retryable */
3106
- true
3126
+ true,
3127
+ cause
3107
3128
  );
3108
3129
  }
3130
+ /**
3131
+ * Watch a `Language.load` that the bound abandoned (#4224). web-tree-sitter
3132
+ * gives the load no abort, so it keeps running and settles later, and
3133
+ * `withDeadline` hands that late settle to a catch that records nothing.
3134
+ * Mirrors #1716's late-answer watch on a timed-out nav request.
3135
+ *
3136
+ * Every late failure is logged once to `tree-sitter.log`. Then:
3137
+ *
3138
+ * - An Emscripten abort kills the runtime whenever it lands, so it reaches
3139
+ * the same latch an on-time abort does (AGENTS.md shape 60). A trap takes
3140
+ * the other arm, as it does on time: charged to the grammar, not the budget.
3141
+ * - Any other failure says the load ended rather than hung. It leaves one
3142
+ * bounded `grammar-blocked` record naming the grammar and the failure. The
3143
+ * timeout already notified the user and climbed the cooldown ladder for
3144
+ * this load, so neither happens again.
3145
+ * - A late success is dropped. The caller was answered null and the grammar
3146
+ * sits on its cooldown, so keeping the language would make the answer depend
3147
+ * on when the load happened to finish.
3148
+ *
3149
+ * One abandoned load has one watch, so a late settle is one record however
3150
+ * many callers joined the build that started it.
3151
+ *
3152
+ * No caller awaits the watch, so it ends in a logging catch: a handler that
3153
+ * throws (the host's `onWasmAbort` can) is written to `tree-sitter.log`
3154
+ * rather than escaping as an unhandled rejection.
3155
+ */
3156
+ observeAbandonedLoad(loading, grammarPath, grammarFile) {
3157
+ loading.then(() => {
3158
+ this.dbg(`Abandoned Language.load for ${grammarFile} succeeded after the bound; ignored`);
3159
+ }, (late) => {
3160
+ const message = late instanceof Error ? late.message : String(late);
3161
+ logTreeSitterDiagnostic({
3162
+ subsystem: "tree-sitter-client",
3163
+ level: "warn",
3164
+ message: `Language.load for ${grammarPath} settled after its ${GRAMMAR_LOAD_TIMEOUT_MS}ms bound and failed (${message}).`,
3165
+ metadata: { grammarFile, outcome: "late-load-failed" }
3166
+ });
3167
+ if (classifyTreeSitterWasmError(late) === "abort") {
3168
+ this.reportWasmAbort(late);
3169
+ } else {
3170
+ incrementDegradationCount({
3171
+ kind: "grammar-blocked",
3172
+ subject: grammarFile,
3173
+ reason: `Language.load failed after its ${GRAMMAR_LOAD_TIMEOUT_MS}ms bound (${message}).`
3174
+ });
3175
+ }
3176
+ }).catch((handlerErr) => {
3177
+ const message = handlerErr instanceof Error ? handlerErr.message : String(handlerErr);
3178
+ logTreeSitterDiagnostic({
3179
+ subsystem: "tree-sitter-client",
3180
+ level: "warn",
3181
+ message: `The late-settle handler for Language.load of ${grammarPath} threw (${message}).`,
3182
+ metadata: { grammarFile, outcome: "late-load-handler-failed" }
3183
+ });
3184
+ });
3185
+ }
3109
3186
  /** Initialize tree-sitter WASM runtime */
3110
3187
  async init() {
3111
3188
  if (this.wasmAborted)
@@ -3220,28 +3297,42 @@ var TreeSitterClient = class _TreeSitterClient {
3220
3297
  this.dbg(`Grammar file not found: ${grammarPath}`);
3221
3298
  return null;
3222
3299
  }
3300
+ let loading;
3223
3301
  try {
3224
3302
  if (!this.LanguageLoader?.load) {
3225
3303
  this.dbg(`LanguageLoader.load not available`);
3226
3304
  return null;
3227
3305
  }
3228
3306
  this.dbg(`Calling Language.load...`);
3229
- const language = await this.LanguageLoader.load(grammarPath);
3307
+ const started = this.LanguageLoader.load(grammarPath);
3308
+ loading = started;
3309
+ const language = await withTimeout(started, GRAMMAR_LOAD_TIMEOUT_MS);
3230
3310
  this.dbg(`Language loaded: ${language?.name || "unknown"}`);
3231
3311
  if (language) {
3232
3312
  this.languages.set(languageId, language);
3233
3313
  }
3234
3314
  return language;
3235
3315
  } catch (err) {
3236
- if (classifyTreeSitterWasmError(err) === "abort") {
3237
- this.reportWasmAbort(err);
3238
- } else {
3239
- this.recordGrammarLoadFailure(grammarPath, grammarFile, err);
3240
- }
3316
+ this.recordLanguageLoadFailure(err, loading, grammarPath, grammarFile);
3241
3317
  this.dbg(`Language load error: ${err}`);
3242
3318
  return null;
3243
3319
  }
3244
3320
  }
3321
+ /**
3322
+ * The one place a failed `Language.load` is recorded, so every path out of
3323
+ * `loadLanguage`'s catch publishes something.
3324
+ */
3325
+ recordLanguageLoadFailure(err, loading, grammarPath, grammarFile) {
3326
+ const abandoned = isGrammarLoadTimeout(err) ? loading : void 0;
3327
+ if (abandoned) {
3328
+ this.observeAbandonedLoad(abandoned, grammarPath, grammarFile);
3329
+ }
3330
+ if (classifyTreeSitterWasmError(err) === "abort") {
3331
+ this.reportWasmAbort(err);
3332
+ } else {
3333
+ this.recordGrammarLoadFailure(grammarPath, grammarFile, err, abandoned ? "load-timed-out" : void 0);
3334
+ }
3335
+ }
3245
3336
  /** Get or create parser for a language */
3246
3337
  async getParser(languageId) {
3247
3338
  if (this.wasmAborted)
@@ -4,10 +4,10 @@ import {
4
4
  getOwnedLspService,
5
5
  peekOwnedLspService,
6
6
  resetOwnedLspService
7
- } from "./chunk-SRYEJNES.js";
8
- import "./chunk-QBFBRV2B.js";
9
- import "./chunk-YNE3RP52.js";
10
- import "./chunk-3RKP3FMS.js";
7
+ } from "./chunk-2LDMXL2M.js";
8
+ import "./chunk-XWFIHYCH.js";
9
+ import "./chunk-TVZRLTG6.js";
10
+ import "./chunk-EWXXLS26.js";
11
11
  import "./chunk-NXL4FFQQ.js";
12
12
  export {
13
13
  configureLspServiceLifecycle,
@@ -44,27 +44,25 @@ import {
44
44
  setProjectSnapshotPromotionSeamForTests,
45
45
  terminateProjectSnapshotPersistWorkerForTests,
46
46
  waitForProjectSnapshotPersistsForTests
47
- } from "./chunk-T7FEBKXN.js";
48
- import "./chunk-W66O5E25.js";
49
- import "./chunk-7HXE67BN.js";
50
- import "./chunk-Z3CCVDUB.js";
47
+ } from "./chunk-JWOVP5BL.js";
48
+ import "./chunk-IEBJF3PN.js";
49
+ import "./chunk-UO66IMVP.js";
51
50
  import "./chunk-2BEMIWEW.js";
52
51
  import "./chunk-IJYGIDF4.js";
53
- import "./chunk-KUA4OJ5Y.js";
54
- import "./chunk-BW5KFIQC.js";
52
+ import "./chunk-TPYYEDP5.js";
53
+ import "./chunk-AWQWXSW4.js";
55
54
  import "./chunk-QYF5S6P6.js";
56
- import "./chunk-DUO2TU77.js";
57
- import "./chunk-J6MPGQTS.js";
58
- import "./chunk-5HSRT26B.js";
59
- import "./chunk-2EECBNC5.js";
60
- import "./chunk-J64T55EI.js";
61
- import "./chunk-POMLXPMY.js";
62
- import "./chunk-JMYYOTQG.js";
63
- import "./chunk-QBFBRV2B.js";
64
- import "./chunk-YNE3RP52.js";
55
+ import "./chunk-GYRZ72R4.js";
56
+ import "./chunk-KJJAVH3X.js";
57
+ import "./chunk-ZSUX7KEM.js";
58
+ import "./chunk-EIKRZ32J.js";
59
+ import "./chunk-FWZRGGGY.js";
60
+ import "./chunk-N3PLNNCW.js";
61
+ import "./chunk-S26LC76R.js";
62
+ import "./chunk-XWFIHYCH.js";
63
+ import "./chunk-TVZRLTG6.js";
65
64
  import "./chunk-LJDODBBZ.js";
66
- import "./chunk-ABBOA7UD.js";
67
- import "./chunk-3RKP3FMS.js";
65
+ import "./chunk-EWXXLS26.js";
68
66
  import "./chunk-NXL4FFQQ.js";
69
67
  export {
70
68
  PROJECT_SNAPSHOT_MAX_WARM_ROOTS,
@@ -2,29 +2,31 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
2
2
  import {
3
3
  firstOutputLine,
4
4
  spawnFailedWithNoOutput
5
- } from "./chunk-S67KYG37.js";
5
+ } from "./chunk-T4NGVFYI.js";
6
6
  import {
7
7
  SecurityScanClient
8
- } from "./chunk-TIQ2PKDW.js";
8
+ } from "./chunk-QT66NEYN.js";
9
9
  import {
10
10
  probeToolAsync
11
- } from "./chunk-3KAZU3VR.js";
11
+ } from "./chunk-XI34NWDI.js";
12
12
  import {
13
13
  INSTALL_TRANSIENT_MAX_ATTEMPTS,
14
14
  classifyProbeFailure,
15
15
  describeProbeEvidence,
16
16
  logAvailabilityDecision,
17
17
  startHostStallSampler
18
- } from "./chunk-P63GXC37.js";
18
+ } from "./chunk-5LRUKYFA.js";
19
19
  import {
20
+ isUntrustedProjectPath,
21
+ recordProjectCommandRefusal,
20
22
  safeSpawnAsync
21
- } from "./chunk-KUA4OJ5Y.js";
23
+ } from "./chunk-TPYYEDP5.js";
22
24
  import {
23
25
  assertInstallAllowed
24
- } from "./chunk-M2IFVFWU.js";
26
+ } from "./chunk-EIKRZ32J.js";
25
27
  import {
26
28
  recordDegradationOnce
27
- } from "./chunk-J64T55EI.js";
29
+ } from "./chunk-FWZRGGGY.js";
28
30
 
29
31
  // dist/clients/govulncheck-client.js
30
32
  import * as fs from "node:fs";
@@ -213,6 +215,10 @@ var GovulncheckClient = class _GovulncheckClient extends SecurityScanClient {
213
215
  for (const candidate of candidates) {
214
216
  try {
215
217
  if (fs.existsSync(candidate)) {
218
+ if (isUntrustedProjectPath(candidate)) {
219
+ recordProjectCommandRefusal(candidate);
220
+ continue;
221
+ }
216
222
  this.binaryPath = candidate;
217
223
  this.available = true;
218
224
  this.log(`govulncheck auto-installed at ${candidate}`);
@@ -1,17 +1,17 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  extractFactsFromTree
4
- } from "./chunk-T57LYLZT.js";
4
+ } from "./chunk-G224FADB.js";
5
5
  import {
6
6
  findOwnerName
7
7
  } from "./chunk-5W3R6LFT.js";
8
8
  import {
9
9
  firstChildOfType,
10
10
  walk
11
- } from "./chunk-US7ECLD7.js";
11
+ } from "./chunk-YWWG4AQA.js";
12
12
  import {
13
13
  isJstsFactFile
14
- } from "./chunk-DUO2TU77.js";
14
+ } from "./chunk-GYRZ72R4.js";
15
15
 
16
16
  // dist/clients/dispatch/facts/function-facts.js
17
17
  var BOUNDARY_PREFIXES = [