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,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{t as Y}from"./chunk-CIVYHK7U.js";import{f as H}from"./chunk-RJWAB4VR.js";import{d as L,e as W}from"./chunk-D62CTZX6.js";import{R as $,S as w,Wa as F,X as G,Xa as J,fb as M,m as B,o as m,p as N,q as z,t as v}from"./chunk-G2XUZCF2.js";import{d as A,f as O,j as C,r as R}from"./chunk-DUKHVPU5.js";import{existsSync as k,lstatSync as b,readdirSync as K,realpathSync as U,rmSync as S,statSync as Q}from"fs";import{join as l,resolve as P,sep as V}from"path";var ne=3600*1e3,oe=2*1024*1024*1024,x=300*1e3,se="gc-state.json",ae="gc.lock",ie="projects-gc-state.json",ce="projects-gc.lock",le=1440*60*1e3;function de(t){let e=t.leases.filter(o=>o.managed&&!o.live&&!o.busy),n=X(t.leases,t.locks),r={};for(let o of t.generations)n.has(o.generationId)||(r[o.generationId]=o.unreferencedAt??t.nowMs);let a=t.generations.filter(o=>!n.has(o.generationId)).sort((o,d)=>r[o.generationId]-r[d.generationId]||o.generationId.localeCompare(d.generationId)),s=new Set;for(let o of a)t.nowMs-r[o.generationId]>=t.policy.generationTtlMs&&s.add(o.generationId);let c=t.generations.filter(o=>!s.has(o.generationId)).reduce((o,d)=>o+d.size,0);for(let o of a){if(c<=t.policy.budgetBytes)break;s.has(o.generationId)||(s.add(o.generationId),c-=o.size)}for(let o of s)delete r[o];return{deleteWorktrees:e,deleteGenerations:t.generations.filter(o=>s.has(o.generationId)),deleteLocks:t.locks.filter(o=>!o.live),deleteTemporaries:t.temporaries.filter(o=>!o.live),protectedGenerationIds:[...n].sort(),unreferencedSince:r}}function X(t,e){let n=new Set(t.filter(r=>r.managed&&(r.live||r.busy)).flatMap(r=>[r.lease.baseGenerationId,r.lease.activeGenerationId]).filter(r=>r!==void 0));for(let r of e)r.live&&n.add(r.generationId);return n}function Le(t,e,n={}){if(!z())return{kind:"disabled"};let r=A(t);if(!r)return{kind:"unavailable"};let a=l(m(),"repositories",r.repositoryId),s=(n.now??Date.now)(),c=k(a)?Z(t,a,r.repositoryId,e,s,n):{kind:"unavailable"};return fe(t,r.repositoryId,e,s,n),ue(s,n),c}function ue(t,e){let n=l(m(),"projects"),r={examined:0,reclaimed:0};if(!k(n))return r;let a=l(n,ie),s=re(a);if(!e.force&&s!==void 0&&t-s<x)return r;let c=w(l(n,ce));if(!c)return r;try{for(let o of I(n)){let d=l(n,o),i;try{i=b(d)}catch{continue}if(!(!i.isDirectory()||i.isSymbolicLink())&&(r.examined+=1,!!pe(d,t)))try{S(d,{recursive:!0,force:!0}),r.reclaimed+=1}catch{}}G(a,{version:1,lastSweepAt:new Date(t).toISOString()},{spacing:2,trailingNewline:!0})}finally{c.release()}return r}function pe(t,e){let n=l(t,B),r;try{let c=JSON.parse(R(n,"cache-ownership"));if(typeof c.canonicalProjectRoot!="string"||c.canonicalProjectRoot.length===0)return!1;r=c.canonicalProjectRoot}catch{return!1}if(k(r))return!1;try{if(e-b(t).mtimeMs<le)return!1}catch{return!1}let a=W(L(t).statePath);if(a&&C(a.pid))return!1;let s=w(l(t,"cache-lifecycle.lock"));return s===null?!1:(s.release(),!0)}function Z(t,e,n,r,a,s){let c=l(e,"gc-state.json"),o=te(c);if(!s.force&&o&&a-Date.parse(o.lastSweepAt)<x)return{kind:"throttled",sweptAt:o.lastSweepAt};let d=$(e,{now:()=>a});if(!d)return{kind:"busy"};try{let i=ee(t,e,n,o?.unreferencedSince??{}),u=de({nowMs:a,...i,policy:{generationTtlMs:s.policy?.generationTtlMs??ne,budgetBytes:s.policy?.budgetBytes??oe}}),p=0,y=0;for(let f of u.deleteWorktrees){if(!T(f.lease))continue;if(!k(f.lease.localCacheDir)){S(f.leasePath,{force:!0}),y+=1;continue}if(!he(f.lease))continue;let _=w(l(f.lease.localCacheDir,"cache-lifecycle.lock"));if(_)try{if(E(f.lease,!0))continue;try{Y({projectRoot:f.lease.projectRoot,cacheDir:f.lease.localCacheDir,cliVersion:r})}catch{continue}if(E(f.lease,!0))continue;S(f.lease.localCacheDir,{recursive:!0,force:!0}),S(f.leasePath,{force:!0}),y+=1}finally{_.release()}}for(let f of u.deleteLocks)S(f.path,{force:!0});for(let f of u.deleteTemporaries)S(f.path,{recursive:!0,force:!0});for(let f of u.deleteGenerations)S(f.path,{recursive:!0,force:!0}),p+=f.size;H(l(e,"evidence.db"));let g={kind:"swept",sweptAt:new Date(a).toISOString(),deletedWorktrees:y,deletedGenerations:u.deleteGenerations.length,deletedBytes:p,protectedGenerations:u.protectedGenerationIds.length},h={version:1,lastSweepAt:g.sweptAt,unreferencedSince:u.unreferencedSince,lastResult:g};return G(c,h,{spacing:2,trailingNewline:!0}),g}catch(i){return{kind:"failed",error:i instanceof Error?i.message:String(i)}}finally{d.release()}}function fe(t,e,n,r,a){let s=l(m(),"repositories");if(!k(s))return;let c=l(s,se),o=re(c);if(!a.force&&o!==void 0&&r-o<x)return;let d=w(l(s,ae));if(d)try{for(let i of I(s)){if(i===e||!/^[a-f0-9]{24}$/.test(i))continue;let u=l(s,i),p;try{p=b(u)}catch{continue}if(!p.isDirectory()||p.isSymbolicLink())continue;let y=ge(u)??t;Z(y,u,i,n,r,a)}G(c,{version:1,lastSweepAt:new Date(r).toISOString()},{spacing:2,trailingNewline:!0})}finally{d.release()}}function Ee(t,e,n){let r=F(t,n.dbPath,e);if(r)return{state:"bypassed",reason:r,localCacheDir:n.cacheDir,generations:0,generationBytes:0,protectedGenerations:0,unreferencedGenerations:0,unreferencedBytes:0,temporaryGenerations:0,sharedEvidence:{exists:!1,bytes:0}};let a=A(t);if(!a)return{state:"unavailable",reason:"Git worktree identity is unavailable",localCacheDir:n.cacheDir,generations:0,generationBytes:0,protectedGenerations:0,unreferencedGenerations:0,unreferencedBytes:0,temporaryGenerations:0,sharedEvidence:{exists:!1,bytes:0}};let s=l(m(),"repositories",a.repositoryId),c=j(l(s,"worktrees",`${a.worktreeId}.json`)),o=te(l(s,"gc-state.json")),d=ee(t,s,a.repositoryId,o?.unreferencedSince??{}),i=X(d.leases,d.locks),u=d.generations.filter(h=>!i.has(h.generationId)),p=d.generations.reduce((h,f)=>h+f.size,0),y=J(t,e),g=0;return y&&(g=ye(y)),{state:"managed",repositoryId:a.repositoryId,worktreeId:a.worktreeId,localCacheDir:n.cacheDir,...c?{baseGenerationId:c.baseGenerationId,activeGenerationId:c.activeGenerationId,lastAction:c.lastAction,reason:c.lastReason,lastSeenAt:c.lastSeenAt}:{},generations:d.generations.length,generationBytes:p,protectedGenerations:d.generations.filter(h=>i.has(h.generationId)).length,unreferencedGenerations:u.length,unreferencedBytes:u.reduce((h,f)=>h+f.size,0),temporaryGenerations:d.temporaries.length,sharedEvidence:{path:y,exists:g>0,bytes:g},cleanup:o?.lastResult}}function ye(t){return[t,`${t}-wal`,`${t}-shm`].reduce((e,n)=>{try{return e+Q(n).size}catch{return e}},0)}function ee(t,e,n,r){let a=new Set(O(t).map(i=>P(i.path))),s=[];for(let i of I(l(e,"worktrees"))){if(!i.endsWith(".json"))continue;let u=l(e,"worktrees",i),p=j(u);if(!p)continue;let y=P(p.projectRoot);s.push({leasePath:u,lease:p,managed:p.repositoryId===n&&T(p),live:a.has(y)||k(y),busy:E(p)})}let c=[];for(let i of I(l(e,"locks"))){let u=/^([a-f0-9]{64})\.lock$/.exec(i);if(!u)continue;let p=l(e,"locks",i),y=D(p),g=y!==void 0&&C(y),h=u[1];c.push({generationId:h,path:p,live:g})}let o=[],d=[];for(let i of I(l(e,"generations"))){let u=/^\.tmp-(\d+)-/.exec(i);if(u){let g=l(e,"generations",i),h=Number(u[1]);try{d.push({path:g,size:q(g),live:Number.isSafeInteger(h)&&C(h)})}catch{}continue}if(!/^[a-f0-9]{64}$/.test(i))continue;let p=l(e,"generations",i),y;try{y=b(p)}catch{continue}!y.isDirectory()||y.isSymbolicLink()||o.push({generationId:i,path:p,size:q(p),...r[i]===void 0?{}:{unreferencedAt:r[i]}})}return{leases:s,generations:o,locks:c,temporaries:d}}function T(t){if(t.ownershipChecksum!==M(t)||v(t.localCacheDir)!==v(N(t.projectRoot)))return!1;let e=v(l(m(),"projects"));return v(t.localCacheDir).startsWith(`${e}${V}`)}function he(t){if(!T(t))return!1;let e=P(m()),n=P(l(e,"projects")),r=P(t.localCacheDir);try{let a=b(e),s=b(n),c=b(r);if(!a.isDirectory()||a.isSymbolicLink()||!s.isDirectory()||s.isSymbolicLink()||!c.isDirectory()||c.isSymbolicLink())return!1;let o=U(n);return U(r).startsWith(`${o}${V}`)}catch{return!1}}function ge(t){for(let e of I(l(t,"worktrees"))){if(!e.endsWith(".json"))continue;let n=j(l(t,"worktrees",e));if(n)return n.projectRoot}}function E(t,e=!1){for(let r of e?["index.lock"]:["index.lock","cache-lifecycle.lock"]){let a=D(l(t.localCacheDir,r));if(a!==void 0&&C(a))return!0}let n=D(L(t.localCacheDir).lockPath);return n!==void 0&&C(n)}function j(t){try{let e=JSON.parse(R(t,"worktree cache lease"));return e.version!==1||typeof e.repositoryId!="string"||typeof e.worktreeId!="string"||typeof e.projectRoot!="string"||e.treeOid!==void 0&&typeof e.treeOid!="string"||typeof e.localCacheDir!="string"||e.baseGenerationId!==void 0&&typeof e.baseGenerationId!="string"||e.activeGenerationId!==void 0&&typeof e.activeGenerationId!="string"||typeof e.ownershipChecksum!="string"||!/^[a-f0-9]{64}$/.test(e.ownershipChecksum)||typeof e.lastAction!="string"||e.lastReason!==void 0&&typeof e.lastReason!="string"||typeof e.lastSeenAt!="string"?null:e}catch{return null}}function D(t){try{let e=JSON.parse(R(t,"watch lock record"));return typeof e.pid=="number"&&Number.isSafeInteger(e.pid)&&e.pid>0?e.pid:void 0}catch{return}}function te(t){try{let e=JSON.parse(R(t,"repository cache GC state"));return e.version!==1||typeof e.lastSweepAt!="string"||!Number.isFinite(Date.parse(e.lastSweepAt))||!e.unreferencedSince||typeof e.unreferencedSince!="object"||!e.lastResult?null:e}catch{return null}}function re(t){try{let e=JSON.parse(R(t,"global repository cache GC state"));if(e.version!==1||typeof e.lastSweepAt!="string")return;let n=Date.parse(e.lastSweepAt);return Number.isFinite(n)?n:void 0}catch{return}}function I(t){try{return K(t)}catch{return[]}}function q(t){let e=0,n=[t];for(;n.length>0;){let r=n.pop();for(let a of K(r,{withFileTypes:!0})){let s=l(r,a.name);a.isDirectory()?n.push(s):a.isFile()&&(e+=Q(s).size)}}return e}export{Le as a,Ee as b};
3
- //# sourceMappingURL=chunk-YYFV32WR.js.map
2
+ import{t as Y}from"./chunk-5IC2WZAL.js";import{f as H}from"./chunk-FTTV7IRX.js";import{d as L,e as W}from"./chunk-D62CTZX6.js";import{R as $,S as w,Wa as F,X as G,Xa as J,fb as M,m as B,o as m,p as N,q as z,t as v}from"./chunk-5T44HG5Y.js";import{d as A,f as O,j as C,r as R}from"./chunk-DUKHVPU5.js";import{existsSync as k,lstatSync as b,readdirSync as K,realpathSync as U,rmSync as S,statSync as Q}from"fs";import{join as l,resolve as P,sep as V}from"path";var ne=3600*1e3,oe=2*1024*1024*1024,x=300*1e3,se="gc-state.json",ae="gc.lock",ie="projects-gc-state.json",ce="projects-gc.lock",le=1440*60*1e3;function de(t){let e=t.leases.filter(o=>o.managed&&!o.live&&!o.busy),n=X(t.leases,t.locks),r={};for(let o of t.generations)n.has(o.generationId)||(r[o.generationId]=o.unreferencedAt??t.nowMs);let a=t.generations.filter(o=>!n.has(o.generationId)).sort((o,d)=>r[o.generationId]-r[d.generationId]||o.generationId.localeCompare(d.generationId)),s=new Set;for(let o of a)t.nowMs-r[o.generationId]>=t.policy.generationTtlMs&&s.add(o.generationId);let c=t.generations.filter(o=>!s.has(o.generationId)).reduce((o,d)=>o+d.size,0);for(let o of a){if(c<=t.policy.budgetBytes)break;s.has(o.generationId)||(s.add(o.generationId),c-=o.size)}for(let o of s)delete r[o];return{deleteWorktrees:e,deleteGenerations:t.generations.filter(o=>s.has(o.generationId)),deleteLocks:t.locks.filter(o=>!o.live),deleteTemporaries:t.temporaries.filter(o=>!o.live),protectedGenerationIds:[...n].sort(),unreferencedSince:r}}function X(t,e){let n=new Set(t.filter(r=>r.managed&&(r.live||r.busy)).flatMap(r=>[r.lease.baseGenerationId,r.lease.activeGenerationId]).filter(r=>r!==void 0));for(let r of e)r.live&&n.add(r.generationId);return n}function Le(t,e,n={}){if(!z())return{kind:"disabled"};let r=A(t);if(!r)return{kind:"unavailable"};let a=l(m(),"repositories",r.repositoryId),s=(n.now??Date.now)(),c=k(a)?Z(t,a,r.repositoryId,e,s,n):{kind:"unavailable"};return fe(t,r.repositoryId,e,s,n),ue(s,n),c}function ue(t,e){let n=l(m(),"projects"),r={examined:0,reclaimed:0};if(!k(n))return r;let a=l(n,ie),s=re(a);if(!e.force&&s!==void 0&&t-s<x)return r;let c=w(l(n,ce));if(!c)return r;try{for(let o of I(n)){let d=l(n,o),i;try{i=b(d)}catch{continue}if(!(!i.isDirectory()||i.isSymbolicLink())&&(r.examined+=1,!!pe(d,t)))try{S(d,{recursive:!0,force:!0}),r.reclaimed+=1}catch{}}G(a,{version:1,lastSweepAt:new Date(t).toISOString()},{spacing:2,trailingNewline:!0})}finally{c.release()}return r}function pe(t,e){let n=l(t,B),r;try{let c=JSON.parse(R(n,"cache-ownership"));if(typeof c.canonicalProjectRoot!="string"||c.canonicalProjectRoot.length===0)return!1;r=c.canonicalProjectRoot}catch{return!1}if(k(r))return!1;try{if(e-b(t).mtimeMs<le)return!1}catch{return!1}let a=W(L(t).statePath);if(a&&C(a.pid))return!1;let s=w(l(t,"cache-lifecycle.lock"));return s===null?!1:(s.release(),!0)}function Z(t,e,n,r,a,s){let c=l(e,"gc-state.json"),o=te(c);if(!s.force&&o&&a-Date.parse(o.lastSweepAt)<x)return{kind:"throttled",sweptAt:o.lastSweepAt};let d=$(e,{now:()=>a});if(!d)return{kind:"busy"};try{let i=ee(t,e,n,o?.unreferencedSince??{}),u=de({nowMs:a,...i,policy:{generationTtlMs:s.policy?.generationTtlMs??ne,budgetBytes:s.policy?.budgetBytes??oe}}),p=0,y=0;for(let f of u.deleteWorktrees){if(!T(f.lease))continue;if(!k(f.lease.localCacheDir)){S(f.leasePath,{force:!0}),y+=1;continue}if(!he(f.lease))continue;let _=w(l(f.lease.localCacheDir,"cache-lifecycle.lock"));if(_)try{if(E(f.lease,!0))continue;try{Y({projectRoot:f.lease.projectRoot,cacheDir:f.lease.localCacheDir,cliVersion:r})}catch{continue}if(E(f.lease,!0))continue;S(f.lease.localCacheDir,{recursive:!0,force:!0}),S(f.leasePath,{force:!0}),y+=1}finally{_.release()}}for(let f of u.deleteLocks)S(f.path,{force:!0});for(let f of u.deleteTemporaries)S(f.path,{recursive:!0,force:!0});for(let f of u.deleteGenerations)S(f.path,{recursive:!0,force:!0}),p+=f.size;H(l(e,"evidence.db"));let g={kind:"swept",sweptAt:new Date(a).toISOString(),deletedWorktrees:y,deletedGenerations:u.deleteGenerations.length,deletedBytes:p,protectedGenerations:u.protectedGenerationIds.length},h={version:1,lastSweepAt:g.sweptAt,unreferencedSince:u.unreferencedSince,lastResult:g};return G(c,h,{spacing:2,trailingNewline:!0}),g}catch(i){return{kind:"failed",error:i instanceof Error?i.message:String(i)}}finally{d.release()}}function fe(t,e,n,r,a){let s=l(m(),"repositories");if(!k(s))return;let c=l(s,se),o=re(c);if(!a.force&&o!==void 0&&r-o<x)return;let d=w(l(s,ae));if(d)try{for(let i of I(s)){if(i===e||!/^[a-f0-9]{24}$/.test(i))continue;let u=l(s,i),p;try{p=b(u)}catch{continue}if(!p.isDirectory()||p.isSymbolicLink())continue;let y=ge(u)??t;Z(y,u,i,n,r,a)}G(c,{version:1,lastSweepAt:new Date(r).toISOString()},{spacing:2,trailingNewline:!0})}finally{d.release()}}function Ee(t,e,n){let r=F(t,n.dbPath,e);if(r)return{state:"bypassed",reason:r,localCacheDir:n.cacheDir,generations:0,generationBytes:0,protectedGenerations:0,unreferencedGenerations:0,unreferencedBytes:0,temporaryGenerations:0,sharedEvidence:{exists:!1,bytes:0}};let a=A(t);if(!a)return{state:"unavailable",reason:"Git worktree identity is unavailable",localCacheDir:n.cacheDir,generations:0,generationBytes:0,protectedGenerations:0,unreferencedGenerations:0,unreferencedBytes:0,temporaryGenerations:0,sharedEvidence:{exists:!1,bytes:0}};let s=l(m(),"repositories",a.repositoryId),c=j(l(s,"worktrees",`${a.worktreeId}.json`)),o=te(l(s,"gc-state.json")),d=ee(t,s,a.repositoryId,o?.unreferencedSince??{}),i=X(d.leases,d.locks),u=d.generations.filter(h=>!i.has(h.generationId)),p=d.generations.reduce((h,f)=>h+f.size,0),y=J(t,e),g=0;return y&&(g=ye(y)),{state:"managed",repositoryId:a.repositoryId,worktreeId:a.worktreeId,localCacheDir:n.cacheDir,...c?{baseGenerationId:c.baseGenerationId,activeGenerationId:c.activeGenerationId,lastAction:c.lastAction,reason:c.lastReason,lastSeenAt:c.lastSeenAt}:{},generations:d.generations.length,generationBytes:p,protectedGenerations:d.generations.filter(h=>i.has(h.generationId)).length,unreferencedGenerations:u.length,unreferencedBytes:u.reduce((h,f)=>h+f.size,0),temporaryGenerations:d.temporaries.length,sharedEvidence:{path:y,exists:g>0,bytes:g},cleanup:o?.lastResult}}function ye(t){return[t,`${t}-wal`,`${t}-shm`].reduce((e,n)=>{try{return e+Q(n).size}catch{return e}},0)}function ee(t,e,n,r){let a=new Set(O(t).map(i=>P(i.path))),s=[];for(let i of I(l(e,"worktrees"))){if(!i.endsWith(".json"))continue;let u=l(e,"worktrees",i),p=j(u);if(!p)continue;let y=P(p.projectRoot);s.push({leasePath:u,lease:p,managed:p.repositoryId===n&&T(p),live:a.has(y)||k(y),busy:E(p)})}let c=[];for(let i of I(l(e,"locks"))){let u=/^([a-f0-9]{64})\.lock$/.exec(i);if(!u)continue;let p=l(e,"locks",i),y=D(p),g=y!==void 0&&C(y),h=u[1];c.push({generationId:h,path:p,live:g})}let o=[],d=[];for(let i of I(l(e,"generations"))){let u=/^\.tmp-(\d+)-/.exec(i);if(u){let g=l(e,"generations",i),h=Number(u[1]);try{d.push({path:g,size:q(g),live:Number.isSafeInteger(h)&&C(h)})}catch{}continue}if(!/^[a-f0-9]{64}$/.test(i))continue;let p=l(e,"generations",i),y;try{y=b(p)}catch{continue}!y.isDirectory()||y.isSymbolicLink()||o.push({generationId:i,path:p,size:q(p),...r[i]===void 0?{}:{unreferencedAt:r[i]}})}return{leases:s,generations:o,locks:c,temporaries:d}}function T(t){if(t.ownershipChecksum!==M(t)||v(t.localCacheDir)!==v(N(t.projectRoot)))return!1;let e=v(l(m(),"projects"));return v(t.localCacheDir).startsWith(`${e}${V}`)}function he(t){if(!T(t))return!1;let e=P(m()),n=P(l(e,"projects")),r=P(t.localCacheDir);try{let a=b(e),s=b(n),c=b(r);if(!a.isDirectory()||a.isSymbolicLink()||!s.isDirectory()||s.isSymbolicLink()||!c.isDirectory()||c.isSymbolicLink())return!1;let o=U(n);return U(r).startsWith(`${o}${V}`)}catch{return!1}}function ge(t){for(let e of I(l(t,"worktrees"))){if(!e.endsWith(".json"))continue;let n=j(l(t,"worktrees",e));if(n)return n.projectRoot}}function E(t,e=!1){for(let r of e?["index.lock"]:["index.lock","cache-lifecycle.lock"]){let a=D(l(t.localCacheDir,r));if(a!==void 0&&C(a))return!0}let n=D(L(t.localCacheDir).lockPath);return n!==void 0&&C(n)}function j(t){try{let e=JSON.parse(R(t,"worktree cache lease"));return e.version!==1||typeof e.repositoryId!="string"||typeof e.worktreeId!="string"||typeof e.projectRoot!="string"||e.treeOid!==void 0&&typeof e.treeOid!="string"||typeof e.localCacheDir!="string"||e.baseGenerationId!==void 0&&typeof e.baseGenerationId!="string"||e.activeGenerationId!==void 0&&typeof e.activeGenerationId!="string"||typeof e.ownershipChecksum!="string"||!/^[a-f0-9]{64}$/.test(e.ownershipChecksum)||typeof e.lastAction!="string"||e.lastReason!==void 0&&typeof e.lastReason!="string"||typeof e.lastSeenAt!="string"?null:e}catch{return null}}function D(t){try{let e=JSON.parse(R(t,"watch lock record"));return typeof e.pid=="number"&&Number.isSafeInteger(e.pid)&&e.pid>0?e.pid:void 0}catch{return}}function te(t){try{let e=JSON.parse(R(t,"repository cache GC state"));return e.version!==1||typeof e.lastSweepAt!="string"||!Number.isFinite(Date.parse(e.lastSweepAt))||!e.unreferencedSince||typeof e.unreferencedSince!="object"||!e.lastResult?null:e}catch{return null}}function re(t){try{let e=JSON.parse(R(t,"global repository cache GC state"));if(e.version!==1||typeof e.lastSweepAt!="string")return;let n=Date.parse(e.lastSweepAt);return Number.isFinite(n)?n:void 0}catch{return}}function I(t){try{return K(t)}catch{return[]}}function q(t){let e=0,n=[t];for(;n.length>0;){let r=n.pop();for(let a of K(r,{withFileTypes:!0})){let s=l(r,a.name);a.isDirectory()?n.push(s):a.isFile()&&(e+=Q(s).size)}}return e}export{Le as a,Ee as b};
3
+ //# sourceMappingURL=chunk-Q3ZCQY2Y.js.map
@@ -1,2 +1,2 @@
1
- import{c as h}from"./chunk-B75HZHUP.js";import{a as m}from"./chunk-OJFLPVBP.js";import{b,d as g}from"./chunk-57KEZDPT.js";import{a as u}from"./chunk-3XFJUWJE.js";import{d as o,h as p}from"./chunk-AM5SUGHF.js";function N(n,a,f={}){let i=u(n,a);if(!i)return null;let l=f.semantic!==!1,c=g(n,i,{semantic:l,semanticEvidence:m}),S=c.rows.filter(e=>p(e.symbol)).slice(0,50),t=b(n,i,{limit:50,additive:!0,callableOnly:!0,semantic:l,semanticEvidence:m}),E=h(t.rows),d=S.map(e=>({symbol:e.symbol,shortName:o(e.symbol),file:e.file,relationship:e.source!=="caller-map-inversion"?"reference-candidate":e.callEvidence==="scip-chunk"?"chunk-candidate":"resolved-call",evidenceStrength:e.source==="caller-map-inversion"&&e.callEvidence!=="scip-chunk"?"exact":"candidate",evidenceSource:e.callEvidence??e.source})),v=E.map(e=>({symbol:e.symbol,shortName:o(e.symbol),file:e.file,relationship:e.source==="scip-chunk"?"chunk-candidate":"resolved-call",evidenceStrength:e.source==="scip-chunk"?"candidate":"exact",evidenceSource:e.source}));return{symbol:i.symbol,shortName:o(i.symbol),callers:d.map(({symbol:e,shortName:s,file:r})=>({symbol:e,shortName:s,file:r})),callees:v.map(({symbol:e,shortName:s,file:r})=>({symbol:e,shortName:s,file:r})),callerEvidence:d,calleeEvidence:v,coverage:{scope:"indexed-static-call-graph",blindSpots:["unresolved dynamic dispatch and reflection","external or unindexed callees without a resolved symbol identity","SCIP chunk co-occurrence is retained only as candidate call evidence",...c.semanticIncomplete?["compiler-resolved incoming evidence was incomplete; known callers are retained"]:[],...c.semanticUnavailable?["compiler-resolved incoming evidence was unavailable; known callers are retained"]:[],...t.semanticIncomplete?["compiler-resolved outgoing evidence was incomplete; known callees are retained"]:[],...t.semanticUnavailable?["compiler-resolved outgoing evidence was unavailable; known callees are retained"]:[]],semanticEvidence:{enabled:l,incoming:y(l,c),outgoing:y(l,t)}}}}function y(n,a){return n?a.semanticIncomplete&&a.semanticUnavailable?"incomplete-and-unavailable":a.semanticIncomplete?"incomplete":a.semanticUnavailable?"unavailable":"complete":"disabled"}export{N as a};
2
- //# sourceMappingURL=chunk-OMBRP7BB.js.map
1
+ import{c as h}from"./chunk-B75HZHUP.js";import{a as m}from"./chunk-6VREELBC.js";import{b,d as g}from"./chunk-MSI3K7PJ.js";import{a as u}from"./chunk-SGMNWYTH.js";import{d as o,h as p}from"./chunk-GVAF222T.js";function N(n,a,f={}){let i=u(n,a);if(!i)return null;let l=f.semantic!==!1,c=g(n,i,{semantic:l,semanticEvidence:m}),S=c.rows.filter(e=>p(e.symbol)).slice(0,50),t=b(n,i,{limit:50,additive:!0,callableOnly:!0,semantic:l,semanticEvidence:m}),E=h(t.rows),d=S.map(e=>({symbol:e.symbol,shortName:o(e.symbol),file:e.file,relationship:e.source!=="caller-map-inversion"?"reference-candidate":e.callEvidence==="scip-chunk"?"chunk-candidate":"resolved-call",evidenceStrength:e.source==="caller-map-inversion"&&e.callEvidence!=="scip-chunk"?"exact":"candidate",evidenceSource:e.callEvidence??e.source})),v=E.map(e=>({symbol:e.symbol,shortName:o(e.symbol),file:e.file,relationship:e.source==="scip-chunk"?"chunk-candidate":"resolved-call",evidenceStrength:e.source==="scip-chunk"?"candidate":"exact",evidenceSource:e.source}));return{symbol:i.symbol,shortName:o(i.symbol),callers:d.map(({symbol:e,shortName:s,file:r})=>({symbol:e,shortName:s,file:r})),callees:v.map(({symbol:e,shortName:s,file:r})=>({symbol:e,shortName:s,file:r})),callerEvidence:d,calleeEvidence:v,coverage:{scope:"indexed-static-call-graph",blindSpots:["unresolved dynamic dispatch and reflection","external or unindexed callees without a resolved symbol identity","SCIP chunk co-occurrence is retained only as candidate call evidence",...c.semanticIncomplete?["compiler-resolved incoming evidence was incomplete; known callers are retained"]:[],...c.semanticUnavailable?["compiler-resolved incoming evidence was unavailable; known callers are retained"]:[],...t.semanticIncomplete?["compiler-resolved outgoing evidence was incomplete; known callees are retained"]:[],...t.semanticUnavailable?["compiler-resolved outgoing evidence was unavailable; known callees are retained"]:[]],semanticEvidence:{enabled:l,incoming:y(l,c),outgoing:y(l,t)}}}}function y(n,a){return n?a.semanticIncomplete&&a.semanticUnavailable?"incomplete-and-unavailable":a.semanticIncomplete?"incomplete":a.semanticUnavailable?"unavailable":"complete":"disabled"}export{N as a};
2
+ //# sourceMappingURL=chunk-Q4XEU3UH.js.map
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-I2KP4AGR.js";import{h as o}from"./chunk-327YK6TB.js";function g(e,r){return s(e).filter(t=>c({pattern:r,relativePath:t})).map(t=>({relativePath:t}))}function c(e,r){let t=typeof e=="string"?{pattern:e,relativePath:r}:e;if(typeof t.pattern!="string"||typeof t.relativePath!="string")throw new TypeError("pathMatchesGlob requires pattern and relativePath.");let n=o(t.pattern),a=o(t.relativePath);if(!/[*?]/.test(n))return a.includes(n);let l=n.includes("/")?n:`**/${n}`;return i(l.split("/"),a.split("/"))}function i(e,r){if(e.length===0)return r.length===0;let[t,...n]=e;return t==="**"?i(n,r)||r.length>0&&i(e,r.slice(1)):r.length===0||!f(t??"",r[0]??"")?!1:i(n,r.slice(1))}function f(e,r){let t="^";for(let n of e)n==="*"?t+="[^/]*":n==="?"?t+="[^/]":t+=p(n);return t+="$",new RegExp(t).test(r)}function p(e){return/[\\^$.*+?()[\]{}|]/.test(e)?`\\${e}`:e}export{g as a,c as b};
2
- //# sourceMappingURL=chunk-I645ZF75.js.map
1
+ import{a as s}from"./chunk-TJWVT4DO.js";import{h as o}from"./chunk-UC2FD2PS.js";function g(e,r){return s(e).filter(t=>c({pattern:r,relativePath:t})).map(t=>({relativePath:t}))}function c(e,r){let t=typeof e=="string"?{pattern:e,relativePath:r}:e;if(typeof t.pattern!="string"||typeof t.relativePath!="string")throw new TypeError("pathMatchesGlob requires pattern and relativePath.");let n=o(t.pattern),a=o(t.relativePath);if(!/[*?]/.test(n))return a.includes(n);let l=n.includes("/")?n:`**/${n}`;return i(l.split("/"),a.split("/"))}function i(e,r){if(e.length===0)return r.length===0;let[t,...n]=e;return t==="**"?i(n,r)||r.length>0&&i(e,r.slice(1)):r.length===0||!f(t??"",r[0]??"")?!1:i(n,r.slice(1))}function f(e,r){let t="^";for(let n of e)n==="*"?t+="[^/]*":n==="?"?t+="[^/]":t+=p(n);return t+="$",new RegExp(t).test(r)}function p(e){return/[\\^$.*+?()[\]{}|]/.test(e)?`\\${e}`:e}export{g as a,c as b};
2
+ //# sourceMappingURL=chunk-QEOWONKY.js.map
@@ -1,2 +1,2 @@
1
- import{x as c,y as l}from"./chunk-PLZXWZHY.js";function h(e,a,i,r,n,o){let t=new Set;d(e,a,i,r)&&t.add(n);for(let s of o)s.value&&p(t,s.label,s.value);return[...t].slice(0,6)}function p(e,a,i){let r=u(i);a.endsWith("name")&&y(r)&&e.add(`${a} has type-guard boundary shape`);for(let n of r){let o=f.get(n);o&&e.add(`${a} has ${o} term: ${n}`)}}function d(e,a,i,r){if(i<=0)return!1;let n=c(e,a);if(n.length===0)return!1;for(let o=i-1;o>=0&&o>=i-5;o-=1){let t=(n[o]??"").trim();if(t!==""){if(l(t)===r)return!0;if(!t.startsWith("//")&&!t.startsWith("*")&&!t.startsWith("/*")&&!t.startsWith("@")&&!t.startsWith("#"))return!1}}return!1}function u(e){return e.replace(/([A-Z])([A-Z][a-z])/g,"$1 $2").replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)}function y(e){return e.some(a=>g.has(a))&&e.some(a=>m.has(a))}var f=new Map([["access","access policy"],["accessible","access policy"],["adapter","adapter"],["adapters","adapter"],["allow","access policy"],["allowed","access policy"],["animation","animation calculation"],["api","api surface"],["apply","settings/application"],["audit","side-effect boundary"],["auth","authorization"],["authorize","authorization"],["audio","audio side-effect"],["can","access policy"],["capabilities","capability boundary"],["capability","capability boundary"],["boundary","boundary"],["begin","lifecycle"],["bridge","bridge"],["bridges","bridge"],["cache","state cache"],["chase","gameplay action"],["command","command boundary"],["context","context policy"],["cooldown","temporal state"],["cooldowns","temporal state"],["controller","controller"],["controllers","controller"],["diagnostic","diagnostics"],["diagnostics","diagnostics"],["effect","side-effect boundary"],["effects","side-effect boundary"],["energy","gameplay calculation"],["expired","temporal state"],["facade","facade"],["facades","facade"],["fire","gameplay action"],["gateway","gateway"],["gateways","gateway"],["guard","guard"],["guards","guard"],["haptic","haptic side-effect"],["haptics","haptic side-effect"],["head","sequence boundary"],["history","state history"],["input","input boundary"],["jump","gameplay action"],["keyboard","input boundary"],["log","side-effect boundary"],["logger","side-effect boundary"],["lock","coordination boundary"],["middleware","middleware"],["multiplier","gameplay calculation"],["mute","audio side-effect"],["normalize","normalization"],["normalise","normalization"],["normalizer","normalization"],["oscillate","animation calculation"],["oscillation","animation calculation"],["overlap","collision predicate"],["performance","diagnostics"],["permission","access policy"],["permissions","access policy"],["policy","policy"],["pool","state pool"],["pooled","state pool"],["pools","state pool"],["predict","prediction"],["presenter","presenter"],["presenters","presenter"],["projectile","gameplay entity"],["provider","provider boundary"],["providers","provider boundary"],["public","public surface"],["quality","settings/application"],["rate","calculation"],["register","registry"],["registry","registry"],["relay","relay"],["relays","relay"],["reseed","state lifecycle"],["reset","state lifecycle"],["respond","response boundary"],["response","response boundary"],["resolve","resolution"],["resolver","resolution"],["route","route boundary"],["routes","route boundary"],["run","lifecycle"],["sample","diagnostics"],["score","gameplay calculation"],["scope","scope policy"],["scroll","position state"],["scrolled","position state"],["seed","state lifecycle"],["seeded","state lifecycle"],["segment","segment boundary"],["segments","segment boundary"],["setting","settings/application"],["settings","settings/application"],["spawn","gameplay lifecycle"],["spawning","gameplay lifecycle"],["speed","gameplay calculation"],["surface","public surface"],["tail","sequence boundary"],["tick","temporal state"],["transaction","transaction"],["transactional","transaction"],["transform","transformation"],["transformer","transformation"],["translate","translation"],["translator","translation"],["try","fallible action"],["validate","validation"],["validation","validation"],["validator","validation"],["visual","diagnostics"],["window","settings/application"],["socket","transport boundary"],["websocket","transport boundary"]]),g=new Set(["can","has","is","should"]),m=new Set(["access","api","auth","collision","expired","input","keyboard","overlap","permission","permissions","policy","projectile","response","route","routes","scope"]);export{h as a};
2
- //# sourceMappingURL=chunk-JXHLB7TP.js.map
1
+ import{x as c,y as l}from"./chunk-7GAK2F3H.js";function h(e,a,i,r,n,o){let t=new Set;d(e,a,i,r)&&t.add(n);for(let s of o)s.value&&p(t,s.label,s.value);return[...t].slice(0,6)}function p(e,a,i){let r=u(i);a.endsWith("name")&&y(r)&&e.add(`${a} has type-guard boundary shape`);for(let n of r){let o=f.get(n);o&&e.add(`${a} has ${o} term: ${n}`)}}function d(e,a,i,r){if(i<=0)return!1;let n=c(e,a);if(n.length===0)return!1;for(let o=i-1;o>=0&&o>=i-5;o-=1){let t=(n[o]??"").trim();if(t!==""){if(l(t)===r)return!0;if(!t.startsWith("//")&&!t.startsWith("*")&&!t.startsWith("/*")&&!t.startsWith("@")&&!t.startsWith("#"))return!1}}return!1}function u(e){return e.replace(/([A-Z])([A-Z][a-z])/g,"$1 $2").replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)}function y(e){return e.some(a=>g.has(a))&&e.some(a=>m.has(a))}var f=new Map([["access","access policy"],["accessible","access policy"],["adapter","adapter"],["adapters","adapter"],["allow","access policy"],["allowed","access policy"],["animation","animation calculation"],["api","api surface"],["apply","settings/application"],["audit","side-effect boundary"],["auth","authorization"],["authorize","authorization"],["audio","audio side-effect"],["can","access policy"],["capabilities","capability boundary"],["capability","capability boundary"],["boundary","boundary"],["begin","lifecycle"],["bridge","bridge"],["bridges","bridge"],["cache","state cache"],["chase","gameplay action"],["command","command boundary"],["context","context policy"],["cooldown","temporal state"],["cooldowns","temporal state"],["controller","controller"],["controllers","controller"],["diagnostic","diagnostics"],["diagnostics","diagnostics"],["effect","side-effect boundary"],["effects","side-effect boundary"],["energy","gameplay calculation"],["expired","temporal state"],["facade","facade"],["facades","facade"],["fire","gameplay action"],["gateway","gateway"],["gateways","gateway"],["guard","guard"],["guards","guard"],["haptic","haptic side-effect"],["haptics","haptic side-effect"],["head","sequence boundary"],["history","state history"],["input","input boundary"],["jump","gameplay action"],["keyboard","input boundary"],["log","side-effect boundary"],["logger","side-effect boundary"],["lock","coordination boundary"],["middleware","middleware"],["multiplier","gameplay calculation"],["mute","audio side-effect"],["normalize","normalization"],["normalise","normalization"],["normalizer","normalization"],["oscillate","animation calculation"],["oscillation","animation calculation"],["overlap","collision predicate"],["performance","diagnostics"],["permission","access policy"],["permissions","access policy"],["policy","policy"],["pool","state pool"],["pooled","state pool"],["pools","state pool"],["predict","prediction"],["presenter","presenter"],["presenters","presenter"],["projectile","gameplay entity"],["provider","provider boundary"],["providers","provider boundary"],["public","public surface"],["quality","settings/application"],["rate","calculation"],["register","registry"],["registry","registry"],["relay","relay"],["relays","relay"],["reseed","state lifecycle"],["reset","state lifecycle"],["respond","response boundary"],["response","response boundary"],["resolve","resolution"],["resolver","resolution"],["route","route boundary"],["routes","route boundary"],["run","lifecycle"],["sample","diagnostics"],["score","gameplay calculation"],["scope","scope policy"],["scroll","position state"],["scrolled","position state"],["seed","state lifecycle"],["seeded","state lifecycle"],["segment","segment boundary"],["segments","segment boundary"],["setting","settings/application"],["settings","settings/application"],["spawn","gameplay lifecycle"],["spawning","gameplay lifecycle"],["speed","gameplay calculation"],["surface","public surface"],["tail","sequence boundary"],["tick","temporal state"],["transaction","transaction"],["transactional","transaction"],["transform","transformation"],["transformer","transformation"],["translate","translation"],["translator","translation"],["try","fallible action"],["validate","validation"],["validation","validation"],["validator","validation"],["visual","diagnostics"],["window","settings/application"],["socket","transport boundary"],["websocket","transport boundary"]]),g=new Set(["can","has","is","should"]),m=new Set(["access","api","auth","collision","expired","input","keyboard","overlap","permission","permissions","policy","projectile","response","route","routes","scope"]);export{h as a};
2
+ //# sourceMappingURL=chunk-QMOZZ2VX.js.map
@@ -1,4 +1,4 @@
1
- import{a as p,g as m}from"./chunk-4O52YNKL.js";import F from"ignore";import{existsSync as h,readdirSync as D}from"fs";import{dirname as d,isAbsolute as b,join as l,relative as T,resolve as $}from"path";function M(e){let t=F();return x(e,t)||t.add(P),{isIgnored:r=>f(t,e,r),filter:r=>r.filter(i=>!f(t,e,i))}}function x(e,t){let n=new Set,r=(s,a)=>{if(!(n.has(s)||!h(s)))try{let g=m(s,{maxBytes:p,inputKind:"gitignore file"});t.add(a?w(g,a):g),n.add(s)}catch{}},i=d(e),o=0;for(;i!==d(i)&&o<5&&(r(l(i,".gitignore"),""),!h(l(i,".git")));)i=d(i),o++;return y(e,"",t,r),n.size>0}function y(e,t,n,r){let i=t?l(e,t):e;r(l(i,".gitignore"),t);let o;try{o=D(i,{withFileTypes:!0})}catch{return}for(let s of o){if(!s.isDirectory()||s.name===".git")continue;let a=t?`${t}/${s.name}`:s.name;f(n,e,`${a}/`)||y(e,a,n,r)}}function w(e,t){let n=t.replaceAll("\\","/").replace(/\/+$/,"");return e.split(/\r?\n/).map(r=>I(r,n)).join(`
1
+ import{a as p,g as m}from"./chunk-UQYQBLJX.js";import F from"ignore";import{existsSync as h,readdirSync as D}from"fs";import{dirname as d,isAbsolute as b,join as l,relative as T,resolve as $}from"path";function M(e){let t=F();return x(e,t)||t.add(P),{isIgnored:r=>f(t,e,r),filter:r=>r.filter(i=>!f(t,e,i))}}function x(e,t){let n=new Set,r=(s,a)=>{if(!(n.has(s)||!h(s)))try{let g=m(s,{maxBytes:p,inputKind:"gitignore file"});t.add(a?w(g,a):g),n.add(s)}catch{}},i=d(e),o=0;for(;i!==d(i)&&o<5&&(r(l(i,".gitignore"),""),!h(l(i,".git")));)i=d(i),o++;return y(e,"",t,r),n.size>0}function y(e,t,n,r){let i=t?l(e,t):e;r(l(i,".gitignore"),t);let o;try{o=D(i,{withFileTypes:!0})}catch{return}for(let s of o){if(!s.isDirectory()||s.name===".git")continue;let a=t?`${t}/${s.name}`:s.name;f(n,e,`${a}/`)||y(e,a,n,r)}}function w(e,t){let n=t.replaceAll("\\","/").replace(/\/+$/,"");return e.split(/\r?\n/).map(r=>I(r,n)).join(`
2
2
  `)}function I(e,t){let n=e.trimStart();if(!n||n.startsWith("#"))return e;let r=e.slice(0,e.length-n.length),i=n.startsWith("!"),o=i?n.slice(1):n;if(!o||o.startsWith("#"))return e;let s=o.startsWith("/"),a=s?o.slice(1):o,A=(a.endsWith("/")?a.slice(0,-1):a).includes("/")||s?`${t}/${a}`:`${t}/**/${a}`;return`${r}${i?"!":""}${A}`}var P=`
3
3
  # Dependencies
4
4
  node_modules/
@@ -57,4 +57,4 @@ Thumbs.db
57
57
  # Type definitions (often noise in queries)
58
58
  *.d.ts
59
59
  `;function f(e,t,n){let r=R(t,n);if(!r)return!1;try{return e.ignores(r)}catch{return!1}}function R(e,t){if(!t||t===".")return null;if(!b(t)&&!t.startsWith(".."))return t.replaceAll("\\","/");let n=b(t)?t:$(e,t),r=T(e,n).replaceAll("\\","/");return!r||r==="."||r.startsWith("..")?null:r}import{mkdtempSync as S}from"fs";import{win32 as G}from"path";var W=259,N=8,E=6,c="\\\\?\\",u=`${c}UNC\\`;function v(e,t,n){if(n!=="win32"||e.startsWith(c))return;let r=G.resolve(e);if(!(r.length+t<=W))return r.startsWith("\\\\")?`${u}${r.slice(2)}`:`${c}${r}`}function q(e,t=process.platform){return e===""||e===":memory:"?e:v(e,N,t)??e}function K(e,t=process.platform){let n=v(e,E,t);if(!n)return S(e);let r=S(n);return r.startsWith(u)?`\\\\${r.slice(u.length)}`:r.slice(c.length)}var C=[],_=[];function j(e){e.groups.length>0&&C.push(e)}function Q(e){_.push(e)}function Y(e){let t=[];for(let n of _)try{n.close(e)}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Multiple database-owned resources failed to close.")}function V(e,t){let n=new Set(t.groups);for(let r of C)r.groups.some(i=>n.has(i))&&(t.file!==void 0&&r.clearFile?r.clearFile(e,t.file):r.clearAll(e))}export{q as a,K as b,j as c,Q as d,Y as e,V as f,M as g};
60
- //# sourceMappingURL=chunk-2VKB5CMA.js.map
60
+ //# sourceMappingURL=chunk-RCIGX23V.js.map
@@ -1,2 +1,2 @@
1
- import{a as g}from"./chunk-DGXRDLV5.js";import{c as d}from"./chunk-NK76RSB6.js";import{b as c}from"./chunk-BH5CE4LN.js";import{d as p}from"./chunk-AM5SUGHF.js";import{f as o}from"./chunk-JOALNFY3.js";import{z as u}from"./chunk-RVYLJDXC.js";function F(r,a={}){let{scope:l,limit:s=30,scanLimit:b}=a,f=new d(r);return g({candidates:()=>f.productionCallableDefinitions({scope:l,files:a.files,minLoc:2,excludeRootedSymbols:!0,requireFunctionLikeSymbol:!0}),filterCandidate:e=>y(e.relativePath),scanLimit:b,profile:{name:"unused-params"},evaluate:e=>{let n=o(r,e.relativePath)?.callables.find(t=>t.startLine===e.startLine&&t.endLine===e.endLine);if(!n||n.params.length===0||n.params.some(t=>!t.simple)||n.paramsEndLine>=n.endLine)return null;let L=c(r,e.relativePath),m=[];for(let t=n.params.length-1;t>=0;t--){let i=n.params[t];if(i.name===""||i.name.startsWith("_")||h(L.get(i.name),n.paramsEndLine,n.endLine))break;m.unshift(i.name)}return m.length===0?null:{symbol:e.symbol,shortName:p(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,paramCount:n.paramCount,unusedTrailing:m}},orderResults:(e,n)=>n.unusedTrailing.length-e.unusedTrailing.length||e.file.localeCompare(n.file)||e.startLine-n.startLine,limit:s})}function y(r){let a=u(r);return a==="typescript"||a==="tsx"||a==="javascript"}function h(r,a,l){return r?r.some(s=>s>a&&s<=l):!1}export{F as a};
2
- //# sourceMappingURL=chunk-J24VICI5.js.map
1
+ import{a as g}from"./chunk-DGXRDLV5.js";import{c as d}from"./chunk-HENP2O4A.js";import{b as c}from"./chunk-J7AMBVWF.js";import{d as p}from"./chunk-GVAF222T.js";import{f as o}from"./chunk-F74LZWCE.js";import{z as u}from"./chunk-ICUL7XRT.js";function F(r,a={}){let{scope:l,limit:s=30,scanLimit:b}=a,f=new d(r);return g({candidates:()=>f.productionCallableDefinitions({scope:l,files:a.files,minLoc:2,excludeRootedSymbols:!0,requireFunctionLikeSymbol:!0}),filterCandidate:e=>y(e.relativePath),scanLimit:b,profile:{name:"unused-params"},evaluate:e=>{let n=o(r,e.relativePath)?.callables.find(t=>t.startLine===e.startLine&&t.endLine===e.endLine);if(!n||n.params.length===0||n.params.some(t=>!t.simple)||n.paramsEndLine>=n.endLine)return null;let L=c(r,e.relativePath),m=[];for(let t=n.params.length-1;t>=0;t--){let i=n.params[t];if(i.name===""||i.name.startsWith("_")||h(L.get(i.name),n.paramsEndLine,n.endLine))break;m.unshift(i.name)}return m.length===0?null:{symbol:e.symbol,shortName:p(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,paramCount:n.paramCount,unusedTrailing:m}},orderResults:(e,n)=>n.unusedTrailing.length-e.unusedTrailing.length||e.file.localeCompare(n.file)||e.startLine-n.startLine,limit:s})}function y(r){let a=u(r);return a==="typescript"||a==="tsx"||a==="javascript"}function h(r,a,l){return r?r.some(s=>s>a&&s<=l):!1}export{F as a};
2
+ //# sourceMappingURL=chunk-RIYJ4L33.js.map
@@ -1,6 +1,6 @@
1
- import{a as at}from"./chunk-ILMHV3KM.js";import{a as mt}from"./chunk-IGYAZPRX.js";import{G as ht,a as pt,b as gt,h as Z,i as W,j as de,k as bt}from"./chunk-BLKYYQ7C.js";import{b as We,c as je,j as he,n as ot,x as st}from"./chunk-IGQQUENU.js";import{b as Ve,c as Ge,d as qe}from"./chunk-2Q2LW5JW.js";import{D as tt,E as nt,I as rt}from"./chunk-M7LAIM77.js";import{d as Qe,e as Ze,f as et}from"./chunk-DRENNWRG.js";import{b as X,c as Ee,d as it,e as dt,f as ct,i as lt,j as ut,k as ft}from"./chunk-WJOQC4P7.js";import{a as be,l as Xe,m as Ye}from"./chunk-IYBIBMPF.js";import{i as H,j as J,m as ze}from"./chunk-XYLV727H.js";import{b as Je}from"./chunk-4NHWNAWQ.js";import{a as Ke}from"./chunk-2VKB5CMA.js";import{d as ge,e as ie}from"./chunk-6URCE5QY.js";import{e as He,g as pe}from"./chunk-4O52YNKL.js";import{join as $e}from"path";import{createHash as gn}from"crypto";import{mkdirSync as Ct,mkdtempSync as bn,renameSync as hn,rmSync as kt,statSync as En,writeFileSync as wt}from"fs";import{tmpdir as yn}from"os";import{extname as Sn,join as ee,resolve as vn,sep as Cn}from"path";var kn=1024*1024,Et=500,wn=64,Rn=/\.(?:cmd|bat)$/i;async function Rt(e,t,n={}){let r=Se(e);if(!r.ok)return $(r.reason,r.detail);let a=JSON.stringify(it),o;try{Ct(t.workDir,{recursive:!0}),o=bn(ee(yn(),"codebaseiq-probe-")),e.argv.includes("{schemaFile}")&&wt(ee(o,"schema.json"),a)}catch(s){return yt(o),$("spawn-failed",`could not prepare the agent sandbox: ${te(xn(s))}`)}try{let s=ee(o,"schema.json"),d=ee(o,"output.json"),i=e.argv.includes("{outputFile}"),c=new Map([["{schemaJson}",a],["{schemaFile}",s],["{outputFile}",d]]),l=Ge(r.path,e.argv.slice(1).map(S=>c.get(S)??S)),b;try{b=await je({command:l.binary,args:l.args,label:`agent probe command ${e.name}`,timeoutMs:e.timeoutMs,maxStdoutBytes:e.maxOutputBytes,maxStderrBytes:kn,cwd:t.workDir,env:Tn(n.env??process.env),input:ct(t.description,t.languages),signal:n.signal})}catch(S){return _n(S,n.signal)}if(b.status!==0){let S=St(b.stdout),g=b.status===null?`signal ${b.signal}`:`code ${b.status}`,m=S.kind==="error"?S.detail:b.stderr.trim()||b.stdout.trim();return $("agent-error",`${e.name} exited with ${g}: ${te(m)}`)}let p=[];if(i){let S=Mn(d,e.maxOutputBytes);if(S==="too-large")return $("output-too-large",`${e.name} wrote more than ${e.maxOutputBytes} bytes.`);S!==null&&p.push(S)}p.push(b.stdout);for(let S of p){let g=St(S);if(g.kind==="error")return $("agent-error",g.detail);if(g.kind==="none")continue;let{probes:m,diagnostics:w}=Ee(g.value);return X(m)?{ok:!0,probes:m,diagnostics:w,raw:S.trim()}:$("invalid-probes",On(w))}return $("no-json",`${e.name} printed no JSON object: ${te(b.stdout.trim())}`)}finally{yt(o)}}function yt(e){if(e!==void 0)try{kt(e,{recursive:!0,force:!0,maxRetries:3})}catch{}}function xn(e){return e instanceof Error?e.message:String(e)}function $(e,t){return{ok:!1,reason:e,detail:t}}function Pn(e){let t=ut({agent:{commands:[e]}}).filter(n=>n.level==="error");return t.length>0?t.map(n=>`${n.path}: ${n.message}`).join(" "):ft.has(e.argv[0])?"argv[0] must be the executable, not a placeholder.":[e.timeoutMs,e.maxOutputBytes].every(n=>Number.isFinite(n)&&n>0)?null:"timeoutMs and maxOutputBytes must be positive numbers."}function Se(e){let t=Pn(e);if(t)return{ok:!1,reason:"misconfigured",detail:t};let n=e.argv[0],r=`argv[0] "${n}" is a .cmd/.bat shim, which cannot be started without a shell. Point argv[0] at the real executable or at a node script (.js, .mjs, .cjs).`,a=n.includes("/")||n.includes(Cn),o;if(a){o=An(vn(n));let s=ye(o);if(s==="missing")return{ok:!1,reason:"spawn-failed",detail:`argv[0] "${n}" was not found.`};if(s==="other")return{ok:!1,reason:"misconfigured",detail:`argv[0] "${n}" is not an executable file.`}}else o=qe(n);return o===null?Ve(n)?{ok:!1,reason:"misconfigured",detail:r}:{ok:!1,reason:"spawn-failed",detail:`argv[0] "${n}" was not found on PATH.`}:process.platform==="win32"&&Rn.test(o)?{ok:!1,reason:"misconfigured",detail:r}:{ok:!0,path:o}}function An(e,t=process.platform){return t!=="win32"||Sn(e)!==""||ye(e)!=="missing"?e:[".exe",".com"].map(n=>`${e}${n}`).find(n=>ye(n)==="file")??e}function ye(e){try{return En(e).isFile()?"file":"other"}catch{return"missing"}}function Tn(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&!/^CODEBASEIQ_/i.test(n)&&(t[n]=r);return t}function _n(e,t){if(!(e instanceof We))throw e;switch(e.kind){case"spawn":return $("spawn-failed",e.message);case"timeout":return $("timeout",e.message);case"stdout-limit":case"stderr-limit":return $("output-too-large",e.message);case"aborted":throw t?H(t,e.message):e}}function Mn(e,t){try{return pe(e,{maxBytes:t,inputKind:"agent output file"})}catch(n){return n instanceof He&&n.reason==="too-large"?"too-large":null}}function St(e){let t=vt(e);if(!t)return{kind:"none"};if(t.type!=="result")return{kind:"object",value:t};if(t.is_error===!0){let r=typeof t.result=="string"&&t.result?t.result:t.subtype;return{kind:"error",detail:te(`The agent reported an error: ${String(r??"no message")}`)}}if(Pt(t.structured_output))return{kind:"object",value:t.structured_output};let n=typeof t.result=="string"?vt(t.result):null;return n?{kind:"object",value:n}:{kind:"none"}}function vt(e){let t=e.trim();return xt(t)??Bn(t)}function xt(e){try{let t=JSON.parse(e);return Pt(t)?t:null}catch{return null}}function Bn(e){let t=/\{\s*["}]/g,n=null,r=0;for(let a=0;a<wn;){t.lastIndex=r;let o=t.exec(e);if(!o)break;let s=Nn(e,o.index),d=s===-1?null:xt(e.slice(o.index,s+1));d?(n=d,r=s+1):(r=o.index+1,a++)}return n}function Nn(e,t){let n=0,r=!1,a=!1;for(let o=t;o<e.length;o++){let s=e[o];if(r)a?a=!1:s==="\\"?a=!0:s==='"'&&(r=!1);else if(s==='"')r=!0;else if(s==="{")n++;else if(s==="}"&&--n===0)return o}return-1}function Pt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function On(e){return e.length===0?"The agent returned no usable probes.":te(`The agent returned no usable probes: ${e.slice(0,3).map(t=>`${t.path||"root"}: ${t.message}`).join("; ")}`)}function te(e){return e.length>Et?`${e.slice(0,Et)}...`:e}var Fn=64*1024,Ln=3600*1e3;function At(e,t,n=Date.now){let r=(a,o)=>ee(e,`${gn("sha256").update(JSON.stringify([a,3,o])).digest("hex")}.json`);return{get(a,o){try{let s=JSON.parse(pe(r(a,o),{maxBytes:Fn,inputKind:"agent probe cache entry"}));if(typeof s.storedAt!="number"||n()-s.storedAt>=t*Ln)return;let{probes:d}=Ee(s.probes);return X(d)?d:void 0}catch{return}},set(a,o,s){let d=r(a,o),i=`${d}.${process.pid}.tmp`;try{Ct(e,{recursive:!0}),wt(i,JSON.stringify({storedAt:n(),probes:s})),hn(i,d)}catch{try{kt(i,{force:!0})}catch{}}}}}import{BlockList as In,isIP as $n}from"net";var Ce=64*1024*1024,Dn=2,Tt="embedding request aborted",Un="codebaseiq embedding canary: parse a retry delay from a config file",M=class extends Error{constructor(n,r,a){super(r);this.kind=n;this.status=a;this.name="EmbeddingClientError"}kind;status},ne=new In;for(let[e,t]of[["127.0.0.0",8],["10.0.0.0",8],["172.16.0.0",12],["192.168.0.0",16],["100.64.0.0",10],["169.254.0.0",16]])ne.addSubnet(e,t,"ipv4");ne.addAddress("::1","ipv6");ne.addSubnet("fe80::",10,"ipv6");ne.addSubnet("fc00::",7,"ipv6");var Hn=[".local",".lan",".home.arpa",".internal"];function _t(e){let t;try{t=new URL(e).hostname}catch{return!1}let n=(t.startsWith("[")?t.slice(1,-1):t).replace(/\.$/,""),r=$n(n);return r!==0?ne.check(n,r===4?"ipv4":"ipv6"):n==="localhost"||Hn.some(a=>n.endsWith(a))}function Nt(e,t={}){let n=t.fetchImpl??fetch,r=t.env??process.env,a=e.baseUrl.replace(/\/+$/,"");function o(){let l=e.apiKeyEnv?r[e.apiKeyEnv]:void 0;return l||void 0}function s(){let l;try{l=new URL(e.baseUrl)}catch{throw new M("invalid-endpoint",`embedding endpoint "${e.name}" has an invalid baseUrl`)}if(l.protocol!=="http:"&&l.protocol!=="https:")throw new M("invalid-endpoint",`embedding endpoint "${e.name}" must use http or https`);if(l.username!==""||l.password!=="")throw new M("invalid-endpoint",`embedding endpoint "${e.name}" must not embed credentials in baseUrl; use apiKeyEnv`);if(!e.allowRemote&&!_t(e.baseUrl))throw new M("remote-not-allowed",`embedding endpoint "${e.name}" is not on a private network; set allowRemote to use it`);if(l.protocol==="http:"&&o()!==void 0&&!_t(e.baseUrl))throw new M("insecure-token-transport",`embedding endpoint "${e.name}" would send its API key over plain http to a non-private host; use https`)}function d(l){let b={};l&&(b["content-type"]="application/json");let p=o();return p&&(b.authorization=`Bearer ${p}`),b}async function i(l,b,p,S){let g={model:e.model,input:l,encoding_format:"float",...e.dimensions!==void 0?{dimensions:e.dimensions}:{}},{status:m,text:w}=await Mt(n,`${a}/embeddings`,{method:"POST",headers:d(!0),body:JSON.stringify(g)},b,!0,S);if(m<200||m>=300)throw new M("http",`embeddings request failed with HTTP ${m}`,m);return Vn(w,l.length,p)}async function c(l,b,p){try{return await i(l,e.requestTimeoutMs,b,p)}catch(S){if(!Wn(S))throw S;return i(l,e.requestTimeoutMs,b,p)}}return{async checkHealth({signal:l}={}){try{s()}catch(p){return ve(p)}try{await Mt(n,`${a}/models`,{method:"GET",headers:d(!1)},e.healthTimeoutMs,!1,l)}catch(p){return l?.aborted?ve(p,l):{ok:!1,reason:"unreachable",detail:ke(p)}}let b=ge();try{let[p]=await i([e.documentPrefix+Un],e.warmTimeoutMs,{dims:e.dimensions},l);return{ok:!0,model:e.model,dimensions:p.length,latencyMs:Math.round(ge()-b),canary:p}}catch(p){return ve(p,l)}},async embed(l,b,{signal:p}={}){if(s(),l.length===0)return[];let S=b==="query"?e.queryPrefix:e.documentPrefix,g=Math.max(1,Math.floor(e.batchSize)),m=[];for(let x=0;x<l.length;x+=g)m.push(l.slice(x,x+g).map(A=>S+A));let w={dims:e.dimensions};return(await at(m,Dn,x=>c(x,w,p))).flat()}}}function Wn(e){return e instanceof M&&(e.kind==="timeout"||e.kind==="http"&&(e.status??0)>=500)}function ve(e,t){let n=ke(e);if(t?.aborted)return{ok:!1,reason:"aborted",detail:n};if(!(e instanceof M))return{ok:!1,reason:"bad-response",detail:n};switch(e.kind){case"remote-not-allowed":case"insecure-token-transport":case"invalid-endpoint":return{ok:!1,reason:e.kind,detail:n};case"network":return{ok:!1,reason:"unreachable",detail:n};case"timeout":return{ok:!1,reason:"model-loading",detail:n};case"http":return e.status===503?{ok:!1,reason:"model-loading",detail:n}:e.status===401||e.status===403?{ok:!1,reason:"unauthorized",detail:n}:{ok:!1,reason:"bad-response",detail:n};default:return{ok:!1,reason:"bad-response",detail:n}}}function ke(e){return e instanceof Error?e.message:String(e)}async function Mt(e,t,n,r,a,o){J(o,Tt);let s=new AbortController,d=setTimeout(()=>{s.abort(new M("timeout",`no response within ${r}ms`))},r),i=()=>s.abort(o?.reason);o?.addEventListener("abort",i,{once:!0});try{let c=await Ot(e(t,{...n,signal:s.signal,redirect:"error"}),s.signal);return{status:c.status,text:a?await Kn(c,s.signal):""}}catch(c){throw o?.aborted&&s.signal.reason===o.reason?H(o,Tt):c instanceof M?c:s.signal.aborted&&s.signal.reason instanceof M?s.signal.reason:new M("network",`could not reach the embeddings endpoint: ${jn(c)}`)}finally{clearTimeout(d),o?.removeEventListener("abort",i),s.abort()}}function jn(e){let t=e instanceof Error?e.cause:void 0;return typeof t?.code=="string"?t.code:ke(e)}async function Kn(e,t){let n=Number(e.headers.get("content-length"));if(Number.isFinite(n)&&n>Ce)throw Bt();if(!e.body)return"";let r=e.body.getReader(),a=[],o=0;for(;;){let{done:s,value:d}=await Ot(r.read(),t);if(s)break;if(o+=d.byteLength,o>Ce)throw r.cancel().catch(()=>{}),Bt();a.push(d)}return new TextDecoder().decode(Buffer.concat(a))}function Bt(){return new M("too-large",`embeddings response exceeded the ${Ce} byte limit`)}function Ot(e,t){return new Promise((n,r)=>{let a=()=>r(t.reason);if(t.aborted){a();return}t.addEventListener("abort",a,{once:!0}),e.then(n,r).finally(()=>t.removeEventListener("abort",a))})}function Vn(e,t,n){let r;try{r=JSON.parse(e)}catch{throw j("response is not valid JSON")}let a=typeof r=="object"&&r!==null?r.data:void 0;if(!Array.isArray(a)||a.length!==t)throw j(`expected ${t} embeddings, received ${Array.isArray(a)?a.length:"none"}`);let o=new Array(t).fill(void 0),s=new Set;return a.forEach((d,i)=>{let c=typeof d=="object"&&d!==null?d:{},l=c.index===void 0?i:c.index;if(typeof l!="number"||!Number.isInteger(l)||l<0||l>=t||s.has(l))throw j("embedding indexes are not a permutation of the inputs");s.add(l),o[l]=c.embedding}),o.map(d=>Gn(d,n))}function Gn(e,t){if(!Array.isArray(e)||e.length===0)throw j("embedding is not a non-empty float array");if(t.dims!==void 0&&e.length!==t.dims)throw j(`embedding has ${e.length} dimensions, expected ${t.dims}`);let n=0;for(let o of e){if(typeof o!="number"||!Number.isFinite(o))throw j("embedding contains a non-finite value");n+=o*o}let r=Math.sqrt(n);if(!Number.isFinite(r)||r===0)throw j("embedding has zero or unrepresentable magnitude");t.dims=e.length;let a=new Float32Array(e.length);for(let o=0;o<e.length;o+=1)a[o]=e[o]/r;return a}function j(e){return new M("bad-response",`embeddings response rejected: ${e}`)}var xe=["name","container","doc","signature","path"],qn=1e3,zn=150,Jn=400,Xn=3,we=/@deprecated\b|#\[deprecated\b|\bdeprecated\s*[:(]/i,Ft=/^\s*(?:\/\/|\/\*|\*|#|@)/,Yn=new Set(gt()),Qn=/(?:^|\/)(?:__generated__|generated)\/|\.(?:generated|gen|g)\.[a-z0-9]+$|\.pb2?\.[a-z0-9]+$|_pb2?\.[a-z0-9]+$/i,Re=/@generated\b|\bcode generated\b.*\bdo not edit\b/i,Zn=40,er=/^(?:\/\/|--|#(?![[!\w]))/,tr=/^\s*export\s+(?:default\s+)?(?:(?:async\s+)?function|(?:abstract\s+)?class|interface|type|enum|namespace|module|const|let|var)\s+([\p{L}\p{N}_$]+)/u,nr=/^\s*export\s*\{([^}\n]*)/,rr=/[\p{L}\p{N}_$]+/gu,or=2,sr=Je("builder-candidate-corpus",{clearGroups:["whole-project","definition-catalog"]});function Y(e){return sr.get(e,()=>dr(e))}function D(e,t=2,n=Number.POSITIVE_INFINITY){let r=[],a=[],o=new Set;for(let s of W(e)){if(r.length>=n)break;if(Z.has(s.toLocaleLowerCase()))continue;let d=de(s),i=d[0];if(!(i.length<t||Z.has(i))){r.push(i),a.push(d);for(let c of d)o.add(c)}}return{words:r,variants:a,set:o}}function Pe(e){return W(e).map(bt)}function ar(e){let t=0,n=0,r=0,a=-1;for(let i=0;i<e.length&&a<0;i+=1){let c=e[i];c==="["?t+=1:c==="]"?t=Math.max(0,t-1):c==="{"?n+=1:c==="}"?n=Math.max(0,n-1):c==="<"?r+=1:c===">"&&e[i-1]!=="="&&e[i-1]!=="-"?r=Math.max(0,r-1):c==="("&&t===0&&n===0&&r===0&&(a=i)}if(a<0)return{params:null,returns:null};let o=0,s=-1;for(let i=a;i<e.length;i+=1){let c=e[i];if(c==="(")o+=1;else if(c===")"&&(o-=1,o===0)){s=i;break}}if(s<0)return{params:e.slice(a+1).trim(),returns:null};let d=e.slice(s+1).trim().replace(/^(?:=>|->|:)\s*/,"").replace(/\s+where\b.*$/,"").replace(/\s*(?:=>|=|\{|:)\s*$/,"").trim();return{params:e.slice(a+1,s).trim(),returns:d||null}}function ir(e){if(!e)return"";let t=/^\s*```(?:\w+)?\s*\n?[\s\S]*?\n?```/.exec(e);return(t?e.slice(t[0].length):e.includes("|")?e.slice(0,e.indexOf("|")):"").replace(/\s+/g," ").trim().slice(0,qn)}function dr(e){let t=new Map,n=new Set;for(let s of rt(e)){if(s.symbol.startsWith("local ")||!s.isFunctionLike&&!s.isTypeLike||e.isIgnored(s.relativePath)||he(s.relativePath)==="test")continue;let d=`${s.symbol}\0${s.relativePath}`;if(n.has(d))continue;n.add(d);let i=t.get(s.relativePath);i?i.push(s):t.set(s.relativePath,[s])}let r=[];for(let s of[...t.keys()].sort()){let d=Ye(e,s);if(Cr(s,d))continue;let i=t.get(s),c=fr(e,s,d,i);for(let l of i){let b=pr(l,c);b&&r.push({definition:l,candidate:b})}}r.sort((s,d)=>s.candidate.file.localeCompare(d.candidate.file)||s.candidate.startLine-d.candidate.startLine||s.candidate.name.localeCompare(d.candidate.name));let a=ht(e,new Set,r.map(({definition:s})=>s.symbolId)),o=r.map(({definition:s,candidate:d})=>{let i=[...a.get(s.symbolId)??[]].filter(([c,l])=>c!==d.file&&l.occurrences>0&&he(c)!=="test").map(([c])=>c).sort();return{...d,referencedFrom:i,consumable:d.exported||i.length>0}});return lr(o,r.map(({definition:s})=>cr(s)))}function cr(e){let{symbolId:t,documentId:n,startLine:r,endLine:a,symbol:o,relativePath:s}=e;return{symbolId:t,documentId:n,startLine:r,endLine:a,symbol:o,relativePath:s}}function lr(e,t){let n=new Map,r=new Map,a=new Map,o=new Set;return e.forEach((s,d)=>{let i=new Set;for(let c of xe)for(let l of s.fields[c].set)i.add(l);for(let c of i)It(n,c,d);for(let c of s.fields.name.set)r.set(c,(r.get(c)??0)+1);It(a,s.name,d);for(let c of s.calleeLeaves)o.add(c)}),{candidates:e,locations:t,byToken:n,nameDocFreq:r,byName:a,calledLeaves:o}}var Lt=new WeakMap;function $t(e,t,n,r){let a=Lt.get(t);a||(a=new Map,Lt.set(t,a));let o=a.get(n);return o||(o=ur(e,t.locations[n],t.candidates[n].name),a.set(n,o)),o.get(r)??[]}function ur(e,t,n){let r=new Map;for(let o of st(e,[t.symbolId])){if(e.isIgnored(o.relative_path))continue;let s=[o.chunk_start,o.chunk_end],d=r.get(o.relative_path);d?d.push(s):r.set(o.relative_path,[s])}let a=new Map;for(let[o,s]of r){let d=o===t.relativePath?{excludeStartLine:t.startLine,excludeEndLine:t.endLine}:{},i=ot(e,o,n,d);a.set(o,s.flatMap(([c,l])=>{let b=i.filter(p=>p>=c&&p<=l);return b.length>0?b.map(p=>[p,p]):[[c,l]]}))}return a}function It(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function fr(e,t,n,r){let a=null;return{lines:n,units:mr(e,t),endLines:r.map(o=>o.endLine).sort((o,s)=>o-s),exportedNames:()=>a??=Sr(n)}}function mr(e,t){let n=new Map,r=Xe(e,t);if(!r)return n;for(let a of mt(e,t,r)?.units??[]){let o=n.get(a.name);o?o.push(a):n.set(a.name,[a])}return n}function pr(e,t){let{units:n}=t,r=e.isTypeLike?null:gr(n.get(e.leaf),e.startLine),a=!e.isTypeLike&&(r!==null||et(e.symbol)||Yn.has(e.kind??-1));if(!e.isTypeLike&&!a)return null;let o=tt(nt(e.documentation)),s=kr(a&&(!o||!o.includes("("))&&r?r.signature:o??r?.signature??"").slice(0,Jn),d=a&&s?ar(s):{params:null,returns:null},i=ir(e.documentation),c=br(e,r),l=e.leaf;return{symbol:e.symbol,name:l,kind:a?e.parentTypeName?"method":"function":hr(e,s),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,container:c,doc:i,signature:s||null,paramsText:d.params,returnsText:d.returns,nameWords:Pe(l),fields:{name:D(l),container:D(c??""),doc:D(i,3,zn),signature:D(s),path:D(e.relativePath.replace(/\.[^./]+$/,""))},calleeLeaves:r?.calleeLeaves??[],hasBody:r!==null,exported:r?.exported===!0||vr(t.exportedNames(),e),deprecated:Er(t,e,i)}}function gr(e,t){let n=null;for(let r of e??[]){let a=Math.abs(r.startLine-t);a<=Xn&&(!n||a<Math.abs(n.startLine-t))&&(n=r)}return n}function br(e,t){return e.parentTypeName?e.parentTypeName:e.enclosingSymbol&&Ze(e.enclosingSymbol)!=="namespace"?Qe(e.enclosingSymbol)||null:t?.container.at(-1)??null}function hr(e,t){let r=(/^(?:export\s+)?(?:default\s+)?(?:declare\s+)?(?:abstract\s+)?(class|struct|interface|trait|protocol)\b/.exec(t)?.[1]??pt(e.kind??0)).toLowerCase();return r==="class"||r==="struct"?"class":r==="interface"||r==="trait"||r==="protocol"?"interface":"type"}function Er(e,t,n){if(we.test(n))return!0;let{lines:r}=e,a=r[t.startLine];if(a!==void 0&&Ft.test(a)&&we.test(a))return!0;let o=yr(e.endLines,t.startLine),s=!1;for(let d=t.startLine-1;d>o;d-=1){let i=r[d]?.trim()??"";if(i===""){if(s)continue;return!1}if(!s&&!Ft.test(i))return!1;if(we.test(i))return!0;s?s=!i.includes("/*"):s=i.endsWith("*/")&&!i.includes("/*")}return!1}function yr(e,t){let n=0,r=e.length;for(;n<r;){let a=n+r>>>1;e[a]<t?n=a+1:r=a}return n>0?e[n-1]:-1}function Sr(e){let t=new Map,n=new Set;return e.forEach((r,a)=>{if(!r.includes("export"))return;let o=tr.exec(r)?.[1];if(o){let s=t.get(o);s?s.push(a):t.set(o,[a])}for(let s of nr.exec(r)?.[1]?.match(rr)??[])n.add(s)}),{declared:t,listed:n}}function vr(e,t){if(e.listed.has(t.leaf))return!0;let n=t.startLine-or;return e.declared.get(t.leaf)?.some(r=>r>=n&&r<=t.startLine)??!1}function Cr(e,t){if(Qn.test(e.replace(/\\/g,"/")))return!0;let n=!1;for(let[r,a]of t.slice(0,Zn).entries()){let o=a.trim();if(n){if(Re.test(o))return!0;n=!o.includes("*/")}else{if(o===""||r===0&&o.startsWith("#!"))continue;if(o.startsWith("/*")){if(Re.test(o))return!0;n=!o.includes("*/",2)}else if(er.test(o)){if(Re.test(o))return!0}else return!1}}return!1}function kr(e){return e.replace(/\s+/g," ").trim()}var wr={name:1,container:.8,doc:.6,signature:.5,path:.3},Rr=200,xr=3,Pr=5,Ar=new Set(["add","apply","build","calculate","call","check","compute","config","context","convert","create","data","default","delete","do","ensure","error","fetch","find","format","get","handle","has","info","init","is","item","load","make","new","normalize","option","param","parse","process","read","remove","resolve","result","run","set","state","type","update","use","validate","value","with","wrap","write"]);function Ut(e,t,n={}){let r=Tr(e,t,n.scope),a=[];for(let o of Mr(e,r)){if(!Wt(r,e.candidates[o]))continue;let s=jt(r,e,o);(s.exactName||s.match>0)&&a.push(s)}return a.sort((o,s)=>Number(s.exactName)-Number(o.exactName)||s.match-o.match||s.nameCoverage-o.nameCoverage||o.index-s.index),{plan:r,corpusUnits:e.candidates.filter(o=>Q(r.scope,o)).length,shortlist:a.slice(0,Rr).map(o=>Kt(r,e,o)),unresolvedProbes:r.calls.filter(o=>o.status!=="matched").map(o=>({probe:o.probe,status:o.status}))}}function Ht(e,t,n){return Wt(t,e.candidates[n])?Kt(t,e,jt(t,e,n)):null}function re(e){return e?e.replace(/\\/g,"/").toLowerCase():null}function Q(e,t){return!e||t.file.toLowerCase().includes(e)}function Wt(e,t){return Q(e.scope,t)?e.kinds.size===0||e.kinds.has(t.kind)?!0:(t.kind==="function"||t.kind==="method")&&(e.kinds.has("function")||e.kinds.has("method")):!1}function Tr(e,t,n){let r=new Set,a=i=>{for(let c of W(i))for(let l of de(c))r.add(l)},o=[];for(let i of t.terms){let c=[],l=[];for(let p of i){let S=Ae(p);S.length!==0&&(c.push(p),l.push(S),a(p))}if(l.length===0)continue;let b=Math.max(...l.map(p=>_r(e,p)));o.push({labels:c,synonyms:l,weight:Math.log((e.candidates.length+1)/(b+1))+1})}let s=t.names.map(Pe).filter(i=>i.length>0);for(let i of t.names)a(i);for(let i of t.calls)a(i);for(let i of[...t.params,...t.returns])a(i);let d=t.calls.map(i=>Nr(e,i));return{groups:o,totalWeight:o.reduce((i,c)=>i+c.weight,0),names:s,vocab:r,calls:d,callTargets:new Set(d.flatMap(i=>i.targets)),params:{label:t.params.join("/"),words:t.params.flatMap(Ae)},returns:{label:t.returns.join("/"),words:t.returns.flatMap(Ae)},kinds:new Set(t.kinds),scope:re(n)}}function Ae(e){return D(e).variants}function _r(e,t){return Math.min(...t.map(n=>Math.max(0,...n.map(r=>e.nameDocFreq.get(r)??0))))}function Mr(e,t){let n=new Set,r=o=>o.flatMap(s=>e.byToken.get(s)??[]),a=o=>{let s=o.map(r).sort((d,i)=>d.length-i.length)[0];for(let d of s??[])n.add(d)};for(let o of t.groups)for(let s of o.synonyms)a(s);for(let o of t.names)a(o.filter(s=>s.length>=2&&!Z.has(s)).map(s=>[s]));return n}var Br=/[.#:/]/;function Nr(e,t){let n=t.replace(/`/g,""),r=Br.test(n),a=r?n.split(/[.#:/]+/).filter(Boolean).at(-1)??n:n,o=e.byName.get(a)??[],s=r?o.filter(i=>Fr(e.candidates[i]).has(n)):o;if(s.length>0)return new Set(s.map(c=>Or(e.candidates[c]))).size>Pr?{probe:t,leaf:a,status:"ambiguous",targets:[]}:{probe:t,leaf:a,status:"matched",targets:s};let d=!r&&e.calledLeaves.has(n);return{probe:t,leaf:a,status:d?"matched":"unmatched",targets:[]}}function Or(e){return`${e.file}\0${e.container??""}`}function Fr(e){let t=new Set,n=[e.name];if(e.container){for(let r of[".","#","::"])t.add(`${e.container}${r}${e.name}`);n.push(`${e.container}.${e.name}`)}for(let r of[e.file,e.file.replace(/\.[^./]+$/,"")])for(let a of[":","#","/"])for(let o of n)t.add(`${r}${a}${o}`);return t}function jt(e,t,n){let r=t.candidates[n],a=e.names.some(l=>Lr(l,r.nameWords)),o=0,s=0,d=0,i=[];for(let l of e.groups){let b={label:l.labels[0],field:null};for(let p of xe){let S=l.synonyms.findIndex(g=>Ir(r.fields[p],g));if(!(S<0)){b={label:l.labels[S],field:p};break}}i.push(b),b.field&&(o+=l.weight*wr[b.field]),b.field==="name"&&(s+=l.weight,d+=1)}let c=e.totalWeight;return{index:n,match:c>0?o/c:0,nameCoverage:c>0?s/c:0,nameGroups:d,exactName:a,hits:i}}function Lr(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Ir(e,t){if(t.length===1)return t[0].some(n=>e.set.has(n));for(let n=0;n+t.length<=e.words.length;n+=1)if(t.every((r,a)=>e.variants[n+a].some(o=>r.includes(o))))return!0;return!1}function Kt(e,t,n){let r=t.candidates[n.index],a=e.calls.filter(i=>i.status==="matched"),o=a.filter(i=>r.calleeLeaves.includes(i.leaf)).map(i=>i.probe),{fit:s,note:d}=Dr(e,r);return{...n,candidate:r,callContainment:r.hasBody&&a.length>0?o.length/a.length:null,callsFound:o,fit:s,fitNote:d,specializedWords:$r(e,t,r),isCallTarget:e.callTargets.has(n.index)}}function $r(e,t,n){let r=n.fields.name;return r.words.filter((a,o)=>(t.nameDocFreq.get(a)??0)<=xr&&!Ar.has(a)&&!r.variants[o].some(s=>e.vocab.has(s)))}function Dr(e,t){if(t.kind!=="function"&&t.kind!=="method")return{fit:"unknown",note:null};let n=[Ur(e,t),Hr(e,t)].filter(a=>a!==null),r=n.find(a=>a.verdict==="conflicts")??n[0];return r?{fit:r.verdict,note:r.note}:{fit:"unknown",note:null}}function Ur(e,t){if(e.returns.words.length===0)return null;let n=t.returnsText;return n?Vt(D(n),e.returns.words)?{verdict:"fits",note:`returns ${Dt(n)}`}:{verdict:"conflicts",note:`returns ${Dt(n)}, probe expects ${e.returns.label}`}:null}function Hr(e,t){return e.params.words.length===0||t.paramsText===null?null:t.paramsText===""?{verdict:"conflicts",note:`takes no parameters, probe expects ${e.params.label}`}:Vt(D(t.paramsText),e.params.words)?{verdict:"fits",note:`parameters include ${e.params.label}`}:null}function Vt(e,t){return t.some(n=>n.some(r=>e.set.has(r)))}function Dt(e){return e.length>40?`${e.slice(0,39)}\u2026`:e}import{createHash as Yr}from"crypto";var Wr=.6,jr=.35,Gt=.5,Kr=.75,Vr=.5,Me="blocked: file-internal (not exported, no references from other files)",Be="blocked: marked @deprecated",oe=["reuse","rework","compose"];function zt(e,t,n){let{plan:r}=n,a=new Map(n.shortlist.map(i=>[i.index,i])),o=i=>{if(a.has(i))return;let c=Ht(t,r,i);c&&a.set(i,c)};for(let i of r.callTargets)o(i);let s=new Map;for(let i of[...a.values()].filter(c=>qr(r,c)))for(let c of i.candidate.calleeLeaves)for(let l of Jr(e,t,i.candidate,c)){if(l===i.index)continue;let b=s.get(l);b?b.push(i):s.set(l,[i])}for(let i of s.keys())o(i);let d=[];for(let i of a.values()){let c=Gr(r,i,s.get(i.index)??[]);c&&d.push(c)}return d.sort(Xr)}function Gr(e,t,n){let r=Yt(t),a=zr(e,t,n),o=t.exactName||t.nameCoverage>=Kr,s=t.candidate.consumable&&!t.candidate.deprecated;return a.length>0&&!o&&s?Te(t,"compose",[..._e(t),...a]):Jt(t,r)?Te(t,"reuse",_e(t)):(t.exactName||t.match>=jr)&&r.length>0?Te(t,"rework",[..._e(t),...r.map(d=>d.text)]):null}function Te(e,t,n){let r=e.exactName||(e.callContainment??0)>=Vr&&e.fit==="fits";return{candidate:e.candidate,bucket:t,tier:r?"direct":"signal",score:Le(e.exactName?Math.max(e.match,.9):e.match),why:n}}function Jt(e,t){return(e.exactName||e.match>=Wr)&&t.length===0}function qr(e,t){return Jt(t,Yt(t))&&!t.isCallTarget&&!Xt(e,t)}function Xt(e,t){return e.groups.length>=2&&t.nameGroups===1&&t.specializedWords.length===0&&t.hits.some(n=>n.field===null)}function zr(e,t,n){let r=[];t.isCallTarget&&r.push(`name matches call probe ${t.candidate.name}`),Xt(e,t)&&r.push(`part of the task: name covers 1 of ${e.groups.length} concepts`);let a=n.filter(o=>qt(o)>qt(t));if(a.length>0){let o=[...new Set(a.map(s=>s.candidate.name))].slice(0,3);r.push(`referenced inside ${o.join(", ")}`)}return r}function qt(e){return e.exactName?Math.max(e.match,.9):e.match}function Jr(e,t,n,r){return(t.byName.get(r)??[]).filter(a=>{let o=t.candidates[a];return o.file!==n.file&&!o.referencedFrom.includes(n.file)?!1:$t(e,t,a,n.file).some(([s,d])=>s>=n.startLine&&d<=n.endLine)})}function Yt(e){let{candidate:t}=e,n=[];e.fit==="conflicts"&&n.push({kind:"signature",text:`blocked: ${e.fitNote??"signature conflicts with the probes"}`}),t.consumable||n.push({kind:"file-internal",text:Me}),e.specializedWords.length>0&&n.push({kind:"specialized",text:`blocked: specialized name (${e.specializedWords.join(", ")} not in the probes)`}),t.deprecated&&n.push({kind:"deprecated",text:Be});let r=[...new Set(e.hits.flatMap(o=>o.field&&o.field!=="name"?[o.field]:[]))],a=e.exactName||e.nameCoverage>=Gt||(e.callContainment??0)>=Gt;return r.length>0&&!a&&n.push({kind:"doc-only",text:`blocked: concept appears only in ${r.join("/")}, not in the name or callees`}),n}function _e(e){let t=[];e.exactName&&t.push(`name equals probe name ${e.candidate.name}`);let n=new Map;for(let a of e.hits){if(!a.field)continue;let o=n.get(a.field)??[];o.push(a.label),n.set(a.field,o)}let r=n.get("name");r&&!e.exactName&&t.push(`name matches ${r.join("+")}`);for(let[a,o]of n)a!=="name"&&t.push(`${a} mentions ${o.join("+")}`);return e.callsFound.length>0&&t.push(`calls ${e.callsFound.join(", ")}`),e.candidate.consumable&&t.push(Ne(e.candidate)),e.fit==="fits"&&e.fitNote&&t.push(`signature fits: ${e.fitNote}`),t}function Ne(e){let t=e.referencedFrom.length,n=`referenced from ${t} ${t===1?"file":"files"}`;return e.exported?t>0?`exported, ${n}`:"exported, no references from other files":t>0?`not exported, ${n}`:"file-internal"}function Oe(e,t){return{symbolId:e.symbol,name:e.kind==="method"&&e.container?`${e.container}.${e.name}`:e.name,file:e.file,line:e.startLine+1,signature:e.signature,...t}}function Fe(e,t,n){let r=new Map;return e.filter(a=>{if(n&&a.bucket!==n)return!1;let o=r.get(a.bucket)??0;return r.set(a.bucket,o+1),o<t})}function Xr(e,t){return oe.indexOf(e.bucket)-oe.indexOf(t.bucket)||+(t.tier==="direct")-+(e.tier==="direct")||t.score-e.score||e.candidate.file.localeCompare(t.candidate.file)||e.candidate.startLine-t.candidate.startLine||e.candidate.name.localeCompare(t.candidate.name)}function Le(e){return Math.round(e*1e3)/1e3}var tn=5,nn=1200,Qr=.05,Zr=.12,eo=15,to=3,no=.5,ro=200,oo=300,Qt=1e-9;function rn(e,t,n={}){let r=Y(e),a=Ut(r,t,{scope:n.scope}),o=zt(e,r,a);return{candidates:Fe(o,n.limit??tn,n.bucket).map(s=>Oe(s.candidate,{bucket:s.bucket,tier:s.tier,score:s.score,scoreBasis:"probe-match",why:s.why})),unresolvedProbes:a.unresolvedProbes,coverage:{corpusUnits:a.corpusUnits}}}var Zt=new WeakMap;function on(e,t=nn){return sn(Y(e),t).cards}function sn(e,t){let n=Zt.get(e);n||(n=new Map,Zt.set(e,n));let r=n.get(t);if(!r){let a=e.candidates.map((s,d)=>{let i=ao(s,t);return{cardHash:so(i),text:i,candidateIndex:d}}),o=new Map;for(let s of a){let d=o.get(s.cardHash);d?d.push(s.candidateIndex):o.set(s.cardHash,[s.candidateIndex])}r={cards:a,indexesByHash:o},n.set(t,r)}return r}function so(e){return Yr("sha256").update(`card-format-${1}
1
+ import{a as at}from"./chunk-ILMHV3KM.js";import{a as mt}from"./chunk-XN3EKMLI.js";import{G as ht,a as pt,b as gt,h as Z,i as W,j as de,k as bt}from"./chunk-LONKINMJ.js";import{U as ot,V as st,g as he,k as nt}from"./chunk-6WAPPQ5F.js";import{b as Ke,c as Ve,d as Ge,q as rt}from"./chunk-EQNMD62X.js";import{D as Ze,E as et,I as tt}from"./chunk-C6WKPKCF.js";import{d as Xe,e as Ye,f as Qe}from"./chunk-DRENNWRG.js";import{b as X,c as Ee,d as it,e as dt,f as ct,i as lt,j as ut,k as ft}from"./chunk-MEUHIDI3.js";import{a as be,l as ze,m as Je}from"./chunk-5FWR5HLG.js";import{i as H,j as J,m as je}from"./chunk-T75DS2E6.js";import{b as qe}from"./chunk-YT4DVWUV.js";import{a as We}from"./chunk-RCIGX23V.js";import{a as ge,b as ie}from"./chunk-6O3KXIDL.js";import{e as He,g as pe}from"./chunk-UQYQBLJX.js";import{join as $e}from"path";import{createHash as gn}from"crypto";import{mkdirSync as Ct,mkdtempSync as bn,renameSync as hn,rmSync as kt,statSync as En,writeFileSync as wt}from"fs";import{tmpdir as yn}from"os";import{extname as Sn,join as ee,resolve as vn,sep as Cn}from"path";var kn=1024*1024,Et=500,wn=64,Rn=/\.(?:cmd|bat)$/i;async function Rt(e,t,n={}){let r=Se(e);if(!r.ok)return $(r.reason,r.detail);let a=JSON.stringify(it),o;try{Ct(t.workDir,{recursive:!0}),o=bn(ee(yn(),"codebaseiq-probe-")),e.argv.includes("{schemaFile}")&&wt(ee(o,"schema.json"),a)}catch(s){return yt(o),$("spawn-failed",`could not prepare the agent sandbox: ${te(xn(s))}`)}try{let s=ee(o,"schema.json"),d=ee(o,"output.json"),i=e.argv.includes("{outputFile}"),c=new Map([["{schemaJson}",a],["{schemaFile}",s],["{outputFile}",d]]),l=Ve(r.path,e.argv.slice(1).map(S=>c.get(S)??S)),b;try{b=await st({command:l.binary,args:l.args,label:`agent probe command ${e.name}`,timeoutMs:e.timeoutMs,maxStdoutBytes:e.maxOutputBytes,maxStderrBytes:kn,cwd:t.workDir,env:Tn(n.env??process.env),input:ct(t.description,t.languages),signal:n.signal})}catch(S){return _n(S,n.signal)}if(b.status!==0){let S=St(b.stdout),g=b.status===null?`signal ${b.signal}`:`code ${b.status}`,m=S.kind==="error"?S.detail:b.stderr.trim()||b.stdout.trim();return $("agent-error",`${e.name} exited with ${g}: ${te(m)}`)}let p=[];if(i){let S=Mn(d,e.maxOutputBytes);if(S==="too-large")return $("output-too-large",`${e.name} wrote more than ${e.maxOutputBytes} bytes.`);S!==null&&p.push(S)}p.push(b.stdout);for(let S of p){let g=St(S);if(g.kind==="error")return $("agent-error",g.detail);if(g.kind==="none")continue;let{probes:m,diagnostics:w}=Ee(g.value);return X(m)?{ok:!0,probes:m,diagnostics:w,raw:S.trim()}:$("invalid-probes",On(w))}return $("no-json",`${e.name} printed no JSON object: ${te(b.stdout.trim())}`)}finally{yt(o)}}function yt(e){if(e!==void 0)try{kt(e,{recursive:!0,force:!0,maxRetries:3})}catch{}}function xn(e){return e instanceof Error?e.message:String(e)}function $(e,t){return{ok:!1,reason:e,detail:t}}function Pn(e){let t=ut({agent:{commands:[e]}}).filter(n=>n.level==="error");return t.length>0?t.map(n=>`${n.path}: ${n.message}`).join(" "):ft.has(e.argv[0])?"argv[0] must be the executable, not a placeholder.":[e.timeoutMs,e.maxOutputBytes].every(n=>Number.isFinite(n)&&n>0)?null:"timeoutMs and maxOutputBytes must be positive numbers."}function Se(e){let t=Pn(e);if(t)return{ok:!1,reason:"misconfigured",detail:t};let n=e.argv[0],r=`argv[0] "${n}" is a .cmd/.bat shim, which cannot be started without a shell. Point argv[0] at the real executable or at a node script (.js, .mjs, .cjs).`,a=n.includes("/")||n.includes(Cn),o;if(a){o=An(vn(n));let s=ye(o);if(s==="missing")return{ok:!1,reason:"spawn-failed",detail:`argv[0] "${n}" was not found.`};if(s==="other")return{ok:!1,reason:"misconfigured",detail:`argv[0] "${n}" is not an executable file.`}}else o=Ge(n);return o===null?Ke(n)?{ok:!1,reason:"misconfigured",detail:r}:{ok:!1,reason:"spawn-failed",detail:`argv[0] "${n}" was not found on PATH.`}:process.platform==="win32"&&Rn.test(o)?{ok:!1,reason:"misconfigured",detail:r}:{ok:!0,path:o}}function An(e,t=process.platform){return t!=="win32"||Sn(e)!==""||ye(e)!=="missing"?e:[".exe",".com"].map(n=>`${e}${n}`).find(n=>ye(n)==="file")??e}function ye(e){try{return En(e).isFile()?"file":"other"}catch{return"missing"}}function Tn(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&!/^CODEBASEIQ_/i.test(n)&&(t[n]=r);return t}function _n(e,t){if(!(e instanceof ot))throw e;switch(e.kind){case"spawn":return $("spawn-failed",e.message);case"timeout":return $("timeout",e.message);case"stdout-limit":case"stderr-limit":return $("output-too-large",e.message);case"aborted":throw t?H(t,e.message):e}}function Mn(e,t){try{return pe(e,{maxBytes:t,inputKind:"agent output file"})}catch(n){return n instanceof He&&n.reason==="too-large"?"too-large":null}}function St(e){let t=vt(e);if(!t)return{kind:"none"};if(t.type!=="result")return{kind:"object",value:t};if(t.is_error===!0){let r=typeof t.result=="string"&&t.result?t.result:t.subtype;return{kind:"error",detail:te(`The agent reported an error: ${String(r??"no message")}`)}}if(Pt(t.structured_output))return{kind:"object",value:t.structured_output};let n=typeof t.result=="string"?vt(t.result):null;return n?{kind:"object",value:n}:{kind:"none"}}function vt(e){let t=e.trim();return xt(t)??Bn(t)}function xt(e){try{let t=JSON.parse(e);return Pt(t)?t:null}catch{return null}}function Bn(e){let t=/\{\s*["}]/g,n=null,r=0;for(let a=0;a<wn;){t.lastIndex=r;let o=t.exec(e);if(!o)break;let s=Nn(e,o.index),d=s===-1?null:xt(e.slice(o.index,s+1));d?(n=d,r=s+1):(r=o.index+1,a++)}return n}function Nn(e,t){let n=0,r=!1,a=!1;for(let o=t;o<e.length;o++){let s=e[o];if(r)a?a=!1:s==="\\"?a=!0:s==='"'&&(r=!1);else if(s==='"')r=!0;else if(s==="{")n++;else if(s==="}"&&--n===0)return o}return-1}function Pt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function On(e){return e.length===0?"The agent returned no usable probes.":te(`The agent returned no usable probes: ${e.slice(0,3).map(t=>`${t.path||"root"}: ${t.message}`).join("; ")}`)}function te(e){return e.length>Et?`${e.slice(0,Et)}...`:e}var Fn=64*1024,Ln=3600*1e3;function At(e,t,n=Date.now){let r=(a,o)=>ee(e,`${gn("sha256").update(JSON.stringify([a,3,o])).digest("hex")}.json`);return{get(a,o){try{let s=JSON.parse(pe(r(a,o),{maxBytes:Fn,inputKind:"agent probe cache entry"}));if(typeof s.storedAt!="number"||n()-s.storedAt>=t*Ln)return;let{probes:d}=Ee(s.probes);return X(d)?d:void 0}catch{return}},set(a,o,s){let d=r(a,o),i=`${d}.${process.pid}.tmp`;try{Ct(e,{recursive:!0}),wt(i,JSON.stringify({storedAt:n(),probes:s})),hn(i,d)}catch{try{kt(i,{force:!0})}catch{}}}}}import{BlockList as In,isIP as $n}from"net";var Ce=64*1024*1024,Dn=2,Tt="embedding request aborted",Un="codebaseiq embedding canary: parse a retry delay from a config file",M=class extends Error{constructor(n,r,a){super(r);this.kind=n;this.status=a;this.name="EmbeddingClientError"}kind;status},ne=new In;for(let[e,t]of[["127.0.0.0",8],["10.0.0.0",8],["172.16.0.0",12],["192.168.0.0",16],["100.64.0.0",10],["169.254.0.0",16]])ne.addSubnet(e,t,"ipv4");ne.addAddress("::1","ipv6");ne.addSubnet("fe80::",10,"ipv6");ne.addSubnet("fc00::",7,"ipv6");var Hn=[".local",".lan",".home.arpa",".internal"];function _t(e){let t;try{t=new URL(e).hostname}catch{return!1}let n=(t.startsWith("[")?t.slice(1,-1):t).replace(/\.$/,""),r=$n(n);return r!==0?ne.check(n,r===4?"ipv4":"ipv6"):n==="localhost"||Hn.some(a=>n.endsWith(a))}function Nt(e,t={}){let n=t.fetchImpl??fetch,r=t.env??process.env,a=e.baseUrl.replace(/\/+$/,"");function o(){let l=e.apiKeyEnv?r[e.apiKeyEnv]:void 0;return l||void 0}function s(){let l;try{l=new URL(e.baseUrl)}catch{throw new M("invalid-endpoint",`embedding endpoint "${e.name}" has an invalid baseUrl`)}if(l.protocol!=="http:"&&l.protocol!=="https:")throw new M("invalid-endpoint",`embedding endpoint "${e.name}" must use http or https`);if(l.username!==""||l.password!=="")throw new M("invalid-endpoint",`embedding endpoint "${e.name}" must not embed credentials in baseUrl; use apiKeyEnv`);if(!e.allowRemote&&!_t(e.baseUrl))throw new M("remote-not-allowed",`embedding endpoint "${e.name}" is not on a private network; set allowRemote to use it`);if(l.protocol==="http:"&&o()!==void 0&&!_t(e.baseUrl))throw new M("insecure-token-transport",`embedding endpoint "${e.name}" would send its API key over plain http to a non-private host; use https`)}function d(l){let b={};l&&(b["content-type"]="application/json");let p=o();return p&&(b.authorization=`Bearer ${p}`),b}async function i(l,b,p,S){let g={model:e.model,input:l,encoding_format:"float",...e.dimensions!==void 0?{dimensions:e.dimensions}:{}},{status:m,text:w}=await Mt(n,`${a}/embeddings`,{method:"POST",headers:d(!0),body:JSON.stringify(g)},b,!0,S);if(m<200||m>=300)throw new M("http",`embeddings request failed with HTTP ${m}`,m);return Vn(w,l.length,p)}async function c(l,b,p){try{return await i(l,e.requestTimeoutMs,b,p)}catch(S){if(!Wn(S))throw S;return i(l,e.requestTimeoutMs,b,p)}}return{async checkHealth({signal:l}={}){try{s()}catch(p){return ve(p)}try{await Mt(n,`${a}/models`,{method:"GET",headers:d(!1)},e.healthTimeoutMs,!1,l)}catch(p){return l?.aborted?ve(p,l):{ok:!1,reason:"unreachable",detail:ke(p)}}let b=ge();try{let[p]=await i([e.documentPrefix+Un],e.warmTimeoutMs,{dims:e.dimensions},l);return{ok:!0,model:e.model,dimensions:p.length,latencyMs:Math.round(ge()-b),canary:p}}catch(p){return ve(p,l)}},async embed(l,b,{signal:p}={}){if(s(),l.length===0)return[];let S=b==="query"?e.queryPrefix:e.documentPrefix,g=Math.max(1,Math.floor(e.batchSize)),m=[];for(let x=0;x<l.length;x+=g)m.push(l.slice(x,x+g).map(A=>S+A));let w={dims:e.dimensions};return(await at(m,Dn,x=>c(x,w,p))).flat()}}}function Wn(e){return e instanceof M&&(e.kind==="timeout"||e.kind==="http"&&(e.status??0)>=500)}function ve(e,t){let n=ke(e);if(t?.aborted)return{ok:!1,reason:"aborted",detail:n};if(!(e instanceof M))return{ok:!1,reason:"bad-response",detail:n};switch(e.kind){case"remote-not-allowed":case"insecure-token-transport":case"invalid-endpoint":return{ok:!1,reason:e.kind,detail:n};case"network":return{ok:!1,reason:"unreachable",detail:n};case"timeout":return{ok:!1,reason:"model-loading",detail:n};case"http":return e.status===503?{ok:!1,reason:"model-loading",detail:n}:e.status===401||e.status===403?{ok:!1,reason:"unauthorized",detail:n}:{ok:!1,reason:"bad-response",detail:n};default:return{ok:!1,reason:"bad-response",detail:n}}}function ke(e){return e instanceof Error?e.message:String(e)}async function Mt(e,t,n,r,a,o){J(o,Tt);let s=new AbortController,d=setTimeout(()=>{s.abort(new M("timeout",`no response within ${r}ms`))},r),i=()=>s.abort(o?.reason);o?.addEventListener("abort",i,{once:!0});try{let c=await Ot(e(t,{...n,signal:s.signal,redirect:"error"}),s.signal);return{status:c.status,text:a?await Kn(c,s.signal):""}}catch(c){throw o?.aborted&&s.signal.reason===o.reason?H(o,Tt):c instanceof M?c:s.signal.aborted&&s.signal.reason instanceof M?s.signal.reason:new M("network",`could not reach the embeddings endpoint: ${jn(c)}`)}finally{clearTimeout(d),o?.removeEventListener("abort",i),s.abort()}}function jn(e){let t=e instanceof Error?e.cause:void 0;return typeof t?.code=="string"?t.code:ke(e)}async function Kn(e,t){let n=Number(e.headers.get("content-length"));if(Number.isFinite(n)&&n>Ce)throw Bt();if(!e.body)return"";let r=e.body.getReader(),a=[],o=0;for(;;){let{done:s,value:d}=await Ot(r.read(),t);if(s)break;if(o+=d.byteLength,o>Ce)throw r.cancel().catch(()=>{}),Bt();a.push(d)}return new TextDecoder().decode(Buffer.concat(a))}function Bt(){return new M("too-large",`embeddings response exceeded the ${Ce} byte limit`)}function Ot(e,t){return new Promise((n,r)=>{let a=()=>r(t.reason);if(t.aborted){a();return}t.addEventListener("abort",a,{once:!0}),e.then(n,r).finally(()=>t.removeEventListener("abort",a))})}function Vn(e,t,n){let r;try{r=JSON.parse(e)}catch{throw j("response is not valid JSON")}let a=typeof r=="object"&&r!==null?r.data:void 0;if(!Array.isArray(a)||a.length!==t)throw j(`expected ${t} embeddings, received ${Array.isArray(a)?a.length:"none"}`);let o=new Array(t).fill(void 0),s=new Set;return a.forEach((d,i)=>{let c=typeof d=="object"&&d!==null?d:{},l=c.index===void 0?i:c.index;if(typeof l!="number"||!Number.isInteger(l)||l<0||l>=t||s.has(l))throw j("embedding indexes are not a permutation of the inputs");s.add(l),o[l]=c.embedding}),o.map(d=>Gn(d,n))}function Gn(e,t){if(!Array.isArray(e)||e.length===0)throw j("embedding is not a non-empty float array");if(t.dims!==void 0&&e.length!==t.dims)throw j(`embedding has ${e.length} dimensions, expected ${t.dims}`);let n=0;for(let o of e){if(typeof o!="number"||!Number.isFinite(o))throw j("embedding contains a non-finite value");n+=o*o}let r=Math.sqrt(n);if(!Number.isFinite(r)||r===0)throw j("embedding has zero or unrepresentable magnitude");t.dims=e.length;let a=new Float32Array(e.length);for(let o=0;o<e.length;o+=1)a[o]=e[o]/r;return a}function j(e){return new M("bad-response",`embeddings response rejected: ${e}`)}var xe=["name","container","doc","signature","path"],qn=1e3,zn=150,Jn=400,Xn=3,we=/@deprecated\b|#\[deprecated\b|\bdeprecated\s*[:(]/i,Ft=/^\s*(?:\/\/|\/\*|\*|#|@)/,Yn=new Set(gt()),Qn=/(?:^|\/)(?:__generated__|generated)\/|\.(?:generated|gen|g)\.[a-z0-9]+$|\.pb2?\.[a-z0-9]+$|_pb2?\.[a-z0-9]+$/i,Re=/@generated\b|\bcode generated\b.*\bdo not edit\b/i,Zn=40,er=/^(?:\/\/|--|#(?![[!\w]))/,tr=/^\s*export\s+(?:default\s+)?(?:(?:async\s+)?function|(?:abstract\s+)?class|interface|type|enum|namespace|module|const|let|var)\s+([\p{L}\p{N}_$]+)/u,nr=/^\s*export\s*\{([^}\n]*)/,rr=/[\p{L}\p{N}_$]+/gu,or=2,sr=qe("builder-candidate-corpus",{clearGroups:["whole-project","definition-catalog"]});function Y(e){return sr.get(e,()=>dr(e))}function D(e,t=2,n=Number.POSITIVE_INFINITY){let r=[],a=[],o=new Set;for(let s of W(e)){if(r.length>=n)break;if(Z.has(s.toLocaleLowerCase()))continue;let d=de(s),i=d[0];if(!(i.length<t||Z.has(i))){r.push(i),a.push(d);for(let c of d)o.add(c)}}return{words:r,variants:a,set:o}}function Pe(e){return W(e).map(bt)}function ar(e){let t=0,n=0,r=0,a=-1;for(let i=0;i<e.length&&a<0;i+=1){let c=e[i];c==="["?t+=1:c==="]"?t=Math.max(0,t-1):c==="{"?n+=1:c==="}"?n=Math.max(0,n-1):c==="<"?r+=1:c===">"&&e[i-1]!=="="&&e[i-1]!=="-"?r=Math.max(0,r-1):c==="("&&t===0&&n===0&&r===0&&(a=i)}if(a<0)return{params:null,returns:null};let o=0,s=-1;for(let i=a;i<e.length;i+=1){let c=e[i];if(c==="(")o+=1;else if(c===")"&&(o-=1,o===0)){s=i;break}}if(s<0)return{params:e.slice(a+1).trim(),returns:null};let d=e.slice(s+1).trim().replace(/^(?:=>|->|:)\s*/,"").replace(/\s+where\b.*$/,"").replace(/\s*(?:=>|=|\{|:)\s*$/,"").trim();return{params:e.slice(a+1,s).trim(),returns:d||null}}function ir(e){if(!e)return"";let t=/^\s*```(?:\w+)?\s*\n?[\s\S]*?\n?```/.exec(e);return(t?e.slice(t[0].length):e.includes("|")?e.slice(0,e.indexOf("|")):"").replace(/\s+/g," ").trim().slice(0,qn)}function dr(e){let t=new Map,n=new Set;for(let s of tt(e)){if(s.symbol.startsWith("local ")||!s.isFunctionLike&&!s.isTypeLike||e.isIgnored(s.relativePath)||he(s.relativePath)==="test")continue;let d=`${s.symbol}\0${s.relativePath}`;if(n.has(d))continue;n.add(d);let i=t.get(s.relativePath);i?i.push(s):t.set(s.relativePath,[s])}let r=[];for(let s of[...t.keys()].sort()){let d=Je(e,s);if(Cr(s,d))continue;let i=t.get(s),c=fr(e,s,d,i);for(let l of i){let b=pr(l,c);b&&r.push({definition:l,candidate:b})}}r.sort((s,d)=>s.candidate.file.localeCompare(d.candidate.file)||s.candidate.startLine-d.candidate.startLine||s.candidate.name.localeCompare(d.candidate.name));let a=ht(e,new Set,r.map(({definition:s})=>s.symbolId)),o=r.map(({definition:s,candidate:d})=>{let i=[...a.get(s.symbolId)??[]].filter(([c,l])=>c!==d.file&&l.occurrences>0&&he(c)!=="test").map(([c])=>c).sort();return{...d,referencedFrom:i,consumable:d.exported||i.length>0}});return lr(o,r.map(({definition:s})=>cr(s)))}function cr(e){let{symbolId:t,documentId:n,startLine:r,endLine:a,symbol:o,relativePath:s}=e;return{symbolId:t,documentId:n,startLine:r,endLine:a,symbol:o,relativePath:s}}function lr(e,t){let n=new Map,r=new Map,a=new Map,o=new Set;return e.forEach((s,d)=>{let i=new Set;for(let c of xe)for(let l of s.fields[c].set)i.add(l);for(let c of i)It(n,c,d);for(let c of s.fields.name.set)r.set(c,(r.get(c)??0)+1);It(a,s.name,d);for(let c of s.calleeLeaves)o.add(c)}),{candidates:e,locations:t,byToken:n,nameDocFreq:r,byName:a,calledLeaves:o}}var Lt=new WeakMap;function $t(e,t,n,r){let a=Lt.get(t);a||(a=new Map,Lt.set(t,a));let o=a.get(n);return o||(o=ur(e,t.locations[n],t.candidates[n].name),a.set(n,o)),o.get(r)??[]}function ur(e,t,n){let r=new Map;for(let o of rt(e,[t.symbolId])){if(e.isIgnored(o.relative_path))continue;let s=[o.chunk_start,o.chunk_end],d=r.get(o.relative_path);d?d.push(s):r.set(o.relative_path,[s])}let a=new Map;for(let[o,s]of r){let d=o===t.relativePath?{excludeStartLine:t.startLine,excludeEndLine:t.endLine}:{},i=nt(e,o,n,d);a.set(o,s.flatMap(([c,l])=>{let b=i.filter(p=>p>=c&&p<=l);return b.length>0?b.map(p=>[p,p]):[[c,l]]}))}return a}function It(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function fr(e,t,n,r){let a=null;return{lines:n,units:mr(e,t),endLines:r.map(o=>o.endLine).sort((o,s)=>o-s),exportedNames:()=>a??=Sr(n)}}function mr(e,t){let n=new Map,r=ze(e,t);if(!r)return n;for(let a of mt(e,t,r)?.units??[]){let o=n.get(a.name);o?o.push(a):n.set(a.name,[a])}return n}function pr(e,t){let{units:n}=t,r=e.isTypeLike?null:gr(n.get(e.leaf),e.startLine),a=!e.isTypeLike&&(r!==null||Qe(e.symbol)||Yn.has(e.kind??-1));if(!e.isTypeLike&&!a)return null;let o=Ze(et(e.documentation)),s=kr(a&&(!o||!o.includes("("))&&r?r.signature:o??r?.signature??"").slice(0,Jn),d=a&&s?ar(s):{params:null,returns:null},i=ir(e.documentation),c=br(e,r),l=e.leaf;return{symbol:e.symbol,name:l,kind:a?e.parentTypeName?"method":"function":hr(e,s),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,container:c,doc:i,signature:s||null,paramsText:d.params,returnsText:d.returns,nameWords:Pe(l),fields:{name:D(l),container:D(c??""),doc:D(i,3,zn),signature:D(s),path:D(e.relativePath.replace(/\.[^./]+$/,""))},calleeLeaves:r?.calleeLeaves??[],hasBody:r!==null,exported:r?.exported===!0||vr(t.exportedNames(),e),deprecated:Er(t,e,i)}}function gr(e,t){let n=null;for(let r of e??[]){let a=Math.abs(r.startLine-t);a<=Xn&&(!n||a<Math.abs(n.startLine-t))&&(n=r)}return n}function br(e,t){return e.parentTypeName?e.parentTypeName:e.enclosingSymbol&&Ye(e.enclosingSymbol)!=="namespace"?Xe(e.enclosingSymbol)||null:t?.container.at(-1)??null}function hr(e,t){let r=(/^(?:export\s+)?(?:default\s+)?(?:declare\s+)?(?:abstract\s+)?(class|struct|interface|trait|protocol)\b/.exec(t)?.[1]??pt(e.kind??0)).toLowerCase();return r==="class"||r==="struct"?"class":r==="interface"||r==="trait"||r==="protocol"?"interface":"type"}function Er(e,t,n){if(we.test(n))return!0;let{lines:r}=e,a=r[t.startLine];if(a!==void 0&&Ft.test(a)&&we.test(a))return!0;let o=yr(e.endLines,t.startLine),s=!1;for(let d=t.startLine-1;d>o;d-=1){let i=r[d]?.trim()??"";if(i===""){if(s)continue;return!1}if(!s&&!Ft.test(i))return!1;if(we.test(i))return!0;s?s=!i.includes("/*"):s=i.endsWith("*/")&&!i.includes("/*")}return!1}function yr(e,t){let n=0,r=e.length;for(;n<r;){let a=n+r>>>1;e[a]<t?n=a+1:r=a}return n>0?e[n-1]:-1}function Sr(e){let t=new Map,n=new Set;return e.forEach((r,a)=>{if(!r.includes("export"))return;let o=tr.exec(r)?.[1];if(o){let s=t.get(o);s?s.push(a):t.set(o,[a])}for(let s of nr.exec(r)?.[1]?.match(rr)??[])n.add(s)}),{declared:t,listed:n}}function vr(e,t){if(e.listed.has(t.leaf))return!0;let n=t.startLine-or;return e.declared.get(t.leaf)?.some(r=>r>=n&&r<=t.startLine)??!1}function Cr(e,t){if(Qn.test(e.replace(/\\/g,"/")))return!0;let n=!1;for(let[r,a]of t.slice(0,Zn).entries()){let o=a.trim();if(n){if(Re.test(o))return!0;n=!o.includes("*/")}else{if(o===""||r===0&&o.startsWith("#!"))continue;if(o.startsWith("/*")){if(Re.test(o))return!0;n=!o.includes("*/",2)}else if(er.test(o)){if(Re.test(o))return!0}else return!1}}return!1}function kr(e){return e.replace(/\s+/g," ").trim()}var wr={name:1,container:.8,doc:.6,signature:.5,path:.3},Rr=200,xr=3,Pr=5,Ar=new Set(["add","apply","build","calculate","call","check","compute","config","context","convert","create","data","default","delete","do","ensure","error","fetch","find","format","get","handle","has","info","init","is","item","load","make","new","normalize","option","param","parse","process","read","remove","resolve","result","run","set","state","type","update","use","validate","value","with","wrap","write"]);function Ut(e,t,n={}){let r=Tr(e,t,n.scope),a=[];for(let o of Mr(e,r)){if(!Wt(r,e.candidates[o]))continue;let s=jt(r,e,o);(s.exactName||s.match>0)&&a.push(s)}return a.sort((o,s)=>Number(s.exactName)-Number(o.exactName)||s.match-o.match||s.nameCoverage-o.nameCoverage||o.index-s.index),{plan:r,corpusUnits:e.candidates.filter(o=>Q(r.scope,o)).length,shortlist:a.slice(0,Rr).map(o=>Kt(r,e,o)),unresolvedProbes:r.calls.filter(o=>o.status!=="matched").map(o=>({probe:o.probe,status:o.status}))}}function Ht(e,t,n){return Wt(t,e.candidates[n])?Kt(t,e,jt(t,e,n)):null}function re(e){return e?e.replace(/\\/g,"/").toLowerCase():null}function Q(e,t){return!e||t.file.toLowerCase().includes(e)}function Wt(e,t){return Q(e.scope,t)?e.kinds.size===0||e.kinds.has(t.kind)?!0:(t.kind==="function"||t.kind==="method")&&(e.kinds.has("function")||e.kinds.has("method")):!1}function Tr(e,t,n){let r=new Set,a=i=>{for(let c of W(i))for(let l of de(c))r.add(l)},o=[];for(let i of t.terms){let c=[],l=[];for(let p of i){let S=Ae(p);S.length!==0&&(c.push(p),l.push(S),a(p))}if(l.length===0)continue;let b=Math.max(...l.map(p=>_r(e,p)));o.push({labels:c,synonyms:l,weight:Math.log((e.candidates.length+1)/(b+1))+1})}let s=t.names.map(Pe).filter(i=>i.length>0);for(let i of t.names)a(i);for(let i of t.calls)a(i);for(let i of[...t.params,...t.returns])a(i);let d=t.calls.map(i=>Nr(e,i));return{groups:o,totalWeight:o.reduce((i,c)=>i+c.weight,0),names:s,vocab:r,calls:d,callTargets:new Set(d.flatMap(i=>i.targets)),params:{label:t.params.join("/"),words:t.params.flatMap(Ae)},returns:{label:t.returns.join("/"),words:t.returns.flatMap(Ae)},kinds:new Set(t.kinds),scope:re(n)}}function Ae(e){return D(e).variants}function _r(e,t){return Math.min(...t.map(n=>Math.max(0,...n.map(r=>e.nameDocFreq.get(r)??0))))}function Mr(e,t){let n=new Set,r=o=>o.flatMap(s=>e.byToken.get(s)??[]),a=o=>{let s=o.map(r).sort((d,i)=>d.length-i.length)[0];for(let d of s??[])n.add(d)};for(let o of t.groups)for(let s of o.synonyms)a(s);for(let o of t.names)a(o.filter(s=>s.length>=2&&!Z.has(s)).map(s=>[s]));return n}var Br=/[.#:/]/;function Nr(e,t){let n=t.replace(/`/g,""),r=Br.test(n),a=r?n.split(/[.#:/]+/).filter(Boolean).at(-1)??n:n,o=e.byName.get(a)??[],s=r?o.filter(i=>Fr(e.candidates[i]).has(n)):o;if(s.length>0)return new Set(s.map(c=>Or(e.candidates[c]))).size>Pr?{probe:t,leaf:a,status:"ambiguous",targets:[]}:{probe:t,leaf:a,status:"matched",targets:s};let d=!r&&e.calledLeaves.has(n);return{probe:t,leaf:a,status:d?"matched":"unmatched",targets:[]}}function Or(e){return`${e.file}\0${e.container??""}`}function Fr(e){let t=new Set,n=[e.name];if(e.container){for(let r of[".","#","::"])t.add(`${e.container}${r}${e.name}`);n.push(`${e.container}.${e.name}`)}for(let r of[e.file,e.file.replace(/\.[^./]+$/,"")])for(let a of[":","#","/"])for(let o of n)t.add(`${r}${a}${o}`);return t}function jt(e,t,n){let r=t.candidates[n],a=e.names.some(l=>Lr(l,r.nameWords)),o=0,s=0,d=0,i=[];for(let l of e.groups){let b={label:l.labels[0],field:null};for(let p of xe){let S=l.synonyms.findIndex(g=>Ir(r.fields[p],g));if(!(S<0)){b={label:l.labels[S],field:p};break}}i.push(b),b.field&&(o+=l.weight*wr[b.field]),b.field==="name"&&(s+=l.weight,d+=1)}let c=e.totalWeight;return{index:n,match:c>0?o/c:0,nameCoverage:c>0?s/c:0,nameGroups:d,exactName:a,hits:i}}function Lr(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Ir(e,t){if(t.length===1)return t[0].some(n=>e.set.has(n));for(let n=0;n+t.length<=e.words.length;n+=1)if(t.every((r,a)=>e.variants[n+a].some(o=>r.includes(o))))return!0;return!1}function Kt(e,t,n){let r=t.candidates[n.index],a=e.calls.filter(i=>i.status==="matched"),o=a.filter(i=>r.calleeLeaves.includes(i.leaf)).map(i=>i.probe),{fit:s,note:d}=Dr(e,r);return{...n,candidate:r,callContainment:r.hasBody&&a.length>0?o.length/a.length:null,callsFound:o,fit:s,fitNote:d,specializedWords:$r(e,t,r),isCallTarget:e.callTargets.has(n.index)}}function $r(e,t,n){let r=n.fields.name;return r.words.filter((a,o)=>(t.nameDocFreq.get(a)??0)<=xr&&!Ar.has(a)&&!r.variants[o].some(s=>e.vocab.has(s)))}function Dr(e,t){if(t.kind!=="function"&&t.kind!=="method")return{fit:"unknown",note:null};let n=[Ur(e,t),Hr(e,t)].filter(a=>a!==null),r=n.find(a=>a.verdict==="conflicts")??n[0];return r?{fit:r.verdict,note:r.note}:{fit:"unknown",note:null}}function Ur(e,t){if(e.returns.words.length===0)return null;let n=t.returnsText;return n?Vt(D(n),e.returns.words)?{verdict:"fits",note:`returns ${Dt(n)}`}:{verdict:"conflicts",note:`returns ${Dt(n)}, probe expects ${e.returns.label}`}:null}function Hr(e,t){return e.params.words.length===0||t.paramsText===null?null:t.paramsText===""?{verdict:"conflicts",note:`takes no parameters, probe expects ${e.params.label}`}:Vt(D(t.paramsText),e.params.words)?{verdict:"fits",note:`parameters include ${e.params.label}`}:null}function Vt(e,t){return t.some(n=>n.some(r=>e.set.has(r)))}function Dt(e){return e.length>40?`${e.slice(0,39)}\u2026`:e}import{createHash as Yr}from"crypto";var Wr=.6,jr=.35,Gt=.5,Kr=.75,Vr=.5,Me="blocked: file-internal (not exported, no references from other files)",Be="blocked: marked @deprecated",oe=["reuse","rework","compose"];function zt(e,t,n){let{plan:r}=n,a=new Map(n.shortlist.map(i=>[i.index,i])),o=i=>{if(a.has(i))return;let c=Ht(t,r,i);c&&a.set(i,c)};for(let i of r.callTargets)o(i);let s=new Map;for(let i of[...a.values()].filter(c=>qr(r,c)))for(let c of i.candidate.calleeLeaves)for(let l of Jr(e,t,i.candidate,c)){if(l===i.index)continue;let b=s.get(l);b?b.push(i):s.set(l,[i])}for(let i of s.keys())o(i);let d=[];for(let i of a.values()){let c=Gr(r,i,s.get(i.index)??[]);c&&d.push(c)}return d.sort(Xr)}function Gr(e,t,n){let r=Yt(t),a=zr(e,t,n),o=t.exactName||t.nameCoverage>=Kr,s=t.candidate.consumable&&!t.candidate.deprecated;return a.length>0&&!o&&s?Te(t,"compose",[..._e(t),...a]):Jt(t,r)?Te(t,"reuse",_e(t)):(t.exactName||t.match>=jr)&&r.length>0?Te(t,"rework",[..._e(t),...r.map(d=>d.text)]):null}function Te(e,t,n){let r=e.exactName||(e.callContainment??0)>=Vr&&e.fit==="fits";return{candidate:e.candidate,bucket:t,tier:r?"direct":"signal",score:Le(e.exactName?Math.max(e.match,.9):e.match),why:n}}function Jt(e,t){return(e.exactName||e.match>=Wr)&&t.length===0}function qr(e,t){return Jt(t,Yt(t))&&!t.isCallTarget&&!Xt(e,t)}function Xt(e,t){return e.groups.length>=2&&t.nameGroups===1&&t.specializedWords.length===0&&t.hits.some(n=>n.field===null)}function zr(e,t,n){let r=[];t.isCallTarget&&r.push(`name matches call probe ${t.candidate.name}`),Xt(e,t)&&r.push(`part of the task: name covers 1 of ${e.groups.length} concepts`);let a=n.filter(o=>qt(o)>qt(t));if(a.length>0){let o=[...new Set(a.map(s=>s.candidate.name))].slice(0,3);r.push(`referenced inside ${o.join(", ")}`)}return r}function qt(e){return e.exactName?Math.max(e.match,.9):e.match}function Jr(e,t,n,r){return(t.byName.get(r)??[]).filter(a=>{let o=t.candidates[a];return o.file!==n.file&&!o.referencedFrom.includes(n.file)?!1:$t(e,t,a,n.file).some(([s,d])=>s>=n.startLine&&d<=n.endLine)})}function Yt(e){let{candidate:t}=e,n=[];e.fit==="conflicts"&&n.push({kind:"signature",text:`blocked: ${e.fitNote??"signature conflicts with the probes"}`}),t.consumable||n.push({kind:"file-internal",text:Me}),e.specializedWords.length>0&&n.push({kind:"specialized",text:`blocked: specialized name (${e.specializedWords.join(", ")} not in the probes)`}),t.deprecated&&n.push({kind:"deprecated",text:Be});let r=[...new Set(e.hits.flatMap(o=>o.field&&o.field!=="name"?[o.field]:[]))],a=e.exactName||e.nameCoverage>=Gt||(e.callContainment??0)>=Gt;return r.length>0&&!a&&n.push({kind:"doc-only",text:`blocked: concept appears only in ${r.join("/")}, not in the name or callees`}),n}function _e(e){let t=[];e.exactName&&t.push(`name equals probe name ${e.candidate.name}`);let n=new Map;for(let a of e.hits){if(!a.field)continue;let o=n.get(a.field)??[];o.push(a.label),n.set(a.field,o)}let r=n.get("name");r&&!e.exactName&&t.push(`name matches ${r.join("+")}`);for(let[a,o]of n)a!=="name"&&t.push(`${a} mentions ${o.join("+")}`);return e.callsFound.length>0&&t.push(`calls ${e.callsFound.join(", ")}`),e.candidate.consumable&&t.push(Ne(e.candidate)),e.fit==="fits"&&e.fitNote&&t.push(`signature fits: ${e.fitNote}`),t}function Ne(e){let t=e.referencedFrom.length,n=`referenced from ${t} ${t===1?"file":"files"}`;return e.exported?t>0?`exported, ${n}`:"exported, no references from other files":t>0?`not exported, ${n}`:"file-internal"}function Oe(e,t){return{symbolId:e.symbol,name:e.kind==="method"&&e.container?`${e.container}.${e.name}`:e.name,file:e.file,line:e.startLine+1,signature:e.signature,...t}}function Fe(e,t,n){let r=new Map;return e.filter(a=>{if(n&&a.bucket!==n)return!1;let o=r.get(a.bucket)??0;return r.set(a.bucket,o+1),o<t})}function Xr(e,t){return oe.indexOf(e.bucket)-oe.indexOf(t.bucket)||+(t.tier==="direct")-+(e.tier==="direct")||t.score-e.score||e.candidate.file.localeCompare(t.candidate.file)||e.candidate.startLine-t.candidate.startLine||e.candidate.name.localeCompare(t.candidate.name)}function Le(e){return Math.round(e*1e3)/1e3}var tn=5,nn=1200,Qr=.05,Zr=.12,eo=15,to=3,no=.5,ro=200,oo=300,Qt=1e-9;function rn(e,t,n={}){let r=Y(e),a=Ut(r,t,{scope:n.scope}),o=zt(e,r,a);return{candidates:Fe(o,n.limit??tn,n.bucket).map(s=>Oe(s.candidate,{bucket:s.bucket,tier:s.tier,score:s.score,scoreBasis:"probe-match",why:s.why})),unresolvedProbes:a.unresolvedProbes,coverage:{corpusUnits:a.corpusUnits}}}var Zt=new WeakMap;function on(e,t=nn){return sn(Y(e),t).cards}function sn(e,t){let n=Zt.get(e);n||(n=new Map,Zt.set(e,n));let r=n.get(t);if(!r){let a=e.candidates.map((s,d)=>{let i=ao(s,t);return{cardHash:so(i),text:i,candidateIndex:d}}),o=new Map;for(let s of a){let d=o.get(s.cardHash);d?d.push(s.candidateIndex):o.set(s.cardHash,[s.candidateIndex])}r={cards:a,indexesByHash:o},n.set(t,r)}return r}function so(e){return Yr("sha256").update(`card-format-${1}
2
2
  ${e}`).digest("hex")}function ao(e,t){let n=o=>W(o).map(s=>s.toLocaleLowerCase()).join(" "),r=`name: ${n(e.name)} | kind: ${e.kind} | in: ${e.container??""}`,a=[`signature: ${(e.signature??"").slice(0,ro)}`,`doc: ${e.doc.slice(0,oo)}`,`path: ${n(e.file.replace(/\.[^./]+$/,""))}`].join(" | ");return`${r}
3
- ${a}`.slice(0,t)}function an(e,t,n={}){let{topBandMargin:r=Qr,maxCardChars:a=nn}=n,o=Y(e),{indexesByHash:s}=sn(o,a),d=re(n.scope),i=new Map;for(let b of t)for(let p of s.get(b.cardHash)??[])Q(d,o.candidates[p])&&i.set(p,Math.max(i.get(p)??Number.NEGATIVE_INFINITY,b.score));if(i.size===0)return[];let c=Math.max(...i.values()),l=[];for(let[b,p]of i){let S=o.candidates[b],g=c-p,m=io(S),w=S.endLine-S.startLine+1<=eo&&S.referencedFrom.length>=to,P=g<=Zr+Qt,x=null;if(g<=r+Qt?x=m.length===0?"reuse":"rework":w&&m.length===0&&(P||p>=no)?x="compose":P&&m.length>0&&(x="rework"),!x)continue;let A=[`cosine ${p.toFixed(3)} (best ${c.toFixed(3)})`];S.consumable&&A.push(Ne(S)),x==="compose"&&A.push(`small utility: ${S.endLine-S.startLine+1} lines, referenced from ${S.referencedFrom.length} files`),A.push(...m),l.push(Oe(S,{bucket:x,tier:"signal",score:Le(p),scoreBasis:"cosine",why:A}))}return l.sort((b,p)=>oe.indexOf(b.bucket)-oe.indexOf(p.bucket)||p.score-b.score||b.file.localeCompare(p.file)||b.line-p.line||b.name.localeCompare(p.name)),Fe(l,n.limit??tn,n.bucket)}function io(e){let t=[];return e.consumable||t.push(Me),e.deprecated&&t.push(Be),t}import{mkdirSync as co}from"fs";import{dirname as lo,join as uo}from"path";import fo from"better-sqlite3";var mo="embeddings",po=1,go=720*60*60*1e3,bo=.995,ho=3600*1e3;function Eo(e){return be(JSON.stringify({model:e.model,dims:e.dims,documentPrefix:e.documentPrefix,cardFormatVersion:e.cardFormatVersion})).slice(0,16)}function ln(e,t){return be(`${e}\0${t}`).slice(0,16)}function ce(e,t){process.env.CODEBASEIQ_DEBUG&&console.error(`embedding-store: ${e}: ${t instanceof Error?t.message:String(t)}`)}function Ie(e,t,n={}){let r=n.now??ie,a=n.storeKey??Eo(t),o=uo(e,mo,`${a}.db`),s=t.dims,d=yo(o,t),i=null;function c(g,m){ce(`disabled (${g})`,m),i=null;try{d?.db.close()}catch(w){ce("close failed while disabling",w)}d=null}function l(g){return g.readDataVersion.get()}function b(g){return i&&i.dataVersion===l(g)||(i=p(g)),i}function p(g){return g.db.transaction(()=>{let m=l(g),w=g.countRows.get().count,P=new Float32Array(w*s),x=[],A=new Map;for(let N of g.readAll.iterate())new Uint8Array(P.buffer,x.length*s*4,s*4).set(N.vector),A.set(N.card_hash,x.length),x.push(N.card_hash);return{dataVersion:m,hashes:x,index:A,data:P}})()}function S(g,m){let w=0;for(let P of m)g.readUsed.get(P)!==void 0&&(w+=1);return w}return{get available(){return d!==null},key:a,path:o,verifyCanary(g){if(!d)return"first";try{let m=d.readCanary.get();return m?Co(vo(m.value),g)>=bo?"match":"drift":(d.writeCanary.run(cn(g)),"first")}catch(m){return c("canary",m),"first"}},missing(g){let m=[...new Set(g)];if(!d)return m;try{let w=[],P=[],x=r()-ho;for(let A of m){let N=d.readUsed.get(A);N?N.last_used_at<x&&P.push(A):w.push(A)}if(P.length>0){let A=d,N=r();A.db.transaction(()=>{for(let O of P)A.touch.run(N,O)})()}return w}catch(w){return c("missing",w),m}},put(g){for(let m of g)if(m.vector.length!==s)throw new RangeError(`vector for ${m.cardHash} has ${m.vector.length} dimensions, store holds ${s}`);if(!(!d||g.length===0))try{let m=d,w=r();m.db.transaction(()=>{for(let P of g)m.upsert.run(P.cardHash,w,w,cn(P.vector))})(),i=null}catch(m){c("put",m)}},topK(g,m,w){if(g.length!==s)throw new RangeError(`query vector has ${g.length} dimensions, store holds ${s}`);if(!d||m<=0)return[];let P;try{P=b(d)}catch(B){return c("topK",B),[]}let{hashes:x,index:A,data:N}=P,O=[],ae=B=>{let I=x[B],K=0,fe=B*s;for(let G=0;G<s;G+=1)K+=N[fe+G]*g[G];if(O.length===m&&!dn(K,I,O[m-1]))return;let V=O.length;for(;V>0&&dn(K,I,O[V-1]);)V-=1;O.splice(V,0,{cardHash:I,score:K}),O.length>m&&O.pop()};if(w)for(let B of w){let I=A.get(B);I!==void 0&&ae(I)}else for(let B=0;B<x.length;B+=1)ae(B);return O},coverage(g){let m=new Set(g);if(m.size===0)return 1;if(!d)return 0;try{return S(d,m)/m.size}catch(w){return c("coverage",w),0}},prune(g={}){if(!d)return 0;try{let m=d,w=g.unusedForMs??go,P=m.db.transaction(()=>{let x=m.deleteUnusedBefore.run(r()-w).changes;if(g.maxRows!==void 0){let A=m.countRows.get().count;A>g.maxRows&&(x+=m.deleteOldest.run(A-g.maxRows).changes)}return x})();return P>0&&(i=null),P}catch(m){return c("prune",m),0}},async withRefreshLock(g){if(!d)return{acquired:!1};let m=await ze(`${o}.refresh.lock`);if(!m)return{acquired:!1};try{return{acquired:!0,value:await g()}}finally{m.release()}},close(){i=null;try{d?.db.close()}catch(g){ce("close failed",g)}d=null}}}function dn(e,t,n){return e>n.score||e===n.score&&t<n.cardHash}function yo(e,t){let n;try{return co(lo(e),{recursive:!0}),n=new fo(Ke(e)),n.pragma("busy_timeout = 5000"),n.pragma("journal_mode = WAL"),n.pragma("synchronous = NORMAL"),n.exec(`
3
+ ${a}`.slice(0,t)}function an(e,t,n={}){let{topBandMargin:r=Qr,maxCardChars:a=nn}=n,o=Y(e),{indexesByHash:s}=sn(o,a),d=re(n.scope),i=new Map;for(let b of t)for(let p of s.get(b.cardHash)??[])Q(d,o.candidates[p])&&i.set(p,Math.max(i.get(p)??Number.NEGATIVE_INFINITY,b.score));if(i.size===0)return[];let c=Math.max(...i.values()),l=[];for(let[b,p]of i){let S=o.candidates[b],g=c-p,m=io(S),w=S.endLine-S.startLine+1<=eo&&S.referencedFrom.length>=to,P=g<=Zr+Qt,x=null;if(g<=r+Qt?x=m.length===0?"reuse":"rework":w&&m.length===0&&(P||p>=no)?x="compose":P&&m.length>0&&(x="rework"),!x)continue;let A=[`cosine ${p.toFixed(3)} (best ${c.toFixed(3)})`];S.consumable&&A.push(Ne(S)),x==="compose"&&A.push(`small utility: ${S.endLine-S.startLine+1} lines, referenced from ${S.referencedFrom.length} files`),A.push(...m),l.push(Oe(S,{bucket:x,tier:"signal",score:Le(p),scoreBasis:"cosine",why:A}))}return l.sort((b,p)=>oe.indexOf(b.bucket)-oe.indexOf(p.bucket)||p.score-b.score||b.file.localeCompare(p.file)||b.line-p.line||b.name.localeCompare(p.name)),Fe(l,n.limit??tn,n.bucket)}function io(e){let t=[];return e.consumable||t.push(Me),e.deprecated&&t.push(Be),t}import{mkdirSync as co}from"fs";import{dirname as lo,join as uo}from"path";import fo from"better-sqlite3";var mo="embeddings",po=1,go=720*60*60*1e3,bo=.995,ho=3600*1e3;function Eo(e){return be(JSON.stringify({model:e.model,dims:e.dims,documentPrefix:e.documentPrefix,cardFormatVersion:e.cardFormatVersion})).slice(0,16)}function ln(e,t){return be(`${e}\0${t}`).slice(0,16)}function ce(e,t){process.env.CODEBASEIQ_DEBUG&&console.error(`embedding-store: ${e}: ${t instanceof Error?t.message:String(t)}`)}function Ie(e,t,n={}){let r=n.now??ie,a=n.storeKey??Eo(t),o=uo(e,mo,`${a}.db`),s=t.dims,d=yo(o,t),i=null;function c(g,m){ce(`disabled (${g})`,m),i=null;try{d?.db.close()}catch(w){ce("close failed while disabling",w)}d=null}function l(g){return g.readDataVersion.get()}function b(g){return i&&i.dataVersion===l(g)||(i=p(g)),i}function p(g){return g.db.transaction(()=>{let m=l(g),w=g.countRows.get().count,P=new Float32Array(w*s),x=[],A=new Map;for(let N of g.readAll.iterate())new Uint8Array(P.buffer,x.length*s*4,s*4).set(N.vector),A.set(N.card_hash,x.length),x.push(N.card_hash);return{dataVersion:m,hashes:x,index:A,data:P}})()}function S(g,m){let w=0;for(let P of m)g.readUsed.get(P)!==void 0&&(w+=1);return w}return{get available(){return d!==null},key:a,path:o,verifyCanary(g){if(!d)return"first";try{let m=d.readCanary.get();return m?Co(vo(m.value),g)>=bo?"match":"drift":(d.writeCanary.run(cn(g)),"first")}catch(m){return c("canary",m),"first"}},missing(g){let m=[...new Set(g)];if(!d)return m;try{let w=[],P=[],x=r()-ho;for(let A of m){let N=d.readUsed.get(A);N?N.last_used_at<x&&P.push(A):w.push(A)}if(P.length>0){let A=d,N=r();A.db.transaction(()=>{for(let O of P)A.touch.run(N,O)})()}return w}catch(w){return c("missing",w),m}},put(g){for(let m of g)if(m.vector.length!==s)throw new RangeError(`vector for ${m.cardHash} has ${m.vector.length} dimensions, store holds ${s}`);if(!(!d||g.length===0))try{let m=d,w=r();m.db.transaction(()=>{for(let P of g)m.upsert.run(P.cardHash,w,w,cn(P.vector))})(),i=null}catch(m){c("put",m)}},topK(g,m,w){if(g.length!==s)throw new RangeError(`query vector has ${g.length} dimensions, store holds ${s}`);if(!d||m<=0)return[];let P;try{P=b(d)}catch(B){return c("topK",B),[]}let{hashes:x,index:A,data:N}=P,O=[],ae=B=>{let I=x[B],K=0,fe=B*s;for(let G=0;G<s;G+=1)K+=N[fe+G]*g[G];if(O.length===m&&!dn(K,I,O[m-1]))return;let V=O.length;for(;V>0&&dn(K,I,O[V-1]);)V-=1;O.splice(V,0,{cardHash:I,score:K}),O.length>m&&O.pop()};if(w)for(let B of w){let I=A.get(B);I!==void 0&&ae(I)}else for(let B=0;B<x.length;B+=1)ae(B);return O},coverage(g){let m=new Set(g);if(m.size===0)return 1;if(!d)return 0;try{return S(d,m)/m.size}catch(w){return c("coverage",w),0}},prune(g={}){if(!d)return 0;try{let m=d,w=g.unusedForMs??go,P=m.db.transaction(()=>{let x=m.deleteUnusedBefore.run(r()-w).changes;if(g.maxRows!==void 0){let A=m.countRows.get().count;A>g.maxRows&&(x+=m.deleteOldest.run(A-g.maxRows).changes)}return x})();return P>0&&(i=null),P}catch(m){return c("prune",m),0}},async withRefreshLock(g){if(!d)return{acquired:!1};let m=await je(`${o}.refresh.lock`);if(!m)return{acquired:!1};try{return{acquired:!0,value:await g()}}finally{m.release()}},close(){i=null;try{d?.db.close()}catch(g){ce("close failed",g)}d=null}}}function dn(e,t,n){return e>n.score||e===n.score&&t<n.cardHash}function yo(e,t){let n;try{return co(lo(e),{recursive:!0}),n=new fo(We(e)),n.pragma("busy_timeout = 5000"),n.pragma("journal_mode = WAL"),n.pragma("synchronous = NORMAL"),n.exec(`
4
4
  CREATE TABLE IF NOT EXISTS meta (key TEXT PRIMARY KEY, value) WITHOUT ROWID;
5
5
  CREATE TABLE IF NOT EXISTS vectors (
6
6
  card_hash TEXT PRIMARY KEY,
@@ -11,4 +11,4 @@ ${a}`.slice(0,t)}function an(e,t,n={}){let{topBandMargin:r=Qr,maxCardChars:a=nn}
11
11
  `),So(n,t),{db:n,readDataVersion:n.prepare("PRAGMA data_version").pluck(),readCanary:n.prepare("SELECT value FROM meta WHERE key = 'canary'"),writeCanary:n.prepare("INSERT OR REPLACE INTO meta (key, value) VALUES ('canary', ?)"),readUsed:n.prepare("SELECT last_used_at FROM vectors WHERE card_hash = ?"),touch:n.prepare("UPDATE vectors SET last_used_at = ? WHERE card_hash = ?"),upsert:n.prepare("INSERT OR REPLACE INTO vectors (card_hash, embedded_at, last_used_at, vector) VALUES (?, ?, ?, ?)"),countRows:n.prepare("SELECT COUNT(*) AS count FROM vectors"),readAll:n.prepare("SELECT card_hash, vector FROM vectors"),deleteUnusedBefore:n.prepare("DELETE FROM vectors WHERE last_used_at < ?"),deleteOldest:n.prepare(`DELETE FROM vectors WHERE card_hash IN (
12
12
  SELECT card_hash FROM vectors ORDER BY last_used_at ASC, embedded_at ASC, card_hash ASC LIMIT ?
13
13
  )`)}}catch(r){ce("disabled (open failed)",r);try{n?.close()}catch{}return null}}function So(e,t){let n={schema_version:String(po),model:t.model,dims:String(t.dims),document_prefix:t.documentPrefix,card_format_version:String(t.cardFormatVersion)};e.transaction(()=>{let r=new Map(e.prepare("SELECT key, value FROM meta").all().map(s=>[s.key,s.value]));if(Object.entries(n).every(([s,d])=>r.get(s)===d))return;e.exec("DELETE FROM vectors; DELETE FROM meta;");let o=e.prepare("INSERT INTO meta (key, value) VALUES (?, ?)");for(let[s,d]of Object.entries(n))o.run(s,d)}).immediate()}function cn(e){return Buffer.from(e.buffer,e.byteOffset,e.byteLength)}function vo(e){return new Float32Array(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength))}function Co(e,t){if(e.length!==t.length)return 0;let n=0,r=0,a=0;for(let o=0;o<e.length;o+=1)n+=e[o]*t[o],r+=e[o]*e[o],a+=t[o]*t[o];return r===0||a===0?0:n/Math.sqrt(r*a)}var ko="builder";function $s(e){return $e(e,ko)}var wo=.8,un="inside an agent session: pass probes (--term/--name/--calls) instead of a description",Ro=3e4,xo=6e4,Po=2,Ao=50,To=12,De=2e3,_o=5,se="builder query aborted",Mo=2147483647;function Bo(e){return e>=De?`vector search returns at most ${De} hits; lower-ranked units are not listed`:void 0}function Ds(e){let{settings:t,storeRoot:n,languages:r}=e,a=e.env??process.env,o=e.now??ie,s=new Map,d;function i(u){let f=e.openDb();try{return u(f)}finally{e.closeDb?.(f)}}function c(){return Object.entries(a).some(([u,f])=>f!==void 0&&(u==="CLAUDECODE"||u.startsWith("CODEX_")))}function l(u){let f=s.get(u.name);return f||(f={client:Nt(u,{fetchImpl:e.fetchImpl,env:a})},s.set(u.name,f)),f}function b(u,f,h){u.health=void 0,u.failure={state:f,detail:h,openUntil:o()+xo}}async function p(u,f,h=!1){let E=l(u),v=o();if(!h&&E.failure&&v<E.failure.openUntil){let k=Math.ceil((E.failure.openUntil-v)/1e3);return{ok:!1,state:E.failure.state,detail:`${E.failure.detail} (not retried for another ${k}s)`}}let C=!h&&E.health!==void 0&&v-E.health.checkedAt<Ro,y;if(C)y=E.health.value;else{let k=await E.client.checkHealth({signal:f});if(!k.ok){J(f,se);let T=No(k.reason);return b(E,T,k.detail),{ok:!1,state:T,detail:k.detail}}y=k,E.health={value:k,checkedAt:o()},E.failure=void 0}let R=S(E,u,y,!C);return R.ok?{ok:!0,endpoint:u,store:R.held.store,client:E.client,...R.held.forked?{note:`model weights differ from the shared ${u.model} store; using a store forked for ${u.name}`}:{}}:R}function S(u,f,h,E){let v=u.held;if(v&&v.dims===h.dimensions&&(!E||v.store.verifyCanary(h.canary)!=="drift"))return{ok:!0,held:v};v?.store.close(),u.held=void 0;let C={model:f.model,dims:h.dimensions,documentPrefix:f.documentPrefix,cardFormatVersion:1},y=Ie(n,C);if(!y.available)return y.close(),{ok:!1,state:"degraded",detail:`the vector store ${y.path} could not be opened`};if(y.verifyCanary(h.canary)!=="drift")return u.held={store:y,dims:h.dimensions,forked:!1},{ok:!0,held:u.held};let R=y.key;y.close();let k=Ie(n,C,{storeKey:ln(R,f.name)});return!k.available||k.verifyCanary(h.canary)==="drift"?(k.close(),{ok:!1,state:"degraded",detail:`model weights for ${f.model} keep changing between runs`}):(u.held={store:k,dims:h.dimensions,forked:!0},{ok:!0,held:u.held})}function g(u){return i(f=>{let h=on(f,t.maxCardChars),E=new Map;for(let y of h)E.has(y.cardHash)||E.set(y.cardHash,y.text);let v=re(u),C=null;if(v){let{candidates:y}=Y(f);C=new Set(h.filter(R=>Q(v,y[R.candidateIndex])).map(R=>R.cardHash))}return{hashes:h.map(y=>y.cardHash),textByHash:E,scopedHashes:C}})}function m(u,f){let h=new Set(u.missing(f.hashes)),E=f.hashes.filter(v=>!h.has(v)).length;return{embeddedUnits:E,fraction:f.hashes.length===0?1:E/f.hashes.length}}async function w(u,f,h,E){let{endpoint:v,store:C,client:y}=u,R=C.missing(f.hashes);if(R.length===0)return{embedded:0,budgetExhausted:!1};let k=AbortSignal.timeout(Math.min(E,Mo)),T=h?AbortSignal.any([h,k]):k,F=Math.max(1,Math.floor(v.batchSize))*Po,_={embedded:0,budgetExhausted:!1};return(await C.withRefreshLock(async()=>{for(let q=0;q<R.length;q+=F){let z=R.slice(q,q+F);try{let U=await y.embed(z.map(L=>f.textByHash.get(L)),"document",{signal:T});C.put(z.map((L,me)=>({cardHash:L,vector:U[me]}))),_.embedded+=z.length}catch(U){if(h?.aborted)throw H(h,se);if(k.aborted){_.budgetExhausted=!0;return}b(l(v),"degraded",ue(U)),_.note=`embedding stopped: ${ue(U)}`;return}}})).acquired?_.embedded>0&&C.prune():_.note="another process is already embedding this repository",_}async function P(u,f,h,E){let v=await p(u,E);if(!v.ok)return{kind:"failed",reason:`${v.state}: ${v.detail}`};let C=g(f.scope),y=await w(v,C,E,t.indexBudgetMs),{embeddedUnits:R,fraction:k}=m(v.store,C),T;try{let[L]=await v.client.embed([h],"query",{signal:E}),me=Math.min(De,Math.max(Ao,(f.limit??_o)*To));T=v.store.topK(L,me,C.scopedHashes??new Set(C.hashes))}catch(L){if(E?.aborted)throw H(E,se);return b(l(u),"degraded",ue(L)),{kind:"failed",reason:`degraded: ${ue(L)}`}}let F=i(L=>an(L,T,{topBandMargin:t.topBandMargin,maxCardChars:t.maxCardChars,limit:f.limit,scope:f.scope,bucket:f.bucket})),_=C.hashes.length,Ue=R<_?`partial embeddings: ${R} of ${_} units (${le(k)})`:void 0,q=y.budgetExhausted?`index budget of ${t.indexBudgetMs} ms used up`:void 0,z=[v.note,Ue,q,y.note,Bo(T.length)].filter(L=>L!==void 0),U={provider:`embeddings:${u.name}`,probes:null,unresolvedProbes:[],candidates:F,coverage:{corpusUnits:_,embeddedUnits:R,...z.length>0?{note:z.join("; ")}:{}}};return k>=t.minCoverage?{kind:"answer",answer:U}:{kind:"degraded",answer:U,fraction:k,reason:`degraded: embedded ${R} of ${_} units (${le(k)}), below the ${le(t.minCoverage)} minimum`}}function x(){return d??=At($e(n,"agent-probes"),t.cacheTtlHours,o),d}async function A(u,f,h,E){if(c())return{kind:"failed",reason:un};let v=x(),C=v.get(u.argv,h);if(!C){let y=await Rt(u,{description:h,languages:r,workDir:$e(n,"agent-sandbox")},{signal:E,env:a});if(!y.ok)return{kind:"failed",reason:`${y.reason}: ${y.detail}`};C=y.probes,v.set(u.argv,h,C)}return{kind:"answer",answer:{provider:`agent:${u.name}`,...N(f,C)}}}function N(u,f){let h=i(E=>rn(E,f,{limit:u.limit,scope:u.scope,bucket:u.bucket}));return{probes:f,unresolvedProbes:h.unresolvedProbes,candidates:h.candidates,coverage:h.coverage}}function O(u){return u==="agent"?t.agents.map(f=>({kind:"agent",name:f.name})):u==="embeddings"?t.endpoints.map(f=>({kind:"embeddings",name:f.name})):t.chain}async function ae(u,f,h,E){if(u.kind==="agent"){let C=t.agents.find(y=>y.name===u.name);return C?A(C,f,h,E):{kind:"failed",reason:"not configured"}}let v=t.endpoints.find(C=>C.name===u.name);return v?P(v,f,h,E):{kind:"failed",reason:"not configured"}}function B(u,f){return{...u,fallbacksTried:f,evidence:"heuristic"}}function I(u,f){return B({provider:"none",probes:null,unresolvedProbes:[],candidates:[],coverage:{corpusUnits:0,note:f}},u)}async function K(u,f={}){let{signal:h}=f;J(h,se);let E=u.mode??t.mode;if(u.probes&&X(u.probes)&&E!=="embeddings")return B({provider:"agent:caller",...N(u,u.probes)},[]);let v=dt(u.description?.trim()??"").trim();if(v===""){let k=E==="embeddings"&&u.probes&&X(u.probes)?"embeddings mode ranks a description; probes are not embedded":"no description or probes were given";return I([{provider:"request",reason:k}],"nothing to look up")}let C=O(E);if(C.length===0)return I([{provider:E,reason:"no providers are configured for this mode"}],"no provider ran");let y=[],R=[];for(let k of C){J(h,se);let T=await ae(k,u,v,h);if(T.kind==="answer")return B(T.answer,y);let F={provider:lt(k),reason:T.reason};y.push(F),T.kind==="degraded"&&R.push({entry:F,answer:T.answer,fraction:T.fraction})}if(R.length>0){let k=R.reduce((T,F)=>F.fraction>T.fraction?F:T);return B(k.answer,y.filter(T=>T!==k.entry))}return I(y,"no provider answered")}function fe(u){let f=`agent:${u.name}`;if(c())return{provider:f,state:"skipped",detail:un};let h=Se(u);return h.ok?{provider:f,state:"ok",detail:`runs ${u.argv[0]} with a ${Math.round(u.timeoutMs/1e3)}s timeout`}:{provider:f,state:h.reason==="misconfigured"?"misconfigured":"unreachable",detail:h.detail}}async function V(u,f){let h=`embeddings:${u.name}`,E=await p(u,f,!0);if(!E.ok)return{provider:h,state:E.state,detail:E.detail};let v=g(void 0),{embeddedUnits:C,fraction:y}=m(E.store,v),R=`${u.model} reachable; embedded ${C} of ${v.hashes.length} units (${le(y)})`;return{provider:h,state:y>=t.minCoverage?"ok":"degraded",detail:E.note?`${R}; ${E.note}`:R,coverage:y}}async function G(u={}){let f=[];for(let h of t.endpoints)f.push(await V(h,u.signal));for(let h of t.agents)f.push(fe(h));return f}async function fn(u={}){let{endpoint:f,signal:h,endsAt:E,budgetMs:v=t.indexBudgetMs}=u,C=f===void 0?t.endpoints:t.endpoints.filter(R=>R.name===f);if(C.length===0)throw new Error(f===void 0?"No embeddings endpoint is configured.":`No embeddings endpoint is named ${f}.`);let y=[];for(let R of C){let k=await p(R,h);if(!k.ok){y.push(`embeddings:${R.name} ${k.state}: ${k.detail}`);continue}let T=g(void 0),F=E===void 0?v:Math.max(1,Math.floor((E-o())*wo)),_=await w(k,T,h,F);return{provider:`embeddings:${R.name}`,embedded:_.embedded,coverage:m(k.store,T).fraction,budgetExhausted:_.budgetExhausted,..._.note?{note:_.note}:{}}}throw new Error(`No embeddings endpoint could be refreshed: ${y.join("; ")}`)}function mn(){for(let u of s.values())u.held?.store.close(),u.held=void 0}return{query:K,providerStatus:G,refreshEmbeddings:fn,close:mn}}function No(e){switch(e){case"unreachable":return"unreachable";case"remote-not-allowed":case"insecure-token-transport":case"invalid-endpoint":case"unauthorized":return"misconfigured";default:return"degraded"}}function le(e){return`${Math.round(e*100)}%`}function ue(e){return e instanceof Error?e.message:String(e)}export{$s as a,Ds as b};
14
- //# sourceMappingURL=chunk-M4EVGA5S.js.map
14
+ //# sourceMappingURL=chunk-RJVAPMHF.js.map
@@ -0,0 +1,2 @@
1
+ import{existsSync as g,mkdirSync as R,symlinkSync as L,readlinkSync as $,unlinkSync as S,readdirSync as h}from"fs";import{join as a,dirname as f,resolve as d,relative as q,isAbsolute as T}from"path";import{homedir as m,platform as N}from"os";import{fileURLToPath as y}from"url";var U=N()==="win32",x=["codebaseiq","codebaseiq-explore","concrete-plan"];function A(i={}){let l=i.quiet?()=>{}:console.log,o=y(import.meta.url),u=d(f(o),"..","skills"),k=[a(m(),".claude","skills"),a(m(),".codex","skills"),a(m(),".agents","skills")],s={installed:[],skipped:[],alreadyLinked:[],pruned:[]};for(let t of k){let r=f(t);if(!g(r))continue;R(t,{recursive:!0});let e=b(t);j(t,u,e,s,l);for(let n of x){let p=a(u,n),c=a(t,n);if(!g(p)){s.skipped.push(`${e}/${n}`);continue}if(g(c)){try{let I=$(c);if(d(I)===d(p)){s.alreadyLinked.push(`${e}/${n}`),l(` ok: ${n} \u2192 ${e} (already linked)`);continue}}catch{s.skipped.push(`${e}/${n}`),l(` skip: ${n} \u2192 ${e} (exists, not a symlink)`);continue}S(c)}L(p,c,U?"junction":"dir"),s.installed.push(`${e}/${n}`),l(` done: ${n} \u2192 ${e}`)}}return s}function j(i,l,o,u,k){let s=new Set(x);for(let t of h(i)){if(s.has(t))continue;let r=a(i,t),e;try{e=d(f(r),$(r))}catch{continue}v(e,l)&&(S(r),u.pruned.push(`${o}/${t}`),k(` prune: ${t} \u2192 ${o} (removed stale codebaseiq skill link)`))}}function C(i={}){let l=y(import.meta.url),o=d(f(l),"..","skills"),u=i.homeDir??m(),k=[a(u,".claude","skills"),a(u,".codex","skills"),a(u,".agents","skills")],s={removed:[],left:[],skipped:[]};for(let t of k){if(!g(t))continue;let r=b(t);for(let e of h(t)){let n=a(t,e),p;try{let c=$(n);p=d(f(n),c)}catch{s.left.push(`${r}/${e} (not a symlink)`);continue}if(!v(p,o)){s.left.push(`${r}/${e} (symlink outside codebaseiq package)`);continue}if(s.removed.push(`${r}/${e}`),!i.dryRun)try{S(n)}catch(c){s.skipped.push(`${r}/${e} (${c instanceof Error?c.message:String(c)})`)}}}return s}function v(i,l){let o=q(d(l),d(i));return o===""||!o.startsWith("..")&&!T(o)}function b(i){return i.includes(".codex")?"Codex":i.includes(".agents")?"Agents":"Claude"}function O(){console.log("codebaseiq installed (Node.js 24 LTS recommended; minimum Node.js 22.15) -- run 'codebaseiq setup' in a repo to install skills and build the index.")}export{x as a,A as b,C as c,O as d};
2
+ //# sourceMappingURL=chunk-SB7NASHU.js.map
@@ -1,3 +1,3 @@
1
- import{B as Q,c as N,d as _,e as w,g as k,h as A,i as z,n as f,o as S,r as R}from"./chunk-AM5SUGHF.js";import{b as B}from"./chunk-RVYLJDXC.js";import{g as O}from"./chunk-PLZXWZHY.js";var T=O("symbol-resolution",{clearGroups:[]});function he(e,n){return G(e,n).match}function G(e,n){return T.get(e,n,()=>{let t=W(e,n.trim()).filter(i=>!e.isIgnored(i.relative_path));if(t.length>0)return L(e,t);let o=P(e,n);if(o&&!e.isIgnored(o.relative_path))return L(e,[o]);let r=H(e,n);if(r.length>0)return L(e,r);let s=U(e,n);return s.length>0?L(e,s):J(e,n)})}function H(e,n){let t=n.trim().replace(/\(\)$/u,""),o=t.lastIndexOf(":");if(o<=0||o===t.length-1||t.startsWith("local:"))return[];let r=t.slice(o+1);if(!/^[\p{L}_$][\p{L}\p{N}_$]*$/u.test(r))return[];let s=[`/${r}().`,`/${r}.`,`/${r}#`,`#${r}().`,`#${r}.`,`/${r}/`],i=`gs.display_name = ? OR ${s.map(()=>"instr(gs.symbol, ?) > 0").join(" OR ")}`,a=[r,...s],l=f(e,{where:i,params:a,orderBy:"d.relative_path, der.start_line",limit:200}),m=l.length>0?[]:S(e,{where:i,params:a,orderBy:"d.relative_path, start_line",limit:200}),p=R(l,m).filter(u=>!e.isIgnored(u.relative_path)).filter(u=>_(u.symbol).replace(/\(\)$/u,"")===t);return[...new Map(p.map(u=>[`${u.symbol}\0${u.relative_path}`,u])).values()]}function U(e,n){let t=M(n),o=E(t);if(!o)return[];let r=`%${o.path}%`,s=o.leaf;return X(e,r,s,t)}function X(e,n,t,o){let r=R([],[...Y(e,n,t),...Z(e,n,t)]).filter(s=>!e.isIgnored(s.relative_path)).filter(s=>C(s,o)>1);return r.sort((s,i)=>C(i,o)-C(s,o)||s.end_line-s.start_line-(i.end_line-i.start_line)||s.start_line-i.start_line||s.symbol.localeCompare(i.symbol)),r}function Y(e,n,t){return f(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function Z(e,n,t){return S(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function J(e,n){let t=M(n),o=ae(n),r=oe(e,o),s=se(r,n,t).filter(a=>!e.isIgnored(a.relative_path));if(s.length>0)return L(e,s);let i=[];for(let a of r){if(e.isIgnored(a.relative_path))continue;let l=re(a,n,t,o);l<=0||i.push({row:a,score:l})}return i.sort((a,l)=>l.score-a.score||a.row.end_line-a.row.start_line-(l.row.end_line-l.row.start_line)||a.row.relative_path.localeCompare(l.row.relative_path)||a.row.symbol.localeCompare(l.row.symbol)),L(e,i.map(a=>a.row))}function L(e,n){let t=n.map(r=>Q(e,r)),o=t[0]??null;return{match:o,candidates:o?V(t,o):[],total:t.length}}function V(e,n){let t=new Set([`${n.symbolId}:${n.relativePath}:${n.startLine}`]),o=[];for(let r of e){let s=`${r.symbolId}:${r.relativePath}:${r.startLine}`;if(!t.has(s)&&(t.add(s),o.push({symbol:r.symbol,shortName:_(r.symbol),relativePath:r.relativePath,startLine:r.startLine}),o.length>=5))break}return o}function P(e,n){let t=n.match(/^(.+):(\d+)(?:-(\d+))?$/);if(!t)return;let[,o,r,s]=t,i=B(e,o,{allowMultiple:!1})[0]?.relativePath;if(!i)return;let a=Math.max(0,parseInt(r,10)-1),l=s?Math.max(a,parseInt(s,10)-1):a;return ee(e,i,a,l)??te(e,i,a,l)}function ee(e,n,t,o){return f(e,{where:"d.relative_path = ? AND der.start_line <= ? AND der.end_line >= ?",params:[n,t,o],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function te(e,n,t,o){return S(e,{where:"d.relative_path = ? AND c.start_line <= ? AND c.end_line >= ?",params:[n,t,o],orderBy:"(MAX(c.end_line) - MIN(c.start_line)) ASC",limit:1})[0]}function be(e,n){let t=W(e,n).find(o=>!e.isIgnored(o.relative_path));return t?Q(e,t):null}function W(e,n){let t=f(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, der.start_line"}),o=t.length>0?[]:S(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, start_line"});return R(t,o)}function Se(e,n){if("symbol"in n&&"relativePath"in n)return n;let t=ne(e,n.symbolId)[0];return t?Q(e,t):null}function ne(e,n){let t=f(e,{where:"gs.id = ?",params:[n],orderBy:"der.start_line, der.end_line"}),o=S(e,{where:"gs.id = ?",params:[n],orderBy:"start_line, end_line"});return R(t,o)}function oe(e,n){let t=n.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),o=n.flatMap(a=>{let l=`%${a}%`;return[l,l,l]}),r=t.join(`
1
+ import{B as Q,c as N,d as _,e as w,g as k,h as A,i as z,n as f,o as S,r as R}from"./chunk-GVAF222T.js";import{b as B}from"./chunk-ICUL7XRT.js";import{g as O}from"./chunk-7GAK2F3H.js";var T=O("symbol-resolution",{clearGroups:[]});function he(e,n){return G(e,n).match}function G(e,n){return T.get(e,n,()=>{let t=W(e,n.trim()).filter(i=>!e.isIgnored(i.relative_path));if(t.length>0)return L(e,t);let o=P(e,n);if(o&&!e.isIgnored(o.relative_path))return L(e,[o]);let r=H(e,n);if(r.length>0)return L(e,r);let s=U(e,n);return s.length>0?L(e,s):J(e,n)})}function H(e,n){let t=n.trim().replace(/\(\)$/u,""),o=t.lastIndexOf(":");if(o<=0||o===t.length-1||t.startsWith("local:"))return[];let r=t.slice(o+1);if(!/^[\p{L}_$][\p{L}\p{N}_$]*$/u.test(r))return[];let s=[`/${r}().`,`/${r}.`,`/${r}#`,`#${r}().`,`#${r}.`,`/${r}/`],i=`gs.display_name = ? OR ${s.map(()=>"instr(gs.symbol, ?) > 0").join(" OR ")}`,a=[r,...s],l=f(e,{where:i,params:a,orderBy:"d.relative_path, der.start_line",limit:200}),m=l.length>0?[]:S(e,{where:i,params:a,orderBy:"d.relative_path, start_line",limit:200}),p=R(l,m).filter(u=>!e.isIgnored(u.relative_path)).filter(u=>_(u.symbol).replace(/\(\)$/u,"")===t);return[...new Map(p.map(u=>[`${u.symbol}\0${u.relative_path}`,u])).values()]}function U(e,n){let t=M(n),o=E(t);if(!o)return[];let r=`%${o.path}%`,s=o.leaf;return X(e,r,s,t)}function X(e,n,t,o){let r=R([],[...Y(e,n,t),...Z(e,n,t)]).filter(s=>!e.isIgnored(s.relative_path)).filter(s=>C(s,o)>1);return r.sort((s,i)=>C(i,o)-C(s,o)||s.end_line-s.start_line-(i.end_line-i.start_line)||s.start_line-i.start_line||s.symbol.localeCompare(i.symbol)),r}function Y(e,n,t){return f(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function Z(e,n,t){return S(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function J(e,n){let t=M(n),o=ae(n),r=oe(e,o),s=se(r,n,t).filter(a=>!e.isIgnored(a.relative_path));if(s.length>0)return L(e,s);let i=[];for(let a of r){if(e.isIgnored(a.relative_path))continue;let l=re(a,n,t,o);l<=0||i.push({row:a,score:l})}return i.sort((a,l)=>l.score-a.score||a.row.end_line-a.row.start_line-(l.row.end_line-l.row.start_line)||a.row.relative_path.localeCompare(l.row.relative_path)||a.row.symbol.localeCompare(l.row.symbol)),L(e,i.map(a=>a.row))}function L(e,n){let t=n.map(r=>Q(e,r)),o=t[0]??null;return{match:o,candidates:o?V(t,o):[],total:t.length}}function V(e,n){let t=new Set([`${n.symbolId}:${n.relativePath}:${n.startLine}`]),o=[];for(let r of e){let s=`${r.symbolId}:${r.relativePath}:${r.startLine}`;if(!t.has(s)&&(t.add(s),o.push({symbol:r.symbol,shortName:_(r.symbol),relativePath:r.relativePath,startLine:r.startLine}),o.length>=5))break}return o}function P(e,n){let t=n.match(/^(.+):(\d+)(?:-(\d+))?$/);if(!t)return;let[,o,r,s]=t,i=B(e,o,{allowMultiple:!1})[0]?.relativePath;if(!i)return;let a=Math.max(0,parseInt(r,10)-1),l=s?Math.max(a,parseInt(s,10)-1):a;return ee(e,i,a,l)??te(e,i,a,l)}function ee(e,n,t,o){return f(e,{where:"d.relative_path = ? AND der.start_line <= ? AND der.end_line >= ?",params:[n,t,o],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function te(e,n,t,o){return S(e,{where:"d.relative_path = ? AND c.start_line <= ? AND c.end_line >= ?",params:[n,t,o],orderBy:"(MAX(c.end_line) - MIN(c.start_line)) ASC",limit:1})[0]}function be(e,n){let t=W(e,n).find(o=>!e.isIgnored(o.relative_path));return t?Q(e,t):null}function W(e,n){let t=f(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, der.start_line"}),o=t.length>0?[]:S(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, start_line"});return R(t,o)}function Se(e,n){if("symbol"in n&&"relativePath"in n)return n;let t=ne(e,n.symbolId)[0];return t?Q(e,t):null}function ne(e,n){let t=f(e,{where:"gs.id = ?",params:[n],orderBy:"der.start_line, der.end_line"}),o=S(e,{where:"gs.id = ?",params:[n],orderBy:"start_line, end_line"});return R(t,o)}function oe(e,n){let t=n.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),o=n.flatMap(a=>{let l=`%${a}%`;return[l,l,l]}),r=t.join(`
2
2
  AND `),s=f(e,{where:r,params:o,limit:200}),i=S(e,{where:r,params:o,limit:200});return R(s,i)}function re(e,n,t,o){let r=n.trim(),s=t,i=s.replace(/\(\)$/,""),a=n.toLowerCase(),l=t.toLowerCase(),m=l.replace(/\(\)$/,""),p=e.symbol,u=_(e.symbol),y=w(e.symbol),g=e.display_name??"",$=e.symbol.toLowerCase(),d=u.toLowerCase(),h=y.toLowerCase(),x=g.toLowerCase(),b=e.relative_path.toLowerCase(),j=/[/:.]/.test(t),I=E(t),v=I?.leaf.toLowerCase(),c=0;return(p===r||p===s)&&(c+=1150),(u===r||u===s)&&(c+=1100),g===i&&(c+=1180),y===i&&(c+=1160),(`${y}()`===r||`${y}()`===s)&&(c+=955),($===a||$===l)&&(c+=1e3),(d===a||d===l)&&(c+=950),(b===a||b===l)&&(c+=925),(b.endsWith(`/${l}`)||b.endsWith(`/${a}`))&&(c+=875),x===m&&(c+=850),h===m&&(c+=825),(`${h}()`===a||`${h}()`===l)&&(c+=820),(d.endsWith(`:${l}`)||d.endsWith(`:${m}`)||d.endsWith(`:${m}()`))&&(c+=800),$.includes(l)&&(c+=120),d.includes(l)&&(c+=140),b.includes(l)&&(c+=140),x.includes(l)&&(c+=110),o.every(q=>{let D=q.toLowerCase();return $.includes(D)||d.includes(D)||b.includes(D)||x.includes(D)})&&(c+=100+o.length*15),I&&b.includes(I.path.toLowerCase())&&(c+=360,v&&(h===v||`${h}()`===v||`${h}()`==`${v}()`)&&(c+=700),k(e.symbol)&&(c+=180)),A(e.symbol)&&h===m&&(c+=60),!j&&z(e.symbol)&&(c-=160),c-=Math.min(50,Math.max(0,e.end_line-e.start_line)),c}function E(e){let n=e.trim().replace(/\\/g,"/"),t=n.lastIndexOf("/");if(t<=0||t===n.length-1)return null;let o=n.slice(t+1).replace(/\(\)$/,"");return!o||o.includes(".")?null:{path:n.slice(0,t),leaf:o}}function M(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function ae(e){let n=M(e),t=n.split(/[^A-Za-z0-9_]+/).map(o=>o.trim()).filter(o=>o.length>0);return t.length>0?[...new Set(t)]:[n]}function se(e,n,t){let o=n.trim(),r=e.filter(a=>{let l=_(a.symbol),m=w(a.symbol),p=(a.display_name??"").trim();return a.symbol===o||l===o||l===t||m===o||m===t||`${m}()`===o||p===o||p===t||`${p}()`===o||C(a,t)>1||a.relative_path===o});if(r.length===0)return[];let s=t.replace(/\(\)$/u,""),i=r.filter(a=>w(a.symbol)===s);if(i.length>0){i.sort((l,m)=>F(l,m,t));let a=i.filter(l=>A(l.symbol));return a.length>0?a:i}return r.sort((a,l)=>F(a,l,t)),r}function F(e,n,t){return C(n,t)-C(e,t)||e.end_line-e.start_line-(n.end_line-n.start_line)||e.relative_path.localeCompare(n.relative_path)||e.symbol.localeCompare(n.symbol)}function C(e,n){let t=E(n);if(!t)return 0;let o=e.relative_path.toLowerCase(),r=w(e.symbol).toLowerCase(),s=t.path.toLowerCase(),i=t.leaf.toLowerCase();return o.includes(s)?r!==i?1:k(e.symbol)?N(e.symbol)===null?5:4:N(e.symbol)===null?3:2:0}function ge(e,n,t=5){let o=K(n);if(!o)return[];let r=f(e,{where:"1 = 1",orderBy:"d.relative_path, der.start_line",limit:5e3}),s=new Map;for(let i of r){if(e.isIgnored(i.relative_path))continue;let a=_(i.symbol),l=w(i.symbol),m=i.display_name??l,p=[a,l,m].filter(g=>g.trim().length>0),u=Math.min(...p.map(g=>ie(K(g),o))),y=s.get(a);(!y||u<y.distance)&&s.set(a,{shortName:a,distance:u})}return[...s.values()].sort((i,a)=>i.distance-a.distance||i.shortName.localeCompare(a.shortName)).slice(0,t).map(i=>i.shortName)}function K(e){return M(e).toLowerCase().replace(/[^a-z0-9_]+/g,"")}function ie(e,n){if(e===n)return 0;if(e.length===0)return n.length;if(n.length===0)return e.length;let t=Array.from({length:n.length+1},(o,r)=>r);for(let o=0;o<e.length;o++){let r=[o+1];for(let s=0;s<n.length;s++){let i=e[o]===n[s]?0:1;r[s+1]=Math.min(r[s]+1,t[s+1]+1,t[s]+i)}t=r}return t[n.length]}export{he as a,G as b,be as c,Se as d,ge as e};
3
- //# sourceMappingURL=chunk-3XFJUWJE.js.map
3
+ //# sourceMappingURL=chunk-SGMNWYTH.js.map
@@ -0,0 +1,27 @@
1
+ import{a as w,b as G,c as Te,d as Fe,e as $,f as Le,k as ie,l as oe}from"./chunk-6JMAVFL4.js";import{a as W}from"./chunk-GV2CEZCW.js";import{a as De}from"./chunk-ICUL7XRT.js";import{h as Be,k as se,t as Ne,v as qe}from"./chunk-7GAK2F3H.js";import{d as Oe,e as Ce}from"./chunk-SX72EVMY.js";import{d as ae}from"./chunk-3LCDIREB.js";import{E as Ae,H as S,L as Ee,P as ke,Q as F,R as re,i as Ie,k as Re,o as we,q as l,s as Me,t as Pe,v as _,x as ve}from"./chunk-UC2FD2PS.js";function Tt(t,e){return t.reason instanceof Error?t.reason:new Error(e)}function Er(t,e){if(t?.aborted)throw Tt(t,e)}import{join as Ft}from"path";var Lt=t=>{if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t.pid;return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?{pid:e}:null};function Br(t,e={}){return z(Ft(t,"gc.lock"),e)}function z(t,e={}){let n=e.waitMs??0,r=e.pollMs??10,i=e.now??$,o=i()+n;do{let s=kt(t);if(s)return Bt(s);let a=o-i();if(a<=0)return null;Dt(Math.min(r,a))}while(i()<=o);return null}function kt(t){let e=Le(t,{kind:"generic",parseLegacy:Lt});return e.kind==="acquired"?e.lock:null}function Bt(t){return{release:()=>{t.release()}}}function Dt(t){let e=new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));Atomics.wait(e,0,0,t)}function je(t,e,n={}){ie(t,_e(e,n),{durability:"visibility",runtime:n.runtime})}function qr(t,e,n={}){return ie(t,_e(e,n),{durability:"durable",runtime:n.runtime})}function _e(t,e){let n=JSON.stringify(t,null,e.spacing);return e.trailingNewline?`${n}
2
+ `:n}import{execFileSync as ze,spawnSync as zr}from"child_process";import{platform as Wt}from"os";import{resolve as zt}from"path";import{createHash as Nt}from"crypto";import{existsSync as Ge,renameSync as qt,rmSync as Ot,writeFileSync as Ct}from"fs";import{tmpdir as jt}from"os";import{join as _t}from"path";var $e=`'use strict';
3
+ const NativeRegExp = globalThis.RegExp;
4
+ const escapeLoneSeparator = (args) =>
5
+ typeof args[0] === 'string' && args[0] === '\\\\' ? ['\\\\\\\\', ...args.slice(1)] : args;
6
+ globalThis.RegExp = new Proxy(NativeRegExp, {
7
+ construct(target, args) {
8
+ return Reflect.construct(target, escapeLoneSeparator(args));
9
+ },
10
+ apply(target, thisArg, args) {
11
+ return Reflect.apply(target, thisArg, escapeLoneSeparator(args));
12
+ },
13
+ });
14
+ `,Gt=/scip-python/i;function We(t,e=process.platform){return e!=="win32"||!Gt.test(t)?[]:["--require",$t()]}function $t(t=jt()){let e=Nt("sha256").update($e).digest("hex").slice(0,16),n=_t(t,`codebaseiq-indexer-compat-${e}.cjs`);if(Ge(n))return n;let r=`${n}.${process.pid}.tmp`;Ct(r,$e);try{qt(r,n)}catch{if(Ot(r,{force:!0}),!Ge(n))throw new Error(`could not materialize indexer compatibility preload at ${n}`)}return n}var Je=Wt()==="win32";function He(t){let e=Je?"where":"which";try{return ze(e,[t],{stdio:"pipe",timeout:1e4,killSignal:"SIGKILL"}),!0}catch{return!1}}var Jt=/\.(?:c|m)?js$/i,Ht=/\.(?:exe|com)$/i;function Vr(t,e){return Jt.test(t)?{binary:process.execPath,args:[...We(t),t,...e]}:{binary:t,args:[...e]}}function Ut(t,e){return ze(t,e,{stdio:["ignore","pipe","ignore"],windowsHide:!0,encoding:"utf8",timeout:1e4,killSignal:"SIGKILL"})}function Ue(t,e={}){let n=e.isWindows??Je,r=e.lookup??Ut,i;try{i=r(n?"where":"which",[t])}catch{return null}let o=i.split(/\r?\n/).map(s=>s.trim()).filter(Boolean);if(!n){let s=o[0];return s?zt(s):null}return o.find(s=>Ht.test(s))??null}import{execFileSync as Qe}from"child_process";import{createHash as Vt}from"crypto";import{existsSync as J,statSync as Qt}from"fs";import{createRequire as Kt}from"module";import{platform as Xt}from"os";import{dirname as Ve,join as L}from"path";var Yt=Kt(import.meta.url),oi={language:"rust",indexerBinary:"rust-analyzer",installUrl:"https://github.com/rust-lang/rust-analyzer"};function ce(t){return[t.indexerBinary,...t.binaryAliases??[]]}function Zt(t){let e=ce(t);return e.length===1?e[0]:e.join(" or ")}function de(t){for(let e of ce(t)){let n=Ue(e);if(n)return n}return tn(t)}function si(t){return de(t)!==null||en(t)}function en(t){return Ke(t)!==null}function tn(t){let e=Ke(t);if(!e)return null;let r=JSON.parse(S(e,"indexer package manifest")).bin;if(!r)return null;if(typeof r=="string")return L(Ve(e),r);for(let i of ce(t)){let o=r[i];if(o)return L(Ve(e),o)}return null}function Ke(t){if(!t.bundledNpmPackage)return null;try{return Yt.resolve(`${t.bundledNpmPackage}/package.json`)}catch{return null}}function nn(t,e){for(let n of t.projectLocalBinaries??[]){let r=L(e,n);if(J(r))return r}return null}function rn(t,e){for(let n of t.projectLocalBinaries??[]){let r=L(e,n);if(J(r))return Xe(e,n,r)}return null}function ai(t,e){let n=on(t,e);if(!n||n.canonicalPath!==e.canonicalPath||n.sha256!==e.sha256||n.size!==e.size||n.mtimeMs!==e.mtimeMs||n.device!==e.device||n.inode!==e.inode||n.executable!==e.executable)throw new Error(`refusing changed project-local indexer ${e.relativePath}; review the current file and rerun with --trust-project-tools`)}function on(t,e){try{return Xe(t,e.relativePath,e.configuredPath)}catch{return null}}function Xe(t,e,n){let r={maxBytes:268435456,inputKind:"project-local indexer"},i=Oe(t,e,r),o=Ce(t,e,r),s=Qt(i.absolutePath);return{configuredPath:n,canonicalPath:i.absolutePath,relativePath:e,sha256:Vt("sha256").update(o).digest("hex"),size:i.size,mtimeMs:i.mtimeMs,device:i.device,inode:i.inode,executable:(s.mode&73)!==0}}function sn(t,e,n={}){return(n.trustProjectTools?rn(t,e)?.canonicalPath:null)??de(t)}function ci(t,e=process.env,n=t.indexerBinary){if(t.indexerBinary!=="scip-dotnet"||le(n,e))return e;let r=Ye(n,e);return r?{...e,DOTNET_ROOT:r}:e}function di(t,e,n={}){let r=Zt(t),i=e?sn(t,e,n):de(t);if(!i)return{language:t.language,binaryLabel:r,installed:!1,runnable:!1,resolvedBinary:null,installUrl:t.installUrl,...e&&nn(t,e)?{note:"project-local indexer available only with --trust-project-tools"}:{}};if(t.indexerBinary!=="scip-dotnet")return{language:t.language,binaryLabel:r,installed:!0,runnable:!0,resolvedBinary:i};let o=an(i);return{language:t.language,binaryLabel:r,installed:!0,runnable:o.runnable,resolvedBinary:i,installUrl:t.installUrl,note:o.note}}function an(t){if(le(t,process.env))return{runnable:!0};let e=Ye(t,process.env);if(e)return{runnable:!0,note:`using .NET 9 runtime from ${e}`};let n=Ze(process.env);return{runnable:!1,note:n.length>0?`.NET 9 runtime still unavailable after checking ${n.join(", ")}`:"binary is present, but scip-dotnet still needs a .NET 9 runtime"}}function Ye(t,e){for(let n of Ze(e))if(le(t,{...e,DOTNET_ROOT:n}))return n;return null}function Ze(t){let e=[],n=t.DOTNET_ROOT;if(n&&J(n)&&e.push(n),Xt()==="darwin"&&He("brew"))try{let r=Qe("brew",["--prefix","dotnet@9"],{stdio:"pipe",windowsHide:!0,env:t,timeout:1e4,killSignal:"SIGKILL"}).toString().trim(),i=L(r,"libexec");J(i)&&!e.includes(i)&&e.push(i)}catch{}return e}function le(t,e){try{return Qe(t,["--version"],{stdio:"pipe",windowsHide:!0,env:e,timeout:1e4,killSignal:"SIGKILL"}),!0}catch{return!1}}var cn=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"];function H(t){let e=t.toLowerCase();return cn.some(n=>e.endsWith(n))}function V(t){let e=U(t.projectFiles),n=new Set(e),r=new Map(t.snapshot.files.map(d=>[d.path,d])),i=t.snapshot.files.filter(d=>{let m=Ie(d.path,["typescript"]);return m==="config"||m==="ambient"}).map(d=>d.path),o=U([...e,...i]),s=o.find(d=>!r.has(d)),a=new Set(t.snapshot.files.map(d=>d.path)).size!==t.snapshot.files.length,c=!s&&o.some(d=>et(r.get(d))),p=se(JSON.stringify({pnpmWorkspaces:t.snapshot.pnpmWorkspaces,typescriptProjectMode:t.snapshot.typescriptProjectMode,typescriptProjects:U(t.snapshot.typescriptProjects),membership:e})),u=new Map;return{identityFor(d,m){if(!n.has(d))return M("target-outside-project");if(a)return M("duplicate-input-path");if(s)return M("missing-input-fingerprint");if(c)return M("unreadable-input");let g=[],f,I;if(t.graph===null)g.push("dependency-graph-unavailable"),I="whole-project",f=o;else{let j=ln(d,t.graph,u);if(j.find(ne=>!r.has(ne)))return M("missing-input-fingerprint");if(f=U([...j,...i]),f.some(ne=>et(r.get(ne))))return M("unreadable-input");I="dependency-closure"}let C=f.map(j=>un(r.get(j)));return{version:1,key:se(JSON.stringify({version:1,engineIdentity:t.engineIdentity,schemaVersion:m,projectIdentity:p,inputs:C})),mode:I,inputFiles:f,reasons:g}}}}function dn(t,e){let n=new Set,r=[t];for(let i=0;i<r.length;i+=1){let o=r[i];if(!(o===void 0||n.has(o))){n.add(o);for(let s of[...e.get(o)??[]].sort())n.has(s)||r.push(s)}}return[...n].sort()}function ln(t,e,n){let r=n.get(t);if(r)return r;let i=dn(t,e);return n.set(t,i),i}function un(t){return{path:t.path,size:t.size,hash:t.hash}}function et(t){return t.size<0||t.hash==="unreadable"}function M(t){return{version:1,key:null,mode:"unkeyed",inputFiles:[],reasons:[t]}}function U(t){return[...new Set(t)].sort()}import{createRequire as pn}from"module";var tt=pn(import.meta.url),k,Q;function fn(){if(k!==void 0)return k;try{k=tt("ts-morph")}catch{k=null}return k}function K(){if(Q)return Q;let t=fn();if(!t)return"ts-morph:unavailable";let e="unknown";try{e=tt("ts-morph/package.json").version??"unknown"}catch{}return Q=`ts-morph:${e}:typescript:${t.ts.version}`,Q}function gi(t,e){return e.map(n=>({tsconfigPath:n,project:new t.Project({tsConfigFilePath:n,skipFileDependencyResolution:!0})}))}function bi(t,e,n){return{language:"typescript",availability:()=>({available:!1,reason:t,tsconfigPath:e,tsconfigPaths:n}),importUsage:()=>[],referencesFor:()=>[],calleesFor:()=>[],signatureFor:()=>null}}var mn=Be("typescript-semantic-identity-context",{clearGroups:["whole-project"]});function ue(t,e,n){let r=mn.get(t,()=>yn(t));if(!r)return null;let i=`${n}\0${e}`,o=r.identities.get(i);if(o)return o;let s=r.builder.identityFor(e,n);return r.identities.set(i,s),s}function B(t){return De(t,{includeIgnored:!1}).filter(H).sort()}function yn(t){try{if(!t.generation.metadataRaw)return null;let e=_(t.generation.metadataRaw);if(e.kind!=="legacy"&&e.kind!=="supported"||!e.capabilities.usableForEvidenceCache)return null;let n=Re(e.metadata.fingerprint);return n?{builder:V({projectFiles:B(t),snapshot:n,graph:W(t),engineIdentity:K()}),identities:new Map}:null}catch{return null}}function X(t,e){let n=new Map(t.map(i=>[i.symbol,i])),r=new Map(t.map(i=>[i.symbolId,[]]));for(let i of e.values())for(let o of i){let s=n.get(o.targetSymbol);s&&r.get(s.symbolId).push(o.location)}for(let[i,o]of r)r.set(i,gn(o));return r}function it(t,e,n){let r=rt(t,e),i=rt(t,n),o=[...r].filter(d=>!i.has(d)).sort(),s=[...i].filter(d=>!r.has(d)).sort(),a=nt(t,e),c=nt(t,n),p=[...a].filter(d=>!c.has(d)).sort(),u=[...c].filter(d=>!a.has(d)).sort();return{passed:o.length===0&&s.length===0,expectedCount:r.size,actualCount:i.size,missing:o,extra:s,callerFiles:{passed:p.length===0&&u.length===0,expectedCount:a.size,actualCount:c.size,missing:p,extra:u}}}function nt(t,e){let n=new Set;for(let r of t)for(let i of e.get(r.symbolId)??[])i.file!==r.relativePath&&n.add(`${r.symbol}\0${i.file}`);return n}function Ei(t,e,n){let r=new Set(n),i=new Map(n.map(o=>[o,[]]));for(let o of t)for(let s of e.get(o.symbolId)??[])r.has(s.file)&&i.get(s.file).push({targetSymbol:o.symbol,location:s});for(let[o,s]of i)i.set(o,bn(s));return i}function rt(t,e){let n=new Set;for(let r of t)for(let i of e.get(r.symbolId)??[])n.add(`${r.symbol}\0${i.file}\0${i.line}\0${i.column}`);return n}function gn(t){let e=new Map;for(let n of t)e.set(`${n.file}\0${n.line}\0${n.column}`,n);return[...e.values()].sort(ot)}function bn(t){let e=new Map;for(let n of t){let{location:r}=n;e.set(`${n.targetSymbol}\0${r.file}\0${r.line}\0${r.column}`,n)}return[...e.values()].sort((n,r)=>n.targetSymbol.localeCompare(r.targetSymbol)||ot(n.location,r.location))}function ot(t,e){return t.file.localeCompare(e.file)||t.line-e.line||t.column-e.column}var pe="typescript-reference-fragment-v3-incomplete-scan",Y=Ne({kind:"typescript-reference-fragments",invalidation:qe("typescript-reference-fragments"),serialize:t=>JSON.stringify(t),deserialize:Sn});function Ci(t,e,n,r=t){let i=B(t),o=V({projectFiles:i,snapshot:e,graph:W(t),engineIdentity:K()}),s=[...n].map(([a,c])=>({relativePath:a,contentHash:o.identityFor(a,pe).key,value:[...c]}));if(s.some(a=>a.contentHash===null))throw new Error("TypeScript reference fragment identity is unavailable for an affected document.");return Y.writeBatch(r,s.map(a=>({...a,contentHash:a.contentHash}))),s.length}function ji(t,e,n,r){let i=e.filter(s=>H(s.relativePath));if(i.length===0)return D("no TypeScript definitions");let o=D("shadow did not run");return ae("typescript.reference-fragments.shadow",()=>{try{let s=r(i[0].relativePath);if(!s.availability().available||!s.referenceFragmentsForFiles)return o=D("TypeScript reference fragment provider is unavailable"),o;let a=B(t),c=new Set(a),p=s.referenceFragmentsForFiles(a),u=a.filter(f=>!p.has(f));if(u.length>0)return o=D(`TypeScript reference lookup was incomplete for ${u.length} file(s)`),o;let d=X(i,p),m=it(i,hn(n,c),d);if(!m.passed)return o={state:"failing",files:a.length,keyedFiles:0,writtenFiles:0,...m},o;let g=[];for(let f of a){let I=ue(t,f,pe);I?.key&&g.push({relativePath:f,contentHash:I.key,value:p.get(f)??[]})}return Y.writeBatch(t,g),o={state:"passing",files:a.length,keyedFiles:g.length,writtenFiles:g.length,...m},o}catch(s){return o=D(s instanceof Error?s.message:String(s)),o}},()=>({...o}))}function hn(t,e){return new Map([...t].map(([n,r])=>[n,r.filter(i=>e.has(i.file))]))}function _i(t,e,n){if(e.length===0)return{references:new Map,files:0,cacheHits:0,cacheMisses:0,computedFiles:0};let r="fallback",i=0,o=0,s=0,a=0;return ae("typescript.reference-fragments.materialize",()=>{try{let c=B(t);i=c.length;let p=new Map,u=new Map,d=[];for(let f of c){let I=ue(t,f,pe);if(!I?.key)return null;p.set(f,I.key);let C=Y.read(t,f,I.key);C===null?(s+=1,d.push(f)):(o+=1,u.set(f,C))}if(s===0)return r="hit",{references:X(e,u),files:i,cacheHits:o,cacheMisses:s,computedFiles:a};let m=n(e[0].relativePath);if(!m.availability().available||!m.referenceFragmentsForFiles)return null;let g=m.referenceFragmentsForFiles(d);if(d.some(f=>!g.has(f)))return null;a=g.size,Y.writeBatch(t,d.map(f=>({relativePath:f,contentHash:p.get(f),value:g.get(f)??[]})));for(let[f,I]of g)u.set(f,I);return r="computed",{references:X(e,u),files:i,cacheHits:o,cacheMisses:s,computedFiles:a}}catch{return null}},()=>({state:r,files:i,cacheHits:o,cacheMisses:s,computedFiles:a}))}function D(t){return{state:"unavailable",files:0,keyedFiles:0,writtenFiles:0,expectedCount:0,actualCount:0,missing:[],extra:[],reason:t}}function Sn(t){try{let e=JSON.parse(t);return!Array.isArray(e)||!e.every(xn)?null:e}catch{return null}}function xn(t){if(!t||typeof t!="object")return!1;let e=t,n=e.location;return typeof e.targetSymbol=="string"&&!!n&&typeof n.file=="string"&&typeof n.line=="number"&&typeof n.column=="number"}import{createHash as In,randomUUID as Rn}from"crypto";import{existsSync as P,mkdirSync as wn,readdirSync as Mn,rmSync as at,statSync as ct}from"fs";import{basename as Pn,dirname as Z,join as x}from"path";var vn=1,An=1,En=".codebaseiq-generations",Tn="manifest.json",dt="readers",Fn="gc.lock",Ln=128,N=new Map,lt={pid:process.pid,now:()=>new Date,randomToken:()=>Rn(),isProcessAlive:Fe,readProcessIdentity:Te,resolveImmutableGeneration:ft};function v(t){return x(Z(t),En)}function ut(t){return x(v(t),Fn)}function Yi(t,e=lt){let n=z(ut(t.dbPath),{waitMs:5e3});if(!n)throw new Error("SQLite generation retention is busy; retry opening the index.");let r;try{let o=ge(t.dbPath);if(!o||!pt(t.dbPath,o.currentGeneration))return{generation:qn(t),release(){}};let s=e.randomToken();if(!/^[A-Za-z0-9._-]+$/.test(s))throw new Error("SQLite generation reader token is unsafe.");let a=x(v(t.dbPath),dt);wn(a,{recursive:!0});let c=x(a,`${e.pid}-${s}.json`),p=e.readProcessIdentity(e.pid);je(c,{version:1,token:s,generationIdentity:o.currentGeneration,pid:e.pid,...p?{processIdentity:p}:{},acquiredAt:e.now().toISOString()},{spacing:2,trailingNewline:!0});let u=!1;r={identity:o.currentGeneration,required:o.artifactSet==="immutable-v1",release(){u||(u=!0,at(c,{force:!0}))}}}finally{n.release()}let i;try{i=e.resolveImmutableGeneration(t,r.identity)}catch(o){throw r.release(),o}if(i?.source==="immutable"&&i.identity===r.identity)return{generation:i,release:r.release};if(r.release(),r.required)throw new Error(`Published SQLite generation ${r.identity} is missing or invalid.`);return kn(t,r.identity)}function kn(t,e){let n=z(ut(t.dbPath),{waitMs:5e3});if(!n)throw new Error("SQLite generation retention is busy; retry opening the index.");try{let r=ge(t.dbPath);if(r?.currentGeneration!==e)throw new Error("SQLite index publication changed while opening a legacy generation.");if(P(x(Z(t.dbPath),"index.lock")))throw new Error("Legacy SQLite publication is in progress; retry after the reindex lock is released.");return{generation:mt(t,r.currentGeneration),release(){}}}finally{n.release()}}function Zi(t,e,n=lt,r={}){let i=x(v(t),dt);if(!P(i))return{protectedGenerations:new Set,activeLeases:0,staleLeasesRemoved:0,malformedLeases:0};let o=new Set,s=0,a=0,c=0;for(let p of Mn(i,{withFileTypes:!0})){if(!p.isFile()||!p.name.endsWith(".json"))continue;let u=x(i,p.name),d;try{d=Bn(JSON.parse(S(u,"SQLite generation reader lease")))}catch{d=null}if(!d){c+=1;for(let m of e)o.add(m);continue}if(!Dn(d,n)){r.removeStale!==!1&&(at(u,{force:!0}),a+=1);continue}s+=1,o.add(d.generationIdentity)}return{protectedGenerations:o,activeLeases:s,staleLeasesRemoved:a,malformedLeases:c}}function Bn(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t,n=e.processIdentity===void 0?null:w(e.processIdentity);return e.version!==1||typeof e.token!="string"||e.token.trim()===""||typeof e.generationIdentity!="string"||!/^[a-f0-9]{64}$/.test(e.generationIdentity)||typeof e.pid!="number"||!Number.isSafeInteger(e.pid)||e.pid<=0||typeof e.acquiredAt!="string"||!Number.isFinite(Date.parse(e.acquiredAt))||e.processIdentity!==void 0&&(!n||n.pid!==e.pid)?null:{version:1,token:e.token,generationIdentity:e.generationIdentity,pid:e.pid,...n?{processIdentity:n}:{},acquiredAt:e.acquiredAt}}function Dn(t,e){if(!e.isProcessAlive(t.pid))return!1;if(!t.processIdentity)return!0;let n=e.readProcessIdentity(t.pid);return n===null||G(t.processIdentity,n)}function ge(t){try{let e=JSON.parse(S(x(v(t),"state.json"),"SQLite generation state"));return _n(e)?e:null}catch{return null}}function pt(t,e){return Nn(v(t),e)}function Nn(t,e){try{let n=JSON.parse(S(x(t,e,Tn),"SQLite generation manifest"));return jn(n,e)?n:null}catch{return null}}function qn(t){let e=ge(t.dbPath);if(e){let n=ft(t,e.currentGeneration);if(n)return n;if(e.artifactSet==="immutable-v1")throw new Error(`Published SQLite generation ${e.currentGeneration} is missing or invalid.`)}if(P(x(Z(t.dbPath),"index.lock")))throw new Error("Legacy SQLite publication is in progress; retry after the reindex lock is released.");return mt(t,e?.currentGeneration)}function On(t){return ve(_(t))??t}function ft(t,e){try{let n=x(v(t.dbPath),e),r=pt(t.dbPath,e);if(!r)return null;let i=fe(n,r.database),o=r.index?fe(n,r.index):void 0,s=r.metadata?fe(n,r.metadata):void 0;return!me(i,r.database)||r.index&&(!o||!me(o,r.index))||r.metadata&&(!s||!me(s,r.metadata))?null:{identity:e,databasePath:i,...o?{indexPath:o}:{},...s?{metadataPath:s,metadataRaw:S(s,"reindex metadata")}:{},source:"immutable"}}catch{return null}}function mt(t,e){let n=yt(t.dbPath),r=x(Z(t.dbPath),"meta.json"),i=P(r)?S(r,"reindex metadata"):void 0,o=P(t.indexPath)?t.indexPath:void 0;return{identity:e??Cn(t.dbPath,i),databasePath:t.dbPath,...o?{indexPath:o}:{},...i===void 0?{}:{metadataPath:r,metadataRaw:i},source:"legacy",databaseFileIdentity:n}}function Cn(t,e){let n=In("sha256").update("sqlite-generation-legacy-v1\0");return e!==void 0&&n.update(On(e)),n.update(`\0${yt(t)}`),n.digest("hex")}function yt(t){let e=ct(t);return`${e.dev}:${e.ino}:${e.size}:${e.mtimeMs}`}function fe(t,e){if(Pn(e.file)!==e.file||e.file==="."||e.file==="..")throw new Error("SQLite generation manifest contains an unsafe artifact path");return x(t,e.file)}function me(t,e){if(!P(t))return!1;let n=st(t);if(!n||n.size!==e.size)return!1;let r=`${t}\0${e.sha256}\0${n.identity}`;if(N.has(r))return!0;let i=Ee(t,{inputKind:"immutable SQLite generation artifact",maxBytes:e.size}),o=st(t);if(!o||o.identity!==n.identity||i!==e.sha256)return!1;for(N.set(r,!0);N.size>Ln;){let s=N.keys().next().value;if(s===void 0)break;N.delete(s)}return!0}function st(t){let e=ct(t,{bigint:!0});return e.isFile()?{identity:`${e.dev}:${e.ino}:${e.size}:${e.mtimeNs}:${e.ctimeNs}`,size:Number(e.size)}:null}function jn(t,e){return t.version===An&&t.identity===e&&ye(t.database)&&(t.index===void 0||ye(t.index))&&(t.metadata===void 0||ye(t.metadata))}function ye(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.file=="string"&&!!e.file&&Number.isSafeInteger(e.size)&&(e.size??-1)>=0&&typeof e.sha256=="string"&&/^[a-f0-9]{64}$/.test(e.sha256)}function _n(t){return t.version===vn&&typeof t.currentGeneration=="string"&&!!t.currentGeneration&&typeof t.publishedAt=="string"&&Number.isFinite(Date.parse(t.publishedAt))&&(t.artifactSet===void 0||t.artifactSet==="immutable-v1")&&Gn(t.stableMirrors)&&$n(t.previousGeneration)&&Wn(t.publication)}function Gn(t){if(t===void 0)return!0;if(!t||typeof t!="object")return!1;let e=t;return typeof e.databaseFileIdentity=="string"&&!!e.databaseFileIdentity&&(e.indexFileIdentity===void 0||typeof e.indexFileIdentity=="string"&&!!e.indexFileIdentity)}function $n(t){if(t===void 0)return!0;if(!t||typeof t!="object")return!1;let e=t;return typeof e.generationIdentity=="string"&&!!e.generationIdentity&&typeof e.databasePath=="string"&&!!e.databasePath&&(e.metadataPath===void 0||typeof e.metadataPath=="string"&&!!e.metadataPath)}function Wn(t){if(t===void 0)return!0;if(!t||typeof t!="object")return!1;let e=t,n=[e.converterDurationMs,e.affectedDocumentCount,e.changedDocumentCount,e.producerDurationMs,e.materializationDurationMs,e.patchDurationMs].filter(r=>r!==void 0);return(e.mode==="incremental"||e.mode==="full")&&e.validation==="passed"&&e.converterDurationMs!==void 0&&n.every(r=>typeof r=="number"&&Number.isFinite(r)&&r>=0)&&(e.scipCompanion===void 0||e.scipCompanion==="current"||e.scipCompanion==="deferred")&&(e.typescriptOverlayGeneration===void 0||typeof e.typescriptOverlayGeneration=="string"&&!!e.typescriptOverlayGeneration)&&(e.scipCompanion!=="deferred"||!!e.typescriptOverlayGeneration)&&(e.fallbackReason===void 0||typeof e.fallbackReason=="string")}function to(t){return t.startsWith("local ")}import{zstdCompressSync as Jn,zstdDecompressSync as Hn}from"zlib";function oo(t){return Jn(Buffer.from(JSON.stringify(t.map(e=>[e.symbol,e.roles,e.range,e.enclosingRange]))))}function bt(t){let e;try{e=JSON.parse(Hn(t).toString("utf8"))}catch{return null}return Array.isArray(e)?e.map(([n,r,i,o])=>({symbol:n,roles:r,range:i,enclosingRange:o})):null}function Un(t){return t.length===1&&t[0]===0}function so(t,e){let n=t.all(`SELECT c.occurrences
15
+ FROM chunks c
16
+ JOIN documents d ON d.id = c.document_id
17
+ WHERE d.relative_path = ?
18
+ ORDER BY c.chunk_index, c.id`,e),r=[];for(let i of n){if(Un(i.occurrences))continue;let o=bt(i.occurrences);if(!o)return null;r.push(...o)}return r}function ao(t,e){let n=new Map(e.map(i=>[i,[]])),r=new Map;for(let i of gt([...n.keys()])){let o=t.all(`SELECT DISTINCT m.chunk_id, gs.symbol
19
+ FROM mentions m
20
+ JOIN global_symbols gs ON gs.id = m.symbol_id
21
+ WHERE gs.symbol IN (${i.map(()=>"?").join(",")})`,...i);for(let s of o){let a=r.get(s.chunk_id)??[];a.push(s.symbol),r.set(s.chunk_id,a)}}for(let i of gt([...r.keys()])){let o=t.all(`SELECT c.id, d.relative_path, c.occurrences
22
+ FROM chunks c
23
+ JOIN documents d ON d.id = c.document_id
24
+ WHERE c.id IN (${i.map(()=>"?").join(",")})`,...i);for(let s of o){let a=bt(s.occurrences);if(!a){for(let c of r.get(s.id)??[])n.set(c,null);continue}for(let c of a)(c.roles&1)===0&&n.get(c.symbol)?.push({relativePath:s.relative_path,occurrence:c})}}return n}function gt(t){let e=[];for(let n=0;n<t.length;n+=750)e.push(t.slice(n,n+750));return e}import{createHash as Vn,randomUUID as Rt}from"crypto";import{existsSync as T,lstatSync as O,readdirSync as E,renameSync as wt,rmSync as R}from"fs";import{basename as be,dirname as Qn,join as y}from"path";function ee(t){return Array.isArray(t)?`[${t.map(ee).join(",")}]`:t&&typeof t=="object"?`{${Object.entries(t).sort(([e],[n])=>e.localeCompare(n)).map(([e,n])=>`${JSON.stringify(e)}:${ee(n)}`).join(",")}}`:JSON.stringify(t)}var Kn=1,Xn=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}),A=class extends Error{constructor(n,r,i,o){let s=n==="item-too-large"?`request is ${o} bytes; per-item limit is ${i.maxItemBytes}`:n==="item-capacity"?`mailbox has ${r.totalItems} retained items; limit is ${i.maxItems}`:n==="byte-capacity"?`mailbox retains ${r.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=n;this.status=r;this.limits=i;this.attemptedBytes=o;this.name="MailboxBackpressureError"}code;status;limits;attemptedBytes},Yn=".owner.json",Zn={isProcessAlive:()=>!0,readProcessIdentity:()=>null};function xo(t){return{rootDir:t,pendingDir:y(t,"pending"),inflightDir:y(t,"inflight"),responseDir:y(t,"responses"),deadLetterDir:y(t,"dead-letter"),legacyRequestDir:y(t,"requests")}}function er(t={}){let e={...Xn,...t};for(let[n,r]of Object.entries(e))if(!Number.isFinite(r)||r<=0||!Number.isInteger(r))throw new Error(`Mailbox limit ${n} must be a positive integer.`);return e}function Mt(t){let e=[t.pendingDir,t.inflightDir,t.responseDir,t.deadLetterDir,t.legacyRequestDir].map(n=>ke(n));return re(...e)}function Io(t,e){return Vn("sha256").update(ee({namespace:t,payload:e})).digest("hex")}function tr(t){if(!/^[a-f0-9]{64}$/.test(t))throw new Error("Mailbox operation keys must be lowercase SHA-256 identities.");return`op-${t}`}function Ro(t,e,n={}){let r=er(n.limits),i=n.nowMs??Date.now(),o=Mt(t);return dr(e),rr(t,r,n.admissionLockTimeoutMs??2e3,n.monotonicNow??$,()=>{nr(t,i,r);let s=y(t.pendingDir,`${e.id}.json`),a=y(t.responseDir,`${e.id}.json`),c=ht(t,e.id);if(c){let m=St(c,e.operationKey,e.id);return{disposition:"duplicate",requestId:e.id,responsePath:a,authoritativeDeadlineAtMs:m.deadlineAtMs??e.deadlineAtMs}}let p=`${JSON.stringify(e)}
25
+ `,u=Buffer.byteLength(p),d=Pt(t);if(u>r.maxItemBytes)throw new A("item-too-large",d,r,u);if(d.totalItems+1>r.maxItems)throw new A("item-capacity",d,r,u);if(d.totalBytes+u>r.maxBytes)throw new A("byte-capacity",d,r,u);n.onBeforePublish?.();try{let m=oe(s,p,{durability:"durable"}),g=re(o,m.directorySync);return{disposition:"accepted",requestId:e.id,responsePath:a,authoritativeDeadlineAtMs:e.deadlineAtMs,achievedDurability:g==="synced"?"directory-durable":"file-flushed",directorySync:g}}catch(m){if(m.code!=="EEXIST")throw m;let g=ht(t,e.id);if(!g)throw m;let f=St(g,e.operationKey,e.id);return{disposition:"duplicate",requestId:e.id,responsePath:a,authoritativeDeadlineAtMs:f.deadlineAtMs??e.deadlineAtMs}}})}function nr(t,e,n,r=Zn){let i={reclaimed:0,completedClaimsRemoved:0,responsesRemoved:0,deadLettersRemoved:0,temporaryFilesRemoved:0},o=n.cleanupBatch;for(let s of Se(t.inflightDir)){if(o<=0)break;let a=y(t.responseDir,`${s.requestId}.json`);if(T(a)){R(s.path,{force:!0}),i.completedClaimsRemoved++,o--;continue}if(s.claimExpiresAtMs>e||ar(t,s.ownerId,r)!=="dead")continue;let c=y(t.pendingDir,s.originalFile);try{wt(s.path,c),i.reclaimed++}catch(p){if(p.code!=="EEXIST")throw p;R(s.path,{force:!0})}F(Qn(s.path)),F(t.pendingDir),o--}o=xt(t.responseDir,o,(s,a)=>a+n.responseRetentionMs,e,()=>{i.responsesRemoved++}),o=xt(t.deadLetterDir,o,(s,a)=>a+n.deadLetterRetentionMs,e,()=>{i.deadLettersRemoved++});for(let s of[t.pendingDir,t.inflightDir,t.responseDir,t.deadLetterDir,t.legacyRequestDir]){if(o<=0)break;for(let a of vt(s)){if(o<=0)break;be(a).includes(".tmp-")&&(O(a).mtimeMs+n.temporaryRetentionMs>e||(R(a,{force:!0}),i.temporaryFilesRemoved++,o--))}}return lr(t.inflightDir),i}function Pt(t){Mt(t);let e=[...q(t.pendingDir).map(c=>({path:c,pending:!0})),...q(t.legacyRequestDir).map(c=>({path:c,pending:!0}))],n=Se(t.inflightDir).map(c=>({path:c.path,pending:!1})),r=q(t.responseDir).map(c=>({path:c,pending:!1})),i=q(t.deadLetterDir).map(c=>({path:c,pending:!1})),o=[...e,...n,...r,...i],s=0,a;for(let c of e){let p=xe(c.path);if(!p){s++;continue}let u=p.enqueuedAtMs??O(c.path).mtimeMs;a=a===void 0?u:Math.min(a,u)}return{pending:e.length,inflight:n.length,responses:r.length,deadLetters:i.length,invalid:s,totalItems:o.length,totalBytes:o.reduce((c,p)=>c+ur(p.path),0),...a===void 0?{}:{oldestPendingAt:new Date(a).toISOString()}}}function rr(t,e,n,r,i){let o=y(t.rootDir,".admission.lock"),s=`${process.pid}-${Rt()}`,a=r()+Math.max(0,n);for(;!ir(t.rootDir,o,s);){if(or(o),r()>=a)throw new A("admission-busy",Pt(t),e,0);Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,5)}try{return i()}finally{try{he(o).ownerToken===s&&(R(o,{recursive:!0,force:!0}),F(t.rootDir))}catch{}}}function ir(t,e,n){let r=`${JSON.stringify({ownerToken:n,pid:process.pid,acquiredAtMs:Date.now()})}
26
+ `;try{return oe(e,r,{durability:"durable"}),!0}catch(i){if(i.code==="EEXIST")return!1;try{he(e).ownerToken===n&&(R(e,{force:!0}),F(t))}catch{}throw i}}function or(t){let e=null;try{let r=he(t);typeof r.ownerToken=="string"&&Number.isSafeInteger(r.pid)&&Number(r.pid)>0&&(e=Number(r.pid))}catch{}if(e===null||sr(e))return;let n=`${t}.stale-${Rt()}`;try{wt(t,n)}catch(r){let i=r.code;if(i==="ENOENT"||i==="EEXIST")return;throw r}R(n,{recursive:!0,force:!0})}function he(t){try{return JSON.parse(S(t,"mailbox lock record"))}catch(e){if(e.code!=="EISDIR"&&!(e instanceof Ae&&e.reason==="not-regular"))throw e;return JSON.parse(S(y(t,"owner.json"),"mailbox lock owner record"))}}function sr(t){try{return process.kill(t,0),!0}catch(e){let n=e.code;return n==="EPERM"||n!=="ESRCH"}}function ar(t,e,n){let r=cr(y(t.inflightDir,At(e),Yn));if(!r)return"unknown";if(!n.isProcessAlive(r.pid))return"dead";if(!r.processIdentity)return"live";let i=n.readProcessIdentity(r.pid);return i?G(r.processIdentity,i)?"live":"dead":"unknown"}function cr(t){try{let e=JSON.parse(S(t,"mailbox owner record"));if(e.version!==1||typeof e.ownerId!="string"||!e.ownerId||typeof e.pid!="number"||!Number.isSafeInteger(e.pid)||e.pid<=0)return null;let n=e.processIdentity===void 0?null:w(e.processIdentity);return e.processIdentity!==void 0&&(!n||n.pid!==e.pid)?null:{version:1,ownerId:e.ownerId,pid:e.pid,...n?{processIdentity:n}:{}}}catch{return null}}function ht(t,e){for(let n of[y(t.pendingDir,`${e}.json`),y(t.legacyRequestDir,`${e}.json`),y(t.responseDir,`${e}.json`)])if(T(n))return n;for(let n of Se(t.inflightDir))if(n.requestId===e)return n.path;return null}function St(t,e,n){let r=xe(t);if(!r||r.operationKey!==e)throw new Error(`Mailbox operation ${n} conflicts with an existing retained record.`);return r}function dr(t){if(t.mailboxVersion!==Kn||t.id!==tr(t.operationKey)||!t.clientId.trim()||!Number.isFinite(t.enqueuedAtMs)||!Number.isFinite(t.deadlineAtMs)||t.deadlineAtMs<t.enqueuedAtMs)throw new Error("Mailbox request has an invalid lifecycle identity.")}function Se(t){if(!T(t))return[];let e=[];for(let n of E(t,{withFileTypes:!0})){if(!n.isDirectory())continue;let r=It(n.name);if(r===null)continue;let i=y(t,n.name);for(let o of E(i,{withFileTypes:!0})){if(!o.isFile()||!o.name.endsWith(".claim"))continue;let s=/^(.*)\.(\d+)\.claim$/.exec(o.name);if(!s)continue;let a=It(s[1]),c=Number(s[2]);if(a===null||be(a)!==a||!a.endsWith(".json")||!Number.isSafeInteger(c))continue;let p=y(i,o.name),u=xe(p)??{id:be(a,".json")},d=O(p);e.push({requestId:u.id,ownerId:r,path:p,originalFile:a,claimedAtMs:d.mtimeMs,claimExpiresAtMs:c,byteLength:d.size,...u.operationKey?{operationKey:u.operationKey}:{},...u.clientId?{clientId:u.clientId}:{},...u.enqueuedAtMs===void 0?{}:{enqueuedAtMs:u.enqueuedAtMs},...u.deadlineAtMs===void 0?{}:{deadlineAtMs:u.deadlineAtMs},legacy:u.operationKey===void 0})}}return e.sort((n,r)=>n.claimedAtMs-r.claimedAtMs||n.path.localeCompare(r.path))}function xe(t){try{let e=JSON.parse(S(t,"mailbox record"));return typeof e.id!="string"||!e.id?null:{id:e.id,...typeof e.operationKey=="string"?{operationKey:e.operationKey}:{},...typeof e.clientId=="string"?{clientId:e.clientId}:{},...typeof e.enqueuedAtMs=="number"?{enqueuedAtMs:e.enqueuedAtMs}:{},...typeof e.deadlineAtMs=="number"?{deadlineAtMs:e.deadlineAtMs}:{}}}catch{return null}}function xt(t,e,n,r,i){for(let o of q(t)){if(e<=0)break;let s=O(o);n(o,s.mtimeMs)>r||(R(o,{force:!0}),i(),e--)}return e}function q(t){return T(t)?E(t,{withFileTypes:!0}).filter(e=>e.isFile()).map(e=>y(t,e.name)).sort():[]}function vt(t){if(!T(t))return[];let e=[];for(let n of E(t,{withFileTypes:!0})){let r=y(t,n.name);n.isFile()?e.push(r):n.isDirectory()&&e.push(...vt(r))}return e.sort()}function lr(t){if(T(t))for(let e of E(t,{withFileTypes:!0})){if(!e.isDirectory())continue;let n=y(t,e.name);E(n).some(r=>r.endsWith(".claim"))||R(n,{recursive:!0,force:!0})}}function ur(t){try{return O(t).size}catch{return 0}}function At(t){return Buffer.from(t,"utf8").toString("base64url")}function It(t){try{let e=Buffer.from(t,"base64url").toString("utf8");return At(e)===t?e:null}catch{return null}}import{join as te}from"path";var pr="watch.lock",fr="watch-state.json",mr="watch-activity.json",yr="watch-refresh-requests";function To(t){return{lockPath:te(t,pr),statePath:te(t,fr),activityPath:te(t,mr),refreshRequestsPath:te(t,yr)}}function Fo(t){try{return gr(JSON.parse(S(t,"watch service state")))}catch{return null}}function gr(t){if(!t||typeof t!="object")return null;let e=t;if(e.version!==1||typeof e.protocolVersion!="number"||typeof e.pid!="number"||!Number.isInteger(e.pid)||e.pid<=0||typeof e.projectRoot!="string"||e.worktreeId!==void 0&&(typeof e.worktreeId!="string"||e.worktreeId.length===0)||typeof e.cliVersion!="string"||!b(e.startedAt)||!b(e.heartbeatAt)||!b(e.lastActivityAt)||!br(e.watcher)||e.idleDeadlineAt!==void 0&&!b(e.idleDeadlineAt))return null;if(e.processIdentity!==void 0){let n=w(e.processIdentity);if(!n||n.pid!==e.pid)return null;e.processIdentity=n}return e.indexGeneration!==void 0&&!/^[a-f0-9]{64}$/.test(e.indexGeneration)||e.lastError!==void 0&&!hr(e.lastError)||e.lastRefresh!==void 0&&!Sr(e.lastRefresh)||e.reindexActivity!==void 0&&!xr(e.reindexActivity)||e.refreshRequests!==void 0&&!Rr(e.refreshRequests)||e.typescriptSemantic!==void 0&&!wr(e.typescriptSemantic)||e.typescriptIndex!==void 0&&!Mr(e.typescriptIndex)||e.queryLane!==void 0&&!Pr(e.queryLane)?null:e}function b(t){return we(t)}function br(t){if(!t||typeof t!="object"||!("state"in t))return!1;let e=t;switch(e.state){case"idle":return!0;case"waiting":return h(e.changedFiles)&&h(e.reindexAt);case"indexing":return h(e.startedAt);case"cooldown":return h(e.until)&&typeof e.dirty=="boolean";case"budget-paused":return h(e.until)&&typeof e.dirty=="boolean"&&typeof e.reason=="string"&&l(e.rebuilt)&&l(e.estimatedWriteBytes);case"draining":return h(e.startedAt)&&typeof e.reason=="string";default:return!1}}function hr(t){if(!t||typeof t!="object")return!1;let e=t;return b(e.at)&&typeof e.message=="string"}function Sr(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.trigger?.kind=="string"&&typeof e.result=="string"&&b(e.startedAt)&&b(e.completedAt)&&h(e.durationMs)}function xr(t){if(!t||typeof t!="object")return!1;let e=t;return e.confidence!==void 0&&e.confidence!=="complete"&&e.confidence!=="partial"&&e.confidence!=="unavailable"||e.recordsRead!==void 0&&!l(e.recordsRead)||e.invalidRecords!==void 0&&!l(e.invalidRecords)||e.skippedRecords!==void 0&&!l(e.skippedRecords)||e.readErrors!==void 0&&!l(e.readErrors)||e.ignoredPartialTailBytes!==void 0&&!l(e.ignoredPartialTailBytes)||!b(e.windowStartedAt)||!b(e.windowEndedAt)||!l(e.runs)||!l(e.rebuilt)||!l(e.reused)||!l(e.failed)||!l(e.suppressed)||!h(e.estimatedLogicalOutputBytes)||e.estimatedWriteBytes!==void 0&&!l(e.estimatedWriteBytes)||e.reflinkedBytes!==void 0&&!l(e.reflinkedBytes)||e.fallbackCopiedBytes!==void 0&&!l(e.fallbackCopiedBytes)||e.oldestRebuildAt!==void 0&&!b(e.oldestRebuildAt)||e.oldestWriteAt!==void 0&&!b(e.oldestWriteAt)||e.languageAttribution!==void 0&&e.languageAttribution!=="complete"&&e.languageAttribution!=="partial"&&e.languageAttribution!=="unavailable"||e.attributedRuns!==void 0&&!l(e.attributedRuns)||e.unattributedRuns!==void 0&&!l(e.unattributedRuns)||e.invalidLanguageDetails!==void 0&&!l(e.invalidLanguageDetails)||e.estimatedLogicalOutputBytes<0||!e.byTrigger||typeof e.byTrigger!="object"||Array.isArray(e.byTrigger)||e.byLanguage!==void 0&&!Ir(e.byLanguage)?!1:Object.values(e.byTrigger).every(n=>n===void 0||l(n))}function Ir(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;for(let[e,n]of Object.entries(t)){if(!Pe.includes(e)||!n||typeof n!="object")return!1;let r=n;if(!l(r.runs)||!l(r.rebuilt)||!l(r.reused)||!l(r.producedOutputBytes)||!Me(r.durationMs)||r.rebuilt+r.reused!==r.runs)return!1}return!0}function Rr(t){if(!t||typeof t!="object")return!1;let e=t;return l(e.pending)&&l(e.claimed)&&l(e.completed)&&l(e.expired)&&l(e.invalid)&&(e.oldestPendingAt===void 0||b(e.oldestPendingAt))}function wr(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.protocolVersion=="number"&&(e.state==="idle"||e.state==="ready"||e.state==="unavailable"||e.state==="error")&&h(e.requests)&&h(e.sessionsCreated)&&h(e.sessionsReused)&&h(e.sessionsRefreshed)&&h(e.sessionsReplaced)&&h(e.projectsCreated)&&(e.lastRequestAt===void 0||b(e.lastRequestAt))&&(e.lastError===void 0||typeof e.lastError=="string")&&(e.busyUntil===void 0||b(e.busyUntil))&&(e.mailbox===void 0||Et(e.mailbox))}function Mr(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.protocolVersion=="number"&&(e.state==="idle"||e.state==="ready"||e.state==="unavailable"||e.state==="error")&&l(e.requests)&&l(e.sessionsCreated)&&l(e.sessionsReplaced)&&l(e.initializations)&&l(e.programUpdates)&&l(e.documentsEmitted)&&l(e.documentsRemoved)&&(e.lastRequestAt===void 0||b(e.lastRequestAt))&&(e.lastDurationMs===void 0||h(e.lastDurationMs)&&e.lastDurationMs>=0)&&(e.lastError===void 0||typeof e.lastError=="string")&&(e.busyUntil===void 0||b(e.busyUntil))&&(e.mailbox===void 0||Et(e.mailbox))}function Pr(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.protocolVersion=="number"&&typeof e.socketPath=="string"&&e.socketPath.length>0&&l(e.requests)&&(e.lastRequestAt===void 0||b(e.lastRequestAt))&&(e.lastError===void 0||typeof e.lastError=="string")}function Et(t){if(!t||typeof t!="object")return!1;let e=t;return l(e.pending)&&l(e.inflight)&&l(e.responses)&&l(e.deadLetters)&&l(e.invalid)&&l(e.totalItems)&&h(e.totalBytes)&&e.totalBytes>=0&&e.totalItems===e.pending+e.inflight+e.responses+e.deadLetters&&(e.oldestPendingAt===void 0||b(e.oldestPendingAt))}function h(t){return typeof t=="number"&&Number.isFinite(t)}export{Tt as a,Er as b,Br as c,z as d,je as e,qr as f,vn as g,An as h,En as i,Tn as j,v as k,ut as l,Yi as m,Zi as n,ge as o,pt as p,Nn as q,qn as r,On as s,yt as t,He as u,Vr as v,oi as w,Zt as x,de as y,si as z,nn as A,rn as B,ai as C,ci as D,di as E,ee as F,Kn as G,xo as H,Io as I,tr as J,Ro as K,to as L,oo as M,so as N,ao as O,To as P,Fo as Q,cn as R,H as S,fn as T,gi as U,bi as V,Ei as W,V as X,ue as Y,Ci as Z,ji as _,_i as $};
27
+ //# sourceMappingURL=chunk-SMDIEDM4.js.map