scip-query 0.22.0 → 0.24.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 (470) hide show
  1. package/CHANGELOG.md +500 -0
  2. package/README.md +13 -0
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/by-kind-H3P6BR5G.js +2 -0
  5. package/dist/call-graph-VTG2CUOQ.js +2 -0
  6. package/dist/call-graph-evidence-BociKRpF.d.ts +19 -0
  7. package/dist/chunk-2BMSSRBH.js +2 -0
  8. package/dist/{chunk-TAYD3AE7.js → chunk-2GJSD5GY.js} +2 -2
  9. package/dist/{chunk-TUQIPUDS.js → chunk-2M2LSIMY.js} +3 -3
  10. package/dist/{chunk-GIQ6CSL4.js → chunk-2N6WBNDC.js} +2 -2
  11. package/dist/{chunk-JHH5SCZ3.js → chunk-2OOY75BW.js} +2 -2
  12. package/dist/{chunk-EELPBR7E.js → chunk-2USA3S3P.js} +2 -2
  13. package/dist/chunk-2VAHDDLM.js +133 -0
  14. package/dist/chunk-2XWIUW5Z.js +455 -0
  15. package/dist/{chunk-57N6LN2A.js → chunk-3AF4TUFK.js} +2 -2
  16. package/dist/chunk-3D4BOXW6.js +20 -0
  17. package/dist/{chunk-FFJQZG6J.js → chunk-3LO4FST5.js} +2 -2
  18. package/dist/{chunk-HXOU4XNH.js → chunk-3WTY4LP2.js} +2 -2
  19. package/dist/{chunk-DPWKKNKI.js → chunk-3Z5AMSK6.js} +2 -2
  20. package/dist/{chunk-F24G5NBE.js → chunk-44IETFOU.js} +2 -2
  21. package/dist/chunk-4FR6GQIT.js +2 -0
  22. package/dist/chunk-4KBTHJLP.js +2 -0
  23. package/dist/chunk-5BIKR67W.js +2 -0
  24. package/dist/{chunk-DJAO2OZJ.js → chunk-5PROPLHI.js} +2 -2
  25. package/dist/chunk-5V7EPTII.js +2 -0
  26. package/dist/{chunk-VZ7NXSHV.js → chunk-62LPZCBQ.js} +2 -2
  27. package/dist/{chunk-LXQUF2RP.js → chunk-64O2JHQA.js} +2 -2
  28. package/dist/chunk-6D4F5VWG.js +10 -0
  29. package/dist/{chunk-NEIQPFBI.js → chunk-6ERFBC3X.js} +2 -2
  30. package/dist/{chunk-4HE7MVWD.js → chunk-6ILKOOGH.js} +2 -2
  31. package/dist/chunk-6MFXCMZC.js +2 -0
  32. package/dist/chunk-6O7FACKB.js +2 -0
  33. package/dist/{chunk-R6M456QG.js → chunk-6TS3KOXR.js} +2 -2
  34. package/dist/{chunk-7U2YQSDE.js → chunk-76QOU4PK.js} +2 -2
  35. package/dist/{chunk-25GWKRUZ.js → chunk-7DUI77BN.js} +2 -2
  36. package/dist/chunk-7F45LJKI.js +2 -0
  37. package/dist/{chunk-DEAB5TGT.js → chunk-7F7T6DCR.js} +2 -2
  38. package/dist/chunk-7H6VHWWJ.js +2 -0
  39. package/dist/chunk-7HXT6YLU.js +5 -0
  40. package/dist/{chunk-KZYID5KV.js → chunk-7R4V5ES6.js} +4 -4
  41. package/dist/chunk-7RIRIADH.js +7 -0
  42. package/dist/chunk-7ZLWLOGT.js +2 -0
  43. package/dist/{chunk-WHADK6OS.js → chunk-A4WEAK35.js} +2 -2
  44. package/dist/chunk-AADQLOQ4.js +38 -0
  45. package/dist/{chunk-XFMVKFSF.js → chunk-AN76MGUE.js} +2 -2
  46. package/dist/chunk-ANLNLY66.js +2 -0
  47. package/dist/chunk-ATXPTSEI.js +81 -0
  48. package/dist/{chunk-EELG7D3Q.js → chunk-AX7IDVFT.js} +2 -2
  49. package/dist/chunk-B3PYOSCX.js +2 -0
  50. package/dist/chunk-B7MPDEAK.js +3 -0
  51. package/dist/chunk-BBB5FBX4.js +2 -0
  52. package/dist/{chunk-Y2VM4CJC.js → chunk-BHKK5RJY.js} +2 -2
  53. package/dist/chunk-BJWFVAA5.js +2 -0
  54. package/dist/chunk-BKVWUP7Y.js +2 -0
  55. package/dist/{chunk-7XA3OM44.js → chunk-BKZYTLGE.js} +2 -2
  56. package/dist/chunk-BL6DCHQP.js +2 -0
  57. package/dist/chunk-BOW7SSQH.js +43 -0
  58. package/dist/{chunk-KQHJEU6V.js → chunk-C4RHHCKL.js} +2 -2
  59. package/dist/chunk-C7C6AKAT.js +117 -0
  60. package/dist/chunk-CD6M6LS2.js +16 -0
  61. package/dist/chunk-CFE6PSG6.js +2 -0
  62. package/dist/{chunk-GPGRZJ3R.js → chunk-CFNIGQMT.js} +2 -2
  63. package/dist/{chunk-K3XFWJI2.js → chunk-CKBUBRYD.js} +2 -2
  64. package/dist/chunk-CZW5MZ5B.js +2 -0
  65. package/dist/chunk-DBBZ63ZX.js +2 -0
  66. package/dist/chunk-DBN7DMJB.js +18 -0
  67. package/dist/{chunk-CKRWA452.js → chunk-DUULLZHZ.js} +2 -2
  68. package/dist/{chunk-6HRZQLOI.js → chunk-DV5Y5NOS.js} +2 -2
  69. package/dist/chunk-DZOIKCTM.js +3 -0
  70. package/dist/chunk-E4PKTOL3.js +2 -0
  71. package/dist/{chunk-GVOMSPGL.js → chunk-E65ELFKU.js} +2 -2
  72. package/dist/{chunk-VXJJTQYE.js → chunk-E7QR35ST.js} +2 -2
  73. package/dist/{chunk-2RE5OCHZ.js → chunk-EFSXAINW.js} +2 -2
  74. package/dist/{chunk-GY7CCCEZ.js → chunk-EHVEIEQN.js} +2 -2
  75. package/dist/{chunk-BVFYEEBH.js → chunk-EHYDXE3Z.js} +2 -2
  76. package/dist/{chunk-HISEUIL2.js → chunk-EP63Y6LD.js} +2 -2
  77. package/dist/chunk-EPX6NQN6.js +4 -0
  78. package/dist/chunk-ETC674NS.js +5 -0
  79. package/dist/{chunk-5H5WTJSD.js → chunk-F5GSBHC6.js} +2 -2
  80. package/dist/chunk-FH3DGXC6.js +2 -0
  81. package/dist/{chunk-2XCGSDIT.js → chunk-FI7VGOR4.js} +2 -2
  82. package/dist/chunk-FJF6VO2P.js +2 -0
  83. package/dist/{chunk-FELGD32K.js → chunk-FLMTCX5R.js} +2 -2
  84. package/dist/chunk-FVFDOIM3.js +2 -0
  85. package/dist/{chunk-AQ2PORIO.js → chunk-G2HU5WRN.js} +2 -2
  86. package/dist/{chunk-7YQOCABQ.js → chunk-G4ALYS4J.js} +2 -2
  87. package/dist/{chunk-SWK4XPUS.js → chunk-G56I7K4W.js} +2 -2
  88. package/dist/{chunk-JFQBRL3J.js → chunk-GC4DG2V5.js} +2 -2
  89. package/dist/chunk-GG45PK4S.js +4 -0
  90. package/dist/{chunk-XN22RGSR.js → chunk-GHNPACNP.js} +2 -2
  91. package/dist/{chunk-XU75YQN4.js → chunk-GINH3YQU.js} +2 -2
  92. package/dist/chunk-GTZZVLKJ.js +2 -0
  93. package/dist/chunk-GXXW5ZHH.js +2 -0
  94. package/dist/{chunk-RNKPYYYE.js → chunk-HAXXKRTD.js} +2 -2
  95. package/dist/chunk-HEZWBAZY.js +2 -0
  96. package/dist/chunk-HMEWLMML.js +2 -0
  97. package/dist/{chunk-2KVU55CW.js → chunk-HOBOVYPO.js} +2 -2
  98. package/dist/{chunk-2YC7YNKT.js → chunk-HRFQ6GW5.js} +2 -2
  99. package/dist/{chunk-RYOYJMGF.js → chunk-HX4X7KG3.js} +2 -2
  100. package/dist/{chunk-AZS7YPCB.js → chunk-HYT2R7LX.js} +2 -2
  101. package/dist/chunk-IKQVBVQL.js +40 -0
  102. package/dist/chunk-J6GLBBRK.js +4 -0
  103. package/dist/{chunk-TNG2FYS5.js → chunk-J7A4PWFX.js} +2 -2
  104. package/dist/chunk-JCSAZ35V.js +2 -0
  105. package/dist/{chunk-EWWY2ZFL.js → chunk-JDU2IV3A.js} +2 -2
  106. package/dist/{chunk-SB25YMEQ.js → chunk-JFMEXGFE.js} +2 -2
  107. package/dist/chunk-JFMI5SGB.js +4 -0
  108. package/dist/chunk-JJP37RGX.js +57 -0
  109. package/dist/chunk-JZ2A7LDM.js +5 -0
  110. package/dist/chunk-KNLQGXVH.js +80 -0
  111. package/dist/chunk-KVQCECPR.js +2 -0
  112. package/dist/{chunk-F24QUEQP.js → chunk-KXXORBZ2.js} +2 -2
  113. package/dist/{chunk-IKVNEGTW.js → chunk-L5KYH6U3.js} +2 -2
  114. package/dist/chunk-L6XHYJPZ.js +21 -0
  115. package/dist/chunk-L7KTFEAV.js +43 -0
  116. package/dist/{chunk-UAQ4T73O.js → chunk-LDXHR5EL.js} +2 -2
  117. package/dist/chunk-LEECKFCJ.js +2 -0
  118. package/dist/{chunk-LO5JSW2C.js → chunk-MHGDSBFX.js} +2 -2
  119. package/dist/{chunk-JUN5DOAK.js → chunk-MLQVVDG3.js} +2 -2
  120. package/dist/chunk-MOKUWRHO.js +3 -0
  121. package/dist/{chunk-44T4DUAA.js → chunk-MPYAPMNE.js} +2 -2
  122. package/dist/{chunk-ARVO6TTW.js → chunk-MV6SPXCR.js} +2 -2
  123. package/dist/{chunk-NRBNAECH.js → chunk-MWN53KRN.js} +2 -2
  124. package/dist/{chunk-TH6IC56G.js → chunk-MZPXPSUJ.js} +2 -2
  125. package/dist/{chunk-FBCVASUG.js → chunk-N55KIE46.js} +2 -2
  126. package/dist/{chunk-VMWUV6WB.js → chunk-NB4D3BNM.js} +2 -2
  127. package/dist/{chunk-JAT6C3VX.js → chunk-NGKBOT6G.js} +2 -2
  128. package/dist/{chunk-Q6T2CAJL.js → chunk-NJGKXKQF.js} +2 -2
  129. package/dist/chunk-NJQISBL4.js +8 -0
  130. package/dist/chunk-NJT3ZEKY.js +16 -0
  131. package/dist/{chunk-KFVSJX25.js → chunk-NKMKZP6A.js} +2 -2
  132. package/dist/chunk-NODFZ6ED.js +2 -0
  133. package/dist/{chunk-ERCYGVAM.js → chunk-NSM5IEVW.js} +2 -2
  134. package/dist/{chunk-YAGYMBEX.js → chunk-NTGUVNR2.js} +2 -2
  135. package/dist/{chunk-N7FP5H5U.js → chunk-NU3KFF2O.js} +8 -8
  136. package/dist/chunk-NWLVNU66.js +557 -0
  137. package/dist/{chunk-Q55NF3ZG.js → chunk-NYKZMCRC.js} +2 -2
  138. package/dist/{chunk-I6UTXNHU.js → chunk-O6BUXZEH.js} +2 -2
  139. package/dist/chunk-ODPDP7A4.js +3 -0
  140. package/dist/{chunk-ZAZGGSM3.js → chunk-OHIV323X.js} +2 -2
  141. package/dist/chunk-OIAPEKMT.js +3 -0
  142. package/dist/chunk-OIOC5EHF.js +3 -0
  143. package/dist/{chunk-YIHNPKWD.js → chunk-ONPPQM4G.js} +2 -2
  144. package/dist/{chunk-RHHCLWQ6.js → chunk-OUHEZBYI.js} +2 -2
  145. package/dist/{chunk-MSR2QRUE.js → chunk-OVGYW7UD.js} +2 -2
  146. package/dist/{chunk-OPSAW5DT.js → chunk-OYKU4B3Y.js} +2 -2
  147. package/dist/{chunk-5YRQIE2B.js → chunk-POBJ6FR2.js} +2 -2
  148. package/dist/{chunk-ZGW4HLPD.js → chunk-PSZPMMWN.js} +2 -2
  149. package/dist/chunk-PXTRBKRK.js +3 -0
  150. package/dist/{chunk-U2N2KE7A.js → chunk-Q5JRIHT3.js} +2 -2
  151. package/dist/{chunk-GRX7JOXQ.js → chunk-Q7ATHARX.js} +2 -2
  152. package/dist/{chunk-5ZMBRQFC.js → chunk-Q7CSKIDM.js} +2 -2
  153. package/dist/{chunk-HG722PO7.js → chunk-QBQE7ZJ5.js} +2 -2
  154. package/dist/{chunk-Z2PZVKPR.js → chunk-QH22UIXP.js} +2 -2
  155. package/dist/chunk-QXCKQTKR.js +60 -0
  156. package/dist/chunk-RBAD4GJ2.js +13 -0
  157. package/dist/chunk-RMDPFPNW.js +2 -0
  158. package/dist/chunk-ROPJDEJZ.js +4 -0
  159. package/dist/{chunk-56NQAEPJ.js → chunk-RVZC6TJE.js} +2 -2
  160. package/dist/{chunk-XJX6LGHL.js → chunk-S4QZBKSR.js} +2 -2
  161. package/dist/chunk-SCPMZ73U.js +2 -0
  162. package/dist/{chunk-7IQXARSQ.js → chunk-SIAP5RGI.js} +2 -2
  163. package/dist/{chunk-4TQU4TX2.js → chunk-SIX4RFR3.js} +2 -2
  164. package/dist/{chunk-AYPDH2LU.js → chunk-SKKXTABJ.js} +2 -2
  165. package/dist/{chunk-ZYM4HOFA.js → chunk-SSRFUQBD.js} +2 -2
  166. package/dist/chunk-SYVJEEUJ.js +3 -0
  167. package/dist/chunk-T3CZAZSI.js +8 -0
  168. package/dist/chunk-T3I6NHBH.js +2 -0
  169. package/dist/{chunk-GDRJB3SB.js → chunk-T6DWDI5E.js} +2 -2
  170. package/dist/chunk-T6HRIROJ.js +7 -0
  171. package/dist/{chunk-OTSPRVNW.js → chunk-TAA7HXHE.js} +2 -2
  172. package/dist/{chunk-IJMD6BRI.js → chunk-TJ2JQYT3.js} +2 -2
  173. package/dist/chunk-TULNMD5T.js +368 -0
  174. package/dist/chunk-U2FPY5XA.js +3 -0
  175. package/dist/chunk-U3SXIMII.js +38 -0
  176. package/dist/{chunk-ENWQWA2R.js → chunk-U6KCHXJ4.js} +2 -2
  177. package/dist/chunk-UH3XSKS5.js +9 -0
  178. package/dist/{chunk-UDY7MIAW.js → chunk-UIFUZVCC.js} +2 -2
  179. package/dist/{chunk-BDGTPN27.js → chunk-UXKURIVI.js} +2 -2
  180. package/dist/{chunk-FGNCOQUX.js → chunk-V2RBODHL.js} +2 -2
  181. package/dist/chunk-VBKUWB6N.js +2 -0
  182. package/dist/{chunk-PIFTZEEM.js → chunk-VBV6ALJE.js} +2 -2
  183. package/dist/{chunk-2OXVP5U5.js → chunk-VDGFWCQV.js} +2 -2
  184. package/dist/chunk-VDSDOEWF.js +2 -0
  185. package/dist/{chunk-C76O5MDS.js → chunk-VZPWVCLN.js} +2 -2
  186. package/dist/chunk-WDSFQDPN.js +2 -0
  187. package/dist/{chunk-BTVKZGWT.js → chunk-WFA35BGR.js} +2 -2
  188. package/dist/{chunk-H7CG6LOE.js → chunk-WLMP3OCW.js} +2 -2
  189. package/dist/{chunk-WOOAY3PA.js → chunk-WSA52GOR.js} +2 -2
  190. package/dist/chunk-WYPL7GF7.js +2 -0
  191. package/dist/{chunk-RDULNRSJ.js → chunk-X3YVZAKZ.js} +2 -2
  192. package/dist/chunk-X6OGVFIT.js +2 -0
  193. package/dist/{chunk-ISWFRGJ6.js → chunk-XKXTR6ZI.js} +2 -2
  194. package/dist/chunk-Y5DFAW5W.js +4 -0
  195. package/dist/chunk-YSYPDRD5.js +3 -0
  196. package/dist/chunk-ZFVPWH62.js +5 -0
  197. package/dist/chunk-ZGIHTH27.js +2 -0
  198. package/dist/{chunk-QKT4UI2Y.js → chunk-ZGIQN2SX.js} +2 -2
  199. package/dist/chunk-ZHG4WAHR.js +12 -0
  200. package/dist/{chunk-CLG6DWVS.js → chunk-ZKB2XUEN.js} +2 -2
  201. package/dist/chunk-ZLMXIQLC.js +21 -0
  202. package/dist/chunk-ZMCQIHI4.js +2 -0
  203. package/dist/cli-main.js +2 -2
  204. package/dist/code-TAVIKWJI.js +2 -0
  205. package/dist/code-result-json-5FEFQCAQ.js +2 -0
  206. package/dist/command-descriptors-7BKH53Y3.js +343 -0
  207. package/dist/dataflow-GFBTVDH3.js +2 -0
  208. package/dist/dependence-slice-GWGQCODG.js +2 -0
  209. package/dist/deps-4QHVDPYA.js +2 -0
  210. package/dist/direct-navigation-4UBC6HNW.js +3 -0
  211. package/dist/entry-map-QCTF4RVY.js +2 -0
  212. package/dist/files-M2UBF5HJ.js +2 -0
  213. package/dist/frontend-profile-roles-D7eCum8P.d.ts +10 -0
  214. package/dist/{health-CPp2Jf1Z.d.ts → health-BI2a9WPy.d.ts} +60 -2
  215. package/dist/hierarchy-2UIHRLW4.js +2 -0
  216. package/dist/imports-WIE3YZOB.js +2 -0
  217. package/dist/index.d.ts +1 -1
  218. package/dist/index.js +1 -1
  219. package/dist/members-YKD636DA.js +2 -0
  220. package/dist/methods-VDF4IMYG.js +2 -0
  221. package/dist/output-continuation-command-4UMDOOLO.js +3 -0
  222. package/dist/output-pagination-2GME6OPY.js +19 -0
  223. package/dist/postinstall.js +1 -1
  224. package/dist/project-reindex-XEQTRCV5.js +3 -0
  225. package/dist/queries/affected.js +1 -1
  226. package/dist/queries/anchors.d.ts +1 -1
  227. package/dist/queries/anchors.js +1 -1
  228. package/dist/queries/architecture.js +1 -1
  229. package/dist/queries/bottlenecks.js +1 -1
  230. package/dist/queries/by-kind.js +1 -1
  231. package/dist/queries/call-graph.d.ts +2 -0
  232. package/dist/queries/call-graph.js +1 -1
  233. package/dist/queries/change-surface.js +1 -1
  234. package/dist/queries/cleanup-plan.js +1 -1
  235. package/dist/queries/co-change.d.ts +20 -2
  236. package/dist/queries/co-change.js +1 -1
  237. package/dist/queries/code.js +1 -1
  238. package/dist/queries/complexity-hotspots.js +1 -1
  239. package/dist/queries/complexity.js +1 -1
  240. package/dist/queries/context.js +1 -1
  241. package/dist/queries/convergence.js +1 -1
  242. package/dist/queries/coupling.js +1 -1
  243. package/dist/queries/cycles.js +1 -1
  244. package/dist/queries/dataflow.js +1 -1
  245. package/dist/queries/dead.d.ts +2 -0
  246. package/dist/queries/dead.js +1 -1
  247. package/dist/queries/decorative-checkers.js +1 -1
  248. package/dist/queries/deep-chains.js +1 -1
  249. package/dist/queries/dependence-slice.js +1 -1
  250. package/dist/queries/dependency-depth.js +1 -1
  251. package/dist/queries/deps.js +1 -1
  252. package/dist/queries/diff-impact.d.ts +9 -0
  253. package/dist/queries/diff-impact.js +1 -1
  254. package/dist/queries/doc-drift.js +1 -1
  255. package/dist/queries/drift.js +1 -1
  256. package/dist/queries/duplicate-bodies.d.ts +28 -1
  257. package/dist/queries/duplicate-bodies.js +1 -1
  258. package/dist/queries/entry-map.d.ts +1 -1
  259. package/dist/queries/entry-map.js +1 -1
  260. package/dist/queries/evidence.js +1 -1
  261. package/dist/queries/extract-candidates.d.ts +50 -23
  262. package/dist/queries/extract-candidates.js +1 -1
  263. package/dist/queries/fan.js +1 -1
  264. package/dist/queries/files.js +1 -1
  265. package/dist/queries/health.d.ts +1 -1
  266. package/dist/queries/health.js +1 -1
  267. package/dist/queries/hierarchy.js +1 -1
  268. package/dist/queries/hotspots.js +1 -1
  269. package/dist/queries/imports.js +1 -1
  270. package/dist/queries/incomplete-migration.js +1 -1
  271. package/dist/queries/index.d.ts +4 -3
  272. package/dist/queries/index.js +1 -1
  273. package/dist/queries/isolated.js +1 -1
  274. package/dist/queries/locality-candidates.js +1 -1
  275. package/dist/queries/members.js +1 -1
  276. package/dist/queries/methods.js +1 -1
  277. package/dist/queries/not-implemented.js +1 -1
  278. package/dist/queries/outline.js +1 -1
  279. package/dist/queries/passthrough-candidates.d.ts +9 -1
  280. package/dist/queries/passthrough-candidates.js +1 -1
  281. package/dist/queries/plan-context.js +1 -1
  282. package/dist/queries/react-component-duplicates.d.ts +19 -3
  283. package/dist/queries/react-component-duplicates.js +1 -1
  284. package/dist/queries/react-hook-candidates.d.ts +22 -3
  285. package/dist/queries/react-hook-candidates.js +1 -1
  286. package/dist/queries/react-large-component-pressure.d.ts +17 -3
  287. package/dist/queries/react-large-component-pressure.js +1 -1
  288. package/dist/queries/recent-duplicates.js +1 -1
  289. package/dist/queries/redundant-reexports.js +1 -1
  290. package/dist/queries/reference-neighborhood.js +1 -1
  291. package/dist/queries/reference-reachability.js +1 -1
  292. package/dist/queries/refs.js +1 -1
  293. package/dist/queries/self-audit.d.ts +7 -1
  294. package/dist/queries/self-audit.js +1 -1
  295. package/dist/queries/similar-chains.js +1 -1
  296. package/dist/queries/similar-files.js +1 -1
  297. package/dist/queries/similar-signatures.js +1 -1
  298. package/dist/queries/similar.js +1 -1
  299. package/dist/queries/slice.js +1 -1
  300. package/dist/queries/source-inspection.js +1 -1
  301. package/dist/queries/source-search.js +1 -1
  302. package/dist/queries/stale-abstractions.js +1 -1
  303. package/dist/queries/surface.js +1 -1
  304. package/dist/queries/symbols.js +1 -1
  305. package/dist/queries/system-map.d.ts +1 -1
  306. package/dist/queries/system-map.js +1 -1
  307. package/dist/queries/system.js +1 -1
  308. package/dist/queries/test-quality.js +1 -1
  309. package/dist/queries/trace.js +1 -1
  310. package/dist/queries/twin-ab.js +1 -1
  311. package/dist/queries/twin-drift.d.ts +22 -6
  312. package/dist/queries/twin-drift.js +1 -1
  313. package/dist/queries/unused-imports.js +1 -1
  314. package/dist/queries/unused-params.js +1 -1
  315. package/dist/queries/value-flow.js +1 -1
  316. package/dist/queries/vue-component-duplicates.js +1 -1
  317. package/dist/queries/vue-composable-candidates.js +1 -1
  318. package/dist/queries/vue-large-view-pressure.js +1 -1
  319. package/dist/queries/wrapper-candidates.d.ts +16 -1
  320. package/dist/queries/wrapper-candidates.js +1 -1
  321. package/dist/query-service-fastpath.js +5 -5
  322. package/dist/query-service-server.js +3 -3
  323. package/dist/refs-JNK5CLM7.js +2 -0
  324. package/dist/refs-pagination-6BLRYGMV.js +2 -0
  325. package/dist/reindex-worker.js +25 -25
  326. package/dist/reindex.d.ts +3 -2
  327. package/dist/reindex.js +35 -35
  328. package/dist/runtime.d.ts +34 -2
  329. package/dist/runtime.js +4 -4
  330. package/dist/rust-semantic-session-server.js +1 -1
  331. package/dist/rust-semantic-session-worker.js +1 -1
  332. package/dist/rust-semantic-worker.js +1 -1
  333. package/dist/{scip-cli-H-n59izO.d.ts → scip-cli-DOerTq-R.d.ts} +42 -4
  334. package/dist/slice-PHPVNCWX.js +2 -0
  335. package/dist/surface-MQX5MPIV.js +2 -0
  336. package/dist/symbol-resolution-DBLVXLBC.js +2 -0
  337. package/dist/system-JOPKV4OG.js +2 -0
  338. package/dist/trace-I2P2YFH4.js +2 -0
  339. package/dist/typescript-mailbox-worker.js +1 -1
  340. package/dist/value-flow-JJVMF7NP.js +2 -0
  341. package/dist/watch-server.js +3 -3
  342. package/docs/COMMAND_REFERENCE.md +2 -2
  343. package/docs/DETECTOR_GUIDE.md +51 -12
  344. package/docs/accuracy-audit-checklist.md +36 -13
  345. package/docs/locality-analyzer-design.md +9 -9
  346. package/package.json +2 -2
  347. package/skills/conductor/SKILL.md +110 -0
  348. package/skills/conductor/agents/openai.yaml +4 -0
  349. package/skills/principal-maintainability-review/SKILL.md +273 -0
  350. package/skills/principal-maintainability-review/agents/openai.yaml +4 -0
  351. package/skills/scip-calibrate/SKILL.md +102 -0
  352. package/skills/scip-calibrate/agents/openai.yaml +4 -0
  353. package/skills/scip-claim-audit/SKILL.md +113 -0
  354. package/skills/scip-claim-audit/agents/openai.yaml +4 -0
  355. package/skills/scip-probe-reachability/SKILL.md +93 -0
  356. package/skills/scip-probe-reachability/agents/openai.yaml +4 -0
  357. package/skills/scip-root-cause/SKILL.md +160 -0
  358. package/skills/scip-root-cause/agents/openai.yaml +4 -0
  359. package/skills/scip-system-compression/SKILL.md +252 -0
  360. package/skills/scip-system-compression/agents/openai.yaml +4 -0
  361. package/skills/scip-system-compression/references/compression-atlas.md +116 -0
  362. package/skills/scip-system-compression/references/compression-patterns.md +87 -0
  363. package/skills/scip-twin-drift/SKILL.md +109 -0
  364. package/skills/scip-twin-drift/agents/openai.yaml +4 -0
  365. package/dist/by-kind-4IYG2SKW.js +0 -2
  366. package/dist/call-graph-WQNXMNNN.js +0 -2
  367. package/dist/call-graph-evidence-lZa2dwQA.d.ts +0 -11
  368. package/dist/chunk-2BTJALUS.js +0 -454
  369. package/dist/chunk-3QXC54FQ.js +0 -3
  370. package/dist/chunk-3TJY6M3B.js +0 -7
  371. package/dist/chunk-42W3LFUK.js +0 -13
  372. package/dist/chunk-4GAQ6FI4.js +0 -43
  373. package/dist/chunk-6NC3YSPY.js +0 -38
  374. package/dist/chunk-6VEFRPTD.js +0 -5
  375. package/dist/chunk-7C26EKLZ.js +0 -4
  376. package/dist/chunk-7JYHQAH2.js +0 -22
  377. package/dist/chunk-7KSO2OAP.js +0 -2
  378. package/dist/chunk-7XZGZBSQ.js +0 -2
  379. package/dist/chunk-A77SCPW2.js +0 -3
  380. package/dist/chunk-AK3PYTIK.js +0 -5
  381. package/dist/chunk-AMIMMNA4.js +0 -11
  382. package/dist/chunk-AUY5BL74.js +0 -2
  383. package/dist/chunk-BDHFVH2M.js +0 -18
  384. package/dist/chunk-BECZLYNU.js +0 -8
  385. package/dist/chunk-BUTEIZKP.js +0 -10
  386. package/dist/chunk-BWVQP3LB.js +0 -38
  387. package/dist/chunk-BYDAFMSR.js +0 -57
  388. package/dist/chunk-BZYSGZRK.js +0 -2
  389. package/dist/chunk-C7IJMOFP.js +0 -134
  390. package/dist/chunk-CBBHFNLX.js +0 -2
  391. package/dist/chunk-D2MVJSP4.js +0 -21
  392. package/dist/chunk-D35XIZGN.js +0 -2
  393. package/dist/chunk-DKM723YF.js +0 -79
  394. package/dist/chunk-DRENNWRG.js +0 -2
  395. package/dist/chunk-E44IVWIJ.js +0 -367
  396. package/dist/chunk-EDMB6SSO.js +0 -7
  397. package/dist/chunk-EETGXQY7.js +0 -3
  398. package/dist/chunk-FKGQOTKD.js +0 -2
  399. package/dist/chunk-GH5YSGZL.js +0 -5
  400. package/dist/chunk-GQIDEID3.js +0 -2
  401. package/dist/chunk-HCVJR2V4.js +0 -3
  402. package/dist/chunk-IMKZEXZG.js +0 -2
  403. package/dist/chunk-ISIQLPJ2.js +0 -61
  404. package/dist/chunk-IXESDH3J.js +0 -2
  405. package/dist/chunk-JJ62MTQH.js +0 -40
  406. package/dist/chunk-JT6XX7QY.js +0 -8
  407. package/dist/chunk-KFOYCQAJ.js +0 -9
  408. package/dist/chunk-LRI5OMPE.js +0 -2
  409. package/dist/chunk-MHIEP7EG.js +0 -4
  410. package/dist/chunk-NK3JMP22.js +0 -2
  411. package/dist/chunk-NVSZNESQ.js +0 -2
  412. package/dist/chunk-OJNK5ALA.js +0 -2
  413. package/dist/chunk-OXYAWIEA.js +0 -2
  414. package/dist/chunk-OZETODHH.js +0 -2
  415. package/dist/chunk-PBUH2P5S.js +0 -3
  416. package/dist/chunk-PLJUQFQN.js +0 -2
  417. package/dist/chunk-PLYUVM4F.js +0 -2
  418. package/dist/chunk-PXXYQK55.js +0 -2
  419. package/dist/chunk-Q5TA4OY4.js +0 -20
  420. package/dist/chunk-Q7GBK5T7.js +0 -81
  421. package/dist/chunk-QLBSG7U5.js +0 -3
  422. package/dist/chunk-QWKHW6VZ.js +0 -2
  423. package/dist/chunk-RPL3ARU7.js +0 -16
  424. package/dist/chunk-SVHTMVA4.js +0 -4
  425. package/dist/chunk-T6QD2ZQB.js +0 -43
  426. package/dist/chunk-TD7VKJ2Y.js +0 -117
  427. package/dist/chunk-TKDNDQA7.js +0 -3
  428. package/dist/chunk-TQZV7KV4.js +0 -2
  429. package/dist/chunk-TUSPIVZ3.js +0 -4
  430. package/dist/chunk-URSGGIZX.js +0 -2
  431. package/dist/chunk-UT7TADJX.js +0 -2
  432. package/dist/chunk-V4NG5OMS.js +0 -554
  433. package/dist/chunk-VTCIYFEK.js +0 -2
  434. package/dist/chunk-VU6LIWHT.js +0 -2
  435. package/dist/chunk-VUSKPCUB.js +0 -2
  436. package/dist/chunk-WN3TCGJ4.js +0 -2
  437. package/dist/chunk-WSLEJSFR.js +0 -2
  438. package/dist/chunk-WYZIHUPZ.js +0 -16
  439. package/dist/chunk-XE33FV5W.js +0 -2
  440. package/dist/chunk-XGGBK66W.js +0 -4
  441. package/dist/chunk-XSWYJCAK.js +0 -2
  442. package/dist/chunk-Y334QQU5.js +0 -3
  443. package/dist/chunk-Z2AWCTN6.js +0 -2
  444. package/dist/chunk-ZOXKSQQB.js +0 -2
  445. package/dist/chunk-ZPASRBLF.js +0 -2
  446. package/dist/chunk-ZZ3Z7D56.js +0 -2
  447. package/dist/code-EQJFDT6I.js +0 -2
  448. package/dist/code-result-json-7UWIWBOO.js +0 -2
  449. package/dist/command-descriptors-ORNTVNYV.js +0 -342
  450. package/dist/dataflow-6VL54GX5.js +0 -2
  451. package/dist/dependence-slice-DT2NUHD2.js +0 -2
  452. package/dist/deps-DB7H5IKC.js +0 -2
  453. package/dist/direct-navigation-O3LUAYWQ.js +0 -3
  454. package/dist/entry-map-6K62RV3D.js +0 -2
  455. package/dist/files-MSLD7MO6.js +0 -2
  456. package/dist/hierarchy-IVBXAKFA.js +0 -2
  457. package/dist/imports-FRAVZ3Y2.js +0 -2
  458. package/dist/members-KJOJDYGO.js +0 -2
  459. package/dist/methods-2AYABBT3.js +0 -2
  460. package/dist/output-continuation-command-JHMPH6NC.js +0 -3
  461. package/dist/output-pagination-3OFL2MJV.js +0 -19
  462. package/dist/project-reindex-HYO4WD7Z.js +0 -3
  463. package/dist/refs-ARMA6XUJ.js +0 -2
  464. package/dist/refs-pagination-VUGIWN6U.js +0 -2
  465. package/dist/slice-YOB5YFAM.js +0 -2
  466. package/dist/surface-VY5EFWTW.js +0 -2
  467. package/dist/symbol-resolution-DGQN4XIV.js +0 -2
  468. package/dist/system-2KQ3QD2P.js +0 -2
  469. package/dist/trace-HTIPTXAE.js +0 -2
  470. package/dist/value-flow-5FV3VQI7.js +0 -2
@@ -1,2 +0,0 @@
1
- import{d as f}from"./chunk-B3X6KU75.js";import{P as d}from"./chunk-7JYHQAH2.js";function S(n,e={}){let{minComponentLines:o=300,minFileLines:i=800,minJsxTokens:u=80,minBehaviorTokens:s=40,limit:a=20,scope:m,scanLimit:c,filePattern:p}=e;return d(n).reactProfiles({scope:m,scanLimit:c}).filter(t=>t.kind==="component").filter(t=>!p||t.file.includes(p)||t.name.includes(p)).map(t=>C(t,{minComponentLines:o,minFileLines:i,minJsxTokens:u,minBehaviorTokens:s})).filter(t=>t!==null).sort((t,r)=>r.componentLines-t.componentLines||r.fileLines-t.fileLines||t.file.localeCompare(r.file)).slice(0,a)}function C(n,e){let o=Math.max(80,Math.floor(e.minComponentLines/2)),i=f(n,x({minComponentLines:e.minComponentLines,minFileLines:e.minFileLines,minJsxTokens:e.minJsxTokens,minBehaviorTokens:e.minBehaviorTokens,substantialComponentLines:o}),"component"),{reasons:u}=i;if(u.length===0)return null;let s=i.dominantPressure,a=i.pressureKinds,m=b(n),c=R(s,a,m);return{file:n.file,component:n.name,componentLines:n.loc,fileLines:n.fileLines,jsxTokens:n.jsxTokens.size,behaviorTokens:n.behaviorTokens.size,dominantPressure:s,pressureKinds:a,contextKind:m,recommendationKind:c,recommendation:v(c,m),reasons:u,loc:n.loc}}function x(n){return[{axis:"component",value:e=>e.loc,qualifies:(e,o)=>o>=n.minComponentLines,reason:(e,o)=>`${o} component line(s)`},{axis:"file",value:e=>e.fileLines,qualifies:(e,o)=>o>=n.minFileLines&&e.loc>=n.substantialComponentLines,reason:(e,o)=>`${o} file line(s)`},{axis:"jsx-structure",value:e=>e.jsxTokens.size,weightedValue:(e,o)=>o*3,qualifies:(e,o)=>o>=n.minJsxTokens,reason:(e,o)=>`${o} JSX structure token(s)`},{axis:"hook-behavior",value:e=>e.behaviorTokens.size,weightedValue:(e,o)=>o*4,qualifies:(e,o)=>o>=n.minBehaviorTokens,reason:(e,o)=>`${o} behavior token(s)`}]}function b(n){let e=n.file.split(/[\\/]+/).filter(Boolean),o=e.slice(0,-1).map(r=>r.toLowerCase()),i=(e.at(-1)??n.name).replace(/\.[^.]+$/,""),s=o.findIndex(r=>k.has(r))>=0,a=o.some(r=>h.has(r));if(L(i)||L(n.name))return"component";let c=T.has(i.toLowerCase()),p=/(?:Page|Route|Screen)$/.test(n.name),l=s&&/View$/.test(n.name),t=!a&&i.replace(/[^A-Za-z0-9]+/g,"").toLowerCase()===n.name.replace(/[^A-Za-z0-9]+/g,"").toLowerCase()&&/(?:Page|Route|Screen|View)$/.test(i);return c||p||l||t?"route-page":"component"}function L(n){let e=n.split(/[^A-Za-z0-9]+/).filter(Boolean).map(o=>o.toLowerCase());return e.at(-1)&&g.has(e.at(-1))?!0:[...g].some(o=>n.endsWith(P(o)))}function R(n,e,o){return n==="hook-behavior"?"behavior-extraction":o==="route-page"?"route-page-decomposition":e.includes("hook-behavior")?"behavior-extraction":e.includes("jsx-structure")?"jsx-decomposition":e.includes("file")?"file-decomposition":n==="jsx-structure"?"jsx-decomposition":n==="file"&&!e.includes("component")?"file-decomposition":"component-decomposition"}function v(n,e){switch(n){case"behavior-extraction":return"Extract independent state, effects, requests, or handlers into hooks, controllers, or feature modules.";case"route-page-decomposition":return"Split route/page orchestration from reusable panels and feature controllers.";case"jsx-decomposition":return e==="route-page"?"Split page JSX into named layout sections before extracting behavior.":"Split repeated JSX sections into named presentational components.";case"file-decomposition":return"Review file-level decomposition; split colocated panels or helpers before changing behavior.";case"component-decomposition":return"Review component boundaries around props, state ownership, and independently changing UI sections."}}var h=new Set(["component","components","panel","panels","partial","partials"]),g=new Set(["banner","button","card","dialog","drawer","filter","form","grid","header","item","list","menu","modal","nav","panel","picker","rail","row","section","selector","shell","sidebar","table","toolbar"]),k=new Set(["landing","page","pages","route","routes","screen","screens","view","views"]),T=new Set(["page","route","screen"]);function P(n){return n.charAt(0).toUpperCase()+n.slice(1)}export{S as a};
2
- //# sourceMappingURL=chunk-VTCIYFEK.js.map
@@ -1,2 +0,0 @@
1
- import{a as le}from"./chunk-ZAZGGSM3.js";import{a as de}from"./chunk-3TJY6M3B.js";import{a as pe}from"./chunk-U2N2KE7A.js";import{a as he}from"./chunk-6YTSKJJ3.js";import{a as ge}from"./chunk-UT7TADJX.js";import{a as se}from"./chunk-VTCIYFEK.js";import{a as ue}from"./chunk-H7CG6LOE.js";import{a as ce}from"./chunk-ZYM4HOFA.js";import{a as oe}from"./chunk-URSGGIZX.js";import{a as ae}from"./chunk-7XZGZBSQ.js";import{a as ne}from"./chunk-OPSAW5DT.js";import{a as me}from"./chunk-PLJUQFQN.js";import{a as ie}from"./chunk-NVSZNESQ.js";import{a as re}from"./chunk-GY7CCCEZ.js";import{a as J}from"./chunk-ZPASRBLF.js";import{b as ee}from"./chunk-OJNK5ALA.js";import{a as Z}from"./chunk-QLBSG7U5.js";import{b as te}from"./chunk-XDAUYDFT.js";import{a as M,b as U}from"./chunk-3QXC54FQ.js";import{b as Y}from"./chunk-PXXYQK55.js";import{a as K}from"./chunk-ISWFRGJ6.js";import{a as X}from"./chunk-7C26EKLZ.js";import{f as Q}from"./chunk-6VEFRPTD.js";import{a as W}from"./chunk-OTSPRVNW.js";import{f as A,h as T}from"./chunk-BECZLYNU.js";import{a as G}from"./chunk-42W3LFUK.js";import{C as O,z as j}from"./chunk-7JYHQAH2.js";import{B as k}from"./chunk-Q7GBK5T7.js";import{xa as q,ya as z}from"./chunk-GH5YSGZL.js";import{readdirSync as Ye}from"fs";import{basename as Xe,join as fe}from"path";function Qe(e,r,t={}){let i=new Set(e),n=new Set(r),o=[...n].filter(s=>!i.has(s)).sort(),a=t.allowExtra?[]:[...i].filter(s=>!n.has(s)).sort();return{missing:o,extra:a}}function Je(e,r){let t=Ze(e,r.file,r.keys);if(!t.ok)return{name:r.name,file:r.file,status:"unavailable",missing:[],extra:[],unavailableReason:t.reason};let i=ot(e.config.projectRoot,r.mustEqual),n=Qe(t.keys,i,{allowExtra:r.allowExtra??!1}),o=n.missing.length>0||n.extra.length>0?"violated":"ok";return{name:r.name,file:r.file,status:o,missing:n.missing,extra:n.extra}}function ve(e,r){return r.map(t=>Je(e,t))}function Ze(e,r,t){return t.type==="markdown-list"?nt(e,r,t.marker):et(e,r,t)}function et(e,r,t){if(!k(e,r))return{ok:!1,reason:`file not found: ${r}`};let n=j(r);if(!n)return{ok:!1,reason:`unsupported file type for ${t.type} extraction: ${r}`};let o=O(e,r);if(!o)return{ok:!1,reason:`tree-sitter parser unavailable for ${n} (${r}) \u2014 contract skipped, not silently passed`,disclosedUnavailable:{language:n,reason:"parser-unavailable"}};let a=t.type==="object-literal-keys"?tt(o,t.identifier):it(o,t.identifier);return a===null?{ok:!1,reason:`no ${t.type==="object-literal-keys"?"object literal":"string array"} named "${t.identifier}" found in ${r}`}:{ok:!0,keys:a}}function be(e){let r=e.childForFieldName("value");return r?r.type==="as_expression"||r.type==="satisfies_expression"?r.namedChild(0):r:null}function tt(e,r){for(let t of e.rootNode.descendantsOfType("variable_declarator")){if(t.childForFieldName("name")?.text!==r)continue;let n=be(t);if(n?.type==="object")return rt(n)}return null}function rt(e){let r=new Set;for(let t of e.namedChildren)if(t.type==="pair"){let i=t.childForFieldName("key");i&&r.add(ye(i.text))}else t.type==="shorthand_property_identifier"&&r.add(t.text);return[...r].sort()}function it(e,r){for(let t of e.rootNode.descendantsOfType("variable_declarator")){if(t.childForFieldName("name")?.text!==r)continue;let n=be(t);if(n?.type!=="array")continue;let o=new Set;for(let a of n.namedChildren)a.type==="string"&&o.add(ye(a.text));return[...o].sort()}return null}function ye(e){return e.length>=2&&(e[0]==="'"&&e.endsWith("'")||e[0]==='"'&&e.endsWith('"'))?e.slice(1,-1):e}function nt(e,r,t){let i=k(e,r);if(!i)return{ok:!1,reason:`file not found: ${r}`};let n=Se(i,t);return n===null?{ok:!1,reason:`no <!-- BEGIN GENERATED ${t} --> ... <!-- END GENERATED ${t} --> block in ${r}`}:{ok:!0,keys:xe(n)}}function Se(e,r){let t=G(r),n=new RegExp(`<!--\\s*BEGIN GENERATED ${t}\\s*-->([\\s\\S]*?)<!--\\s*END GENERATED ${t}\\s*-->`).exec(e);return n?n[1]:null}function xe(e){let r=new Set;for(let t of e.matchAll(/`([a-z][a-z0-9-]*)`/g))r.add(t[1]);for(let t of e.matchAll(/\[([a-z][a-z0-9-]*)\]\([^)]*\)/g))r.add(t[1]);return[...r].sort()}function ot(e,r){switch(r.type){case"top-level-dirs":return Ce(fe(e,r.path));case"file-glob":return[...new Set(W(e,r.pattern).map(t=>Xe(t)))].sort();case"registered-commands":return at(e);case"builtin-skills":return Ce(fe(e,"skills"))}}function Ce(e){let r;try{r=Ye(e,{withFileTypes:!0})}catch{return[]}return r.filter(t=>t.isDirectory()&&!t.name.startsWith(".")).map(t=>t.name).sort()}function at(e){let r;try{r=q(e,"docs/COMMAND_REFERENCE.md",{maxBytes:8*1024*1024,inputKind:"generated command reference"})}catch(i){if(!z(i))throw i;return[]}let t=Se(r,"COMMAND REFERENCE");return t?xe(t):[]}function h(e){return e.scoreCount??e.count}function B(e){let r=lt(e),{breakdown:t,pressure:i}=dt(e),n=He(t,"risk"),o=He(t,"hygiene");return{score:Math.min(n,o),riskScore:n,hygieneScore:o,scoreBreakdown:t,overview:{documents:e.statsResult.documents,symbols:e.statsResult.symbols,indexSizeBytes:e.statsResult.indexSizeBytes},findings:{deadSymbols:e.dead.count,deadLoc:e.dead.loc,isolatedSymbols:e.isolated.count,isolatedLoc:e.isolated.loc,cycles:e.realCycleCount,similarPairs:e.similarCount,duplicateBodyGroups:e.duplicateBodies.count,duplicateBodyLoc:e.duplicateBodies.loc,twinDriftGroups:e.twinDrift.count,twinDriftLoc:e.twinDrift.loc,reactComponentDuplicatePairs:e.reactComponentDuplicates.count,reactHookCandidatePairs:e.reactHookCandidates.count,reactHookCandidateScoreCount:h(e.reactHookCandidates),reactLargeComponentPressureFiles:e.reactLargeComponentPressure.count,vueComponentDuplicatePairs:e.vueComponentDuplicates.count,vueComposableCandidatePairs:e.vueComposableCandidates.count,vueComposableCandidateScoreCount:h(e.vueComposableCandidates),vueLargeViewPressureFiles:e.vueLargeViewPressure.count,extractionCandidates:e.extractCount,wrappers:e.wrappers.count,wrapperScoreCount:h(e.wrappers),passthroughs:e.passthroughs.count,staleTypes:e.stale.count,driftedFiles:e.drift.count,complexityHotspotCount:e.complexity.extremeCount,hiddenCouplingPairs:e.gitEvidence?.hiddenCoupling.pairCount??null,hiddenCouplingScoreCount:e.gitEvidence?.hiddenCoupling.scoreCount??null,coverageContractViolations:e.coverageContracts.count},axes:st(e),validation:ut(e),suppressions:e.suppressions,actions:r,pressure:i,topComplexity:e.complexity.top,detectorEvidence:e.detectorEvidence,warnings:e.warnings.length>0?e.warnings:void 0}}function st(e){return{deletable:{loc:e.dead.loc+e.isolated.loc,symbols:e.dead.count+e.isolated.count},cycles:{count:e.realCycleCount},changeAmplification:e.gitEvidence?.amplification??null,hiddenCoupling:e.gitEvidence?.hiddenCoupling??null,churnWeightedComplexity:ct(e),evidenceQuality:{graphFindings:e.dead.count+e.isolated.count+e.realCycleCount,heuristicFindings:e.similarCount+e.duplicateBodies.count+e.twinDrift.count+e.reactComponentDuplicates.count+e.reactHookCandidates.count+e.reactLargeComponentPressure.count+e.vueComponentDuplicates.count+e.vueComposableCandidates.count+e.vueLargeViewPressure.count+e.extractCount+e.wrappers.count+e.passthroughs.count+e.stale.count+e.drift.count,userSuppressed:e.suppressions?.total??0}}}function ct(e){let r=e.gitEvidence?.fileStats;return r?e.complexity.top.map(t=>{let i=t.file?r[t.file]?.changes??0:0;return{...t,changes:i,weighted:p(t.score*Math.log2(1+i))}}).sort((t,i)=>i.weighted-t.weighted):null}function ut(e){let r=e.gitEvidence?.fileStats;if(!r)return null;let t={dead:e.dead.files??[],isolated:e.isolated.files??[],twinDrift:e.twinDrift.files??[],wrappers:e.wrappers.files??[],passthroughs:e.passthroughs.files??[],stale:e.stale.files??[],reactComponents:e.reactComponentDuplicates.files??[],reactHooks:e.reactHookCandidates.files??[],reactLargeComponents:e.reactLargeComponentPressure.files??[],vueComponents:e.vueComponentDuplicates.files??[],vueComposables:e.vueComposableCandidates.files??[],vueLargeViews:e.vueLargeViewPressure.files??[]},i=new Set(Object.values(t).flat()),n=0,o=0,a=0;for(let[v,g]of Object.entries(r))i.has(v)?n+=g.fixChanges:(o+=g.fixChanges,a+=1);let s=i.size>0?p(n/i.size):0,l=a>0?p(o/a):0,S={};for(let[v,g]of Object.entries(t)){let f=new Set(g);if(f.size===0)continue;let b=0;for(let R of f)b+=r[R]?.fixChanges??0;let x=p(b/f.size);S[v]={flaggedFiles:f.size,fixDensity:x,lift:l>0?p(x/l):null}}return{flaggedFiles:i.size,flaggedFixDensity:s,baselineFixDensity:l,ratio:i.size>0&&l>0?p(s/l):null,byCategory:S,validationBasis:{method:"subject-regex",commitsScanned:e.gitEvidence?.commitsScanned??0}}}function p(e){return Math.round(e*100)/100}function Ee(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/0+$/,"").replace(/\.$/,"")}function E(e,r="existing shared infrastructure discount"){let t=h(e);return Math.abs(t-e.count)<.01?"":` (${Ee(t)} score-weighted after ${r})`}function y(e,r){let t=h(e),i=`${e.count} ${r}`;return Math.abs(t-e.count)<.01?i:`${i} (${Ee(t)} score-weighted)`}function lt(e){let r=[];if(e.dead.count>0&&r.push({category:"Dead code",evidence:"graph-fact",evidenceContractId:"dead-visible-references",description:`${e.dead.count} indexed symbols with no visible repository references \u2014 review runtime/framework roots and the capability disclosure, then verify any deletion with cleanup-plan --verify`,effort:"low",impact:"high",count:e.dead.count,locRecoverable:e.dead.loc}),e.isolated.count>0&&r.push({category:"Isolated symbols",evidence:"graph-fact",evidenceContractId:"isolated-visible-connectivity",description:`${e.isolated.count} symbols with no visible indexed or source-supported caller/callee after root exclusions \u2014 runtime reflection and generated dispatch remain disclosed blind spots`,effort:"low",impact:"medium",count:e.isolated.count,locRecoverable:e.isolated.loc}),e.realCycleCount>0&&r.push({category:"Circular dependencies",evidence:"graph-fact",description:`${e.realCycleCount} indexed dependency cycle(s) \u2014 inspect ownership and runtime order before choosing whether or how to break them`,effort:"medium",impact:"high",count:e.realCycleCount,locRecoverable:0}),e.similarCount>0&&r.push({category:"Similar functions",evidence:"heuristic",evidenceContractId:"duplicate-structural-candidate",description:`${e.similarCount} pairs share disclosed call or source-token evidence beyond imports \u2014 review domain identity before considering consolidation`,effort:"medium",impact:"medium",count:e.similarCount,locRecoverable:0}),e.duplicateBodies.count>0&&r.push({category:"Duplicate function bodies",evidence:"heuristic",evidenceContractId:"duplicate-structural-candidate",description:`${e.duplicateBodies.count} exact small-body group(s) across files \u2014 consolidate only when the domain concept matches`,effort:"low",impact:"medium",count:e.duplicateBodies.count,locRecoverable:e.duplicateBodies.loc}),e.twinDrift.count>0&&r.push({category:"Drifted twin implementations",evidence:"heuristic",description:`${e.twinDrift.count} same-name (or near-name) function group(s) across files with diverged or identical bodies \u2014 determine whether they represent the same concept before acting`,effort:"medium",impact:"medium",count:e.twinDrift.count,locRecoverable:0}),e.reactComponentDuplicates.count>0&&r.push({category:"Duplicated React components",evidence:"heuristic",description:`${e.reactComponentDuplicates.count} React component pair(s) share JSX structure \u2014 review whether local product intent justifies reuse`,effort:"medium",impact:"medium",count:e.reactComponentDuplicates.count,locRecoverable:e.reactComponentDuplicates.loc}),e.reactHookCandidates.count>0&&r.push({category:"Duplicated React hook behavior",evidence:"heuristic",description:`${e.reactHookCandidates.count} React component pair(s) share state/effect/request behavior${E(e.reactHookCandidates)} \u2014 review whether a common hook would preserve ownership and lifecycle semantics`,effort:"medium",impact:"medium",count:e.reactHookCandidates.count,locRecoverable:e.reactHookCandidates.loc}),e.reactLargeComponentPressure.count>0&&r.push({category:"Large React components",evidence:"heuristic",description:`${e.reactLargeComponentPressure.count} React component(s) concentrate JSX/behavior pressure \u2014 split by reason to change`,effort:"medium",impact:"medium",count:e.reactLargeComponentPressure.count,locRecoverable:0}),e.vueComponentDuplicates.count>0&&r.push({category:"Duplicated Vue components",evidence:"heuristic",description:`${e.vueComponentDuplicates.count} Vue component pair(s) share template structure \u2014 review whether local product intent justifies reuse`,effort:"medium",impact:"medium",count:e.vueComponentDuplicates.count,locRecoverable:e.vueComponentDuplicates.loc}),e.vueComposableCandidates.count>0&&r.push({category:"Duplicated Vue behavior",evidence:"heuristic",description:`${e.vueComposableCandidates.count} Vue component pair(s) share state/effect/request behavior${E(e.vueComposableCandidates)} \u2014 review whether a common composable would preserve ownership and lifecycle semantics`,effort:"medium",impact:"medium",count:e.vueComposableCandidates.count,locRecoverable:e.vueComposableCandidates.loc}),e.vueLargeViewPressure.count>0&&r.push({category:"Large Vue views",evidence:"heuristic",description:`${e.vueLargeViewPressure.count} Vue file(s) concentrate template/script/style pressure \u2014 split by reason to change`,effort:"medium",impact:"medium",count:e.vueLargeViewPressure.count,locRecoverable:0}),e.extractCount>0&&r.push({category:"Extraction candidates",evidence:"heuristic",description:`${e.extractCount} large functions with isolated callee clusters \u2014 review same-file or feature-local extraction seams`,effort:"medium",impact:"medium",count:e.extractCount,locRecoverable:0}),e.wrappers.count>0&&r.push({category:"Wrapper functions",evidence:"heuristic",evidenceContractId:"wrapper-indirection-candidate",description:`${e.wrappers.count} single-consumer symbols${E(e.wrappers,"boundary-evidence discount")} \u2014 inspect whether each is indirection or an intentional API, framework, or ownership boundary`,effort:"low",impact:"low",count:e.wrappers.count,locRecoverable:e.wrappers.loc}),e.passthroughs.count>0&&r.push({category:"Passthrough functions",evidence:"heuristic",evidenceContractId:"passthrough-forwarding-candidate",description:`${e.passthroughs.count} functions that literally forward to one callee \u2014 inspect whether each is unnecessary indirection or an intentional boundary`,effort:"low",impact:"low",count:e.passthroughs.count,locRecoverable:e.passthroughs.loc}),e.stale.count>0){let n=[];e.stale.unused>0&&n.push(`${e.stale.unused} unused`),e.stale.singleUse>0&&n.push(`${e.stale.singleUse} single-consumer (not in types file)`),r.push({category:"Stale abstractions",evidence:"heuristic",evidenceContractId:"stale-abstraction-candidate",description:`${n.join(", ")} \u2014 review public, runtime-registration, and ownership evidence before removing, moving, or inlining`,effort:"low",impact:"medium",count:e.stale.count,locRecoverable:e.stale.loc})}if(e.drift.count>0){let n=[];e.drift.unusedImports>0&&n.push(`${e.drift.unusedImports} unused imports`),e.drift.architectureViolations>0&&n.push(`${e.drift.architectureViolations} declared architecture violations`),r.push({category:"Structural drift",evidence:"heuristic",description:`${n.join(", ")} \u2014 repair direct dependency-rule breaks; inspect boundary signals with \`drift --architecture\``,effort:e.drift.architectureViolations>0?"medium":"low",impact:e.drift.architectureViolations>0?"medium":"low",count:e.drift.count,locRecoverable:0})}if(e.coverageContracts.count>0&&r.push({category:"Coverage contract drift",evidence:"graph-fact",description:`${e.coverageContracts.count} configured coverage contract(s) drifted from their ground-truth source (enumeration rot) \u2014 run \`scip-query health --json\` for the missing/extra keys`,effort:"low",impact:"medium",count:e.coverageContracts.count,locRecoverable:0}),e.gitEvidence&&e.gitEvidence.hiddenCoupling.pairCount>0){let n=e.gitEvidence.hiddenCoupling.top[0];r.push({category:"Hidden coupling",evidence:"change-graph",description:`${e.gitEvidence.hiddenCoupling.pairCount} file pair(s) co-change without a structural link`+E({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:e.gitEvidence.hiddenCoupling.scoreCount},"broad/stale-history discount")+(n?` (e.g. ${n.fileA} \u2194 ${n.fileB})`:"")+" \u2014 inspect whether a shared concept, generated artifact, or coordinated contract explains the history",effort:"medium",impact:"high",count:e.gitEvidence.hiddenCoupling.pairCount,locRecoverable:0})}let t={high:3,medium:2,low:1},i={low:3,medium:2,high:1};return r.sort((n,o)=>{let a=t[n.impact]*i[n.effort];return t[o.impact]*i[o.effort]-a}),r}var we={"dead-code":"risk",isolated:"risk",cycles:"risk",complexity:"risk","hidden-coupling":"risk","cycles-pressure":"risk","complexity-pressure":"risk","hidden-coupling-pressure":"risk",similar:"hygiene","duplicate-bodies":"hygiene","twin-drift":"hygiene","react-component-duplicates":"hygiene","react-hook-candidates":"hygiene","react-large-component-pressure":"hygiene","vue-component-duplicates":"hygiene","vue-composable-candidates":"hygiene","vue-large-view-pressure":"hygiene",extract:"hygiene",wrappers:"hygiene",passthroughs:"hygiene","stale-abstractions":"hygiene",drift:"hygiene","similar-pressure":"hygiene","duplicate-bodies-pressure":"hygiene","twin-drift-pressure":"hygiene","react-component-duplicates-pressure":"hygiene","react-hook-candidates-pressure":"hygiene","react-large-component-pressure-pressure":"hygiene","vue-component-duplicates-pressure":"hygiene","vue-composable-candidates-pressure":"hygiene","vue-large-view-pressure-pressure":"hygiene","extract-pressure":"hygiene","wrappers-pressure":"hygiene","passthroughs-pressure":"hygiene","stale-abstractions-pressure":"hygiene","drift-pressure":"hygiene"};function He(e,r){let t=e.filter(i=>i.kind===r).reduce((i,n)=>i+n.points,0);return Math.max(0,Math.min(100,100-t))}function dt(e){let r=Math.max(e.statsResult.documents,1),t=Math.max(e.statsResult.symbols,1),i=[],n=[],o=(d,w,C)=>{w>0&&i.push({axis:d,points:w,detail:C,kind:we[d]??"hygiene"})},a=(d,w,C,je,Oe,We,Ue)=>{let H=Math.max(je,1);if(C<=H)return;let D=C/H,P=Math.min(Oe,Math.ceil(Math.log2(D)*We));if(P<=0)return;let Ke=we[d]??"hygiene";n.push({axis:d,category:w,kind:Ke,count:C,threshold:p(H),ratio:p(D),extraPenalty:P}),o(d,P,`${C} ${Ue} exceed pressure threshold ${p(H)} (${p(D)}x)`)},s=e.dead.count/t;o("dead-code",Math.min(20,Math.round(s*200)),`${e.dead.count} dead symbols (${e.dead.loc} LOC deletable)`);let l=e.isolated.count/t;o("isolated",Math.min(10,Math.round(l*200)),`${e.isolated.count} isolated symbols (${e.isolated.loc} LOC deletable)`),o("cycles",Math.min(15,e.realCycleCount*5),`${e.realCycleCount} real dependency cycle(s)`);let S=e.similarCount/t*1e3;o("similar",Math.min(10,Math.round(S)),`${e.similarCount} similar function pair(s)`);let v=e.duplicateBodies.count/t*1e3;o("duplicate-bodies",Math.min(10,Math.round(v*2)),`${e.duplicateBodies.count} exact duplicate small-body group(s) (${e.duplicateBodies.loc} duplicate LOC)`);let g=e.twinDrift.count/t*1e3;o("twin-drift",Math.min(10,Math.round(g*2)),`${e.twinDrift.count} drifted twin implementation group(s) (same or near-same name, diverged or identical bodies)`);let f=e.reactComponentDuplicates.count/r*1e3;o("react-component-duplicates",Math.min(10,Math.round(f)),`${e.reactComponentDuplicates.count} duplicated React component pair(s)`);let b=h(e.reactHookCandidates),x=b/r*1e3;o("react-hook-candidates",Math.min(10,Math.round(x)),y(e.reactHookCandidates,"duplicated React behavior pair(s)"));let R=e.reactLargeComponentPressure.count/r*1e3;o("react-large-component-pressure",Math.min(5,Math.round(R/2)),`${e.reactLargeComponentPressure.count} large React component pressure file(s)`);let Fe=e.vueComponentDuplicates.count/r*1e3;o("vue-component-duplicates",Math.min(10,Math.round(Fe)),`${e.vueComponentDuplicates.count} duplicated Vue component pair(s)`);let _=h(e.vueComposableCandidates),qe=_/r*1e3;o("vue-composable-candidates",Math.min(10,Math.round(qe)),y(e.vueComposableCandidates,"duplicated Vue behavior pair(s)"));let ze=e.vueLargeViewPressure.count/r*1e3;o("vue-large-view-pressure",Math.min(5,Math.round(ze/2)),`${e.vueLargeViewPressure.count} large Vue view pressure file(s)`);let I=h(e.wrappers);o("wrappers",Math.min(3,I),y(e.wrappers,"wrapper candidate(s)"));let F=h(e.passthroughs);o("passthroughs",Math.min(3,F),y(e.passthroughs,"passthrough candidate(s)")),o("stale-abstractions",Math.min(8,e.stale.unused),`${e.stale.unused} unused stale abstraction(s); ${e.stale.singleUse} single-consumer signal(s)`);let Ge=e.drift.direct/r;if(o("drift",Math.min(5,Math.round(Ge*50)),`${e.drift.direct} direct drift finding(s); ${e.drift.signal} signal drift finding(s)`),o("complexity",Math.min(5,e.complexity.extremeCount*2),`${e.complexity.extremeCount} extreme complexity hotspot(s)`),e.gitEvidence){let d=e.gitEvidence.hiddenCoupling.scoreCount;o("hidden-coupling",Math.min(5,Math.ceil(d/10)),y({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:d},"co-changing pair(s) without a structural link"))}if(a("cycles-pressure","Circular dependencies",e.realCycleCount,3,10,3,"cycle(s)"),a("complexity-pressure","Extreme complexity",e.complexity.extremeCount,3,5,2,"extreme complexity hotspot(s)"),e.gitEvidence){let d=e.gitEvidence.hiddenCoupling.scoreCount;a("hidden-coupling-pressure","Hidden coupling",d,50,10,4,"score-weighted co-changing pair(s)")}return a("similar-pressure","Similar functions",e.similarCount,Math.max(50,t*.01),8,4,"similar function pair(s)"),a("duplicate-bodies-pressure","Duplicate function bodies",e.duplicateBodies.count,Math.max(20,t*.005),8,4,"exact duplicate small-body group(s)"),a("twin-drift-pressure","Drifted twin implementations",e.twinDrift.count,Math.max(20,t*.005),8,4,"drifted twin implementation group(s)"),a("react-component-duplicates-pressure","Duplicated React components",e.reactComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated React component pair(s)"),a("react-hook-candidates-pressure","Duplicated React hook behavior",b,Math.max(10,r*.01),8,4,"duplicated React behavior pair(s)"),a("react-large-component-pressure-pressure","Large React components",e.reactLargeComponentPressure.count,Math.max(10,r*.01),4,2,"large React component pressure file(s)"),a("vue-component-duplicates-pressure","Duplicated Vue components",e.vueComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated Vue component pair(s)"),a("vue-composable-candidates-pressure","Duplicated Vue behavior",_,Math.max(10,r*.01),8,4,"duplicated Vue behavior pair(s)"),a("vue-large-view-pressure-pressure","Large Vue views",e.vueLargeViewPressure.count,Math.max(10,r*.01),4,2,"large Vue view pressure file(s)"),a("extract-pressure","Extraction candidates",e.extractCount,Math.max(50,t*.01),4,2,"extraction candidate(s)"),a("wrappers-pressure","Wrapper functions",I,50,4,2,"wrapper candidate(s)"),a("passthroughs-pressure","Passthrough functions",F,50,4,2,"passthrough candidate(s)"),a("stale-abstractions-pressure","Single-consumer stale abstraction signals",e.stale.singleUse,Math.max(50,t*.02),4,2,"single-consumer stale abstraction signal(s)"),a("drift-pressure","Structural drift signals",e.drift.signal,Math.max(10,r*.1),4,2,"signal drift finding(s)"),{breakdown:i,pressure:n}}var m={dead:{minLoc:1,skipBarrels:!1,deadCodeOnly:!1},isolated:{minLoc:3},similar:{minSimilarity:.6,limit:50,minCallees:4},duplicateBodies:{maxLoc:15,limit:50},extract:{minLoc:15,minCallees:5,limit:50},wrappers:{maxLoc:15,limit:50},passthroughs:{maxLoc:15,limit:50},stale:{minLoc:3,limit:50},drift:{},twinDrift:{minSimilarity:.3}};import{getHeapStatistics as mt}from"v8";var pt=64*1024*1024;function $(){let e=globalThis.gc;if(!e)return;let r=mt();r.heap_size_limit-r.used_heap_size<pt||e()}var ht=[{id:"dead-visible-references",detector:"dead",claim:"The symbol has no visible repository reference after entry, framework, and rooted-symbol exclusions.",relationRequirements:[{family:"identity",subtype:"references",minimumStrength:"exact"},{family:"execution",subtype:"call",minimumStrength:"exact"}],structuralEvidence:["entry-surface exclusions","framework/source fallback references","rooted-symbol exclusions"],calibration:"mixed",providerCoverage:"partial",nonClaims:["Absence of visible references does not prove absence of reflection, generated dispatch, or external use."],recoverWith:"scip-query evidence --symbol <symbol> --edge execution --edge runtime --edge identity --direction both --depth 2 --max-edges 100"},{id:"isolated-visible-connectivity",detector:"isolated",claim:"The callable has no visible non-self caller or callee after entry, framework, and rooted-symbol exclusions.",relationRequirements:[{family:"execution",subtype:"call",minimumStrength:"exact"},{family:"identity",subtype:"references",minimumStrength:"exact"}],structuralEvidence:["entry-surface exclusions","framework contract exclusions","source fallback callers"],calibration:"mixed",providerCoverage:"partial",nonClaims:["Visible graph isolation does not establish runtime unreachability through reflection or generated dispatch."],recoverWith:"scip-query evidence --symbol <symbol> --edge execution --edge runtime --edge identity --direction both --depth 2 --max-edges 100"},{id:"wrapper-indirection-candidate",detector:"wrapper-candidates",claim:"A small callable has one visible consumer and wrapper-shaped delegation, after boundary evidence is disclosed.",relationRequirements:[{family:"execution",subtype:"call",minimumStrength:"exact"},{family:"ownership",subtype:"contains",minimumStrength:"exact"}],structuralEvidence:["callable body shape","public and runtime-boundary signals","consumer fan-in"],calibration:"candidate",providerCoverage:"partial",nonClaims:["Wrapper shape does not prove that an API, ownership, observability, or compatibility boundary is unnecessary."],recoverWith:"scip-query inspect --symbol <symbol> --view behavior"},{id:"passthrough-forwarding-candidate",detector:"passthrough-candidates",claim:"A small callable visibly forwards to one callee, with public-facade and boundary signals disclosed.",relationRequirements:[{family:"execution",subtype:"call",minimumStrength:"exact"},{family:"contract",subtype:"uses-contract-symbol",minimumStrength:"exact"}],structuralEvidence:["statement-complete forwarding shape","public facade evidence","runtime-boundary signals"],calibration:"mixed",providerCoverage:"partial",nonClaims:["Literal forwarding does not prove the callable has no contract, naming, policy, or compatibility role."],recoverWith:"scip-query inspect --symbol <symbol> --view behavior"},{id:"stale-abstraction-candidate",detector:"stale-abstractions",claim:"A type-like abstraction has zero or one visible real consumer after re-export and ownership distinctions.",relationRequirements:[{family:"identity",subtype:"references",minimumStrength:"exact"},{family:"ownership",subtype:"contains",minimumStrength:"exact"}],structuralEvidence:["definition kind","barrel-only consumer distinction","defining-file usage"],calibration:"mixed",providerCoverage:"partial",nonClaims:["Low visible consumer count does not prove a public contract or runtime-registered type is obsolete."],recoverWith:"scip-query evidence --symbol <symbol> --edge identity --edge ownership --edge contract --direction both --depth 2 --max-edges 100"},{id:"complexity-control-pressure",detector:"complexity-hotspots",claim:"A callable concentrates local branch/control pressure and graph fan-in or fan-out.",relationRequirements:[{family:"execution",subtype:"predicate-consequence",minimumStrength:"exact"},{family:"execution",subtype:"call",minimumStrength:"exact"}],structuralEvidence:["AST branch count or disclosed regex fallback","call fan-in","callee count"],calibration:"mixed",providerCoverage:"partial",nonClaims:["Structural complexity does not establish runtime frequency, latency, defect density, or a required refactor."],recoverWith:"scip-query inspect --symbol <symbol> --view behavior"},{id:"decorative-checker-terminal-behavior",detector:"decorative-checkers",claim:"A checker-shaped callable lacks a visible failure terminal directly or through one resolved delegate.",relationRequirements:[{family:"execution",subtype:"returns",minimumStrength:"exact"},{family:"execution",subtype:"throws",minimumStrength:"exact"}],structuralEvidence:["checker naming shape","direct terminal behavior","one-hop delegate body"],calibration:"mixed",providerCoverage:"partial",nonClaims:["No visible terminal does not prove the checker cannot fail through an opaque call, exception, or process exit."],recoverWith:"scip-query inspect --symbol <symbol> --view behavior"},{id:"duplicate-structural-candidate",detector:"duplicate and similarity detectors",claim:"Two source units share the detector-specific structural or token pattern.",relationRequirements:[],structuralEvidence:["normalized source/token/JSX/template similarity"],calibration:"candidate",providerCoverage:"partial",nonClaims:["Structural similarity does not establish shared domain identity or justify consolidation."],recoverWith:"scip-query inspect --symbol <symbol-a> --symbol <symbol-b> --view behavior"}];function Le(e=new Set(["indexed-graph","source-facts"])){return ht.map(r=>{let t=r.relationRequirements.map(n=>{let o=te(n.family,n.subtype);if(!o)throw new Error(`Detector ${r.id} names an unregistered relation ${n.family}/${n.subtype}`);if(!o.relation.evidenceStrengths.includes(n.minimumStrength))throw new Error(`Detector ${r.id} requires unsupported strength ${n.minimumStrength} for ${n.family}/${n.subtype}`);return o.provider}),i=[...new Set(t.flatMap(n=>n.requirements))].filter(n=>!e.has(n));return{...r,status:i.length>0?"unsupported":r.calibration,providerIds:[...new Set(t.map(n=>n.id))],unavailableRequirements:i}})}var gt=50,ft=25e3,Ct=2500,Re=2500,De=50,vt=10,bt=["overview","dead","isolated","cycles","similar","duplicate-bodies","twin-drift","react-component-duplicates","react-hook-candidates","react-large-component-pressure","vue-component-duplicates","vue-composable-candidates","vue-large-view-pressure","extract-candidates","wrapper-candidates","passthrough-candidates","stale-abstractions","drift","complexity-hotspots","git-evidence","suppressions","coverage-contracts"],Ae={overview:(e,r,t,i)=>({phase:"overview",statsResult:i,warnings:t.warnings}),dead:(e,r,t)=>({phase:"dead",dead:xt(e,r,t)}),isolated:(e,r,t)=>({phase:"isolated",isolated:wt(e,r,t)}),cycles:(e,r,t)=>({phase:"cycles",realCycleCount:Ht(e,r,t)}),similar:(e,r,t)=>({phase:"similar",similarCount:Et(e,r,t)}),"duplicate-bodies":(e,r,t)=>({phase:"duplicate-bodies",duplicateBodies:Rt(e,r,t)}),"twin-drift":(e,r,t)=>({phase:"twin-drift",twinDrift:Dt(e,r,t)}),"react-component-duplicates":(e,r,t)=>({phase:"react-component-duplicates",reactComponentDuplicates:Pt(e,r,t)}),"react-hook-candidates":(e,r,t)=>({phase:"react-hook-candidates",reactHookCandidates:kt(e,r,t)}),"react-large-component-pressure":(e,r,t)=>({phase:"react-large-component-pressure",reactLargeComponentPressure:At(e,r,t)}),"vue-component-duplicates":(e,r,t)=>({phase:"vue-component-duplicates",vueComponentDuplicates:Tt(e,r,t)}),"vue-composable-candidates":(e,r,t)=>({phase:"vue-composable-candidates",vueComposableCandidates:Mt(e,r,t)}),"vue-large-view-pressure":(e,r,t)=>({phase:"vue-large-view-pressure",vueLargeViewPressure:Bt(e,r,t)}),"extract-candidates":(e,r,t)=>({phase:"extract-candidates",extractCount:Lt(e,r,t)}),"wrapper-candidates":(e,r,t)=>({phase:"wrapper-candidates",wrappers:$t(e,r,t)}),"passthrough-candidates":(e,r,t)=>({phase:"passthrough-candidates",passthroughs:Vt(e,r,t)}),"stale-abstractions":(e,r,t)=>({phase:"stale-abstractions",stale:Nt(e,r,t)}),drift:(e,r,t)=>({phase:"drift",drift:qt(e,r,t)}),"complexity-hotspots":(e,r,t)=>({phase:"complexity-hotspots",complexity:zt(e,r,t)}),"git-evidence":(e,r,t)=>({phase:"git-evidence",gitEvidence:_t(e,t)}),suppressions:(e,r,t)=>({phase:"suppressions",suppressions:It(e,t)}),"coverage-contracts":(e,r,t)=>({phase:"coverage-contracts",coverageContracts:Ft(e,t)})};function zr(e,r={}){return Te(e,r.full!==!1,(t,i)=>{let n=St(e,r.scope,t,i);return B(n)})}function Gr(e,r,t={}){return yt(e,[r],t)[0]}function yt(e,r,t={}){return Te(e,t.full!==!1,(i,n)=>{let o={...n,releaseCachesBetweenPhases:!1};return r.map(a=>Ae[a](e,t.scope,o,i))})}function Te(e,r,t){let i=he(e),n=Gt(i,r);try{return t(i,n)}finally{M(e,{semanticProvider:!0}),$()}}function jr(e){return B(Me(e))}function Me(e){let r=u(e,"overview");return{statsResult:r.statsResult,warnings:r.warnings,detectorEvidence:Le(),dead:u(e,"dead").dead,isolated:u(e,"isolated").isolated,realCycleCount:u(e,"cycles").realCycleCount,similarCount:u(e,"similar").similarCount,duplicateBodies:u(e,"duplicate-bodies").duplicateBodies,twinDrift:u(e,"twin-drift").twinDrift,reactComponentDuplicates:u(e,"react-component-duplicates").reactComponentDuplicates,reactHookCandidates:u(e,"react-hook-candidates").reactHookCandidates,reactLargeComponentPressure:u(e,"react-large-component-pressure").reactLargeComponentPressure,vueComponentDuplicates:u(e,"vue-component-duplicates").vueComponentDuplicates,vueComposableCandidates:u(e,"vue-composable-candidates").vueComposableCandidates,vueLargeViewPressure:u(e,"vue-large-view-pressure").vueLargeViewPressure,extractCount:u(e,"extract-candidates").extractCount,wrappers:u(e,"wrapper-candidates").wrappers,passthroughs:u(e,"passthrough-candidates").passthroughs,stale:u(e,"stale-abstractions").stale,drift:u(e,"drift").drift,complexity:u(e,"complexity-hotspots").complexity,gitEvidence:Pe(e,"git-evidence")?.gitEvidence??null,suppressions:Pe(e,"suppressions")?.suppressions??null,coverageContracts:u(e,"coverage-contracts").coverageContracts}}function Pe(e,r){return e.find(t=>t.phase===r)}function u(e,r){let t=e.find(i=>i.phase===r);if(!t)throw new Error(`Missing health phase result: ${r}`);return t}function St(e,r,t,i){return Me(bt.map(n=>Ae[n](e,r,i,t)))}function xt(e,r,t){return c(e,t,"dead",()=>{let i=U(e,{scope:r,...m.dead,scanLimit:t.candidateScanLimit,semantic:t.semantic});return L(Wt(e,i.symbols))})}function wt(e,r,t){return c(e,t,"isolated",()=>{let i=ne(e,{scope:r,...m.isolated,scanLimit:t.candidateScanLimit,semantic:t.semantic});return L(Ut(e,i))})}function Ht(e,r,t){return c(e,t,"cycles",()=>J(e,{scope:r}).filter(n=>n.kind==="real").length)}function Et(e,r,t){let i=c(e,t,"similar",()=>Q(e,{scope:r,...m.similar,scanLimit:t.candidateScanLimit,semantic:t.semantic}));return Math.min(i,t.candidateResultLimit)}function Lt(e,r,t){return c(e,t,"extract-candidates",()=>ie(e,{scope:r,...m.extract,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic}).length)}function Rt(e,r,t){return c(e,t,"duplicate-bodies",()=>{let i=Z(e,{scope:r,...m.duplicateBodies,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}),n=new Set,o=0;for(let a of i)for(let s of a.functions.slice(1))n.add(s.file),o+=s.loc;return{count:i.length,loc:o,files:[...n]}})}function Dt(e,r,t){return c(e,t,"twin-drift",()=>{let i=ee(e,{scope:r,...m.twinDrift,scanLimit:t.candidateScanLimit}).filter(a=>a.relationship==="divergent"||a.relationship==="identical"),n=new Set,o=0;for(let a of i)for(let s of a.members)n.add(s.file),o+=s.loc;return{count:i.length,loc:o,files:[...n].sort()}})}function Pt(e,r,t){return c(e,t,"react-component-duplicates",()=>{let i=oe(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function kt(e,r,t){return c(e,t,"react-hook-candidates",()=>{let i=ae(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return $e(i,Yt)})}function At(e,r,t){return c(e,t,"react-large-component-pressure",()=>{let i=se(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return Kt(i)})}function Tt(e,r,t){return c(e,t,"vue-component-duplicates",()=>{let i=ce(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function Mt(e,r,t){return c(e,t,"vue-composable-candidates",()=>{let i=ue(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return $e(i,Xt)})}function Bt(e,r,t){return c(e,t,"vue-large-view-pressure",()=>{let i=le(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return L(i)})}function $t(e,r,t){return c(e,t,"wrapper-candidates",()=>{let i=de(e,{scope:r,...m.wrappers,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return Be(i,Qt)})}function Vt(e,r,t){return c(e,t,"passthrough-candidates",()=>{let i=me(e,{scope:r,...m.passthroughs,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return Be(i,Jt)})}function Nt(e,r,t){return c(e,t,"stale-abstractions",()=>{let i=pe(e,{scope:r,...m.stale,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic}),n=i.filter(o=>o.consumers===0).length;return{count:i.length,loc:i.reduce((o,a)=>o+a.loc,0),files:[...new Set(i.map(o=>o.file))],unused:n,singleUse:i.length-n}})}function _t(e,r){return c(e,r,"git-evidence",()=>{let t=K(e,{historyMode:r.gitHistoryMode}),i=t.fileChurn();if(!i)return null;let n=t.commitHistory(),o=Y(e,void 0,{limit:r.candidateResultLimit,historyMode:r.gitHistoryMode}),a={};for(let[s,l]of i)a[s]={changes:l.changes,fixChanges:l.fixChanges};return{amplification:t.changeAmplification(),hiddenCoupling:{pairCount:o.findings.length,scoreCount:N(o.findings.reduce((s,l)=>s+ke(l),0)),top:o.findings.slice(0,5).map(s=>({fileA:s.fileA,fileB:s.fileB,together:s.together,confidence:s.confidence,focusedTogether:s.focusedTogether,broadTogether:s.broadTogether,broadCommitRatio:s.broadCommitRatio,lastTogetherAt:s.lastTogetherAt,recentTogether:s.recentTogether,commitScope:s.commitScope,recency:s.recency,scoreWeight:ke(s),subjectContext:s.subjectContext}))},fileStats:a,commitsScanned:n?.commits.length??0}})}function It(e,r){return c(e,r,"suppressions",()=>{let t=ge(e);return{total:t.total,byCategory:{...t.byCategory}}})}function Ft(e,r){return c(e,r,"coverage-contracts",()=>{let t=e.config.coverageContracts??[],n=ve(e,t).filter(o=>o.status!=="ok");return{count:n.length,loc:0,files:[...new Set(n.map(o=>o.file))].sort()}})}function qt(e,r,t){return c(e,t,"drift",()=>{let i=re(e,{scope:r,...m.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY,semantic:t.semantic}),n=i.results.filter(s=>s.kind!=="pattern-deviation"),o=n.filter(s=>s.actionTier==="direct").length,a=n.length-o;return{count:n.length,unusedImports:i.unusedImports,architectureViolations:i.architectureViolations,layerViolations:i.layerViolations,direct:o,signal:a}})}function zt(e,r,t){return c(e,t,"complexity-hotspots",()=>{let i=X(e,{scope:r,minLoc:10,limit:t.complexityResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return{top:i.slice(0,5).map(n=>({symbol:n.shortName,score:n.score,file:n.file})),extremeCount:i.filter(n=>n.score>gt).length}})}function Gt(e,r){let t=e.symbols>=ft||e.documents>=Ct,i=r?Number.POSITIVE_INFINITY:De,n=r?Number.POSITIVE_INFINITY:vt;return!t||r?{candidateScanLimit:void 0,candidateResultLimit:i,complexityResultLimit:n,semantic:!0,gitHistoryMode:r?"full":"bounded",releaseCachesBetweenPhases:!0,warnings:r&&t?["Large index detected; running health without candidate scan or result caps because full mode is enabled."]:[]}:{candidateScanLimit:Re,candidateResultLimit:i,complexityResultLimit:n,semantic:!1,gitHistoryMode:"bounded",releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${Re} symbols and reported their top ${De} findings. Enable full mode for unbounded candidate counts.`]}}function jt(e,r){r.releaseCachesBetweenPhases&&(M(e),$())}function c(e,r,t,i){Ot(t);try{return i()}finally{jt(e,r)}}function Ot(e){process.env.SCIP_QUERY_HEALTH_TRACE==="1"&&console.error(`[health] ${e}`)}function Wt(e,r){return r.filter(t=>!A(e,t.relativePath)&&!T(e,t.symbol,t.relativePath)&&t.kind==="dead-code")}function Ut(e,r){return r.filter(t=>!A(e,t.relativePath)&&!T(e,t.symbol,t.relativePath))}function L(e){let r=new Set;for(let t of e){let i=t.relativePath??t.file;i&&r.add(i)}return{count:e.length,loc:e.reduce((t,i)=>t+i.loc,0),files:[...r]}}function Be(e,r){return{...L(e),scoreCount:N(e.reduce((i,n)=>i+r(n),0))}}function Kt(e){let r=new Map;for(let t of e)r.set(t.file,Math.max(r.get(t.file)??0,t.loc));return{count:r.size,loc:[...r.values()].reduce((t,i)=>t+i,0),files:[...r.keys()]}}function V(e){let r=new Map;for(let t of e)r.set(t.fileA,Math.max(r.get(t.fileA)??0,t.locA)),r.set(t.fileB,Math.max(r.get(t.fileB)??0,t.locB));return{count:e.length,loc:[...r.values()].reduce((t,i)=>t+i,0),files:[...r.keys()]}}function $e(e,r){return{...V(e),scoreCount:N(e.reduce((i,n)=>i+r(n),0))}}function Yt(e){let r=e.sharedHooks.length>0,t=Ve({namedState:e.sharedState,requests:e.sharedRequests,lifecycle:e.sharedEffects,functions:e.sharedHandlers});return r&&t<=2?0:r?.5:Ne(e.sharedState,e.sharedHandlers,e.sharedHandlerVerbs)?.25:t>=2?1:.5}function Xt(e){let r=e.sharedComposables.length+e.sharedStores.length>0,t=Ve({namedState:e.sharedBindings,requests:e.sharedRequests,lifecycle:e.sharedLifecycle,functions:e.sharedFunctions});return r&&t<=2?0:r?.5:Ne(e.sharedBindings,e.sharedFunctions,e.sharedFunctionVerbs)?.25:t>=2?1:.5}function Ve(e){return e.requests.length*2+e.lifecycle.length+e.namedState.filter(r=>!Ie.has(_e(r))).length+Math.min(e.functions.length,3)}function Ne(e,r,t){let i=[...e,...r,...t].map(_e);return i.length>0&&i.every(n=>Ie.has(n))}function _e(e){return e.replace(/^handle/,"").replace(/^is/,"").replace(/^has/,"").toLowerCase()}function Qt(e){return e.actionTier==="signal"?.25:1}function Jt(e){return e.actionTier==="signal"?.25:1}function ke(e){return e.commitScope==="broad-sweep"?e.recency==="recent"?.25:0:e.commitScope==="mixed"?e.recency==="recent"?.5:.25:e.recency==="recent"?1:.5}function N(e){return Math.round(e*100)/100}var Ie=new Set(["add","apply","cancel","change","clear","close","create","delete","draft","edit","error","filter","form","load","loading","name","open","refresh","remove","reset","save","saving","search","select","selected","submit","toggle","update","value"]);export{m as a,bt as b,zr as c,Gr as d,yt as e,jr as f};
2
- //# sourceMappingURL=chunk-VU6LIWHT.js.map
@@ -1,2 +0,0 @@
1
- import{a as f,c as g}from"./chunk-F4FNK44D.js";import{h as d,ia as p,ja as x}from"./chunk-AK3PYTIK.js";function U(n){if(!n)return;let e=Number(n);return Number.isInteger(e)&&e>0?e:void 0}import{execFileSync as b}from"child_process";import{createHash as v}from"crypto";import{existsSync as s,statSync as j}from"fs";import{createRequire as B}from"module";import{platform as N}from"os";import{dirname as m,join as a}from"path";var S=B(import.meta.url),G={language:"rust",indexerBinary:"rust-analyzer",installUrl:"https://github.com/rust-lang/rust-analyzer"};function l(n){return[n.indexerBinary,...n.binaryAliases??[]]}function k(n){let e=l(n);return e.length===1?e[0]:e.join(" or ")}function u(n){for(let e of l(n)){let r=g(e);if(r)return r}return O(n)}function W(n){return u(n)!==null||L(n)}function L(n){return I(n)!==null}function O(n){let e=I(n);if(!e)return null;let t=JSON.parse(d(e,"indexer package manifest")).bin;if(!t)return null;if(typeof t=="string")return a(m(e),t);for(let o of l(n)){let i=t[o];if(i)return a(m(e),i)}return null}function I(n){if(!n.bundledNpmPackage)return null;try{return S.resolve(`${n.bundledNpmPackage}/package.json`)}catch{return null}}function E(n,e){for(let r of n.projectLocalBinaries??[]){let t=a(e,r);if(s(t))return t}return null}function w(n,e){for(let r of n.projectLocalBinaries??[]){let t=a(e,r);if(s(t))return T(e,r,t)}return null}function Y(n,e){let r=D(n,e);if(!r||r.canonicalPath!==e.canonicalPath||r.sha256!==e.sha256||r.size!==e.size||r.mtimeMs!==e.mtimeMs||r.device!==e.device||r.inode!==e.inode||r.executable!==e.executable)throw new Error(`refusing changed project-local indexer ${e.relativePath}; review the current file and rerun with --trust-project-tools`)}function D(n,e){try{return T(n,e.relativePath,e.configuredPath)}catch{return null}}function T(n,e,r){let t={maxBytes:268435456,inputKind:"project-local indexer"},o=p(n,e,t),i=x(n,e,t),h=j(o.absolutePath);return{configuredPath:r,canonicalPath:o.absolutePath,relativePath:e,sha256:v("sha256").update(i).digest("hex"),size:o.size,mtimeMs:o.mtimeMs,device:o.device,inode:o.inode,executable:(h.mode&73)!==0}}function R(n,e,r={}){return(r.trustProjectTools?w(n,e)?.canonicalPath:null)??u(n)}function Z(n,e=process.env,r=n.indexerBinary){if(n.indexerBinary!=="scip-dotnet"||c(r,e))return e;let t=P(r,e);return t?{...e,DOTNET_ROOT:t}:e}function Q(n,e,r={}){let t=k(n),o=e?R(n,e,r):u(n);if(!o)return{language:n.language,binaryLabel:t,installed:!1,runnable:!1,resolvedBinary:null,installUrl:n.installUrl,...e&&E(n,e)?{note:"project-local indexer available only with --trust-project-tools"}:{}};if(n.indexerBinary!=="scip-dotnet")return{language:n.language,binaryLabel:t,installed:!0,runnable:!0,resolvedBinary:o};let i=J(o);return{language:n.language,binaryLabel:t,installed:!0,runnable:i.runnable,resolvedBinary:o,installUrl:n.installUrl,note:i.note}}function J(n){if(c(n,process.env))return{runnable:!0};let e=P(n,process.env);if(e)return{runnable:!0,note:`using .NET 9 runtime from ${e}`};let r=y(process.env);return{runnable:!1,note:r.length>0?`.NET 9 runtime still unavailable after checking ${r.join(", ")}`:"binary is present, but scip-dotnet still needs a .NET 9 runtime"}}function P(n,e){for(let r of y(e))if(c(n,{...e,DOTNET_ROOT:r}))return r;return null}function y(n){let e=[],r=n.DOTNET_ROOT;if(r&&s(r)&&e.push(r),N()==="darwin"&&f("brew"))try{let t=b("brew",["--prefix","dotnet@9"],{stdio:"pipe",env:n,timeout:1e4,killSignal:"SIGKILL"}).toString().trim(),o=a(t,"libexec");s(o)&&!e.includes(o)&&e.push(o)}catch{}return e}function c(n,e){try{return b(n,["--version"],{stdio:"pipe",env:e,timeout:1e4,killSignal:"SIGKILL"}),!0}catch{return!1}}export{G as a,k as b,u as c,W as d,E as e,w as f,Y as g,Z as h,Q as i,U as j};
2
- //# sourceMappingURL=chunk-VUSKPCUB.js.map
@@ -1,2 +0,0 @@
1
- import{b as C}from"./chunk-DKM723YF.js";import{d as Se,f as Ct}from"./chunk-K3XFWJI2.js";import{b as xe}from"./chunk-57N6LN2A.js";import{a as we,b as ve,c as V,d as D}from"./chunk-JT6XX7QY.js";import{e as X}from"./chunk-HGFDYOVB.js";import{a as Dt,b as Gt,c as ye,d as be}from"./chunk-SB25YMEQ.js";import{B as _e,F as je,G as Ot,I as Mt,J as Ft,K as Ne,L as qe,O as $e,Q as _t,R as jt,T as Nt,a as v,b as J,c as S,f as b,g as R,h as I,k as Tt,l as H,m as At,o as Lt,p as kt,q as he,ua as Be,x as Ie,y as O,z as Z}from"./chunk-AK3PYTIK.js";import{createHash as sn,randomUUID as cn}from"crypto";import{existsSync as Y,mkdirSync as dn,readdirSync as ln,rmSync as Bt,statSync as Wt}from"fs";import{basename as un,dirname as Re,join as x}from"path";import{join as tn}from"path";function en(e,t){return e.reason instanceof Error?e.reason:new Error(t)}function xo(e,t){if(e?.aborted)throw en(e,t)}var rn=e=>{if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e.pid;return typeof t=="number"&&Number.isSafeInteger(t)&&t>0?{pid:t}:null};function qt(e,t={}){return M(tn(e,"gc.lock"),t)}function M(e,t={}){let r=t.waitMs??0,n=t.pollMs??10,i=t.now??be,o=i()+r;do{let a=nn(e,t.directoryDurability);if(a)return on(a);let s=o-i();if(s<=0)return null;an(Math.min(n,s))}while(i()<=o);return null}function nn(e,t){let r=xe(e,{kind:"generic",parseLegacy:rn,...t?{directoryDurability:t}:{}});return r.kind==="acquired"?r.lock:null}function on(e){return{release:()=>{e.release()}}}function an(e){let t=new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));Atomics.wait(t,0,0,e)}var N=1,He=1,te=".scipquery-generations",Ee="manifest.json",zt="readers",fn="gc.lock",pn=128,ee=new Map,Ut={pid:process.pid,now:()=>new Date,randomToken:()=>cn(),isProcessAlive:we,readProcessIdentity:ye};function h(e){return x(Re(e),te)}function Ve(e){return x(h(e),fn)}function jo(e,t=Ut){let r=M(Ve(e.dbPath),{waitMs:5e3,directoryDurability:"recoverable"});if(!r)throw new Error("SQLite generation retention is busy; retry opening the index.");let n;try{let i=yn(e);if(i.source!=="immutable")return{generation:i,release(){}};let o=t.randomToken();if(!/^[A-Za-z0-9._-]+$/.test(o))throw new Error("SQLite generation reader token is unsafe.");let a=x(h(e.dbPath),zt);dn(a,{recursive:!0}),n=x(a,`${t.pid}-${o}.json`);let s=t.readProcessIdentity(t.pid);V(n,{version:1,token:o,generationIdentity:i.identity,pid:t.pid,...s?{processIdentity:s}:{},acquiredAt:t.now().toISOString()},{spacing:2,trailingNewline:!0});let c=!1;return{generation:i,release(){c||!n||(c=!0,Bt(n,{force:!0}))}}}finally{r.release()}}function Ht(e,t,r=Ut,n={}){let i=x(h(e),zt);if(!Y(i))return{protectedGenerations:new Set,activeLeases:0,staleLeasesRemoved:0,malformedLeases:0};let o=new Set,a=0,s=0,c=0;for(let d of ln(i,{withFileTypes:!0})){if(!d.isFile()||!d.name.endsWith(".json"))continue;let l=x(i,d.name),f;try{f=mn(JSON.parse(I(l,"SQLite generation reader lease")))}catch{f=null}if(!f){c+=1;for(let m of t)o.add(m);continue}if(!gn(f,r)){n.removeStale!==!1&&(Bt(l,{force:!0}),s+=1);continue}a+=1,o.add(f.generationIdentity)}return{protectedGenerations:o,activeLeases:a,staleLeasesRemoved:s,malformedLeases:c}}function mn(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,r=t.processIdentity===void 0?null:Dt(t.processIdentity);return t.version!==1||typeof t.token!="string"||t.token.trim()===""||typeof t.generationIdentity!="string"||!/^[a-f0-9]{64}$/.test(t.generationIdentity)||typeof t.pid!="number"||!Number.isSafeInteger(t.pid)||t.pid<=0||typeof t.acquiredAt!="string"||!Number.isFinite(Date.parse(t.acquiredAt))||t.processIdentity!==void 0&&(!r||r.pid!==t.pid)?null:{version:1,token:t.token,generationIdentity:t.generationIdentity,pid:t.pid,...r?{processIdentity:r}:{},acquiredAt:t.acquiredAt}}function gn(e,t){if(!t.isProcessAlive(e.pid))return!1;if(!e.processIdentity)return!0;let r=t.readProcessIdentity(e.pid);return r===null||Gt(e.processIdentity,r)}function q(e){try{let t=JSON.parse(I(x(h(e),"state.json"),"SQLite generation state"));return In(t)?t:null}catch{return null}}function re(e,t){return ne(h(e),t)}function ne(e,t){try{let r=JSON.parse(I(x(e,t,Ee),"SQLite generation manifest"));return bn(r,t)?r:null}catch{return null}}function yn(e){let t=q(e.dbPath);if(t){let r=hn(e,t.currentGeneration);if(r)return r;if(t.artifactSet==="immutable-v1")throw new Error(`Published SQLite generation ${t.currentGeneration} is missing or invalid.`)}if(Y(x(Re(e.dbPath),"index.lock")))throw new Error("Legacy SQLite publication is in progress; retry after the reindex lock is released.");return Sn(e,t?.currentGeneration)}function No(e){let t=q(e);if(t)return t.currentGeneration;try{let r=x(Re(e),"meta.json"),n=Y(r)?I(r,"reindex metadata"):void 0;return Vt(e,n)}catch{return null}}function F(e){return Ct(Se(e))??e}function hn(e,t){try{let r=x(h(e.dbPath),t),n=re(e.dbPath,t);if(!n)return null;let i=We(r,n.database),o=n.index?We(r,n.index):void 0,a=n.metadata?We(r,n.metadata):void 0;return!ze(i,n.database)||n.index&&(!o||!ze(o,n.index))||n.metadata&&(!a||!ze(a,n.metadata))?null:{identity:t,databasePath:i,...o?{indexPath:o}:{},...a?{metadataPath:a,metadataRaw:I(a,"reindex metadata")}:{},source:"immutable"}}catch{return null}}function Sn(e,t){let r=$(e.dbPath),n=x(Re(e.dbPath),"meta.json"),i=Y(n)?I(n,"reindex metadata"):void 0,o=Y(e.indexPath)?e.indexPath:void 0;return{identity:t??Vt(e.dbPath,i),databasePath:e.dbPath,...o?{indexPath:o}:{},...i===void 0?{}:{metadataPath:n,metadataRaw:i},source:"legacy",databaseFileIdentity:r}}function Vt(e,t){let r=sn("sha256").update("sqlite-generation-legacy-v1\0");return t!==void 0&&r.update(F(t)),r.update(`\0${$(e)}`),r.digest("hex")}function $(e){let t=Wt(e);return`${t.dev}:${t.ino}:${t.size}:${t.mtimeMs}`}function We(e,t){if(un(t.file)!==t.file||t.file==="."||t.file==="..")throw new Error("SQLite generation manifest contains an unsafe artifact path");return x(e,t.file)}function ze(e,t){if(!Y(e))return!1;let r=$t(e);if(!r||r.size!==t.size)return!1;let n=`${e}\0${t.sha256}\0${r.identity}`;if(ee.has(n))return!0;let i=H(e,{inputKind:"immutable SQLite generation artifact",maxBytes:t.size}),o=$t(e);if(!o||o.identity!==r.identity||i!==t.sha256)return!1;for(ee.set(n,!0);ee.size>pn;){let a=ee.keys().next().value;if(a===void 0)break;ee.delete(a)}return!0}function $t(e){let t=Wt(e,{bigint:!0});return t.isFile()?{identity:`${t.dev}:${t.ino}:${t.size}:${t.mtimeNs}:${t.ctimeNs}`,size:Number(t.size)}:null}function bn(e,t){return e.version===He&&e.identity===t&&Ue(e.database)&&(e.index===void 0||Ue(e.index))&&(e.metadata===void 0||Ue(e.metadata))}function Ue(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.file=="string"&&!!t.file&&Number.isSafeInteger(t.size)&&(t.size??-1)>=0&&typeof t.sha256=="string"&&/^[a-f0-9]{64}$/.test(t.sha256)}function In(e){return e.version===N&&typeof e.currentGeneration=="string"&&!!e.currentGeneration&&typeof e.publishedAt=="string"&&Number.isFinite(Date.parse(e.publishedAt))&&(e.artifactSet===void 0||e.artifactSet==="immutable-v1")&&wn(e.stableMirrors)&&xn(e.previousGeneration)&&vn(e.publication)}function wn(e){if(e===void 0)return!0;if(!e||typeof e!="object")return!1;let t=e;return typeof t.databaseFileIdentity=="string"&&!!t.databaseFileIdentity&&(t.indexFileIdentity===void 0||typeof t.indexFileIdentity=="string"&&!!t.indexFileIdentity)}function xn(e){if(e===void 0)return!0;if(!e||typeof e!="object")return!1;let t=e;return typeof t.generationIdentity=="string"&&!!t.generationIdentity&&typeof t.databasePath=="string"&&!!t.databasePath&&(t.metadataPath===void 0||typeof t.metadataPath=="string"&&!!t.metadataPath)}function vn(e){if(e===void 0)return!0;if(!e||typeof e!="object")return!1;let t=e,r=[t.converterDurationMs,t.affectedDocumentCount,t.changedDocumentCount,t.producerDurationMs,t.materializationDurationMs,t.patchDurationMs].filter(n=>n!==void 0);return(t.mode==="incremental"||t.mode==="full")&&t.validation==="passed"&&t.converterDurationMs!==void 0&&r.every(n=>typeof n=="number"&&Number.isFinite(n)&&n>=0)&&(t.scipCompanion===void 0||t.scipCompanion==="current"||t.scipCompanion==="deferred")&&(t.typescriptOverlayGeneration===void 0||typeof t.typescriptOverlayGeneration=="string"&&!!t.typescriptOverlayGeneration)&&(t.scipCompanion!=="deferred"||!!t.typescriptOverlayGeneration)&&(t.fallbackReason===void 0||typeof t.fallbackReason=="string")}import{execFileSync as Rn}from"child_process";import{existsSync as En,readdirSync as Yt}from"fs";import{extname as Qt,join as Kt}from"path";var Jt=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),Pn=[{language:"typescript",files:["tsconfig.json","tsconfig.base.json"],extensions:[".ts",".tsx",".mts",".cts"]},{language:"rust",files:["Cargo.toml"],extensions:[".rs"]},{language:"go",files:["go.mod"],extensions:[".go"]},{language:"java",files:["pom.xml","build.gradle","build.gradle.kts"],extensions:[".java"]},{language:"kotlin",files:["build.gradle.kts"],extensions:[".kt",".kts"]},{language:"scala",files:["build.sbt"],extensions:[".scala"]},{language:"clojure",files:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"],extensions:[".clj",".cljs",".cljc"]},{language:"python",files:["pyproject.toml","setup.py","setup.cfg","Pipfile"],extensions:[".py",".pyi"]},{language:"ruby",files:["Gemfile"],extensions:[".rb"]},{language:"cpp",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"]},{language:"c",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".c",".h"]},{language:"csharp",globs:["*.csproj","*.sln"],extensions:[".cs"]},{language:"vb",globs:["*.vbproj"],extensions:[".vb"]},{language:"dart",files:["pubspec.yaml"],extensions:[".dart"]},{language:"php",files:["composer.json"],extensions:[".php"]},{language:"javascript",files:["package.json"],extensions:[".js",".jsx",".mjs",".cjs"]}];function Uo(e){let t=[],r=Tn(e),n=Ln(e);for(let i of Pn){if(Dn(e,i.files)){t.push(i.language);continue}if(Gn(r,i.globs)){t.push(i.language);continue}Cn(n,i.extensions)&&t.push(i.language)}if(t.includes("typescript")&&Ye(t,"javascript"),t.includes("cpp")&&t.includes("c")){let i=n.has(".c"),o=[".cc",".cpp",".cxx"].some(a=>n.has(a));i&&!o?Ye(t,"cpp"):i||Ye(t,"c")}return t}function Tn(e){try{return Yt(e)}catch{return[]}}function Dn(e,t){return t?.length?t.some(r=>En(Kt(e,r))):!1}function Gn(e,t){return t?.length?e.some(r=>t.some(n=>An(r,n))):!1}function An(e,t){if(t==="*")return!0;if(!t.includes("*"))return e===t;let[r,n]=t.split("*");return e.startsWith(r??"")&&e.endsWith(n??"")}function Ln(e){let t=kn(e);if(t)return t;let r=new Set,n=[e];for(;n.length>0;){let i=n.pop();if(!i)continue;let o;try{o=Yt(i,{withFileTypes:!0})}catch{continue}for(let a of o){if(a.name.startsWith(".")&&!a.name.endsWith("proj")&&!a.name.endsWith("sln")&&a.isDirectory())continue;let s=Kt(i,a.name);if(a.isDirectory()){Jt.has(a.name)||n.push(s);continue}let c=Qt(a.name).toLowerCase();c&&r.add(c)}}return r}function kn(e){try{let t=_t(e,26214400,()=>Rn("git",["-C",e,"ls-files","-co","-v","-z","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:52428800,stdio:["ignore","pipe","ignore"],timeout:3e4,killSignal:"SIGKILL"})),r=new Set;for(let n of jt(t)){if(n.split("/").some(o=>Jt.has(o)))continue;let i=Qt(n).toLowerCase();i&&r.add(i)}return r}catch{return null}}function Cn(e,t){return t?.length?t.some(r=>e.has(r)):!1}function Ye(e,t){let r=e.indexOf(t);r!==-1&&e.splice(r,1)}import{closeSync as Zt,openSync as Nn,renameSync as qn,rmSync as $n,writeSync as Bn}from"fs";import{create as er,fromBinary as Wn,toBinary as zn}from"@bufbuild/protobuf";import{DocumentSchema as Ke,IndexSchema as Un,SymbolRole as Xe}from"@c4312/scip";var E=class extends Error{},On=0,Mn=1,Xt=2,Fn=5;function Qe(e,t,r){let n=0,i=0;for(;t<r;){let o=e[t];if(t+=1,i<53)n+=(o&127)*2**i;else if((o&127)!==0)throw new E("varint exceeds the safe integer range");if((o&128)===0)return{value:n,pos:t};if(i+=7,i>63)throw new E("varint is longer than 64 bits")}throw new E("varint runs past the end of the buffer")}function*P(e,t=0,r=e.length){let n=t;for(;n<r;){let i=n,o=Qe(e,n,r);n=o.pos;let a=Math.floor(o.value/8),s=o.value%8;if(a===0)throw new E("field number 0 is invalid");let c=n,d=0;if(s===On){let l=Qe(e,n,r);d=l.value,n=l.pos}else if(s===Xt){let l=Qe(e,n,r);if(c=l.pos,n=l.pos+l.value,n>r)throw new E("length-delimited field runs past the end of the buffer")}else if(s===Mn)n+=8;else if(s===Fn)n+=4;else throw new E(`unsupported wire type ${s}`);if(n>r)throw new E("field value runs past the end of the buffer");yield{fieldNumber:a,wireType:s,fieldStart:i,valueStart:c,valueEnd:n,fieldEnd:n,varint:d}}}function ie(e){if(!Number.isSafeInteger(e)||e<0)throw new E(`cannot encode varint ${e}`);let t=[],r=e;do{let n=r%128;r=Math.floor(r/128),r>0&&(n|=128),t.push(n)}while(r>0);return Uint8Array.from(t)}function Pe(e){return ie(e*8+Xt)}var _n=1,jn=3;function oe(e){let t=new TextDecoder,r;for(let n of P(e))if(!(n.fieldNumber!==_n||n.wireType!==2))for(let i of P(e,n.valueStart,n.valueEnd)){if(i.fieldNumber!==jn||i.wireType!==2)continue;let o=t.decode(e.subarray(i.valueStart,i.valueEnd));o&&(r=o)}return r}var Je=2,Hn=3,Vn=1,Yn=2,Qn=3,Kn=1,Jn=2,Xn=3;function ea(e){let t;try{t=b(e,{inputKind:"SCIP sanitization input",maxBytes:S})}catch{return{removedDefinitionOccurrences:0,touchedDocuments:0}}try{return Zn(t,e)}catch(r){if(r instanceof E)return{removedDefinitionOccurrences:0,touchedDocuments:0};throw r}}function Zn(e,t){let r=new TextDecoder,n=new Set;for(let a of P(e))if(a.wireType===2)if(a.fieldNumber===Je)for(let s of P(e,a.valueStart,a.valueEnd))s.wireType===2&&(s.fieldNumber===Vn?je(r.decode(e.subarray(s.valueStart,s.valueEnd))):s.fieldNumber===Qn&&tr(e,s,r,n));else a.fieldNumber===Hn&&tr(e,a,r,n);let i=0,o=[];for(let a of P(e)){if(a.wireType!==2||a.fieldNumber!==Je)continue;let s=ei(e,a,r,n);s>0&&(i+=s,o.push(a))}return i===0?{removedDefinitionOccurrences:0,touchedDocuments:0}:(ti(e,t,o,n),{removedDefinitionOccurrences:i,touchedDocuments:o.length})}function tr(e,t,r,n){for(let i of P(e,t.valueStart,t.valueEnd)){if(i.wireType!==2||i.fieldNumber!==Kn)continue;let o=r.decode(e.subarray(i.valueStart,i.valueEnd));o&&n.add(o)}}function ei(e,t,r,n){let i=0;for(let o of P(e,t.valueStart,t.valueEnd)){if(o.wireType!==2||o.fieldNumber!==Yn)continue;let a="",s=0;for(let c of P(e,o.valueStart,o.valueEnd))c.fieldNumber===Jn&&c.wireType===2?a=r.decode(e.subarray(c.valueStart,c.valueEnd)):c.fieldNumber===Xn&&c.wireType===0&&(s=c.varint);(s&Xe.Definition)!==0&&!n.has(a)&&(i+=1)}return i}function ti(e,t,r,n){let i=`${t}.sanitize-tmp`,o=Nn(i,"w",384);try{let a=0;for(let s of r){ae(o,e.subarray(a,s.fieldStart));let c=Wn(Ke,e.subarray(s.valueStart,s.valueEnd));c.occurrences=c.occurrences.filter(l=>(l.symbolRoles&Xe.Definition)===0||n.has(l.symbol));let d=zn(Ke,c);ae(o,Pe(Je)),ae(o,ie(d.byteLength)),ae(o,d),a=s.fieldEnd}ae(o,e.subarray(a))}catch(a){throw Zt(o),$n(i,{force:!0}),a}Zt(o),qn(i,t)}function ae(e,t){let r=0;for(;r<t.byteLength;)r+=Bn(e,t,r,t.byteLength-r)}function rr(e){let t=new Set;for(let o of e.documents){je(o.relativePath);for(let a of o.symbols)a.symbol&&t.add(a.symbol)}for(let o of e.externalSymbols)o.symbol&&t.add(o.symbol);let r=0,n=0,i=[];for(let o of e.documents){let a=o.occurrences.filter(s=>(s.symbolRoles&Xe.Definition)===0||t.has(s.symbol)?!0:(r+=1,!1));if(a.length===o.occurrences.length){i.push(o);continue}n+=1,i.push(er(Ke,{language:o.language,relativePath:o.relativePath,occurrences:a,symbols:o.symbols,text:o.text,positionEncoding:o.positionEncoding}))}return{index:r===0?e:er(Un,{metadata:e.metadata,documents:i,externalSymbols:e.externalSymbols}),removedDefinitionOccurrences:r,touchedDocuments:n}}import{closeSync as ce,openSync as Ze,readSync as ri,renameSync as ni,rmSync as or,statSync as ii,writeFileSync as ar,writeSync as sr}from"fs";import{create as et,fromBinary as oi,toBinary as ai}from"@bufbuild/protobuf";import{deserializeSCIP as cr,serializeSCIP as dr,DocumentSchema as si,IndexSchema as ci,MetadataSchema as nr,SymbolInformationSchema as di}from"@c4312/scip";function lr(e){if(e.length===0)throw new Error("Cannot merge zero SCIP indexes");if(e.length===1)return e[0];let t=li(e),r=ui(e.flatMap(i=>i.documents??[])),n=fr(e.flatMap(i=>i.externalSymbols??[]));return et(ci,{metadata:t,documents:r,externalSymbols:n})}function da(e,t){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let r=e.map(i=>cr(b(i,{inputKind:"SCIP merge input",maxBytes:S}))),n=lr(r);return ar(t,dr(n)),{documentCount:n.documents.length,externalSymbolCount:n.externalSymbols.length,inputCount:e.length}}function la(e,t){if(e.length===0)throw new Error("Cannot concatenate zero SCIP files");let r=0;for(let o of e)if(r+=ii(o).size,r>S)throw new Error(`Concatenated SCIP output exceeds the ${S}-byte artifact limit. Reduce the indexed project scope or use compatible cached generations.`);let n=Buffer.allocUnsafe(1024*1024),i=Ze(t,"w",384);try{for(let o of e){let a=Ze(o,"r");try{let s=0;for(;(s=ri(a,n,0,n.byteLength,null))>0;){let c=0;for(;c<s;)c+=sr(i,n,c,s-c)}}finally{ce(a)}}}catch(o){throw ce(i),or(t,{force:!0}),o}ce(i)}function ua(e,t){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let r=X("reindex.publish.scip-output.deserialize",()=>e.map(o=>cr(b(o,{inputKind:"SCIP merge input",maxBytes:S})))),n=X("reindex.publish.scip-output.merge",()=>lr(r)),i=X("reindex.publish.scip-output.sanitize",()=>rr(n));return X("reindex.publish.scip-output.serialize",()=>ar(t,dr(i.index))),{documentCount:i.index.documents.length,externalSymbolCount:i.index.externalSymbols.length,inputCount:e.length,removedDefinitionOccurrences:i.removedDefinitionOccurrences,touchedDocuments:i.touchedDocuments}}var ir=1;function ur(e,t,r){let n=b(e,{inputKind:"SCIP normalization input",maxBytes:S}),i=oe(n),o=[];for(let c of P(n))c.fieldNumber===ir&&c.wireType===2&&o.push(c);if(o.length===0)throw new Error("Cannot rebase a SCIP index without metadata");if((i??"")!==t)throw new Error(`Cannot rebase SCIP project root: expected ${t}, got ${i??""}`);let a=`${e}.rebase-tmp`,s=Ze(a,"w",384);try{let c=0;for(let d of o){se(s,n.subarray(c,d.fieldStart));let l=oi(nr,n.subarray(d.valueStart,d.valueEnd));l.projectRoot=r;let f=ai(nr,l);se(s,Pe(ir)),se(s,ie(f.byteLength)),se(s,f),c=d.fieldEnd}se(s,n.subarray(c))}catch(c){throw ce(s),or(a,{force:!0}),c}ce(s),ni(a,e)}function se(e,t){let r=0;for(;r<t.byteLength;)r+=sr(e,t,r,t.byteLength-r)}function li(e){let t=e[0]?.metadata;if(!t)return;let r=t.projectRoot;for(let n of e.slice(1)){let i=n.metadata?.projectRoot;if(r&&i&&i!==r)throw new Error(`Cannot merge SCIP indexes with different project roots: ${r} vs ${i}`)}return t}function ui(e){let t=new Map;for(let r of e){let n=t.get(r.relativePath);if(!n){t.set(r.relativePath,r);continue}t.set(r.relativePath,et(si,{language:n.language||r.language,relativePath:n.relativePath||r.relativePath,occurrences:fi([...n.occurrences,...r.occurrences]),symbols:fr([...n.symbols,...r.symbols]),text:mi(n.text,r.text),positionEncoding:n.positionEncoding||r.positionEncoding}))}return[...t.values()]}function fi(e){let t=new Set,r=[];for(let n of e){let i=JSON.stringify(n);t.has(i)||(t.add(i),r.push(n))}return r}function fr(e){let t=new Map;for(let r of e){let n=t.get(r.symbol);if(!n){t.set(r.symbol,r);continue}t.set(r.symbol,et(di,{symbol:n.symbol,documentation:gi([...n.documentation,...r.documentation]),relationships:pi([...n.relationships,...r.relationships]),kind:n.kind||r.kind,displayName:n.displayName||r.displayName,enclosingSymbol:n.enclosingSymbol||r.enclosingSymbol,signatureDocumentation:n.signatureDocumentation??r.signatureDocumentation}))}return[...t.values()]}function pi(e){let t=new Set,r=[];for(let n of e){let i=[n.symbol,n.isReference?"1":"0",n.isImplementation?"1":"0",n.isTypeDefinition?"1":"0",n.isDefinition?"1":"0"].join("|");t.has(i)||(t.add(i),r.push(n))}return r}function mi(e,t){return e?t?e.length>=t.length?e:t:e:t}function gi(e){return[...new Set(e)]}import yi from"better-sqlite3";var hi=25,Si=new Set(["typescript","javascript"]);function ya(e,t,r){let n=null;try{n=new yi(e,{readonly:!0,fileMustExist:!0});let i=new Set(n.prepare("SELECT relative_path FROM documents").pluck().all().map(_e)),o=bi(t,r),a=new Set([...o.values()].flatMap(l=>[...l])),s=[...a].filter(l=>!i.has(l)).sort();if(s.length===0)return{state:"complete",expectedDocumentCount:a.size,actualDocumentCount:i.size};let c=new Set(s),d=r.filter(l=>[...o.get(l)??[]].some(f=>c.has(f)));return{state:"incomplete",expectedDocumentCount:a.size,actualDocumentCount:i.size,missingDocumentCount:s.length,missingPaths:s.slice(0,hi),affectedLanguages:d}}catch(i){return{state:"unavailable",reason:i instanceof Error?i.message:String(i)}}finally{n?.close()}}function bi(e,t){let r=new Map,n=t.filter(i=>Si.has(i));for(let i of n)r.set(i,new Set);for(let i of e.files){let o=_e(i.path);for(let a of n)At(o,[a])==="source"&&r.get(a).add(o)}return r}import{existsSync as mr,readdirSync as gr,rmSync as yr}from"fs";import{join as Q}from"path";import{create as Sr,fromBinary as br,toBinary as Pa}from"@bufbuild/protobuf";import{deserializeSCIP as tt,DocumentSchema as Ir,IndexSchema as wr,serializeSCIP as xr}from"@c4312/scip";import{existsSync as Ii,mkdirSync as wi,renameSync as xi,writeFileSync as vi}from"fs";import{join as Ri}from"path";function pr(e){wi(e.blobDir,{recursive:!0});let t=Ri(e.blobDir,`${e.blobHash}.scipdoc`);if(Ii(t)){let n=b(t,{maxBytes:J,inputKind:e.inputKind});if(n.byteLength!==e.bytes.byteLength||C(n)!==e.blobHash)throw new Error(`existing ${e.inputKind} is corrupt: ${e.relativePath}`);return}let r=`${t}.${process.pid}.${Date.now()}.tmp`;vi(r,e.bytes),xi(r,t)}var rt=1,de="typescript-scip-fragments";function Aa(e){let t=new Set,r=[];for(let o of e){let a=Te(o.relativePath);if(t.has(a))throw new Error(`duplicate TypeScript fragment replacement: ${a}`);if(t.add(a),o.bytes===null)throw new Error(`affected TypeScript mini index cannot contain a deleted document: ${a}`);let s=br(Ir,o.bytes);if(s.relativePath!==a)throw new Error(`TypeScript fragment path mismatch: expected ${a}, got ${s.relativePath}`);r.push(s)}let n=xr(Sr(wr,{documents:r,externalSymbols:[]})),i=tt(n);if(i.documents.length!==r.length||i.externalSymbols.length!==0)throw new Error("affected TypeScript SCIP index failed structural verification");return n}function Ei(e){let t=Q(e,de);return{rootDir:t,blobDir:Q(t,"blobs"),generationDir:Q(t,"generations")}}function vr(e){let t=Pi(e);return Ti(t.baseIndex,t.completeDocuments,"assembled")}function Pi(e){let t=tt(e.baseIndexBytes);Li(t.metadata,ki(e)),Ai(t.externalSymbols);let r=new Map;for(let s of e.fragments){let c=Te(s.relativePath);if(r.has(c))throw new Error(`duplicate TypeScript fragment replacement: ${c}`);r.set(c,s)}if(r.size===0)throw new Error("TypeScript index assembly requires at least one replacement");let n=new Set,i=[],o=[],a=[];for(let s of t.documents){let c=Te(s.relativePath);if(n.has(c))throw new Error(`duplicate TypeScript SCIP document path: ${c}`);n.add(c);let d=r.get(c);if(!d){i.push(s);continue}if(r.delete(c),d.bytes===null){a.push(c);continue}let l=hr(c,d.bytes);i.push(l),o.push(l)}for(let s of[...r.keys()].sort()){let c=r.get(s);if(c.bytes===null)continue;if(n.has(s))throw new Error(`duplicate TypeScript SCIP document path: ${s}`);n.add(s);let d=hr(s,c.bytes);i.push(d),o.push(d)}return{baseIndex:t,completeDocuments:i,affectedDocuments:o,deletedAffectedPaths:a}}function hr(e,t){let r=br(Ir,t);if(r.relativePath!==e)throw new Error(`TypeScript fragment path mismatch: expected ${e}, got ${r.relativePath}`);return r}function Ti(e,t,r){let n=xr(Sr(wr,{metadata:e.metadata,documents:t,externalSymbols:[]})),i=tt(n);if(i.documents.length!==t.length||i.externalSymbols.length!==0)throw new Error(`${r} TypeScript SCIP index failed structural verification`);return n}function La(e,t){let r=Ei(e);if(!mr(r.generationDir))return;let n=new Set(t.map(a=>Gi(a))),i=gr(r.generationDir).filter(a=>a.endsWith(".json")),o=new Set;for(let a of i.filter(s=>n.has(s))){let s=Di(R(Q(r.generationDir,a),{maxBytes:v,inputKind:"TypeScript fragment manifest"}));for(let c of s.documents)o.add(`${c.blobHash}.scipdoc`)}for(let a of i)n.has(a)||yr(Q(r.generationDir,a),{force:!0});if(mr(r.blobDir))for(let a of gr(r.blobDir))o.has(a)||yr(Q(r.blobDir,a),{force:!0})}function Di(e){let t=JSON.parse(e);if(t.version!==rt||typeof t.producerIdentity!="string"||typeof t.projectIdentity!="string"||typeof t.generationIdentity!="string"||typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))||!Array.isArray(t.documents))throw new Error("invalid TypeScript fragment generation manifest");let r=new Set;for(let n of t.documents){if(!n||typeof n.relativePath!="string"||typeof n.blobHash!="string"||!/^[a-f0-9]{64}$/.test(n.blobHash)||typeof n.byteLength!="number"||!Number.isInteger(n.byteLength)||n.byteLength<0||typeof n.documentIdentity!="string"||!n.documentIdentity)throw new Error("invalid TypeScript fragment record");if(Te(n.relativePath),r.has(n.relativePath))throw new Error("duplicate TypeScript fragment record");r.add(n.relativePath)}return t}function Gi(e){if(!e)throw new Error("TypeScript fragment generation identity must be non-empty");return`${C(e)}.json`}function Ai(e){if(e.length>0)throw new Error("scip-typescript emitted external symbols; incremental document assembly is unsupported")}function Li(e,t){if(!e||typeof e!="object")throw new Error("TypeScript SCIP shard has no producer metadata");let r=e,n=r.toolInfo??r.tool_info;if(!n||typeof n!="object")throw new Error("TypeScript SCIP shard has no producer tool identity");let i=n;if(i.name!=="scip-typescript"||i.version!==t)throw new Error("TypeScript SCIP shard producer identity changed")}function ki(e){let t=e.packageVersion??e.runtime?.packageVersion;if(!t)throw new Error("scip-typescript package version is unavailable");return t}function Te(e){if(!e||e.startsWith("/")||e.startsWith("\\")||e.includes("\\"))throw new Error(`invalid TypeScript SCIP document path: ${e}`);let t=e.split("/");if(t.includes("")||t.includes(".")||t.includes(".."))throw new Error(`invalid TypeScript SCIP document path: ${e}`);return e}import{existsSync as De,readdirSync as nt,rmSync as Rr}from"fs";import{join as G}from"path";var Ge=1,le="typescript-scip-overlays",Er="typescript-project-v3:";function qa(e){let t=Tr(e.cacheDir,e.previousGenerationIdentity);if(!t&&!e.baseShardCurrent)throw new Error("deferred TypeScript SCIP base has no matching overlay generation");if(t?.producerIdentity!==void 0&&t.producerIdentity!==e.producerIdentity)throw new Error("TypeScript overlay producer identity changed");let r=e.allowLegacyProjectIdentityMigration===!0&&t!==null&&!t.projectIdentity.startsWith(Er)&&e.projectIdentity.startsWith(Er);if(t&&t.projectIdentity!==e.projectIdentity&&!e.allowProjectIdentityChange&&!r)throw new Error("TypeScript overlay project identity changed");let n=new Map((t?.overlays??[]).map(a=>[a.relativePath,a])),i=new Set;for(let a of e.fragments){let s=at(a.relativePath);if(i.has(s))throw new Error(`duplicate TypeScript overlay: ${s}`);i.add(s),n.set(s,Ci(e.cacheDir,a))}if(i.size===0)throw new Error("TypeScript overlay generation requires affected documents");let o={version:Ge,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,baseGenerationIdentity:t?.baseGenerationIdentity??e.previousGenerationIdentity,generationIdentity:e.nextGenerationIdentity,createdAt:(e.now??(()=>new Date))().toISOString(),overlays:[...n.values()].sort((a,s)=>a.relativePath.localeCompare(s.relativePath))};return Oi(e.cacheDir,o),o}function $a(e){let t=Tr(e.cacheDir,e.generationIdentity);if(!t)throw new Error("TypeScript overlay generation is unavailable");let r=t.overlays.map(n=>{if(n.blobHash===null)return{relativePath:n.relativePath,bytes:null,occurrences:0,symbols:0,referenceFragments:[]};let i=b(G(ue(e.cacheDir),"blobs",`${n.blobHash}.scipdoc`),{maxBytes:J,inputKind:"TypeScript overlay blob"});if(i.byteLength!==n.byteLength||C(i)!==n.blobHash)throw new Error(`TypeScript overlay blob is corrupt: ${n.relativePath}`);return{relativePath:n.relativePath,bytes:i,occurrences:0,symbols:0,referenceFragments:[]}});return vr({packageVersion:e.packageVersion,baseIndexBytes:e.baseIndexBytes,fragments:r})}function Ba(e,t){let r=ue(e),n=G(r,"generations");if(!De(n))return;let i=new Set(t.map(ot)),o=new Set;for(let s of nt(n).filter(c=>i.has(c))){let c=it(R(G(n,s),{maxBytes:v,inputKind:"TypeScript overlay manifest"}));for(let d of c.overlays)d.blobHash&&o.add(`${d.blobHash}.scipdoc`)}for(let s of nt(n))i.has(s)||Rr(G(n,s),{force:!0});let a=G(r,"blobs");if(De(a))for(let s of nt(a))o.has(s)||Rr(G(a,s),{force:!0})}function Tr(e,t){let r=G(ue(e),"generations",ot(t));if(!De(r))return null;let n=it(R(r,{maxBytes:v,inputKind:"TypeScript overlay manifest"}));if(n.generationIdentity!==t)throw new Error("TypeScript overlay generation identity does not match its path");return n}function Ci(e,t){let r=at(t.relativePath);if(t.bytes===null)return{relativePath:r,blobHash:null,byteLength:0};let n=Buffer.from(t.bytes),i=C(n);return pr({blobDir:G(ue(e),"blobs"),blobHash:i,bytes:n,relativePath:r,inputKind:"TypeScript overlay blob"}),{relativePath:r,blobHash:i,byteLength:n.byteLength}}function Oi(e,t){let r=G(ue(e),"generations",ot(t.generationIdentity));if(De(r)){let n=it(R(r,{maxBytes:v,inputKind:"TypeScript overlay manifest"}));if(Pr(n)!==Pr(t))throw new Error(`TypeScript overlay generation is immutable: ${t.generationIdentity}`);return}V(r,t,{spacing:2,trailingNewline:!0})}function it(e){let t=JSON.parse(e);if(t.version!==Ge||typeof t.producerIdentity!="string"||!t.producerIdentity||typeof t.projectIdentity!="string"||!t.projectIdentity||typeof t.baseGenerationIdentity!="string"||!t.baseGenerationIdentity||typeof t.generationIdentity!="string"||!t.generationIdentity||typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))||!Array.isArray(t.overlays))throw new Error("invalid TypeScript overlay manifest");let r=new Set;for(let n of t.overlays){if(!n||typeof n.relativePath!="string"||n.blobHash!==null&&(typeof n.blobHash!="string"||!/^[a-f0-9]{64}$/.test(n.blobHash))||!Number.isInteger(n.byteLength)||n.byteLength<0||n.blobHash===null&&n.byteLength!==0)throw new Error("invalid TypeScript overlay record");if(at(n.relativePath),r.has(n.relativePath))throw new Error("duplicate TypeScript overlay record");r.add(n.relativePath)}return t}function ue(e){return G(e,le)}function ot(e){if(!e)throw new Error("TypeScript overlay generation identity must be non-empty");return`${C(e)}.json`}function Pr(e){return C(JSON.stringify({version:e.version,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,baseGenerationIdentity:e.baseGenerationIdentity,generationIdentity:e.generationIdentity,overlays:e.overlays}))}function at(e){if(!e||e.startsWith("/")||e.includes("\\")||e.split("/").some(t=>!t||t==="."))throw new Error(`invalid TypeScript overlay path: ${e}`);if(e.split("/").includes(".."))throw new Error(`invalid TypeScript overlay path: ${e}`);return e}import{createHash as ft}from"crypto";import{closeSync as Mi,existsSync as g,mkdirSync as Fi,openSync as _i,readSync as ji,readdirSync as pt,renameSync as lt,rmSync as fe,statSync as B}from"fs";import{basename as mt,dirname as A,join as p,relative as Dr}from"path";var Ni=Object.freeze({maxGenerations:2,maxLogicalBytes:2*1024*1024*1024});function Ar(e){let t=h(e.outputDb),r=zi(e);e.onStage?.("after-recovery-retained");let n=e.preserveOutputScip?e.outputScip:e.tempOutputScip,i=Ui(e,r),o=yt({generationRoot:t,databasePath:e.tempOutputDb,indexPath:g(n)?n:void 0,verifiedIndexArtifact:i,metadataPath:g(e.tempMetaPath)?e.tempMetaPath:void 0}),a=(e.now??(()=>new Date))().toISOString(),s={version:N,currentGeneration:o.identity,artifactSet:"immutable-v1",...r?{previousGeneration:r}:{},...e.publication?{publication:e.publication}:{},publishedAt:a},c=D(p(t,"state.json"),s,{spacing:2,trailingNewline:!0});e.onStage?.("after-pointer-handoff"),e.preserveOutputScip||dt(e.tempOutputScip,e.outputScip),e.onStage?.("after-scip-handoff"),dt(e.tempOutputDb,e.outputDb),e.onStage?.("after-database-handoff"),dt(e.tempMetaPath,e.metaPath),e.onStage?.("after-metadata-handoff");let d=o.identity,l={...s,stableMirrors:gt(e.outputDb,e.outputScip)};D(p(t,"state.json"),l,{spacing:2,trailingNewline:!0});let f=Lr(e.outputDb,{now:e.now}),m=Z(o.directorySync,c.directorySync);return{currentGeneration:d,...r?{previousGeneration:r}:{},retention:f,achievedDurability:m==="synced"?"directory-durable":"file-flushed",directorySync:m}}function qi(e,t,r,n=()=>new Date){if(!g(e))return null;let i=q(e),o=p(h(e),"state.json");if(i?.artifactSet==="immutable-v1"&&re(e,i.currentGeneration))return i;let a=h(e),s=!i&&g(o)?Vi(r,e,t):void 0;if(s&&!ne(a,s))return null;let c=yt({generationRoot:a,databasePath:e,indexPath:g(t)?t:void 0,metadataPath:g(r)?r:void 0,forcedIdentity:i?.currentGeneration??s}),d={version:N,currentGeneration:c.identity,artifactSet:"immutable-v1",stableMirrors:gt(e,t),...i?.previousGeneration?{previousGeneration:i.previousGeneration}:{},...i?.publication?{publication:i.publication}:{},publishedAt:i?.publishedAt??n().toISOString()};return D(p(a,"state.json"),d,{spacing:2,trailingNewline:!0}),d}function es(e,t,r=()=>new Date){if(!g(e)||!g(t))throw new Error("metadata-only generation refresh requires stable database and metadata files");let n=q(e),i=h(e),o=yt({generationRoot:i,databasePath:e,indexPath:g(p(A(e),"index.scip"))?p(A(e),"index.scip"):void 0,metadataPath:t}),a=n&&n.currentGeneration!==o.identity?Cr(e,n.currentGeneration):void 0,s={version:N,currentGeneration:o.identity,artifactSet:"immutable-v1",stableMirrors:gt(e,p(A(e),"index.scip")),...a?{previousGeneration:a}:{},...n?.publication?{publication:n.publication}:{},publishedAt:r().toISOString()};return D(p(h(e),"state.json"),s,{spacing:2,trailingNewline:!0}),Lr(e,{now:r}),s}function Lr(e,t={}){let r=$i(t.limits),i=(t.now??(()=>new Date))().toISOString(),o=M(Ve(e),{waitMs:0});if(!o)return{state:"deferred",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,staleReaderLeasesRemoved:0,malformedReaderLeases:0,removedGenerations:0,removedLogicalBytes:0,limits:r,at:i,reason:"another process owns local generation retention"};try{let a=q(e),s=Bi(e),c=Ht(e,s.map(w=>w.identity),{isProcessAlive:t.isProcessAlive??we,readProcessIdentity:t.readProcessIdentity??ye}),d=new Set(c.protectedGenerations);a?.currentGeneration&&d.add(a.currentGeneration),a?.previousGeneration?.generationIdentity&&d.add(a.previousGeneration.generationIdentity);let l=s.length,f=s.reduce((w,Fe)=>w+Fe.logicalBytes,0),m=0,T=0;for(let w of s){if(l<=r.maxGenerations&&f<=r.maxLogicalBytes)break;d.has(w.identity)||(t.onBeforeRemove?.(w.identity),fe(w.path,{recursive:!0,force:!0}),l-=1,f-=w.logicalBytes,m+=1,T+=w.logicalBytes)}let y=l>r.maxGenerations||f>r.maxLogicalBytes,k={state:y?"protected":m>0?"collected":"within-bounds",generationCount:l,logicalBytes:f,protectedGenerations:d.size,activeReaderLeases:c.activeLeases,staleReaderLeasesRemoved:c.staleLeasesRemoved,malformedReaderLeases:c.malformedLeases,removedGenerations:m,removedLogicalBytes:T,limits:r,at:i,...y?{reason:c.malformedLeases>0?"malformed reader ownership evidence fails closed":"retention bounds cannot be met without deleting a protected generation"}:{}};return Gr(e,k),k}catch(a){let s={state:"error",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,staleReaderLeasesRemoved:0,malformedReaderLeases:0,removedGenerations:0,removedLogicalBytes:0,limits:r,at:i,reason:a instanceof Error?a.message:String(a)};try{Gr(e,s)}catch{}return s}finally{o.release()}}function $i(e={}){let t={...Ni,...e};if(!Number.isSafeInteger(t.maxGenerations)||t.maxGenerations<2)throw new Error("Local SQLite generation retention must keep at least current and previous generations.");if(!Number.isSafeInteger(t.maxLogicalBytes)||t.maxLogicalBytes<=0)throw new Error("Local SQLite generation byte retention must be a positive safe integer.");return t}function Bi(e){let t=h(e);return g(t)?pt(t,{withFileTypes:!0}).filter(r=>r.isDirectory()&&/^[a-f0-9]{64}$/.test(r.name)).map(r=>{let n=p(t,r.name),i=ne(t,r.name),o=i?i.database.size+(i.index?.size??0)+(i.metadata?.size??0):kr(n);return{identity:r.name,path:n,logicalBytes:o,modifiedAtMs:B(n).mtimeMs}}).sort((r,n)=>r.modifiedAtMs-n.modifiedAtMs||r.identity.localeCompare(n.identity)):[]}function kr(e){let t=0;for(let r of pt(e,{withFileTypes:!0})){let n=p(e,r.name);r.isDirectory()?t+=kr(n):r.isFile()&&(t+=B(n).size)}return t}function Gr(e,t){V(p(h(e),"gc.json"),t,{spacing:2,trailingNewline:!0})}function Le(e,t=p(A(e),"meta.json")){let r=p(h(e),"state.json");if(!g(r))return{state:"legacy",statePath:r};let n=q(e);if(!n)return{state:"invalid",statePath:r,reason:"generation state is malformed"};try{let i=re(e,n.currentGeneration),o=i!==null,a=i?Wi(e,t,i,n):!1,s=n.previousGeneration?g(p(A(e),n.previousGeneration.databasePath)):!0;return!a||!o||!s?{state:"drifted",statePath:r,currentMatches:a,recoveryExists:s,generation:n,reason:o?a?"retained recovery database is missing":"stable database or metadata no longer matches the published generation":"published immutable generation is missing"}:{state:"current",statePath:r,currentMatches:a,recoveryExists:s,generation:n}}catch(i){return{state:"drifted",statePath:r,currentMatches:!1,recoveryExists:!1,generation:n,reason:i instanceof Error?i.message:String(i)}}}function Wi(e,t,r,n){if(n.stableMirrors&&(n.stableMirrors.databaseFileIdentity!==$(e)||n.stableMirrors.indexFileIdentity!==void 0&&n.stableMirrors.indexFileIdentity!==$(p(A(e),"index.scip")))||!ut(e,r.database))return!1;let i=p(A(e),"index.scip");if(r.index&&!ut(i,r.index))return!1;if(!r.metadata)return!g(t);if(!g(t))return!1;let o=p(h(e),r.identity,r.metadata.file);return g(o)&&F(I(t,"reindex metadata"))===F(I(o,"immutable reindex metadata"))}function ut(e,t){return g(e)&&B(e).isFile()&&B(e).size===t.size}function zi(e){let t=qi(e.outputDb,e.outputScip,e.metaPath);return t?Cr(e.outputDb,t.currentGeneration):void 0}function Ui(e,t){if(!e.preserveOutputScip)return;if(!t)throw new Error("deferred SCIP publication requires an accepted immutable generation");let r=Le(e.outputDb,e.metaPath);if(r.state!=="current"||r.generation.currentGeneration!==t.generationIdentity){let i=r.state==="current"?"generation identity changed":"reason"in r?r.reason:`generation state is ${r.state}`;throw new Error(`deferred SCIP publication requires a verified accepted companion: ${i}`)}let n=re(e.outputDb,t.generationIdentity);if(!n?.index||!ut(e.outputScip,n.index))throw new Error("deferred SCIP publication requires the verified accepted index artifact");return n.index}function gt(e,t){return{databaseFileIdentity:$(e),...g(t)?{indexFileIdentity:$(t)}:{}}}function Cr(e,t){let r=p(h(e),t),n=p(r,mt(e)),i=p(r,"meta.json");return{generationIdentity:t,databasePath:Dr(A(e),n),...g(i)?{metadataPath:Dr(A(e),i)}:{}}}function Hi(e){if(g(e))for(let t of pt(e,{withFileTypes:!0}))t.isDirectory()&&t.name.endsWith(".tmp")&&fe(p(e,t.name),{recursive:!0,force:!0})}function Vi(e,t,r=p(A(t),"index.scip")){let n=ft("sha256").update("sqlite-generation-artifacts-v1\0");return n.update(Ae(t)),g(r)&&n.update(`\0${Ae(r)}`),g(e)&&n.update(`\0${F(I(e,"reindex metadata"))}`),n.digest("hex")}function yt(e){let t=st(e.databasePath),r=e.indexPath?e.verifiedIndexArtifact?Qi(e.indexPath,e.verifiedIndexArtifact):st(e.indexPath):void 0,n=e.metadataPath?st(e.metadataPath):void 0,i=e.forcedIdentity??Yi(t,r,e.metadataPath),o=p(e.generationRoot,i),a=p(o,Ee);if(g(a)){let d=ne(e.generationRoot,i);if(d&&Or(o,d.database,t)&&Ji(o,d.index,r)&&Xi(o,d.metadata,e.metadataPath))return{identity:i,directorySync:O(e.generationRoot)};throw new Error(`SQLite generation ${i} already exists with different or corrupt artifacts.`)}let s=[Ie(e.generationRoot)];Hi(e.generationRoot);let c=`${o}.${process.pid}.${Date.now()}.tmp`;fe(c,{recursive:!0,force:!0}),Fi(c,{recursive:!0});try{s.push(ct(e.databasePath,p(c,t.file))),r&&e.indexPath&&s.push(ct(e.indexPath,p(c,r.file))),n&&e.metadataPath&&s.push(ct(e.metadataPath,p(c,n.file)));let d=D(p(c,Ee),{version:He,identity:i,database:t,...r?{index:r}:{},...n?{metadata:n}:{}},{spacing:2,trailingNewline:!0});d.directorySync!=="not-requested"&&s.push(d.directorySync),s.push(O(c)),lt(c,o),s.push(O(e.generationRoot))}finally{fe(c,{recursive:!0,force:!0})}return{identity:i,directorySync:Z(...s)}}function Yi(e,t,r){let n=ft("sha256").update("sqlite-generation-artifacts-v1\0");return n.update(e.sha256),t&&n.update(`\0${t.sha256}`),r&&n.update(`\0${F(I(r,"reindex metadata"))}`),n.digest("hex")}function st(e){return{file:mt(e),size:B(e).size,sha256:Ae(e)}}function Qi(e,t){if(t.file!==mt(e)||B(e).size!==t.size)throw new Error(`verified SQLite generation artifact changed before publication: ${e}`);return t}function Ae(e){let t=ft("sha256"),r=_i(e,"r"),n=Buffer.allocUnsafe(1024*1024);try{for(;;){let i=Ki(r,n);if(i===0)break;t.update(n.subarray(0,i))}}finally{Mi(r)}return t.digest("hex")}function Ki(e,t){let r=0;for(;r<t.length;){let n=ji(e,t,r,t.length-r,null);if(r+=n,n===0)break}return r}function ct(e,t){return ve(e,t,{mode:292})}function Or(e,t,r){let n=p(e,t.file);return t.file===r.file&&t.size===r.size&&t.sha256===r.sha256&&g(n)&&B(n).size===t.size&&Ae(n)===t.sha256}function Ji(e,t,r){return!t||!r?t===r:Or(e,t,r)}function Xi(e,t,r){if(!t||!r)return t===void 0&&r===void 0;let n=p(e,t.file);return g(n)&&F(I(n,"stored reindex metadata"))===F(I(r,"candidate reindex metadata"))}function dt(e,t){fe(`${t}.tmp-replace`,{force:!0}),lt(e,`${t}.tmp-replace`),lt(`${t}.tmp-replace`,t)}import{createHash as Wr,randomUUID as oo}from"crypto";import{existsSync as j,lstatSync as bt,mkdirSync as K,mkdtempSync as zr,readdirSync as Ur,realpathSync as Hr,renameSync as z,rmSync as _,statSync as Me}from"fs";import{dirname as It,join as u,resolve as W}from"path";import{setTimeout as ao}from"timers/promises";import{pathToFileURL as jr}from"url";import so from"better-sqlite3";import{lstatSync as Zi,readdirSync as eo}from"fs";import{join as to,relative as ro,resolve as ht,sep as no}from"path";var pe=1,St="language-indexes",Mr=["index.db","index.scip","meta.json"],Fr=[St,de,le];function ke(e){let t=[];for(let r of Mr)io(e,r),t.push(r);for(let r of Fr)_r(e,r,t);return{version:pe,files:t.sort()}}function Ce(e){if(!e||e.includes("\0")||e.startsWith("/")||e.includes("\\"))throw new Error(`invalid index artifact path: ${e||"<empty>"}`);let t=e.split("/");if(t.some(n=>!n||n==="."||n===".."))throw new Error(`invalid index artifact path: ${e}`);let r=t[0];if(!Mr.includes(e)&&!Fr.includes(r))throw new Error(`index artifact path is not shareable: ${e}`);return e}function L(e,t){let r=Ce(t),n=ht(e),i=ht(n,...r.split("/"));if(i!==n&&!i.startsWith(`${n}${no}`))throw new Error(`index artifact escapes cache: ${t}`);return i}function _r(e,t,r){let n=to(e,t),i;try{i=eo(n,{withFileTypes:!0,encoding:"utf8"})}catch{return}for(let o of i){let a=`${t}/${o.name}`;if(o.isSymbolicLink())throw new Error(`index artifact cannot be a symlink: ${a}`);o.isDirectory()?_r(e,a,r):o.isFile()&&r.push(Ce(a))}}function io(e,t){let r=L(e,t),n;try{n=Zi(r)}catch{throw new Error(`required index artifact is missing: ${t}`)}if(!n.isFile()||n.isSymbolicLink())throw new Error(`required index artifact is not a regular file: ${t}`);if(ro(ht(e),r).startsWith(".."))throw new Error(`index artifact escapes cache: ${t}`)}var wt=1,Nr="SCIP_QUERY_SHARED_CACHE",co=2,Oe=JSON.stringify({cliVersion:Ot,artifactCatalogVersion:pe,postIndexAugmentationSchemaVersion:co,sqliteGenerationStoreVersion:N,typescriptFragmentStoreVersion:rt,typescriptOverlayStoreVersion:Ge}),xt="manifest.json",Vr="shared-cache.json";var vt=[St,de,le];function lo(e,t){if(!e.clean||!e.treeOid)return;let r=Zr(JSON.stringify({version:wt,repositoryId:e.repositoryId,treeOid:e.treeOid,fingerprint:kt(t),producerIdentity:Oe}));return{repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,fingerprint:t,producerIdentity:Oe,generationId:r,repositoryCacheDir:Ne(e.repositoryId)}}function Cs(e,t,r){if(!wo(r))return!1;let n=lo(e,r);if(!n)return!1;try{let i=yo(t);if(!i||i.repositoryId!==e.repositoryId||i.worktreeId!==e.worktreeId)return!1;let o=JSON.parse(R(u(n.repositoryCacheDir,"worktrees",`${i.worktreeId}.json`),{inputKind:"worktree cache lease",maxBytes:v}));return o.version!==1||o.repositoryId!==i.repositoryId||o.worktreeId!==i.worktreeId||W(o.projectRoot)!==W(e.projectRoot)||o.treeOid!==e.treeOid||W(o.localCacheDir)!==W(t)||o.ownershipChecksum!==Rt(o)||o.baseGenerationId!==n.generationId||o.activeGenerationId!==n.generationId?!1:U(n,!1)!==null}catch{return!1}}function Os(e,t,r){if(process.env[Nr]==="0")return`${Nr}=0`;if(!qe(r))return"explicit cache or database override";if($e(It(t))!==$e(Ft(e))||t!==u(It(t),"index.db"))return"index database is outside the managed worktree cache"}function Ms(e,t,r){if(!qe(t))return;let n=r??Nt(e);return n?u(Ne(n.repositoryId),"evidence.db"):void 0}function U(e,t=!0){let r=Et(e),n;try{n=Yr(R(u(r,xt),{inputKind:"shared-generation manifest",maxBytes:v}))}catch{return null}if(n.generationId!==e.generationId||n.repositoryId!==e.repositoryId||n.treeOid!==e.treeOid||n.producerIdentity!==e.producerIdentity||!he(n.fingerprint,e.fingerprint)||!mo(r))return null;if(!t)return n;try{for(let i of n.artifacts){let o=L(r,i.path),a=Me(o);if(!a.isFile()||a.size!==i.size||H(o,{inputKind:"shared-generation artifact",maxBytes:S})!==i.sha256)return null}}catch{return null}return n}function Fs(e,t,r,n){if(!e.treeOid)return null;let i=Be(t,r),o=u(Mt(),"repositories",e.repositoryId),a;try{let d=bt(o);if(!d.isDirectory()||d.isSymbolicLink())return null;a=Hr(o)}catch{return null}let s=u(a,"generations"),c=[];try{for(let d of Ur(s)){if(!/^[a-f0-9]{64}$/.test(d))continue;let l=u(s,d),f;try{f=bt(l)}catch{continue}if(!(!f.isDirectory()||f.isSymbolicLink()))try{let m=Yr(R(u(l,xt),{inputKind:"shared-generation baseline manifest",maxBytes:v}));m.generationId===d&&m.repositoryId===e.repositoryId&&m.producerIdentity===Oe&&go(m.fingerprint,i)&&c.push(m)}catch{continue}}}catch{return null}c.sort((d,l)=>{let f=d.treeOid===e.treeOid?0:1,m=l.treeOid===e.treeOid?0:1;if(f!==m)return f-m;if(n){let y=Br(d.fingerprint,n)-Br(l.fingerprint,n);if(y!==0)return y}return Date.parse(l.createdAt)-Date.parse(d.createdAt)||d.generationId.localeCompare(l.generationId)});for(let d of c){let l={repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:d.treeOid,fingerprint:d.fingerprint,producerIdentity:d.producerIdentity,generationId:d.generationId,repositoryCacheDir:a},f=U(l);if(f)return{snapshot:l,manifest:f}}return null}function _s(e){let t=M(u(e.snapshot.repositoryCacheDir,"locks",`${e.snapshot.generationId}.publish.lock`));if(!t)throw new Error(`shared generation publication is already in progress for ${e.snapshot.generationId}`);try{return uo(e)}finally{t.release()}}function uo(e){let t=U(e.snapshot);if(t)return qr(e.snapshot,t);if(!Xr(e.sourceCacheDir,e.sourceProjectRoot,e.snapshot.fingerprint))throw new Error("source index is incomplete, incompatible, or corrupt");let r=$r(e.sourceCacheDir);if(!r)throw new Error("source index artifacts are incomplete");let n=ke(e.sourceCacheDir),i=u(e.snapshot.repositoryCacheDir,"generations"),o=[Ie(i)],a=zr(u(i,`.tmp-${process.pid}-`));try{let s=[];for(let y of n.files){let k=L(e.sourceCacheDir,y),w=L(a,y);o.push(ge(k,w,292)),e.onPublicationStage?.("after-artifact-flushed",y);let Fe=Me(w).size;s.push({path:y,size:Fe,sha256:H(w,{inputKind:"staged shared-generation artifact",maxBytes:S})})}let c=oe(b(u(a,"index.scip"),{inputKind:"staged shared SCIP index",maxBytes:S}));if(!c)throw new Error("shared SCIP generation has no project root metadata");let d=Pt(e.sourceProjectRoot);if(c!==d)throw new Error("shared SCIP generation root does not match its source worktree");if($r(e.sourceCacheDir)!==r||e.sourceStillValid&&!e.sourceStillValid())throw new Error("source index changed while staging a shared generation");let l={version:wt,artifactCatalogVersion:pe,generationId:e.snapshot.generationId,repositoryId:e.snapshot.repositoryId,treeOid:e.snapshot.treeOid,fingerprint:e.snapshot.fingerprint,producerIdentity:e.snapshot.producerIdentity,sourceProjectRoot:e.sourceProjectRoot,scipProjectRoot:c,createdAt:(e.now??(()=>new Date))().toISOString(),artifacts:s.sort((y,k)=>y.path.localeCompare(k.path))},f=D(u(a,xt),l,{spacing:2,trailingNewline:!0});f.directorySync!=="not-requested"&&o.push(f.directorySync),e.onPublicationStage?.("after-manifest-flushed"),o.push(O(a)),e.onPublicationStage?.("after-staging-directory-synced");let m=Et(e.snapshot);try{if(j(m)&&!U(e.snapshot)){let y=`${m}.corrupt-${process.pid}-${Date.now()}`;z(m,y),_(y,{recursive:!0,force:!0})}z(a,m)}catch(y){let k=U(e.snapshot);if(k)return qr(e.snapshot,k);throw y}e.onPublicationStage?.("after-generation-renamed"),o.push(O(i)),e.onPublicationStage?.("after-generations-directory-synced");let T=Z(...o);return{kind:"published",manifest:l,achievedDurability:T==="synced"?"directory-durable":"file-flushed",directorySync:T}}finally{_(a,{recursive:!0,force:!0})}}function qr(e,t){let r=O(u(e.repositoryCacheDir,"generations"));return{kind:"existing",manifest:t,achievedDurability:r==="synced"?"directory-durable":"file-flushed",directorySync:r}}function js(e){let t=Et(e.snapshot);K(e.targetCacheDir,{recursive:!0});let r=M(u(e.targetCacheDir,"cache-lifecycle.lock"),{waitMs:e.lockWaitMs??3e4});if(!r)throw new Error("timed out waiting for another cache hydration");let n,i,o=!1;try{n=zr(u(e.targetCacheDir,".shared-hydrate-")),Io(e.manifest,e.snapshot);for(let c of e.manifest.artifacts){let d=L(t,c.path),l=L(n,c.path);if(ge(d,l),Me(l).size!==c.size||H(l,{inputKind:"hydrated shared-generation artifact",maxBytes:S})!==c.sha256)throw new Error(`shared artifact is corrupt: ${c.path}`)}let a=Pt(e.targetProjectRoot);if(a!==e.manifest.scipProjectRoot)for(let c of e.manifest.artifacts)c.path.endsWith(".scip")&&ur(L(n,c.path),e.manifest.scipProjectRoot,a);if(!Xr(n,e.targetProjectRoot,e.snapshot.fingerprint,!1))throw new Error("staged shared generation failed completeness or integrity validation");i=ho(e.targetCacheDir,n),o=!0,So(n,e.targetCacheDir,i),Ar({tempOutputScip:u(n,"index.scip"),tempOutputDb:u(n,"index.db"),tempMetaPath:u(n,"meta.json"),outputScip:u(e.targetCacheDir,"index.scip"),outputDb:u(e.targetCacheDir,"index.db"),metaPath:u(e.targetCacheDir,"meta.json"),now:e.now});let s=Le(u(e.targetCacheDir,"index.db"),u(e.targetCacheDir,"meta.json"));if(s.state==="invalid"||s.state==="drifted")throw new Error(`hydrated SQLite generation failed validation: ${s.reason}`);e.persistLease!==!1&&fo(e.snapshot,e.targetCacheDir,e.action??"attached",e.now)}catch(a){throw o&&i&&bo(e.targetCacheDir,i),a}finally{n&&_(n,{recursive:!0,force:!0}),r.release()}}async function Ns(e,t={}){let r=t.timeoutMs??3e4,n=t.pollMs??100,i=t.now??be,o=i()+r,a=u(e.repositoryCacheDir,"locks"),s=u(a,`${e.generationId}.lock`),c=d=>{if(!d||typeof d!="object"||Array.isArray(d))return null;let l=d.pid;return typeof l=="number"&&Number.isSafeInteger(l)&&l>0?{pid:l}:null};for(;i()<=o;){if(U(e))return{kind:"generation-ready"};let d=xe(s,{kind:"shared-generation-build",detail:{generationId:e.generationId},parseLegacy:c});if(d.kind==="acquired")return{kind:"owner",release:()=>d.lock.release()};let l=o-i();if(l<=0)break;await ao(Math.min(n,l))}return U(e)?{kind:"generation-ready"}:{kind:"timeout"}}function fo(e,t,r,n=void 0){let i={version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,localCacheDir:t,baseGenerationId:e.generationId,activeGenerationId:e.generationId,lastAction:r,lastSeenAt:(n??(()=>new Date))().toISOString()},o={...i,ownershipChecksum:Rt(i)};return Kr(e.repositoryCacheDir,o,!0),o}function qs(e,t,r=void 0){let n={version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,localCacheDir:t,baseGenerationId:e.generationId,lastAction:"overlay",lastReason:`private cache forked from shared baseline ${e.generationId}`,lastSeenAt:(r??(()=>new Date))().toISOString()},i={...n,ownershipChecksum:Rt(n)};return Kr(e.repositoryCacheDir,i,!0),i}function Rt(e){return Zr(JSON.stringify({version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:W(e.projectRoot),localCacheDir:W(e.localCacheDir)}))}function Yr(e){let t=JSON.parse(e);if(t.version!==wt||t.artifactCatalogVersion!==pe||typeof t.generationId!="string"||!/^[a-f0-9]{64}$/.test(t.generationId)||typeof t.repositoryId!="string"||!/^[a-f0-9]{24}$/.test(t.repositoryId)||typeof t.treeOid!="string"||!t.treeOid||typeof t.producerIdentity!="string"||t.producerIdentity!==Oe||typeof t.sourceProjectRoot!="string"||typeof t.scipProjectRoot!="string"||typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))||!t.fingerprint||!Array.isArray(t.artifacts))throw new Error("invalid shared generation manifest");let r=new Set;for(let n of t.artifacts){if(!n||typeof n.path!="string"||typeof n.size!="number"||n.size<0||typeof n.sha256!="string"||!/^[a-f0-9]{64}$/.test(n.sha256))throw new Error("invalid shared generation artifact");if(Ce(n.path),r.has(n.path))throw new Error(`duplicate shared generation artifact: ${n.path}`);r.add(n.path)}for(let n of["index.db","index.scip","meta.json"])if(!r.has(n))throw new Error(`shared generation is missing ${n}`);return t}function ge(e,t,r=384){return ve(e,t,{mode:r})}function po(e,t,r){K(e,{recursive:!0}),D(u(e,Vr),{version:1,repositoryId:t,worktreeId:r},{spacing:2,trailingNewline:!0})}function $r(e){try{let t=ke(e),r=Wr("sha256");for(let n of t.files){let i=L(e,n),o=Me(i).size;r.update(n).update("\0").update(String(o)).update("\0"),Tt(i,{inputKind:"source-generation artifact",maxBytes:S},a=>r.update(a)),r.update("\0")}return r.digest("hex")}catch{return null}}function Qr(e){try{let t=Se(R(u(e,"meta.json"),{inputKind:"reindex metadata",maxBytes:v}));return(t.kind==="legacy"||t.kind==="supported")&&t.capabilities.publishableGeneration?t.metadata:void 0}catch{return}}function mo(e){return Qr(e)?.scipCompanion!=="deferred"}function go(e,t){let r=Be(e.languages,e);return JSON.stringify(r)===JSON.stringify(t)}function Br(e,t){let r=new Map(e.files.map(o=>[o.path,`${o.size}\0${o.hash}`])),n=new Map(t.files.map(o=>[o.path,`${o.size}\0${o.hash}`])),i=0;for(let[o,a]of r)n.get(o)!==a&&(i+=1);for(let o of n.keys())r.has(o)||(i+=1);return i}function Et(e){return u(e.repositoryCacheDir,"generations",e.generationId)}function yo(e){let t=JSON.parse(R(u(e,Vr),{inputKind:"worktree cache pointer",maxBytes:v}));return t.version!==1||typeof t.repositoryId!="string"||!/^[a-f0-9]{24}$/.test(t.repositoryId)||typeof t.worktreeId!="string"||!/^[a-f0-9]{24}$/.test(t.worktreeId)?null:{version:t.version,repositoryId:t.repositoryId,worktreeId:t.worktreeId}}function Kr(e,t,r){let n=qt(e,{waitMs:5e3});if(!n)throw new Error("repository cache cleanup is busy");try{if(r){let o=t.activeGenerationId??t.baseGenerationId;if(!o||!j(u(e,"generations",o)))throw new Error("shared generation disappeared before its lease was attached")}let i=u(e,"worktrees");K(i,{recursive:!0}),D(u(i,`${t.worktreeId}.json`),t,{spacing:2,trailingNewline:!0}),po(t.localCacheDir,t.repositoryId,t.worktreeId)}finally{n.release()}}function ho(e,t){let r=u(t,".rollback"),n=new Map,i=new Map;K(r,{recursive:!0});for(let s of["index.scip","index.db","meta.json"]){let c=u(e,s),d=j(c);n.set(s,d),d&&ge(c,u(r,"stable",s))}for(let s of vt){let c=u(e,s),d=j(c);if(d){let l=bt(c);if(!l.isDirectory()||l.isSymbolicLink())throw new Error(`managed artifact path is not a directory: ${s}`)}i.set(s,d)}let o=u(e,te),a=j(o);return a&&Jr(o,u(r,"sqlite-generations")),{root:r,stableFiles:n,managedDirectories:i,generationStoreExisted:a}}function So(e,t,r){for(let n of vt){let i=u(t,n);if(r.managedDirectories.get(n)){let a=u(r.root,"managed",n);K(It(a),{recursive:!0}),z(i,a)}let o=u(e,n);j(o)&&z(o,i)}}function bo(e,t){for(let i of vt){let o=u(e,i),a=u(t.root,"managed",i);t.managedDirectories.get(i)?j(a)&&(_(o,{recursive:!0,force:!0}),z(a,o)):_(o,{recursive:!0,force:!0})}for(let[i,o]of t.stableFiles){let a=u(e,i);if(!o){_(a,{force:!0});continue}let s=`${a}.shared-restore-${oo()}`;ge(u(t.root,"stable",i),s),_(a,{force:!0}),z(s,a)}let r=u(e,te);_(r,{recursive:!0,force:!0});let n=u(t.root,"sqlite-generations");t.generationStoreExisted&&j(n)&&z(n,r)}function Jr(e,t){K(t,{recursive:!0});for(let r of Ur(e,{withFileTypes:!0})){let n=u(e,r.name),i=u(t,r.name);if(r.isSymbolicLink())throw new Error(`managed cache backup cannot contain a symlink: ${n}`);r.isDirectory()?Jr(n,i):r.isFile()&&ge(n,i)}}function Io(e,t){if(e.generationId!==t.generationId||e.repositoryId!==t.repositoryId||e.treeOid!==t.treeOid||e.producerIdentity!==t.producerIdentity||!he(e.fingerprint,t.fingerprint))throw new Error("shared generation manifest does not match the requested snapshot")}function Xr(e,t,r,n=!0,i=!0){try{let o=Qr(e);if(!o||o.scipCompanion==="deferred"||!he(Lt(o.fingerprint),r)||JSON.stringify([...o.indexedLanguages??[]].sort())!==JSON.stringify([...r.languages].sort()))return me("source validation rejected metadata"),!1;let a=ke(e),s=Le(u(e,"index.db"),u(e,"meta.json"));if(n?s.state!=="current":s.state==="invalid"||s.state==="drifted")return me(`source validation rejected SQLite generation state ${s.state}`),!1;let c=new so(u(e,"index.db"),{readonly:!0,fileMustExist:!0});try{if(i){if(c.pragma("quick_check(1)",{simple:!0})!=="ok")return!1}else c.pragma("schema_version",{simple:!0})}finally{c.close()}let d=Pt(t),f=(i?a.files.filter(m=>m.endsWith(".scip")):["index.scip"]).every(m=>{let T=oe(b(L(e,m),{inputKind:"shared SCIP validation artifact",maxBytes:S}));return T!==d&&me(`source validation rejected SCIP root for ${m}: ${String(T)}`),T===d});return f||me("source validation rejected SCIP project roots"),f}catch(o){return me(`source validation failed: ${o instanceof Error?o.message:String(o)}`),!1}}function me(e){process.env.SCIP_QUERY_DEBUG&&console.error(`shared-cache: ${e}`)}function Pt(e){try{return jr(Hr(e)).href}catch{return jr(W(e)).href}}function wo(e){if(!e||typeof e!="object")return!1;let t=e;return t.version===3&&Array.isArray(t.languages)&&typeof t.pnpmWorkspaces=="boolean"&&(t.typescriptProjectMode==="single"||t.typescriptProjectMode==="workspace")&&Array.isArray(t.typescriptProjects)&&Array.isArray(t.files)&&t.files.every(r=>r!==null&&typeof r=="object"&&typeof r.path=="string"&&typeof r.size=="number"&&typeof r.hash=="string"&&(r.semanticHash===void 0||typeof r.semanticHash=="string"))}function Zr(e){return Wr("sha256").update(e).digest("hex")}export{en as a,xo as b,qt as c,M as d,jo as e,yn as f,No as g,$ as h,Uo as i,P as j,ie as k,Pe as l,ea as m,da as n,la as o,ua as p,ya as q,Aa as r,La as s,qa as t,$a as u,Ba as v,Ar as w,qi as x,es as y,Le as z,lo as A,Cs as B,Os as C,Ms as D,U as E,Fs as F,_s as G,js as H,Ns as I,fo as J,qs as K,Rt as L};
2
- //# sourceMappingURL=chunk-WN3TCGJ4.js.map
@@ -1,2 +0,0 @@
1
- import{a as Ie,i as De,j as W}from"./chunk-VUSKPCUB.js";import{c as we,h as Ae}from"./chunk-HCVJR2V4.js";import{a as Me,e as he,i as Ee}from"./chunk-DRENNWRG.js";import{a as be,e as A,g as k,i as ke,k as q,l as U,m as xe}from"./chunk-JT6XX7QY.js";import{a as S,c as ye,d as M,e as p,f as Q,g as J,i as Se}from"./chunk-H5EXS3HM.js";import{a as C,e as X,g as v}from"./chunk-HGFDYOVB.js";import{a as fe,b as Re,c as me,d as w}from"./chunk-SB25YMEQ.js";import{a as ce,b as E,c as de,f as pe,g as x,l as $,qa as ge}from"./chunk-AK3PYTIK.js";import{createHash as cn}from"crypto";import{resolve as dn}from"path";var b=3;function F(e){return cn("sha256").update(A({kind:"scip-query-durable-rust-mailbox",protocolVersion:b,sessionDir:dn(e)})).digest("hex")}function pn(e,n){if(!S(e)||typeof e.id!="string"||!e.id)return T("Durable Rust semantic helper received an invalid mailbox request.");if(e.id!==n.claimRequestId)return T("Durable Rust semantic request identity does not match its mailbox path.");if(e.protocolVersion===void 0){if(e.mailboxVersion!==void 0||e.operationKey!==void 0||e.clientId!==void 0||e.enqueuedAtMs!==void 0||e.deadlineAtMs!==void 0||e.sessionIdentity!==void 0)return T("Durable Rust semantic helper received a partially versioned request without a protocol version.");let s=_e(e.request);if(!s)return T("Durable Rust semantic helper received an invalid legacy request kind or payload.");let i=n.nowMs+Math.max(1,s.timeoutMs);return{ok:!0,compatibility:"legacy-v2",value:{mailboxVersion:k,protocolVersion:b,id:e.id,operationKey:q("rust-semantic-v2",{id:e.id,request:s}),clientId:"legacy-v2",enqueuedAtMs:n.nowMs,deadlineAtMs:i,sessionIdentity:n.sessionIdentity,request:s}}}let t=fn(e,n);if(!t.ok)return t;if(e.protocolVersion!==b)return{ok:!1,code:"unsupported-protocol",error:`Durable Rust semantic helper does not support mailbox protocol ${String(e.protocolVersion)}.`,responseIdentity:t.responseIdentity};let r=_e(e.request);return r?t.operationKey!==q("rust-semantic-v3",r)?{ok:!1,code:"malformed-request",error:"Durable Rust semantic helper received a mismatched mailbox operation identity.",responseIdentity:t.responseIdentity}:t.deadlineAtMs-t.enqueuedAtMs!==r.timeoutMs?{ok:!1,code:"malformed-request",error:"Durable Rust semantic helper received a deadline that does not match the request timeout.",responseIdentity:t.responseIdentity}:t.deadlineAtMs<n.nowMs?{ok:!1,code:"expired-request",error:"Durable Rust semantic request expired before processing.",responseIdentity:t.responseIdentity}:{ok:!0,compatibility:t.priorSessionIdentity?"prior-v3":"current-v3",value:{mailboxVersion:k,protocolVersion:b,id:e.id,operationKey:t.operationKey,clientId:t.clientId,enqueuedAtMs:t.enqueuedAtMs,deadlineAtMs:t.deadlineAtMs,sessionIdentity:n.sessionIdentity,request:r}}:{ok:!1,code:"malformed-request",error:"Durable Rust semantic helper received an invalid request kind or payload.",responseIdentity:t.responseIdentity}}function ne(e,n){return S(e)?e.protocolVersion!==b?ve(e.protocolVersion===void 0?"helper wrote a prior uncorrelated response protocol":`helper wrote unsupported response protocol ${String(e.protocolVersion)}`):e.mailboxVersion!==k||e.id!==n.requestId||e.operationKey!==n.operationKey||e.sessionIdentity!==n.sessionIdentity||e.deadlineAtMs!==n.deadlineAtMs?ve("helper wrote an incompatible response identity"):typeof e.completedAtMs!="number"||!Number.isFinite(e.completedAtMs)||e.completedAtMs>n.deadlineAtMs||n.nowMs>n.deadlineAtMs?{ok:!1,code:"expired-request",error:"helper response arrived after the durable request deadline"}:e.ok===!1?typeof e.error!="string"||!In(e.errorCode)?Z("helper wrote an invalid rejection response"):{ok:!1,code:e.errorCode,error:e.error}:e.ok!==!0||e.session!=="created"&&e.session!=="reused"&&e.session!=="invalidated"||!Sn(e.response,n.requestKind)?Z("helper wrote an invalid success response"):{ok:!0,session:e.session,response:e.response}:Z("helper wrote an invalid response object")}function fn(e,n){if(e.mailboxVersion!==k||typeof e.protocolVersion!="number"||!Number.isInteger(e.protocolVersion)||typeof e.operationKey!="string"||!J(e.operationKey)||e.id!==U(e.operationKey)||typeof e.clientId!="string"||!e.clientId||typeof e.enqueuedAtMs!="number"||!Number.isFinite(e.enqueuedAtMs)||typeof e.deadlineAtMs!="number"||!Number.isFinite(e.deadlineAtMs)||e.deadlineAtMs<e.enqueuedAtMs||e.sessionIdentity!==void 0&&(typeof e.sessionIdentity!="string"||!J(e.sessionIdentity))||e.sessionIdentity===void 0&&e.protocolVersion!==b)return T("Durable Rust semantic helper received an invalid mailbox lifecycle.");let t={id:n.claimRequestId,sessionIdentity:n.sessionIdentity,deadlineAtMs:e.deadlineAtMs};return e.sessionIdentity!==void 0&&e.sessionIdentity!==n.sessionIdentity?{ok:!1,code:"malformed-request",error:"Durable Rust semantic request belongs to a different mailbox session.",responseIdentity:t}:{ok:!0,responseIdentity:t,operationKey:e.operationKey,clientId:e.clientId,enqueuedAtMs:e.enqueuedAtMs,deadlineAtMs:e.deadlineAtMs,priorSessionIdentity:e.sessionIdentity===void 0}}function _e(e){return!S(e)||typeof e.identityKey!="string"||!e.identityKey||!Q(e.timeoutMs)||e.workerEnvironment!==void 0&&!ye(e.workerEnvironment)?null:e.kind==="semantic"&&Rn(e.request)?{kind:"semantic",identityKey:e.identityKey,...e.workerEnvironment===void 0?{}:{workerEnvironment:e.workerEnvironment},request:e.request,timeoutMs:e.timeoutMs}:e.kind==="import-definitions"&&mn(e.request)?{kind:"import-definitions",identityKey:e.identityKey,...e.workerEnvironment===void 0?{}:{workerEnvironment:e.workerEnvironment},request:e.request,timeoutMs:e.timeoutMs}:null}function Rn(e){return!S(e)||!M(e.projectRoot)||!M(e.rustAnalyzerBinary)||!Te(e.definitions)?!1:G(e.referenceDefinitions)&&G(e.calleeDefinitions)&&G(e.signatureDefinitions)&&I(e.requestTimeoutMs)&&I(e.readinessDeadlineMs)&&I(e.referenceRetryTimeoutMs)&&I(e.diagnosticsTimeoutMs)&&I(e.settleDelayMs)&&Pe(e.concurrency)&&ee(e.includeReferences)&&ee(e.includeCallees)&&ee(e.includeSignatures)}function mn(e){return!S(e)||!M(e.projectRoot)||!M(e.rustAnalyzerBinary)||!M(e.file)||!Array.isArray(e.positions)||!e.positions.every(n=>S(n)&&M(n.id)&&M(n.file)&&p(n.line)&&p(n.column))?!1:I(e.requestTimeoutMs)&&I(e.readinessDeadlineMs)&&I(e.diagnosticsTimeoutMs)&&I(e.settleDelayMs)&&Pe(e.concurrency)}function Te(e){return Array.isArray(e)&&e.every(yn)}function G(e){return e===void 0||Te(e)}function yn(e){return S(e)&&p(e.symbolId)&&p(e.documentId)&&p(e.startLine)&&qe(e.startChar)&&p(e.endLine)&&qe(e.endChar)&&typeof e.symbol=="string"&&typeof e.relativePath=="string"&&typeof e.leaf=="string"&&(e.parentTypeName===null||typeof e.parentTypeName=="string")&&typeof e.isFunctionLike=="boolean"&&typeof e.isTypeLike=="boolean"&&(e.kind===null||Number.isSafeInteger(e.kind))&&(e.documentation===null||typeof e.documentation=="string")&&(e.enclosingSymbol===null||typeof e.enclosingSymbol=="string")}function Sn(e,n){return!S(e)||typeof e.available!="boolean"||e.available===!1&&(typeof e.reason!="string"||e.reason.length===0)||e.available===!0&&e.reason!==void 0?!1:n==="import-definitions"?Array.isArray(e.sourcePaths)&&e.sourcePaths.every(t=>Array.isArray(t)&&t.length===2&&typeof t[0]=="string"&&(t[1]===null||typeof t[1]=="string")):Ce(e.references,bn)&&(e.incompleteReferenceSymbolIds===void 0||Array.isArray(e.incompleteReferenceSymbolIds)&&e.incompleteReferenceSymbolIds.every(t=>Number.isSafeInteger(t)))&&(e.callees===void 0||Ce(e.callees,gn))&&(e.signatures===void 0||Array.isArray(e.signatures)&&e.signatures.every(t=>Array.isArray(t)&&t.length===2&&Number.isSafeInteger(t[0])&&(t[1]===null||typeof t[1]=="string")))}function Ce(e,n){return Array.isArray(e)&&e.every(t=>Array.isArray(t)&&t.length===2&&Number.isSafeInteger(t[0])&&Array.isArray(t[1])&&t[1].every(n))}function bn(e){return S(e)&&typeof e.file=="string"&&p(e.line)&&p(e.column)}function gn(e){return S(e)&&typeof e.symbol=="string"&&typeof e.file=="string"&&p(e.line)&&(e.callsiteLine===void 0||p(e.callsiteLine))}function In(e){return e==="unsupported-protocol"||e==="malformed-request"||e==="expired-request"||e==="handler-error"}function T(e){return{ok:!1,code:"malformed-request",error:e}}function Z(e){return{ok:!1,code:"malformed-response",error:e}}function ve(e){return{ok:!1,code:"incompatible-response",error:e}}function Pe(e){return e===void 0||Q(e)}function qe(e){return e===void 0||p(e)}function I(e){return e===void 0||Se(e)}function ee(e){return e===void 0||typeof e=="boolean"}import{spawn as Tn}from"child_process";import{createHash as Pn,randomUUID as Bn}from"crypto";import{existsSync as He,realpathSync as Nn,rmSync as On}from"fs";import{tmpdir as Un}from"os";import{resolve as _}from"path";import{execFileSync as An}from"child_process";import{existsSync as Dn}from"fs";import{deserializeSCIP as Mn,SymbolRole as hn}from"@c4312/scip";var te=new WeakMap,En="SCIP_RUST_SCIP_OCCURRENCE_REFERENCE_MODE";function kt(e,n){let t=new Map,r=L(),s=n.filter(u=>Ne(u,r));if(s.length===0)return t;let i=Oe(e);if(!i)return t;for(let u of s){let l=Be(i,u);l!==null&&t.set(u.symbolId,l)}return t}function xt(e,n){if(!Ne(n,L()))return null;let t=Oe(e);return t?Be(t,n):null}function Be(e,n){return e.referencesBySymbol.get(n.symbol)??[]}function Ne(e,n="safe"){if(!e.symbol.startsWith("rust-analyzer ")||!e.relativePath.endsWith(".rs")||Ee(e.symbol)||/impl#\[[^\]]+\]\[Default\]default\(\)\.$/.test(e.symbol))return!1;if(n==="all")return!0;let t=he(e.symbol);if(t==="method")return!0;if(t!=="term")return!1;let r=Me(e.symbol);return"kind"in r?!1:!kn(r)}function kn(e){for(let n=0;n<e.descriptors.length-1;n+=1)if(e.descriptors[n]?.suffix==="type")return!0;return!1}function Oe(e){if(te.has(e))return te.get(e)??null;let n=xn(e);return te.set(e,n),n}function xn(e){if(!e.generation.indexPath||!Dn(e.generation.indexPath))return null;try{let n=Mn(pe(e.generation.indexPath,{inputKind:"SCIP occurrence-reference index",maxBytes:de})),t=new Map;for(let r of n.documents??[]){let s=r.relativePath;if(!(!s||e.isIgnored(s)))for(let i of r.occurrences??[]){if(!i.symbol||(i.symbolRoles&hn.Definition)!==0)continue;let u=wn(s,i.range);if(!u)continue;let l=t.get(i.symbol)??[];l.push(u),t.set(i.symbol,l)}}for(let[r,s]of t)t.set(r,Ae(s));return{referencesBySymbol:t}}catch{return null}}function wn(e,n){if(n.length<3)return null;let t=n[0],r=n[1];return!Number.isInteger(t)||!Number.isInteger(r)?null:{file:e,line:t,column:r}}function L(){return process.env[En]==="all"?"all":"safe"}function Ue(e){let n=De(Ie,e),t=n.runnable;return t?{available:!0,dependencyAvailable:t,resolvedBinary:n.resolvedBinary??void 0,note:"rust-analyzer semantic reference queries are enabled."}:{available:!1,dependencyAvailable:t,resolvedBinary:n.resolvedBinary??void 0,reason:"rust-analyzer is not runnable; Rust semantic checks will use SCIP/source evidence only."}}var We=new Map;function re(e){let t=Ue(e).resolvedBinary??null;return{engine:"rust-analyzer",resolvedBinary:t,version:t?_n(e,t):"unavailable"}}function Tt(e){return{...re(e),scipOccurrenceReferenceMode:L()}}function _n(e,n){let t=`${e}\0${n}`,r=We.get(t);if(r)return r;let s;try{s=An(n,["--version"],{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3}).trim()}catch{s="unknown"}return We.set(t,s),s}import{createHash as Cn}from"crypto";var vn=new Set(["Cargo.lock","Cargo.toml","rust-project.json","rust-toolchain","rust-toolchain.toml"]);function Fe(e){let n=ge(e,{includePath:qn});return Cn("sha256").update(JSON.stringify(n)).digest("hex")}function qn(e){let n=e.replaceAll("\\","/"),t=n.split("/").at(-1)??n;return n.endsWith(".rs")||vn.has(t)?!0:n===".cargo/config"||n===".cargo/config.toml"||n.endsWith("/.cargo/config")||n.endsWith("/.cargo/config.toml")}var Wn=5e3,$e=10,Fn=3e4;function Le(e,n,t,r=en){let s=r.engineIdentity(e),i={protocolVersion:b,projectRoot:r.canonicalProjectRoot(e),projectFingerprint:r.projectFingerprint(e),engine:{engine:s.engine,resolvedBinary:s.resolvedBinary,version:s.version},workerFingerprint:r.fileFingerprint(n),environment:Je(r.environment())};return{key:se(A(i)),...i}}var je=class{constructor(n,t=Kn){this.createRequester=n;this.applyEnvironment=t}createRequester;applyEnvironment;requester=null;identityKey=null;semanticResponseCache=null;handle(n){this.applyEnvironment(n.workerEnvironment??{});let t;if(this.requester?this.identityKey!==n.identityKey?(this.semanticResponseCache=null,this.requester.shutdown(),this.requester=this.createRequester(),this.identityKey=n.identityKey,t="invalidated"):t="reused":(this.requester=this.createRequester(),this.identityKey=n.identityKey,t="created"),n.kind==="semantic"){let r=Ln(n.request),s=t==="reused"&&r!==null&&this.semanticResponseCache?.identityKey===n.identityKey&&this.semanticResponseCache.requestKey===r?this.semanticResponseCache.response:null;if(s)return Ke(!0,n.request.definitions.length),{session:t,response:s};let i=this.requester.requestSemantic(n.request,n.timeoutMs);return r!==null&&jn(i)&&(this.semanticResponseCache={identityKey:n.identityKey,requestKey:r,response:i}),Ke(!1,n.request.definitions.length),{session:t,response:i}}return{session:t,response:this.requester.requestImportDefinitions(n.request,n.timeoutMs)}}shutdown(){this.requester?.shutdown(),this.requester=null,this.identityKey=null,this.semanticResponseCache=null}};function Ln(e){if(e.includeReferences===!1||e.includeCallees!==!0||e.includeSignatures===!0||(e.referenceDefinitions?.length??0)===0||(e.calleeDefinitions?.length??0)===0)return null;let{readinessDeadlineMs:n,...t}=e;return se(A(t))}function jn(e){return e.available&&Array.isArray(e.callees)&&(e.incompleteReferenceSymbolIds?.length??0)===0}function Ke(e,n){C()&&v({type:"span",name:"rust.semantic.durable-session.response-cache",durationMs:0,ok:!0,hit:e,definitions:n})}function j(e,n,t,r){if(e.protocolVersion!==b||!t(e.pid))return!1;if(!e.processIdentity)return!0;let s=r?.(e.pid);return s!=null&&Re(e.processIdentity,s)}function Qe(e,n,t){let r;try{r=$(n,{maxBytes:E,inputKind:"Rust semantic engine artifact"})}catch{r="missing"}let s=se(A({projectRoot:_(e),serverPath:_(n),serverFingerprint:r})).slice(0,20);return _(t,`scip-query-rust-session-${s}`)}function ze(e){let n=e===void 0?Number.NaN:Number(e);return Number.isInteger(n)&&n>=0?n:0}function Je(e){return Object.fromEntries(Object.entries(e).filter(([n])=>Ge(n)).sort(([n],[t])=>n.localeCompare(t)).map(([n,t])=>[n,t??null]))}function Xe(e,n){let t=n.runtime??$n,r=n.identityRuntime??en,s=Qe(e,n.serverPath,n.tempRoot??Un()),i=!1,u=(l,d)=>{if(i)throw new Error("Durable Rust semantic session was already disposed.");return Vn(s,n.serverPath,n.semanticWorkerPath,l,d,t,n.mailboxLimits)};return{requestSemantic(l,d){let R=Le(e,n.semanticWorkerPath,l,r),{readinessDeadlineMs:c,...o}=l;return u({kind:"semantic",identityKey:R.key,workerEnvironment:Ye(),request:{...o,referenceRetryTimeoutMs:zn(process.env.SCIP_RUST_SEMANTIC_REFERENCE_RETRY_TIMEOUT_MS,l.referenceRetryTimeoutMs),settleDelayMs:process.env.SCIP_RUST_SEMANTIC_SETTLE_MS===void 0?l.settleDelayMs:ze(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS)},timeoutMs:d},d)},requestImportDefinitions(l,d){let R=Le(e,n.semanticWorkerPath,l,r),{readinessDeadlineMs:c,...o}=l;return u({kind:"import-definitions",identityKey:R.key,workerEnvironment:Ye(),request:{...o,settleDelayMs:process.env.SCIP_RUST_SEMANTIC_SETTLE_MS===void 0?l.settleDelayMs:ze(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS)},timeoutMs:d},d)},shutdown(){i=!0}}}function Kn(e){for(let n of Object.keys(process.env))Ze(n)&&delete process.env[n];for(let[n,t]of Object.entries(e))t!==null&&(process.env[n]=t)}function zn(e,n){return n!==void 0?n:e===void 0?Fn:void 0}function Vn(e,n,t,r,s,i,u={}){let l=i.now(),d=l+s,R=(i.monotonicNow??w)(),c=R+s,o=q("rust-semantic-v3",r),a=U(o),f=ke(e),m=F(e),y=xe(f,{mailboxVersion:k,protocolVersion:b,id:a,operationKey:o,clientId:i.randomId(),enqueuedAtMs:l,deadlineAtMs:d,sessionIdentity:m,request:r},{nowMs:l,limits:u});for(Ve(e,n,t,c,i);(i.monotonicNow??w)()<=c;){if(He(y.responsePath)){let D=Yn(x(y.responsePath,{maxBytes:u.maxItemBytes??E,inputKind:"durable Rust semantic mailbox response"}),{requestId:a,operationKey:o,sessionIdentity:m,deadlineAtMs:y.authoritativeDeadlineAtMs,requestKind:r.kind,nowMs:i.now()});if(!D.ok)throw new Error(D.error);return C()&&v({type:"span",name:"rust.semantic.durable-session.request",durationMs:(i.monotonicNow??w)()-R,ok:!0,session:D.session,kind:r.kind}),D.response}let h=K(e);(!h||!j(h,i.now(),i.isProcessAlive,i.readProcessIdentity))&&Ve(e,n,t,c,i),i.sleep($e)}throw new Error(`Durable Rust semantic session timed out after ${(s/1e3).toFixed(0)}s.`)}function Ve(e,n,t,r,s){let i=K(e);if(i&&j(i,s.now(),s.isProcessAlive,s.readProcessIdentity))return;On(_(e,"server.json"),{force:!0}),s.spawnServer(n,e,t);let u=s.monotonicNow??w,l=Math.min(r,u()+Wn);for(;u()<=l;){let d=K(e);if(d&&j(d,s.now(),s.isProcessAlive,s.readProcessIdentity))return;s.sleep($e)}throw new Error("Durable Rust semantic session helper did not become ready within 5s.")}function K(e){try{let n=JSON.parse(x(_(e,"server.json"),{maxBytes:ce,inputKind:"durable Rust session state"}));if(typeof n.protocolVersion!="number"||n.sessionIdentity!==void 0&&(typeof n.sessionIdentity!="string"||n.sessionIdentity!==F(e))||typeof n.pid!="number"||typeof n.heartbeatAtMs!="number"||n.busyUntilMs!==void 0&&typeof n.busyUntilMs!="number"||n.mailbox!==void 0&&!Hn(n.mailbox))return null;let t=n.processIdentity===void 0?null:fe(n.processIdentity);return n.processIdentity!==void 0&&(!t||t.pid!==n.pid)?null:{protocolVersion:n.protocolVersion,...n.sessionIdentity===void 0?{}:{sessionIdentity:n.sessionIdentity},pid:n.pid,...t?{processIdentity:t}:{},heartbeatAtMs:n.heartbeatAtMs,...n.busyUntilMs===void 0?{}:{busyUntilMs:n.busyUntilMs},...n.mailbox===void 0?{}:{mailbox:n.mailbox}}}catch{return null}}function Yn(e,n){try{return ne(JSON.parse(e),n)}catch(t){return{ok:!1,code:"malformed-response",error:`helper wrote malformed JSON: ${t instanceof Error?t.message:String(t)}`}}}function Hn(e){if(!e||typeof e!="object")return!1;let n=e;return p(n.pending)&&p(n.inflight)&&p(n.responses)&&p(n.deadLetters)&&p(n.invalid)&&p(n.totalItems)&&typeof n.totalBytes=="number"&&Number.isFinite(n.totalBytes)&&n.totalBytes>=0&&(n.oldestPendingAt===void 0||Number.isFinite(Date.parse(n.oldestPendingAt)))}function Ye(){return Object.fromEntries(Object.entries(process.env).filter(([e])=>Ze(e)).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,n??null]))}function Ge(e){return e==="HOME"||e==="PATH"||e.startsWith("CARGO_")||e.startsWith("RA_")||e.startsWith("RUST")}function Ze(e){return Ge(e)||e.startsWith("SCIP_RUST_")||e==="SCIP_QUERY_PROFILE"||e==="SCIP_QUERY_PROFILE_CACHE_STATE"||e==="SCIP_QUERY_PROFILE_COMMAND"||e==="SCIP_QUERY_PROFILE_OUT"||e==="SCIP_QUERY_PROFILE_RUN_ID"||e==="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY"||e==="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY_KIND"||e==="SCIP_QUERY_PROFILE_MIN_MS"}var en={canonicalProjectRoot(e){try{return Nn(e)}catch{return _(e)}},projectFingerprint(e){return Fe(e)},engineIdentity:re,fileFingerprint(e){return $(e,{maxBytes:E,inputKind:"Rust semantic engine artifact"})},environment(){return Je(process.env)}},$n={now:Date.now,monotonicNow:w,randomId:Bn,isProcessAlive:be,readProcessIdentity:me,spawnServer(e,n,t){if(!He(e))throw new Error(`Durable Rust semantic session helper was not found at ${e}. Run npm run build first.`);Tn(process.execPath,[e,n,t],{detached:!0,stdio:"ignore"}).unref()},sleep(e){let n=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(n,0,0,e)}};function se(e){return Pn("sha256").update(e).digest("hex")}import{existsSync as Qn,mkdtempSync as nn,rmSync as oe}from"fs";import{tmpdir as tn}from"os";import{join as ae}from"path";import{fileURLToPath as H,pathToFileURL as Jn}from"url";import{SHARE_ENV as Xn,Worker as Gn}from"worker_threads";function z(e,n,t=new Set){let r=new Map;for(let s of e)t.has(s.symbolId)||r.set(s.symbolId,n.get(s.symbolId)??[]);return r}function ie(e,n,t){let r=W(process.env.SCIP_RUST_SEMANTIC_BATCH_TIMEOUT_MS)??0;if(r>0)return r;let s=Math.max(1,Math.ceil(e/Math.max(1,t)));return Math.max(12e4,3e4+s*n)}var rn=15e3,sn=8,an=5e3,Zn=64,et=96,le=class{constructor(n,t,r={}){this.projectRoot=n;this.status=t;this.opts=r;this.requester=r.requester??it(n,process.env.SCIP_RUST_SEMANTIC_DURABLE_SESSION)}projectRoot;status;opts;requester;referencesForDefinitions(n){let t=this.status(this.projectRoot);if(!t.available||!t.resolvedBinary)return{available:!1,resolvedBinary:t.resolvedBinary,reason:B(t),references:N(n)};try{let r=this.requestSession(t.resolvedBinary,n,{includeReferences:!0});return{...P(r),resolvedBinary:t.resolvedBinary,references:z(n,new Map(r.references),new Set(r.incompleteReferenceSymbolIds??[]))}}catch(r){return this.opts.fallbackReferenceResolver?.referencesForDefinitions(n)??{available:!1,resolvedBinary:t.resolvedBinary,reason:r instanceof Error?r.message:String(r),references:N(n)}}}calleesForDefinitions(n){let t=this.status(this.projectRoot);if(!t.available||!t.resolvedBinary)return{available:!1,resolvedBinary:t.resolvedBinary,reason:B(t),callees:O(n)};try{let r=this.requestSession(t.resolvedBinary,n,{includeReferences:!1,includeCallees:!0});return{...P(r),resolvedBinary:t.resolvedBinary,callees:ue(n,new Map(r.callees??[]))}}catch(r){return this.opts.fallbackCalleeResolver?.calleesForDefinitions(n)??{available:!1,resolvedBinary:t.resolvedBinary,reason:r instanceof Error?r.message:String(r),callees:O(n)}}}referencesAndCalleesForDefinitions(n,t){let r=this.status(this.projectRoot);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:B(r),references:N(n),callees:O(t)};let s=[...n,...t];try{let i=this.requestSession(r.resolvedBinary,s,{includeReferences:n.length>0,includeCallees:t.length>0,referenceDefinitions:n,calleeDefinitions:t});return{...P(i),resolvedBinary:r.resolvedBinary,references:z(n,new Map(i.references),new Set(i.incompleteReferenceSymbolIds??[])),callees:ue(t,new Map(i.callees??[]))}}catch(i){return this.fallbackReferencesAndCallees(r,n,t,i)}}signaturesForDefinitions(n){let t=this.status(this.projectRoot);if(!t.available||!t.resolvedBinary)return{available:!1,resolvedBinary:t.resolvedBinary,reason:B(t),signatures:on(n)};try{let r=this.requestSession(t.resolvedBinary,n,{includeReferences:!1,includeCallees:!1,includeSignatures:!0});return{...P(r),resolvedBinary:t.resolvedBinary,signatures:ct(n,new Map(r.signatures??[]))}}catch(r){return this.opts.fallbackSignatureResolver?.signaturesForDefinitions(n)??{available:!1,resolvedBinary:t.resolvedBinary,reason:r instanceof Error?r.message:String(r),signatures:on(n)}}}importDefinitionsForFile(n,t){let r=this.status(this.projectRoot);if(t.length===0)return r.available?{available:!0,resolvedBinary:r.resolvedBinary,sourcePaths:new Map}:{available:!1,reason:r.reason,resolvedBinary:r.resolvedBinary,sourcePaths:new Map};if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:B(r),sourcePaths:new Map(t.map(s=>[s.id,null]))};try{let s=this.requestImportDefinitions(r.resolvedBinary,n,t);return{...P(s),resolvedBinary:r.resolvedBinary,sourcePaths:new Map(s.sourcePaths)}}catch(s){return{available:!1,resolvedBinary:r.resolvedBinary,reason:s instanceof Error?s.message:String(s),sourcePaths:new Map(t.map(i=>[i.id,null]))}}}dispose(){this.requester.shutdown()}requestSession(n,t,r){let s=V(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,rn),i=Y(process.env.SCIP_RUST_SEMANTIC_REFERENCE_RETRY_TIMEOUT_MS,0),u=V(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,sn),l=Y(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(s,1e4)),d=r.referenceDefinitions?[...r.referenceDefinitions]:void 0,R=r.calleeDefinitions?[...r.calleeDefinitions]:void 0,c=r.signatureDefinitions?[...r.signatureDefinitions]:void 0,o=nt(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:t.length,...r}),a={projectRoot:this.projectRoot,rustAnalyzerBinary:n,definitions:[...t],...d?{referenceDefinitions:d}:{},...R?{calleeDefinitions:R}:{},...c?{signatureDefinitions:c}:{},requestTimeoutMs:s,...r.includeReferences!==!1&&i>0?{referenceRetryTimeoutMs:i}:{},diagnosticsTimeoutMs:l,settleDelayMs:o,concurrency:u,includeReferences:r.includeReferences,includeCallees:r.includeCallees,includeSignatures:r.includeSignatures},f=dt(a);return X("rust.semantic.session.request",()=>this.requester.requestSemantic(a,ie(f,pt(s,a.referenceRetryTimeoutMs),u)),()=>({definitions:t.length,operationDefinitions:f,referenceDefinitions:a.referenceDefinitions?.length,calleeDefinitions:a.calleeDefinitions?.length,signatureDefinitions:a.signatureDefinitions?.length,references:a.includeReferences!==!1,callees:a.includeCallees===!0,signatures:a.includeSignatures===!0,referenceRetryTimeoutMs:a.referenceRetryTimeoutMs}))}fallbackReferencesAndCallees(n,t,r,s){let i=t.length===0?{available:!0,resolvedBinary:n.resolvedBinary,references:N(t)}:this.opts.fallbackReferenceResolver?.referencesForDefinitions(t),u=r.length===0?{available:!0,resolvedBinary:n.resolvedBinary,callees:O(r)}:this.opts.fallbackCalleeResolver?.calleesForDefinitions(r);if(i&&u){let l={resolvedBinary:i.resolvedBinary??u.resolvedBinary??n.resolvedBinary,references:z(t,i.references),callees:ue(r,u.callees)};return i.available&&u.available?{available:!0,...l}:{available:!1,reason:(i.available?void 0:i.reason)??(u.available?void 0:u.reason)??"Rust semantic fallback was unavailable.",...l}}return{available:!1,resolvedBinary:n.resolvedBinary,reason:s instanceof Error?s.message:String(s),references:N(t),callees:O(r)}}requestImportDefinitions(n,t,r){let s=V(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,rn),i=V(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,sn),u=Y(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(s,1e4)),l=Y(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,an),d={projectRoot:this.projectRoot,rustAnalyzerBinary:n,file:t,positions:[...r],requestTimeoutMs:s,diagnosticsTimeoutMs:u,settleDelayMs:l,concurrency:i};return X("rust.semantic.import-definitions.session.request",()=>this.requester.requestImportDefinitions(d,ie(r.length,s,i)),()=>({file:t,positions:r.length}))}};function P(e){return e.available?{available:!0}:{available:!1,reason:e.reason}}function B(e){return e.available?"rust-analyzer binary path is unavailable.":e.reason}function mr(e,n,t={}){return new le(e,n,t)}function nt(e,n){let t=ln(e);if(t!==null)return t;let r=n.includeReferences!==!1;return r&&n.includeCallees!==!0&&n.includeSignatures!==!0&&n.definitionCount<=Zn||r&&n.includeCallees===!0&&n.includeSignatures!==!0&&n.definitionCount<=et?0:an}function tt(e){let n=e?.trim().toLowerCase(),t=n==="0"||n==="false"||n==="off"||n==="worker",r=n==="1"||n==="true"||n==="on"||n==="durable",s=n===void 0||n==="";return{transport:t||!s&&!r?"worker":"durable",source:s?"default":"environment",fallback:"worker",valid:s||t||r,optOut:"SCIP_RUST_SEMANTIC_DURABLE_SESSION=0"}}function rt(e){return tt(e).transport}function st(e,n){let t=null,r=!1,s=!1,i=!1,u=()=>t??=n(),l=()=>{s||(e.shutdown(),s=!0)},d=(c,o,a)=>{let f=lt(c);r=!0;try{l()}catch{}C()&&v({type:"span",name:"rust.semantic.durable-session.request",durationMs:a,ok:!1,kind:o,session:"worker-fallback",reason:f})},R=(c,o,a)=>{if(i)throw new Error("Rust semantic failover session was already disposed.");if(r)return a(u());let f=performance.now();try{return o(e)}catch(m){d(m,c,performance.now()-f)}return a(u())};return{requestSemantic(c,o){return R("semantic",a=>a.requestSemantic(c,o),a=>a.requestSemantic(c,o))},requestImportDefinitions(c,o){return R("import-definitions",a=>a.requestImportDefinitions(c,o),a=>a.requestImportDefinitions(c,o))},shutdown(){if(i)return;i=!0;let c=[];try{l()}catch(o){c.push(o)}try{t?.shutdown()}catch(o){c.push(o)}if(c.length>0)throw c[0]}}}function it(e,n,t={worker:()=>ot(),durable:()=>Xe(e,{serverPath:H(ft()),semanticWorkerPath:H(un())})}){return rt(n)==="durable"?st(t.durable(),t.worker):t.worker()}function ot(e={}){let n=null,t=null,r=1,s=!1,i=null,u=null,l=o=>{o&&oe(o,{recursive:!0,force:!0})},d=()=>{if(i)return;let o=n,a=t;n=null,t=null;let f=o?o.terminate():Promise.resolve(0);i=Promise.allSettled([f,we(a,{gracefulMs:1e3,forceMs:1e3})]).then(([m,y])=>{let D=(y.status==="fulfilled"?y.value:[{reaped:!1,detail:String(y.reason)}]).filter(g=>!g.reaped);if(m.status==="rejected"||D.length>0){u=new Error(`Rust semantic worker cleanup did not complete; ownership evidence remains at ${a??"unknown"}.`);return}l(a)}).finally(()=>{i=null})},R=()=>{if(n)return n;if(i)throw new Error("The previous Rust semantic session worker is still terminating; retry the request.");if(u)throw u;let o=e.semanticWorkerPath?Jn(e.semanticWorkerPath):un();if(!Qn(H(o)))throw new Error(`Rust semantic session worker was not found at ${H(o)}. Run npm run build before using built semantic Rust queries.`);return t=nn(ae(tn(),"scip-query-rust-session-")),n=new Gn(o,e.shareEnvironment?{env:Xn}:void 0),n.unref(),n},c=()=>{let o=t??nn(ae(tn(),"scip-query-rust-session-"));return t=o,ae(o,`${r++}.json`)};return{requestSemantic(o,a){if(s)throw new Error("Rust semantic session was already disposed.");let f=R(),m=c(),y=new SharedArrayBuffer(4),h=new Int32Array(y);if(f.postMessage({kind:"semantic",request:o,responsePath:m,sharedBuffer:y}),Atomics.wait(h,0,0,a)==="timed-out")throw d(),new Error(`Rust semantic session worker timed out after ${(a/1e3).toFixed(0)}s`);try{let g=at(x(m,{maxBytes:E,inputKind:"Rust semantic worker response"}));if(!g.ok)throw new Error(g.error);return g.response}finally{oe(m,{force:!0})}},requestImportDefinitions(o,a){if(s)throw new Error("Rust semantic session was already disposed.");let f=R(),m=c(),y=new SharedArrayBuffer(4),h=new Int32Array(y);if(f.postMessage({kind:"import-definitions",request:o,responsePath:m,sharedBuffer:y}),Atomics.wait(h,0,0,a)==="timed-out")throw d(),new Error(`Rust semantic import-definition session worker timed out after ${(a/1e3).toFixed(0)}s`);try{let g=ut(x(m,{maxBytes:E,inputKind:"Rust import-definition worker response"}));if(!g.ok)throw new Error(g.error);return g.response}finally{oe(m,{force:!0})}},shutdown(){if(s)return;if(s=!0,!n){l(t),t=null;return}let o=c(),a=new SharedArrayBuffer(4),f=new Int32Array(a);n.postMessage({kind:"shutdown",responsePath:o,sharedBuffer:a}),Atomics.wait(f,0,0,5e3),d()}}}function at(e){let n=JSON.parse(e);if(!n||typeof n!="object")return{ok:!1,error:"Rust semantic session worker wrote a non-object response."};let t=n;return t.ok===!0&&"response"in t?{ok:!0,response:t.response}:{ok:!1,error:typeof n.error=="string"?n.error:"Rust semantic session worker failed."}}function ut(e){let n=JSON.parse(e);if(!n||typeof n!="object")return{ok:!1,error:"Rust semantic session worker wrote a non-object response."};let t=n;return t.ok===!0&&"response"in t?{ok:!0,response:t.response}:{ok:!1,error:typeof n.error=="string"?n.error:"Rust semantic session worker failed."}}function lt(e){let n=e instanceof Error?`${e.name} ${e.message}`.toLowerCase():String(e).toLowerCase();return n.includes("readiness")?"readiness":n.includes("timeout")||n.includes("timed out")?"timeout":n.includes("helper")?"helper":"request"}function N(e){return new Map(e.map(n=>[n.symbolId,[]]))}function O(e){return new Map(e.map(n=>[n.symbolId,[]]))}function on(e){return new Map(e.map(n=>[n.symbolId,null]))}function ue(e,n){return new Map(e.map(t=>[t.symbolId,n.get(t.symbolId)??[]]))}function ct(e,n){return new Map(e.map(t=>[t.symbolId,n.get(t.symbolId)??null]))}function dt(e){let n=0;return e.includeReferences!==!1&&(n+=(e.referenceDefinitions??e.definitions).length),e.includeCallees===!0&&(n+=(e.calleeDefinitions??e.definitions).length),e.includeSignatures===!0&&(n+=(e.signatureDefinitions??e.definitions).length),Math.max(1,n)}function pt(e,n){return n&&n>0?Math.max(e,n):e}function un(){return new URL("./rust-semantic-session-worker.js",import.meta.url)}function ft(){return new URL("./rust-semantic-session-server.js",import.meta.url)}function V(e,n){return W(e)??n}function Y(e,n){return ln(e)??n}function ln(e){if(!e)return null;let n=Number(e);return Number.isInteger(n)&&n>=0?n:null}export{kt as a,xt as b,Ue as c,Tt as d,b as e,F as f,pn as g,je as h,z as i,ie as j,mr as k,nt as l,ot as m,pt as n};
2
- //# sourceMappingURL=chunk-WSLEJSFR.js.map