pi-lens 4.4.4 → 4.4.6

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 (191) hide show
  1. package/CHANGELOG.md +477 -0
  2. package/README.md +45 -3
  3. package/config/biome/core.jsonc +3 -3
  4. package/config/dependency-cruiser-eager-allowlist.json +1 -0
  5. package/dist/{chunk-UBOQLVT2.js → chunk-2DDDCJDL.js} +4 -4
  6. package/dist/{chunk-RKKOYPRA.js → chunk-2DMLM3ZO.js} +13 -15
  7. package/dist/chunk-2F47TQOA.js +73 -0
  8. package/dist/{chunk-O4NWQT6I.js → chunk-2PHMIAKO.js} +4 -4
  9. package/dist/{chunk-DGUKIYSI.js → chunk-2RLWJO5K.js} +8 -10
  10. package/dist/{chunk-S67KYG37.js → chunk-2X4VLOCC.js} +2 -2
  11. package/dist/{chunk-TIQ2PKDW.js → chunk-3MYEA7QD.js} +4 -4
  12. package/dist/{chunk-3DA2JDOL.js → chunk-3WEPUD2V.js} +551 -203
  13. package/dist/{chunk-AMERCH6V.js → chunk-4AVZ3TG7.js} +15 -16
  14. package/dist/{chunk-IYNJ6YPZ.js → chunk-4PCQCU47.js} +4 -4
  15. package/dist/chunk-4WX4CTUE.js +57 -0
  16. package/dist/{chunk-P63GXC37.js → chunk-5APMQ2IJ.js} +31 -4
  17. package/dist/{chunk-ZIVJBOO3.js → chunk-5CV5ITZF.js} +2 -2
  18. package/dist/{chunk-6DLWKFEX.js → chunk-5ZR3APIM.js} +41 -42
  19. package/dist/{chunk-XTBDCR27.js → chunk-63RIVFQI.js} +4 -4
  20. package/dist/{chunk-GSLNCYGG.js → chunk-75SY4F24.js} +13 -14
  21. package/dist/{chunk-U44DJXQP.js → chunk-7RQXA5GG.js} +15 -18
  22. package/dist/chunk-A3YNG5KP.js +45 -0
  23. package/dist/{chunk-5OFV52AM.js → chunk-AE37FEGH.js} +1 -1
  24. package/dist/{chunk-BWD5EPKO.js → chunk-AMXIUN2R.js} +4 -6
  25. package/dist/{chunk-3KAZU3VR.js → chunk-ARD426WI.js} +2 -2
  26. package/dist/{chunk-BW5KFIQC.js → chunk-AWQWXSW4.js} +1 -0
  27. package/dist/{chunk-YH5MVY2U.js → chunk-BHUWL2Y3.js} +7 -7
  28. package/dist/{chunk-CT4MN5IU.js → chunk-BI5LAQ3Y.js} +353 -359
  29. package/dist/{chunk-KAPJINKN.js → chunk-BM5GS6ZH.js} +2 -2
  30. package/dist/{chunk-TLX72JTG.js → chunk-BWYQUPOS.js} +1 -1
  31. package/dist/chunk-CFRQMBGP.js +49 -0
  32. package/dist/{chunk-RMLC67LF.js → chunk-CJYKEW2L.js} +2 -30
  33. package/dist/chunk-CKEQFGLT.js +32 -0
  34. package/dist/{chunk-IWDLU6K3.js → chunk-DC4CFXM5.js} +4 -6
  35. package/dist/{chunk-ZVUL7QYY.js → chunk-DMSLNKF7.js} +29 -32
  36. package/dist/{chunk-KN35K52N.js → chunk-DQXSPYRI.js} +3 -3
  37. package/dist/{chunk-HYGZEMX6.js → chunk-EVDGNG4F.js} +11 -5
  38. package/dist/{chunk-SRYEJNES.js → chunk-F5Z6URKM.js} +2 -2
  39. package/dist/{chunk-UMS2MFPZ.js → chunk-F6X3YJWD.js} +2 -3
  40. package/dist/{chunk-XYURS6EN.js → chunk-FA5LDARD.js} +15 -17
  41. package/dist/{chunk-24AKHFGP.js → chunk-FFL3A2VP.js} +6 -6
  42. package/dist/chunk-FJIVKLPH.js +31 -0
  43. package/dist/chunk-G2B7F6ZU.js +88 -0
  44. package/dist/{chunk-US7ECLD7.js → chunk-GAACZY6R.js} +131 -41
  45. package/dist/{chunk-MZGQNL3Y.js → chunk-GMTFDAOK.js} +12 -13
  46. package/dist/{chunk-VOOAPROD.js → chunk-GNSIWBAT.js} +3 -3
  47. package/dist/chunk-GTAI2J6U.js +27 -0
  48. package/dist/{chunk-RVK72CZX.js → chunk-GZE7WOI4.js} +1362 -459
  49. package/dist/{chunk-IUE7SSKV.js → chunk-H7HTEQUZ.js} +13 -7
  50. package/dist/{chunk-EUXZEFTV.js → chunk-HK6JVFZC.js} +3 -3
  51. package/dist/chunk-IPDG45G5.js +26 -0
  52. package/dist/{chunk-5HSRT26B.js → chunk-J6JP25XU.js} +16 -15
  53. package/dist/{chunk-HWCCCQNX.js → chunk-JL6CXUMW.js} +13 -6
  54. package/dist/{chunk-EBC36LNN.js → chunk-K2YGBXOA.js} +17 -17
  55. package/dist/{chunk-WMYE35PX.js → chunk-KLQVC3XC.js} +7 -5
  56. package/dist/{chunk-ATKJFDQN.js → chunk-KSR7RGQY.js} +12 -14
  57. package/dist/{chunk-POMLXPMY.js → chunk-KXF5R4UN.js} +1 -1
  58. package/dist/{chunk-LLJNQKQW.js → chunk-LEJOJDXL.js} +20 -13
  59. package/dist/{chunk-JUKMK5Y4.js → chunk-MA77RSFN.js} +10 -11
  60. package/dist/{chunk-GAQ7OQG6.js → chunk-MKVZQUEG.js} +85 -96
  61. package/dist/{chunk-2EECBNC5.js → chunk-MN7MHUXQ.js} +75 -0
  62. package/dist/{chunk-DEL2U6CM.js → chunk-MT6BVNFW.js} +16 -14
  63. package/dist/chunk-NDMCVUYK.js +507 -0
  64. package/dist/{chunk-HRNHZA3N.js → chunk-NIU2IPC5.js} +12 -16
  65. package/dist/{chunk-AGSS7277.js → chunk-NNKXDXXS.js} +7 -24
  66. package/dist/{chunk-V35JG4JB.js → chunk-OJLTLYHB.js} +152 -334
  67. package/dist/{chunk-J6MPGQTS.js → chunk-OLAWH5UQ.js} +81 -15
  68. package/dist/{chunk-T57LYLZT.js → chunk-OOU2WZZE.js} +1 -1
  69. package/dist/{chunk-CYRKQRPM.js → chunk-OSTKYB55.js} +2 -4
  70. package/dist/chunk-P4QNXS6I.js +27 -0
  71. package/dist/chunk-PKES3ISE.js +297 -0
  72. package/dist/{chunk-ROYSX2S5.js → chunk-PO45POGF.js} +2 -2
  73. package/dist/{chunk-T7FEBKXN.js → chunk-PPIBVH4R.js} +7 -9
  74. package/dist/{chunk-3RKP3FMS.js → chunk-PQJFG24Z.js} +295 -23
  75. package/dist/{chunk-KUA4OJ5Y.js → chunk-Q3UZHW6N.js} +846 -350
  76. package/dist/{chunk-N5FLEO7W.js → chunk-Q4EMRFNA.js} +37 -37
  77. package/dist/{chunk-5IUSNGOC.js → chunk-Q4FCYCRE.js} +28 -21
  78. package/dist/chunk-Q6D6VMI4.js +22 -0
  79. package/dist/{chunk-UZ2XCLYS.js → chunk-QGSTQH4D.js} +8 -8
  80. package/dist/{chunk-DUO2TU77.js → chunk-RZOXUSPC.js} +10 -4
  81. package/dist/{chunk-JMYYOTQG.js → chunk-S26LC76R.js} +13 -1
  82. package/dist/{chunk-GMX5OS7B.js → chunk-S67UJDGQ.js} +11 -12
  83. package/dist/chunk-SCIUNBPF.js +44 -0
  84. package/dist/{chunk-RKBXZN3A.js → chunk-SJJYRZB4.js} +2 -2
  85. package/dist/chunk-SXGD4ANG.js +25 -0
  86. package/dist/{chunk-YCWYO6TQ.js → chunk-T7FTXGS3.js} +48 -45
  87. package/dist/{chunk-FM4RDMKT.js → chunk-TIQJPRDD.js} +115 -61
  88. package/dist/{chunk-XHJBS436.js → chunk-TIYGSODX.js} +25 -25
  89. package/dist/{chunk-S2HEXIWI.js → chunk-U2SDMG7C.js} +10 -6
  90. package/dist/{chunk-2KXTHF3M.js → chunk-U6OC3QEM.js} +253 -33
  91. package/dist/{chunk-AWSCPCN2.js → chunk-UCGQT677.js} +19 -19
  92. package/dist/chunk-UHGF5UT5.js +32 -0
  93. package/dist/{chunk-JW3YWBVB.js → chunk-UN4TEBWN.js} +17 -19
  94. package/dist/{chunk-ZHH37KZL.js → chunk-V3APN3DY.js} +17 -17
  95. package/dist/{chunk-ED36RF6Y.js → chunk-V63BC55Q.js} +1 -1
  96. package/dist/{chunk-XBJVAEEO.js → chunk-VG5JS5SW.js} +3 -2
  97. package/dist/{chunk-W66O5E25.js → chunk-VPBIMOAQ.js} +13 -15
  98. package/dist/chunk-VQH24FIP.js +37 -0
  99. package/dist/{chunk-YNE3RP52.js → chunk-VSFLRN5Y.js} +8 -1
  100. package/dist/{chunk-7D6L4MTX.js → chunk-W2V54OCL.js} +3 -3
  101. package/dist/{chunk-2FN63LPV.js → chunk-W5LGKNET.js} +13 -14
  102. package/dist/{chunk-IQWN5JCP.js → chunk-W5R5SABV.js} +13 -14
  103. package/dist/{chunk-R3T7CLQ2.js → chunk-WIZWZR4C.js} +41 -41
  104. package/dist/{chunk-TOY6QKOH.js → chunk-WQOIR3QY.js} +17 -17
  105. package/dist/{chunk-Y6GZHWSJ.js → chunk-XAIT2YGS.js} +6 -6
  106. package/dist/chunk-XCUHKYCQ.js +23 -0
  107. package/dist/{chunk-GSM5UU7A.js → chunk-XQCSWV2G.js} +44 -35
  108. package/dist/{chunk-OHKJ7PQF.js → chunk-YBSONGSZ.js} +43 -39
  109. package/dist/{chunk-GXFV6MYU.js → chunk-YISME6ON.js} +72 -39
  110. package/dist/chunk-YRD4ISED.js +30 -0
  111. package/dist/{chunk-SD4I7ZO4.js → chunk-YSBHPOY6.js} +43 -53
  112. package/dist/{chunk-QBFBRV2B.js → chunk-Z2XAOKHK.js} +4 -2
  113. package/dist/{chunk-5VSF4UUQ.js → chunk-Z7IGUAXL.js} +34 -39
  114. package/dist/{chunk-MPNJLASA.js → chunk-ZKXQKGWZ.js} +10 -13
  115. package/dist/{chunk-J64T55EI.js → chunk-ZQ6NZZTB.js} +75 -9
  116. package/dist/chunk-ZUUI3ZSA.js +38 -0
  117. package/dist/{chunk-7HXE67BN.js → chunk-ZYNI26MI.js} +2 -2
  118. package/dist/index.js +32674 -27567
  119. package/dist/mcp/analyze-cli.js +11 -12
  120. package/dist/mcp/cli.js +46 -45
  121. package/dist/mcp/server.js +1210 -574
  122. package/dist/mcp/worker.js +65 -65
  123. package/dist/probes/installer.js +21 -23
  124. package/docs/adr/0010-trace-validation-session-lifecycle.md +390 -0
  125. package/docs/adr/README.md +1 -0
  126. package/docs/agent-tools.md +28 -7
  127. package/docs/ast-grep_rules_catalog.md +5 -3
  128. package/docs/configuration.md +12 -1
  129. package/docs/defect-shapes.md +738 -0
  130. package/docs/engineering-principles.md +12 -0
  131. package/docs/environment-variables.md +20 -0
  132. package/docs/features.md +16 -1
  133. package/docs/globalconfig.md +37 -8
  134. package/docs/invariants/caches-stores.md +30 -0
  135. package/docs/invariants/dispatch-runners.md +164 -0
  136. package/docs/invariants/git-guard-host.md +53 -0
  137. package/docs/invariants/language-config.md +31 -0
  138. package/docs/invariants/lsp-trust-exec.md +286 -0
  139. package/docs/invariants/paths-os.md +59 -0
  140. package/docs/invariants/session-telemetry.md +74 -0
  141. package/docs/lsp-capability-matrix.md +105 -12
  142. package/docs/lsp-idle-eviction.md +37 -18
  143. package/docs/pi-lens-fixer.md +24 -2
  144. package/docs/pi-lens-investigator.md +14 -0
  145. package/docs/pi-lens-merge-policy.md +32 -17
  146. package/docs/pi-lens-monitor.md +66 -10
  147. package/docs/pi-lens-orchestration.md +41 -0
  148. package/docs/pi-lens-release.md +20 -0
  149. package/docs/pi-lens-retro.md +5 -4
  150. package/docs/pi-lens-reviewer.md +54 -7
  151. package/docs/pi-lens-subagent.md +10 -3
  152. package/docs/release-qa-baseline.md +19 -7
  153. package/docs/servercapabilities.md +47 -47
  154. package/docs/settings.md +9 -5
  155. package/docs/subagent-compat.md +1 -1
  156. package/docs/usage.md +1 -0
  157. package/package.json +8 -5
  158. package/rules/ast-grep-rules/rule-tests/no-return-value-in-generator-test.yml +17 -0
  159. package/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-js-test.yml +86 -0
  160. package/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-test.yml +86 -0
  161. package/rules/ast-grep-rules/rule-tests/unchecked-numeric-parse-python-test.yml +15 -0
  162. package/rules/ast-grep-rules/rules/no-return-value-in-generator.yml +9 -4
  163. package/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +119 -0
  164. package/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +119 -0
  165. package/rules/ast-grep-rules/rules/unchecked-numeric-parse-python.yml +13 -2
  166. package/rules/rule-catalog.json +25 -1
  167. package/scripts/analyze-pi-lens-logs.mjs +15 -5
  168. package/scripts/lib/is-main-module.mjs +27 -0
  169. package/scripts/lib/scratch-home-env.mjs +21 -0
  170. package/scripts/rpc-load-check.mjs +4 -6
  171. package/scripts/warm-loader-cache.mjs +2 -5
  172. package/dist/chunk-3PTHXJXR.js +0 -28
  173. package/dist/chunk-3QED2P4V.js +0 -31
  174. package/dist/chunk-5WRPDP2A.js +0 -47
  175. package/dist/chunk-ABBOA7UD.js +0 -157
  176. package/dist/chunk-CUHSHSB6.js +0 -273
  177. package/dist/chunk-GL5LUMZE.js +0 -51
  178. package/dist/chunk-HAD7QRQI.js +0 -30
  179. package/dist/chunk-JORED7EX.js +0 -44
  180. package/dist/chunk-KYUB6QDC.js +0 -72
  181. package/dist/chunk-LZSEQW6A.js +0 -57
  182. package/dist/chunk-M2IFVFWU.js +0 -79
  183. package/dist/chunk-M2UD3LPU.js +0 -88
  184. package/dist/chunk-MBKQHGA7.js +0 -39
  185. package/dist/chunk-R7YOCSNV.js +0 -23
  186. package/dist/chunk-SKAMFC7A.js +0 -28
  187. package/dist/chunk-SYE6T2EB.js +0 -28
  188. package/dist/chunk-TRETHTQO.js +0 -26
  189. package/dist/chunk-UA7ZXYDR.js +0 -184
  190. package/dist/chunk-XTFDJI3T.js +0 -24
  191. package/dist/chunk-Z3CCVDUB.js +0 -76
@@ -1,47 +0,0 @@
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-RKKOYPRA.js";
13
- import "./chunk-7U2IDNXN.js";
14
- import "./chunk-RKBXZN3A.js";
15
- import "./chunk-S67KYG37.js";
16
- import "./chunk-BWD5EPKO.js";
17
- import "./chunk-UA7ZXYDR.js";
18
- import "./chunk-MPNJLASA.js";
19
- import "./chunk-5VSF4UUQ.js";
20
- import "./chunk-3KAZU3VR.js";
21
- import "./chunk-P63GXC37.js";
22
- import "./chunk-KUA4OJ5Y.js";
23
- import "./chunk-BW5KFIQC.js";
24
- import "./chunk-J6MPGQTS.js";
25
- import "./chunk-5HSRT26B.js";
26
- import "./chunk-M2IFVFWU.js";
27
- import "./chunk-2EECBNC5.js";
28
- import "./chunk-J64T55EI.js";
29
- import "./chunk-POMLXPMY.js";
30
- import "./chunk-JMYYOTQG.js";
31
- import "./chunk-QBFBRV2B.js";
32
- import "./chunk-YNE3RP52.js";
33
- import "./chunk-LJDODBBZ.js";
34
- import "./chunk-ABBOA7UD.js";
35
- import "./chunk-3RKP3FMS.js";
36
- import "./chunk-NXL4FFQQ.js";
37
- export {
38
- DEAD_CODE_DELTA_MAX_SHOWN,
39
- PythonDeadCodeClient,
40
- deadCodeIssueCount,
41
- deadCodeIssueKey,
42
- deadCodeIssues,
43
- formatDeadCodeDelta,
44
- getDeadCodeClients,
45
- parseVultureOutput,
46
- stableFindingKey
47
- };
@@ -1,157 +0,0 @@
1
- import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
-
3
- // dist/clients/bounded-cache.js
4
- var BoundedFifoMap = class {
5
- entries = /* @__PURE__ */ new Map();
6
- maxEntries;
7
- constructor(maxEntries) {
8
- this.maxEntries = maxEntries;
9
- }
10
- get(key) {
11
- return this.entries.get(key);
12
- }
13
- has(key) {
14
- return this.entries.has(key);
15
- }
16
- /**
17
- * Insert or update `key` without reordering. Evicts the oldest
18
- * (insertion-order) entries once the map exceeds capacity.
19
- *
20
- * Returns the evicted `[key, value]` pairs, oldest first — callers with
21
- * eviction-side bookkeeping use the return value instead of hand-rolling
22
- * `keys().next().value` (#2442). The VALUE is returned, not just the key,
23
- * because the eviction-coupled sites need it: `tree-sitter-cache.ts` has to
24
- * retire the dropped entry's WASM-heap tree (#417/#890) and
25
- * `tree-sitter-client.ts` has to `delete()` the dropped compiled query.
26
- * Handing back only the key would force those sites to read the value out
27
- * of the map before eviction — i.e. to hand-roll the block this class
28
- * exists to delete.
29
- */
30
- set(key, value) {
31
- this.entries.set(key, value);
32
- return this.evictOverflow();
33
- }
34
- /**
35
- * Change the capacity ceiling, evicting down to it immediately when it
36
- * shrinks. Returns the evicted `[key, value]` pairs, oldest first, on the
37
- * same contract as {@link set} — a caller with a DYNAMIC cap (an env-read
38
- * ceiling, `TreeCache.setMaxSize`) needs the shrink to free the same
39
- * resources an ordinary overflow frees.
40
- */
41
- setMaxEntries(maxEntries) {
42
- this.maxEntries = maxEntries;
43
- return this.evictOverflow();
44
- }
45
- /** Current capacity ceiling. */
46
- getMaxEntries() {
47
- return this.maxEntries;
48
- }
49
- /** Drop oldest-first until within capacity. The one eviction block. */
50
- evictOverflow() {
51
- const evicted = [];
52
- while (this.entries.size > this.maxEntries) {
53
- const oldest = this.entries.entries().next().value;
54
- if (oldest === void 0)
55
- break;
56
- this.entries.delete(oldest[0]);
57
- evicted.push(oldest);
58
- }
59
- return evicted;
60
- }
61
- delete(key) {
62
- return this.entries.delete(key);
63
- }
64
- clear() {
65
- this.entries.clear();
66
- }
67
- get size() {
68
- return this.entries.size;
69
- }
70
- keys() {
71
- return this.entries.keys();
72
- }
73
- values() {
74
- return this.entries.values();
75
- }
76
- entriesArray() {
77
- return [...this.entries.entries()];
78
- }
79
- [Symbol.iterator]() {
80
- return this.entries[Symbol.iterator]();
81
- }
82
- };
83
- var BoundedSet = class {
84
- entries;
85
- constructor(maxEntries) {
86
- this.entries = new BoundedFifoMap(maxEntries);
87
- }
88
- has(value) {
89
- return this.entries.has(value);
90
- }
91
- /**
92
- * Insert `value` without reordering an already-present member. Evicts the
93
- * oldest (insertion-order) members once the set exceeds capacity.
94
- *
95
- * Returns the evicted values, oldest first — see the class doc for why a
96
- * call site consumes this instead of hand-rolling the drop.
97
- */
98
- add(value) {
99
- return this.entries.set(value, true).map(([evicted]) => evicted);
100
- }
101
- /**
102
- * Change the capacity ceiling, evicting down to it immediately when it
103
- * shrinks. Returns the evicted values, oldest first, on the same contract
104
- * as {@link add}.
105
- */
106
- setMaxEntries(maxEntries) {
107
- return this.entries.setMaxEntries(maxEntries).map(([evicted]) => evicted);
108
- }
109
- /** Current capacity ceiling. */
110
- getMaxEntries() {
111
- return this.entries.getMaxEntries();
112
- }
113
- delete(value) {
114
- return this.entries.delete(value);
115
- }
116
- clear() {
117
- this.entries.clear();
118
- }
119
- get size() {
120
- return this.entries.size;
121
- }
122
- values() {
123
- return this.entries.keys();
124
- }
125
- [Symbol.iterator]() {
126
- return this.entries.keys();
127
- }
128
- };
129
- var BoundedLruCache = class extends BoundedFifoMap {
130
- /**
131
- * Read and promote to most-recently-used.
132
- *
133
- * A stored `undefined` value is NOT promoted — the hit is indistinguishable
134
- * from a miss on this signature, and pre-#2442 `BoundedLruCache` behaved
135
- * the same way. No caller stores `undefined`; the note exists so a future
136
- * one does not assume otherwise.
137
- */
138
- get(key) {
139
- const value = this.entries.get(key);
140
- if (value !== void 0) {
141
- this.entries.delete(key);
142
- this.entries.set(key, value);
143
- }
144
- return value;
145
- }
146
- /** Insert or update `key`, moving it to the most-recently-used position. */
147
- set(key, value) {
148
- this.entries.delete(key);
149
- return super.set(key, value);
150
- }
151
- };
152
-
153
- export {
154
- BoundedFifoMap,
155
- BoundedSet,
156
- BoundedLruCache
157
- };
@@ -1,273 +0,0 @@
1
- import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
- import {
3
- extractTomlTableSection,
4
- hasTomlTable,
5
- parseTomlStringArray
6
- } from "./chunk-MPNJLASA.js";
7
- import {
8
- getProjectTrustState
9
- } from "./chunk-M2IFVFWU.js";
10
- import {
11
- incrementDegradationCount,
12
- recordDegradationOnce
13
- } from "./chunk-J64T55EI.js";
14
- import {
15
- logExtension
16
- } from "./chunk-POMLXPMY.js";
17
- import {
18
- logLatency
19
- } from "./chunk-QBFBRV2B.js";
20
- import {
21
- UV_WORKSPACE_EXCLUDE_DIALECT,
22
- UV_WORKSPACE_MEMBERS_DIALECT,
23
- isAtOrAboveHomeDir,
24
- matchesWorkspaceMemberPattern,
25
- toPosix,
26
- walkUpDirs
27
- } from "./chunk-3RKP3FMS.js";
28
-
29
- // dist/clients/bounded-telemetry.js
30
- var MAX_TRACKED_TURN_CAPS = 64;
31
- var turnCounts = /* @__PURE__ */ new Map();
32
- var latestCountedTurnIndex;
33
- var retiredThroughTurnIndex = Number.NEGATIVE_INFINITY;
34
- function admitBounded(phase, identity, options = {}) {
35
- try {
36
- let isRisingEdge = true;
37
- if (options.ledgerKind !== void 0) {
38
- isRisingEdge = incrementDegradationCount({
39
- kind: options.ledgerKind,
40
- subject: identity,
41
- reason: options.reason ?? phase
42
- });
43
- }
44
- if (options.risingEdgePer !== void 0 && !isRisingEdge)
45
- return false;
46
- return admitAgainstTurnCap(phase, options.capPerTurn);
47
- } catch {
48
- return true;
49
- }
50
- }
51
- function emitBounded(phase, identity, payload, options = {}) {
52
- try {
53
- if (!admitBounded(phase, identity, options))
54
- return false;
55
- logLatency({
56
- ...payload,
57
- type: payload.type ?? "phase",
58
- phase,
59
- // `filePath` is what existing latency.log queries filter on, so a site
60
- // may keep a coarser one; `metadata.identity` below always carries the
61
- // full discriminating identity. Aggregation that loses WHICH subject
62
- // is stuck is the failure AGENTS.md names.
63
- filePath: payload.filePath ?? identity,
64
- metadata: { ...payload.metadata, identity }
65
- });
66
- return true;
67
- } catch {
68
- return false;
69
- }
70
- }
71
- function admitAgainstTurnCap(phase, cap) {
72
- if (cap === void 0)
73
- return true;
74
- if (cap.turnIndex <= retiredThroughTurnIndex)
75
- return false;
76
- let counts = turnCounts.get(cap.turnIndex);
77
- if (!counts) {
78
- if (turnCounts.size >= MAX_TRACKED_TURN_CAPS) {
79
- const oldestTrackedTurn = Math.min(...turnCounts.keys());
80
- if (cap.turnIndex < oldestTrackedTurn)
81
- return false;
82
- turnCounts.delete(oldestTrackedTurn);
83
- retiredThroughTurnIndex = Math.max(retiredThroughTurnIndex, oldestTrackedTurn);
84
- }
85
- counts = /* @__PURE__ */ new Map();
86
- turnCounts.set(cap.turnIndex, counts);
87
- }
88
- latestCountedTurnIndex = Math.max(latestCountedTurnIndex ?? cap.turnIndex, cap.turnIndex);
89
- const used = counts.get(phase) ?? 0;
90
- if (used >= cap.limit)
91
- return false;
92
- counts.set(phase, used + 1);
93
- return true;
94
- }
95
- function resetBoundedTelemetry() {
96
- turnCounts = /* @__PURE__ */ new Map();
97
- latestCountedTurnIndex = void 0;
98
- retiredThroughTurnIndex = Number.NEGATIVE_INFINITY;
99
- }
100
-
101
- // dist/clients/python-environment.js
102
- import { access, readFile } from "node:fs/promises";
103
- import os from "node:os";
104
- import path from "node:path";
105
- var UV_WORKSPACE_TABLE = "tool\\.uv\\.workspace";
106
- async function findUvWorkspace(startDir, homeDir) {
107
- const resolvedStart = path.resolve(startDir);
108
- let nearestProject;
109
- for (const dir of walkUpDirs(startDir)) {
110
- if (isAtOrAboveHomeDir(dir, homeDir))
111
- break;
112
- let content;
113
- try {
114
- content = await readFile(path.join(dir, "pyproject.toml"), "utf8");
115
- } catch {
116
- continue;
117
- }
118
- if (!nearestProject)
119
- nearestProject = dir;
120
- if (hasTomlTable(content, UV_WORKSPACE_TABLE)) {
121
- const workspaceTable = extractTomlTableSection(content, UV_WORKSPACE_TABLE);
122
- return {
123
- root: dir,
124
- explicit: true,
125
- projectRoot: nearestProject,
126
- isStartDir: nearestProject === resolvedStart,
127
- members: parseTomlStringArray(workspaceTable, "members"),
128
- exclude: parseTomlStringArray(workspaceTable, "exclude")
129
- };
130
- }
131
- }
132
- return nearestProject ? {
133
- root: nearestProject,
134
- explicit: false,
135
- projectRoot: nearestProject,
136
- isStartDir: nearestProject === resolvedStart,
137
- members: [],
138
- exclude: []
139
- } : void 0;
140
- }
141
- function isUvWorkspaceMember(workspace, projectRoot) {
142
- const relative = toPosix(path.relative(workspace.root, projectRoot));
143
- if (relative.length === 0 || relative === ".." || relative.startsWith("../") || path.isAbsolute(relative)) {
144
- return false;
145
- }
146
- const matches = (dialect) => (pattern) => matchesWorkspaceMemberPattern(pattern, relative, dialect, () => recordDegradationOnce({
147
- kind: "workspace-glob-cap",
148
- subject: String(pattern.length),
149
- reason: "workspace glob matcher exceeded its memo-table cell cap"
150
- }));
151
- return !workspace.exclude.some(matches(UV_WORKSPACE_EXCLUDE_DIALECT)) && workspace.members.some(matches(UV_WORKSPACE_MEMBERS_DIALECT));
152
- }
153
- var PROJECT_SOURCED_PYTHON_SOURCES = /* @__PURE__ */ new Set([
154
- "project-dot-venv",
155
- "project-venv",
156
- "uv-workspace"
157
- ]);
158
- var AMBIENT_ENVIRONMENT_VARIABLES = {
159
- "uv-project-environment": "UV_PROJECT_ENVIRONMENT",
160
- "virtual-env": "VIRTUAL_ENV",
161
- conda: "CONDA_PREFIX"
162
- };
163
- function hasAmbientPythonEnvironment(env = process.env) {
164
- return Object.values(AMBIENT_ENVIRONMENT_VARIABLES).some((name) => Boolean(env[name]));
165
- }
166
- async function detectPythonEnvironment(projectRoot, homeDir = os.homedir(), options = {}) {
167
- const root = path.resolve(projectRoot);
168
- const uvWorkspace = await findUvWorkspace(root, homeDir);
169
- const isProjectRoot = uvWorkspace?.isStartDir === true;
170
- const memberWorkspaceRoot = isProjectRoot && uvWorkspace.explicit && isUvWorkspaceMember(uvWorkspace, root) ? uvWorkspace.root : void 0;
171
- const uvEnvironmentRoot = isProjectRoot ? memberWorkspaceRoot ?? uvWorkspace.projectRoot : void 0;
172
- const uvProjectEnvironment = process.env.UV_PROJECT_ENVIRONMENT;
173
- const allowAmbient = options.allowAmbient ?? true;
174
- const isWithinProjectRoot = (candidateRoot) => {
175
- const relative = path.relative(root, path.resolve(candidateRoot));
176
- return relative !== ".." && !relative.startsWith(`..${path.sep}`) && // #3871 V1: another Windows drive has no relative path, so
177
- // `path.relative` returns the absolute target: no `..`, not inside.
178
- !path.isAbsolute(relative);
179
- };
180
- const candidates = [
181
- ...uvEnvironmentRoot !== void 0 && uvProjectEnvironment ? [
182
- {
183
- // `path.resolve` leaves an absolute value untouched and
184
- // anchors a relative one at the project's workspace root.
185
- root: path.resolve(uvEnvironmentRoot, uvProjectEnvironment),
186
- source: "uv-project-environment"
187
- }
188
- ] : [],
189
- ...memberWorkspaceRoot !== void 0 ? [
190
- {
191
- root: path.join(memberWorkspaceRoot, ".venv"),
192
- source: "uv-workspace"
193
- }
194
- ] : [],
195
- { root: process.env.VIRTUAL_ENV, source: "virtual-env" },
196
- { root: process.env.CONDA_PREFIX, source: "conda" },
197
- { root: path.join(root, ".venv"), source: "project-dot-venv" },
198
- { root: path.join(root, "venv"), source: "project-venv" }
199
- ];
200
- for (const candidate of candidates) {
201
- if (!candidate.root)
202
- continue;
203
- if (!allowAmbient && candidate.source in AMBIENT_ENVIRONMENT_VARIABLES && !isWithinProjectRoot(candidate.root))
204
- continue;
205
- if (PROJECT_SOURCED_PYTHON_SOURCES.has(candidate.source) && getProjectTrustState() !== "trusted") {
206
- if (recordDegradationOnce({
207
- kind: "trust-refusal",
208
- subject: `python-environment:${candidate.root}`,
209
- reason: `project Python environment refused: pi project trust is ${getProjectTrustState()}`
210
- })) {
211
- logExtension({
212
- subsystem: "project-trust",
213
- level: "warn",
214
- message: "project Python environment refused: mark the project trusted in pi or upgrade pi",
215
- metadata: { source: candidate.source }
216
- });
217
- }
218
- continue;
219
- }
220
- const binDir = path.join(candidate.root, process.platform === "win32" ? "Scripts" : "bin");
221
- const pythonPath = path.join(binDir, process.platform === "win32" ? "python.exe" : "python");
222
- try {
223
- await access(pythonPath);
224
- return {
225
- root: candidate.root,
226
- binDir,
227
- pythonPath,
228
- source: candidate.source
229
- };
230
- } catch {
231
- }
232
- }
233
- return void 0;
234
- }
235
- async function detectPythonVenv(projectRoot) {
236
- return (await detectPythonEnvironment(projectRoot))?.pythonPath;
237
- }
238
- function augmentPythonEnvironment(baseEnvironment, environment) {
239
- if (!environment)
240
- return baseEnvironment;
241
- const inheritedPath = baseEnvironment.PATH ?? baseEnvironment.Path ?? baseEnvironment.path ?? "";
242
- const augmentedPath = inheritedPath ? `${environment.binDir}${path.delimiter}${inheritedPath}` : environment.binDir;
243
- const childEnvironment = {
244
- ...baseEnvironment,
245
- PATH: augmentedPath,
246
- VIRTUAL_ENV: environment.root
247
- };
248
- if (process.platform === "win32")
249
- childEnvironment.Path = augmentedPath;
250
- return childEnvironment;
251
- }
252
- function pythonEnvironmentToolCandidates(environment, command) {
253
- if (!environment)
254
- return [];
255
- if (process.platform !== "win32") {
256
- return [path.join(environment.binDir, command)];
257
- }
258
- return [
259
- path.join(environment.binDir, `${command}.exe`),
260
- path.join(environment.binDir, `${command}.cmd`),
261
- path.join(environment.binDir, command)
262
- ];
263
- }
264
-
265
- export {
266
- emitBounded,
267
- resetBoundedTelemetry,
268
- hasAmbientPythonEnvironment,
269
- detectPythonEnvironment,
270
- detectPythonVenv,
271
- augmentPythonEnvironment,
272
- pythonEnvironmentToolCandidates
273
- };
@@ -1,51 +0,0 @@
1
- import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
- import {
3
- MAX_CANONICAL_ROOT_MEMO_ENTRIES,
4
- RUNNERS,
5
- SOURCE_TO_TEST_PATTERNS,
6
- TURN_END_EXCLUDED_TEST_GLOBS,
7
- TestRunnerClient,
8
- isExcludedTestTarget,
9
- isRunnerErrorResult,
10
- stripWrapperArgs
11
- } from "./chunk-SD4I7ZO4.js";
12
- import "./chunk-6HWVI6MI.js";
13
- import "./chunk-CUHSHSB6.js";
14
- import "./chunk-UA7ZXYDR.js";
15
- import "./chunk-MPNJLASA.js";
16
- import "./chunk-Z3CCVDUB.js";
17
- import "./chunk-DEL2U6CM.js";
18
- import "./chunk-5VSF4UUQ.js";
19
- import "./chunk-3KAZU3VR.js";
20
- import "./chunk-P63GXC37.js";
21
- import "./chunk-HRNHZA3N.js";
22
- import "./chunk-TLX72JTG.js";
23
- import "./chunk-DGUKIYSI.js";
24
- import "./chunk-XBJVAEEO.js";
25
- import "./chunk-KUA4OJ5Y.js";
26
- import "./chunk-BW5KFIQC.js";
27
- import "./chunk-QYF5S6P6.js";
28
- import "./chunk-DUO2TU77.js";
29
- import "./chunk-J6MPGQTS.js";
30
- import "./chunk-5HSRT26B.js";
31
- import "./chunk-M2IFVFWU.js";
32
- import "./chunk-2EECBNC5.js";
33
- import "./chunk-J64T55EI.js";
34
- import "./chunk-POMLXPMY.js";
35
- import "./chunk-JMYYOTQG.js";
36
- import "./chunk-QBFBRV2B.js";
37
- import "./chunk-YNE3RP52.js";
38
- import "./chunk-LJDODBBZ.js";
39
- import "./chunk-ABBOA7UD.js";
40
- import "./chunk-3RKP3FMS.js";
41
- import "./chunk-NXL4FFQQ.js";
42
- export {
43
- MAX_CANONICAL_ROOT_MEMO_ENTRIES,
44
- RUNNERS,
45
- SOURCE_TO_TEST_PATTERNS,
46
- TURN_END_EXCLUDED_TEST_GLOBS,
47
- TestRunnerClient,
48
- isExcludedTestTarget,
49
- isRunnerErrorResult,
50
- stripWrapperArgs
51
- };
@@ -1,30 +0,0 @@
1
- import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
- import {
3
- importFactProvider,
4
- importFactsApplyTo
5
- } from "./chunk-IYNJ6YPZ.js";
6
- import "./chunk-T57LYLZT.js";
7
- import "./chunk-US7ECLD7.js";
8
- import "./chunk-Z54ZSOBZ.js";
9
- import "./chunk-GXFV6MYU.js";
10
- import "./chunk-FM4RDMKT.js";
11
- import "./chunk-P63GXC37.js";
12
- import "./chunk-KUA4OJ5Y.js";
13
- import "./chunk-DUO2TU77.js";
14
- import "./chunk-J6MPGQTS.js";
15
- import "./chunk-5HSRT26B.js";
16
- import "./chunk-M2IFVFWU.js";
17
- import "./chunk-2EECBNC5.js";
18
- import "./chunk-J64T55EI.js";
19
- import "./chunk-POMLXPMY.js";
20
- import "./chunk-JMYYOTQG.js";
21
- import "./chunk-QBFBRV2B.js";
22
- import "./chunk-YNE3RP52.js";
23
- import "./chunk-LJDODBBZ.js";
24
- import "./chunk-ABBOA7UD.js";
25
- import "./chunk-3RKP3FMS.js";
26
- import "./chunk-NXL4FFQQ.js";
27
- export {
28
- importFactProvider,
29
- importFactsApplyTo
30
- };
@@ -1,44 +0,0 @@
1
- import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
- import {
3
- DEPENDENCY_DRIFT_MAX_DELIVERIES,
4
- _getForwardImportParsesForTests,
5
- collectForwardImportMtimes,
6
- extractForwardImportPaths,
7
- extractForwardImports,
8
- sweepInlineBlockerFreshness
9
- } from "./chunk-V35JG4JB.js";
10
- import "./chunk-XTBDCR27.js";
11
- import "./chunk-MPNJLASA.js";
12
- import "./chunk-US7ECLD7.js";
13
- import "./chunk-Z54ZSOBZ.js";
14
- import "./chunk-GXFV6MYU.js";
15
- import "./chunk-FM4RDMKT.js";
16
- import "./chunk-RMLC67LF.js";
17
- import {
18
- MTIME_DRIFT_TOLERANCE_MS
19
- } from "./chunk-AGSS7277.js";
20
- import "./chunk-P63GXC37.js";
21
- import "./chunk-KUA4OJ5Y.js";
22
- import "./chunk-DUO2TU77.js";
23
- import "./chunk-J6MPGQTS.js";
24
- import "./chunk-5HSRT26B.js";
25
- import "./chunk-M2IFVFWU.js";
26
- import "./chunk-2EECBNC5.js";
27
- import "./chunk-J64T55EI.js";
28
- import "./chunk-POMLXPMY.js";
29
- import "./chunk-JMYYOTQG.js";
30
- import "./chunk-QBFBRV2B.js";
31
- import "./chunk-YNE3RP52.js";
32
- import "./chunk-LJDODBBZ.js";
33
- import "./chunk-ABBOA7UD.js";
34
- import "./chunk-3RKP3FMS.js";
35
- import "./chunk-NXL4FFQQ.js";
36
- export {
37
- DEPENDENCY_DRIFT_MAX_DELIVERIES,
38
- MTIME_DRIFT_TOLERANCE_MS,
39
- _getForwardImportParsesForTests,
40
- collectForwardImportMtimes,
41
- extractForwardImportPaths,
42
- extractForwardImports,
43
- sweepInlineBlockerFreshness
44
- };
@@ -1,72 +0,0 @@
1
- import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
- import {
3
- adaptLspService,
4
- getLSPService,
5
- groupFilesByPrimaryServer,
6
- hasAuxiliaryLspPublishedForRoot,
7
- notifyExternalFileChange,
8
- peekLSPService,
9
- resetLSPService,
10
- resyncGitChangedFiles,
11
- runPerServerGroups
12
- } from "./chunk-RVK72CZX.js";
13
- import "./chunk-IWDLU6K3.js";
14
- import "./chunk-XIMYZ3JA.js";
15
- import "./chunk-3DA2JDOL.js";
16
- import "./chunk-HWCCCQNX.js";
17
- import "./chunk-CUHSHSB6.js";
18
- import "./chunk-UA7ZXYDR.js";
19
- import "./chunk-T7FEBKXN.js";
20
- import "./chunk-SRYEJNES.js";
21
- import "./chunk-V35JG4JB.js";
22
- import "./chunk-XTBDCR27.js";
23
- import "./chunk-MPNJLASA.js";
24
- import "./chunk-US7ECLD7.js";
25
- import "./chunk-Z54ZSOBZ.js";
26
- import "./chunk-GXFV6MYU.js";
27
- import "./chunk-FM4RDMKT.js";
28
- import "./chunk-RMLC67LF.js";
29
- import "./chunk-W66O5E25.js";
30
- import "./chunk-7HXE67BN.js";
31
- import "./chunk-Z3CCVDUB.js";
32
- import "./chunk-KAPJINKN.js";
33
- import "./chunk-AGSS7277.js";
34
- import "./chunk-2BEMIWEW.js";
35
- import "./chunk-IJYGIDF4.js";
36
- import "./chunk-GAQ7OQG6.js";
37
- import "./chunk-DEL2U6CM.js";
38
- import "./chunk-5VSF4UUQ.js";
39
- import "./chunk-3KAZU3VR.js";
40
- import "./chunk-P63GXC37.js";
41
- import "./chunk-HRNHZA3N.js";
42
- import "./chunk-TLX72JTG.js";
43
- import "./chunk-DGUKIYSI.js";
44
- import "./chunk-XBJVAEEO.js";
45
- import "./chunk-KUA4OJ5Y.js";
46
- import "./chunk-BW5KFIQC.js";
47
- import "./chunk-QYF5S6P6.js";
48
- import "./chunk-DUO2TU77.js";
49
- import "./chunk-J6MPGQTS.js";
50
- import "./chunk-5HSRT26B.js";
51
- import "./chunk-M2IFVFWU.js";
52
- import "./chunk-2EECBNC5.js";
53
- import "./chunk-J64T55EI.js";
54
- import "./chunk-POMLXPMY.js";
55
- import "./chunk-JMYYOTQG.js";
56
- import "./chunk-QBFBRV2B.js";
57
- import "./chunk-YNE3RP52.js";
58
- import "./chunk-LJDODBBZ.js";
59
- import "./chunk-ABBOA7UD.js";
60
- import "./chunk-3RKP3FMS.js";
61
- import "./chunk-NXL4FFQQ.js";
62
- export {
63
- adaptLspService,
64
- getLSPService,
65
- groupFilesByPrimaryServer,
66
- hasAuxiliaryLspPublishedForRoot,
67
- notifyExternalFileChange,
68
- peekLSPService,
69
- resetLSPService,
70
- resyncGitChangedFiles,
71
- runPerServerGroups
72
- };