codebaseiq 0.2.0 → 0.3.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 (402) hide show
  1. package/CHANGELOG.md +44 -2
  2. package/README.md +1 -1
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/{chunk-2DMVFAY7.js → chunk-23C5AD3B.js} +2 -2
  5. package/dist/{chunk-WH5SYOMD.js → chunk-2E6OUPCF.js} +2 -2
  6. package/dist/{chunk-RWKEXCHU.js → chunk-2EDX3JT5.js} +2 -2
  7. package/dist/chunk-2I2UHZET.js +2 -0
  8. package/dist/{chunk-CSZOQ7YO.js → chunk-2OMXFE64.js} +2 -2
  9. package/dist/{chunk-EXMVF3JR.js → chunk-2PRONPAS.js} +3 -3
  10. package/dist/{chunk-5WXOEJ4G.js → chunk-356EZBIP.js} +2 -2
  11. package/dist/{chunk-A7XQT7MH.js → chunk-36JC5BG2.js} +2 -2
  12. package/dist/{chunk-RRPK327J.js → chunk-3RR2K7EZ.js} +2 -2
  13. package/dist/{chunk-3NUZVLR7.js → chunk-3RSBGWGL.js} +2 -2
  14. package/dist/{chunk-MTMF4N7F.js → chunk-3VJ3OCRE.js} +2 -2
  15. package/dist/{chunk-IBM3F2BJ.js → chunk-4LK5OIPW.js} +2 -2
  16. package/dist/{chunk-FQA3KIFX.js → chunk-5DSL3NT2.js} +2 -2
  17. package/dist/{chunk-IYBIBMPF.js → chunk-5FWR5HLG.js} +2 -2
  18. package/dist/{chunk-CIVYHK7U.js → chunk-5IC2WZAL.js} +2 -2
  19. package/dist/{chunk-PARCKE3Q.js → chunk-5IZRKWTZ.js} +2 -2
  20. package/dist/{chunk-HHBBGWES.js → chunk-5LL4KEHO.js} +2 -2
  21. package/dist/chunk-5T44HG5Y.js +88 -0
  22. package/dist/{chunk-YFQPWKHR.js → chunk-5ZI2PPI7.js} +2 -2
  23. package/dist/{chunk-T3YFIJ5P.js → chunk-67VJAYVR.js} +2 -2
  24. package/dist/{chunk-DKJXK3HA.js → chunk-6BF3VYEF.js} +2 -2
  25. package/dist/chunk-6JMAVFL4.js +3 -0
  26. package/dist/chunk-6O3KXIDL.js +2 -0
  27. package/dist/{chunk-OJFLPVBP.js → chunk-6VREELBC.js} +2 -2
  28. package/dist/chunk-6WAPPQ5F.js +82 -0
  29. package/dist/{chunk-QLTFXVUI.js → chunk-75KJGYX7.js} +2 -2
  30. package/dist/{chunk-PLZXWZHY.js → chunk-7GAK2F3H.js} +2 -2
  31. package/dist/{chunk-X5I2BQGX.js → chunk-7JELP5YE.js} +2 -2
  32. package/dist/{chunk-W3FK73MD.js → chunk-7UCDGXRW.js} +2 -2
  33. package/dist/{chunk-CMXW7MFV.js → chunk-AEXQYQD7.js} +2 -2
  34. package/dist/{chunk-PHPQ24UG.js → chunk-AQI4N64O.js} +2 -2
  35. package/dist/{chunk-XUJM6474.js → chunk-AURCQHSG.js} +2 -2
  36. package/dist/{chunk-EM5UHLAM.js → chunk-BBP7HVBJ.js} +2 -2
  37. package/dist/{chunk-57KFVPVZ.js → chunk-BFBIMTCJ.js} +2 -2
  38. package/dist/{chunk-VVCBMH5O.js → chunk-BGGB5N53.js} +2 -2
  39. package/dist/{chunk-ZOEDRCR4.js → chunk-BRQL7AFJ.js} +2 -2
  40. package/dist/{chunk-KDYQQJ6X.js → chunk-BWL3PMPT.js} +2 -2
  41. package/dist/{chunk-M7LAIM77.js → chunk-C6WKPKCF.js} +2 -2
  42. package/dist/{chunk-2F5ERMNI.js → chunk-C7OUW52M.js} +2 -2
  43. package/dist/{chunk-N3Q3AWGW.js → chunk-C7QWUBR2.js} +96 -96
  44. package/dist/{chunk-BX2U3QQV.js → chunk-CCIYWXX6.js} +2 -2
  45. package/dist/{chunk-3AC56WAR.js → chunk-CIYA2KZN.js} +2 -2
  46. package/dist/{chunk-35YYZD3D.js → chunk-CR3OG6SQ.js} +2 -2
  47. package/dist/{chunk-VYZQZ4ZN.js → chunk-CVHOQONG.js} +2 -2
  48. package/dist/{chunk-4IFISPQW.js → chunk-CW6AXOLR.js} +2 -2
  49. package/dist/{chunk-NDGTJHQN.js → chunk-D53LWANR.js} +2 -2
  50. package/dist/{chunk-VCWAJPXQ.js → chunk-D7AZAOZX.js} +2 -2
  51. package/dist/{chunk-ACZDU5GK.js → chunk-D7DOB27N.js} +7 -7
  52. package/dist/{chunk-CDWSLAPN.js → chunk-DAKIGMIK.js} +2 -2
  53. package/dist/chunk-DDN2F6GB.js +2 -0
  54. package/dist/{chunk-L3YSDLNB.js → chunk-DVWO7RBC.js} +2 -2
  55. package/dist/{chunk-KNV5VFDV.js → chunk-E52K4L2W.js} +2 -2
  56. package/dist/chunk-EIBGSU2R.js +2 -0
  57. package/dist/chunk-EQNMD62X.js +51 -0
  58. package/dist/{chunk-LY2NB5XR.js → chunk-EXZ7VLRY.js} +2 -2
  59. package/dist/{chunk-YIOQJ45A.js → chunk-F3QSL4W2.js} +2 -2
  60. package/dist/{chunk-JOALNFY3.js → chunk-F74LZWCE.js} +2 -2
  61. package/dist/{chunk-ZB3V5QM7.js → chunk-FEIZXBLH.js} +2 -2
  62. package/dist/{chunk-NJA4MMBD.js → chunk-FH5WG4LE.js} +2 -2
  63. package/dist/{chunk-MRGTCMDK.js → chunk-FOZ74V56.js} +2 -2
  64. package/dist/{chunk-S5SKXCND.js → chunk-FQTIFWLR.js} +2 -2
  65. package/dist/chunk-FTTV7IRX.js +355 -0
  66. package/dist/chunk-FWQGH2N2.js +2 -0
  67. package/dist/{chunk-PFPHS4NO.js → chunk-GDHWOA57.js} +2 -2
  68. package/dist/{chunk-H3CKAL6P.js → chunk-GIDCP7KV.js} +2 -2
  69. package/dist/{chunk-6SDEQTVY.js → chunk-GL6UTNUB.js} +2 -2
  70. package/dist/{chunk-37TKC6MB.js → chunk-GP7C5VAE.js} +2 -2
  71. package/dist/{chunk-U24M5RQM.js → chunk-GQLDYCWS.js} +2 -2
  72. package/dist/{chunk-I5FCDTK2.js → chunk-GQXXOS55.js} +2 -2
  73. package/dist/{chunk-NTRW52UR.js → chunk-GUFPEFBG.js} +2 -2
  74. package/dist/{chunk-B2E3HZ2A.js → chunk-GV2CEZCW.js} +2 -2
  75. package/dist/{chunk-AM5SUGHF.js → chunk-GVAF222T.js} +2 -2
  76. package/dist/{chunk-TAJ6UGCO.js → chunk-GWYZVVKY.js} +3 -3
  77. package/dist/{chunk-NK76RSB6.js → chunk-HENP2O4A.js} +2 -2
  78. package/dist/{chunk-VG55NFXF.js → chunk-HINZQKSY.js} +2 -2
  79. package/dist/{chunk-6OVNYYY4.js → chunk-HQA7EBSK.js} +2 -2
  80. package/dist/{chunk-DLC6JDN7.js → chunk-HVFB3PME.js} +2 -2
  81. package/dist/{chunk-FY5V4V4F.js → chunk-I22IZYDI.js} +2 -2
  82. package/dist/{chunk-RVYLJDXC.js → chunk-ICUL7XRT.js} +2 -2
  83. package/dist/{chunk-QVHZB75Z.js → chunk-IHSLIIL3.js} +2 -2
  84. package/dist/{chunk-PNVZIJ57.js → chunk-ITSJMNUD.js} +2 -2
  85. package/dist/{chunk-XNUWRTYM.js → chunk-IZDPGOZR.js} +2 -2
  86. package/dist/chunk-J3GLP7Q5.js +3 -0
  87. package/dist/{chunk-BH5CE4LN.js → chunk-J7AMBVWF.js} +2 -2
  88. package/dist/{chunk-YXJ4IAHH.js → chunk-JCMFBF4Z.js} +2 -2
  89. package/dist/{chunk-ZJZQ7Q2Q.js → chunk-JFIA2JI3.js} +2 -2
  90. package/dist/{chunk-FIXYHQ3W.js → chunk-JLZLLLW5.js} +2 -2
  91. package/dist/{chunk-2E6BTWER.js → chunk-JSNTHRLQ.js} +2 -2
  92. package/dist/{chunk-77GHPR2R.js → chunk-JX6ZWDOS.js} +2 -2
  93. package/dist/{chunk-SRY26ITJ.js → chunk-JYI7CV25.js} +2 -2
  94. package/dist/chunk-K7JLSGCJ.js +8 -0
  95. package/dist/{chunk-DFPAZXLU.js → chunk-KPZGTB2O.js} +2 -2
  96. package/dist/{chunk-7Z7HCZ7J.js → chunk-LKUTSP4G.js} +2 -2
  97. package/dist/{chunk-HIEXRDJF.js → chunk-LMTSB3TB.js} +2 -2
  98. package/dist/{chunk-BLKYYQ7C.js → chunk-LONKINMJ.js} +95 -95
  99. package/dist/{chunk-SF34QLK2.js → chunk-LQHYYIOB.js} +2 -2
  100. package/dist/{chunk-HBQGKMM3.js → chunk-LZSQ6X7E.js} +2 -2
  101. package/dist/{chunk-RCPZOPV6.js → chunk-M2Y6PCFE.js} +2 -2
  102. package/dist/{chunk-WJOQC4P7.js → chunk-MEUHIDI3.js} +2 -2
  103. package/dist/{chunk-MT5W4DUG.js → chunk-MHWMEZDA.js} +2 -2
  104. package/dist/{chunk-FLLXYUOL.js → chunk-MQW6SJ4P.js} +2 -2
  105. package/dist/{chunk-57KEZDPT.js → chunk-MSI3K7PJ.js} +2 -2
  106. package/dist/chunk-MVRGB4KJ.js +278 -0
  107. package/dist/{chunk-27PHVDKL.js → chunk-MZNMASFM.js} +2 -2
  108. package/dist/{chunk-DVYG3JTA.js → chunk-NBCQZSGR.js} +2 -2
  109. package/dist/{chunk-NIO346UL.js → chunk-NBZKSTXP.js} +2 -2
  110. package/dist/{chunk-UWB5WMC2.js → chunk-NCJILOAK.js} +2 -2
  111. package/dist/{chunk-JN5LIBT3.js → chunk-NDKOVQFG.js} +2 -2
  112. package/dist/{chunk-W6C6QTXJ.js → chunk-NEWHKGVD.js} +2 -2
  113. package/dist/{chunk-HBXZAGY6.js → chunk-O2M3VNDY.js} +2 -2
  114. package/dist/chunk-OFGOOL6U.js +3 -0
  115. package/dist/{chunk-FEBLLMTL.js → chunk-OQUCBKOI.js} +2 -2
  116. package/dist/{chunk-5IO2APSS.js → chunk-P4NVCOM7.js} +2 -2
  117. package/dist/{chunk-SJZQ2PTZ.js → chunk-PFC44E6D.js} +2 -2
  118. package/dist/{chunk-LAGDJXFY.js → chunk-PHNCEUXX.js} +2 -2
  119. package/dist/{chunk-HYKSLTAR.js → chunk-PTQPPPG2.js} +2 -2
  120. package/dist/{chunk-5XEVXVTK.js → chunk-PUVNH4PO.js} +2 -2
  121. package/dist/chunk-Q23IMHXS.js +343 -0
  122. package/dist/{chunk-YYFV32WR.js → chunk-Q3ZCQY2Y.js} +2 -2
  123. package/dist/{chunk-OMBRP7BB.js → chunk-Q4XEU3UH.js} +2 -2
  124. package/dist/{chunk-I645ZF75.js → chunk-QEOWONKY.js} +2 -2
  125. package/dist/{chunk-JXHLB7TP.js → chunk-QMOZZ2VX.js} +2 -2
  126. package/dist/{chunk-2VKB5CMA.js → chunk-RCIGX23V.js} +2 -2
  127. package/dist/{chunk-J24VICI5.js → chunk-RIYJ4L33.js} +2 -2
  128. package/dist/{chunk-M4EVGA5S.js → chunk-RJVAPMHF.js} +3 -3
  129. package/dist/chunk-SB7NASHU.js +2 -0
  130. package/dist/{chunk-3XFJUWJE.js → chunk-SGMNWYTH.js} +2 -2
  131. package/dist/chunk-SMDIEDM4.js +27 -0
  132. package/dist/{chunk-IOVPAZWP.js → chunk-SX72EVMY.js} +2 -2
  133. package/dist/{chunk-WO47BIPY.js → chunk-T5X7DK6C.js} +2 -2
  134. package/dist/{chunk-CZEIHYMP.js → chunk-T6MQNNAC.js} +2 -2
  135. package/dist/chunk-T75DS2E6.js +21 -0
  136. package/dist/{chunk-57GCCPLS.js → chunk-TEANKHUU.js} +2 -2
  137. package/dist/{chunk-T55YPJGB.js → chunk-TJBOJUVN.js} +2 -2
  138. package/dist/{chunk-I2KP4AGR.js → chunk-TJWVT4DO.js} +2 -2
  139. package/dist/{chunk-KM4QRWI5.js → chunk-TNJGTQWO.js} +2 -2
  140. package/dist/{chunk-EFFMFK7C.js → chunk-TOTWJZIX.js} +2 -2
  141. package/dist/{chunk-QMGWSEPL.js → chunk-TPO7XC5Z.js} +2 -2
  142. package/dist/{chunk-54K6556S.js → chunk-U33PMPNW.js} +2 -2
  143. package/dist/{chunk-GXVDTHFC.js → chunk-U7NUXDQO.js} +2 -2
  144. package/dist/chunk-UC2FD2PS.js +4 -0
  145. package/dist/{chunk-TUTSO7UZ.js → chunk-UQE4XFSA.js} +2 -2
  146. package/dist/{chunk-4O52YNKL.js → chunk-UQYQBLJX.js} +2 -2
  147. package/dist/{chunk-FPDL2TUB.js → chunk-USOAJHY7.js} +2 -2
  148. package/dist/{chunk-JUO3Z644.js → chunk-UW6KD57C.js} +2 -2
  149. package/dist/{chunk-VLTUX4IF.js → chunk-VGWZ4MOY.js} +2 -2
  150. package/dist/{chunk-U2XX3BT4.js → chunk-VWYGCMV5.js} +2 -2
  151. package/dist/{chunk-IWAMYGPN.js → chunk-W7YLRXZE.js} +2 -2
  152. package/dist/{chunk-QKVTWODE.js → chunk-WK2IQJPK.js} +2 -2
  153. package/dist/{chunk-S64NCE2Z.js → chunk-WWCV4E6J.js} +2 -2
  154. package/dist/{chunk-IVJJNVSX.js → chunk-XMJ53WG4.js} +2 -2
  155. package/dist/{chunk-IGYAZPRX.js → chunk-XN3EKMLI.js} +2 -2
  156. package/dist/{chunk-FWY2PRIF.js → chunk-XQAVQVIL.js} +2 -2
  157. package/dist/{chunk-JYX5UZSZ.js → chunk-XQPPURLQ.js} +2 -2
  158. package/dist/{chunk-4AOOSCZ7.js → chunk-YHPG3S2U.js} +2 -2
  159. package/dist/{chunk-5BDK6QC3.js → chunk-YRKP7PM7.js} +2 -2
  160. package/dist/{chunk-4NHWNAWQ.js → chunk-YT4DVWUV.js} +2 -2
  161. package/dist/{chunk-5NJPH3QZ.js → chunk-YTJHCGYB.js} +2 -2
  162. package/dist/chunk-Z35GOVEH.js +2 -0
  163. package/dist/{chunk-K5G7SPAG.js → chunk-Z6RL7XOE.js} +4 -4
  164. package/dist/{chunk-OVKZM2XI.js → chunk-ZAFGY22Q.js} +2 -2
  165. package/dist/{chunk-A67HT5FR.js → chunk-ZB4C5TTR.js} +2 -2
  166. package/dist/{chunk-CWMHWD56.js → chunk-ZNH33XIB.js} +2 -2
  167. package/dist/{chunk-ZNQCR656.js → chunk-ZQ62NNKN.js} +2 -2
  168. package/dist/{cli-context-XEPPF4RX.js → cli-context-FJL2JHOE.js} +2 -2
  169. package/dist/{cli-context-TSADTXLB.js → cli-context-PQNWHMCQ.js} +2 -2
  170. package/dist/{cli-program-KJGQEM72.js → cli-program-UO7PZD6V.js} +2 -2
  171. package/dist/cli.js +1 -1
  172. package/dist/{code-CDe-mIjx.d.ts → code-DfX3xeWy.d.ts} +1 -1
  173. package/dist/{code-viewer-YGDON6SY.js → code-viewer-KIXEYQNJ.js} +2 -2
  174. package/dist/{code-viewer-ZCTHXQ5C.js → code-viewer-VHLBLIUM.js} +2 -2
  175. package/dist/{command-descriptors-5VAB2MZX.js → command-descriptors-F5P2V3NW.js} +129 -129
  176. package/dist/{command-descriptors-EAHKIRAG.js → command-descriptors-YCLATF5I.js} +130 -130
  177. package/dist/{db-DmRNdCtm.d.ts → db-BoG_PWYH.d.ts} +1 -1
  178. package/dist/direct-navigation-4XJTXIDT.js +2 -0
  179. package/dist/direct-navigation-J5MVYYAD.js +3 -0
  180. package/dist/{graph-evidence-Bs54NWws.d.ts → graph-evidence-D1jx1Cql.d.ts} +1 -1
  181. package/dist/{health-BnzbSLCE.d.ts → health-DkYBS5BI.d.ts} +1 -1
  182. package/dist/index.d.ts +1 -1
  183. package/dist/index.js +1 -1
  184. package/dist/invocation-command-descriptors-RWV4VAI4.js +2 -0
  185. package/dist/invocation-command-descriptors-U76PN7IY.js +3 -0
  186. package/dist/{scip-cli-BRFKkHQn.d.ts → maintenance-types-CdL5eQii.d.ts} +1 -20
  187. package/dist/output-continuation-command-BL25S26S.js +3 -0
  188. package/dist/output-continuation-command-BTETTXEC.js +2 -0
  189. package/dist/postinstall.js +1 -1
  190. package/dist/project-reindex-CRJU3IFG.js +2 -0
  191. package/dist/project-reindex-TQFCOA2O.js +3 -0
  192. package/dist/queries/affected.d.ts +1 -1
  193. package/dist/queries/affected.js +1 -1
  194. package/dist/queries/anchors.d.ts +1 -1
  195. package/dist/queries/anchors.js +1 -1
  196. package/dist/queries/architecture.d.ts +1 -1
  197. package/dist/queries/architecture.js +1 -1
  198. package/dist/queries/bottlenecks.d.ts +1 -1
  199. package/dist/queries/bottlenecks.js +1 -1
  200. package/dist/queries/by-kind.d.ts +1 -1
  201. package/dist/queries/by-kind.js +1 -1
  202. package/dist/queries/call-graph.d.ts +1 -1
  203. package/dist/queries/call-graph.js +1 -1
  204. package/dist/queries/change-surface.d.ts +1 -1
  205. package/dist/queries/change-surface.js +1 -1
  206. package/dist/queries/cleanup-plan.d.ts +1 -1
  207. package/dist/queries/cleanup-plan.js +1 -1
  208. package/dist/queries/co-change.d.ts +1 -1
  209. package/dist/queries/co-change.js +1 -1
  210. package/dist/queries/code.d.ts +2 -2
  211. package/dist/queries/code.js +1 -1
  212. package/dist/queries/complexity-hotspots.d.ts +1 -1
  213. package/dist/queries/complexity-hotspots.js +1 -1
  214. package/dist/queries/complexity.d.ts +1 -1
  215. package/dist/queries/complexity.js +1 -1
  216. package/dist/queries/context.d.ts +1 -1
  217. package/dist/queries/context.js +1 -1
  218. package/dist/queries/convergence.d.ts +1 -1
  219. package/dist/queries/convergence.js +1 -1
  220. package/dist/queries/coupling.d.ts +1 -1
  221. package/dist/queries/coupling.js +1 -1
  222. package/dist/queries/cycles.d.ts +1 -1
  223. package/dist/queries/cycles.js +1 -1
  224. package/dist/queries/dataflow.d.ts +1 -1
  225. package/dist/queries/dataflow.js +1 -1
  226. package/dist/queries/dead.d.ts +1 -1
  227. package/dist/queries/dead.js +1 -1
  228. package/dist/queries/decorative-checkers.d.ts +1 -1
  229. package/dist/queries/decorative-checkers.js +1 -1
  230. package/dist/queries/deep-chains.d.ts +1 -1
  231. package/dist/queries/deep-chains.js +1 -1
  232. package/dist/queries/dependence-slice.d.ts +2 -2
  233. package/dist/queries/dependence-slice.js +1 -1
  234. package/dist/queries/dependency-depth.d.ts +1 -1
  235. package/dist/queries/dependency-depth.js +1 -1
  236. package/dist/queries/deps.d.ts +1 -1
  237. package/dist/queries/deps.js +1 -1
  238. package/dist/queries/diff-impact.d.ts +1 -1
  239. package/dist/queries/diff-impact.js +1 -1
  240. package/dist/queries/doc-drift.d.ts +1 -1
  241. package/dist/queries/doc-drift.js +1 -1
  242. package/dist/queries/drift.d.ts +1 -1
  243. package/dist/queries/drift.js +1 -1
  244. package/dist/queries/duplicate-bodies.d.ts +1 -1
  245. package/dist/queries/duplicate-bodies.js +1 -1
  246. package/dist/queries/entry-map.d.ts +1 -1
  247. package/dist/queries/entry-map.js +1 -1
  248. package/dist/queries/evidence.d.ts +2 -2
  249. package/dist/queries/evidence.js +1 -1
  250. package/dist/queries/extract-candidates.d.ts +1 -1
  251. package/dist/queries/extract-candidates.js +1 -1
  252. package/dist/queries/fan.d.ts +1 -1
  253. package/dist/queries/fan.js +1 -1
  254. package/dist/queries/files.d.ts +1 -1
  255. package/dist/queries/files.js +1 -1
  256. package/dist/queries/health.d.ts +2 -2
  257. package/dist/queries/health.js +1 -1
  258. package/dist/queries/hierarchy.d.ts +1 -1
  259. package/dist/queries/hierarchy.js +1 -1
  260. package/dist/queries/hotspots.d.ts +1 -1
  261. package/dist/queries/hotspots.js +1 -1
  262. package/dist/queries/imports.d.ts +1 -1
  263. package/dist/queries/imports.js +1 -1
  264. package/dist/queries/incomplete-migration.d.ts +1 -1
  265. package/dist/queries/incomplete-migration.js +1 -1
  266. package/dist/queries/index.d.ts +4 -4
  267. package/dist/queries/index.js +1 -1
  268. package/dist/queries/isolated.d.ts +1 -1
  269. package/dist/queries/isolated.js +1 -1
  270. package/dist/queries/locality-candidates.d.ts +1 -1
  271. package/dist/queries/locality-candidates.js +1 -1
  272. package/dist/queries/members.d.ts +1 -1
  273. package/dist/queries/members.js +1 -1
  274. package/dist/queries/methods.d.ts +1 -1
  275. package/dist/queries/methods.js +1 -1
  276. package/dist/queries/not-implemented.d.ts +1 -1
  277. package/dist/queries/not-implemented.js +1 -1
  278. package/dist/queries/outline.d.ts +1 -1
  279. package/dist/queries/outline.js +1 -1
  280. package/dist/queries/passthrough-candidates.d.ts +1 -1
  281. package/dist/queries/passthrough-candidates.js +1 -1
  282. package/dist/queries/plan-context.d.ts +1 -1
  283. package/dist/queries/plan-context.js +1 -1
  284. package/dist/queries/react-component-duplicates.d.ts +1 -1
  285. package/dist/queries/react-component-duplicates.js +1 -1
  286. package/dist/queries/react-hook-candidates.d.ts +1 -1
  287. package/dist/queries/react-hook-candidates.js +1 -1
  288. package/dist/queries/react-large-component-pressure.d.ts +1 -1
  289. package/dist/queries/react-large-component-pressure.js +1 -1
  290. package/dist/queries/recent-duplicates.d.ts +1 -1
  291. package/dist/queries/recent-duplicates.js +1 -1
  292. package/dist/queries/redundant-reexports.d.ts +1 -1
  293. package/dist/queries/redundant-reexports.js +1 -1
  294. package/dist/queries/reference-neighborhood.d.ts +1 -1
  295. package/dist/queries/reference-neighborhood.js +1 -1
  296. package/dist/queries/reference-reachability.d.ts +1 -1
  297. package/dist/queries/reference-reachability.js +1 -1
  298. package/dist/queries/refs.d.ts +1 -1
  299. package/dist/queries/refs.js +1 -1
  300. package/dist/queries/self-audit.d.ts +1 -1
  301. package/dist/queries/self-audit.js +1 -1
  302. package/dist/queries/similar-chains.d.ts +1 -1
  303. package/dist/queries/similar-chains.js +1 -1
  304. package/dist/queries/similar-files.d.ts +1 -1
  305. package/dist/queries/similar-files.js +1 -1
  306. package/dist/queries/similar-signatures.d.ts +1 -1
  307. package/dist/queries/similar-signatures.js +1 -1
  308. package/dist/queries/similar.d.ts +1 -1
  309. package/dist/queries/similar.js +1 -1
  310. package/dist/queries/slice.d.ts +1 -1
  311. package/dist/queries/slice.js +1 -1
  312. package/dist/queries/source-inspection.d.ts +3 -3
  313. package/dist/queries/source-inspection.js +1 -1
  314. package/dist/queries/source-search.d.ts +1 -1
  315. package/dist/queries/source-search.js +1 -1
  316. package/dist/queries/stale-abstractions.d.ts +1 -1
  317. package/dist/queries/stale-abstractions.js +1 -1
  318. package/dist/queries/stats.d.ts +1 -1
  319. package/dist/queries/surface.d.ts +1 -1
  320. package/dist/queries/surface.js +1 -1
  321. package/dist/queries/symbols.d.ts +1 -1
  322. package/dist/queries/symbols.js +1 -1
  323. package/dist/queries/system-map.d.ts +1 -1
  324. package/dist/queries/system-map.js +1 -1
  325. package/dist/queries/system.d.ts +1 -1
  326. package/dist/queries/system.js +1 -1
  327. package/dist/queries/test-quality.d.ts +1 -1
  328. package/dist/queries/test-quality.js +1 -1
  329. package/dist/queries/trace.d.ts +1 -1
  330. package/dist/queries/trace.js +1 -1
  331. package/dist/queries/twin-ab.d.ts +1 -1
  332. package/dist/queries/twin-ab.js +1 -1
  333. package/dist/queries/twin-drift.d.ts +1 -1
  334. package/dist/queries/twin-drift.js +1 -1
  335. package/dist/queries/unused-imports.d.ts +1 -1
  336. package/dist/queries/unused-imports.js +1 -1
  337. package/dist/queries/unused-params.d.ts +1 -1
  338. package/dist/queries/unused-params.js +1 -1
  339. package/dist/queries/value-flow.d.ts +2 -2
  340. package/dist/queries/value-flow.js +1 -1
  341. package/dist/queries/vue-component-duplicates.d.ts +1 -1
  342. package/dist/queries/vue-component-duplicates.js +1 -1
  343. package/dist/queries/vue-composable-candidates.d.ts +1 -1
  344. package/dist/queries/vue-composable-candidates.js +1 -1
  345. package/dist/queries/vue-large-view-pressure.d.ts +1 -1
  346. package/dist/queries/vue-large-view-pressure.js +1 -1
  347. package/dist/queries/wrapper-candidates.d.ts +1 -1
  348. package/dist/queries/wrapper-candidates.js +1 -1
  349. package/dist/reindex-worker.js +2 -2
  350. package/dist/reindex.d.ts +2 -4
  351. package/dist/reindex.js +71 -32
  352. package/dist/runtime.d.ts +1 -2
  353. package/dist/runtime.js +3 -3
  354. package/dist/rust-semantic-session-server.js +1 -1
  355. package/dist/rust-semantic-session-worker.js +1 -1
  356. package/dist/rust-semantic-worker.js +1 -1
  357. package/dist/sentinel-ensure-command-OSWGCFFL.js +3 -0
  358. package/dist/sentinel-ensure-command-SPW7XQLB.js +2 -0
  359. package/dist/sentinel-worker.js +1 -1
  360. package/dist/typescript-mailbox-worker.js +1 -1
  361. package/dist/watch-server.js +2 -2
  362. package/docs/INDEX_GENERATIONS.md +2 -2
  363. package/docs/NPM_RELEASE.md +323 -0
  364. package/docs/schemas/npm-release-state.schema.json +4 -13
  365. package/package.json +3 -11
  366. package/dist/chunk-2Q2LW5JW.js +0 -14
  367. package/dist/chunk-327YK6TB.js +0 -4
  368. package/dist/chunk-347TXATM.js +0 -2
  369. package/dist/chunk-36WRYYTE.js +0 -3
  370. package/dist/chunk-6OAHRI2D.js +0 -6
  371. package/dist/chunk-6URCE5QY.js +0 -2
  372. package/dist/chunk-6ZV5EDUT.js +0 -5
  373. package/dist/chunk-7R64XY4Y.js +0 -12
  374. package/dist/chunk-CANBLFVQ.js +0 -15
  375. package/dist/chunk-CCRZLRWJ.js +0 -2
  376. package/dist/chunk-G2XUZCF2.js +0 -88
  377. package/dist/chunk-H5QXP63L.js +0 -2
  378. package/dist/chunk-HCMQZPEO.js +0 -2
  379. package/dist/chunk-IEL6Q5W3.js +0 -308
  380. package/dist/chunk-IGQQUENU.js +0 -109
  381. package/dist/chunk-K2O7SBAU.js +0 -2
  382. package/dist/chunk-QVWDQTMG.js +0 -2
  383. package/dist/chunk-RJWAB4VR.js +0 -345
  384. package/dist/chunk-VCL7FK3E.js +0 -3
  385. package/dist/chunk-WOOTEWQT.js +0 -239
  386. package/dist/chunk-XYLV727H.js +0 -21
  387. package/dist/chunk-YMGZZEW4.js +0 -2
  388. package/dist/direct-navigation-B3SGOOBW.js +0 -2
  389. package/dist/direct-navigation-ZL362KXF.js +0 -3
  390. package/dist/invocation-command-descriptors-CSUGUHTT.js +0 -2
  391. package/dist/invocation-command-descriptors-PPVZOIE5.js +0 -3
  392. package/dist/output-continuation-command-FTVVBVSN.js +0 -2
  393. package/dist/output-continuation-command-ITPRC3YV.js +0 -3
  394. package/dist/project-reindex-7HZSLLLY.js +0 -3
  395. package/dist/project-reindex-NGM3DYBN.js +0 -2
  396. package/dist/sentinel-ensure-command-KYYULCFU.js +0 -2
  397. package/dist/sentinel-ensure-command-RIZA3RY7.js +0 -3
  398. package/docs/WINDOWS_SIDECAR_RELEASE.md +0 -424
  399. package/docs/schemas/windows-sidecar-provenance.schema.json +0 -137
  400. package/scripts/build-codebaseiq-windows.mjs +0 -197
  401. package/scripts/codebaseiq-windows-provenance.mjs +0 -364
  402. package/scripts/verify-codebaseiq-windows.mjs +0 -29
@@ -1,4 +1,4 @@
1
- import{a as O}from"./chunk-P5XHIJHI.js";import{h as H,t as v,v as M}from"./chunk-PLZXWZHY.js";import{execFileSync as U}from"child_process";var L=2e3,S=50,J=64,V=8,W=3,X=2160*60*60,Y=/\b(?:fix(?:es|ed)?|bug|regression|hotfix)\b/i,Z=3,Q=/#\d+|\b[A-Z][A-Z0-9]+-\d+\b/g,q=/^([a-z][a-z0-9-]+)(?:\([^)]+\))?!?:/i;function tt(t){let e=H(t,{clearGroups:["whole-project"]});return(i,n,r)=>{let o=r??P(i.config.projectRoot);if(!o)return null;let s=e.has(i)?e.get(i,()=>({head:"",value:null})):null;return s&&s.head===o?s.value:(e.invalidate(i),e.get(i,()=>({head:o,value:n(i.config.projectRoot,o)})).value)}}function F(t){let e=H(t,{clearGroups:["whole-project"]});return(i,n,r,o)=>{let s=o??P(i.config.projectRoot);if(!s)return null;let c=e.has(i)?e.get(i,()=>({head:"",values:new Map})):null;(!c||c.head!==s)&&e.invalidate(i);let l=e.get(i,()=>({head:s,values:new Map}));if(l.values.has(n))return l.values.get(n)??null;let d=r(i.config.projectRoot,s);return l.values.set(n,d),d}}var et=F("git-commit-history");function nt(t,e={}){let i=e.historyMode??"bounded",n=e.head;return{capability:r=>it(t,r,n),commitHistory:()=>x(t,i,n),fileChurn:()=>st(t,i,n),changeAmplification:()=>at(t,i,n),trackedFiles:()=>lt(t,n),fileAddRecords:()=>dt(t,i,n),coChangePairs:(r={})=>bt(t,r,i,n),coChangePairsForFiles:(r,o={})=>z(t,r,o,i,n),directionalCoChangePairsForFiles:(r,o={})=>yt(t,r,o,i,n)}}function x(t,e="bounded",i){return et(t,y(e),(n,r)=>rt(n,r,e),i)}function it(t,e,i){let n=i??P(t.config.projectRoot);return n?{slot:e,available:!0,head:n}:{slot:e,available:!1,head:null,reason:"git history is unavailable for this project"}}function P(t){try{return C(t,["rev-parse","HEAD"]).trim()||null}catch{return null}}function C(t,e){return U("git",["-C",t,...e],{encoding:"utf-8",maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"})}function rt(t,e,i){let n;try{n=C(t,["log","--no-merges","--name-only",...R(i),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}return{head:e,...w(n,S)}}function ot(t){return Y.test(t.subject)}function st(t,e,i){let n=x(t,e,i);if(!n)return null;let r=new Map;for(let o of n.commits){let s=ot(o);for(let c of o.files){let l=r.get(c)??{changes:0,fixChanges:0,lastChangedAt:0};l.changes+=1,s&&(l.fixChanges+=1),o.timestamp>l.lastChangedAt&&(l.lastChangedAt=o.timestamp),r.set(c,l)}}return r}function at(t,e,i){let n=x(t,e,i);if(!n||n.commits.length===0)return null;let r=n.commits.map(o=>o.files.length).filter(o=>o>0).sort((o,s)=>o-s);return r.length===0?null:{medianFilesPerCommit:D(r,.5),p90FilesPerCommit:D(r,.9),commitsAnalyzed:r.length}}function D(t,e){let i=Math.min(t.length-1,Math.floor(t.length*e));return t[i]}var ct=tt("git-tracked-files");function lt(t,e){return ct(t,i=>{try{let n=C(i,["ls-files"]);return new Set(n.split(`
1
+ import{a as O}from"./chunk-P5XHIJHI.js";import{h as H,t as v,v as M}from"./chunk-7GAK2F3H.js";import{execFileSync as U}from"child_process";var L=2e3,S=50,J=64,V=8,W=3,X=2160*60*60,Y=/\b(?:fix(?:es|ed)?|bug|regression|hotfix)\b/i,Z=3,Q=/#\d+|\b[A-Z][A-Z0-9]+-\d+\b/g,q=/^([a-z][a-z0-9-]+)(?:\([^)]+\))?!?:/i;function tt(t){let e=H(t,{clearGroups:["whole-project"]});return(i,n,r)=>{let o=r??P(i.config.projectRoot);if(!o)return null;let s=e.has(i)?e.get(i,()=>({head:"",value:null})):null;return s&&s.head===o?s.value:(e.invalidate(i),e.get(i,()=>({head:o,value:n(i.config.projectRoot,o)})).value)}}function F(t){let e=H(t,{clearGroups:["whole-project"]});return(i,n,r,o)=>{let s=o??P(i.config.projectRoot);if(!s)return null;let c=e.has(i)?e.get(i,()=>({head:"",values:new Map})):null;(!c||c.head!==s)&&e.invalidate(i);let l=e.get(i,()=>({head:s,values:new Map}));if(l.values.has(n))return l.values.get(n)??null;let d=r(i.config.projectRoot,s);return l.values.set(n,d),d}}var et=F("git-commit-history");function nt(t,e={}){let i=e.historyMode??"bounded",n=e.head;return{capability:r=>it(t,r,n),commitHistory:()=>x(t,i,n),fileChurn:()=>st(t,i,n),changeAmplification:()=>at(t,i,n),trackedFiles:()=>lt(t,n),fileAddRecords:()=>dt(t,i,n),coChangePairs:(r={})=>bt(t,r,i,n),coChangePairsForFiles:(r,o={})=>z(t,r,o,i,n),directionalCoChangePairsForFiles:(r,o={})=>yt(t,r,o,i,n)}}function x(t,e="bounded",i){return et(t,y(e),(n,r)=>rt(n,r,e),i)}function it(t,e,i){let n=i??P(t.config.projectRoot);return n?{slot:e,available:!0,head:n}:{slot:e,available:!1,head:null,reason:"git history is unavailable for this project"}}function P(t){try{return C(t,["rev-parse","HEAD"]).trim()||null}catch{return null}}function C(t,e){return U("git",["-C",t,...e],{encoding:"utf-8",maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"})}function rt(t,e,i){let n;try{n=C(t,["log","--no-merges","--name-only",...R(i),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}return{head:e,...w(n,S)}}function ot(t){return Y.test(t.subject)}function st(t,e,i){let n=x(t,e,i);if(!n)return null;let r=new Map;for(let o of n.commits){let s=ot(o);for(let c of o.files){let l=r.get(c)??{changes:0,fixChanges:0,lastChangedAt:0};l.changes+=1,s&&(l.fixChanges+=1),o.timestamp>l.lastChangedAt&&(l.lastChangedAt=o.timestamp),r.set(c,l)}}return r}function at(t,e,i){let n=x(t,e,i);if(!n||n.commits.length===0)return null;let r=n.commits.map(o=>o.files.length).filter(o=>o>0).sort((o,s)=>o-s);return r.length===0?null:{medianFilesPerCommit:D(r,.5),p90FilesPerCommit:D(r,.9),commitsAnalyzed:r.length}}function D(t,e){let i=Math.min(t.length-1,Math.floor(t.length*e));return t[i]}var ct=tt("git-tracked-files");function lt(t,e){return ct(t,i=>{try{let n=C(i,["ls-files"]);return new Set(n.split(`
2
2
  `).map(r=>r.trim()).filter(r=>r!==""))}catch{return null}},e)}var ut=F("git-file-adds"),_="__git__/file-adds",k=v({kind:"git-file-adds",invalidation:M("git-file-adds"),serialize:gt,deserialize:ft});function Ot(t){return nt(t).fileAddRecords()}function dt(t,e,i){let n=y(e);return ut(t,n,(r,o)=>mt(t,r,o,e),i)}function mt(t,e,i,n){let r=k.read(t,I(n),i);if(r)return r;let o=ht(e,n);return o&&k.write(t,I(n),i,o),o}function gt(t){return JSON.stringify([...t.entries()])}function ft(t){if(!t)return null;try{let e=JSON.parse(t);if(!Array.isArray(e))return null;let i=new Map;for(let n of e){if(!Array.isArray(n)||n.length!==2||typeof n[0]!="string")return null;let r=n[1];if(!r||typeof r.commitsAgo!="number"||!Number.isFinite(r.commitsAgo)||typeof r.addedAt!="number"||!Number.isFinite(r.addedAt))return null;i.set(n[0],{commitsAgo:r.commitsAgo,addedAt:r.addedAt})}return i}catch{return null}}function ht(t,e){let i;try{i=C(t,["log","--no-merges","--find-renames","--name-status",...R(e),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}let n=new Map,r=new Map,o=-1;for(let s of i.split("")){if(s.trim()==="")continue;o+=1;let c=s.indexOf(`
3
3
  `),l=c>=0?s.slice(0,c):s,[,d]=l.split("\0"),f=Number(d)||0;if(!(c<0))for(let u of s.slice(c+1).split(`
4
4
  `)){let a=pt(u);if(!a)continue;if(a.status==="R"&&a.from&&a.to){let p=r.get(a.to)??new Set([a.to]);r.set(a.from,p);continue}if(a.status!=="A"||!a.to)continue;let m={commitsAgo:o,addedAt:f};n.set(a.to,m);for(let p of r.get(a.to)??[])n.set(p,m)}}return n}function pt(t){let e=t.trim().split(" "),i=e[0]??"";if(!i)return null;let n=i[0]??"";if(n==="R"){let o=e[1],s=e[2];return o&&s?{status:n,from:o,to:s}:null}let r=e[1];return r?{status:n,to:r}:null}var j=F("git-co-change-pairs"),Ct=F("git-directional-co-change-pairs");function bt(t,e,i,n){let r=`all\0${y(i)}\0${T(e)}`,o=j(t,r,()=>{let s=x(t,i,n);return s?G(s,e):null},n);return o&&[...o]}function z(t,e,i,n,r){if(e.size===0)return[];let o=`files\0${y(n)}\0${B(e)}\0${T(i)}`,s=j(t,o,()=>{let c=x(t,n,r);return c?G(c,i,e):null},r);return s&&[...s]}function yt(t,e,i,n,r){if(e.size===0)return[];let o=i.maxFilesPerCommit??S;if(e.size>J)return z(t,e,i,n,r);let s=`directional\0${y(n)}\0${B(e)}\0${T({...i,maxFilesPerCommit:o})}`,c=Ct(t,s,(l,d)=>{let f=At(l,d,e,o,n);return f?G(f,i,e):null},r);return c&&[...c]}function T(t){let e=t.minTogether??4,i=t.minConfidence??.6,n=t.maxFilesPerCommit??S;return`${e}\0${i}\0${n}`}function B(t){return[...t].sort().join("\0")}function G(t,e,i){let{minTogether:n=4,minConfidence:r=.6,maxFilesPerCommit:o=S}=e,s=new Map,c=new Map,l=t.newestAnalyzedAt??0;for(let u of t.commits){let a=[...new Set(u.files)].sort();if(a.length>o)continue;t.newestAnalyzedAt===void 0&&u.timestamp>l&&(l=u.timestamp);let m=Ft(a),p=i===void 0||a.some(g=>i.has(g));for(let g of a)s.set(g,(s.get(g)??0)+1);if(p)for(let g=0;g<a.length;g++)for(let b=g+1;b<a.length;b++){if(i&&!i.has(a[g])&&!i.has(a[b]))continue;let A=`${a[g]}\0${a[b]}`,h=c.get(A)??{together:0,focusedTogether:0,broadTogether:0,lastTogetherAt:0,timestamps:[],subjects:[]};h.together+=1,m?h.broadTogether+=1:h.focusedTogether+=1,u.timestamp>h.lastTogetherAt&&(h.lastTogetherAt=u.timestamp),h.timestamps.push(u.timestamp),h.subjects.push(u.subject),c.set(A,h)}}let d=[],f=l-X;for(let[u,a]of c){let m=a.together;if(m<n)continue;let[p,g]=u.split("\0"),b=s.get(p)??m,A=s.get(g)??m,h=Math.max(m/b,m/A);if(h<r)continue;let $=a.broadTogether/m,E=a.timestamps.filter(K=>K>=f).length;d.push({fileA:p,fileB:g,together:m,confidence:h,changesA:b,changesB:A,focusedTogether:a.focusedTogether,broadTogether:a.broadTogether,broadCommitRatio:$,lastTogetherAt:a.lastTogetherAt,recentTogether:E,commitScope:Ht(a.broadTogether,m),recency:E>0?"recent":"stale",subjectContext:Pt(a.subjects)})}return d.sort((u,a)=>a.together-u.together||a.confidence-u.confidence||u.fileA.localeCompare(a.fileA)),d}function At(t,e,i,n,r){let o;try{o=xt(t,r)}catch{return null}if(o.length===0)return{head:e,commits:[],skippedBulkCommits:0,newestAnalyzedAt:0};let s;try{s=C(t,["log","--no-merges","--format=%H",...R(r),"--",...[...i].sort()])}catch{return null}let c=new Set(o.map(a=>a.hash)),l=s.split(`
@@ -6,4 +6,4 @@ import{a as O}from"./chunk-P5XHIJHI.js";import{h as H,t as v,v as M}from"./chunk
6
6
  `).map(n=>n.trim()).filter(n=>n!=="").map(n=>{let[r,o]=n.split("\0");return{hash:r??"",timestamp:Number(o)||0}}).filter(n=>n.hash!=="")}function R(t){return t==="full"?[]:["-n",String(N())]}function N(){return O(process.env.CODEBASEIQ_GIT_HISTORY_MAX_COMMITS)??L}function y(t){return t==="full"?"full":`bounded:${N()}`}function I(t){let e=y(t);return e===`bounded:${L}`?_:`${_}:${e}`}function St(t,e,i){for(let r=0;r<e.length;r+=20){let o=e.slice(r,r+20),s;try{s=C(t,["show","--no-walk=unsorted","--name-only","--pretty=format:%x01%H%x00%ct%x00%s",...o.map(l=>l.hash)])}catch{return e[0]?.timestamp??0}let c=w(s,i);if(c.commits.length>0)return c.commits[0].timestamp}return 0}function w(t,e){let i=[],n=0;for(let r of t.split("")){if(r.trim()==="")continue;let o=r.indexOf(`
7
7
  `),s=o>=0?r.slice(0,o):r,[c,l,d]=s.split("\0");if(!c||!l)continue;let f=o>=0?r.slice(o+1).split(`
8
8
  `).map(u=>u.trim()).filter(u=>u!==""):[];if(f.length>e){n+=1;continue}i.push({hash:c,timestamp:Number(l)||0,subject:d??"",files:f})}return{commits:i,skippedBulkCommits:n}}function Ft(t){return t.length>=V?!0:Rt(t).size>=W}function Rt(t){let e=new Set;for(let i of t){let n=i.indexOf("/");e.add(n>=0?i.slice(0,n):".")}return e}function Ht(t,e){return t===0?"focused":t/e>=.5?"broad-sweep":"mixed"}function Pt(t){let e=new Set,i=[],n=[];for(let r of t){!n.includes(r)&&n.length<Z&&n.push(r);for(let o of Tt(r))e.add(o);for(let o of r.match(Q)??[])i.includes(o)||i.push(o)}return{subjectLabels:[...e].sort(),issueRefs:i,sampleSubjects:n,externalIssueLabelStatus:"unavailable"}}function Tt(t){let e=new Set,i=q.exec(t)?.[1]?.toLowerCase();return i&&e.add(Gt(i)),/\b(?:feat|feature)\b/i.test(t)&&e.add("feature"),/\b(?:fix(?:es|ed)?|bug|regression|hotfix)\b/i.test(t)&&e.add("fix"),/\b(?:docs?|documentation|guide|readme)\b/i.test(t)&&e.add("docs"),/\brefactor(?:ing|ed)?\b/i.test(t)&&e.add("refactor"),/\btests?\b/i.test(t)&&e.add("test"),/\b(?:release|version|v\d+\.\d+)\b/i.test(t)&&e.add("release"),/\bchore\b/i.test(t)&&e.add("chore"),/\bbuild\b/i.test(t)&&e.add("build"),/\bci\b/i.test(t)&&e.add("ci"),/\bperf(?:ormance)?\b/i.test(t)&&e.add("perf"),[...e]}function Gt(t){return t==="feat"?"feature":t}export{nt as a,C as b,Ot as c};
9
- //# sourceMappingURL=chunk-BX2U3QQV.js.map
9
+ //# sourceMappingURL=chunk-CCIYWXX6.js.map
@@ -1,3 +1,3 @@
1
- import{H as P,I as ye,a as ae,b as le,d as _,r as U,s as H,t as pe,v as de,w as B,z as me}from"./chunk-M7LAIM77.js";import{d as E,e as ue}from"./chunk-DRENNWRG.js";import{q as fe}from"./chunk-IYBIBMPF.js";import{a as ce,e as O}from"./chunk-4NHWNAWQ.js";import{a as A,i as x}from"./chunk-R2NOK63J.js";import{aa as se,da as K,h as re}from"./chunk-4O52YNKL.js";import{existsSync as j}from"fs";import b from"path";var z=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function V(r,t){let e=t?b.dirname(b.join(r,t)):r,o=b.resolve(r);for(;e.startsWith(o);){for(let s of z){let c=b.join(e,s);if(j(c))return c}let i=b.dirname(e);if(i===e)break;e=i}for(let i of z){let s=b.join(r,i);if(j(s))return s}return null}function ge(r){let t=r.config.projectRoot,n=new Set(Ee(t,r.config.semantic?.typescript?.tsconfigs)),e=O(r,{includeIgnored:!1,extensions:U});for(let o of e){let i=V(t,o);i&&n.add(b.resolve(i))}if(n.size===0){let o=V(t);o&&n.add(b.resolve(o))}return[...n].filter(o=>!he(t,o)).sort((o,i)=>o.localeCompare(i))}function Ee(r,t=[]){let n=new Set;for(let e of t){let o=b.isAbsolute(e)?e:b.join(r,e);j(o)&&n.add(b.resolve(o))}for(let e of je(r))for(let o of z){let i=b.join(e,o);j(i)&&n.add(b.resolve(i))}if(n.size===0){let e=V(r);e&&n.add(b.resolve(e))}return[...n].filter(e=>!he(r,e)).sort((e,o)=>e.localeCompare(o))}function je(r){let t=b.join(r,"package.json");if(!j(t))return[];let n;try{n=JSON.parse(re(t,"project package manifest"))}catch{return[]}return(Array.isArray(n.workspaces)?n.workspaces:n.workspaces?.packages??[]).flatMap(o=>le(r,o))}function he(r,t){let n=b.relative(r,t).replace(/\\/g,"/");return n.startsWith("..")||n.includes("/node_modules/")||n.startsWith("node_modules/")||n.includes("/dist/")||n.startsWith("dist/")}import{performance as u}from"perf_hooks";function k(r,t,n){if(r.has(t))return r.get(t);let e=n();return r.set(t,e),e}import Ie from"path";import{realpathSync as Se}from"fs";function Ae(r,t){return r.getReferences().map(n=>{let e=n.getNode();return $(e,t)})}function Oe(r){let t=r;return typeof t.findReferences=="function"?t.findReferences():[]}function Me(r,t,n,e){let o=[];for(let i of Oe(r))for(let s of Ae(i,e))s.file===t.relativePath&&s.line>=t.startLine&&s.line<=t.endLine||o.push(s);for(let i of n)o.push(i);return L(o)}function Fe(r,t,n,e){let o=[],i=n?.getStart();for(let s of r.getReferences()){let c=s.getNode();w(e,c.getSourceFile().getFilePath())===t&&(i!==void 0&&c.getStart()===i||o.push({location:$(c,e),node:c}))}return o}function $(r,t){let n=r.getSourceFile(),e=n.getLineAndColumnAtPos(r.getStart());return{file:w(t,n.getFilePath())??n.getBaseName(),line:e.line-1,column:e.column-1}}function q(r,t,n){let e=r.getSourceFile(),o=G(e,r),i=r.getText(),s=new RegExp(`\\b${fe(i)}\\b`,"g"),c=e.getFullText().split(`
1
+ import{H as P,I as ye,a as ae,b as le,d as _,r as U,s as H,t as pe,v as de,w as B,z as me}from"./chunk-C6WKPKCF.js";import{d as E,e as ue}from"./chunk-DRENNWRG.js";import{q as fe}from"./chunk-5FWR5HLG.js";import{a as ce,e as O}from"./chunk-YT4DVWUV.js";import{a as A,i as x}from"./chunk-R2NOK63J.js";import{aa as se,da as K,h as re}from"./chunk-UQYQBLJX.js";import{existsSync as j}from"fs";import b from"path";var z=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function V(r,t){let e=t?b.dirname(b.join(r,t)):r,o=b.resolve(r);for(;e.startsWith(o);){for(let s of z){let c=b.join(e,s);if(j(c))return c}let i=b.dirname(e);if(i===e)break;e=i}for(let i of z){let s=b.join(r,i);if(j(s))return s}return null}function ge(r){let t=r.config.projectRoot,n=new Set(Ee(t,r.config.semantic?.typescript?.tsconfigs)),e=O(r,{includeIgnored:!1,extensions:U});for(let o of e){let i=V(t,o);i&&n.add(b.resolve(i))}if(n.size===0){let o=V(t);o&&n.add(b.resolve(o))}return[...n].filter(o=>!he(t,o)).sort((o,i)=>o.localeCompare(i))}function Ee(r,t=[]){let n=new Set;for(let e of t){let o=b.isAbsolute(e)?e:b.join(r,e);j(o)&&n.add(b.resolve(o))}for(let e of je(r))for(let o of z){let i=b.join(e,o);j(i)&&n.add(b.resolve(i))}if(n.size===0){let e=V(r);e&&n.add(b.resolve(e))}return[...n].filter(e=>!he(r,e)).sort((e,o)=>e.localeCompare(o))}function je(r){let t=b.join(r,"package.json");if(!j(t))return[];let n;try{n=JSON.parse(re(t,"project package manifest"))}catch{return[]}return(Array.isArray(n.workspaces)?n.workspaces:n.workspaces?.packages??[]).flatMap(o=>le(r,o))}function he(r,t){let n=b.relative(r,t).replace(/\\/g,"/");return n.startsWith("..")||n.includes("/node_modules/")||n.startsWith("node_modules/")||n.includes("/dist/")||n.startsWith("dist/")}import{performance as u}from"perf_hooks";function k(r,t,n){if(r.has(t))return r.get(t);let e=n();return r.set(t,e),e}import Ie from"path";import{realpathSync as Se}from"fs";function Ae(r,t){return r.getReferences().map(n=>{let e=n.getNode();return $(e,t)})}function Oe(r){let t=r;return typeof t.findReferences=="function"?t.findReferences():[]}function Me(r,t,n,e){let o=[];for(let i of Oe(r))for(let s of Ae(i,e))s.file===t.relativePath&&s.line>=t.startLine&&s.line<=t.endLine||o.push(s);for(let i of n)o.push(i);return L(o)}function Fe(r,t,n,e){let o=[],i=n?.getStart();for(let s of r.getReferences()){let c=s.getNode();w(e,c.getSourceFile().getFilePath())===t&&(i!==void 0&&c.getStart()===i||o.push({location:$(c,e),node:c}))}return o}function $(r,t){let n=r.getSourceFile(),e=n.getLineAndColumnAtPos(r.getStart());return{file:w(t,n.getFilePath())??n.getBaseName(),line:e.line-1,column:e.column-1}}function q(r,t,n){let e=r.getSourceFile(),o=G(e,r),i=r.getText(),s=new RegExp(`\\b${fe(i)}\\b`,"g"),c=e.getFullText().split(`
2
2
  `),a=[];for(let l=0;l<c.length;l++){if(l===o)continue;let f=c[l]??"";s.lastIndex=0;let p;for(;(p=s.exec(f))!==null;)a.push({file:t,line:l,column:p.index})}return L(a.filter(l=>w(n,Ie.join(n,l.file))===t))}function Y(r){for(let t=r;t;t=t.getParent()){let n=t.getKindName();if(n.includes("Type")||n==="InterfaceDeclaration"||n==="TypeAliasDeclaration")return!0;if(n==="CallExpression"||n==="NewExpression"||n==="ExpressionStatement")return!1}return!1}function G(r,t){return r.getLineAndColumnAtPos(t.getStart()).line-1}function L(r){let t=new Set,n=[];for(let e of r){let o=`${e.file}:${e.line}:${e.column}`;t.has(o)||(t.add(o),n.push(e))}return n}function w(r,t){let n=r||process.cwd(),e=be(n,t);if(e)return e;try{return be(Se(n),Se(t))}catch{return null}}function be(r,t){let n=Ie.relative(r,t).replace(/\\/g,"/");return!n||n===".."||n.startsWith("../")?null:n}function xe(r,t,n,e){let o=Ue(t,e);return o.size===0?new Map:He(r,n,o)}function Ue(r,t){let n=new Map;for(let e of P(r,t)){let o=E(e.symbol)??e.leaf;if(!o)continue;let i=n.get(o);i||(i=[],n.set(o,i)),i.push(e)}return n}function He(r,t,n){let e=new Map,o=new Map;return t.forEachDescendant(i=>{for(let s of Be(r,i)){let c=n.get(s);if(!c)continue;let a=G(t,i);for(let l of c){if(a<l.startLine-1||a>l.endLine+1)continue;let f=Math.abs(a-l.startLine),p=o.get(l.symbolId);p!==void 0&&p<=f||(o.set(l.symbolId,f),e.set(l.symbolId,i))}}}),e}function Be(r,t){let n=[],e=o=>{o&&!n.includes(o)&&n.push(o)};if("getNameNode"in t&&typeof t.getNameNode=="function"){let o=t.getNameNode();e(o?.getText())}if("getName"in t&&typeof t.getName=="function"){let o=t.getName();e(o)}return r.Node.isIdentifier(t)&&e(t.getText()),n}var $e=ce("ts-definition-leaf-candidates",{clearGroups:["definition-catalog"]});function ke(r,t,n,e){let o=Q(r,t),i=J(o.get(e)??[],n);if(i)return i;let s=[];for(let c of o.values())for(let a of c)((a.leaf||E(a.symbol)||"").includes(e)||a.symbol.includes(e))&&s.push(a);return J(s,n)}function X(r,t,n,e){return J(Q(r,t).get(e)??[],n)}function Te(r,t){let n=new Map;for(let[e,o]of Q(r,t)){let i=o[0];i&&n.set(e,i)}return n}function Q(r,t){return $e.get(r,t,()=>{let n=new Map;for(let e of P(r,t)){let o=e.leaf||E(e.symbol);if(!o)continue;let i=n.get(o);i||(i=[],n.set(o,i)),i.push({...e,leaf:o})}for(let e of n.values())e.sort((o,i)=>o.startLine-i.startLine||o.endLine-i.endLine||o.symbolId-i.symbolId);return n})}function J(r,t){let n=null,e=Number.POSITIVE_INFINITY;for(let o of r){let i=Math.abs(o.startLine-t);(i<e||i===e&&n&&o.startLine<n.startLine)&&(n=o,e=i)}return n}import We from"path";import{realpathSync as Ke}from"fs";function De(r,t){let n=new Map,e=null,o=null,i=()=>(o??=O(r,{extensions:U}),o),s=()=>(e??=x("typescript.source-file-index",()=>_e(r.config.projectRoot,t,i()),()=>({projects:t.length,indexedDocuments:i().length})),e),c=a=>H(a)?k(n,a,()=>{let l=Ce(r.config.projectRoot,a);if(!l)return null;for(let{project:f,sourceFiles:p}of s()){let d=p.get(l)??null;if(d||(d=f.addSourceFileAtPathIfExists(l)??null,d&&Z(p,d)),d)return{project:f,sourceFile:d}}return null}):null;return{sourceFile:a=>c(a)?.sourceFile??null,sourceFileMatch:c,indexedTypeScriptLikeDocuments:i}}function _e(r,t,n){let e=t.map(({project:o})=>{let i=new Map;for(let s of o.getSourceFiles())Z(i,s);return{project:o,sourceFiles:i}});for(let o of n){let i=Ce(r,o);if(i)for(let s of e){if(s.sourceFiles.has(i))break;let c=s.project.addSourceFileAtPathIfExists(i)??null;if(c){Z(s.sourceFiles,c);break}}}return e}function Z(r,t){let n=ee(t.getFilePath());r.set(n,t);try{r.set(ee(Ke(n)),t)}catch(e){if(!K(e))throw e}}function Ce(r,t){try{return ee(se(r,t,{inputKind:"indexed TypeScript source file"}).absolutePath)}catch(n){if(!K(n))throw n;return null}}function ee(r){return We.resolve(r)}function te(r,t){for(let n of r)if(t===n.name||t.startsWith(`${n.name}/`))return n.name;return null}function Ne(r){let t=`${r.relativeDir}/src`;return[`${t}/index.ts`,`${t}/index.tsx`,`${t}/index.mts`,`${t}/index.cts`]}function ne(r,t){try{return r()}catch{t?.();return}}var ze=32;function Yt(r,t){let n=x("typescript.provider.load",()=>pe());if(!n)return B("ts-morph is not installed");let e=x("typescript.provider.tsconfig-discovery",()=>ge(r));if(e.length===0)return B("no tsconfig found");try{let o=x("typescript.provider.project-bundles",()=>de(n,e),()=>({tsconfigs:e.length}));return Ve(r,n,o)}catch(o){return B(o instanceof Error?o.message:String(o),e[0],e)}}function Ve(r,t,n,e={}){return x("typescript.provider.construct",()=>new oe(r,t,n),()=>({tsconfigs:n.length,reusedProjects:e.reusedProjects===!0}))}var oe=class{constructor(t,n,e){this.db=t;this.tsMorph=n;this.projects=e;this.workspacePackages=ae(t.config.projectRoot),this.sourceFiles=De(t,e)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;compilerCheckerCache=new WeakMap;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;sourceFiles;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(t=>t.tsconfigPath)}}importUsage(t){return k(this.importUsageCache,t,()=>{let n=this.sourceFiles.sourceFile(t);if(!n)return[];let e=Ye();return x("typescript.import-usage.file",()=>this.importUsageForSourceFile(t,n,e),()=>({file:t,...e}))})}referencesFor(t){return k(this.referencesCache,t.symbolId,()=>{let n=this.nodeForDefinition(t);return this.referencesForDefinitionNode(t,n)})}referencesForDefinitions(t,n={}){let e=new Map,o=A(),i=[];for(let f of t){let p=this.referencesCache.get(f.symbolId);p?e.set(f.symbolId,p):i.push(f)}if(i.length===0)return e;let s=i,c=n.exact?[]:i.filter(f=>!ve(f));if(c.length>=ze){let f=this.referencesForDefinitionsBySymbolScan(c);if(f.incompleteFiles.size===0)for(let p of c){let d=f.references.get(p.symbolId)??[];this.referencesCache.set(p.symbolId,d),e.set(p.symbolId,d)}if(s=i.filter(p=>ve(p)),s.length===0)return e}let a=new Map;for(let f of s){let p=a.get(f.relativePath);p?p.push(f):a.set(f.relativePath,[f])}let l=[];for(let[f,p]of a){let d=Pe();x("typescript.references-map.file",()=>{let h=this.definitionNodesForFile(f);for(let m of p){o&&(d.cacheMisses+=1);let I=h.get(m.symbolId)??null;o&&(I?d.nodeHits+=1:d.nodeMisses+=1);try{let g=this.referencesForDefinitionNode(m,I,o?d:void 0);this.referencesCache.set(m.symbolId,g),e.set(m.symbolId,g)}catch{d.preciseSearchFailures+=1,l.push(m)}}},()=>({relativePath:f,definitions:p.length,...Le(d)}))}if(l.length>0){let f=this.referencesForDefinitionsBySymbolScan(l);if(f.incompleteFiles.size===0)for(let p of l){let d=f.references.get(p.symbolId)??[];this.referencesCache.set(p.symbolId,d),e.set(p.symbolId,d)}}return e}referenceFragmentsForFiles(t){let n=ye(this.db).filter(s=>H(s.relativePath)),e=t.filter(s=>this.sourceFiles.sourceFile(s)!==null),o=this.referencesForDefinitionsBySymbolScan(n,e),i=e.filter(s=>!o.incompleteFiles.has(s));return me(n,o.references,i)}referencesForDefinitionsBySymbolScan(t,n){let e=A(),o=Pe(),i=new Map,s=new Set,c=new Set(t.map(l=>l.symbolId)),a=new Map(t.map(l=>[l.symbolId,l]));for(let l of t)i.set(l.symbolId,[]);return x("typescript.references-map.inverted-scan",()=>{let l=e?u.now():0,f=n?this.packageImportReferencesForFiles(n):this.packageImportReferences();for(let y of t){let S=f.get(y.symbolId)??[];if(S.length>0){let T=i.get(y.symbolId)??[];T.push(...S),i.set(y.symbolId,T)}e&&(o.packageReferenceCount+=S.length)}e&&(o.packageRefsMs+=u.now()-l);let p=new Map,d=new Map,h=this.hierarchyTargetsForDefinitions(t),m=new Set(t.map(y=>y.leaf).filter(Boolean)),I=e?u.now():0;for(let y of n??this.sourceFiles.indexedTypeScriptLikeDocuments()){if(this.db.isIgnored(y))continue;let S=this.sourceFiles.sourceFile(y);if(!S)continue;e&&(o.scanFiles+=1),this.addReferencesFromSourceFileScan(S,y,c,a,h,m,p,d,i,e?o:void 0)||s.add(y)}e&&(o.scanMs+=u.now()-I);let g=e?u.now():0;this.addHierarchyMemberReferences(t,i,e?o:void 0),e&&(o.hierarchyMs+=u.now()-g);for(let[y,S]of i){let T=L(S);i.set(y,T),e&&(o.referenceCount+=T.length)}},()=>({definitions:t.length,...Le(o)})),{references:i,incompleteFiles:s}}addReferencesFromSourceFileScan(t,n,e,o,i,s,c,a,l,f){let p=this.compilerCheckerForSourceFile(t),d=t.compilerNode,h=Xe(t),m=!0,I=g=>{if(this.tsMorph.ts.isIdentifier(g)){if(f&&(f.identifiers+=1),!s.has(g.text)&&!h.has(g.text)){this.tsMorph.ts.forEachChild(g,I);return}let y=this.compilerReferenceSymbol(p,g,f,()=>{m=!1});if(y){let S;c.has(y)?S=c.get(y)??null:(S=this.referenceDefinitionFromCompilerSymbol(y),c.set(y,S)),f&&(S?f.targetHits+=1:f.targetMisses+=1);let T=k(a,y,()=>this.compilerSymbolKeys(y)),R=null,D=null,v=S&&e.has(S.symbolId)?o.get(S.symbolId):void 0;if(v&&(R=W(d,g),!Re(v,n,R))){let N=d.getLineAndCharacterOfPosition(g.getStart(d));D={file:n,line:N.line,column:N.character};let C=l.get(v.symbolId)??[];C.push(D),l.set(v.symbolId,C),f&&(f.requestedHits+=1)}for(let N of T)for(let C of i.get(N)?.values()??[]){if(R??=W(d,g),Re(C,n,R))continue;if(!D){let F=d.getLineAndCharacterOfPosition(g.getStart(d));D={file:n,line:F.line,column:F.character}}let M=l.get(C.symbolId)??[];M.push(D),l.set(C.symbolId,M),f&&(f.requestedHits+=1)}}}this.tsMorph.ts.forEachChild(g,I)};return I(d),m}hierarchyTargetsForDefinitions(t){let n=new Map;for(let e of t){let o=this.nodeForDefinition(e),i=o?.compilerNode;if(!i||!this.isHierarchyMethod(i))continue;let s=i.parent;if(!this.isHierarchyContainer(s))continue;let c=this.compilerCheckerForSourceFile(o.getSourceFile()),a=c.getSymbolAtLocation(i.name);if(a)for(let l of this.hierarchyMemberSymbols(c,s,a))for(let f of this.compilerSymbolKeys(l)){let p=n.get(f)??new Map;p.set(e.symbolId,e),n.set(f,p)}}return n}hierarchyMemberSymbols(t,n,e){let o=new Set,i=new Set,s=(c,a,l)=>{if(!i.has(c)){i.add(c),o.add(a);for(let f of l){let p=f.getProperty(e.name);p&&s(f,p,this.hierarchyAncestorTypesForType(t,f))}}};return s(t.getTypeAtLocation(n),e,this.hierarchyAncestorTypes(t,n)),o}addHierarchyMemberReferences(t,n,e){let o=new Map;for(let i of t){let s=this.nodeForDefinition(i),c=s?.compilerNode;if(!c||!this.isHierarchyMethod(c))continue;let a=c.parent;if(!this.isHierarchyContainer(a))continue;let l=this.compilerCheckerForSourceFile(s.getSourceFile()),f=l.getSymbolAtLocation(c.name);if(!f)continue;let p=c.getSourceFile(),d=p.getLineAndCharacterOfPosition(c.name.getStart(p)),h={definition:i,location:{file:i.relativePath,line:d.line,column:d.character}},m=n.get(i.symbolId)??[];for(let g of this.hierarchyMemberSymbols(l,a,f))if(g!==f)for(let y of this.compilerSymbolLocations(g))m.push(y),e&&(e.hierarchyReferences+=1);n.set(i.symbolId,m);let I=this.hierarchyRootMemberSymbols(l,a,f);for(let g of I){let y=o.get(g)??new Map;y.set(i.symbolId,h),o.set(g,y)}e&&(e.hierarchyDefinitions+=1)}for(let i of o.values())if(!(i.size<2)){e&&(e.hierarchyFamilies+=1);for(let{definition:s}of i.values()){let c=n.get(s.symbolId)??[];for(let a of i.values())a.definition.symbolId!==s.symbolId&&(c.push(a.location),e&&(e.hierarchyReferences+=1));n.set(s.symbolId,c)}}}hierarchyRootMemberSymbols(t,n,e){let o=new Set,i=new Set,s=(c,a,l)=>{if(i.has(c))return;i.add(c);let f=!1;for(let p of l){let d=p.getProperty(e.name);d&&(f=!0,s(p,d,this.hierarchyAncestorTypesForType(t,p)))}if(!f)for(let p of this.compilerSymbolKeys(a))o.add(p)};return s(t.getTypeAtLocation(n),e,this.hierarchyAncestorTypes(t,n)),o}compilerSymbolKeys(t){return(t.declarations??[]).map(n=>{let e=n.getSourceFile();return`${e.fileName}\0${n.getStart(e)}\0${t.name}`})}compilerSymbolLocations(t){let n=[];for(let e of t.declarations??[]){let o=e.getSourceFile(),i=w(this.db.config.projectRoot,o.fileName);if(!i)continue;let s=e.name,c=o.getLineAndCharacterOfPosition((s??e).getStart(o));n.push({file:i,line:c.line,column:c.character})}return n}baseTypes(t,n){try{return t.getBaseTypes(n)??[]}catch{return[]}}hierarchyAncestorTypes(t,n){let e=new Set(this.hierarchyAncestorTypesForType(t,t.getTypeAtLocation(n)));for(let o of n.heritageClauses??[])for(let i of o.types)e.add(t.getTypeAtLocation(i));return[...e]}hierarchyAncestorTypesForType(t,n){let e=new Set(this.baseTypes(t,n));for(let o of n.getSymbol()?.declarations??[])if(this.isHierarchyContainer(o))for(let i of o.heritageClauses??[])for(let s of i.types)e.add(t.getTypeAtLocation(s));return[...e]}isHierarchyMethod(t){return this.tsMorph.ts.isMethodDeclaration(t)||this.tsMorph.ts.isMethodSignature(t)}isHierarchyContainer(t){return this.tsMorph.ts.isClassDeclaration(t)||this.tsMorph.ts.isClassExpression(t)||this.tsMorph.ts.isInterfaceDeclaration(t)}compilerReferenceSymbol(t,n,e,o){e&&(e.symbolLookups+=1);let i=ne(()=>t.getSymbolAtLocation(n),o);if(i){if((i.flags&this.tsMorph.ts.SymbolFlags.Alias)===0)return i;try{return e&&(e.aliasResolutions+=1),t.getAliasedSymbol(i)}catch{return o?.(),i}}}calleesFor(t){if(this.calleesCache.has(t.symbolId))return this.calleesCache.get(t.symbolId)??[];let n=k(this.fileCalleesCache,t.relativePath,()=>this.calleeMapForFile(t.relativePath));if(n.incompleteSymbolIds.has(t.symbolId))throw new Error(`TypeScript callee evidence is incomplete for ${t.symbol}.`);let e=n.callees.get(t.symbolId)??[];return this.calleesCache.set(t.symbolId,e),e}calleesForDefinitions(t){let n=new Map,e=new Map;for(let o of t){if(this.calleesCache.has(o.symbolId)){n.set(o.symbolId,this.calleesCache.get(o.symbolId)??[]);continue}let i=e.get(o.relativePath);i?i.push(o):e.set(o.relativePath,[o])}for(let[o,i]of e){let s=this.fileCalleesCache.get(o),c=new Set(i.map(l=>l.symbolId)),a=s??this.calleeMapForFile(o,c);for(let l of i){if(a.incompleteSymbolIds.has(l.symbolId))continue;let f=a.callees.get(l.symbolId)??[];this.calleesCache.set(l.symbolId,f),n.set(l.symbolId,f)}}return n}referencesForDefinitionNode(t,n,e){let o=e?u.now():0,i=this.packageImportReferencesForDefinition(t);if(e&&(e.packageRefsMs+=u.now()-o,e.packageReferenceCount+=i.length),!n)return i;let s=e?u.now():0,c=Me(n,t,i,this.db.config.projectRoot);return e&&(e.semanticRefsMs+=u.now()-s,e.referenceCount+=c.length),c}signatureFor(t){return k(this.signatureCache,t.symbolId,()=>{let n=this.nodeForDefinition(t);if(!n||!this.tsMorph.Node.isFunctionDeclaration(n)&&!this.tsMorph.Node.isMethodDeclaration(n)&&!this.tsMorph.Node.isArrowFunction(n)&&!this.tsMorph.Node.isFunctionExpression(n)&&!this.tsMorph.Node.isConstructorDeclaration(n))return null;let e=n.getType().getCallSignatures()[0];if(!e)return null;let o=e.getParameters().map(s=>{let c=s.getDeclarations()[0],a=c?s.getTypeAtLocation(c).getText(c):s.getValueDeclaration()?.getType().getText()??"unknown";return we(a)}),i=e.getReturnType().getText(n);return`(${o.join(",")})=>${we(i)}`})}importUsageForSourceFile(t,n,e){let o=[],i=new Map;for(let s of n.getImportDeclarations()){e.declarations+=1;let c=_(this.db,t,s.getModuleSpecifierValue()),a=s.getImportClause()?.isTypeOnly()??!1;for(let l of ie(s)){e.entries+=1;let f=a?null:l.identifier?.getSymbol()?.compilerSymbol??null;!a&&l.identifier&&(f?e.bindingSymbols+=1:e.missingBindingSymbols+=1);let p={sourcePath:c,entry:l,typeOnlyDeclaration:a,bindingSymbol:f,references:[]};if(o.push(p),a||!l.localName||!f)continue;let d=i.get(l.localName);d?d.push(p):i.set(l.localName,[p])}}return i.size>0&&n.forEachDescendant(s=>{if(s.getKindName()!=="Identifier")return;let c=i.get(s.getText());if(!c||Ge(s))return;e.scannedIdentifiers+=1;let a=s.getSymbol()?.compilerSymbol;if(e.symbolLookups+=1,!!a){for(let l of c)if(l.bindingSymbol===a){l.references.push({location:$(s,this.db.config.projectRoot),node:s}),e.matchedReferences+=1;break}}}),o.map(s=>s.typeOnlyDeclaration?qe(t,s.sourcePath,s.entry):s.entry.identifier&&!s.bindingSymbol?(e.fallbackEntries+=1,this.valueImportUsageForEntry(t,s.sourcePath,s.entry)):this.valueImportUsageFromLocations(t,s.sourcePath,s.entry,s.references))}valueImportUsageForEntry(t,n,e){let o;try{o=e.identifier?e.identifier.findReferences():[]}catch{let s=e.identifier?q(e.identifier,t,this.db.config.projectRoot):[];return{importer:t,sourcePath:n,importedName:e.importedName,localName:e.localName,kind:e.kind,isTypeOnly:e.isTypeOnly,isUsed:e.isTypeOnly||s.length>0,isTypeUsed:e.isTypeOnly,isValueUsed:!e.isTypeOnly&&s.length>0,references:s}}let i=[];for(let s of o)for(let c of Fe(s,t,e.identifier,this.db.config.projectRoot))i.push(c);return this.valueImportUsageFromLocations(t,n,e,i)}valueImportUsageFromLocations(t,n,e,o){let i=o.some(a=>!Y(a.node)),s=o.some(a=>Y(a.node)),c=e.isTypeOnly;return{importer:t,sourcePath:n,importedName:e.importedName,localName:e.localName,kind:e.kind,isTypeOnly:c,isUsed:c||o.length>0,isTypeUsed:c||s,isValueUsed:i,references:o.map(a=>a.location)}}packageImportReferencesForDefinition(t){return this.packageImportReferences().get(t.symbolId)??[]}packageImportReferencesForFiles(t){let n=new Map,e=new Set;for(let i of t){let s=this.sourceFiles.sourceFile(i);if(s)for(let c of s.getImportDeclarations()){let a=te(this.workspacePackages,c.getModuleSpecifierValue());a&&e.add(a)}}if(e.size===0)return n;let o=this.packageExportsForNames(e);for(let i of t)this.addPackageImportReferencesForDocument(n,o,i);for(let[i,s]of n)n.set(i,L(s));return n}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let t=new Map,n=this.packageExports();for(let e of this.sourceFiles.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(t,n,e);for(let[e,o]of t)t.set(e,L(o));return this.packageImportReferenceIndex=t,t}addPackageImportReferencesForDocument(t,n,e){if(this.db.isIgnored(e))return;let o=this.sourceFiles.sourceFileMatch(e);if(o)for(let i of o.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(t,n,e,i)}addPackageImportReferencesForDeclaration(t,n,e,o){let i=te(this.workspacePackages,o.getModuleSpecifierValue());if(!i)return;let s=n.get(i);if(s)for(let c of ie(o)){if(c.kind!=="named"||!c.identifier)continue;let a=s.get(c.importedName);if(!a||a.size===0)continue;let l=q(c.identifier,e,this.db.config.projectRoot);l.length>0&&tt(t,a,l)}}packageExports(){return this.packageExportIndex?this.packageExportIndex:(this.packageExportIndex=this.packageExportsForNames(new Set(this.workspacePackages.map(t=>t.name))),this.packageExportIndex)}packageExportsForNames(t){let n=new Map;for(let e of this.workspacePackages){if(!t.has(e.name))continue;let o=new Map;for(let i of Ne(e))this.collectPackageExports(e,i,o,new Set);o.size>0&&n.set(e.name,o)}return n}collectPackageExports(t,n,e,o){if(o.has(n))return;o.add(n);let i=this.sourceFiles.sourceFile(n);if(i)for(let s of i.getExportDeclarations()){let c=s.getModuleSpecifierValue(),a=c?_(this.db,n,c):n;if(!a||!a.startsWith(`${t.relativeDir}/src/`))continue;let l=s.getNamedExports();if(l.length===0){if(s.isNamespaceExport())continue;this.collectPackageExports(t,a,e,o);continue}for(let f of l){let p=f.getNameNode().getText(),d=f.getAliasNode()?.getText()??p,h=this.indexedDefinitionByLeaf(a,p);if(!h)continue;let m=e.get(d);m||(m=new Set,e.set(d,m)),m.add(h.symbolId)}}}indexedDefinitionByLeaf(t,n){return k(this.indexedDefinitionLeafCache,t,()=>Te(this.db,t)).get(n)??null}nodeForDefinition(t){return k(this.definitionNodeCache,t.symbolId,()=>this.definitionNodesForFile(t.relativePath).get(t.symbolId)??null)}definitionNodesForFile(t){return k(this.fileDefinitionNodeCache,t,()=>{let n=this.sourceFiles.sourceFile(t);return n?xe(this.tsMorph,this.db,n,t):new Map})}referenceDefinitionFromCompilerSymbol(t){return this.definitionFromCompilerSymbol(t,void 0,!0)}definitionFromCompilerSymbol(t,n,e=!1){let o=t.name,i=n?u.now():0,s=t.declarations??[];n&&(n.declarationsMs+=u.now()-i,n.declarationChecks+=s.length);for(let c of s){let a=n?u.now():0,l=c.getSourceFile(),f=w(this.db.config.projectRoot,l.fileName),p=l.getLineAndCharacterOfPosition(c.getStart(l)).line;if(n&&(n.declarationLocationMs+=u.now()-a),!f||this.db.isIgnored(f))continue;let d=n?u.now():0,h=this.compilerDeclarationName(c),m=e?X(this.db,f,p,o)??(h&&h!==o?X(this.db,f,p,h):null):ke(this.db,f,p,o);if(n&&(n.indexedLookupMs+=u.now()-d),m)return{symbolId:m.symbolId,symbol:m.symbol,file:m.relativePath,line:m.startLine}}return null}compilerDeclarationName(t){let n=t.name;return n&&this.tsMorph.ts.isIdentifier(n)?n.text:null}calleeMapForFile(t,n){let e=A(),o=0,i=0,s=0,c=0,a=0,l=0,f=0,p=0,d=e?Ze():void 0;return x("typescript.callee-map.file",()=>{let h=e?u.now():0,m=this.sourceFiles.sourceFile(t);if(e&&(a=Math.round(u.now()-h)),!m)return{callees:new Map,incompleteSymbolIds:new Set};let I=e?u.now():0,g=P(this.db,t).sort((M,F)=>M.startLine-F.startLine||F.endLine-M.endLine);if(e&&(l=Math.round(u.now()-I)),o=g.length,g.length===0)return{callees:new Map,incompleteSymbolIds:new Set};let y=new Map,S=new Set,T=e?u.now():0,R=this.compilerCheckerForSourceFile(m),D=m.compilerNode;e&&(f=Math.round(u.now()-T));let v=new Map,N=M=>{if(this.tsMorph.ts.isCallExpression(M)||this.tsMorph.ts.isNewExpression(M)){e&&(i+=1);let F=this.semanticCalleeForCallNode(R,D,g,M,v,n,S,d);F&&(e&&(s+=1),Je(y,F.callerId,F.target))}this.tsMorph.ts.forEachChild(M,N)},C=e?u.now():0;N(D),e&&(p=Math.round(u.now()-C));for(let[M,F]of y)y.set(M,nt(F));return c=y.size,{callees:y,incompleteSymbolIds:S}},()=>({relativePath:t,definitions:o,callNodes:i,resolvedCallees:s,outputRows:c,requestedDefinitions:n?.size??o,sourceFileLookupMs:a,definitionsLoadMs:l,checkerLookupMs:f,traversalMs:p,...d?et(d):{}}))}semanticCalleeForCallNode(t,n,e,o,i,s,c,a){let l=a?u.now():0,f=Qe(e,W(n,o));if(a&&(a.callerLookupMs+=u.now()-l),!f)return null;if(s&&!s.has(f.symbolId))return a&&(a.skippedUnrequestedCallers+=1),null;let p=o.expression,d=this.compilerSymbolForExpression(t,p,a);d.incomplete&&c?.add(f.symbolId);let h=d.symbol,m=null;if(h)if(a&&(a.targetSymbolHits+=1),i.has(h))a&&(a.compilerSymbolCacheHits+=1),m=i.get(h)??null;else{a&&(a.compilerSymbolCacheMisses+=1);let I=a?u.now():0;m=this.definitionFromCompilerSymbol(h,a),a&&(a.targetLookupMs+=u.now()-I),i.set(h,m)}else a&&(a.targetMisses+=1);return m?{callerId:f.symbolId,target:{symbol:m.symbol,file:m.file,line:m.line,callsiteLine:W(n,o)}}:null}compilerSymbolForExpression(t,n,e){let o=!1,i=e?u.now():0,s=ne(()=>t.getSymbolAtLocation(n),()=>{o=!0});if(e&&(e.expressionSymbolMs+=u.now()-i),s)return{symbol:s,incomplete:!1};e&&(e.typeFallbacks+=1);let c=!1,a=e?u.now():0,l=ne(()=>t.getTypeAtLocation(n).getSymbol(),()=>{c=!0});return e&&(e.typeSymbolMs+=u.now()-a),{symbol:l,incomplete:!l&&(o||c)}}compilerCheckerForSourceFile(t){let n=t.getProject(),e=this.compilerCheckerCache.get(n);return e||(e=n.getTypeChecker().compilerObject,this.compilerCheckerCache.set(n,e)),e}};function ie(r){let t=[],n=r.getDefaultImport();n&&t.push({identifier:n,importedName:"default",localName:n.getText(),kind:"default",isTypeOnly:r.getImportClause()?.isTypeOnly()??!1});let e=r.getNamespaceImport();e&&t.push({identifier:e,importedName:"*",localName:e.getText(),kind:"namespace",isTypeOnly:r.getImportClause()?.isTypeOnly()??!1});for(let o of r.getNamedImports()){let i=o.getNameNode(),c=o.getAliasNode()??(i.getKindName()==="Identifier"?i:null);t.push({identifier:c,importedName:i.getText(),localName:c?.getText()??i.getText(),kind:"named",isTypeOnly:o.isTypeOnly()||(r.getImportClause()?.isTypeOnly()??!1)})}return t.length===0&&t.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),t}function qe(r,t,n){return{importer:r,sourcePath:t,importedName:n.importedName,localName:n.localName,kind:n.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function Ye(){return{declarations:0,entries:0,bindingSymbols:0,missingBindingSymbols:0,scannedIdentifiers:0,symbolLookups:0,matchedReferences:0,fallbackEntries:0}}function Ge(r){for(let t=r;t;t=t.getParent())if(t.getKindName()==="ImportDeclaration")return!0;return!1}function Je(r,t,n){let e=r.get(t);e||(e=[],r.set(t,e)),e.push(n)}function Xe(r){let t=new Set;for(let n of r.getImportDeclarations())for(let e of ie(n))e.localName&&t.add(e.localName);return t}function Qe(r,t){let n=null;for(let e of r)t<e.startLine||t>e.endLine||(!n||e.startLine>=n.startLine)&&(n=e);return n}function W(r,t){return r.getLineAndCharacterOfPosition(t.getStart(r)).line}function Re(r,t,n){return t===r.relativePath&&n>=r.startLine&&n<=r.endLine}function ve(r){return r.symbol.includes("#")?ue(r.symbol)==="type"&&r.relativePath.endsWith(".d.ts"):!1}function Ze(){return{callerLookupMs:0,expressionSymbolMs:0,typeSymbolMs:0,targetLookupMs:0,declarationsMs:0,declarationLocationMs:0,indexedLookupMs:0,compilerSymbolCacheHits:0,compilerSymbolCacheMisses:0,targetSymbolHits:0,targetMisses:0,typeFallbacks:0,declarationChecks:0,skippedUnrequestedCallers:0}}function et(r){return{...r,callerLookupMs:Math.round(r.callerLookupMs),expressionSymbolMs:Math.round(r.expressionSymbolMs),typeSymbolMs:Math.round(r.typeSymbolMs),targetLookupMs:Math.round(r.targetLookupMs),declarationsMs:Math.round(r.declarationsMs),declarationLocationMs:Math.round(r.declarationLocationMs),indexedLookupMs:Math.round(r.indexedLookupMs)}}function Pe(){return{cacheHits:0,cacheMisses:0,nodeHits:0,nodeMisses:0,scanFiles:0,identifiers:0,symbolLookups:0,aliasResolutions:0,targetHits:0,targetMisses:0,requestedHits:0,scanMs:0,packageRefsMs:0,semanticRefsMs:0,packageReferenceCount:0,referenceCount:0,preciseSearchFailures:0,hierarchyDefinitions:0,hierarchyFamilies:0,hierarchyReferences:0,hierarchyMs:0}}function Le(r){return{...r,scanMs:Math.round(r.scanMs),packageRefsMs:Math.round(r.packageRefsMs),semanticRefsMs:Math.round(r.semanticRefsMs),hierarchyMs:Math.round(r.hierarchyMs)}}function tt(r,t,n){for(let e of t){let o=r.get(e)??[];o.push(...n),r.set(e,o)}}function nt(r){let t=new Set,n=[];for(let e of r){let o=`${e.symbol}|${e.file}|${e.line}|${e.callsiteLine??""}`;t.has(o)||(t.add(o),n.push(e))}return n}function we(r){return r.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}export{ge as a,Ee as b,Yt as c,Ve as d};
3
- //# sourceMappingURL=chunk-3AC56WAR.js.map
3
+ //# sourceMappingURL=chunk-CIYA2KZN.js.map
@@ -1,2 +1,2 @@
1
- import{c as C}from"./chunk-NK76RSB6.js";import{a as k}from"./chunk-OJFLPVBP.js";import{f as w,m as P,n as Q}from"./chunk-VCL7FK3E.js";import{o as T}from"./chunk-BH5CE4LN.js";import{d as x}from"./chunk-AM5SUGHF.js";import{f as g}from"./chunk-JOALNFY3.js";import{z as b}from"./chunk-RVYLJDXC.js";function Y(e,n={}){let{samples:o=50,scope:s,maxDisagreements:u=5}=n,c=new C(e),l=F(c.productionCallableDefinitions({scope:s,minLoc:2,requireFunctionLikeSymbol:!0}),o),a=U(e,l);if(l.length===0||!a)return{available:!1,sampleSize:l.length,oracleCoverage:0,scores:[],topDisagreements:[]};let t={references:M(),callees:M()},r=[],m=0,d=a==="semantic"?P(e,l):{rows:new Map,incompleteSymbolIds:new Set,unavailableSymbolIds:new Set},y=a==="semantic"?Q(e,l):{rows:new Map,incompleteSymbolIds:new Set,unavailableSymbolIds:new Set},O=a==="source"?N(e,c,l):null;for(let i of l){let p=S(i,a==="semantic"?(d.rows.get(i.symbolId)??[]).map(f=>f.file):[...O?.referencesBySymbolId.get(i.symbolId)??[]]),E=S(i,a==="semantic"?(y.rows.get(i.symbolId)??[]).map(f=>f.file):[...O?.calleesBySymbolId.get(i.symbolId)??[]]),A=a!=="semantic"||!d.incompleteSymbolIds.has(i.symbolId)&&!d.unavailableSymbolIds.has(i.symbolId),D=a!=="semantic"||!y.incompleteSymbolIds.has(i.symbolId)&&!y.unavailableSymbolIds.has(i.symbolId);A&&D&&(m+=1);let R=S(i,T(e,i,{semanticEvidence:k}).map(f=>f.file)),B=S(i,(c.calleeMap([i],{semantic:!1}).get(i.symbolId)??[]).map(f=>f.file)),K=h(a,"references"),z=h(a,"callees");A?j(t.references,i,"references",R,p,K,r):t.references.skippedOracleUnavailable+=1,D?j(t.callees,i,"callees",B,E,z,r):t.callees.skippedOracleUnavailable+=1}return r.sort((i,p)=>p.cheapOnly.length+p.oracleOnly.length-(i.cheapOnly.length+i.oracleOnly.length)),{available:!0,sampleSize:l.length,oracleCoverage:l.length>0?v(m/l.length):0,oracleKind:a,scores:["references","callees"].map(i=>q(i,t[i],a)),topDisagreements:r.slice(0,u)}}function M(){return{comparedSymbols:0,agreed:0,cheapTotal:0,oracleTotal:0,skippedOraclePartial:0,skippedOracleUnavailable:0}}function F(e,n){let o=[...e].sort((c,l)=>c.symbolId-l.symbolId);if(o.length<=n)return o;let s=o.length/n,u=[];for(let c=0;c<n;c++)u.push(o[Math.floor(c*s)]);return u}function U(e,n){let o=n[0];if(!o)return null;if(I(e,o))return"source";try{if(w(e).capability("semantic-references",o.relativePath).available)return"semantic"}catch{}return n.some(s=>I(e,s))?"source":null}function S(e,n){let o=new Set;for(let s of n)s!==e.relativePath&&o.add(s);return o}function j(e,n,o,s,u,c,l){if(!c&&u.size===0){e.skippedOraclePartial+=1;return}e.comparedSymbols+=1,e.cheapTotal+=s.size,e.oracleTotal+=u.size;let a=[],t=[];for(let r of s)u.has(r)?e.agreed+=1:a.push(r);for(let r of u)s.has(r)||t.push(r);(a.length>0||t.length>0)&&l.push({symbol:x(n.symbol),question:o,cheapOnly:a,oracleOnly:t})}var _={references:!0,callees:!1};function q(e,n,o){let s=n.oracleTotal>0?n.agreed/n.oracleTotal:1,u=n.cheapTotal-n.agreed,c=h(o,e);return{question:e,comparedSymbols:n.comparedSymbols,precision:c&&n.cheapTotal>0?v(n.agreed/n.cheapTotal):null,recall:v(s),unverified:u,skippedOraclePartial:n.skippedOraclePartial,skippedOracleUnavailable:n.skippedOracleUnavailable}}function h(e,n){return e==="semantic"?_[n]:!1}function I(e,n){return b(n.relativePath)==="clojure"&&g(e,n.relativePath)!==null}function N(e,n,o){let s=new Map,u=new Map,c=o.filter(t=>I(e,t)),l=new Map;for(let t of c){let r=l.get(t.leaf)??[];r.push(t),l.set(t.leaf,r)}for(let t of n.sourceFiles()){if(b(t)!=="clojure")continue;let r=g(e,t);if(r)for(let m of r.fileIdentifiers)for(let d of l.get(m)??[])L(s,d.symbolId,t)}let a=new Map;for(let t of n.scopedDefinitions()){if(b(t.relativePath)!=="clojure")continue;let r=a.get(t.leaf)??[];r.push(t),a.set(t.leaf,r)}for(let t of c){let r=g(e,t.relativePath);if(r){for(let m of r.callSites)if(!(m.line<t.startLine||m.line>t.endLine))for(let d of a.get(m.calleeLeaf)??[])L(u,t.symbolId,d.relativePath)}}return{referencesBySymbolId:s,calleesBySymbolId:u}}function L(e,n,o){let s=e.get(n);if(s){s.add(o);return}e.set(n,new Set([o]))}function v(e){return Math.round(e*1e3)/1e3}export{Y as a};
2
- //# sourceMappingURL=chunk-35YYZD3D.js.map
1
+ import{c as C}from"./chunk-HENP2O4A.js";import{a as k}from"./chunk-6VREELBC.js";import{f as w,m as P,n as Q}from"./chunk-J3GLP7Q5.js";import{o as T}from"./chunk-J7AMBVWF.js";import{d as x}from"./chunk-GVAF222T.js";import{f as g}from"./chunk-F74LZWCE.js";import{z as b}from"./chunk-ICUL7XRT.js";function Y(e,n={}){let{samples:o=50,scope:s,maxDisagreements:u=5}=n,c=new C(e),l=F(c.productionCallableDefinitions({scope:s,minLoc:2,requireFunctionLikeSymbol:!0}),o),a=U(e,l);if(l.length===0||!a)return{available:!1,sampleSize:l.length,oracleCoverage:0,scores:[],topDisagreements:[]};let t={references:M(),callees:M()},r=[],m=0,d=a==="semantic"?P(e,l):{rows:new Map,incompleteSymbolIds:new Set,unavailableSymbolIds:new Set},y=a==="semantic"?Q(e,l):{rows:new Map,incompleteSymbolIds:new Set,unavailableSymbolIds:new Set},O=a==="source"?N(e,c,l):null;for(let i of l){let p=S(i,a==="semantic"?(d.rows.get(i.symbolId)??[]).map(f=>f.file):[...O?.referencesBySymbolId.get(i.symbolId)??[]]),E=S(i,a==="semantic"?(y.rows.get(i.symbolId)??[]).map(f=>f.file):[...O?.calleesBySymbolId.get(i.symbolId)??[]]),A=a!=="semantic"||!d.incompleteSymbolIds.has(i.symbolId)&&!d.unavailableSymbolIds.has(i.symbolId),D=a!=="semantic"||!y.incompleteSymbolIds.has(i.symbolId)&&!y.unavailableSymbolIds.has(i.symbolId);A&&D&&(m+=1);let R=S(i,T(e,i,{semanticEvidence:k}).map(f=>f.file)),B=S(i,(c.calleeMap([i],{semantic:!1}).get(i.symbolId)??[]).map(f=>f.file)),K=h(a,"references"),z=h(a,"callees");A?j(t.references,i,"references",R,p,K,r):t.references.skippedOracleUnavailable+=1,D?j(t.callees,i,"callees",B,E,z,r):t.callees.skippedOracleUnavailable+=1}return r.sort((i,p)=>p.cheapOnly.length+p.oracleOnly.length-(i.cheapOnly.length+i.oracleOnly.length)),{available:!0,sampleSize:l.length,oracleCoverage:l.length>0?v(m/l.length):0,oracleKind:a,scores:["references","callees"].map(i=>q(i,t[i],a)),topDisagreements:r.slice(0,u)}}function M(){return{comparedSymbols:0,agreed:0,cheapTotal:0,oracleTotal:0,skippedOraclePartial:0,skippedOracleUnavailable:0}}function F(e,n){let o=[...e].sort((c,l)=>c.symbolId-l.symbolId);if(o.length<=n)return o;let s=o.length/n,u=[];for(let c=0;c<n;c++)u.push(o[Math.floor(c*s)]);return u}function U(e,n){let o=n[0];if(!o)return null;if(I(e,o))return"source";try{if(w(e).capability("semantic-references",o.relativePath).available)return"semantic"}catch{}return n.some(s=>I(e,s))?"source":null}function S(e,n){let o=new Set;for(let s of n)s!==e.relativePath&&o.add(s);return o}function j(e,n,o,s,u,c,l){if(!c&&u.size===0){e.skippedOraclePartial+=1;return}e.comparedSymbols+=1,e.cheapTotal+=s.size,e.oracleTotal+=u.size;let a=[],t=[];for(let r of s)u.has(r)?e.agreed+=1:a.push(r);for(let r of u)s.has(r)||t.push(r);(a.length>0||t.length>0)&&l.push({symbol:x(n.symbol),question:o,cheapOnly:a,oracleOnly:t})}var _={references:!0,callees:!1};function q(e,n,o){let s=n.oracleTotal>0?n.agreed/n.oracleTotal:1,u=n.cheapTotal-n.agreed,c=h(o,e);return{question:e,comparedSymbols:n.comparedSymbols,precision:c&&n.cheapTotal>0?v(n.agreed/n.cheapTotal):null,recall:v(s),unverified:u,skippedOraclePartial:n.skippedOraclePartial,skippedOracleUnavailable:n.skippedOracleUnavailable}}function h(e,n){return e==="semantic"?_[n]:!1}function I(e,n){return b(n.relativePath)==="clojure"&&g(e,n.relativePath)!==null}function N(e,n,o){let s=new Map,u=new Map,c=o.filter(t=>I(e,t)),l=new Map;for(let t of c){let r=l.get(t.leaf)??[];r.push(t),l.set(t.leaf,r)}for(let t of n.sourceFiles()){if(b(t)!=="clojure")continue;let r=g(e,t);if(r)for(let m of r.fileIdentifiers)for(let d of l.get(m)??[])L(s,d.symbolId,t)}let a=new Map;for(let t of n.scopedDefinitions()){if(b(t.relativePath)!=="clojure")continue;let r=a.get(t.leaf)??[];r.push(t),a.set(t.leaf,r)}for(let t of c){let r=g(e,t.relativePath);if(r){for(let m of r.callSites)if(!(m.line<t.startLine||m.line>t.endLine))for(let d of a.get(m.calleeLeaf)??[])L(u,t.symbolId,d.relativePath)}}return{referencesBySymbolId:s,calleesBySymbolId:u}}function L(e,n,o){let s=e.get(n);if(s){s.add(o);return}e.set(n,new Set([o]))}function v(e){return Math.round(e*1e3)/1e3}export{Y as a};
2
+ //# sourceMappingURL=chunk-CR3OG6SQ.js.map
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{m as o}from"./chunk-PHPQ24UG.js";import{l as n}from"./chunk-G2XUZCF2.js";async function i(t){if(typeof t!="string"||t.length===0)throw new Error("Output continuation requires a cursor.");await o(t,n)}var u={id:"continue",command:"continue <cursor>",hidden:!0,description:"Continue an immutable output snapshot",renderShape:"custom",handler:i};export{u as a};
3
- //# sourceMappingURL=chunk-VYZQZ4ZN.js.map
2
+ import{m as o}from"./chunk-AQI4N64O.js";import{l as n}from"./chunk-5T44HG5Y.js";async function i(t){if(typeof t!="string"||t.length===0)throw new Error("Output continuation requires a cursor.");await o(t,n)}var u={id:"continue",command:"continue <cursor>",hidden:!0,description:"Continue an immutable output snapshot",renderShape:"custom",handler:i};export{u as a};
3
+ //# sourceMappingURL=chunk-CVHOQONG.js.map
@@ -1,4 +1,4 @@
1
- import{a as $}from"./chunk-OJFLPVBP.js";import{f as C}from"./chunk-57KEZDPT.js";import{a as F,c as _}from"./chunk-3XFJUWJE.js";import{A as x,d as E,f as A,t as M}from"./chunk-AM5SUGHF.js";import{z as R}from"./chunk-RVYLJDXC.js";function q(t,o,n={}){return P(t,o,n).rows}function G(t,o,n={}){return P(t,o,n)}function P(t,o,n){let{maxDepth:r=5,scope:c}=n,a=r===Number.MAX_SAFE_INTEGER,l=a?null:500,y=F(t,o);if(!y)return{rows:[],coverage:{status:"incomplete",edgeBasis:"reverse-static-call-or-reference-evidence",maxDepth:r,reachedDepth:0,perSymbolEvidenceLimit:l,remainingFrontierSymbols:0,reasons:["The requested symbol could not be resolved."],semanticEvidence:"incomplete"}};let m=[],u=new Set([y.symbolId]),s=new Set,e=[y],d=0,p=!1,h=!1,g=!1;for(let b=1;b<=r&&e.length!==0;b++){d=b;let v=[],S=C(t,e,{...a?{}:{limit:l+1},semanticEvidence:$});S.incompleteSymbolIds.size>0&&(h=!0),S.unavailableSymbolIds.size>0&&(g=!0);for(let w of e){let I=S.rows.get(w.symbolId)??[];l!==null&&I.length>l&&(p=!0);let L=l===null?I:I.slice(0,l);for(let i of T(t,w,c,L)){let N=`${i.file}|${i.shortName}`;if(i.symbolId!==null){if(u.has(i.symbolId))continue;u.add(i.symbolId)}else if(s.has(N))continue;s.add(N),m.push({symbol:i.symbol,shortName:i.shortName,file:i.file,depth:b}),i.symbolId!==null&&i.symbolMatch&&v.push(i.symbolMatch)}}e=v}m.sort((b,v)=>b.depth-v.depth||b.file.localeCompare(v.file));let D=e.length>0,f=[];return D&&f.push(`${e.length} symbol(s) remain eligible beyond depth ${r}.`),p&&f.push(`At least one symbol had more than ${l} incoming evidence row(s).`),h&&f.push("Compiler-resolved incoming evidence was incomplete for at least one traversed symbol."),g&&f.push("Compiler-resolved incoming evidence was unavailable for at least one traversed symbol."),f.length===0&&f.push("The discovered reverse evidence frontier was exhausted."),{rows:m,coverage:{status:h||g?"incomplete":D||p?"bounded":"accounted",edgeBasis:"reverse-static-call-or-reference-evidence",maxDepth:r,reachedDepth:d,perSymbolEvidenceLimit:l,remainingFrontierSymbols:e.length,reasons:f,semanticEvidence:h&&g?"incomplete-and-unavailable":h?"incomplete":g?"unavailable":"complete"}}}function T(t,o,n,r){let c=r.filter(s=>!t.isIgnored(s.file)).filter(s=>!n||s.file.includes(n)),a=new Set(c.map(s=>s.file)),l=[];for(let s of k(t,o,n)){if(a.has(s))continue;let e=M(t,s),d=e.length>0?x(e,e[0].startLine):null;l.push({symbol:d?.symbol??s,file:s})}let y=[...c,...l],m=[],u=new Set;for(let s of y){let e=_(t,s.symbol);if(!e){let p=`${s.file}|${s.symbol}`;if(u.has(p))continue;u.add(p),m.push({symbolId:null,symbol:s.symbol,shortName:E(s.symbol),file:s.file,symbolMatch:null});continue}if(e.symbolId===o.symbolId||t.isIgnored(e.relativePath)||!B(e))continue;let d=`${e.symbolId}|${e.relativePath}`;u.has(d)||(u.add(d),m.push({symbolId:e.symbolId,symbol:e.symbol,shortName:E(e.symbol),file:e.relativePath,symbolMatch:e}))}return m}function k(t,o,n){let r=n?"AND consumer_d.relative_path LIKE ?":"",c=[o.symbolId,o.documentId];return n&&c.push(`%${n}%`),new Set(t.all(`SELECT DISTINCT consumer_d.relative_path
1
+ import{a as $}from"./chunk-6VREELBC.js";import{f as C}from"./chunk-MSI3K7PJ.js";import{a as F,c as _}from"./chunk-SGMNWYTH.js";import{A as x,d as E,f as A,t as M}from"./chunk-GVAF222T.js";import{z as R}from"./chunk-ICUL7XRT.js";function q(t,o,n={}){return P(t,o,n).rows}function G(t,o,n={}){return P(t,o,n)}function P(t,o,n){let{maxDepth:r=5,scope:c}=n,a=r===Number.MAX_SAFE_INTEGER,l=a?null:500,y=F(t,o);if(!y)return{rows:[],coverage:{status:"incomplete",edgeBasis:"reverse-static-call-or-reference-evidence",maxDepth:r,reachedDepth:0,perSymbolEvidenceLimit:l,remainingFrontierSymbols:0,reasons:["The requested symbol could not be resolved."],semanticEvidence:"incomplete"}};let m=[],u=new Set([y.symbolId]),s=new Set,e=[y],d=0,p=!1,h=!1,g=!1;for(let b=1;b<=r&&e.length!==0;b++){d=b;let v=[],S=C(t,e,{...a?{}:{limit:l+1},semanticEvidence:$});S.incompleteSymbolIds.size>0&&(h=!0),S.unavailableSymbolIds.size>0&&(g=!0);for(let w of e){let I=S.rows.get(w.symbolId)??[];l!==null&&I.length>l&&(p=!0);let L=l===null?I:I.slice(0,l);for(let i of T(t,w,c,L)){let N=`${i.file}|${i.shortName}`;if(i.symbolId!==null){if(u.has(i.symbolId))continue;u.add(i.symbolId)}else if(s.has(N))continue;s.add(N),m.push({symbol:i.symbol,shortName:i.shortName,file:i.file,depth:b}),i.symbolId!==null&&i.symbolMatch&&v.push(i.symbolMatch)}}e=v}m.sort((b,v)=>b.depth-v.depth||b.file.localeCompare(v.file));let D=e.length>0,f=[];return D&&f.push(`${e.length} symbol(s) remain eligible beyond depth ${r}.`),p&&f.push(`At least one symbol had more than ${l} incoming evidence row(s).`),h&&f.push("Compiler-resolved incoming evidence was incomplete for at least one traversed symbol."),g&&f.push("Compiler-resolved incoming evidence was unavailable for at least one traversed symbol."),f.length===0&&f.push("The discovered reverse evidence frontier was exhausted."),{rows:m,coverage:{status:h||g?"incomplete":D||p?"bounded":"accounted",edgeBasis:"reverse-static-call-or-reference-evidence",maxDepth:r,reachedDepth:d,perSymbolEvidenceLimit:l,remainingFrontierSymbols:e.length,reasons:f,semanticEvidence:h&&g?"incomplete-and-unavailable":h?"incomplete":g?"unavailable":"complete"}}}function T(t,o,n,r){let c=r.filter(s=>!t.isIgnored(s.file)).filter(s=>!n||s.file.includes(n)),a=new Set(c.map(s=>s.file)),l=[];for(let s of k(t,o,n)){if(a.has(s))continue;let e=M(t,s),d=e.length>0?x(e,e[0].startLine):null;l.push({symbol:d?.symbol??s,file:s})}let y=[...c,...l],m=[],u=new Set;for(let s of y){let e=_(t,s.symbol);if(!e){let p=`${s.file}|${s.symbol}`;if(u.has(p))continue;u.add(p),m.push({symbolId:null,symbol:s.symbol,shortName:E(s.symbol),file:s.file,symbolMatch:null});continue}if(e.symbolId===o.symbolId||t.isIgnored(e.relativePath)||!B(e))continue;let d=`${e.symbolId}|${e.relativePath}`;u.has(d)||(u.add(d),m.push({symbolId:e.symbolId,symbol:e.symbol,shortName:E(e.symbol),file:e.relativePath,symbolMatch:e}))}return m}function k(t,o,n){let r=n?"AND consumer_d.relative_path LIKE ?":"",c=[o.symbolId,o.documentId];return n&&c.push(`%${n}%`),new Set(t.all(`SELECT DISTINCT consumer_d.relative_path
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents consumer_d ON consumer_d.id = c.document_id
@@ -7,4 +7,4 @@ import{a as $}from"./chunk-OJFLPVBP.js";import{f as C}from"./chunk-57KEZDPT.js";
7
7
  AND c.document_id != ?
8
8
  ${t.pathExclusionsFor("consumer_d")}
9
9
  ${r}`,...c).map(a=>a.relative_path).filter(a=>!t.isIgnored(a)))}function B(t){if(t.symbol.startsWith("scip-clojure ")||R(t.relativePath)==="clojure")return!0;let o=A(t.symbol);return o==="method"||o==="type"||t.symbol.endsWith("().")}export{q as a,G as b};
10
- //# sourceMappingURL=chunk-4IFISPQW.js.map
10
+ //# sourceMappingURL=chunk-CW6AXOLR.js.map
@@ -1,2 +1,2 @@
1
- import{d as x}from"./chunk-5BDK6QC3.js";import{f,g as p}from"./chunk-CSZOQ7YO.js";import{a as L}from"./chunk-4AOOSCZ7.js";import{b as D}from"./chunk-B75HZHUP.js";import{c as E}from"./chunk-NK76RSB6.js";import{a as C}from"./chunk-BGBBVSH4.js";import{a as v}from"./chunk-OJFLPVBP.js";import{b as y}from"./chunk-57KEZDPT.js";import{b}from"./chunk-3XFJUWJE.js";import{d as m,t as g}from"./chunk-AM5SUGHF.js";import{c as u,f as h}from"./chunk-JOALNFY3.js";var A=/^(?:validate|verify|check|assert)(?:[A-Z].*)?$/,N=/^(?:is|has)(?:[A-Z].*)?$/,I=/[{,]\s*(?:ok|success|valid|isValid)\s*:\s*false\b/,d=/\breturn\b/g,k=/\bfunction\b|=>|\)\s*(?::\s*[^{;=]+)?\s*\{/,w=/\.(?:addIssue|push)\s*\(/;function M(e,n={}){let{scope:t,limit:o=30,scanLimit:i}=n,c=new E(e),r=D(c.productionCallableDefinitions({scope:t,minLoc:1,requireFunctionLikeSymbol:!0,excludeTypesFiles:!0}),i),s=[];for(let l of r){let a=P(e,l);a&&s.push({symbol:l.symbol,shortName:m(l.symbol),file:l.relativePath,startLine:l.startLine,endLine:l.endLine,loc:C(l),...a})}return s.sort((l,a)=>l.file.localeCompare(a.file)||l.startLine-a.startLine||l.loc-a.loc),o?s.slice(0,o):s}function _(e){return A.test(e)?"imperative":N.test(e)?"predicate":null}function P(e,n){let t=_(n.leaf);if(!t||L(e,n))return null;let o=f(e,n);if(!o||!k.test(o))return null;let i=h(e,n.relativePath)?.callables.find(r=>r.startLine===n.startLine&&r.endLine===n.endLine);if(t==="predicate"&&i?.paramCount===0)return null;if(x(o)){let r=O(e,n);return!r||S(r.body,T(r.snippet))||R(r.body)?null:{nameKind:t,resolvedVia:"one-hop-delegate",delegateTarget:r.shortName}}let c=p(o);return S(c,T(o))||R(c)?null:{nameKind:t,resolvedVia:"direct"}}var F=new Set(["if","for","while","switch","catch","function"]);function R(e){let n=u(e);for(let t of n.matchAll(/\b([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*)\s*\(/g))if(!F.has(t[1]))return!0;return!1}function T(e){let n=e.indexOf("=>");return n===-1?!1:!/^\s*\{/.test(e.slice(n+2))}function S(e,n){let t=u(e);if(/\bthrow\b/.test(t)||/\.reject\s*\(/.test(t)||I.test(t)||w.test(t))return!0;let o=K(t);if(n&&o.length===0){let i=t.trim();return i!==""&&i!=="true"}for(let i of o)if(i!==""&&i!=="true")return!0;return!1}function K(e){let n=[];d.lastIndex=0;let t;for(;t=d.exec(e);){let o=t.index+t[0].length,i=0,c=e.length;for(let r=o;r<e.length;r+=1){let s=e[r];if(s==="("||s==="["||s==="{")i+=1;else if(s===")"||s==="]"||s==="}"){if(i===0){c=r;break}i-=1}else if(s===";"&&i===0){c=r;break}}n.push(e.slice(o,c).trim()),d.lastIndex=c}return n}function O(e,n){let t=y(e,n,{callableOnly:!0,limit:3,semanticEvidence:v});if(t.semanticIncomplete||t.semanticUnavailable)return null;let o=t.rows,i=[...new Set(o.map(a=>a.symbol))].filter(a=>a!==n.symbol);if(i.length!==1)return null;let r=b(e,i[0]).match;if(!r)return null;let s=g(e,r.relativePath).find(a=>a.symbolId===r.symbolId);if(!s)return null;let l=f(e,s);return l?{body:p(l),snippet:l,shortName:m(s.symbol)}:null}export{M as a};
2
- //# sourceMappingURL=chunk-NDGTJHQN.js.map
1
+ import{d as x}from"./chunk-YRKP7PM7.js";import{f,g as p}from"./chunk-2OMXFE64.js";import{a as L}from"./chunk-YHPG3S2U.js";import{b as D}from"./chunk-B75HZHUP.js";import{c as E}from"./chunk-HENP2O4A.js";import{a as C}from"./chunk-BGBBVSH4.js";import{a as v}from"./chunk-6VREELBC.js";import{b as y}from"./chunk-MSI3K7PJ.js";import{b}from"./chunk-SGMNWYTH.js";import{d as m,t as g}from"./chunk-GVAF222T.js";import{c as u,f as h}from"./chunk-F74LZWCE.js";var A=/^(?:validate|verify|check|assert)(?:[A-Z].*)?$/,N=/^(?:is|has)(?:[A-Z].*)?$/,I=/[{,]\s*(?:ok|success|valid|isValid)\s*:\s*false\b/,d=/\breturn\b/g,k=/\bfunction\b|=>|\)\s*(?::\s*[^{;=]+)?\s*\{/,w=/\.(?:addIssue|push)\s*\(/;function M(e,n={}){let{scope:t,limit:o=30,scanLimit:i}=n,c=new E(e),r=D(c.productionCallableDefinitions({scope:t,minLoc:1,requireFunctionLikeSymbol:!0,excludeTypesFiles:!0}),i),s=[];for(let l of r){let a=P(e,l);a&&s.push({symbol:l.symbol,shortName:m(l.symbol),file:l.relativePath,startLine:l.startLine,endLine:l.endLine,loc:C(l),...a})}return s.sort((l,a)=>l.file.localeCompare(a.file)||l.startLine-a.startLine||l.loc-a.loc),o?s.slice(0,o):s}function _(e){return A.test(e)?"imperative":N.test(e)?"predicate":null}function P(e,n){let t=_(n.leaf);if(!t||L(e,n))return null;let o=f(e,n);if(!o||!k.test(o))return null;let i=h(e,n.relativePath)?.callables.find(r=>r.startLine===n.startLine&&r.endLine===n.endLine);if(t==="predicate"&&i?.paramCount===0)return null;if(x(o)){let r=O(e,n);return!r||S(r.body,T(r.snippet))||R(r.body)?null:{nameKind:t,resolvedVia:"one-hop-delegate",delegateTarget:r.shortName}}let c=p(o);return S(c,T(o))||R(c)?null:{nameKind:t,resolvedVia:"direct"}}var F=new Set(["if","for","while","switch","catch","function"]);function R(e){let n=u(e);for(let t of n.matchAll(/\b([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*)\s*\(/g))if(!F.has(t[1]))return!0;return!1}function T(e){let n=e.indexOf("=>");return n===-1?!1:!/^\s*\{/.test(e.slice(n+2))}function S(e,n){let t=u(e);if(/\bthrow\b/.test(t)||/\.reject\s*\(/.test(t)||I.test(t)||w.test(t))return!0;let o=K(t);if(n&&o.length===0){let i=t.trim();return i!==""&&i!=="true"}for(let i of o)if(i!==""&&i!=="true")return!0;return!1}function K(e){let n=[];d.lastIndex=0;let t;for(;t=d.exec(e);){let o=t.index+t[0].length,i=0,c=e.length;for(let r=o;r<e.length;r+=1){let s=e[r];if(s==="("||s==="["||s==="{")i+=1;else if(s===")"||s==="]"||s==="}"){if(i===0){c=r;break}i-=1}else if(s===";"&&i===0){c=r;break}}n.push(e.slice(o,c).trim()),d.lastIndex=c}return n}function O(e,n){let t=y(e,n,{callableOnly:!0,limit:3,semanticEvidence:v});if(t.semanticIncomplete||t.semanticUnavailable)return null;let o=t.rows,i=[...new Set(o.map(a=>a.symbol))].filter(a=>a!==n.symbol);if(i.length!==1)return null;let r=b(e,i[0]).match;if(!r)return null;let s=g(e,r.relativePath).find(a=>a.symbolId===r.symbolId);if(!s)return null;let l=f(e,s);return l?{body:p(l),snippet:l,shortName:m(s.symbol)}:null}export{M as a};
2
+ //# sourceMappingURL=chunk-D53LWANR.js.map
@@ -1,4 +1,4 @@
1
- import{b as a}from"./chunk-HIEXRDJF.js";import{c as l}from"./chunk-NK76RSB6.js";import{d as o,g as i}from"./chunk-AM5SUGHF.js";function _(e,t){let r=a(e,t);return r.length===0?[]:u([...c(e,r),...f(e,r)]).filter(s=>!e.isIgnored(s.relative_path)).map(d)}function R(e,t){let r=a(e,t);return r.length===0?[]:u(c(e,r)).filter(s=>!e.isIgnored(s.relative_path)).map(s=>({...d(s),basis:"external-reference"}))}function c(e,t){let r=t.map(()=>"?").join(", ");return e.all(`SELECT DISTINCT d1.relative_path, gs.symbol
1
+ import{b as a}from"./chunk-LMTSB3TB.js";import{c as l}from"./chunk-HENP2O4A.js";import{d as o,g as i}from"./chunk-GVAF222T.js";function _(e,t){let r=a(e,t);return r.length===0?[]:u([...c(e,r),...f(e,r)]).filter(s=>!e.isIgnored(s.relative_path)).map(d)}function R(e,t){let r=a(e,t);return r.length===0?[]:u(c(e,r)).filter(s=>!e.isIgnored(s.relative_path)).map(s=>({...d(s),basis:"external-reference"}))}function c(e,t){let r=t.map(()=>"?").join(", ");return e.all(`SELECT DISTINCT d1.relative_path, gs.symbol
2
2
  FROM mentions m
3
3
  JOIN chunks c ON m.chunk_id = c.id
4
4
  JOIN documents d1 ON c.document_id = d1.id
@@ -26,4 +26,4 @@ import{b as a}from"./chunk-HIEXRDJF.js";import{c as l}from"./chunk-NK76RSB6.js";
26
26
  AND ${e.localSymbolPredicate}
27
27
  ${e.pathExclusionsFor("d1")}
28
28
  ORDER BY d1.relative_path`,...t,...t,...t)}function f(e,t){let r=new l(e);return t.flatMap(s=>r.definitionsForFile(s).filter(n=>i(n.symbol)).map(n=>({relative_path:s,symbol:n.symbol})))}function u(e){let t=new Set;return e.filter(r=>{let s=`${r.relative_path}|${r.symbol}`;return t.has(s)?!1:(t.add(s),!0)})}function d(e){return{consumer:e.relative_path,symbol:e.symbol,shortName:o(e.symbol)}}export{_ as a,R as b};
29
- //# sourceMappingURL=chunk-VCWAJPXQ.js.map
29
+ //# sourceMappingURL=chunk-D7AZAOZX.js.map
@@ -1,9 +1,9 @@
1
- import{a as P,b as k,c as le,d as B}from"./chunk-6URCE5QY.js";import{e as ae,g as de,h as F,s as L,t as $,u as ue,v as w,w as f,x as b}from"./chunk-4O52YNKL.js";function me(e){try{return process.kill(e,0),!0}catch(r){return typeof r=="object"&&r!==null&&"code"in r&&r.code==="EPERM"}}import{randomUUID as _e}from"crypto";import{closeSync as Ce,fsyncSync as qe,linkSync as $e,mkdirSync as je,openSync as Je,statSync as We,unlinkSync as Ke,writeSync as Ue}from"fs";import{dirname as U}from"path";var J="codebaseiq-process-lock",W=1,O=Object.freeze({wallNow:()=>Date.now(),isProcessAlive:me,readProcessIdentity:le,randomToken:()=>_e(),makeDirectory:e=>je(e,{recursive:!0}),openFile:(e,r,t)=>Je(e,r,t),writeFile:(e,r,t,n)=>Ue(e,r,t,n),syncFile:e=>qe(e),closeFile:e=>Ce(e),linkFile:(e,r)=>$e(e,r),readFile:e=>F(e,"process lock record"),statFile:e=>{let r=We(e);return{dev:r.dev,ino:r.ino,size:r.size,mtimeMs:r.mtimeMs}},removeFile:e=>Ke(e)});function $r(e,r){let t=r.runtime??O;t.makeDirectory(U(e));let n;for(let i=0;i<2;i+=1)try{return{kind:"acquired",lock:fe(e,r,t),...n?{reclaimed:n}:{}}}catch(o){if(o.code!=="EEXIST")throw o;let s=R(e,{parseLegacy:r.parseLegacy,runtime:t});if(i===0&&Xe(e,s,{creationGraceMs:r.creationGraceMs,parseLegacy:r.parseLegacy,runtime:t})){n=s;continue}return{kind:"contended",observation:s}}return{kind:"contended",observation:R(e,{parseLegacy:r.parseLegacy,runtime:t})}}function R(e,r={}){let t=r.runtime??O,n,i;try{n=t.statFile(e),i=t.readFile(e)}catch(a){return a.code==="ENOENT"?{state:"missing"}:{state:"malformed"}}let o;try{o=JSON.parse(i)}catch{return{state:"malformed",raw:i,identity:n}}let s=ze(o);if(s)return{state:"valid",raw:i,identity:n,record:s,owner:He(s),parsed:o};let c=r.parseLegacy?.(o)??null;return c?{state:"legacy",raw:i,identity:n,owner:c,parsed:o}:{state:"malformed",raw:i,identity:n,parsed:o}}function ze(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let r=e;if(r.protocol!==J||r.version!==W||typeof r.kind!="string"||r.kind.trim()===""||typeof r.pid!="number"||!Number.isSafeInteger(r.pid)||r.pid<=0||typeof r.token!="string"||r.token.trim()===""||typeof r.startedAt!="string"||!Number.isFinite(Date.parse(r.startedAt))||r.detail!==void 0&&(typeof r.detail!="object"||r.detail===null||Array.isArray(r.detail)))return null;let t=r.processIdentity===void 0?null:P(r.processIdentity);return r.processIdentity!==void 0&&(!t||t.pid!==r.pid)?null:{protocol:J,version:W,kind:r.kind,pid:r.pid,token:r.token,...t?{processIdentity:t}:{},startedAt:r.startedAt,...r.detail?{detail:r.detail}:{}}}function Xe(e,r,t={}){let n=t.runtime??O;if(!K(r,n))return!1;let i=Ve(`${e}.reclaim`,n);if(!i)return!1;try{let o=R(e,{parseLegacy:t.parseLegacy,runtime:n});return!pe(r,o)||!K(o,n)?!1:z(e,n)}finally{i.release()}}function fe(e,r,t){let n=r.pid??process.pid,i=t.randomToken(),o=r.processIdentity===void 0?t.readProcessIdentity(n):r.processIdentity,s={protocol:J,version:W,kind:r.kind,pid:n,token:i,...o?{processIdentity:o}:{},startedAt:new Date(t.wallNow()).toISOString(),...r.detail?{detail:r.detail}:{}},c=`${e}.${i}.candidate`,a=t.openFile(c,"wx",384),d;try{L(a,Buffer.from(`${JSON.stringify(s)}
2
- `),t,"process lock"),t.syncFile(a)}catch(y){d=y}try{t.closeFile(a)}catch(y){d??=y}if(d!==void 0)throw j(c,t),d;try{t.linkFile(c,e)}catch(y){throw j(c,t),y}j(c,t);try{be(U(e),t)}catch(y){throw ye(e,s,t),y}let l=!1;return{path:e,record:s,release:()=>l?!1:(l=!0,ye(e,s,t))}}function ye(e,r,t=O){let n=R(e,{runtime:t});return n.state!=="valid"||!n.record||n.record.pid!==r.pid||n.record.token!==r.token||r.processIdentity&&(!n.record.processIdentity||!k(r.processIdentity,n.record.processIdentity))?!1:z(e,t)}function Ve(e,r){for(let t=0;t<2;t+=1)try{return fe(e,{kind:"reclaim-guard",runtime:r},r)}catch(n){if(n.code!=="EEXIST")return null;let i=R(e,{runtime:r});if(t>0||!K(i,r))return null;let o=R(e,{runtime:r});if(!pe(i,o)||!z(e,r))return null}return null}function K(e,r){if(e.state==="missing")return!1;if(e.owner){if(!r.isProcessAlive(e.owner.pid))return!0;if(!e.owner.processIdentity)return!1;let t=r.readProcessIdentity(e.owner.pid);return t!==null&&!k(e.owner.processIdentity,t)}return!1}function pe(e,r){return e.state===r.state&&e.raw===r.raw&&e.identity!==void 0&&r.identity!==void 0&&e.identity.dev===r.identity.dev&&e.identity.ino===r.identity.ino&&e.identity.size===r.identity.size&&e.identity.mtimeMs===r.identity.mtimeMs}function He(e){return{pid:e.pid,...e.processIdentity?{processIdentity:e.processIdentity}:{}}}function be(e,r){let t;try{t=r.openFile(e,"r")}catch(n){if($(n,process.platform))return;throw n}try{r.syncFile(t)}catch(n){if(!$(n,process.platform))throw n}finally{r.closeFile(t)}}function z(e,r){try{return r.removeFile(e),be(U(e),r),!0}catch{return!1}}function j(e,r){try{r.removeFile(e)}catch{}}import{randomUUID as sr}from"crypto";import{closeSync as cr,existsSync as ar,fsyncSync as dr,linkSync as lr,mkdirSync as ur,openSync as mr,renameSync as yr,unlinkSync as fr,writeSync as pr}from"fs";import{dirname as we}from"path";var Ye=Object.freeze(["EPERM","EACCES","EBUSY"]),Ge=Object.freeze([10,20,40,80,160,320,640,1e3,1e3,1e3]);function Qe(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)}var X=Object.freeze({platform:process.platform,sleep:Qe});function Ze(e,r){if(r!=="win32")return!1;let t=e?.code;return typeof t=="string"&&Ye.includes(t)}function ge(e,r={}){let t=r.runtime??X,n=r.delaysMs??Ge;for(let i of n)try{return e()}catch(o){if(!Ze(o,t.platform))throw o;t.sleep(i)}return e()}import{chmodSync as er,constants as rr,copyFileSync as tr}from"fs";import{dirname as nr}from"path";var xe=Object.freeze({...ue,copyFile:(e,r)=>tr(e,r,rr.COPYFILE_FICLONE),chmodFile:(e,r)=>er(e,r)});function ir(e,r,t={}){let n=t.runtime??xe,i=nr(r),o=w(i,n);if(n.copyFile(e,r),n.platform==="win32")or(r,t.mode,n);else{t.mode!==void 0&&n.chmodFile(r,t.mode);let s=n.openFile(r,"r");try{n.syncFile(s)}finally{n.closeFile(s)}}return b(o,f(i,n))}function or(e,r,t){let n=!1,i;try{i=t.openFile(e,"r+")}catch(o){let s=o.code;if(s!=="EACCES"&&s!=="EPERM")throw o;t.chmodFile(e,384),n=!0,i=t.openFile(e,"r+")}try{t.syncFile(i)}finally{t.closeFile(i)}r!==void 0?t.chmodFile(e,r):n&&t.chmodFile(e,292)}var Me=Object.freeze({platform:process.platform,randomToken:()=>sr(),pathExists:e=>ar(e),makeDirectory:e=>ur(e,{recursive:!0}),openFile:(e,r,t)=>mr(e,r,t),writeFile:(e,r,t,n)=>pr(e,r,t,n),syncFile:e=>dr(e),closeFile:e=>cr(e),renameFile:(e,r)=>yr(e,r),linkFile:(e,r)=>lr(e,r),removeFile:e=>fr(e)});function V(e,r,t={}){let n=t.durability??"visibility",i=t.runtime??Me,o=we(e),s=n==="durable"?w(o,i):(i.makeDirectory(o),"not-requested"),c=`${e}.tmp-${i.randomToken()}`,a=typeof r=="string"?Buffer.from(r):r,d,l=!1;try{d=i.openFile(c,"wx",t.mode??384),l=!0,L(d,a,i,"atomic file"),n==="durable"&&i.syncFile(d),i.closeFile(d),d=void 0,ge(()=>i.renameFile(c,e),{runtime:{platform:i.platform,sleep:i.sleep??X.sleep}}),l=!1;let y=n==="durable"?b(s,f(o,i)):"not-requested";return Fe(n,y)}finally{if(d!==void 0)try{i.closeFile(d)}catch{}if(l)try{i.removeFile(c)}catch{}}}function N(e,r,t={}){let n=t.durability??"visibility",i=t.runtime??Me;if(!i.linkFile)throw new Error("Exclusive atomic file publication requires hard-link support.");let o=we(e),s=n==="durable"?w(o,i):(i.makeDirectory(o),"not-requested"),c=`${e}.tmp-${i.randomToken()}`,a=typeof r=="string"?Buffer.from(r):r,d,l=!1;try{d=i.openFile(c,"wx",t.mode??384),l=!0,L(d,a,i,"exclusive atomic file"),n==="durable"&&i.syncFile(d),i.closeFile(d),d=void 0,i.linkFile(c,e);let y=n==="durable"?f(o,i):"not-requested";i.removeFile(c),l=!1;let u=n==="durable"?b(s,y,f(o,i)):"not-requested";return Fe(n,u)}finally{if(d!==void 0)try{i.closeFile(d)}catch{}if(l)try{i.removeFile(c)}catch{}}}function Fe(e,r){return{requestedDurability:e,achievedDurability:e==="visibility"?"visibility":r==="synced"?"directory-durable":"file-flushed",directorySync:r}}function nt(e,r,t={}){V(e,he(r,t),{durability:"visibility",runtime:t.runtime})}function H(e,r,t={}){return V(e,he(r,t),{durability:"durable",runtime:t.runtime})}function he(e,r){let t=JSON.stringify(e,null,r.spacing);return r.trailingNewline?`${t}
3
- `:t}import{createHash as Y,randomUUID as Ae}from"crypto";import{existsSync as M,lstatSync as D,readdirSync as I,renameSync as G,rmSync as g}from"fs";import{basename as A,dirname as Q,join as m}from"path";function T(e){return Array.isArray(e)?`[${e.map(T).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).sort(([r],[t])=>r.localeCompare(t)).map(([r,t])=>`${JSON.stringify(r)}:${T(t)}`).join(",")}}`:JSON.stringify(e)}var Z=1,br=Object.freeze({maxItems:1024,maxBytes:512*1024*1024,maxItemBytes:64*1024*1024,maxBatch:16,claimLeaseMs:5*6e4,responseRetentionMs:10*6e4,deadLetterRetentionMs:1440*6e4,temporaryRetentionMs:6e4,cleanupBatch:64}),x=class extends Error{constructor(t,n,i,o){let s=t==="item-too-large"?`request is ${o} bytes; per-item limit is ${i.maxItemBytes}`:t==="item-capacity"?`mailbox has ${n.totalItems} retained items; limit is ${i.maxItems}`:t==="byte-capacity"?`mailbox retains ${n.totalBytes} bytes and the request adds ${o}; limit is ${i.maxBytes}`:"another writer held the admission coordinator through the bounded wait";super(`Mailbox backpressure: ${s}. Retry after the service drains or expires retained work.`);this.code=t;this.status=n;this.limits=i;this.attemptedBytes=o;this.name="MailboxBackpressureError"}code;status;limits;attemptedBytes},Ee=".owner.json",ee={isProcessAlive:()=>!0,readProcessIdentity:()=>null};function pt(e){return{rootDir:e,pendingDir:m(e,"pending"),inflightDir:m(e,"inflight"),responseDir:m(e,"responses"),deadLetterDir:m(e,"dead-letter"),legacyRequestDir:m(e,"requests")}}function S(e={}){let r={...br,...e};for(let[t,n]of Object.entries(r))if(!Number.isFinite(n)||n<=0||!Number.isInteger(n))throw new Error(`Mailbox limit ${t} must be a positive integer.`);return r}function C(e){let r=[e.pendingDir,e.inflightDir,e.responseDir,e.deadLetterDir,e.legacyRequestDir].map(t=>w(t));return b(...r)}function bt(e,r){return Y("sha256").update(T({namespace:e,payload:r})).digest("hex")}function gr(e){if(!/^[a-f0-9]{64}$/.test(e))throw new Error("Mailbox operation keys must be lowercase SHA-256 identities.");return`op-${e}`}function gt(e,r,t={}){let n=S(t.limits),i=t.nowMs??Date.now(),o=C(e);return Sr(r),te(e,n,t.admissionLockTimeoutMs??2e3,t.monotonicNow??B,()=>{re(e,i,n);let s=m(e.pendingDir,`${r.id}.json`),c=m(e.responseDir,`${r.id}.json`),a=Ie(e,r.id);if(a){let u=ke(a,r.operationKey,r.id);return{disposition:"duplicate",requestId:r.id,responsePath:c,authoritativeDeadlineAtMs:u.deadlineAtMs??r.deadlineAtMs}}let d=`${JSON.stringify(r)}
4
- `,l=Buffer.byteLength(d),y=q(e);if(l>n.maxItemBytes)throw new x("item-too-large",y,n,l);if(y.totalItems+1>n.maxItems)throw new x("item-capacity",y,n,l);if(y.totalBytes+l>n.maxBytes)throw new x("byte-capacity",y,n,l);t.onBeforePublish?.();try{let u=N(s,d,{durability:"durable"}),p=b(o,u.directorySync);return{disposition:"accepted",requestId:r.id,responsePath:c,authoritativeDeadlineAtMs:r.deadlineAtMs,achievedDurability:p==="synced"?"directory-durable":"file-flushed",directorySync:p}}catch(u){if(u.code!=="EEXIST")throw u;let p=Ie(e,r.id);if(!p)throw u;let v=ke(p,r.operationKey,r.id);return{disposition:"duplicate",requestId:r.id,responsePath:c,authoritativeDeadlineAtMs:v.deadlineAtMs??r.deadlineAtMs}}})}function xr(e,r){if(!r.ownerId.trim())throw new Error("Mailbox claim owner identity is required.");if(r.owner&&(!Number.isSafeInteger(r.owner.pid)||r.owner.pid<=0||r.owner.processIdentity!==void 0&&r.owner.processIdentity.pid!==r.owner.pid))throw new Error("Mailbox claim process identity is invalid.");let t=r.nowMs??Date.now(),n=S(r.limits),i=C(e);try{return te(e,n,2e3,r.monotonicNow??B,()=>wr(e,r.ownerId,t,n,r.liveness??ee,r.owner??{pid:process.pid},i,r.onClaimStage))}catch(o){if(o instanceof x&&o.code==="admission-busy")return[];throw o}}function xt(e,r){return!Se(e.pendingDir)&&!Se(e.legacyRequestDir)?[]:xr(e,r)}function wr(e,r,t,n,i,o,s,c){re(e,t,n,i);let a=m(e.inflightDir,_(r)),d=[...Re(e.pendingDir,!1),...Re(e.legacyRequestDir,!0)].sort((u,p)=>u.orderAtMs-p.orderAtMs||u.header.id.localeCompare(p.header.id)||u.path.localeCompare(p.path)),l=s;d.length>0&&(l=b(l,w(a)),c?.("after-owner-directory-durable"),Rr(a,r,o),c?.("after-owner-record-published"));let y=[];for(let u of d){if(y.length>=n.maxBatch)break;let p=m(e.responseDir,`${u.header.id}.json`);if(M(p)){g(u.path,{force:!0});continue}let v=Math.max(t+n.claimLeaseMs,(u.header.deadlineAtMs??t)+5e3),Be=`${_(u.originalFile)}.${v}.claim`,oe=m(a,Be);try{G(u.path,oe)}catch(se){let ce=se.code;if(ce==="ENOENT"||ce==="EEXIST")continue;throw se}c?.("after-claim-renamed");let Oe=f(Q(u.path));c?.("after-source-directory-synced");let Ne=f(a);c?.("after-destination-directory-synced");let Te=b(l,Oe,Ne);y.push({requestId:u.header.id,ownerId:r,path:oe,originalFile:u.originalFile,claimedAtMs:t,claimExpiresAtMs:v,byteLength:u.byteLength,...u.header.operationKey?{operationKey:u.header.operationKey}:{},...u.header.clientId?{clientId:u.header.clientId}:{},...u.header.enqueuedAtMs===void 0?{}:{enqueuedAtMs:u.header.enqueuedAtMs},...u.header.deadlineAtMs===void 0?{}:{deadlineAtMs:u.header.deadlineAtMs},legacy:u.legacy,directorySync:Te})}return y}function wt(e,r={}){let t=S(r);if(e.byteLength>t.maxItemBytes)throw new x("item-too-large",{pending:0,inflight:1,responses:0,deadLetters:0,invalid:0,totalItems:1,totalBytes:e.byteLength},t,e.byteLength);return de(e.path,{maxBytes:t.maxItemBytes,inputKind:"bounded mailbox item"})}function Mr(e,r,t,n={}){let i=n.nowMs??Date.now(),o=S(n.limits),s={...t,mailboxVersion:Z,operationKey:r.operationKey??`legacy-${r.requestId}`,clientId:r.clientId??"legacy",...r.deadlineAtMs===void 0?{}:{deadlineAtMs:r.deadlineAtMs},completedAtMs:i,expiresAtMs:i+o.responseRetentionMs},c=Buffer.byteLength(`${JSON.stringify(s)}
1
+ import{a as P,c as B,d as k,e as ue}from"./chunk-6O3KXIDL.js";import{e as ae,g as de,h as F,s as L,t as $,u as le,v as w,w as f,x as b}from"./chunk-UQYQBLJX.js";function me(e){try{return process.kill(e,0),!0}catch(r){return typeof r=="object"&&r!==null&&"code"in r&&r.code==="EPERM"}}import{randomUUID as _e}from"crypto";import{closeSync as Ce,fsyncSync as qe,linkSync as $e,mkdirSync as je,openSync as Je,statSync as We,unlinkSync as Ke,writeSync as Ue}from"fs";import{dirname as U}from"path";var J="codebaseiq-process-lock",W=1,O=Object.freeze({wallNow:()=>Date.now(),isProcessAlive:me,readProcessIdentity:ue,randomToken:()=>_e(),makeDirectory:e=>je(e,{recursive:!0}),openFile:(e,r,t)=>Je(e,r,t),writeFile:(e,r,t,n)=>Ue(e,r,t,n),syncFile:e=>qe(e),closeFile:e=>Ce(e),linkFile:(e,r)=>$e(e,r),readFile:e=>F(e,"process lock record"),statFile:e=>{let r=We(e);return{dev:r.dev,ino:r.ino,size:r.size,mtimeMs:r.mtimeMs}},removeFile:e=>Ke(e)});function $r(e,r){let t=r.runtime??O;t.makeDirectory(U(e));let n;for(let i=0;i<2;i+=1)try{return{kind:"acquired",lock:fe(e,r,t),...n?{reclaimed:n}:{}}}catch(o){if(o.code!=="EEXIST")throw o;let s=R(e,{parseLegacy:r.parseLegacy,runtime:t});if(i===0&&Xe(e,s,{creationGraceMs:r.creationGraceMs,parseLegacy:r.parseLegacy,runtime:t})){n=s;continue}return{kind:"contended",observation:s}}return{kind:"contended",observation:R(e,{parseLegacy:r.parseLegacy,runtime:t})}}function R(e,r={}){let t=r.runtime??O,n,i;try{n=t.statFile(e),i=t.readFile(e)}catch(a){return a.code==="ENOENT"?{state:"missing"}:{state:"malformed"}}let o;try{o=JSON.parse(i)}catch{return{state:"malformed",raw:i,identity:n}}let s=ze(o);if(s)return{state:"valid",raw:i,identity:n,record:s,owner:He(s),parsed:o};let c=r.parseLegacy?.(o)??null;return c?{state:"legacy",raw:i,identity:n,owner:c,parsed:o}:{state:"malformed",raw:i,identity:n,parsed:o}}function ze(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let r=e;if(r.protocol!==J||r.version!==W||typeof r.kind!="string"||r.kind.trim()===""||typeof r.pid!="number"||!Number.isSafeInteger(r.pid)||r.pid<=0||typeof r.token!="string"||r.token.trim()===""||typeof r.startedAt!="string"||!Number.isFinite(Date.parse(r.startedAt))||r.detail!==void 0&&(typeof r.detail!="object"||r.detail===null||Array.isArray(r.detail)))return null;let t=r.processIdentity===void 0?null:B(r.processIdentity);return r.processIdentity!==void 0&&(!t||t.pid!==r.pid)?null:{protocol:J,version:W,kind:r.kind,pid:r.pid,token:r.token,...t?{processIdentity:t}:{},startedAt:r.startedAt,...r.detail?{detail:r.detail}:{}}}function Xe(e,r,t={}){let n=t.runtime??O;if(!K(r,n))return!1;let i=Ve(`${e}.reclaim`,n);if(!i)return!1;try{let o=R(e,{parseLegacy:t.parseLegacy,runtime:n});return!pe(r,o)||!K(o,n)?!1:z(e,n)}finally{i.release()}}function fe(e,r,t){let n=r.pid??process.pid,i=t.randomToken(),o=r.processIdentity===void 0?t.readProcessIdentity(n):r.processIdentity,s={protocol:J,version:W,kind:r.kind,pid:n,token:i,...o?{processIdentity:o}:{},startedAt:new Date(t.wallNow()).toISOString(),...r.detail?{detail:r.detail}:{}},c=`${e}.${i}.candidate`,a=t.openFile(c,"wx",384),d;try{L(a,Buffer.from(`${JSON.stringify(s)}
2
+ `),t,"process lock"),t.syncFile(a)}catch(y){d=y}try{t.closeFile(a)}catch(y){d??=y}if(d!==void 0)throw j(c,t),d;try{t.linkFile(c,e)}catch(y){throw j(c,t),y}j(c,t);try{be(U(e),t)}catch(y){throw ye(e,s,t),y}let l=!1;return{path:e,record:s,release:()=>l?!1:(l=!0,ye(e,s,t))}}function ye(e,r,t=O){let n=R(e,{runtime:t});return n.state!=="valid"||!n.record||n.record.pid!==r.pid||n.record.token!==r.token||r.processIdentity&&(!n.record.processIdentity||!k(r.processIdentity,n.record.processIdentity))?!1:z(e,t)}function Ve(e,r){for(let t=0;t<2;t+=1)try{return fe(e,{kind:"reclaim-guard",runtime:r},r)}catch(n){if(n.code!=="EEXIST")return null;let i=R(e,{runtime:r});if(t>0||!K(i,r))return null;let o=R(e,{runtime:r});if(!pe(i,o)||!z(e,r))return null}return null}function K(e,r){if(e.state==="missing")return!1;if(e.owner){if(!r.isProcessAlive(e.owner.pid))return!0;if(!e.owner.processIdentity)return!1;let t=r.readProcessIdentity(e.owner.pid);return t!==null&&!k(e.owner.processIdentity,t)}return!1}function pe(e,r){return e.state===r.state&&e.raw===r.raw&&e.identity!==void 0&&r.identity!==void 0&&e.identity.dev===r.identity.dev&&e.identity.ino===r.identity.ino&&e.identity.size===r.identity.size&&e.identity.mtimeMs===r.identity.mtimeMs}function He(e){return{pid:e.pid,...e.processIdentity?{processIdentity:e.processIdentity}:{}}}function be(e,r){let t;try{t=r.openFile(e,"r")}catch(n){if($(n,process.platform))return;throw n}try{r.syncFile(t)}catch(n){if(!$(n,process.platform))throw n}finally{r.closeFile(t)}}function z(e,r){try{return r.removeFile(e),be(U(e),r),!0}catch{return!1}}function j(e,r){try{r.removeFile(e)}catch{}}import{randomUUID as sr}from"crypto";import{closeSync as cr,existsSync as ar,fsyncSync as dr,linkSync as lr,mkdirSync as ur,openSync as mr,renameSync as yr,unlinkSync as fr,writeSync as pr}from"fs";import{dirname as we}from"path";var Ye=Object.freeze(["EPERM","EACCES","EBUSY"]),Ge=Object.freeze([10,20,40,80,160,320,640,1e3,1e3,1e3]);function Qe(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)}var X=Object.freeze({platform:process.platform,sleep:Qe});function Ze(e,r){if(r!=="win32")return!1;let t=e?.code;return typeof t=="string"&&Ye.includes(t)}function ge(e,r={}){let t=r.runtime??X,n=r.delaysMs??Ge;for(let i of n)try{return e()}catch(o){if(!Ze(o,t.platform))throw o;t.sleep(i)}return e()}import{chmodSync as er,constants as rr,copyFileSync as tr}from"fs";import{dirname as nr}from"path";var xe=Object.freeze({...le,copyFile:(e,r)=>tr(e,r,rr.COPYFILE_FICLONE),chmodFile:(e,r)=>er(e,r)});function ir(e,r,t={}){let n=t.runtime??xe,i=nr(r),o=w(i,n);if(n.copyFile(e,r),n.platform==="win32")or(r,t.mode,n);else{t.mode!==void 0&&n.chmodFile(r,t.mode);let s=n.openFile(r,"r");try{n.syncFile(s)}finally{n.closeFile(s)}}return b(o,f(i,n))}function or(e,r,t){let n=!1,i;try{i=t.openFile(e,"r+")}catch(o){let s=o.code;if(s!=="EACCES"&&s!=="EPERM")throw o;t.chmodFile(e,384),n=!0,i=t.openFile(e,"r+")}try{t.syncFile(i)}finally{t.closeFile(i)}r!==void 0?t.chmodFile(e,r):n&&t.chmodFile(e,292)}var Me=Object.freeze({platform:process.platform,randomToken:()=>sr(),pathExists:e=>ar(e),makeDirectory:e=>ur(e,{recursive:!0}),openFile:(e,r,t)=>mr(e,r,t),writeFile:(e,r,t,n)=>pr(e,r,t,n),syncFile:e=>dr(e),closeFile:e=>cr(e),renameFile:(e,r)=>yr(e,r),linkFile:(e,r)=>lr(e,r),removeFile:e=>fr(e)});function V(e,r,t={}){let n=t.durability??"visibility",i=t.runtime??Me,o=we(e),s=n==="durable"?w(o,i):(i.makeDirectory(o),"not-requested"),c=`${e}.tmp-${i.randomToken()}`,a=typeof r=="string"?Buffer.from(r):r,d,l=!1;try{d=i.openFile(c,"wx",t.mode??384),l=!0,L(d,a,i,"atomic file"),n==="durable"&&i.syncFile(d),i.closeFile(d),d=void 0,ge(()=>i.renameFile(c,e),{runtime:{platform:i.platform,sleep:i.sleep??X.sleep}}),l=!1;let y=n==="durable"?b(s,f(o,i)):"not-requested";return Fe(n,y)}finally{if(d!==void 0)try{i.closeFile(d)}catch{}if(l)try{i.removeFile(c)}catch{}}}function N(e,r,t={}){let n=t.durability??"visibility",i=t.runtime??Me;if(!i.linkFile)throw new Error("Exclusive atomic file publication requires hard-link support.");let o=we(e),s=n==="durable"?w(o,i):(i.makeDirectory(o),"not-requested"),c=`${e}.tmp-${i.randomToken()}`,a=typeof r=="string"?Buffer.from(r):r,d,l=!1;try{d=i.openFile(c,"wx",t.mode??384),l=!0,L(d,a,i,"exclusive atomic file"),n==="durable"&&i.syncFile(d),i.closeFile(d),d=void 0,i.linkFile(c,e);let y=n==="durable"?f(o,i):"not-requested";i.removeFile(c),l=!1;let u=n==="durable"?b(s,y,f(o,i)):"not-requested";return Fe(n,u)}finally{if(d!==void 0)try{i.closeFile(d)}catch{}if(l)try{i.removeFile(c)}catch{}}}function Fe(e,r){return{requestedDurability:e,achievedDurability:e==="visibility"?"visibility":r==="synced"?"directory-durable":"file-flushed",directorySync:r}}function nt(e,r,t={}){V(e,he(r,t),{durability:"visibility",runtime:t.runtime})}function H(e,r,t={}){return V(e,he(r,t),{durability:"durable",runtime:t.runtime})}function he(e,r){let t=JSON.stringify(e,null,r.spacing);return r.trailingNewline?`${t}
3
+ `:t}import{createHash as Y,randomUUID as Ae}from"crypto";import{existsSync as M,lstatSync as D,readdirSync as I,renameSync as G,rmSync as g}from"fs";import{basename as A,dirname as Q,join as m}from"path";function T(e){return Array.isArray(e)?`[${e.map(T).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).sort(([r],[t])=>r.localeCompare(t)).map(([r,t])=>`${JSON.stringify(r)}:${T(t)}`).join(",")}}`:JSON.stringify(e)}var Z=1,br=Object.freeze({maxItems:1024,maxBytes:512*1024*1024,maxItemBytes:64*1024*1024,maxBatch:16,claimLeaseMs:5*6e4,responseRetentionMs:10*6e4,deadLetterRetentionMs:1440*6e4,temporaryRetentionMs:6e4,cleanupBatch:64}),x=class extends Error{constructor(t,n,i,o){let s=t==="item-too-large"?`request is ${o} bytes; per-item limit is ${i.maxItemBytes}`:t==="item-capacity"?`mailbox has ${n.totalItems} retained items; limit is ${i.maxItems}`:t==="byte-capacity"?`mailbox retains ${n.totalBytes} bytes and the request adds ${o}; limit is ${i.maxBytes}`:"another writer held the admission coordinator through the bounded wait";super(`Mailbox backpressure: ${s}. Retry after the service drains or expires retained work.`);this.code=t;this.status=n;this.limits=i;this.attemptedBytes=o;this.name="MailboxBackpressureError"}code;status;limits;attemptedBytes},Ee=".owner.json",ee={isProcessAlive:()=>!0,readProcessIdentity:()=>null};function pt(e){return{rootDir:e,pendingDir:m(e,"pending"),inflightDir:m(e,"inflight"),responseDir:m(e,"responses"),deadLetterDir:m(e,"dead-letter"),legacyRequestDir:m(e,"requests")}}function S(e={}){let r={...br,...e};for(let[t,n]of Object.entries(r))if(!Number.isFinite(n)||n<=0||!Number.isInteger(n))throw new Error(`Mailbox limit ${t} must be a positive integer.`);return r}function C(e){let r=[e.pendingDir,e.inflightDir,e.responseDir,e.deadLetterDir,e.legacyRequestDir].map(t=>w(t));return b(...r)}function bt(e,r){return Y("sha256").update(T({namespace:e,payload:r})).digest("hex")}function gr(e){if(!/^[a-f0-9]{64}$/.test(e))throw new Error("Mailbox operation keys must be lowercase SHA-256 identities.");return`op-${e}`}function gt(e,r,t={}){let n=S(t.limits),i=t.nowMs??Date.now(),o=C(e);return Sr(r),te(e,n,t.admissionLockTimeoutMs??2e3,t.monotonicNow??P,()=>{re(e,i,n);let s=m(e.pendingDir,`${r.id}.json`),c=m(e.responseDir,`${r.id}.json`),a=Ie(e,r.id);if(a){let u=ke(a,r.operationKey,r.id);return{disposition:"duplicate",requestId:r.id,responsePath:c,authoritativeDeadlineAtMs:u.deadlineAtMs??r.deadlineAtMs}}let d=`${JSON.stringify(r)}
4
+ `,l=Buffer.byteLength(d),y=q(e);if(l>n.maxItemBytes)throw new x("item-too-large",y,n,l);if(y.totalItems+1>n.maxItems)throw new x("item-capacity",y,n,l);if(y.totalBytes+l>n.maxBytes)throw new x("byte-capacity",y,n,l);t.onBeforePublish?.();try{let u=N(s,d,{durability:"durable"}),p=b(o,u.directorySync);return{disposition:"accepted",requestId:r.id,responsePath:c,authoritativeDeadlineAtMs:r.deadlineAtMs,achievedDurability:p==="synced"?"directory-durable":"file-flushed",directorySync:p}}catch(u){if(u.code!=="EEXIST")throw u;let p=Ie(e,r.id);if(!p)throw u;let v=ke(p,r.operationKey,r.id);return{disposition:"duplicate",requestId:r.id,responsePath:c,authoritativeDeadlineAtMs:v.deadlineAtMs??r.deadlineAtMs}}})}function xr(e,r){if(!r.ownerId.trim())throw new Error("Mailbox claim owner identity is required.");if(r.owner&&(!Number.isSafeInteger(r.owner.pid)||r.owner.pid<=0||r.owner.processIdentity!==void 0&&r.owner.processIdentity.pid!==r.owner.pid))throw new Error("Mailbox claim process identity is invalid.");let t=r.nowMs??Date.now(),n=S(r.limits),i=C(e);try{return te(e,n,2e3,r.monotonicNow??P,()=>wr(e,r.ownerId,t,n,r.liveness??ee,r.owner??{pid:process.pid},i,r.onClaimStage))}catch(o){if(o instanceof x&&o.code==="admission-busy")return[];throw o}}function xt(e,r){return!Se(e.pendingDir)&&!Se(e.legacyRequestDir)?[]:xr(e,r)}function wr(e,r,t,n,i,o,s,c){re(e,t,n,i);let a=m(e.inflightDir,_(r)),d=[...Re(e.pendingDir,!1),...Re(e.legacyRequestDir,!0)].sort((u,p)=>u.orderAtMs-p.orderAtMs||u.header.id.localeCompare(p.header.id)||u.path.localeCompare(p.path)),l=s;d.length>0&&(l=b(l,w(a)),c?.("after-owner-directory-durable"),Rr(a,r,o),c?.("after-owner-record-published"));let y=[];for(let u of d){if(y.length>=n.maxBatch)break;let p=m(e.responseDir,`${u.header.id}.json`);if(M(p)){g(u.path,{force:!0});continue}let v=Math.max(t+n.claimLeaseMs,(u.header.deadlineAtMs??t)+5e3),Be=`${_(u.originalFile)}.${v}.claim`,oe=m(a,Be);try{G(u.path,oe)}catch(se){let ce=se.code;if(ce==="ENOENT"||ce==="EEXIST")continue;throw se}c?.("after-claim-renamed");let Oe=f(Q(u.path));c?.("after-source-directory-synced");let Ne=f(a);c?.("after-destination-directory-synced");let Te=b(l,Oe,Ne);y.push({requestId:u.header.id,ownerId:r,path:oe,originalFile:u.originalFile,claimedAtMs:t,claimExpiresAtMs:v,byteLength:u.byteLength,...u.header.operationKey?{operationKey:u.header.operationKey}:{},...u.header.clientId?{clientId:u.header.clientId}:{},...u.header.enqueuedAtMs===void 0?{}:{enqueuedAtMs:u.header.enqueuedAtMs},...u.header.deadlineAtMs===void 0?{}:{deadlineAtMs:u.header.deadlineAtMs},legacy:u.legacy,directorySync:Te})}return y}function wt(e,r={}){let t=S(r);if(e.byteLength>t.maxItemBytes)throw new x("item-too-large",{pending:0,inflight:1,responses:0,deadLetters:0,invalid:0,totalItems:1,totalBytes:e.byteLength},t,e.byteLength);return de(e.path,{maxBytes:t.maxItemBytes,inputKind:"bounded mailbox item"})}function Mr(e,r,t,n={}){let i=n.nowMs??Date.now(),o=S(n.limits),s={...t,mailboxVersion:Z,operationKey:r.operationKey??`legacy-${r.requestId}`,clientId:r.clientId??"legacy",...r.deadlineAtMs===void 0?{}:{deadlineAtMs:r.deadlineAtMs},completedAtMs:i,expiresAtMs:i+o.responseRetentionMs},c=Buffer.byteLength(`${JSON.stringify(s)}
5
5
  `),a=q(e);if(c>o.maxItemBytes)throw new x("item-too-large",a,o,c);let d=Math.max(0,a.totalBytes-r.byteLength)+c;if(d>o.maxBytes&&d>a.totalBytes)throw new x("byte-capacity",a,o,c);Fr(e,r,s),n.onAfterResponsePublished?.(),g(r.path,{force:!0});let l=Q(r.path);f(M(l)?l:e.inflightDir)}function Mt(e,r,t,n,i={}){let o=i.nowMs??Date.now(),s=S(i.limits);if(Mr(e,r,t,{...i,nowMs:o,limits:s}),!M(r.path)){let c=m(e.deadLetterDir,`${Er(r.requestId)}.${o}.${Y("sha256").update(n).digest("hex").slice(0,12)}.json`),a={mailboxVersion:Z,requestId:r.requestId,ownerId:r.ownerId,rejectedAtMs:o,reason:n,originalFile:r.originalFile},d=Buffer.byteLength(`${JSON.stringify(a,null,2)}
6
- `),l=q(e);l.totalItems<s.maxItems&&l.totalBytes+d<=s.maxBytes&&H(c,a,{spacing:2,trailingNewline:!0})}}function Ft(e,r={}){let t=r.nowMs??Date.now(),n=S(r.limits);return C(e),te(e,n,2e3,r.monotonicNow??B,()=>re(e,t,n,r.liveness??ee))}function re(e,r,t,n=ee){let i={reclaimed:0,completedClaimsRemoved:0,responsesRemoved:0,deadLettersRemoved:0,temporaryFilesRemoved:0},o=t.cleanupBatch;for(let s of ie(e.inflightDir)){if(o<=0)break;let c=m(e.responseDir,`${s.requestId}.json`);if(M(c)){g(s.path,{force:!0}),i.completedClaimsRemoved++,o--;continue}if(s.claimExpiresAtMs>r||Dr(e,s.ownerId,n)!=="dead")continue;let a=m(e.pendingDir,s.originalFile);try{G(s.path,a),i.reclaimed++}catch(d){if(d.code!=="EEXIST")throw d;g(s.path,{force:!0})}f(Q(s.path)),f(e.pendingDir),o--}o=De(e.responseDir,o,(s,c)=>c+t.responseRetentionMs,r,()=>{i.responsesRemoved++}),o=De(e.deadLetterDir,o,(s,c)=>c+t.deadLetterRetentionMs,r,()=>{i.deadLettersRemoved++});for(let s of[e.pendingDir,e.inflightDir,e.responseDir,e.deadLetterDir,e.legacyRequestDir]){if(o<=0)break;for(let c of Pe(s)){if(o<=0)break;A(c).includes(".tmp-")&&(D(c).mtimeMs+t.temporaryRetentionMs>r||(g(c,{force:!0}),i.temporaryFilesRemoved++,o--))}}return Lr(e.inflightDir),i}function q(e){C(e);let r=[...h(e.pendingDir).map(a=>({path:a,pending:!0})),...h(e.legacyRequestDir).map(a=>({path:a,pending:!0}))],t=ie(e.inflightDir).map(a=>({path:a.path,pending:!1})),n=h(e.responseDir).map(a=>({path:a,pending:!1})),i=h(e.deadLetterDir).map(a=>({path:a,pending:!1})),o=[...r,...t,...n,...i],s=0,c;for(let a of r){let d=E(a.path);if(!d){s++;continue}let l=d.enqueuedAtMs??D(a.path).mtimeMs;c=c===void 0?l:Math.min(c,l)}return{pending:r.length,inflight:t.length,responses:n.length,deadLetters:i.length,invalid:s,totalItems:o.length,totalBytes:o.reduce((a,d)=>a+Ar(d.path),0),...c===void 0?{}:{oldestPendingAt:new Date(c).toISOString()}}}function Fr(e,r,t){let n=m(e.responseDir,`${r.requestId}.json`),i=`${JSON.stringify(t)}
6
+ `),l=q(e);l.totalItems<s.maxItems&&l.totalBytes+d<=s.maxBytes&&H(c,a,{spacing:2,trailingNewline:!0})}}function Ft(e,r={}){let t=r.nowMs??Date.now(),n=S(r.limits);return C(e),te(e,n,2e3,r.monotonicNow??P,()=>re(e,t,n,r.liveness??ee))}function re(e,r,t,n=ee){let i={reclaimed:0,completedClaimsRemoved:0,responsesRemoved:0,deadLettersRemoved:0,temporaryFilesRemoved:0},o=t.cleanupBatch;for(let s of ie(e.inflightDir)){if(o<=0)break;let c=m(e.responseDir,`${s.requestId}.json`);if(M(c)){g(s.path,{force:!0}),i.completedClaimsRemoved++,o--;continue}if(s.claimExpiresAtMs>r||Dr(e,s.ownerId,n)!=="dead")continue;let a=m(e.pendingDir,s.originalFile);try{G(s.path,a),i.reclaimed++}catch(d){if(d.code!=="EEXIST")throw d;g(s.path,{force:!0})}f(Q(s.path)),f(e.pendingDir),o--}o=De(e.responseDir,o,(s,c)=>c+t.responseRetentionMs,r,()=>{i.responsesRemoved++}),o=De(e.deadLetterDir,o,(s,c)=>c+t.deadLetterRetentionMs,r,()=>{i.deadLettersRemoved++});for(let s of[e.pendingDir,e.inflightDir,e.responseDir,e.deadLetterDir,e.legacyRequestDir]){if(o<=0)break;for(let c of Pe(s)){if(o<=0)break;A(c).includes(".tmp-")&&(D(c).mtimeMs+t.temporaryRetentionMs>r||(g(c,{force:!0}),i.temporaryFilesRemoved++,o--))}}return Lr(e.inflightDir),i}function q(e){C(e);let r=[...h(e.pendingDir).map(a=>({path:a,pending:!0})),...h(e.legacyRequestDir).map(a=>({path:a,pending:!0}))],t=ie(e.inflightDir).map(a=>({path:a.path,pending:!1})),n=h(e.responseDir).map(a=>({path:a,pending:!1})),i=h(e.deadLetterDir).map(a=>({path:a,pending:!1})),o=[...r,...t,...n,...i],s=0,c;for(let a of r){let d=E(a.path);if(!d){s++;continue}let l=d.enqueuedAtMs??D(a.path).mtimeMs;c=c===void 0?l:Math.min(c,l)}return{pending:r.length,inflight:t.length,responses:n.length,deadLetters:i.length,invalid:s,totalItems:o.length,totalBytes:o.reduce((a,d)=>a+Ar(d.path),0),...c===void 0?{}:{oldestPendingAt:new Date(c).toISOString()}}}function Fr(e,r,t){let n=m(e.responseDir,`${r.requestId}.json`),i=`${JSON.stringify(t)}
7
7
  `;try{N(n,i,{durability:"durable"})}catch(o){if(o.code!=="EEXIST")throw o;let s=E(n),c=r.operationKey??`legacy-${r.requestId}`;if(s?.operationKey!==c)throw new Error(`Mailbox completion ${r.requestId} conflicts with an existing operation.`,{cause:o})}}function te(e,r,t,n,i){let o=m(e.rootDir,".admission.lock"),s=`${process.pid}-${Ae()}`,c=n()+Math.max(0,t);for(;!hr(e.rootDir,o,s);){if(Ir(o),n()>=c)throw new x("admission-busy",q(e),r,0);Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,5)}try{return i()}finally{try{ne(o).ownerToken===s&&(g(o,{recursive:!0,force:!0}),f(e.rootDir))}catch{}}}function hr(e,r,t){let n=`${JSON.stringify({ownerToken:t,pid:process.pid,acquiredAtMs:Date.now()})}
8
- `;try{return N(r,n,{durability:"durable"}),!0}catch(i){if(i.code==="EEXIST")return!1;try{ne(r).ownerToken===t&&(g(r,{force:!0}),f(e))}catch{}throw i}}function Ir(e){let r=null;try{let n=ne(e);typeof n.ownerToken=="string"&&Number.isSafeInteger(n.pid)&&Number(n.pid)>0&&(r=Number(n.pid))}catch{}if(r===null||kr(r))return;let t=`${e}.stale-${Ae()}`;try{G(e,t)}catch(n){let i=n.code;if(i==="ENOENT"||i==="EEXIST")return;throw n}g(t,{recursive:!0,force:!0})}function ne(e){try{return JSON.parse(F(e,"mailbox lock record"))}catch(r){if(r.code!=="EISDIR"&&!(r instanceof ae&&r.reason==="not-regular"))throw r;return JSON.parse(F(m(e,"owner.json"),"mailbox lock owner record"))}}function kr(e){try{return process.kill(e,0),!0}catch(r){let t=r.code;return t==="EPERM"||t!=="ESRCH"}}function Rr(e,r,t){let n=m(e,Ee),i=t.processIdentity,o=ve(n);if(!(o&&o.ownerId===r&&o.pid===t.pid&&(!o.processIdentity&&!i||o.processIdentity&&i&&k(o.processIdentity,i)))){if(h(e).some(s=>s.endsWith(".claim")))throw new Error(`Mailbox owner identity ${r} collides with retained work from another process instance.`);H(n,{version:1,ownerId:r,pid:t.pid,...i?{processIdentity:i}:{}})}}function Dr(e,r,t){let n=ve(m(e.inflightDir,_(r),Ee));if(!n)return"unknown";if(!t.isProcessAlive(n.pid))return"dead";if(!n.processIdentity)return"live";let i=t.readProcessIdentity(n.pid);return i?k(n.processIdentity,i)?"live":"dead":"unknown"}function ve(e){try{let r=JSON.parse(F(e,"mailbox owner record"));if(r.version!==1||typeof r.ownerId!="string"||!r.ownerId||typeof r.pid!="number"||!Number.isSafeInteger(r.pid)||r.pid<=0)return null;let t=r.processIdentity===void 0?null:P(r.processIdentity);return r.processIdentity!==void 0&&(!t||t.pid!==r.pid)?null:{version:1,ownerId:r.ownerId,pid:r.pid,...t?{processIdentity:t}:{}}}catch{return null}}function Ie(e,r){for(let t of[m(e.pendingDir,`${r}.json`),m(e.legacyRequestDir,`${r}.json`),m(e.responseDir,`${r}.json`)])if(M(t))return t;for(let t of ie(e.inflightDir))if(t.requestId===r)return t.path;return null}function ke(e,r,t){let n=E(e);if(!n||n.operationKey!==r)throw new Error(`Mailbox operation ${t} conflicts with an existing retained record.`);return n}function Sr(e){if(e.mailboxVersion!==Z||e.id!==gr(e.operationKey)||!e.clientId.trim()||!Number.isFinite(e.enqueuedAtMs)||!Number.isFinite(e.deadlineAtMs)||e.deadlineAtMs<e.enqueuedAtMs)throw new Error("Mailbox request has an invalid lifecycle identity.")}function Re(e,r){return h(e).filter(t=>t.endsWith(".json")).map(t=>{let n=D(t),i=A(t,".json"),o=E(t)??{id:i};return{path:t,originalFile:A(t),header:o,byteLength:n.size,orderAtMs:o.enqueuedAtMs??n.mtimeMs,legacy:r}})}function ie(e){if(!M(e))return[];let r=[];for(let t of I(e,{withFileTypes:!0})){if(!t.isDirectory())continue;let n=Le(t.name);if(n===null)continue;let i=m(e,t.name);for(let o of I(i,{withFileTypes:!0})){if(!o.isFile()||!o.name.endsWith(".claim"))continue;let s=/^(.*)\.(\d+)\.claim$/.exec(o.name);if(!s)continue;let c=Le(s[1]),a=Number(s[2]);if(c===null||A(c)!==c||!c.endsWith(".json")||!Number.isSafeInteger(a))continue;let d=m(i,o.name),l=E(d)??{id:A(c,".json")},y=D(d);r.push({requestId:l.id,ownerId:n,path:d,originalFile:c,claimedAtMs:y.mtimeMs,claimExpiresAtMs:a,byteLength:y.size,...l.operationKey?{operationKey:l.operationKey}:{},...l.clientId?{clientId:l.clientId}:{},...l.enqueuedAtMs===void 0?{}:{enqueuedAtMs:l.enqueuedAtMs},...l.deadlineAtMs===void 0?{}:{deadlineAtMs:l.deadlineAtMs},legacy:l.operationKey===void 0})}}return r.sort((t,n)=>t.claimedAtMs-n.claimedAtMs||t.path.localeCompare(n.path))}function E(e){try{let r=JSON.parse(F(e,"mailbox record"));return typeof r.id!="string"||!r.id?null:{id:r.id,...typeof r.operationKey=="string"?{operationKey:r.operationKey}:{},...typeof r.clientId=="string"?{clientId:r.clientId}:{},...typeof r.enqueuedAtMs=="number"?{enqueuedAtMs:r.enqueuedAtMs}:{},...typeof r.deadlineAtMs=="number"?{deadlineAtMs:r.deadlineAtMs}:{}}}catch{return null}}function De(e,r,t,n,i){for(let o of h(e)){if(r<=0)break;let s=D(o);t(o,s.mtimeMs)>n||(g(o,{force:!0}),i(),r--)}return r}function h(e){return M(e)?I(e,{withFileTypes:!0}).filter(r=>r.isFile()).map(r=>m(e,r.name)).sort():[]}function Se(e){try{return I(e).some(r=>r.endsWith(".json"))}catch{return!1}}function Pe(e){if(!M(e))return[];let r=[];for(let t of I(e,{withFileTypes:!0})){let n=m(e,t.name);t.isFile()?r.push(n):t.isDirectory()&&r.push(...Pe(n))}return r.sort()}function Lr(e){if(M(e))for(let r of I(e,{withFileTypes:!0})){if(!r.isDirectory())continue;let t=m(e,r.name);I(t).some(n=>n.endsWith(".claim"))||g(t,{recursive:!0,force:!0})}}function Ar(e){try{return D(e).size}catch{return 0}}function _(e){return Buffer.from(e,"utf8").toString("base64url")}function Le(e){try{let r=Buffer.from(e,"base64url").toString("utf8");return _(r)===e?r:null}catch{return null}}function Er(e){return/^[a-z0-9][a-z0-9-]{0,127}$/i.test(e)?e:`invalid-${Y("sha256").update(e).digest("hex")}`}function vr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function It(e){return typeof e=="string"&&Number.isFinite(Date.parse(e))}function kt(e){return vr(e)&&Object.values(e).every(r=>typeof r=="string"||r===null)}function Rt(e){return typeof e=="string"&&e.length>0}function Dt(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function St(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}function Lt(e){return typeof e=="string"&&e.length>0&&e.length<=256&&!/[\0\r\n]/u.test(e)}function At(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}export{vr as a,It as b,kt as c,Rt as d,Dt as e,St as f,Lt as g,At as h,ge as i,me as j,O as k,$r as l,R as m,Xe as n,ir as o,V as p,N as q,nt as r,H as s,T as t,Z as u,pt as v,C as w,bt as x,gr as y,gt as z,xt as A,wt as B,Mr as C,Mt as D,Ft as E,q as F};
9
- //# sourceMappingURL=chunk-ACZDU5GK.js.map
8
+ `;try{return N(r,n,{durability:"durable"}),!0}catch(i){if(i.code==="EEXIST")return!1;try{ne(r).ownerToken===t&&(g(r,{force:!0}),f(e))}catch{}throw i}}function Ir(e){let r=null;try{let n=ne(e);typeof n.ownerToken=="string"&&Number.isSafeInteger(n.pid)&&Number(n.pid)>0&&(r=Number(n.pid))}catch{}if(r===null||kr(r))return;let t=`${e}.stale-${Ae()}`;try{G(e,t)}catch(n){let i=n.code;if(i==="ENOENT"||i==="EEXIST")return;throw n}g(t,{recursive:!0,force:!0})}function ne(e){try{return JSON.parse(F(e,"mailbox lock record"))}catch(r){if(r.code!=="EISDIR"&&!(r instanceof ae&&r.reason==="not-regular"))throw r;return JSON.parse(F(m(e,"owner.json"),"mailbox lock owner record"))}}function kr(e){try{return process.kill(e,0),!0}catch(r){let t=r.code;return t==="EPERM"||t!=="ESRCH"}}function Rr(e,r,t){let n=m(e,Ee),i=t.processIdentity,o=ve(n);if(!(o&&o.ownerId===r&&o.pid===t.pid&&(!o.processIdentity&&!i||o.processIdentity&&i&&k(o.processIdentity,i)))){if(h(e).some(s=>s.endsWith(".claim")))throw new Error(`Mailbox owner identity ${r} collides with retained work from another process instance.`);H(n,{version:1,ownerId:r,pid:t.pid,...i?{processIdentity:i}:{}})}}function Dr(e,r,t){let n=ve(m(e.inflightDir,_(r),Ee));if(!n)return"unknown";if(!t.isProcessAlive(n.pid))return"dead";if(!n.processIdentity)return"live";let i=t.readProcessIdentity(n.pid);return i?k(n.processIdentity,i)?"live":"dead":"unknown"}function ve(e){try{let r=JSON.parse(F(e,"mailbox owner record"));if(r.version!==1||typeof r.ownerId!="string"||!r.ownerId||typeof r.pid!="number"||!Number.isSafeInteger(r.pid)||r.pid<=0)return null;let t=r.processIdentity===void 0?null:B(r.processIdentity);return r.processIdentity!==void 0&&(!t||t.pid!==r.pid)?null:{version:1,ownerId:r.ownerId,pid:r.pid,...t?{processIdentity:t}:{}}}catch{return null}}function Ie(e,r){for(let t of[m(e.pendingDir,`${r}.json`),m(e.legacyRequestDir,`${r}.json`),m(e.responseDir,`${r}.json`)])if(M(t))return t;for(let t of ie(e.inflightDir))if(t.requestId===r)return t.path;return null}function ke(e,r,t){let n=E(e);if(!n||n.operationKey!==r)throw new Error(`Mailbox operation ${t} conflicts with an existing retained record.`);return n}function Sr(e){if(e.mailboxVersion!==Z||e.id!==gr(e.operationKey)||!e.clientId.trim()||!Number.isFinite(e.enqueuedAtMs)||!Number.isFinite(e.deadlineAtMs)||e.deadlineAtMs<e.enqueuedAtMs)throw new Error("Mailbox request has an invalid lifecycle identity.")}function Re(e,r){return h(e).filter(t=>t.endsWith(".json")).map(t=>{let n=D(t),i=A(t,".json"),o=E(t)??{id:i};return{path:t,originalFile:A(t),header:o,byteLength:n.size,orderAtMs:o.enqueuedAtMs??n.mtimeMs,legacy:r}})}function ie(e){if(!M(e))return[];let r=[];for(let t of I(e,{withFileTypes:!0})){if(!t.isDirectory())continue;let n=Le(t.name);if(n===null)continue;let i=m(e,t.name);for(let o of I(i,{withFileTypes:!0})){if(!o.isFile()||!o.name.endsWith(".claim"))continue;let s=/^(.*)\.(\d+)\.claim$/.exec(o.name);if(!s)continue;let c=Le(s[1]),a=Number(s[2]);if(c===null||A(c)!==c||!c.endsWith(".json")||!Number.isSafeInteger(a))continue;let d=m(i,o.name),l=E(d)??{id:A(c,".json")},y=D(d);r.push({requestId:l.id,ownerId:n,path:d,originalFile:c,claimedAtMs:y.mtimeMs,claimExpiresAtMs:a,byteLength:y.size,...l.operationKey?{operationKey:l.operationKey}:{},...l.clientId?{clientId:l.clientId}:{},...l.enqueuedAtMs===void 0?{}:{enqueuedAtMs:l.enqueuedAtMs},...l.deadlineAtMs===void 0?{}:{deadlineAtMs:l.deadlineAtMs},legacy:l.operationKey===void 0})}}return r.sort((t,n)=>t.claimedAtMs-n.claimedAtMs||t.path.localeCompare(n.path))}function E(e){try{let r=JSON.parse(F(e,"mailbox record"));return typeof r.id!="string"||!r.id?null:{id:r.id,...typeof r.operationKey=="string"?{operationKey:r.operationKey}:{},...typeof r.clientId=="string"?{clientId:r.clientId}:{},...typeof r.enqueuedAtMs=="number"?{enqueuedAtMs:r.enqueuedAtMs}:{},...typeof r.deadlineAtMs=="number"?{deadlineAtMs:r.deadlineAtMs}:{}}}catch{return null}}function De(e,r,t,n,i){for(let o of h(e)){if(r<=0)break;let s=D(o);t(o,s.mtimeMs)>n||(g(o,{force:!0}),i(),r--)}return r}function h(e){return M(e)?I(e,{withFileTypes:!0}).filter(r=>r.isFile()).map(r=>m(e,r.name)).sort():[]}function Se(e){try{return I(e).some(r=>r.endsWith(".json"))}catch{return!1}}function Pe(e){if(!M(e))return[];let r=[];for(let t of I(e,{withFileTypes:!0})){let n=m(e,t.name);t.isFile()?r.push(n):t.isDirectory()&&r.push(...Pe(n))}return r.sort()}function Lr(e){if(M(e))for(let r of I(e,{withFileTypes:!0})){if(!r.isDirectory())continue;let t=m(e,r.name);I(t).some(n=>n.endsWith(".claim"))||g(t,{recursive:!0,force:!0})}}function Ar(e){try{return D(e).size}catch{return 0}}function _(e){return Buffer.from(e,"utf8").toString("base64url")}function Le(e){try{let r=Buffer.from(e,"base64url").toString("utf8");return _(r)===e?r:null}catch{return null}}function Er(e){return/^[a-z0-9][a-z0-9-]{0,127}$/i.test(e)?e:`invalid-${Y("sha256").update(e).digest("hex")}`}function vr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function It(e){return typeof e=="string"&&Number.isFinite(Date.parse(e))}function kt(e){return vr(e)&&Object.values(e).every(r=>typeof r=="string"||r===null)}function Rt(e){return typeof e=="string"&&e.length>0}function Dt(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function St(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}function Lt(e){return typeof e=="string"&&e.length>0&&e.length<=256&&!/[\0\r\n]/u.test(e)}function At(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}export{vr as a,It as b,kt as c,Rt as d,Dt as e,St as f,Lt as g,At as h,ge as i,me as j,O as k,$r as l,R as m,Xe as n,ir as o,V as p,N as q,nt as r,H as s,T as t,Z as u,pt as v,C as w,bt as x,gr as y,gt as z,xt as A,wt as B,Mr as C,Mt as D,Ft as E,q as F};
9
+ //# sourceMappingURL=chunk-D7DOB27N.js.map
@@ -1,4 +1,4 @@
1
- import{eb as he,gb as z}from"./chunk-BLKYYQ7C.js";import{b as le}from"./chunk-ZZ3MWF33.js";import{j as ge,l as P,r as v}from"./chunk-ACZDU5GK.js";import{a as de,b as pe,c as D}from"./chunk-6URCE5QY.js";import{h as b}from"./chunk-4O52YNKL.js";import{AsyncLocalStorage as nt}from"async_hooks";import{createHash as V}from"crypto";import{existsSync as rt,mkdirSync as st}from"fs";import{tmpdir as it}from"os";import{isAbsolute as ot,join as ye,resolve as Se}from"path";var q=2,at="CODEBASEIQ_SESSION",me="CODEBASEIQ_SESSION_DIR",ut=128,I=new nt;function ve(e,t){let n=e.sessionEnabled===!1||e.json?void 0:It(),r={enabled:n!==void 0,reemit:e.reemit===!0,command:e.command,projectRoot:Se(e.cwd),sessionIdentity:n,staged:[],stagedEvidence:[],finalized:!1};return I.run(r,t)}function Dn(e){let t=I.getStore();!t||t.finalized||(t.generationIdentity=e)}function zn(){return I.getStore()?.staged.length??0}function qn(e){let t=I.getStore();!t||e<0||e>t.staged.length||(t.staged.length=e)}function W(e){let t=I.getStore();if(!t||t.finalized)return;t.finalized=!0;let n=t.state;if(!n){t.staged.length=0,t.stagedEvidence.length=0;return}try{if(e&&(t.staged.length>0||t.stagedEvidence.length>0)){let r=n.ledger.nextOrdinal,s=yt(t.staged).map(o=>({...o,ordinal:r,command:t.command})),i=vt(t.stagedEvidence).map(o=>({...o,ordinal:r,command:t.command}));n.ledger.ranges.push(...s),n.ledger.evidence.push(...i),n.ledger.nextOrdinal+=1,n.ledger.updatedAt=new Date().toISOString(),v(n.ledgerPath,n.ledger,{spacing:2,trailingNewline:!0})}}catch{}finally{n.lock.release(),t.state=null,t.staged.length=0,t.stagedEvidence.length=0}}function Vn(e){let t=e.source.split(`
1
+ import{eb as he,gb as z}from"./chunk-LONKINMJ.js";import{b as le}from"./chunk-ZZ3MWF33.js";import{j as ge,l as P,r as v}from"./chunk-D7DOB27N.js";import{c as de,d as pe,e as D}from"./chunk-6O3KXIDL.js";import{h as b}from"./chunk-UQYQBLJX.js";import{AsyncLocalStorage as nt}from"async_hooks";import{createHash as V}from"crypto";import{existsSync as rt,mkdirSync as st}from"fs";import{tmpdir as it}from"os";import{isAbsolute as ot,join as ye,resolve as Se}from"path";var q=2,at="CODEBASEIQ_SESSION",me="CODEBASEIQ_SESSION_DIR",ut=128,I=new nt;function ve(e,t){let n=e.sessionEnabled===!1||e.json?void 0:It(),r={enabled:n!==void 0,reemit:e.reemit===!0,command:e.command,projectRoot:Se(e.cwd),sessionIdentity:n,staged:[],stagedEvidence:[],finalized:!1};return I.run(r,t)}function Dn(e){let t=I.getStore();!t||t.finalized||(t.generationIdentity=e)}function zn(){return I.getStore()?.staged.length??0}function qn(e){let t=I.getStore();!t||e<0||e>t.staged.length||(t.staged.length=e)}function W(e){let t=I.getStore();if(!t||t.finalized)return;t.finalized=!0;let n=t.state;if(!n){t.staged.length=0,t.stagedEvidence.length=0;return}try{if(e&&(t.staged.length>0||t.stagedEvidence.length>0)){let r=n.ledger.nextOrdinal,s=yt(t.staged).map(o=>({...o,ordinal:r,command:t.command})),i=vt(t.stagedEvidence).map(o=>({...o,ordinal:r,command:t.command}));n.ledger.ranges.push(...s),n.ledger.evidence.push(...i),n.ledger.nextOrdinal+=1,n.ledger.updatedAt=new Date().toISOString(),v(n.ledgerPath,n.ledger,{spacing:2,trailingNewline:!0})}}catch{}finally{n.lock.release(),t.state=null,t.staged.length=0,t.stagedEvidence.length=0}}function Vn(e){let t=e.source.split(`
2
2
  `);if(t.length===0)return"";let n=ct(e.relativePath,e.startLine,t,e.ownerSymbol,e.sessionPolicy??"exact-unit"),r=e.indent??" ",s=e.sourceIndent??" ",i=e.focusLines??new Set;return n.map(o=>{let a=z(e.relativePath,o.startLine,o.endLine);if(o.kind==="covered"){let p=o.ordinal===null?"this command":`session #${o.ordinal} via ${o.command}`;return[`${r}${a} [source previously emitted: ${p}; not repeated]`,...e.afterHeader??[]].join(`
3
3
  `)}let u=e.headerSuffix??"",d=o.lines.map((p,l)=>{let g=o.startLine+l,c=e.showFocusMarker===!1?"":i.has(g)?">":" ",m=e.lineNumberWidth??5;return`${s}${c}${String(he(g)).padStart(m)} ${p}`});return[`${r}${a}${u}`,...e.blankAfterHeader?[""]:[],...e.afterHeader??[],...d].join(`
4
4
  `)}).join(`
@@ -18,4 +18,4 @@ ${t.command}]
18
18
  `:`
19
19
  [codebaseiq transport complete; evaluate command coverage separately]
20
20
  `;return`${r}${e.content}${s}`}export{Ae as a,Dn as b,zn as c,qn as d,Vn as e,Wn as f,Gn as g,tr as h,nr as i,Ft as j,M as k,sn as l,Or as m,br as n};
21
- //# sourceMappingURL=chunk-CDWSLAPN.js.map
21
+ //# sourceMappingURL=chunk-DAKIGMIK.js.map
@@ -0,0 +1,2 @@
1
+ import{a as z}from"./chunk-P5XHIJHI.js";import{e as be,m as ge,u as he}from"./chunk-EQNMD62X.js";import{c as we,h as Ae}from"./chunk-2PRONPAS.js";import{a as Ie,e as De,i as Me}from"./chunk-DRENNWRG.js";import{a as S,c as fe,d as M,e as p,f as X,h as Re,j,t as x,u as k,v as Ee,x as q,y as K,z as ke}from"./chunk-D7DOB27N.js";import{a as C,i as G,k as v}from"./chunk-R2NOK63J.js";import{a as A,c as me,d as ye,e as F}from"./chunk-6O3KXIDL.js";import{a as pe,b as E,g as w,ga as Se,m as J}from"./chunk-UQYQBLJX.js";import{createHash as cn}from"crypto";import{resolve as dn}from"path";var b=3;function V(e){return cn("sha256").update(x({kind:"codebaseiq-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=xe(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=xe(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 te(e,n){return S(e)?e.protocolVersion!==b?Ce(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?Ce("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)?ee("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)?ee("helper wrote an invalid success response"):{ok:!0,session:e.session,response:e.response}:ee("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"||!ve(e.operationKey)||e.id!==K(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"||!ve(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 xe(e){return!S(e)||typeof e.identityKey!="string"||!e.identityKey||!X(e.timeoutMs)||e.workerEnvironment!==void 0&&!fe(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:Z(e.referenceDefinitions)&&Z(e.calleeDefinitions)&&Z(e.signatureDefinitions)&&I(e.requestTimeoutMs)&&I(e.readinessDeadlineMs)&&I(e.referenceRetryTimeoutMs)&&I(e.diagnosticsTimeoutMs)&&I(e.settleDelayMs)&&Pe(e.concurrency)&&ne(e.includeReferences)&&ne(e.includeCallees)&&ne(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 Z(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")):_e(e.references,bn)&&(e.incompleteReferenceSymbolIds===void 0||Array.isArray(e.incompleteReferenceSymbolIds)&&e.incompleteReferenceSymbolIds.every(t=>Number.isSafeInteger(t)))&&(e.callees===void 0||_e(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 _e(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 ee(e){return{ok:!1,code:"malformed-response",error:e}}function Ce(e){return{ok:!1,code:"incompatible-response",error:e}}function ve(e){return/^[a-f0-9]{64}$/.test(e)}function Pe(e){return e===void 0||X(e)}function qe(e){return e===void 0||p(e)}function I(e){return e===void 0||Re(e)}function ne(e){return e===void 0||typeof e=="boolean"}import{spawn as xn}from"child_process";import{createHash as _n,randomUUID as Cn}from"crypto";import{existsSync as $e,realpathSync as vn,rmSync as qn}from"fs";import{tmpdir as Tn}from"os";import{resolve as _}from"path";import{execFileSync as hn}from"child_process";var Be=new WeakMap,Dn="SCIP_RUST_SCIP_OCCURRENCE_REFERENCE_MODE";function yt(e,n){let t=new Map,r=H(),s=n.filter(u=>Oe(u,r));if(s.length===0)return t;let i=Ne(e,s.map(u=>u.symbol));for(let u of s){let l=i.get(u.symbol);l&&t.set(u.symbolId,l)}return t}function St(e,n){return Oe(n,H())?Ne(e,[n.symbol]).get(n.symbol)??null:null}function Oe(e,n="safe"){if(!e.symbol.startsWith("rust-analyzer ")||!e.relativePath.endsWith(".rs")||Me(e.symbol)||/impl#\[[^\]]+\]\[Default\]default\(\)\.$/.test(e.symbol))return!1;if(n==="all")return!0;let t=De(e.symbol);if(t==="method")return!0;if(t!=="term")return!1;let r=Ie(e.symbol);return"kind"in r?!1:!Mn(r)}function Mn(e){for(let n=0;n<e.descriptors.length-1;n+=1)if(e.descriptors[n]?.suffix==="type")return!0;return!1}function Ne(e,n){let t=Be.get(e);t||(t=new Map,Be.set(e,t));let r=[...new Set(n)].filter(s=>!t.has(s));if(r.length>0){let s=he(e,r);for(let i of r){let u=s?.get(i);t.set(i,u?Ae(u.filter(({relativePath:l})=>!e.isIgnored(l)).map(({relativePath:l,occurrence:d})=>({file:l,line:d.range[0],column:d.range[1]}))):null)}}return new Map(n.map(s=>[s,t.get(s)??null]))}function H(){return process.env[Dn]==="all"?"all":"safe"}function Ue(e){let n=ge(be,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?En(e,t):"unavailable"}}function Et(e){return{...re(e),scipOccurrenceReferenceMode:H()}}function En(e,n){let t=`${e}\0${n}`,r=We.get(t);if(r)return r;let s;try{s=hn(n,["--version"],{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:2e3}).trim()}catch{s="unknown"}return We.set(t,s),s}import{createHash as kn}from"crypto";var wn=new Set(["Cargo.lock","Cargo.toml","rust-project.json","rust-toolchain","rust-toolchain.toml"]);function Le(e){let n=Se(e,{includePath:An});return kn("sha256").update(JSON.stringify(n)).digest("hex")}function An(e){let n=e.replaceAll("\\","/"),t=n.split("/").at(-1)??n;return n.endsWith(".rs")||wn.has(t)?!0:n===".cargo/config"||n===".cargo/config.toml"||n.endsWith("/.cargo/config")||n.endsWith("/.cargo/config.toml")}var Pn=5e3,Ye=10,Bn=3e4;function Fe(e,n,t,r=Ze){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:Qe(r.environment())};return{key:ie(x(i)),...i}}var je=class{constructor(n,t=Un){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=On(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&&Nn(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 On(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 ie(x(t))}function Nn(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 P(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&&ye(e.processIdentity,s)}function se(e,n,t){let r;try{r=J(n,{maxBytes:E,inputKind:"Rust semantic engine artifact"})}catch{r="missing"}let s=ie(x({projectRoot:_(e),serverPath:_(n),serverFingerprint:r})).slice(0,20);return _(t,`codebaseiq-rust-session-${s}`)}function ze(e){let n=e===void 0?Number.NaN:Number(e);return Number.isInteger(n)&&n>=0?n:0}function Qe(e){return Object.fromEntries(Object.entries(e).filter(([n])=>Xe(n)).sort(([n],[t])=>n.localeCompare(t)).map(([n,t])=>[n,t??null]))}function Je(e,n){let t=n.runtime??Kn,r=n.identityRuntime??Ze,s=se(e,n.serverPath,n.tempRoot??Tn()),i=!1,u=(l,d)=>{if(i)throw new Error("Durable Rust semantic session was already disposed.");return Ln(s,n.serverPath,n.semanticWorkerPath,l,d,t,n.mailboxLimits)};return{requestSemantic(l,d){let R=Fe(e,n.semanticWorkerPath,l,r),{readinessDeadlineMs:c,...o}=l;return u({kind:"semantic",identityKey:R.key,workerEnvironment:He(),request:{...o,referenceRetryTimeoutMs:Wn(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=Fe(e,n.semanticWorkerPath,l,r),{readinessDeadlineMs:c,...o}=l;return u({kind:"import-definitions",identityKey:R.key,workerEnvironment:He(),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 Un(e){for(let n of Object.keys(process.env))Ge(n)&&delete process.env[n];for(let[n,t]of Object.entries(e))t!==null&&(process.env[n]=t)}function Wn(e,n){return n!==void 0?n:e===void 0?Bn:void 0}function Ln(e,n,t,r,s,i,u={}){let l=i.now(),d=l+s,R=(i.monotonicNow??A)(),c=R+s,o=q("rust-semantic-v3",r),a=K(o),f=Ee(e),m=V(e),y=ke(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??A)()<=c;){if($e(y.responsePath)){let D=Fn(w(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??A)()-R,ok:!0,session:D.session,kind:r.kind}),D.response}let h=B(e);(!h||!P(h,i.now(),i.isProcessAlive,i.readProcessIdentity))&&Ve(e,n,t,c,i),i.sleep(Ye)}throw new Error(`Durable Rust semantic session timed out after ${(s/1e3).toFixed(0)}s.`)}function Ve(e,n,t,r,s){let i=B(e);if(i&&P(i,s.now(),s.isProcessAlive,s.readProcessIdentity))return;qn(_(e,"server.json"),{force:!0}),s.spawnServer(n,e,t);let u=s.monotonicNow??A,l=Math.min(r,u()+Pn);for(;u()<=l;){let d=B(e);if(d&&P(d,s.now(),s.isProcessAlive,s.readProcessIdentity))return;s.sleep(Ye)}throw new Error("Durable Rust semantic session helper did not become ready within 5s.")}function B(e){try{let n=JSON.parse(w(_(e,"server.json"),{maxBytes:pe,inputKind:"durable Rust session state"}));if(typeof n.protocolVersion!="number"||n.sessionIdentity!==void 0&&(typeof n.sessionIdentity!="string"||n.sessionIdentity!==V(e))||typeof n.pid!="number"||typeof n.heartbeatAtMs!="number"||n.busyUntilMs!==void 0&&typeof n.busyUntilMs!="number"||n.mailbox!==void 0&&!jn(n.mailbox))return null;let t=n.processIdentity===void 0?null:me(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 Fn(e,n){try{return te(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 jn(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 He(){return Object.fromEntries(Object.entries(process.env).filter(([e])=>Ge(e)).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>[e,n??null]))}function Xe(e){return e==="HOME"||e==="PATH"||e.startsWith("CARGO_")||e.startsWith("RA_")||e.startsWith("RUST")}function Ge(e){return Xe(e)||e.startsWith("SCIP_RUST_")||e==="CODEBASEIQ_PROFILE"||e==="CODEBASEIQ_PROFILE_CACHE_STATE"||e==="CODEBASEIQ_PROFILE_COMMAND"||e==="CODEBASEIQ_PROFILE_OUT"||e==="CODEBASEIQ_PROFILE_RUN_ID"||e==="CODEBASEIQ_PROFILE_WORKLOAD_IDENTITY"||e==="CODEBASEIQ_PROFILE_WORKLOAD_IDENTITY_KIND"||e==="CODEBASEIQ_PROFILE_MIN_MS"}var Ze={canonicalProjectRoot(e){try{return vn(e)}catch{return _(e)}},projectFingerprint(e){return Le(e)},engineIdentity:re,fileFingerprint(e){return J(e,{maxBytes:E,inputKind:"Rust semantic engine artifact"})},environment(){return Qe(process.env)}},Kn={now:Date.now,monotonicNow:A,randomId:Cn,isProcessAlive:j,readProcessIdentity:F,spawnServer(e,n,t){if(!$e(e))throw new Error(`Durable Rust semantic session helper was not found at ${e}. Run npm run build first.`);xn(process.execPath,[e,n,t],{detached:!0,stdio:"ignore",windowsHide:!0}).unref()},sleep(e){let n=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(n,0,0,e)}};function ie(e){return _n("sha256").update(e).digest("hex")}import{existsSync as zn,mkdtempSync as en,rmSync as ae}from"fs";import{tmpdir as ce}from"os";import{join as ue}from"path";import{fileURLToPath as L,pathToFileURL as Vn}from"url";import{SHARE_ENV as Hn,Worker as $n}from"worker_threads";function $(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 oe(e,n,t){let r=z(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 nn=15e3,tn=8,sn=5e3,Yn=64,Qn=96,de=class{constructor(n,t,r={}){this.projectRoot=n;this.status=t;this.opts=r;this.requester=r.requester??Zn(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:N(t),references:U(n)};try{let r=this.requestSession(t.resolvedBinary,n,{includeReferences:!0});return{...O(r),resolvedBinary:t.resolvedBinary,references:$(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:U(n)}}}calleesForDefinitions(n){let t=this.status(this.projectRoot);if(!t.available||!t.resolvedBinary)return{available:!1,resolvedBinary:t.resolvedBinary,reason:N(t),callees:W(n)};try{let r=this.requestSession(t.resolvedBinary,n,{includeReferences:!1,includeCallees:!0});return{...O(r),resolvedBinary:t.resolvedBinary,callees:le(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:W(n)}}}referencesAndCalleesForDefinitions(n,t){let r=this.status(this.projectRoot);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:N(r),references:U(n),callees:W(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{...O(i),resolvedBinary:r.resolvedBinary,references:$(n,new Map(i.references),new Set(i.incompleteReferenceSymbolIds??[])),callees:le(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:N(t),signatures:rn(n)};try{let r=this.requestSession(t.resolvedBinary,n,{includeReferences:!1,includeCallees:!1,includeSignatures:!0});return{...O(r),resolvedBinary:t.resolvedBinary,signatures:st(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:rn(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:N(r),sourcePaths:new Map(t.map(s=>[s.id,null]))};try{let s=this.requestImportDefinitions(r.resolvedBinary,n,t);return{...O(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=Y(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,nn),i=Q(process.env.SCIP_RUST_SEMANTIC_REFERENCE_RETRY_TIMEOUT_MS,0),u=Y(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,tn),l=Q(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=Jn(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=it(a);return G("rust.semantic.session.request",()=>this.requester.requestSemantic(a,oe(f,ot(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:U(t)}:this.opts.fallbackReferenceResolver?.referencesForDefinitions(t),u=r.length===0?{available:!0,resolvedBinary:n.resolvedBinary,callees:W(r)}:this.opts.fallbackCalleeResolver?.calleesForDefinitions(r);if(i&&u){let l={resolvedBinary:i.resolvedBinary??u.resolvedBinary??n.resolvedBinary,references:$(t,i.references),callees:le(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:U(t),callees:W(r)}}requestImportDefinitions(n,t,r){let s=Y(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,nn),i=Y(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,tn),u=Q(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(s,1e4)),l=Q(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,sn),d={projectRoot:this.projectRoot,rustAnalyzerBinary:n,file:t,positions:[...r],requestTimeoutMs:s,diagnosticsTimeoutMs:u,settleDelayMs:l,concurrency:i};return G("rust.semantic.import-definitions.session.request",()=>this.requester.requestImportDefinitions(d,oe(r.length,s,i)),()=>({file:t,positions:r.length}))}};function O(e){return e.available?{available:!0}:{available:!1,reason:e.reason}}function N(e){return e.available?"rust-analyzer binary path is unavailable.":e.reason}function ur(e,n,t={}){return new de(e,n,t)}function Jn(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<=Yn||r&&n.includeCallees===!0&&n.includeSignatures!==!0&&n.definitionCount<=Qn?0:sn}function on(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 Xn(e){return on(e).transport}function lr(e,n){let t=on(n);if(t.transport==="worker")return{...t,state:"per-command"};let r=L(un()),s=se(e,r,ce()),i=B(s);return i?{...t,state:P(i,Date.now(),j,F)?"live":"stale",pid:i.pid,heartbeatAtMs:i.heartbeatAtMs,...i.busyUntilMs===void 0?{}:{busyUntilMs:i.busyUntilMs}}:{...t,state:"stopped"}}function Gn(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=rt(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 Zn(e,n,t={worker:()=>et(),durable:()=>Je(e,{serverPath:L(un()),semanticWorkerPath:L(an())})}){return Xn(n)==="durable"?Gn(t.durable(),t.worker):t.worker()}function et(e={}){let n=null,t=null,r=1,s=!1,i=null,u=null,l=o=>{o&&ae(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?Vn(e.semanticWorkerPath):an();if(!zn(L(o)))throw new Error(`Rust semantic session worker was not found at ${L(o)}. Run npm run build before using built semantic Rust queries.`);return t=en(ue(ce(),"codebaseiq-rust-session-")),n=new $n(o,e.shareEnvironment?{env:Hn}:void 0),n.unref(),n},c=()=>{let o=t??en(ue(ce(),"codebaseiq-rust-session-"));return t=o,ue(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=nt(w(m,{maxBytes:E,inputKind:"Rust semantic worker response"}));if(!g.ok)throw new Error(g.error);return g.response}finally{ae(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=tt(w(m,{maxBytes:E,inputKind:"Rust import-definition worker response"}));if(!g.ok)throw new Error(g.error);return g.response}finally{ae(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 nt(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 tt(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 rt(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 U(e){return new Map(e.map(n=>[n.symbolId,[]]))}function W(e){return new Map(e.map(n=>[n.symbolId,[]]))}function rn(e){return new Map(e.map(n=>[n.symbolId,null]))}function le(e,n){return new Map(e.map(t=>[t.symbolId,n.get(t.symbolId)??[]]))}function st(e,n){return new Map(e.map(t=>[t.symbolId,n.get(t.symbolId)??null]))}function it(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 ot(e,n){return n&&n>0?Math.max(e,n):e}function an(){return new URL("./rust-semantic-session-worker.js",import.meta.url)}function un(){return new URL("./rust-semantic-session-server.js",import.meta.url)}function Y(e,n){return z(e)??n}function Q(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{yt as a,St as b,Ue as c,Et as d,b as e,V as f,pn as g,je as h,$ as i,oe as j,ur as k,Jn as l,lr as m,et as n,ot as o};
2
+ //# sourceMappingURL=chunk-DDN2F6GB.js.map
@@ -1,2 +1,2 @@
1
- import{h as p,j as x,l,p as g,x as v}from"./chunk-TAJ6UGCO.js";import{X as d}from"./chunk-IGQQUENU.js";import{P as h,S as u,ia as f}from"./chunk-WJOQC4P7.js";import{G as m}from"./chunk-4O52YNKL.js";import{existsSync as C}from"fs";var E=5e3,S=100,R={prepare:f,freshness:h,ensureService:x,inspectService:l,requestRefresh:g,async reindex(e,t,n,o){let{reindexConfiguredProject:a}=await import("./project-reindex-NGM3DYBN.js");return a(e,t,n,o)},indexExists:C,wait(e){return new Promise(t=>setTimeout(t,e))},now:Date.now};async function I(e,t=R,n={}){if(e.dbPathSource==="env")return{source:"explicit-index",service:{kind:"skipped",reason:"environment"}};if(v(e.commandName,e.config)&&t.indexExists(e.paths.dbPath))return{source:"published-generation",service:{kind:"skipped",reason:"excluded-command"}};let o=y(e,t),a=t.prepare(e.projectRoot,e.config,e.paths,{gitContext:e.gitContext,...o?{watcherGeneration:o}:{}}),r=t.freshness(e.projectRoot,e.config,e.paths),i=t.ensureService({commandName:e.commandName,projectRoot:e.projectRoot,cacheDir:e.paths.cacheDir,cliVersion:m,config:e.config,gitContext:e.gitContext});if(r.state==="fresh")return{source:a.kind==="local-fresh"?"existing":"shared-generation",service:i};if((i.kind==="started"||i.kind==="reused")&&(t.requestRefresh(d(e.paths.cacheDir).activityPath,`evidence command ${e.commandName} requires a fresh generation`),r=await F(e,r,t,n,i),r.state==="fresh"))return{source:"watcher",service:i};try{await t.reindex(e.projectRoot,e.config,e.paths,{allowPartial:!1,skipAutoInstall:!0,trigger:{kind:"watch-demand",detail:`codebaseiq ${e.commandName}`},onStatus:()=>{}})}catch(s){throw new Error(`Could not prepare fresh evidence for codebaseiq ${e.commandName}: ${s instanceof Error?s.message:String(s)}`,{cause:s})}if(r=t.freshness(e.projectRoot,e.config,e.paths),r.state!=="fresh")throw new Error(`Could not prepare fresh evidence for codebaseiq ${e.commandName}: index remained ${r.state} (${r.reason})`);return{source:"synchronous-reindex",service:i}}function y(e,t){if(e.config.watch?.enabled===!0)try{return p(t.inspectService({projectRoot:e.projectRoot,cacheDir:e.paths.cacheDir,cliVersion:m,gitContext:e.gitContext}))}catch{return}}async function F(e,t,n,o,a){if(a.state.watcher.state==="budget-paused")return t;let r=Math.max(0,o.waitMs??E),i=Math.max(1,o.pollMs??S),s=n.now()+r,c=t;for(;n.now()<s;)if(await n.wait(Math.min(i,Math.max(1,s-n.now()))),u(),c=n.freshness(e.projectRoot,e.config,e.paths),c.state==="fresh")return c;return c}export{I as a};
2
- //# sourceMappingURL=chunk-L3YSDLNB.js.map
1
+ import{h as p,j as x,l,p as g,x as v}from"./chunk-GWYZVVKY.js";import{Q as d}from"./chunk-6WAPPQ5F.js";import{P as h,S as u,ia as f}from"./chunk-MEUHIDI3.js";import{G as m}from"./chunk-UQYQBLJX.js";import{existsSync as C}from"fs";var E=5e3,S=100,R={prepare:f,freshness:h,ensureService:x,inspectService:l,requestRefresh:g,async reindex(e,t,n,o){let{reindexConfiguredProject:a}=await import("./project-reindex-CRJU3IFG.js");return a(e,t,n,o)},indexExists:C,wait(e){return new Promise(t=>setTimeout(t,e))},now:Date.now};async function I(e,t=R,n={}){if(e.dbPathSource==="env")return{source:"explicit-index",service:{kind:"skipped",reason:"environment"}};if(v(e.commandName,e.config)&&t.indexExists(e.paths.dbPath))return{source:"published-generation",service:{kind:"skipped",reason:"excluded-command"}};let o=y(e,t),a=t.prepare(e.projectRoot,e.config,e.paths,{gitContext:e.gitContext,...o?{watcherGeneration:o}:{}}),r=t.freshness(e.projectRoot,e.config,e.paths),i=t.ensureService({commandName:e.commandName,projectRoot:e.projectRoot,cacheDir:e.paths.cacheDir,cliVersion:m,config:e.config,gitContext:e.gitContext});if(r.state==="fresh")return{source:a.kind==="local-fresh"?"existing":"shared-generation",service:i};if((i.kind==="started"||i.kind==="reused")&&(t.requestRefresh(d(e.paths.cacheDir).activityPath,`evidence command ${e.commandName} requires a fresh generation`),r=await F(e,r,t,n,i),r.state==="fresh"))return{source:"watcher",service:i};try{await t.reindex(e.projectRoot,e.config,e.paths,{allowPartial:!1,skipAutoInstall:!0,trigger:{kind:"watch-demand",detail:`codebaseiq ${e.commandName}`},onStatus:()=>{}})}catch(s){throw new Error(`Could not prepare fresh evidence for codebaseiq ${e.commandName}: ${s instanceof Error?s.message:String(s)}`,{cause:s})}if(r=t.freshness(e.projectRoot,e.config,e.paths),r.state!=="fresh")throw new Error(`Could not prepare fresh evidence for codebaseiq ${e.commandName}: index remained ${r.state} (${r.reason})`);return{source:"synchronous-reindex",service:i}}function y(e,t){if(e.config.watch?.enabled===!0)try{return p(t.inspectService({projectRoot:e.projectRoot,cacheDir:e.paths.cacheDir,cliVersion:m,gitContext:e.gitContext}))}catch{return}}async function F(e,t,n,o,a){if(a.state.watcher.state==="budget-paused")return t;let r=Math.max(0,o.waitMs??E),i=Math.max(1,o.pollMs??S),s=n.now()+r,c=t;for(;n.now()<s;)if(await n.wait(Math.min(i,Math.max(1,s-n.now()))),u(),c=n.freshness(e.projectRoot,e.config,e.paths),c.state==="fresh")return c;return c}export{I as a};
2
+ //# sourceMappingURL=chunk-DVWO7RBC.js.map