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
package/CHANGELOG.md CHANGED
@@ -9,6 +9,48 @@ names are separate packages, and no `scip-query` version is superseded in place.
9
9
  Entries at 0.20.0 and below record the predecessor package's history, retained
10
10
  for continuity; they document releases of `scip-query`, not of `codebaseiq`.
11
11
 
12
+ ## [0.3.0] — 2026-10-18
13
+
14
+ ### Changed (codebaseiq writes its own SQLite index)
15
+
16
+ - **Indexing no longer needs Sourcegraph's `scip` CLI.** codebaseiq now writes
17
+ its SQLite index store itself instead of running `scip expt-convert`, and a
18
+ missing `scip` binary no longer stops a reindex. The tables, indexes, and
19
+ rows are unchanged: on seven real indexes from 15 KB to 160 MB, covering C#,
20
+ JavaScript, Python, Rust, and TypeScript, every row matched the converter's
21
+ output.
22
+ - **Queries no longer read `index.scip`.** Exact occurrence call targets and
23
+ the Rust occurrence references and callees now decode the occurrences stored
24
+ in `index.db` instead of deserializing the whole `index.scip` on first use.
25
+ An index written by an earlier release is rebuilt in full on its next
26
+ refresh rather than patched, and until then those lookups report themselves
27
+ unavailable.
28
+ - **The `codebaseiq-windows` package is retired.** It existed only to ship
29
+ `scip.exe`. New releases no longer depend on it, and the release coordinator
30
+ publishes a single package.
31
+ - **Node.js 22.15 or newer is required** (previously 22.0), for the built-in
32
+ zstd compression the index store uses.
33
+
34
+ ### Breaking
35
+
36
+ - `isScipInstalled`, `getScipVersion`, and `printScipInstallInstructions`
37
+ (`codebaseiq/runtime`) and `tryInstallScipCli` (`codebaseiq/reindex`) are
38
+ removed, and `CODEBASEIQ_SCIP_BIN` is no longer read. `check-deps` and
39
+ `setup` no longer check for a `scip` binary, and the setup report no longer
40
+ carries `scipCliInstalled` or a `scip-cli` step.
41
+ - `chunks.occurrences` in `index.db` now holds codebaseiq's own encoding
42
+ (zstd-compressed JSON) instead of zstd-compressed SCIP protobuf. An external
43
+ tool that decoded the old bytes must change.
44
+
45
+ ### Fixes
46
+
47
+ - **C# and VB solutions in a subfolder now index.** codebaseiq looked for a
48
+ `.sln` or project file only at the repository root, so a layout such as
49
+ `dotnet/App.slnx` handed scip-dotnet the root folder and indexing failed
50
+ with "Solution file not found". It now searches up to three folder levels
51
+ down, skipping hidden folders, `bin`, `obj`, and `node_modules`, and
52
+ recognizes `.slnx` solutions.
53
+
12
54
  ## [0.2.0] — 2026-10-04
13
55
 
14
56
  ### Added (reuse before writing, a trailing sentinel, and a code map)
@@ -22,12 +64,12 @@ for continuity; they document releases of `scip-query`, not of `codebaseiq`.
22
64
  (`--mode embeddings`); `--mode auto` walks the configured chain and reports
23
65
  every fallback. Results are labeled heuristic candidates, never a locator.
24
66
  - **An opt-in trailing sentinel watches agent edits** (`codebaseiq setup
25
- --sentinel`). It parses each edited file directly, without waiting for a
67
+ --sentinel`). It parses each edited file directly, without waiting for a
26
68
  reindex, and reports a new function whose body equals an existing one; at
27
69
  Stop it reports new code nothing imports or calls outside tests. It starts in
28
70
  shadow mode (logged, never shown) until a finding family passes a measured
29
71
  promotion gate (`npm run calibrate:sentinel`, `npm run
30
- calibrate:sentinel-review`, then `codebaseiq setup --sentinel-live <family>`).
72
+ calibrate:sentinel-review`, then `codebaseiq setup --sentinel-live <family>`).
31
73
  Hooks are installed for Claude Code and Codex.
32
74
  - **`codebaseiq view` opens a local code map.** Folders and files are drawn with
33
75
  their dependencies rolled up per level, cycles flagged; clicking into a symbol
package/README.md CHANGED
@@ -29,7 +29,7 @@ is complete.
29
29
 
30
30
  ## Install
31
31
 
32
- codebaseiq requires Node.js 22 or newer. Node.js 24 LTS is recommended.
32
+ codebaseiq requires Node.js 22.15 or newer. Node.js 24 LTS is recommended.
33
33
 
34
34
  ```bash
35
35
  npm install -g codebaseiq
@@ -1,2 +1,2 @@
1
- import{e as t}from"./chunk-5NJPH3QZ.js";import"./chunk-YUKYB54I.js";import"./chunk-FWY2PRIF.js";import"./chunk-4NHWNAWQ.js";import"./chunk-2VKB5CMA.js";import"./chunk-4O52YNKL.js";import{writeFileSync as s}from"fs";import{workerData as o}from"worker_threads";var r=o;try{let e=t({projectRoot:r.projectRoot,dbPath:r.dbPath,tsconfig:r.tsconfig,vueFiles:r.vueFiles,tasks:r.tasks});s(r.resultPath,JSON.stringify({version:1,runId:r.runId,workerId:r.workerId,taskIds:r.taskIds,ok:!0,result:e}))}catch(e){s(r.resultPath,JSON.stringify({version:1,runId:r.runId,workerId:r.workerId,taskIds:r.taskIds,ok:!1,error:e instanceof Error?e.message:String(e)}))}
1
+ import{e as t}from"./chunk-YTJHCGYB.js";import"./chunk-YUKYB54I.js";import"./chunk-XQAVQVIL.js";import"./chunk-YT4DVWUV.js";import"./chunk-RCIGX23V.js";import"./chunk-UQYQBLJX.js";import{writeFileSync as s}from"fs";import{workerData as o}from"worker_threads";var r=o;try{let e=t({projectRoot:r.projectRoot,dbPath:r.dbPath,tsconfig:r.tsconfig,vueFiles:r.vueFiles,tasks:r.tasks});s(r.resultPath,JSON.stringify({version:1,runId:r.runId,workerId:r.workerId,taskIds:r.taskIds,ok:!0,result:e}))}catch(e){s(r.resultPath,JSON.stringify({version:1,runId:r.runId,workerId:r.workerId,taskIds:r.taskIds,ok:!1,error:e instanceof Error?e.message:String(e)}))}
2
2
  //# sourceMappingURL=augment-vue-worker.js.map
@@ -1,2 +1,2 @@
1
- import{e as n}from"./chunk-WOOTEWQT.js";function s(o,r,t,e){return n({projectRoot:o,languages:e.languages?.length?e.languages:r.languages,outputScip:t.indexPath,outputDb:t.dbPath,pnpmWorkspaces:r.indexer?.typescript?.pnpmWorkspaces,typescriptProjectMode:r.indexer?.typescript?.projectMode,typescriptProjects:r.indexer?.typescript?.projects,clojureConfigPath:r.indexer?.clojure?.configPath,skipIfUnchanged:e.force!==!0,allowPartial:e.allowPartial===!0,skipAutoInstall:e.skipAutoInstall===!0,installMissing:e.installMissing===!0,trustProjectTools:e.trustProjectTools===!0,indexerConcurrency:e.indexerConcurrency??r.indexerConcurrency,trigger:e.trigger,...e.onStatus?{onStatus:e.onStatus}:{}})}export{s as a};
2
- //# sourceMappingURL=chunk-2DMVFAY7.js.map
1
+ import{e as n}from"./chunk-MVRGB4KJ.js";function s(o,r,t,e){return n({projectRoot:o,languages:e.languages?.length?e.languages:r.languages,outputScip:t.indexPath,outputDb:t.dbPath,pnpmWorkspaces:r.indexer?.typescript?.pnpmWorkspaces,typescriptProjectMode:r.indexer?.typescript?.projectMode,typescriptProjects:r.indexer?.typescript?.projects,clojureConfigPath:r.indexer?.clojure?.configPath,skipIfUnchanged:e.force!==!0,allowPartial:e.allowPartial===!0,skipAutoInstall:e.skipAutoInstall===!0,installMissing:e.installMissing===!0,trustProjectTools:e.trustProjectTools===!0,indexerConcurrency:e.indexerConcurrency??r.indexerConcurrency,trigger:e.trigger,...e.onStatus?{onStatus:e.onStatus}:{}})}export{s as a};
2
+ //# sourceMappingURL=chunk-23C5AD3B.js.map
@@ -1,2 +1,2 @@
1
- import{K as c}from"./chunk-RVYLJDXC.js";import{h as a,w as u,y as p}from"./chunk-PLZXWZHY.js";var g=a("suppression-inventory",{clearGroups:["whole-project"]});function b(t){return g.get(t,()=>y(t))}function y(t){let e={dead:0,stale:0,wrapper:0,passthrough:0,drift:0,extract:0,similar:0,twin:0,uncategorized:0},n=new Map,o=0;for(let r of c(t)){let i=u(t,r);if(!(!i||!i.includes("codebaseiq")))for(let f of i.split(/\r?\n/)){let s=p(f);if(s===null)continue;o+=1,n.set(r,(n.get(r)??0)+1);let d=l(s);e[d]+=1}}for(let r of t.config.suppressions??[])r.expiresAt&&Date.parse(r.expiresAt)<=Date.now()||(o+=1,r.file&&n.set(r.file,(n.get(r.file)??0)+1),e[l(r.check)]+=1);return{total:o,byCategory:e,byFile:n}}function l(t){if(!t)return"uncategorized";let e=t.toLowerCase();return e==="dead-code"||e==="new-dead"?"dead":e.includes("twin")?"twin":e.includes("similar")||e.includes("duplicate")?"similar":e.includes("wrapper")?"wrapper":e.includes("passthrough")?"passthrough":e.includes("drift")?"drift":e.includes("extract")?"extract":e.includes("stale")?"stale":"uncategorized"}export{b as a};
2
- //# sourceMappingURL=chunk-WH5SYOMD.js.map
1
+ import{K as c}from"./chunk-ICUL7XRT.js";import{h as a,w as u,y as p}from"./chunk-7GAK2F3H.js";var g=a("suppression-inventory",{clearGroups:["whole-project"]});function b(t){return g.get(t,()=>y(t))}function y(t){let e={dead:0,stale:0,wrapper:0,passthrough:0,drift:0,extract:0,similar:0,twin:0,uncategorized:0},n=new Map,o=0;for(let r of c(t)){let i=u(t,r);if(!(!i||!i.includes("codebaseiq")))for(let f of i.split(/\r?\n/)){let s=p(f);if(s===null)continue;o+=1,n.set(r,(n.get(r)??0)+1);let d=l(s);e[d]+=1}}for(let r of t.config.suppressions??[])r.expiresAt&&Date.parse(r.expiresAt)<=Date.now()||(o+=1,r.file&&n.set(r.file,(n.get(r.file)??0)+1),e[l(r.check)]+=1);return{total:o,byCategory:e,byFile:n}}function l(t){if(!t)return"uncategorized";let e=t.toLowerCase();return e==="dead-code"||e==="new-dead"?"dead":e.includes("twin")?"twin":e.includes("similar")||e.includes("duplicate")?"similar":e.includes("wrapper")?"wrapper":e.includes("passthrough")?"passthrough":e.includes("drift")?"drift":e.includes("extract")?"extract":e.includes("stale")?"stale":"uncategorized"}export{b as a};
2
+ //# sourceMappingURL=chunk-2E6OUPCF.js.map
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- var s=new Set(["code","outline","refs"]),c=["--symbol","--at","--search","--view","--edge","--direction","--subtype","--connecting","--inventory-only","--fold","--depth","--max-edges"];function d(e){if(e[2]!=="evidence")return;let t=e[3];if(!t||t.startsWith("-"))return;if(e.slice(4).some(i=>c.some(r=>i===r||i.startsWith(`${r}=`)))){e.splice(3,1,"--symbol",t);return}e[2]="evidence-source"}function a(e){return e!==void 0&&s.has(e)}async function p(e){if(e==="continue"){let{outputContinuationCommandDescriptor:n}=await import("./output-continuation-command-ITPRC3YV.js");return[n]}if(e==="__sentinel-ensure-service"){let{sentinelEnsureCommandDescriptor:n}=await import("./sentinel-ensure-command-RIZA3RY7.js");return[n]}if(a(e)){let{directNavigationQueryCommandDescriptors:n}=await import("./direct-navigation-ZL362KXF.js"),o=n.find(i=>i.id===e);if(!o)throw new Error(`Direct navigation command descriptor is unavailable: ${e}`);return[o]}let{commandDescriptors:t}=await import("./command-descriptors-EAHKIRAG.js");return t}export{d as a,a as b,p as c};
3
- //# sourceMappingURL=chunk-RWKEXCHU.js.map
2
+ var s=new Set(["code","outline","refs"]),c=["--symbol","--at","--search","--view","--edge","--direction","--subtype","--connecting","--inventory-only","--fold","--depth","--max-edges"];function d(e){if(e[2]!=="evidence")return;let t=e[3];if(!t||t.startsWith("-"))return;if(e.slice(4).some(i=>c.some(r=>i===r||i.startsWith(`${r}=`)))){e.splice(3,1,"--symbol",t);return}e[2]="evidence-source"}function a(e){return e!==void 0&&s.has(e)}async function p(e){if(e==="continue"){let{outputContinuationCommandDescriptor:n}=await import("./output-continuation-command-BL25S26S.js");return[n]}if(e==="__sentinel-ensure-service"){let{sentinelEnsureCommandDescriptor:n}=await import("./sentinel-ensure-command-OSWGCFFL.js");return[n]}if(a(e)){let{directNavigationQueryCommandDescriptors:n}=await import("./direct-navigation-J5MVYYAD.js"),o=n.find(i=>i.id===e);if(!o)throw new Error(`Direct navigation command descriptor is unavailable: ${e}`);return[o]}let{commandDescriptors:t}=await import("./command-descriptors-YCLATF5I.js");return t}export{d as a,a as b,p as c};
3
+ //# sourceMappingURL=chunk-2EDX3JT5.js.map
@@ -0,0 +1,2 @@
1
+ import{b as r}from"./chunk-LMTSB3TB.js";import{y as e}from"./chunk-GVAF222T.js";function l(t,s){let o=r(t,s);return e(t,o).map(({relativePath:n,...a})=>a)}export{l as a};
2
+ //# sourceMappingURL=chunk-2I2UHZET.js.map
@@ -1,3 +1,3 @@
1
- import{c as p}from"./chunk-BX2U3QQV.js";import{b as D}from"./chunk-B75HZHUP.js";import{a as m}from"./chunk-BGBBVSH4.js";import{d as g,u as B}from"./chunk-AM5SUGHF.js";import{b as f}from"./chunk-JOALNFY3.js";import{A as d,x as y}from"./chunk-PLZXWZHY.js";import{createHash as A}from"crypto";var h=3;function H(e,t={}){let{scope:o,maxLoc:n=15,minLoc:i=h,limit:r,scanLimit:s}=t,l=p(e),u=L(e,{scope:o,maxLoc:n,scanLimit:s}).map(a=>x(e,a,l,i)).filter(a=>a!==null),c=v(u);return r?c.slice(0,r):c}function M(e,t,o={}){let{scope:n,maxLoc:i=15,minLoc:r=h,scanLimit:s}=o,l=p(e),u=L(e,{scope:n,maxLoc:i,scanLimit:s}).map(a=>x(e,a,l,r)).filter(a=>a!==null),c=u.find(a=>a.symbol===t);return c?u.filter(a=>a.symbol!==c.symbol&&a.normalizedBody===c.normalizedBody&&a.file!==c.file).sort(z).map(({normalizedBody:a,...C})=>C):[]}function I(e){let t=S(e);return f(t).replace(/\s+/g,"")}function v(e){let t=new Map;for(let n of e){if(n.normalizedBody.length<8)continue;let i=F(n.normalizedBody),r=t.get(i)??[];r.push(n),t.set(i,r)}let o=[];for(let[n,i]of t){let r=new Set(i.map(l=>l.file));if(i.length<2||r.size<2)continue;let s=[...i].sort(z).map(({normalizedBody:l,...u})=>u);o.push({hash:n,canonical:s[0],functions:s})}return o.sort((n,i)=>{let r=i.functions.length-n.functions.length;if(r!==0)return r;let s=b(i)-b(n);return s!==0?s:n.canonical.file.localeCompare(i.canonical.file)}),o}function L(e,t){let o=B(e,{scope:t.scope}).filter(n=>n.isFunctionLike&&!e.isIgnored(n.relativePath)).filter(n=>!d(e,n.relativePath,n.startLine,"similar")).filter(n=>m(n)<=t.maxLoc);return o.sort((n,i)=>m(i)-m(n)||n.relativePath.localeCompare(i.relativePath)),D(o,t.scanLimit)}function x(e,t,o,n){let i=E(e,t);if(!i||W(i)<n)return null;let r=P(e,t);return r?{symbol:t.symbol,shortName:g(t.symbol),file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:m(t),ageCommits:o?.get(t.relativePath)?.commitsAgo??null,normalizedBody:r}:null}function P(e,t){let o=E(e,t);return o&&I(o)||null}function E(e,t){let o=y(e,t.relativePath);return o.length===0?null:o.slice(t.startLine,t.endLine+1).join(`
1
+ import{c as p}from"./chunk-CCIYWXX6.js";import{b as D}from"./chunk-B75HZHUP.js";import{a as m}from"./chunk-BGBBVSH4.js";import{d as g,u as B}from"./chunk-GVAF222T.js";import{b as f}from"./chunk-F74LZWCE.js";import{A as d,x as y}from"./chunk-7GAK2F3H.js";import{createHash as A}from"crypto";var h=3;function H(e,t={}){let{scope:o,maxLoc:n=15,minLoc:i=h,limit:r,scanLimit:s}=t,l=p(e),u=L(e,{scope:o,maxLoc:n,scanLimit:s}).map(a=>x(e,a,l,i)).filter(a=>a!==null),c=v(u);return r?c.slice(0,r):c}function M(e,t,o={}){let{scope:n,maxLoc:i=15,minLoc:r=h,scanLimit:s}=o,l=p(e),u=L(e,{scope:n,maxLoc:i,scanLimit:s}).map(a=>x(e,a,l,r)).filter(a=>a!==null),c=u.find(a=>a.symbol===t);return c?u.filter(a=>a.symbol!==c.symbol&&a.normalizedBody===c.normalizedBody&&a.file!==c.file).sort(z).map(({normalizedBody:a,...C})=>C):[]}function I(e){let t=S(e);return f(t).replace(/\s+/g,"")}function v(e){let t=new Map;for(let n of e){if(n.normalizedBody.length<8)continue;let i=F(n.normalizedBody),r=t.get(i)??[];r.push(n),t.set(i,r)}let o=[];for(let[n,i]of t){let r=new Set(i.map(l=>l.file));if(i.length<2||r.size<2)continue;let s=[...i].sort(z).map(({normalizedBody:l,...u})=>u);o.push({hash:n,canonical:s[0],functions:s})}return o.sort((n,i)=>{let r=i.functions.length-n.functions.length;if(r!==0)return r;let s=b(i)-b(n);return s!==0?s:n.canonical.file.localeCompare(i.canonical.file)}),o}function L(e,t){let o=B(e,{scope:t.scope}).filter(n=>n.isFunctionLike&&!e.isIgnored(n.relativePath)).filter(n=>!d(e,n.relativePath,n.startLine,"similar")).filter(n=>m(n)<=t.maxLoc);return o.sort((n,i)=>m(i)-m(n)||n.relativePath.localeCompare(i.relativePath)),D(o,t.scanLimit)}function x(e,t,o,n){let i=E(e,t);if(!i||W(i)<n)return null;let r=P(e,t);return r?{symbol:t.symbol,shortName:g(t.symbol),file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:m(t),ageCommits:o?.get(t.relativePath)?.commitsAgo??null,normalizedBody:r}:null}function P(e,t){let o=E(e,t);return o&&I(o)||null}function E(e,t){let o=y(e,t.relativePath);return o.length===0?null:o.slice(t.startLine,t.endLine+1).join(`
2
2
  `)}function S(e){let t=e.indexOf("{"),o=e.lastIndexOf("}");if(t>=0&&o>t)return e.slice(t+1,o);let n=e.indexOf("=>");return n>=0?e.slice(n+2).replace(/;+\s*$/,""):e}function W(e){return S(e).split(/\r?\n/).map(o=>o.trim()).filter(o=>o.length>0).length}function F(e){return A("sha256").update(e).digest("hex").slice(0,16)}function z(e,t){let o=e.ageCommits??-1;return(t.ageCommits??-1)-o||e.file.localeCompare(t.file)||e.startLine-t.startLine}function b(e){return e.functions.reduce((t,o)=>t+o.loc,0)}export{H as a,M as b,I as c,v as d,P as e,E as f,S as g};
3
- //# sourceMappingURL=chunk-CSZOQ7YO.js.map
3
+ //# sourceMappingURL=chunk-2OMXFE64.js.map
@@ -1,3 +1,3 @@
1
- import{b as m}from"./chunk-5IO2APSS.js";import{a as p}from"./chunk-6URCE5QY.js";import{aa as d,ca as P,da as h,g as f}from"./chunk-4O52YNKL.js";import{realpathSync as c}from"fs";import{basename as x,dirname as L,join as T,relative as I,sep as O}from"path";import{fileURLToPath as S,pathToFileURL as y}from"url";function F(n,e){return e==="."||e==="./"?y(c(n)).href:y(d(n,e).absolutePath).href}function b(n,e){let r=S(e);return I(c(n),v(r)).split(O).join("/")}function v(n){try{return c(n)}catch{try{return T(c(L(n)),x(n))}catch{return n}}}function H(n,e,r){return{textDocument:{uri:F(n,e.relativePath)},position:z(n,e),context:{includeDeclaration:r}}}function z(n,e){let r={line:e.startLine,character:e.startChar??0};try{return M(P(n,e.relativePath,{inputKind:"indexed Rust source file"}),e,r)}catch(t){if(!h(t))throw t;return r}}function M(n,e,r={line:e.startLine,character:e.startChar??0}){let t=n.split(/\r?\n/),o=t[e.startLine];if(o===void 0||e.leaf.length===0)return r;let i=Math.max(0,Math.min(r.character,o.length)),s=o.indexOf(e.leaf,i);if(s>=0)return{line:e.startLine,character:u(s,e.leaf)};let a=o.indexOf(e.leaf);if(a>=0)return{line:e.startLine,character:u(a,e.leaf)};let l=D(t,e.startLine,e.leaf);return l||r}function u(n,e){return n+Math.max(0,e.length-2)}function D(n,e,r){for(let t of[-1,1,-2,2]){let o=e+t;if(o<0||o>=n.length)continue;let i=n[o].indexOf(r);if(i>=0)return{line:o,character:u(i,r)}}return null}function K(n,e){return e.map(r=>({file:b(n,r.uri),line:r.range.start.line,column:r.range.start.character}))}function X(n){let e=new Map;for(let r of n)e.set(`${r.file}\0${r.line}\0${r.column}`,r);return[...e.values()].sort((r,t)=>{let o=r.file.localeCompare(t.file);return o!==0?o:r.line!==t.line?r.line-t.line:r.column-t.column})}import{randomUUID as E}from"crypto";import{readdirSync as $,rmSync as j,writeFileSync as A}from"fs";import{join as g}from"path";var R="rust-analyzer-owner-",w=".json",U=16*1024;function Z(n,e){if(!n||!e.rootIdentity)return null;let r=g(n,`${R}${e.rootPid}-${E()}${w}`),t={version:1,rootIdentity:e.rootIdentity,ownsProcessGroup:e.ownsProcessGroup};return A(r,`${JSON.stringify(t)}
2
- `,{encoding:"utf8",mode:384,flag:"wx"}),r}function ee(n){n&&j(n,{force:!0})}async function re(n,e){if(!n)return[];let r;try{r=$(n)}catch{return[]}let t=r.filter(s=>s.startsWith(R)&&s.endsWith(w)).map(s=>g(n,s)),o=[],i=[];for(let s of t){let a=C(s);a?i.push(a):o.push({reaped:!1,reason:"identity-unavailable",detail:`Rust analyzer ownership record ${s} could not be validated.`})}return o.push(...await Promise.all(i.map(s=>m(s,e)))),o}function C(n){try{let e=f(n,{maxBytes:U,inputKind:"rust-analyzer process ownership record"}),r=JSON.parse(e),t=p(r.rootIdentity);return r.version!==1||!t||typeof r.ownsProcessGroup!="boolean"?null:{rootPid:t.pid,rootIdentity:t,ownsProcessGroup:r.ownsProcessGroup,knownMembers:new Map([[t.pid,t]])}}catch{return null}}export{Z as a,ee as b,re as c,F as d,b as e,H as f,K as g,X as h};
3
- //# sourceMappingURL=chunk-EXMVF3JR.js.map
1
+ import{b as h}from"./chunk-P4NVCOM7.js";import{c as p}from"./chunk-6O3KXIDL.js";import{aa as m,ca as d,da as P,g as f}from"./chunk-UQYQBLJX.js";import{realpathSync as c}from"fs";import{basename as x,dirname as L,join as T,relative as I,sep as O}from"path";import{fileURLToPath as S,pathToFileURL as y}from"url";function F(n,e){return e==="."||e==="./"?y(c(n)).href:y(m(n,e).absolutePath).href}function b(n,e){let r=S(e);return I(c(n),v(r)).split(O).join("/")}function v(n){try{return c(n)}catch{try{return T(c(L(n)),x(n))}catch{return n}}}function H(n,e,r){return{textDocument:{uri:F(n,e.relativePath)},position:z(n,e),context:{includeDeclaration:r}}}function z(n,e){let r={line:e.startLine,character:e.startChar??0};try{return M(d(n,e.relativePath,{inputKind:"indexed Rust source file"}),e,r)}catch(t){if(!P(t))throw t;return r}}function M(n,e,r={line:e.startLine,character:e.startChar??0}){let t=n.split(/\r?\n/),o=t[e.startLine];if(o===void 0||e.leaf.length===0)return r;let i=Math.max(0,Math.min(r.character,o.length)),s=o.indexOf(e.leaf,i);if(s>=0)return{line:e.startLine,character:u(s,e.leaf)};let a=o.indexOf(e.leaf);if(a>=0)return{line:e.startLine,character:u(a,e.leaf)};let l=D(t,e.startLine,e.leaf);return l||r}function u(n,e){return n+Math.max(0,e.length-2)}function D(n,e,r){for(let t of[-1,1,-2,2]){let o=e+t;if(o<0||o>=n.length)continue;let i=n[o].indexOf(r);if(i>=0)return{line:o,character:u(i,r)}}return null}function K(n,e){return e.map(r=>({file:b(n,r.uri),line:r.range.start.line,column:r.range.start.character}))}function X(n){let e=new Map;for(let r of n)e.set(`${r.file}\0${r.line}\0${r.column}`,r);return[...e.values()].sort((r,t)=>{let o=r.file.localeCompare(t.file);return o!==0?o:r.line!==t.line?r.line-t.line:r.column-t.column})}import{randomUUID as E}from"crypto";import{readdirSync as $,rmSync as j,writeFileSync as A}from"fs";import{join as g}from"path";var R="rust-analyzer-owner-",w=".json",U=16*1024;function Z(n,e){if(!n||!e.rootIdentity)return null;let r=g(n,`${R}${e.rootPid}-${E()}${w}`),t={version:1,rootIdentity:e.rootIdentity,ownsProcessGroup:e.ownsProcessGroup};return A(r,`${JSON.stringify(t)}
2
+ `,{encoding:"utf8",mode:384,flag:"wx"}),r}function ee(n){n&&j(n,{force:!0})}async function re(n,e){if(!n)return[];let r;try{r=$(n)}catch{return[]}let t=r.filter(s=>s.startsWith(R)&&s.endsWith(w)).map(s=>g(n,s)),o=[],i=[];for(let s of t){let a=C(s);a?i.push(a):o.push({reaped:!1,reason:"identity-unavailable",detail:`Rust analyzer ownership record ${s} could not be validated.`})}return o.push(...await Promise.all(i.map(s=>h(s,e)))),o}function C(n){try{let e=f(n,{maxBytes:U,inputKind:"rust-analyzer process ownership record"}),r=JSON.parse(e),t=p(r.rootIdentity);return r.version!==1||!t||typeof r.ownsProcessGroup!="boolean"?null:{rootPid:t.pid,rootIdentity:t,ownsProcessGroup:r.ownsProcessGroup,knownMembers:new Map([[t.pid,t]])}}catch{return null}}export{Z as a,ee as b,re as c,F as d,b as e,H as f,K as g,X as h};
3
+ //# sourceMappingURL=chunk-2PRONPAS.js.map
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-B2E3HZ2A.js";function l(d,c,o){if(o.length===0)return[];let e=new Set(o),n=s(d),r=new Set;if(c==="forward")for(let t of e)for(let i of n.get(t)??[])e.has(i)||r.add(i);else for(let[t,i]of n)if(!e.has(t))for(let _ of e)i.has(_)&&r.add(t);return[...r].sort()}export{l as a};
2
- //# sourceMappingURL=chunk-5WXOEJ4G.js.map
1
+ import{a as s}from"./chunk-GV2CEZCW.js";function l(d,c,o){if(o.length===0)return[];let e=new Set(o),n=s(d),r=new Set;if(c==="forward")for(let t of e)for(let i of n.get(t)??[])e.has(i)||r.add(i);else for(let[t,i]of n)if(!e.has(t))for(let _ of e)i.has(_)&&r.add(t);return[...r].sort()}export{l as a};
2
+ //# sourceMappingURL=chunk-356EZBIP.js.map
@@ -1,5 +1,5 @@
1
- import{a as te,b as N,e as V,f as j,g as B,h as re,i as se}from"./chunk-NMTSZXCL.js";import{b as _}from"./chunk-B75HZHUP.js";import{c as q}from"./chunk-NK76RSB6.js";import{a as ie}from"./chunk-OJFLPVBP.js";import{b as ne}from"./chunk-57KEZDPT.js";import{a as D}from"./chunk-3XFJUWJE.js";import{d as v,e as K,h as $}from"./chunk-AM5SUGHF.js";import{a as E}from"./chunk-JOALNFY3.js";import{a as Y}from"./chunk-RVYLJDXC.js";import{h as z,l as J,t as Q,v as ee,w as U,x as H}from"./chunk-PLZXWZHY.js";import{a as A,d as y}from"./chunk-3LCDIREB.js";function Ie(e,n,t={}){let{minSimilarity:i=.4,limit:r=20}=t,s=()=>Ge(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"}),a=Be(e,n,{semantic:t.semantic!==!1});if(a.kind==="not-callable")return[];if(a.kind==="callee-evidence-unusable")return s();let o=a.target;if(!$(o.symbol))return[];if(o.callees.size===0)return s();let c=we(e,o,i,{scanLimit:t.scanLimit,semantic:t.semantic!==!1});return c.length>0?c.slice(0,r):s()}function Tn(e,n,t,i={}){let r=D(e,n),s=D(e,t);if(!r||!s)return null;let a=Ie(e,r.symbol,{minSimilarity:0,limit:Number.POSITIVE_INFINITY,semantic:i.semantic,scanLimit:i.scanLimit}).find(m=>m.symbolB===s.symbol||m.symbolA===s.symbol);if(!a)return null;let o=r.endLine-r.startLine+1,c=s.endLine-s.startLine+1;return{symbolA:{symbol:r.symbol,shortName:v(r.symbol),file:r.relativePath,loc:o},symbolB:{symbol:s.symbol,shortName:v(s.symbol),file:s.relativePath,loc:c},similarity:a.similarity,similarityBasis:a.similarityBasis??"callees",sharedEvidence:a.sharedCallees,uniqueToA:a.uniqueToA,uniqueToB:a.uniqueToB,evidenceClass:a.evidenceClass,actionTier:a.actionTier,recommendation:a.recommendation,consolidationStrategy:ve(a)}}function ve(e){let n=e.similarityBasis==="source-tokens"?"source-token":"tracked callee";return e.sharedCallees.length===0?`No shared ${n} evidence survived similar's weighting. Inspect the source before attempting consolidation.`:e.uniqueToA.length===0&&e.uniqueToB.length===0?`The functions have identical ${n} evidence under similar's weighting. Verify signatures, guards, and return values before consolidating.`:e.uniqueToA.length===0?`A's ${n} evidence is a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToB.length===0?`B's ${n} evidence is a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToA.length<=2&&e.uniqueToB.length<=2?`Create a shared helper around the ${e.sharedCallees.length} shared ${n}(s). Pass the ${e.uniqueToA.length+e.uniqueToB.length} divergent point(s) as parameters or callbacks.`:`Extract the ${e.sharedCallees.length} shared ${n}(s) into a common helper. Keep each function's unique logic outside that helper (${e.uniqueToA.length} item(s) in A, ${e.uniqueToB.length} in B).`}function we(e,n,t,i){let r=G(e).calleeIndex({minCallees:3,scanLimit:i.scanLimit,semantic:i.semantic}),s=_e(n,r.corpus),a=Pe(s,r),o=Te(s,r),c=j(o),m=B(s.callees,o),g=[];for(let f of a){if(f.callees.size<3)continue;let l=B(f.callees,o),u=ce(s,f,o,{minSimilarity:t,requireSignificantShared:1,requireSharedCount:0,medianIdf:c,magnitudeA:m,magnitudeB:l});u&&g.push(u)}return g.sort((f,l)=>l.similarity-f.similarity),g}function Te(e,n){let t=new Map(n.docFreq);for(let i of e.callees)t.set(i,(t.get(i)??0)+1);return V(t,n.corpus.length+1)}function ce(e,n,t,i){let r=Le(e,n,t,i);if(!Re(r,i))return null;let{similarity:s,significantShared:a,trivialShared:o}=r,c=a.length>0?a:o,m=pe(c,"callees");return{symbolA:e.symbol,shortNameA:v(e.symbol),fileA:e.file,symbolB:n.symbol,shortNameB:v(n.symbol),fileB:n.file,similarity:s,similarityBasis:"callees",sharedCallees:c.map(v),uniqueToA:[...N(e.callees,n.callees)].map(v),uniqueToB:[...N(n.callees,e.callees)].map(v),...m}}function Me(e,n,t,i){let r=i.magnitudeA??B(e.callees,t),s=i.magnitudeB??B(n.callees,t),a=0,o=0,c=0,m=i.medianIdf??j(t);for(let l of e.callees){if(!n.callees.has(l))continue;let u=t.get(l)??0;a+=u*u,c+=1,u>=m&&(o+=1)}if(c===0)return!1;let g=r*s;return(g>0?a/g:0)<i.minSimilarity?!1:o>=i.requireSignificantShared||c>=i.requireSharedCount}function Le(e,n,t,i){return i.magnitudeA===void 0||i.magnitudeB===void 0?re(e.callees,n.callees,t,{medianIdf:i.medianIdf}):se(e.callees,n.callees,t,{medianIdf:i.medianIdf,magnitudeA:i.magnitudeA,magnitudeB:i.magnitudeB})}function Re(e,n){if(e.similarity<n.minSimilarity)return!1;let t=e.significantShared.length+e.trivialShared.length;return e.significantShared.length>=n.requireSignificantShared||t>=n.requireSharedCount}function Mn(e,n={}){let{minSimilarity:t=.5,limit:i=20,scope:r,minCallees:s=4,crossFileOnly:a=!1,scanLimit:o}=n,c=n.semantic!==!1,m=A(),g=0,f=0,l=0,u=0,d=0,p=0,b=0;return y("similar.all",()=>{let h=G(e).calleeIndex({minCallees:s,scope:r,scanLimit:o,semantic:c}),S=h.corpus;g=S.length;let F=n.focusFiles,I=[],P=0;return y("similar.all.pair-scan",()=>{for(let k=0;k<S.length;k+=1){let x=S[k],M=F?.has(x.file)??!1,w=h.weightedMagnitudes[k],T=new Set;for(let O of x.callees){let L=h.candidateIndexesByCallee.get(O);if(L)for(let R of L)R<=k||F&&!M&&!F.has(S[R].file)||T.add(R)}m&&(l+=T.size,T.size>0&&(f+=1));for(let O of T){let L=S[O];if(a&&x.file===L.file){m&&(d+=1);continue}if(ue(x,L)){m&&(p+=1);continue}m&&(u+=1);let R=ce(x,L,h.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:h.medianIdf,magnitudeA:w,magnitudeB:h.weightedMagnitudes[O]});R&&(Ae(I,R,i,P),m&&(b+=1),P+=1)}}},()=>({corpusSize:g,candidateSets:f,candidatePairs:l,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:b,topResults:I.length})),y("similar.all.sort-project",()=>(I.sort((k,x)=>x.result.similarity-k.result.similarity||k.order-x.order),I.map(k=>k.result)),()=>({topResults:I.length}))},()=>({minSimilarity:t,limit:i,scope:r,minCallees:s,crossFileOnly:a,scanLimit:o,semantic:c,corpusSize:g,candidateSets:f,candidatePairs:l,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:b}))}function Ln(e,n={}){let{minSimilarity:t=.5,scope:i,minCallees:r=4,crossFileOnly:s=!1,scanLimit:a}=n,o=n.semantic!==!1,c=A(),m=0,g=0,f=0,l=0,u=0,d=0,p=0;return y("similar.all-count",()=>{let C=G(e).calleeIndex({minCallees:r,scope:i,scanLimit:a,semantic:o}),h=C.corpus;m=h.length;let S=n.focusFiles;return y("similar.all-count.pair-scan",()=>{for(let F=0;F<h.length;F+=1){let I=h[F],P=S?.has(I.file)??!1,k=C.weightedMagnitudes[F],x=new Set;for(let M of I.callees){let w=C.candidateIndexesByCallee.get(M);if(w)for(let T of w)T<=F||S&&!P&&!S.has(h[T].file)||x.add(T)}c&&(f+=x.size,x.size>0&&(g+=1));for(let M of x){let w=h[M];if(s&&I.file===w.file){c&&(u+=1);continue}if(ue(I,w)){c&&(d+=1);continue}c&&(l+=1),Me(I,w,C.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:C.medianIdf,magnitudeA:k,magnitudeB:C.weightedMagnitudes[M]})&&(p+=1)}}},()=>({corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:l,crossFileSkips:u,signatureSkips:d,insertedResults:p})),p},()=>({minSimilarity:t,scope:i,minCallees:r,crossFileOnly:s,scanLimit:a,semantic:o,corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:l,crossFileSkips:u,signatureSkips:d,insertedResults:p}))}function ue(e,n){if(e.paramCount<0||n.paramCount<0)return!1;let t=Math.abs(e.paramCount-n.paramCount),i=Math.max(2,Math.ceil(Math.max(e.paramCount,n.paramCount)*.5));return t>i}var me=Q({kind:"source-fingerprints",invalidation:ee("source-fingerprints"),serialize:cn,deserialize:ln});function Ae(e,n,t,i){if(t<=0)return;if(e.length<t){e.push({result:n,order:i});return}let r=0;for(let a=1;a<e.length;a+=1){let o=e[a],c=e[r];(o.result.similarity<c.result.similarity||o.result.similarity===c.result.similarity&&o.order>c.order)&&(r=a)}let s=e[r];n.similarity<=s.result.similarity||(e[r]={result:n,order:i})}var Ee=["ScipDatabase#all","ScipDatabase#get","ScipDatabase#prepare","ScipDatabase#pathExclusionsFor","ScipDatabase#isIgnored","ScipDatabase#symbolNoiseFor","PerDbValue#get","PerDbValue#has",":storage:db:ScipDatabase:all",":storage:db:ScipDatabase:get",":storage:db:ScipDatabase:prepare",":storage:db:ScipDatabase:pathExclusionsFor",":storage:db:ScipDatabase:isIgnored",":storage:db:ScipDatabase:symbolNoiseFor",":storage:per-db-cache:PerDbValue:get",":storage:per-db-cache:PerDbValue:has"];function Be(e,n,t){let i=D(e,n);if(!i)return{kind:"not-callable"};if(!$(i.symbol))return{kind:"not-callable"};let r=new q(e),s=ne(e,i,{semantic:t.semantic,semanticEvidence:ie});return s.semanticIncomplete||s.semanticUnavailable?{kind:"callee-evidence-unusable"}:{kind:"resolved",target:{symbol:i.symbol,file:i.relativePath,callees:ge(s.rows.map(a=>a.symbol)),paramCount:r.callableSignature(i)?.paramCount??-1}}}var ze=z("callee-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),De=z("callee-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function de(e,n){let{minCallees:t,scope:i,excludeSymbol:r,scanLimit:s}=n,a=n.semantic!==!1,o=ze.get(e,()=>new Map),c=`${t}|${i??""}|${s??""}|${a}`,m=!0,g=0,f=0;return y("similar.callee-fingerprints.resolve",()=>{let l=o.get(c);if(m=l!==void 0,l||(l=Oe(e,{minCallees:t,scope:i,scanLimit:s,semantic:a}),o.set(c,l)),g=l.length,r===void 0)return l;let u=l.filter(d=>d.symbol!==r);return f=l.length-u.length,u},()=>({minCallees:t,scope:i,scanLimit:s,semantic:a,cacheHit:m,corpusSize:g,excludeSymbol:r!==void 0,excludedSymbols:f}))}function qe(e,n){let{minCallees:t,scope:i,scanLimit:r}=n,s=n.semantic!==!1,a=De.get(e,()=>new Map),o=`${t}|${i??""}|${r??""}|${s}`,c=!0,m=0,g=0,f=0;return y("similar.callee-index.resolve",()=>{let l=a.get(o);return c=l!==void 0,l||(l=Ne(de(e,{minCallees:t,scope:i,scanLimit:r,semantic:s})),a.set(o,l)),m=l.corpus.length,g=l.docFreq.size,f=l.candidateIndexesByCallee.size,l},()=>({minCallees:t,scope:i,scanLimit:r,semantic:s,cacheHit:c,corpusSize:m,indexedCallees:g,candidateBuckets:f}))}function G(e){return{calleeCorpus:n=>de(e,n),calleeIndex:n=>qe(e,n),sourceCorpus:(n={})=>Ce(e,n),sourceIndex:(n={})=>le(e,n),sourceCandidates:(n,t)=>(t.candidateMode??"full")==="target-pruned"?Qe(e,n,{minSimilarity:t.minSimilarity,scanLimit:t.scanLimit}):Ye(n,le(e,{scanLimit:t.scanLimit}))}}function Ne(e){let n=A(),t=0,i=y("similar.callee-index.doc-frequency",()=>{let l=new Map;for(let u of e)for(let d of u.callees)l.set(d,(l.get(d)??0)+1);return t=l.size,l},()=>({corpusSize:e.length,uniqueCallees:t})),r=Math.max(8,Math.ceil(Math.sqrt(e.length))),s=y("similar.callee-index.idf-weights",()=>V(i,e.length),()=>({corpusSize:e.length,uniqueCallees:i.size})),a=y("similar.callee-index.weighted-magnitudes",()=>e.map(l=>B(l.callees,s)),()=>({corpusSize:e.length})),o=0,c=0,m=0,g=y("similar.callee-index.candidate-buckets",()=>{let l=new Map;for(let u=0;u<e.length;u+=1){let d=e[u];for(let p of d.callees){if((i.get(p)??0)>r){n&&(c+=1);continue}let b=l.get(p);b||(b=[],l.set(p,b)),b.push(u),n&&(o+=1)}}return n&&(m=l.size),l},()=>({corpusSize:e.length,buckets:m,candidateRefs:o,ubiquitousSkips:c,ubiquityThreshold:r})),f=y("similar.callee-index.median-idf",()=>j(s),()=>({uniqueCallees:s.size}));return{corpus:e,candidateIndexesByCallee:g,docFreq:i,idfWeights:s,weightedMagnitudes:a,medianIdf:f,ubiquityThreshold:r}}function Pe(e,n){let t=new Map;for(let i of e.callees)for(let r of n.candidateIndexesByCallee.get(i)??[]){let s=n.corpus[r];s.symbol!==e.symbol&&t.set(s.symbol,s)}return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Oe(e,n){let{minCallees:t,scope:i,scanLimit:r,semantic:s}=n,a=A(),o=new q(e),c=0,m=y("similar.callee-fingerprints.candidates",()=>{let p=_(o.productionCallableDefinitions({scope:i,minLoc:5,sortByLocDesc:typeof r=="number"&&r>0}),r);return c=p.length,p},()=>({scope:i,scanLimit:r,candidateCount:c})),g=0,f=y("similar.callee-fingerprints.callee-map",()=>{let p=o.calleeEvidenceMap(m,{semantic:s});if(a)for(let b of p.rows.values())g+=b.length;return p},()=>({candidateCount:c,semantic:s,calleeEdges:g})),l=0,u=0,d=0;return y("similar.callee-fingerprints.shape",()=>{let b=m.filter(S=>!f.incompleteSymbolIds.has(S.symbolId)&&!f.unavailableSymbolIds.has(S.symbolId)).map(S=>({symbol:S.symbol,file:S.relativePath,callees:ge((f.rows.get(S.symbolId)??[]).map(F=>F.symbol)),paramCount:o.callableSignature(S)?.paramCount??-1})),C=$e(b);a&&(d=C.filter((S,F)=>S.callees.size!==b[F].callees.size).length);let h=C.filter(S=>S.callees.size>=t);return l=h.length,a&&(u=h.reduce((S,F)=>S+F.callees.size,0)),h},()=>({candidateCount:c,fingerprintCount:l,retainedCalleeCount:u,minCallees:t,siblingSaturatedFingerprints:d}))}var fe=5;function $e(e){let n=new Map;for(let t of e){let i=n.get(t.file);i||(i=new Map,n.set(t.file,i));for(let r of t.callees)i.set(r,(i.get(r)??0)+1)}return e.map(t=>{let i=n.get(t.file);if(!i)return t;let r=[...t.callees].filter(a=>(i.get(a)??0)>=fe);if(r.length===0)return t;let s=new Set(t.callees);for(let a of r)s.delete(a);return{...t,callees:s}})}function _e(e,n){let t=new Map;for(let s of n)if(!(s.file!==e.file||s.symbol===e.symbol))for(let a of s.callees)t.set(a,(t.get(a)??0)+1);let i=[...e.callees].filter(s=>(t.get(s)??0)+1>=fe);if(i.length===0)return e;let r=new Set(e.callees);for(let s of i)r.delete(s);return{...e,callees:r}}function ge(e){return new Set([...e].filter(n=>!je(n)))}function je(e){return Ee.some(n=>e.includes(n))}function Ge(e,n,t){let i=Ve(e,n);if(!i||i.tokens.size<3)return[];let r=t.minSimilarity>=.5?t.minSimilarity:.3,s=[],a=t.candidateMode??"full",o=0,c=0,m=0,g=0;return y("similar.source-shape",()=>{let l=G(e).sourceCandidates(i,{minSimilarity:r,scanLimit:t.scanLimit,candidateMode:a});o=l.length;for(let u of l){if(u.symbol===i.symbol||u.tokens.size<3)continue;c+=1;let d=te(i.tokens,u.tokens);if(d.size<2){m+=1;continue}let p=new Set([...i.tokens,...u.tokens]),b=p.size>0?d.size/p.size:0;if(b<r){g+=1;continue}s.push({symbolA:i.symbol,shortNameA:v(i.symbol),fileA:i.file,symbolB:u.symbol,shortNameB:v(u.symbol),fileB:u.file,similarity:b,similarityBasis:"source-tokens",sharedCallees:[...d].sort(),uniqueToA:[...N(i.tokens,u.tokens)].sort(),uniqueToB:[...N(u.tokens,i.tokens)].sort(),...pe([...d],"source-tokens")})}return s.sort((u,d)=>d.similarity-u.similarity||u.shortNameB.localeCompare(d.shortNameB)),s.slice(0,t.limit)},()=>({symbol:i.symbol,file:i.file,targetTokens:i.tokens.size,candidateMode:a,candidates:o,comparedPairs:c,sharedSkips:m,similaritySkips:g,results:s.length}))}function pe(e,n){let t=e.flatMap(W),i=e.flatMap(b=>ae(b,n)),r=Z(t,be),s=Z(t,Se),a=Z(i,X),o=[...new Set(i.filter(oe))],c=e.filter(b=>{let C=ae(b,n);return C.some(h=>X.has(h))&&C.some(oe)}).length,m=[];r.length>0&&m.push(`access/query scaffolding: ${r.slice(0,5).join(", ")}`),s.length>0&&m.push(`framework/generic scaffolding: ${s.slice(0,5).join(", ")}`),a.length>0&&m.push(`domain behavior verbs: ${a.slice(0,5).join(", ")}`),a.length>0&&o.length>0&&m.push(`domain-specific terms: ${o.slice(0,5).join(", ")}`);let g=n==="source-tokens"&&t.length>0&&t.every(b=>ye.has(b));g&&m.push("shared source tokens are generic scaffolding");let f=a.length>0&&o.length>0,l=r.length+s.length>0,u=n==="callees"&&f&&e.length>=4&&o.length>=4&&c>=2,d=u?"domain-behavior":f?l?"mixed":"domain-behavior":r.length>0?"access-query-scaffolding":s.length>0||g?"framework-scaffolding":"structural-overlap";d==="structural-overlap"&&e.length>0&&m.push(`shared ${n} overlap has no recognized domain or scaffolding category`);let p=d==="domain-behavior"&&(e.length>=3||u)?"direct":"signal";return{evidenceClass:d,actionTier:p,evidenceClassReasons:m,recommendation:Ue(d,p)}}function Ue(e,n){return n==="direct"?"Shared domain behavior looks concrete; review for an extract/reuse opportunity.":e==="mixed"?"Shared evidence mixes domain behavior with scaffolding; review semantics before extracting anything.":e==="access-query-scaffolding"?"Shared evidence is mostly access/query scaffolding; compare product semantics before reusing code.":e==="structural-overlap"?"Shared structure has no domain or scaffolding classification; inspect names and behavior before reusing code.":"Shared evidence is mostly framework or generic scaffolding; treat as a contextual signal."}function Z(e,n){return[...new Set(e.filter(t=>n.has(t)))]}function W(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1)}function ae(e,n){if(n==="source-tokens")return W(e);let t=K(e);return W(t.length>0?t:He(e))}function He(e){return e.replace(/[()`]/g," ").replace(/\.[a-z][a-z0-9]+(?=\s|$)/gi," ").split(/[:/\\\s]+/).map(i=>i.trim()).filter(i=>/[A-Za-z]/.test(i)).at(-1)?.replace(/\.$/,"")??e}function oe(e){return e.length>3&&!X.has(e)&&!be.has(e)&&!Se.has(e)&&!ye.has(e)&&!Ke.has(e)}var X=new Set(["archive","assign","book","cancel","create","delete","ensure","export","import","notify","persist","publish","restore","schedule","send","set","submit","sync","update","upload","validate","write"]),be=new Set(["access","auth","authorize","cache","context","db","find","get","guard","list","permission","permissions","prisma","query","request","response","role","route","session","sql","where"]),Se=new Set(["bytes","computed","crypto","describe","effect","expect","fetch","filter","hex","hook","json","map","mounted","on","promise","random","react","reduce","ref","render","state","test","token","trim","uuid","vue","watch"]),ye=new Set(["bytes","crypto","data","false","get","hex","id","key","map","name","num","random","result","secret","set","string","to","token","true","type","value"]),Ke=new Set(["best","backend","conflict","database","effect","effects","error","errors","frontend","found","helpers","javascript","module","modules","scip","shared","source","typescript","utils","with","workflow","workflows"]);function Ve(e,n){let t=D(e,n);if(!t||!$(t.symbol))return null;let i=Ze(e,t);return i?{symbol:t.symbol,file:t.relativePath,tokens:i}:null}function Ze(e,n){let t=K(n.symbol),i=sn(e,n.relativePath,n.startLine,n.endLine,t),r=ke(i,t);return r.size>0?r:null}var We=z("source-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),Xe=z("source-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function he(e){return`${e.scanLimit??""}`}function Ce(e,n={}){let t=We.get(e,()=>new Map),i=he(n),r=t.get(i);return r||(r=rn(e,n),t.set(i,r)),r}function le(e,n={}){let t=Xe.get(e,()=>new Map),i=he(n),r=t.get(i);return r||(r=Je(Ce(e,n)),t.set(i,r)),r}function Je(e){let n=new Map;for(let r of e)for(let s of r.tokens)n.set(s,(n.get(s)??0)+1);let t=Math.max(8,Math.ceil(Math.sqrt(e.length))),i=new Map;for(let r of e)for(let s of r.tokens){if((n.get(s)??0)>t)continue;let a=i.get(s);a||(a=[],i.set(s,a)),a.push(r)}return{corpus:e,candidateByToken:i,docFreq:n,ubiquityThreshold:t}}function Ye(e,n){let t=new Map;for(let i of e.tokens)for(let r of n.candidateByToken.get(i)??[])r.symbol!==e.symbol&&t.set(r.symbol,r);return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Qe(e,n,t){let i=A(),r=new q(e),s=en(n.tokens.size,t.minSimilarity),a=0,o=0,c=0,m=y("similar.source-shape.target-files",()=>{let d=[...n.tokens],p=[];for(let b of Y(e,{includeIgnored:!1})){a+=1;let C=U(e,b);C&&(o+=1,nn(C,d,s)&&p.push(b))}return c=p.length,p},()=>({symbol:n.symbol,targetTokens:n.tokens.size,requiredSharedTokens:s,scannedFiles:a,readableFiles:o,candidateFiles:c})),g=0,f=y("similar.source-shape.target-definitions",()=>{let d=_(r.productionCallableDefinitions({files:m,sortByLocDesc:typeof t.scanLimit=="number"&&t.scanLimit>0}),t.scanLimit);return g=d.length,d},()=>({symbol:n.symbol,candidateFiles:c,scanLimit:t.scanLimit,definitionCount:g})),l=0;return y("similar.source-shape.target-fingerprints",()=>{let d=Fe(e,f);return i&&(l=d.length),d},()=>({symbol:n.symbol,definitionCount:g,fingerprintCount:l})).filter(d=>d.symbol!==n.symbol)}function en(e,n){return Math.max(2,Math.ceil(e*n))}function nn(e,n,t){if(n.length<t)return!1;let i=e.toLowerCase(),r=0;for(let s of n)if(tn(i,s)&&(r+=1,r>=t))return!0;return!1}function tn(e,n){return n==="num"?/\b\d+\b/.test(e):e.includes(n)}function rn(e,n={}){let t=new q(e),{scanLimit:i}=n,r=_(t.productionCallableDefinitions({sortByLocDesc:typeof i=="number"&&i>0}),i);return Fe(e,r)}function Fe(e,n){let t=new Map;for(let r of n){let s=t.get(r.relativePath)??[];s.push(r),t.set(r.relativePath,s)}let i=new Map;for(let[r,s]of t){let a=U(e,r);if(!a)continue;let o=J(e,r,a),c=on(e,r,o),m=!1,g=null;for(let f of s){let l=an(f),u=c.get(l),d=u?new Set(u.tokens):null;d||(g??=H(e,r),d=ke(xe(g,f.startLine,f.endLine,f.leaf),f.leaf),c.set(l,{key:l,symbol:f.symbol,startLine:f.startLine,endLine:f.endLine,leaf:f.leaf,tokens:[...d].sort()}),m=!0),d.size>0&&i.set(f.symbol,{symbol:f.symbol,file:f.relativePath,tokens:d})}m&&un(e,r,o,c)}return n.map(r=>i.get(r.symbol)).filter(r=>!!r)}function sn(e,n,t,i,r){let s=H(e,n);return s.length===0?"":xe(s,t,i,r)}function xe(e,n,t,i){if(t>=n&&t-n<=12)return e.slice(n,t+1).join(`
1
+ import{a as te,b as N,e as V,f as j,g as B,h as re,i as se}from"./chunk-NMTSZXCL.js";import{b as _}from"./chunk-B75HZHUP.js";import{c as q}from"./chunk-HENP2O4A.js";import{a as ie}from"./chunk-6VREELBC.js";import{b as ne}from"./chunk-MSI3K7PJ.js";import{a as D}from"./chunk-SGMNWYTH.js";import{d as v,e as K,h as $}from"./chunk-GVAF222T.js";import{a as E}from"./chunk-F74LZWCE.js";import{a as Y}from"./chunk-ICUL7XRT.js";import{h as z,l as J,t as Q,v as ee,w as U,x as H}from"./chunk-7GAK2F3H.js";import{a as A,d as y}from"./chunk-3LCDIREB.js";function Ie(e,n,t={}){let{minSimilarity:i=.4,limit:r=20}=t,s=()=>Ge(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"}),a=Be(e,n,{semantic:t.semantic!==!1});if(a.kind==="not-callable")return[];if(a.kind==="callee-evidence-unusable")return s();let o=a.target;if(!$(o.symbol))return[];if(o.callees.size===0)return s();let c=we(e,o,i,{scanLimit:t.scanLimit,semantic:t.semantic!==!1});return c.length>0?c.slice(0,r):s()}function Tn(e,n,t,i={}){let r=D(e,n),s=D(e,t);if(!r||!s)return null;let a=Ie(e,r.symbol,{minSimilarity:0,limit:Number.POSITIVE_INFINITY,semantic:i.semantic,scanLimit:i.scanLimit}).find(m=>m.symbolB===s.symbol||m.symbolA===s.symbol);if(!a)return null;let o=r.endLine-r.startLine+1,c=s.endLine-s.startLine+1;return{symbolA:{symbol:r.symbol,shortName:v(r.symbol),file:r.relativePath,loc:o},symbolB:{symbol:s.symbol,shortName:v(s.symbol),file:s.relativePath,loc:c},similarity:a.similarity,similarityBasis:a.similarityBasis??"callees",sharedEvidence:a.sharedCallees,uniqueToA:a.uniqueToA,uniqueToB:a.uniqueToB,evidenceClass:a.evidenceClass,actionTier:a.actionTier,recommendation:a.recommendation,consolidationStrategy:ve(a)}}function ve(e){let n=e.similarityBasis==="source-tokens"?"source-token":"tracked callee";return e.sharedCallees.length===0?`No shared ${n} evidence survived similar's weighting. Inspect the source before attempting consolidation.`:e.uniqueToA.length===0&&e.uniqueToB.length===0?`The functions have identical ${n} evidence under similar's weighting. Verify signatures, guards, and return values before consolidating.`:e.uniqueToA.length===0?`A's ${n} evidence is a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToB.length===0?`B's ${n} evidence is a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToA.length<=2&&e.uniqueToB.length<=2?`Create a shared helper around the ${e.sharedCallees.length} shared ${n}(s). Pass the ${e.uniqueToA.length+e.uniqueToB.length} divergent point(s) as parameters or callbacks.`:`Extract the ${e.sharedCallees.length} shared ${n}(s) into a common helper. Keep each function's unique logic outside that helper (${e.uniqueToA.length} item(s) in A, ${e.uniqueToB.length} in B).`}function we(e,n,t,i){let r=G(e).calleeIndex({minCallees:3,scanLimit:i.scanLimit,semantic:i.semantic}),s=_e(n,r.corpus),a=Pe(s,r),o=Te(s,r),c=j(o),m=B(s.callees,o),g=[];for(let f of a){if(f.callees.size<3)continue;let l=B(f.callees,o),u=ce(s,f,o,{minSimilarity:t,requireSignificantShared:1,requireSharedCount:0,medianIdf:c,magnitudeA:m,magnitudeB:l});u&&g.push(u)}return g.sort((f,l)=>l.similarity-f.similarity),g}function Te(e,n){let t=new Map(n.docFreq);for(let i of e.callees)t.set(i,(t.get(i)??0)+1);return V(t,n.corpus.length+1)}function ce(e,n,t,i){let r=Le(e,n,t,i);if(!Re(r,i))return null;let{similarity:s,significantShared:a,trivialShared:o}=r,c=a.length>0?a:o,m=pe(c,"callees");return{symbolA:e.symbol,shortNameA:v(e.symbol),fileA:e.file,symbolB:n.symbol,shortNameB:v(n.symbol),fileB:n.file,similarity:s,similarityBasis:"callees",sharedCallees:c.map(v),uniqueToA:[...N(e.callees,n.callees)].map(v),uniqueToB:[...N(n.callees,e.callees)].map(v),...m}}function Me(e,n,t,i){let r=i.magnitudeA??B(e.callees,t),s=i.magnitudeB??B(n.callees,t),a=0,o=0,c=0,m=i.medianIdf??j(t);for(let l of e.callees){if(!n.callees.has(l))continue;let u=t.get(l)??0;a+=u*u,c+=1,u>=m&&(o+=1)}if(c===0)return!1;let g=r*s;return(g>0?a/g:0)<i.minSimilarity?!1:o>=i.requireSignificantShared||c>=i.requireSharedCount}function Le(e,n,t,i){return i.magnitudeA===void 0||i.magnitudeB===void 0?re(e.callees,n.callees,t,{medianIdf:i.medianIdf}):se(e.callees,n.callees,t,{medianIdf:i.medianIdf,magnitudeA:i.magnitudeA,magnitudeB:i.magnitudeB})}function Re(e,n){if(e.similarity<n.minSimilarity)return!1;let t=e.significantShared.length+e.trivialShared.length;return e.significantShared.length>=n.requireSignificantShared||t>=n.requireSharedCount}function Mn(e,n={}){let{minSimilarity:t=.5,limit:i=20,scope:r,minCallees:s=4,crossFileOnly:a=!1,scanLimit:o}=n,c=n.semantic!==!1,m=A(),g=0,f=0,l=0,u=0,d=0,p=0,b=0;return y("similar.all",()=>{let h=G(e).calleeIndex({minCallees:s,scope:r,scanLimit:o,semantic:c}),S=h.corpus;g=S.length;let F=n.focusFiles,I=[],P=0;return y("similar.all.pair-scan",()=>{for(let k=0;k<S.length;k+=1){let x=S[k],M=F?.has(x.file)??!1,w=h.weightedMagnitudes[k],T=new Set;for(let O of x.callees){let L=h.candidateIndexesByCallee.get(O);if(L)for(let R of L)R<=k||F&&!M&&!F.has(S[R].file)||T.add(R)}m&&(l+=T.size,T.size>0&&(f+=1));for(let O of T){let L=S[O];if(a&&x.file===L.file){m&&(d+=1);continue}if(ue(x,L)){m&&(p+=1);continue}m&&(u+=1);let R=ce(x,L,h.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:h.medianIdf,magnitudeA:w,magnitudeB:h.weightedMagnitudes[O]});R&&(Ae(I,R,i,P),m&&(b+=1),P+=1)}}},()=>({corpusSize:g,candidateSets:f,candidatePairs:l,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:b,topResults:I.length})),y("similar.all.sort-project",()=>(I.sort((k,x)=>x.result.similarity-k.result.similarity||k.order-x.order),I.map(k=>k.result)),()=>({topResults:I.length}))},()=>({minSimilarity:t,limit:i,scope:r,minCallees:s,crossFileOnly:a,scanLimit:o,semantic:c,corpusSize:g,candidateSets:f,candidatePairs:l,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:b}))}function Ln(e,n={}){let{minSimilarity:t=.5,scope:i,minCallees:r=4,crossFileOnly:s=!1,scanLimit:a}=n,o=n.semantic!==!1,c=A(),m=0,g=0,f=0,l=0,u=0,d=0,p=0;return y("similar.all-count",()=>{let C=G(e).calleeIndex({minCallees:r,scope:i,scanLimit:a,semantic:o}),h=C.corpus;m=h.length;let S=n.focusFiles;return y("similar.all-count.pair-scan",()=>{for(let F=0;F<h.length;F+=1){let I=h[F],P=S?.has(I.file)??!1,k=C.weightedMagnitudes[F],x=new Set;for(let M of I.callees){let w=C.candidateIndexesByCallee.get(M);if(w)for(let T of w)T<=F||S&&!P&&!S.has(h[T].file)||x.add(T)}c&&(f+=x.size,x.size>0&&(g+=1));for(let M of x){let w=h[M];if(s&&I.file===w.file){c&&(u+=1);continue}if(ue(I,w)){c&&(d+=1);continue}c&&(l+=1),Me(I,w,C.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:C.medianIdf,magnitudeA:k,magnitudeB:C.weightedMagnitudes[M]})&&(p+=1)}}},()=>({corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:l,crossFileSkips:u,signatureSkips:d,insertedResults:p})),p},()=>({minSimilarity:t,scope:i,minCallees:r,crossFileOnly:s,scanLimit:a,semantic:o,corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:l,crossFileSkips:u,signatureSkips:d,insertedResults:p}))}function ue(e,n){if(e.paramCount<0||n.paramCount<0)return!1;let t=Math.abs(e.paramCount-n.paramCount),i=Math.max(2,Math.ceil(Math.max(e.paramCount,n.paramCount)*.5));return t>i}var me=Q({kind:"source-fingerprints",invalidation:ee("source-fingerprints"),serialize:cn,deserialize:ln});function Ae(e,n,t,i){if(t<=0)return;if(e.length<t){e.push({result:n,order:i});return}let r=0;for(let a=1;a<e.length;a+=1){let o=e[a],c=e[r];(o.result.similarity<c.result.similarity||o.result.similarity===c.result.similarity&&o.order>c.order)&&(r=a)}let s=e[r];n.similarity<=s.result.similarity||(e[r]={result:n,order:i})}var Ee=["ScipDatabase#all","ScipDatabase#get","ScipDatabase#prepare","ScipDatabase#pathExclusionsFor","ScipDatabase#isIgnored","ScipDatabase#symbolNoiseFor","PerDbValue#get","PerDbValue#has",":storage:db:ScipDatabase:all",":storage:db:ScipDatabase:get",":storage:db:ScipDatabase:prepare",":storage:db:ScipDatabase:pathExclusionsFor",":storage:db:ScipDatabase:isIgnored",":storage:db:ScipDatabase:symbolNoiseFor",":storage:per-db-cache:PerDbValue:get",":storage:per-db-cache:PerDbValue:has"];function Be(e,n,t){let i=D(e,n);if(!i)return{kind:"not-callable"};if(!$(i.symbol))return{kind:"not-callable"};let r=new q(e),s=ne(e,i,{semantic:t.semantic,semanticEvidence:ie});return s.semanticIncomplete||s.semanticUnavailable?{kind:"callee-evidence-unusable"}:{kind:"resolved",target:{symbol:i.symbol,file:i.relativePath,callees:ge(s.rows.map(a=>a.symbol)),paramCount:r.callableSignature(i)?.paramCount??-1}}}var ze=z("callee-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),De=z("callee-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function de(e,n){let{minCallees:t,scope:i,excludeSymbol:r,scanLimit:s}=n,a=n.semantic!==!1,o=ze.get(e,()=>new Map),c=`${t}|${i??""}|${s??""}|${a}`,m=!0,g=0,f=0;return y("similar.callee-fingerprints.resolve",()=>{let l=o.get(c);if(m=l!==void 0,l||(l=Oe(e,{minCallees:t,scope:i,scanLimit:s,semantic:a}),o.set(c,l)),g=l.length,r===void 0)return l;let u=l.filter(d=>d.symbol!==r);return f=l.length-u.length,u},()=>({minCallees:t,scope:i,scanLimit:s,semantic:a,cacheHit:m,corpusSize:g,excludeSymbol:r!==void 0,excludedSymbols:f}))}function qe(e,n){let{minCallees:t,scope:i,scanLimit:r}=n,s=n.semantic!==!1,a=De.get(e,()=>new Map),o=`${t}|${i??""}|${r??""}|${s}`,c=!0,m=0,g=0,f=0;return y("similar.callee-index.resolve",()=>{let l=a.get(o);return c=l!==void 0,l||(l=Ne(de(e,{minCallees:t,scope:i,scanLimit:r,semantic:s})),a.set(o,l)),m=l.corpus.length,g=l.docFreq.size,f=l.candidateIndexesByCallee.size,l},()=>({minCallees:t,scope:i,scanLimit:r,semantic:s,cacheHit:c,corpusSize:m,indexedCallees:g,candidateBuckets:f}))}function G(e){return{calleeCorpus:n=>de(e,n),calleeIndex:n=>qe(e,n),sourceCorpus:(n={})=>Ce(e,n),sourceIndex:(n={})=>le(e,n),sourceCandidates:(n,t)=>(t.candidateMode??"full")==="target-pruned"?Qe(e,n,{minSimilarity:t.minSimilarity,scanLimit:t.scanLimit}):Ye(n,le(e,{scanLimit:t.scanLimit}))}}function Ne(e){let n=A(),t=0,i=y("similar.callee-index.doc-frequency",()=>{let l=new Map;for(let u of e)for(let d of u.callees)l.set(d,(l.get(d)??0)+1);return t=l.size,l},()=>({corpusSize:e.length,uniqueCallees:t})),r=Math.max(8,Math.ceil(Math.sqrt(e.length))),s=y("similar.callee-index.idf-weights",()=>V(i,e.length),()=>({corpusSize:e.length,uniqueCallees:i.size})),a=y("similar.callee-index.weighted-magnitudes",()=>e.map(l=>B(l.callees,s)),()=>({corpusSize:e.length})),o=0,c=0,m=0,g=y("similar.callee-index.candidate-buckets",()=>{let l=new Map;for(let u=0;u<e.length;u+=1){let d=e[u];for(let p of d.callees){if((i.get(p)??0)>r){n&&(c+=1);continue}let b=l.get(p);b||(b=[],l.set(p,b)),b.push(u),n&&(o+=1)}}return n&&(m=l.size),l},()=>({corpusSize:e.length,buckets:m,candidateRefs:o,ubiquitousSkips:c,ubiquityThreshold:r})),f=y("similar.callee-index.median-idf",()=>j(s),()=>({uniqueCallees:s.size}));return{corpus:e,candidateIndexesByCallee:g,docFreq:i,idfWeights:s,weightedMagnitudes:a,medianIdf:f,ubiquityThreshold:r}}function Pe(e,n){let t=new Map;for(let i of e.callees)for(let r of n.candidateIndexesByCallee.get(i)??[]){let s=n.corpus[r];s.symbol!==e.symbol&&t.set(s.symbol,s)}return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Oe(e,n){let{minCallees:t,scope:i,scanLimit:r,semantic:s}=n,a=A(),o=new q(e),c=0,m=y("similar.callee-fingerprints.candidates",()=>{let p=_(o.productionCallableDefinitions({scope:i,minLoc:5,sortByLocDesc:typeof r=="number"&&r>0}),r);return c=p.length,p},()=>({scope:i,scanLimit:r,candidateCount:c})),g=0,f=y("similar.callee-fingerprints.callee-map",()=>{let p=o.calleeEvidenceMap(m,{semantic:s});if(a)for(let b of p.rows.values())g+=b.length;return p},()=>({candidateCount:c,semantic:s,calleeEdges:g})),l=0,u=0,d=0;return y("similar.callee-fingerprints.shape",()=>{let b=m.filter(S=>!f.incompleteSymbolIds.has(S.symbolId)&&!f.unavailableSymbolIds.has(S.symbolId)).map(S=>({symbol:S.symbol,file:S.relativePath,callees:ge((f.rows.get(S.symbolId)??[]).map(F=>F.symbol)),paramCount:o.callableSignature(S)?.paramCount??-1})),C=$e(b);a&&(d=C.filter((S,F)=>S.callees.size!==b[F].callees.size).length);let h=C.filter(S=>S.callees.size>=t);return l=h.length,a&&(u=h.reduce((S,F)=>S+F.callees.size,0)),h},()=>({candidateCount:c,fingerprintCount:l,retainedCalleeCount:u,minCallees:t,siblingSaturatedFingerprints:d}))}var fe=5;function $e(e){let n=new Map;for(let t of e){let i=n.get(t.file);i||(i=new Map,n.set(t.file,i));for(let r of t.callees)i.set(r,(i.get(r)??0)+1)}return e.map(t=>{let i=n.get(t.file);if(!i)return t;let r=[...t.callees].filter(a=>(i.get(a)??0)>=fe);if(r.length===0)return t;let s=new Set(t.callees);for(let a of r)s.delete(a);return{...t,callees:s}})}function _e(e,n){let t=new Map;for(let s of n)if(!(s.file!==e.file||s.symbol===e.symbol))for(let a of s.callees)t.set(a,(t.get(a)??0)+1);let i=[...e.callees].filter(s=>(t.get(s)??0)+1>=fe);if(i.length===0)return e;let r=new Set(e.callees);for(let s of i)r.delete(s);return{...e,callees:r}}function ge(e){return new Set([...e].filter(n=>!je(n)))}function je(e){return Ee.some(n=>e.includes(n))}function Ge(e,n,t){let i=Ve(e,n);if(!i||i.tokens.size<3)return[];let r=t.minSimilarity>=.5?t.minSimilarity:.3,s=[],a=t.candidateMode??"full",o=0,c=0,m=0,g=0;return y("similar.source-shape",()=>{let l=G(e).sourceCandidates(i,{minSimilarity:r,scanLimit:t.scanLimit,candidateMode:a});o=l.length;for(let u of l){if(u.symbol===i.symbol||u.tokens.size<3)continue;c+=1;let d=te(i.tokens,u.tokens);if(d.size<2){m+=1;continue}let p=new Set([...i.tokens,...u.tokens]),b=p.size>0?d.size/p.size:0;if(b<r){g+=1;continue}s.push({symbolA:i.symbol,shortNameA:v(i.symbol),fileA:i.file,symbolB:u.symbol,shortNameB:v(u.symbol),fileB:u.file,similarity:b,similarityBasis:"source-tokens",sharedCallees:[...d].sort(),uniqueToA:[...N(i.tokens,u.tokens)].sort(),uniqueToB:[...N(u.tokens,i.tokens)].sort(),...pe([...d],"source-tokens")})}return s.sort((u,d)=>d.similarity-u.similarity||u.shortNameB.localeCompare(d.shortNameB)),s.slice(0,t.limit)},()=>({symbol:i.symbol,file:i.file,targetTokens:i.tokens.size,candidateMode:a,candidates:o,comparedPairs:c,sharedSkips:m,similaritySkips:g,results:s.length}))}function pe(e,n){let t=e.flatMap(W),i=e.flatMap(b=>ae(b,n)),r=Z(t,be),s=Z(t,Se),a=Z(i,X),o=[...new Set(i.filter(oe))],c=e.filter(b=>{let C=ae(b,n);return C.some(h=>X.has(h))&&C.some(oe)}).length,m=[];r.length>0&&m.push(`access/query scaffolding: ${r.slice(0,5).join(", ")}`),s.length>0&&m.push(`framework/generic scaffolding: ${s.slice(0,5).join(", ")}`),a.length>0&&m.push(`domain behavior verbs: ${a.slice(0,5).join(", ")}`),a.length>0&&o.length>0&&m.push(`domain-specific terms: ${o.slice(0,5).join(", ")}`);let g=n==="source-tokens"&&t.length>0&&t.every(b=>ye.has(b));g&&m.push("shared source tokens are generic scaffolding");let f=a.length>0&&o.length>0,l=r.length+s.length>0,u=n==="callees"&&f&&e.length>=4&&o.length>=4&&c>=2,d=u?"domain-behavior":f?l?"mixed":"domain-behavior":r.length>0?"access-query-scaffolding":s.length>0||g?"framework-scaffolding":"structural-overlap";d==="structural-overlap"&&e.length>0&&m.push(`shared ${n} overlap has no recognized domain or scaffolding category`);let p=d==="domain-behavior"&&(e.length>=3||u)?"direct":"signal";return{evidenceClass:d,actionTier:p,evidenceClassReasons:m,recommendation:Ue(d,p)}}function Ue(e,n){return n==="direct"?"Shared domain behavior looks concrete; review for an extract/reuse opportunity.":e==="mixed"?"Shared evidence mixes domain behavior with scaffolding; review semantics before extracting anything.":e==="access-query-scaffolding"?"Shared evidence is mostly access/query scaffolding; compare product semantics before reusing code.":e==="structural-overlap"?"Shared structure has no domain or scaffolding classification; inspect names and behavior before reusing code.":"Shared evidence is mostly framework or generic scaffolding; treat as a contextual signal."}function Z(e,n){return[...new Set(e.filter(t=>n.has(t)))]}function W(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1)}function ae(e,n){if(n==="source-tokens")return W(e);let t=K(e);return W(t.length>0?t:He(e))}function He(e){return e.replace(/[()`]/g," ").replace(/\.[a-z][a-z0-9]+(?=\s|$)/gi," ").split(/[:/\\\s]+/).map(i=>i.trim()).filter(i=>/[A-Za-z]/.test(i)).at(-1)?.replace(/\.$/,"")??e}function oe(e){return e.length>3&&!X.has(e)&&!be.has(e)&&!Se.has(e)&&!ye.has(e)&&!Ke.has(e)}var X=new Set(["archive","assign","book","cancel","create","delete","ensure","export","import","notify","persist","publish","restore","schedule","send","set","submit","sync","update","upload","validate","write"]),be=new Set(["access","auth","authorize","cache","context","db","find","get","guard","list","permission","permissions","prisma","query","request","response","role","route","session","sql","where"]),Se=new Set(["bytes","computed","crypto","describe","effect","expect","fetch","filter","hex","hook","json","map","mounted","on","promise","random","react","reduce","ref","render","state","test","token","trim","uuid","vue","watch"]),ye=new Set(["bytes","crypto","data","false","get","hex","id","key","map","name","num","random","result","secret","set","string","to","token","true","type","value"]),Ke=new Set(["best","backend","conflict","database","effect","effects","error","errors","frontend","found","helpers","javascript","module","modules","scip","shared","source","typescript","utils","with","workflow","workflows"]);function Ve(e,n){let t=D(e,n);if(!t||!$(t.symbol))return null;let i=Ze(e,t);return i?{symbol:t.symbol,file:t.relativePath,tokens:i}:null}function Ze(e,n){let t=K(n.symbol),i=sn(e,n.relativePath,n.startLine,n.endLine,t),r=ke(i,t);return r.size>0?r:null}var We=z("source-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),Xe=z("source-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function he(e){return`${e.scanLimit??""}`}function Ce(e,n={}){let t=We.get(e,()=>new Map),i=he(n),r=t.get(i);return r||(r=rn(e,n),t.set(i,r)),r}function le(e,n={}){let t=Xe.get(e,()=>new Map),i=he(n),r=t.get(i);return r||(r=Je(Ce(e,n)),t.set(i,r)),r}function Je(e){let n=new Map;for(let r of e)for(let s of r.tokens)n.set(s,(n.get(s)??0)+1);let t=Math.max(8,Math.ceil(Math.sqrt(e.length))),i=new Map;for(let r of e)for(let s of r.tokens){if((n.get(s)??0)>t)continue;let a=i.get(s);a||(a=[],i.set(s,a)),a.push(r)}return{corpus:e,candidateByToken:i,docFreq:n,ubiquityThreshold:t}}function Ye(e,n){let t=new Map;for(let i of e.tokens)for(let r of n.candidateByToken.get(i)??[])r.symbol!==e.symbol&&t.set(r.symbol,r);return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Qe(e,n,t){let i=A(),r=new q(e),s=en(n.tokens.size,t.minSimilarity),a=0,o=0,c=0,m=y("similar.source-shape.target-files",()=>{let d=[...n.tokens],p=[];for(let b of Y(e,{includeIgnored:!1})){a+=1;let C=U(e,b);C&&(o+=1,nn(C,d,s)&&p.push(b))}return c=p.length,p},()=>({symbol:n.symbol,targetTokens:n.tokens.size,requiredSharedTokens:s,scannedFiles:a,readableFiles:o,candidateFiles:c})),g=0,f=y("similar.source-shape.target-definitions",()=>{let d=_(r.productionCallableDefinitions({files:m,sortByLocDesc:typeof t.scanLimit=="number"&&t.scanLimit>0}),t.scanLimit);return g=d.length,d},()=>({symbol:n.symbol,candidateFiles:c,scanLimit:t.scanLimit,definitionCount:g})),l=0;return y("similar.source-shape.target-fingerprints",()=>{let d=Fe(e,f);return i&&(l=d.length),d},()=>({symbol:n.symbol,definitionCount:g,fingerprintCount:l})).filter(d=>d.symbol!==n.symbol)}function en(e,n){return Math.max(2,Math.ceil(e*n))}function nn(e,n,t){if(n.length<t)return!1;let i=e.toLowerCase(),r=0;for(let s of n)if(tn(i,s)&&(r+=1,r>=t))return!0;return!1}function tn(e,n){return n==="num"?/\b\d+\b/.test(e):e.includes(n)}function rn(e,n={}){let t=new q(e),{scanLimit:i}=n,r=_(t.productionCallableDefinitions({sortByLocDesc:typeof i=="number"&&i>0}),i);return Fe(e,r)}function Fe(e,n){let t=new Map;for(let r of n){let s=t.get(r.relativePath)??[];s.push(r),t.set(r.relativePath,s)}let i=new Map;for(let[r,s]of t){let a=U(e,r);if(!a)continue;let o=J(e,r,a),c=on(e,r,o),m=!1,g=null;for(let f of s){let l=an(f),u=c.get(l),d=u?new Set(u.tokens):null;d||(g??=H(e,r),d=ke(xe(g,f.startLine,f.endLine,f.leaf),f.leaf),c.set(l,{key:l,symbol:f.symbol,startLine:f.startLine,endLine:f.endLine,leaf:f.leaf,tokens:[...d].sort()}),m=!0),d.size>0&&i.set(f.symbol,{symbol:f.symbol,file:f.relativePath,tokens:d})}m&&un(e,r,o,c)}return n.map(r=>i.get(r.symbol)).filter(r=>!!r)}function sn(e,n,t,i,r){let s=H(e,n);return s.length===0?"":xe(s,t,i,r)}function xe(e,n,t,i){if(t>=n&&t-n<=12)return e.slice(n,t+1).join(`
2
2
  `);let r=[new RegExp(`\\bdef\\s+${E(i)}\\b`),new RegExp(`\\bfun\\s+${E(i)}\\b`),new RegExp(`\\bfn\\s+${E(i)}\\b`),new RegExp(`\\bfunction\\s+${E(i)}\\b`),new RegExp(`\\b${E(i)}\\s*\\(`)],s=e.findIndex(a=>r.some(o=>o.test(a)));if(s>=0){let a=s;for(let o=s+1;o<e.length&&o<=s+8;o++){let c=e[o]??"";if(o>s&&dn(c)||(a=o,c.trim()===""&&o>s+1))break}return e.slice(s,a+1).join(`
3
3
  `)}return e.slice(n,Math.min(e.length,n+8)).join(`
4
4
  `)}function an(e){return`${e.symbol}\0${e.startLine}\0${e.endLine}\0${e.leaf}`}function on(e,n,t){return me.read(e,n,t)??new Map}function ln(e){try{let n=JSON.parse(e);if(!Array.isArray(n.entries))return null;let t=new Map;for(let i of n.entries){if(!i||typeof i.key!="string"||typeof i.symbol!="string"||typeof i.startLine!="number"||typeof i.endLine!="number"||typeof i.leaf!="string"||!Array.isArray(i.tokens)||!i.tokens.every(r=>typeof r=="string"))return null;t.set(i.key,i)}return t}catch{return null}}function cn(e){let n={entries:[...e.values()].sort((t,i)=>t.key.localeCompare(i.key))};return JSON.stringify(n)}function un(e,n,t,i){me.write(e,n,t,new Map(i))}function ke(e,n){if(!e)return new Set;let t=new Set(["public","private","protected","final","static","class","def","fun","fn","function","return","string","bool","boolean","void","unit","self","this","new","const","let","var","end","pub"]),i=mn(n),s=e.replace(/["'`]/g," ").replace(/\b\d+\b/g," NUM ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9_]+/g," ").replace(/_/g," ").toLowerCase().split(/\s+/).map(a=>a.trim()).filter(a=>a.length>1).filter(a=>!t.has(a)).filter(a=>!i.has(a));return new Set(s)}function mn(e){return new Set(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(n=>n.toLowerCase()).filter(n=>n.length>1))}function dn(e){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(e)}export{Ie as a,Tn as b,Te as c,ce as d,Mn as e,Ln as f,Ae as g,de as h,qe as i,G as j,Ne as k,Pe as l,fe as m,$e as n,ge as o,pe as p};
5
- //# sourceMappingURL=chunk-A7XQT7MH.js.map
5
+ //# sourceMappingURL=chunk-36JC5BG2.js.map
@@ -1,4 +1,4 @@
1
- import{m as u,r as p,t as h}from"./chunk-6ZV5EDUT.js";import{a as c,e as d}from"./chunk-PLZXWZHY.js";import{h as l}from"./chunk-327YK6TB.js";import b from"better-sqlite3";var f=["busy_timeout = 5000","query_only = ON","temp_store = MEMORY","cache_size = -64000","mmap_size = 268435456"],i=class{constructor(t,e){this.connection=t;this.releaseGenerationReader=e}connection;releaseGenerationReader;active=!0;initialize(t){try{for(let e of f)this.connection.pragma(e);t(this.connection)}catch(e){try{this.close()}catch(n){throw new AggregateError([e,n],"SQLite initialization and rollback both failed.",{cause:n})}throw e}}close(){if(!this.active)return;this.active=!1;let t,e;try{this.connection.close()}catch(n){t=n}try{this.releaseGenerationReader()}catch(n){e=n}if(t!==void 0&&e!==void 0)throw new AggregateError([t,e],"SQLite connection close and generation-reader release both failed.");if(t!==void 0)throw t;if(e!==void 0)throw e}},g=["node_modules",".git","dist","build","out","coverage","target",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs",".codebaseiq-cache","__pycache__",".venv","venv"],m=class{db;config;generation;pathFilter;connection;connectionOwnership;statementCache=new Map;closed=!1;constructor(t,e){this.config=t,this.pathFilter=e??null;let n=S(t),o=new i(n.db,n.release);try{o.initialize(E),this.generation=n.generation,this.connection=n.db,this.connectionOwnership=o,this.db=w(n.db)}catch(r){try{o.close()}catch(s){throw new AggregateError([r,s],"SQLite construction and rollback both failed.",{cause:s})}throw r}}isIgnored(t){return this.pathFilter?.isIgnored(t)??!1}get localSymbolPredicate(){return`(
1
+ import{m as u,r as p,t as h}from"./chunk-SMDIEDM4.js";import{a as c,e as d}from"./chunk-7GAK2F3H.js";import{h as l}from"./chunk-UC2FD2PS.js";import b from"better-sqlite3";var f=["busy_timeout = 5000","query_only = ON","temp_store = MEMORY","cache_size = -64000","mmap_size = 268435456"],i=class{constructor(t,e){this.connection=t;this.releaseGenerationReader=e}connection;releaseGenerationReader;active=!0;initialize(t){try{for(let e of f)this.connection.pragma(e);t(this.connection)}catch(e){try{this.close()}catch(n){throw new AggregateError([e,n],"SQLite initialization and rollback both failed.",{cause:n})}throw e}}close(){if(!this.active)return;this.active=!1;let t,e;try{this.connection.close()}catch(n){t=n}try{this.releaseGenerationReader()}catch(n){e=n}if(t!==void 0&&e!==void 0)throw new AggregateError([t,e],"SQLite connection close and generation-reader release both failed.");if(t!==void 0)throw t;if(e!==void 0)throw e}},g=["node_modules",".git","dist","build","out","coverage","target",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs",".codebaseiq-cache","__pycache__",".venv","venv"],m=class{db;config;generation;pathFilter;connection;connectionOwnership;statementCache=new Map;closed=!1;constructor(t,e){this.config=t,this.pathFilter=e??null;let n=S(t),o=new i(n.db,n.release);try{o.initialize(E),this.generation=n.generation,this.connection=n.db,this.connectionOwnership=o,this.db=w(n.db)}catch(r){try{o.close()}catch(s){throw new AggregateError([r,s],"SQLite construction and rollback both failed.",{cause:s})}throw r}}isIgnored(t){return this.pathFilter?.isIgnored(t)??!1}get localSymbolPredicate(){return`(
2
2
  EXISTS (
3
3
  SELECT 1
4
4
  FROM defn_enclosing_ranges local_der
@@ -17,4 +17,4 @@ import{m as u,r as p,t as h}from"./chunk-6ZV5EDUT.js";import{a as c,e as d}from"
17
17
  )
18
18
  )`}get pathExclusions(){return this.pathExclusionsFor("d")}get symbolNoise(){return this.symbolNoiseFor("gs")}pathExclusionsFor(...t){return t.flatMap(e=>g.flatMap(n=>[`AND ${e}.relative_path NOT LIKE '${n}/%'`,`AND ${e}.relative_path NOT LIKE '%/${n}/%'`])).join(`
19
19
  `)}symbolNoiseFor(t){return`AND ${t}.symbol NOT LIKE '%().(%' AND ${t}.symbol NOT LIKE '%typeLiteral%'`}all(t,...e){return this.statement(t).all(...e)}get(t,...e){return this.statement(t).get(...e)}close(){if(this.closed)return;this.closed=!0,this.statementCache.clear();let t,e;try{d(this)}catch(n){t=n}try{this.connectionOwnership.close()}catch(n){e=n}if(t!==void 0&&e!==void 0)throw new AggregateError([t,e],"Database-owned resource and SQLite connection cleanup both failed.");if(t!==void 0)throw t;if(e!==void 0)throw e}statement(t){let e=this.statementCache.get(t);return e||(e=this.connection.prepare(t),this.statementCache.set(t,e)),e}};function w(a){return Object.freeze({prepare(t){let e=a.prepare(t);if(!e.readonly||!e.reader)throw new Error("ScipDatabase.db only permits read-only statements that return rows.");return y(e)}})}function y(a){let t={get:(...e)=>a.get(...e),all:(...e)=>a.all(...e),iterate:(...e)=>a.iterate(...e),pluck(e){return e===void 0?a.pluck():a.pluck(e),t},expand(e){return e===void 0?a.expand():a.expand(e),t},raw(e){return e===void 0?a.raw():a.raw(e),t},bind(...e){return a.bind(...e),t},columns:()=>a.columns(),safeIntegers(e){return e===void 0?a.safeIntegers():a.safeIntegers(e),t}};return Object.freeze(t)}function E(a){if(!a.prepare("SELECT 1 AS present FROM sqlite_master WHERE type = 'table' AND name = 'documents'").get())return;let e=a.prepare("SELECT relative_path FROM documents").iterate();for(let n of e)l(n.relative_path)}function S(a){for(let t=0;t<4;t+=1){let e=u(a),n=e.generation,o;try{o=new b(c(n.databasePath),{readonly:!0,fileMustExist:!0})}catch(r){throw e.release(),r}if(n.source==="immutable")return{db:o,generation:n,release:e.release};try{let r=p(a);if(n.databaseFileIdentity===h(n.databasePath)&&r.source==="legacy"&&r.identity===n.identity&&r.databaseFileIdentity===n.databaseFileIdentity&&r.metadataRaw===n.metadataRaw)return{db:o,generation:n,release:e.release}}catch(r){throw o.close(),e.release(),r}o.close(),e.release()}throw new Error("SQLite index publication changed repeatedly while opening a coherent generation.")}export{m as a};
20
- //# sourceMappingURL=chunk-RRPK327J.js.map
20
+ //# sourceMappingURL=chunk-3RR2K7EZ.js.map
@@ -1,2 +1,2 @@
1
- import{a as P}from"./chunk-JXHLB7TP.js";import{a as d}from"./chunk-GXVDTHFC.js";import{a as y}from"./chunk-DGXRDLV5.js";import{a as v}from"./chunk-B75HZHUP.js";import{c as b}from"./chunk-NK76RSB6.js";import{a as p}from"./chunk-BGBBVSH4.js";import{a as g,h}from"./chunk-JN5LIBT3.js";import{d as c,h as u}from"./chunk-AM5SUGHF.js";import{h as f,i as m}from"./chunk-JOALNFY3.js";import{basename as x,extname as S}from"path";function z(i,e){let{scope:r,maxLoc:n=15,limit:o=30,scanLimit:l}=e??{},a=new b(i);return y({candidates:()=>E(i,a,r,n),orderCandidates:v,scanLimit:l,profile:{name:"passthrough-candidates"},prepare:t=>a.calleeEvidenceMap(t,{semantic:e?.semantic!==!1}),evaluate:(t,s)=>s.incompleteSymbolIds.has(t.symbolId)||s.unavailableSymbolIds.has(t.symbolId)?null:L(i,t,s.rows.get(t.symbolId)??[]),orderResults:(t,s)=>t.loc-s.loc||t.file.localeCompare(s.file),limit:o})}function L(i,e,r){let n=C(r);if(n.size!==1||!f(i,e.relativePath,e.startLine,e.endLine))return null;let[,o]=[...n.entries()][0],l=I(i,e,o),a=T(i,e),t=l.length>0||a.length>0?"signal":"direct";return{symbol:e.symbol,shortName:c(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:p(e),forwardsTo:o.symbol,forwardsToShort:c(o.symbol),forwardsToFile:o.file,actionTier:t,boundaryEvidence:l,publicFacadeEvidence:a,recommendation:D(t,l,a)}}function I(i,e,r){return P(i,e.relativePath,e.startLine,"passthrough","explicit ignore-passthrough comment",[{label:"passthrough name",value:c(e.symbol)},{label:"callee name",value:c(r.symbol)},{label:"passthrough module",value:x(e.relativePath,S(e.relativePath))},{label:"callee module",value:x(r.file,S(r.file))}])}function D(i,e,r){if(i==="signal"){if(r.length>0)return`Review the public API before inlining; public-facade evidence: ${r.slice(0,2).join("; ")}.`;let n=e.filter(w);return n.length>0?`Review the public API before inlining; public-surface evidence: ${n.slice(0,2).join("; ")}.`:`Review the boundary before inlining; boundary evidence: ${e.slice(0,2).join("; ")}.`}return"Inline or remove this passthrough unless an external API or runtime registration depends on the forwarding name."}function T(i,e){return d(i,e)?g(i,e.relativePath)?["exported passthrough is declared on the package public surface"]:h(i,e.symbol,e.relativePath)?["exported passthrough matches configured or framework public entry surface"]:[]:[]}function w(i){return i.includes("public surface")}function C(i){let e=i.some(n=>u(n.symbol))?i.filter(n=>u(n.symbol)):i,r=new Map;for(let n of e)r.has(n.symbol)||r.set(n.symbol,n);return r}function E(i,e,r,n){return e.productionCallableDefinitions({scope:r,minLoc:3,maxLoc:n,requireFunctionLikeSymbol:!0,excludeRustTraitImplMembers:!0}).filter(o=>!m(i,o))}export{z as a};
2
- //# sourceMappingURL=chunk-3NUZVLR7.js.map
1
+ import{a as P}from"./chunk-QMOZZ2VX.js";import{a as d}from"./chunk-U7NUXDQO.js";import{a as y}from"./chunk-DGXRDLV5.js";import{a as v}from"./chunk-B75HZHUP.js";import{c as b}from"./chunk-HENP2O4A.js";import{a as p}from"./chunk-BGBBVSH4.js";import{a as g,h}from"./chunk-NDKOVQFG.js";import{d as c,h as u}from"./chunk-GVAF222T.js";import{h as f,i as m}from"./chunk-F74LZWCE.js";import{basename as x,extname as S}from"path";function z(i,e){let{scope:r,maxLoc:n=15,limit:o=30,scanLimit:l}=e??{},a=new b(i);return y({candidates:()=>E(i,a,r,n),orderCandidates:v,scanLimit:l,profile:{name:"passthrough-candidates"},prepare:t=>a.calleeEvidenceMap(t,{semantic:e?.semantic!==!1}),evaluate:(t,s)=>s.incompleteSymbolIds.has(t.symbolId)||s.unavailableSymbolIds.has(t.symbolId)?null:L(i,t,s.rows.get(t.symbolId)??[]),orderResults:(t,s)=>t.loc-s.loc||t.file.localeCompare(s.file),limit:o})}function L(i,e,r){let n=C(r);if(n.size!==1||!f(i,e.relativePath,e.startLine,e.endLine))return null;let[,o]=[...n.entries()][0],l=I(i,e,o),a=T(i,e),t=l.length>0||a.length>0?"signal":"direct";return{symbol:e.symbol,shortName:c(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:p(e),forwardsTo:o.symbol,forwardsToShort:c(o.symbol),forwardsToFile:o.file,actionTier:t,boundaryEvidence:l,publicFacadeEvidence:a,recommendation:D(t,l,a)}}function I(i,e,r){return P(i,e.relativePath,e.startLine,"passthrough","explicit ignore-passthrough comment",[{label:"passthrough name",value:c(e.symbol)},{label:"callee name",value:c(r.symbol)},{label:"passthrough module",value:x(e.relativePath,S(e.relativePath))},{label:"callee module",value:x(r.file,S(r.file))}])}function D(i,e,r){if(i==="signal"){if(r.length>0)return`Review the public API before inlining; public-facade evidence: ${r.slice(0,2).join("; ")}.`;let n=e.filter(w);return n.length>0?`Review the public API before inlining; public-surface evidence: ${n.slice(0,2).join("; ")}.`:`Review the boundary before inlining; boundary evidence: ${e.slice(0,2).join("; ")}.`}return"Inline or remove this passthrough unless an external API or runtime registration depends on the forwarding name."}function T(i,e){return d(i,e)?g(i,e.relativePath)?["exported passthrough is declared on the package public surface"]:h(i,e.symbol,e.relativePath)?["exported passthrough matches configured or framework public entry surface"]:[]:[]}function w(i){return i.includes("public surface")}function C(i){let e=i.some(n=>u(n.symbol))?i.filter(n=>u(n.symbol)):i,r=new Map;for(let n of e)r.has(n.symbol)||r.set(n.symbol,n);return r}function E(i,e,r,n){return e.productionCallableDefinitions({scope:r,minLoc:3,maxLoc:n,requireFunctionLikeSymbol:!0,excludeRustTraitImplMembers:!0}).filter(o=>!m(i,o))}export{z as a};
2
+ //# sourceMappingURL=chunk-3RSBGWGL.js.map
@@ -1,2 +1,2 @@
1
- import{t as c}from"./chunk-AM5SUGHF.js";import{o as a}from"./chunk-JOALNFY3.js";var D=4;function m(e,i,t,r={}){return p(e,i,t,r.maxReexportDepth??D,0,new Set)}function p(e,i,t,r,s,o){let f=`${i}\0${t}`;if(o.has(f)||s>r)return[];o.add(f);let u=c(e,i).filter(n=>n.leaf===t);return u.length>0?u:a(e,i).flatMap(n=>n.sourcePath?n.kind==="named"&&!n.names.includes(t)?[]:p(e,n.sourcePath,t,r,s+1,new Set(o)):[])}export{m as a};
2
- //# sourceMappingURL=chunk-MTMF4N7F.js.map
1
+ import{t as c}from"./chunk-GVAF222T.js";import{o as a}from"./chunk-F74LZWCE.js";var D=4;function m(e,i,t,r={}){return p(e,i,t,r.maxReexportDepth??D,0,new Set)}function p(e,i,t,r,s,o){let f=`${i}\0${t}`;if(o.has(f)||s>r)return[];o.add(f);let u=c(e,i).filter(n=>n.leaf===t);return u.length>0?u:a(e,i).flatMap(n=>n.sourcePath?n.kind==="named"&&!n.names.includes(t)?[]:p(e,n.sourcePath,t,r,s+1,new Set(o)):[])}export{m as a};
2
+ //# sourceMappingURL=chunk-3VJ3OCRE.js.map
@@ -1,2 +1,2 @@
1
- import{d as F,f as w}from"./chunk-XYLV727H.js";import{u as S,v as D,x as b,y as E}from"./chunk-ACZDU5GK.js";import{h as m}from"./chunk-4O52YNKL.js";import{createHash as V}from"crypto";import{dirname as B,join as A}from"path";var T=4,z=3,L=2,$="typescript-index";function ne(t){let e=A(t,$),r=D(e);return{...r,requestDir:r.legacyRequestDir}}function ie(t){let e=JSON.parse(t),r=e.protocolVersion,n=r===L,i=r===z;if(!n&&!i&&r!==T||typeof e.id!="string"||!e.id||typeof e.baseGeneration!="string"||!e.baseGeneration||typeof e.deadlineAtMs!="number"||!Number.isFinite(e.deadlineAtMs)||!U(e.request)||!n&&(e.mailboxVersion!==S||typeof e.operationKey!="string"||!/^[a-f0-9]{64}$/.test(e.operationKey)||e.id!==E(e.operationKey)||typeof e.clientId!="string"||!e.clientId||typeof e.enqueuedAtMs!="number"||!Number.isFinite(e.enqueuedAtMs)||e.deadlineAtMs<e.enqueuedAtMs))throw new Error("TypeScript index service received an invalid mailbox request.");if(!n){let s=e,p=b(i?"typescript-index-v3":"typescript-index-v4",{baseGeneration:s.baseGeneration,request:s.request});if(s.operationKey!==p)throw new Error("TypeScript index service received a mismatched mailbox operation identity.");return{...s,protocolVersion:T}}let o=b("typescript-index-v2",{id:e.id,baseGeneration:e.baseGeneration,request:e.request});return{protocolVersion:T,mailboxVersion:S,id:e.id,operationKey:o,clientId:"legacy-v2",enqueuedAtMs:e.deadlineAtMs,deadlineAtMs:e.deadlineAtMs,baseGeneration:e.baseGeneration,request:e.request}}function oe(t){try{let e=w(F(m(A(B(t),"meta.json"),"reindex metadata")));return e?V("sha256").update(e).digest("hex"):null}catch{return null}}function U(t){if(!t||typeof t!="object")return!1;let e=t,r=C(e.modifiedFiles)?e.modifiedFiles:null,n=C(e.affectedFiles)?e.affectedFiles:null;return e.kind==="emit-documents"&&typeof e.tsconfigPath=="string"&&!!e.tsconfigPath&&typeof e.projectArgument=="string"&&!!e.projectArgument&&typeof e.projectIdentity=="string"&&!!e.projectIdentity&&typeof e.producerIdentity=="string"&&!!e.producerIdentity&&r!==null&&r.length>0&&new Set(r).size===r.length&&n!==null&&n.length>0&&new Set(n).size===n.length}function C(t){return Array.isArray(t)&&t.every(e=>typeof e=="string"&&e.length>0)}import{createRequire as G}from"module";import{dirname as R,isAbsolute as Y,relative as _,resolve as d,sep as v}from"path";var l=G(import.meta.url),H=1,M="0.4.0";function X(){try{let t=j();if(!t.available)return t;let{packageRoot:e}=t,r=l.resolve("typescript",{paths:[e]}),n=l(r),{FileIndexer:i}=l(d(e,"dist/src/FileIndexer.js")),{Input:o}=l(d(e,"dist/src/Input.js")),{Packages:s}=l(d(e,"dist/src/Packages.js")),p=l(d(e,"dist/src/scip.js"));if(!i||!o||!s||!p.scip?.Document||!p.scip.Index)return{available:!1,reason:"scip-typescript document runtime has an unsupported module shape"};let c={packageVersion:t.packageVersion,typescript:n,Document:p.scip.Document,Index:p.scip.Index,FileIndexer:i,Input:o,Packages:s};return{available:!0,runtime:c,producerIdentity:k(c)}}catch(t){return{available:!1,reason:`scip-typescript document runtime unavailable: ${t instanceof Error?t.message:String(t)}`}}}function ue(){let t=j();return t.available?{available:!0,packageVersion:t.packageVersion,typescriptVersion:t.typescriptVersion,producerIdentity:t.producerIdentity}:t}function j(){try{let t=l.resolve("@sourcegraph/scip-typescript/package.json"),e=JSON.parse(m(t,"scip-typescript package manifest"));if(e.version!==M)return{available:!1,reason:`unsupported scip-typescript version ${String(e.version??"unknown")}; expected ${M}`};let r=R(t),n=l.resolve("typescript/package.json",{paths:[r]}),i=JSON.parse(m(n,"TypeScript package manifest"));return typeof i.version!="string"||!i.version?{available:!1,reason:"scip-typescript TypeScript compiler version is unavailable"}:{available:!0,packageRoot:r,packageVersion:e.version,typescriptVersion:i.version,producerIdentity:q(e.version,i.version)}}catch(t){return{available:!1,reason:`scip-typescript document producer unavailable: ${t instanceof Error?t.message:String(t)}`}}}function le(t){let e=t.runtime===void 0?X():t.runtime===null?{available:!1,reason:"scip-typescript document runtime unavailable"}:{available:!0,runtime:t.runtime,producerIdentity:k(t.runtime)};return e.available?{available:!0,emitter:new x(t,e.runtime)}:e}var x=class{producerIdentity;workspaceRoot;tsconfigPath;projectRoot;maxFileByteSize;runtime;host;config=null;includedFiles=new Set;program=null;checker=null;symbolTable=new Map;constructorTable=new Map;packages;fragments=new Map;stats={initializations:0,programUpdates:0,documentsEmitted:0,documentsRemoved:0,sourceNodesReused:0,sourceNodesReplaced:0,symbolEntriesPruned:0};constructor(e,r){this.workspaceRoot=d(e.workspaceRoot),this.tsconfigPath=d(this.workspaceRoot,e.tsconfigPath),this.projectRoot=e.projectRoot??J(this.workspaceRoot,R(this.tsconfigPath)),this.maxFileByteSize=e.maxFileByteSize??1024*1024,this.runtime=r,this.producerIdentity=k(r);let n=N(r.typescript,this.tsconfigPath);this.config=n,this.host=new I(r.typescript,n.options,this.workspaceRoot),this.packages=new r.Packages(this.projectRoot)}initialize(){let e=performance.now(),r=this.config??N(this.runtime.typescript,this.tsconfigPath);this.includedFiles=new Set(r.fileNames.map(g)),this.program=this.runtime.typescript.createProgram(r.fileNames,r.options,this.host.compilerHost),this.checker=this.program.getTypeChecker(),this.stats.initializations+=1;let n=[];for(let i of this.program.getSourceFiles())this.includedFiles.has(g(i.fileName))&&n.push(this.emitSourceFile(i));return this.result(n,e)}advance(e){if(!this.program||!this.checker||!this.config)return this.initializeAndAdvance(e);let r=performance.now(),n=f(e.modifiedFiles),i=f(e.affectedFiles);this.validateIncrementalPaths(n,i);let o=this.program,s=new Map;for(let c of n){let u=y(this.workspaceRoot,c),a=o.getSourceFile(u);if(!a)throw new Error(`modified TypeScript source is unavailable: ${c}`);s.set(c,a),this.stats.symbolEntriesPruned+=O(this.symbolTable,a),this.stats.symbolEntriesPruned+=O(this.constructorTable,a),this.host.invalidate(u)}this.program=this.runtime.typescript.createProgram(this.config.fileNames,this.config.options,this.host.compilerHost,o),this.checker=this.program.getTypeChecker(),this.stats.programUpdates+=1;for(let[c,u]of s)this.program.getSourceFile(y(this.workspaceRoot,c))===u?this.stats.sourceNodesReused+=1:this.stats.sourceNodesReplaced+=1;let p=i.map(c=>{let u=y(this.workspaceRoot,c),a=this.program.getSourceFile(u);if(!a)throw new Error(`affected TypeScript source is unavailable: ${c}`);return this.emitSourceFile(a)});return this.result(p,r)}fragment(e){return this.fragments.get(h(e))??null}snapshotStats(){return{...this.stats}}initializeAndAdvance(e){let r=this.initialize(),n=f(e.modifiedFiles),i=f(e.affectedFiles);this.validateIncrementalPaths(n,i);let o=new Set(i);return{...r,fragments:r.fragments.filter(s=>o.has(s.relativePath))}}validateIncrementalPaths(e,r){if(e.length===0)throw new Error("incremental TypeScript document update requires a modified file");if(r.length===0)throw new Error("incremental TypeScript document update requires an affected file");for(let n of e){let i=y(this.workspaceRoot,n);if(!this.program?.getSourceFile(i))throw new Error(`modified TypeScript dependency is unavailable to the configured project: ${n}`)}for(let n of r){let i=y(this.workspaceRoot,n);if(!this.includedFiles.has(g(i)))throw new Error(`affected TypeScript file is outside the configured project: ${n}`)}}emitSourceFile(e){if(!this.checker)throw new Error("TypeScript document emitter is not initialized");let r=h(_(this.workspaceRoot,e.fileName)),n=new this.runtime.Document({relative_path:r,occurrences:[]});if(new this.runtime.FileIndexer(this.checker,{cwd:this.workspaceRoot,projectRoot:this.projectRoot,projectDisplayName:this.projectRoot,maxFileByteSizeNumber:this.maxFileByteSize},new this.runtime.Input(e.fileName,e.getText()),n,this.symbolTable,this.constructorTable,this.packages,e).index(),this.stats.documentsEmitted+=1,n.occurrences.length===0)return this.fragments.delete(r),this.stats.documentsRemoved+=1,{relativePath:r,bytes:null,occurrences:0,symbols:n.symbols.length,referenceFragments:[]};let o=n.serializeBinary();return this.fragments.set(r,o),{relativePath:r,bytes:o,occurrences:n.occurrences.length,symbols:n.symbols.length,referenceFragments:K(r,n)}}result(e,r){return{producerIdentity:this.producerIdentity,fragments:e,durationMs:performance.now()-r,stats:this.snapshotStats()}}};function K(t,e){let r=new Map;for(let n of e.occurrences){if(!n.symbol||(n.symbol_roles&1)!==0||n.range.length<3)continue;let i=n.range[0],o=n.range[1];if(!Number.isInteger(i)||!Number.isInteger(o))continue;let s={targetSymbol:n.symbol,location:{file:t,line:i,column:o}};r.set(`${n.symbol}\0${i}\0${o}`,s)}return[...r.values()].sort((n,i)=>n.targetSymbol.localeCompare(i.targetSymbol)||n.location.line-i.location.line||n.location.column-i.location.column)}var I=class{compilerHost;sourceFiles=new Map;constructor(e,r,n){let i=e.createCompilerHost(r),o=i.getSourceFile.bind(i);this.compilerHost={...i,getCurrentDirectory:()=>n,getSourceFile:(s,p,c,u)=>{let a=g(s);if(this.sourceFiles.has(a))return this.sourceFiles.get(a);let P=o(s,p,c,u);return this.sourceFiles.set(a,P),P}}}invalidate(e){this.sourceFiles.delete(g(e))}};function N(t,e){let r=t.readConfigFile(e,t.sys.readFile);if(r.error)throw new Error(t.formatDiagnostics([r.error],t.createCompilerHost({})));let n=t.parseJsonConfigFileContent(r.config,t.sys,R(e)),i=n.errors.filter(o=>o.code!==18003);if(i.length>0)throw new Error(t.formatDiagnostics(i,t.createCompilerHost({})));return n}function k(t){return q(t.packageVersion,t.typescript.version)}function q(t,e){return`scip-typescript:${t}:typescript:${e}:document-adapter:${H}`}function J(t,e){return h(_(t,e))||"."}function y(t,e){if(Y(e))throw new Error(`expected a project-relative path: ${e}`);let r=d(t,e),n=t.endsWith(v)?t:`${t}${v}`;if(r!==t&&!r.startsWith(n))throw new Error(`path escapes the project root: ${e}`);return r}function f(t){return[...new Set(t.map(h))].sort()}function h(t){return t.split(v).join("/").replace(/^\.\//,"")}function g(t){return d(t)}function O(t,e){let r=0;for(let n of t.keys())if(W(n)){try{if(n.getSourceFile()!==e)continue}catch{continue}t.delete(n),r+=1}return r}function W(t){return!!(t&&typeof t=="object"&&"kind"in t&&"getSourceFile"in t)}export{ue as a,le as b,T as c,ne as d,ie as e,oe as f};
2
- //# sourceMappingURL=chunk-IBM3F2BJ.js.map
1
+ import{d as F,f as w}from"./chunk-T75DS2E6.js";import{u as S,v as D,x as b,y as E}from"./chunk-D7DOB27N.js";import{h as m}from"./chunk-UQYQBLJX.js";import{createHash as V}from"crypto";import{dirname as B,join as A}from"path";var T=4,z=3,L=2,$="typescript-index";function ne(t){let e=A(t,$),r=D(e);return{...r,requestDir:r.legacyRequestDir}}function ie(t){let e=JSON.parse(t),r=e.protocolVersion,n=r===L,i=r===z;if(!n&&!i&&r!==T||typeof e.id!="string"||!e.id||typeof e.baseGeneration!="string"||!e.baseGeneration||typeof e.deadlineAtMs!="number"||!Number.isFinite(e.deadlineAtMs)||!U(e.request)||!n&&(e.mailboxVersion!==S||typeof e.operationKey!="string"||!/^[a-f0-9]{64}$/.test(e.operationKey)||e.id!==E(e.operationKey)||typeof e.clientId!="string"||!e.clientId||typeof e.enqueuedAtMs!="number"||!Number.isFinite(e.enqueuedAtMs)||e.deadlineAtMs<e.enqueuedAtMs))throw new Error("TypeScript index service received an invalid mailbox request.");if(!n){let s=e,p=b(i?"typescript-index-v3":"typescript-index-v4",{baseGeneration:s.baseGeneration,request:s.request});if(s.operationKey!==p)throw new Error("TypeScript index service received a mismatched mailbox operation identity.");return{...s,protocolVersion:T}}let o=b("typescript-index-v2",{id:e.id,baseGeneration:e.baseGeneration,request:e.request});return{protocolVersion:T,mailboxVersion:S,id:e.id,operationKey:o,clientId:"legacy-v2",enqueuedAtMs:e.deadlineAtMs,deadlineAtMs:e.deadlineAtMs,baseGeneration:e.baseGeneration,request:e.request}}function oe(t){try{let e=w(F(m(A(B(t),"meta.json"),"reindex metadata")));return e?V("sha256").update(e).digest("hex"):null}catch{return null}}function U(t){if(!t||typeof t!="object")return!1;let e=t,r=C(e.modifiedFiles)?e.modifiedFiles:null,n=C(e.affectedFiles)?e.affectedFiles:null;return e.kind==="emit-documents"&&typeof e.tsconfigPath=="string"&&!!e.tsconfigPath&&typeof e.projectArgument=="string"&&!!e.projectArgument&&typeof e.projectIdentity=="string"&&!!e.projectIdentity&&typeof e.producerIdentity=="string"&&!!e.producerIdentity&&r!==null&&r.length>0&&new Set(r).size===r.length&&n!==null&&n.length>0&&new Set(n).size===n.length}function C(t){return Array.isArray(t)&&t.every(e=>typeof e=="string"&&e.length>0)}import{createRequire as G}from"module";import{dirname as R,isAbsolute as Y,relative as _,resolve as d,sep as v}from"path";var l=G(import.meta.url),H=1,M="0.4.0";function X(){try{let t=j();if(!t.available)return t;let{packageRoot:e}=t,r=l.resolve("typescript",{paths:[e]}),n=l(r),{FileIndexer:i}=l(d(e,"dist/src/FileIndexer.js")),{Input:o}=l(d(e,"dist/src/Input.js")),{Packages:s}=l(d(e,"dist/src/Packages.js")),p=l(d(e,"dist/src/scip.js"));if(!i||!o||!s||!p.scip?.Document||!p.scip.Index)return{available:!1,reason:"scip-typescript document runtime has an unsupported module shape"};let c={packageVersion:t.packageVersion,typescript:n,Document:p.scip.Document,Index:p.scip.Index,FileIndexer:i,Input:o,Packages:s};return{available:!0,runtime:c,producerIdentity:k(c)}}catch(t){return{available:!1,reason:`scip-typescript document runtime unavailable: ${t instanceof Error?t.message:String(t)}`}}}function ue(){let t=j();return t.available?{available:!0,packageVersion:t.packageVersion,typescriptVersion:t.typescriptVersion,producerIdentity:t.producerIdentity}:t}function j(){try{let t=l.resolve("@sourcegraph/scip-typescript/package.json"),e=JSON.parse(m(t,"scip-typescript package manifest"));if(e.version!==M)return{available:!1,reason:`unsupported scip-typescript version ${String(e.version??"unknown")}; expected ${M}`};let r=R(t),n=l.resolve("typescript/package.json",{paths:[r]}),i=JSON.parse(m(n,"TypeScript package manifest"));return typeof i.version!="string"||!i.version?{available:!1,reason:"scip-typescript TypeScript compiler version is unavailable"}:{available:!0,packageRoot:r,packageVersion:e.version,typescriptVersion:i.version,producerIdentity:q(e.version,i.version)}}catch(t){return{available:!1,reason:`scip-typescript document producer unavailable: ${t instanceof Error?t.message:String(t)}`}}}function le(t){let e=t.runtime===void 0?X():t.runtime===null?{available:!1,reason:"scip-typescript document runtime unavailable"}:{available:!0,runtime:t.runtime,producerIdentity:k(t.runtime)};return e.available?{available:!0,emitter:new x(t,e.runtime)}:e}var x=class{producerIdentity;workspaceRoot;tsconfigPath;projectRoot;maxFileByteSize;runtime;host;config=null;includedFiles=new Set;program=null;checker=null;symbolTable=new Map;constructorTable=new Map;packages;fragments=new Map;stats={initializations:0,programUpdates:0,documentsEmitted:0,documentsRemoved:0,sourceNodesReused:0,sourceNodesReplaced:0,symbolEntriesPruned:0};constructor(e,r){this.workspaceRoot=d(e.workspaceRoot),this.tsconfigPath=d(this.workspaceRoot,e.tsconfigPath),this.projectRoot=e.projectRoot??J(this.workspaceRoot,R(this.tsconfigPath)),this.maxFileByteSize=e.maxFileByteSize??1024*1024,this.runtime=r,this.producerIdentity=k(r);let n=N(r.typescript,this.tsconfigPath);this.config=n,this.host=new I(r.typescript,n.options,this.workspaceRoot),this.packages=new r.Packages(this.projectRoot)}initialize(){let e=performance.now(),r=this.config??N(this.runtime.typescript,this.tsconfigPath);this.includedFiles=new Set(r.fileNames.map(g)),this.program=this.runtime.typescript.createProgram(r.fileNames,r.options,this.host.compilerHost),this.checker=this.program.getTypeChecker(),this.stats.initializations+=1;let n=[];for(let i of this.program.getSourceFiles())this.includedFiles.has(g(i.fileName))&&n.push(this.emitSourceFile(i));return this.result(n,e)}advance(e){if(!this.program||!this.checker||!this.config)return this.initializeAndAdvance(e);let r=performance.now(),n=f(e.modifiedFiles),i=f(e.affectedFiles);this.validateIncrementalPaths(n,i);let o=this.program,s=new Map;for(let c of n){let u=y(this.workspaceRoot,c),a=o.getSourceFile(u);if(!a)throw new Error(`modified TypeScript source is unavailable: ${c}`);s.set(c,a),this.stats.symbolEntriesPruned+=O(this.symbolTable,a),this.stats.symbolEntriesPruned+=O(this.constructorTable,a),this.host.invalidate(u)}this.program=this.runtime.typescript.createProgram(this.config.fileNames,this.config.options,this.host.compilerHost,o),this.checker=this.program.getTypeChecker(),this.stats.programUpdates+=1;for(let[c,u]of s)this.program.getSourceFile(y(this.workspaceRoot,c))===u?this.stats.sourceNodesReused+=1:this.stats.sourceNodesReplaced+=1;let p=i.map(c=>{let u=y(this.workspaceRoot,c),a=this.program.getSourceFile(u);if(!a)throw new Error(`affected TypeScript source is unavailable: ${c}`);return this.emitSourceFile(a)});return this.result(p,r)}fragment(e){return this.fragments.get(h(e))??null}snapshotStats(){return{...this.stats}}initializeAndAdvance(e){let r=this.initialize(),n=f(e.modifiedFiles),i=f(e.affectedFiles);this.validateIncrementalPaths(n,i);let o=new Set(i);return{...r,fragments:r.fragments.filter(s=>o.has(s.relativePath))}}validateIncrementalPaths(e,r){if(e.length===0)throw new Error("incremental TypeScript document update requires a modified file");if(r.length===0)throw new Error("incremental TypeScript document update requires an affected file");for(let n of e){let i=y(this.workspaceRoot,n);if(!this.program?.getSourceFile(i))throw new Error(`modified TypeScript dependency is unavailable to the configured project: ${n}`)}for(let n of r){let i=y(this.workspaceRoot,n);if(!this.includedFiles.has(g(i)))throw new Error(`affected TypeScript file is outside the configured project: ${n}`)}}emitSourceFile(e){if(!this.checker)throw new Error("TypeScript document emitter is not initialized");let r=h(_(this.workspaceRoot,e.fileName)),n=new this.runtime.Document({relative_path:r,occurrences:[]});if(new this.runtime.FileIndexer(this.checker,{cwd:this.workspaceRoot,projectRoot:this.projectRoot,projectDisplayName:this.projectRoot,maxFileByteSizeNumber:this.maxFileByteSize},new this.runtime.Input(e.fileName,e.getText()),n,this.symbolTable,this.constructorTable,this.packages,e).index(),this.stats.documentsEmitted+=1,n.occurrences.length===0)return this.fragments.delete(r),this.stats.documentsRemoved+=1,{relativePath:r,bytes:null,occurrences:0,symbols:n.symbols.length,referenceFragments:[]};let o=n.serializeBinary();return this.fragments.set(r,o),{relativePath:r,bytes:o,occurrences:n.occurrences.length,symbols:n.symbols.length,referenceFragments:K(r,n)}}result(e,r){return{producerIdentity:this.producerIdentity,fragments:e,durationMs:performance.now()-r,stats:this.snapshotStats()}}};function K(t,e){let r=new Map;for(let n of e.occurrences){if(!n.symbol||(n.symbol_roles&1)!==0||n.range.length<3)continue;let i=n.range[0],o=n.range[1];if(!Number.isInteger(i)||!Number.isInteger(o))continue;let s={targetSymbol:n.symbol,location:{file:t,line:i,column:o}};r.set(`${n.symbol}\0${i}\0${o}`,s)}return[...r.values()].sort((n,i)=>n.targetSymbol.localeCompare(i.targetSymbol)||n.location.line-i.location.line||n.location.column-i.location.column)}var I=class{compilerHost;sourceFiles=new Map;constructor(e,r,n){let i=e.createCompilerHost(r),o=i.getSourceFile.bind(i);this.compilerHost={...i,getCurrentDirectory:()=>n,getSourceFile:(s,p,c,u)=>{let a=g(s);if(this.sourceFiles.has(a))return this.sourceFiles.get(a);let P=o(s,p,c,u);return this.sourceFiles.set(a,P),P}}}invalidate(e){this.sourceFiles.delete(g(e))}};function N(t,e){let r=t.readConfigFile(e,t.sys.readFile);if(r.error)throw new Error(t.formatDiagnostics([r.error],t.createCompilerHost({})));let n=t.parseJsonConfigFileContent(r.config,t.sys,R(e)),i=n.errors.filter(o=>o.code!==18003);if(i.length>0)throw new Error(t.formatDiagnostics(i,t.createCompilerHost({})));return n}function k(t){return q(t.packageVersion,t.typescript.version)}function q(t,e){return`scip-typescript:${t}:typescript:${e}:document-adapter:${H}`}function J(t,e){return h(_(t,e))||"."}function y(t,e){if(Y(e))throw new Error(`expected a project-relative path: ${e}`);let r=d(t,e),n=t.endsWith(v)?t:`${t}${v}`;if(r!==t&&!r.startsWith(n))throw new Error(`path escapes the project root: ${e}`);return r}function f(t){return[...new Set(t.map(h))].sort()}function h(t){return t.split(v).join("/").replace(/^\.\//,"")}function g(t){return d(t)}function O(t,e){let r=0;for(let n of t.keys())if(W(n)){try{if(n.getSourceFile()!==e)continue}catch{continue}t.delete(n),r+=1}return r}function W(t){return!!(t&&typeof t=="object"&&"kind"in t&&"getSourceFile"in t)}export{ue as a,le as b,T as c,ne as d,ie as e,oe as f};
2
+ //# sourceMappingURL=chunk-4LK5OIPW.js.map
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{K as yt,f as mt,g as pt,p as Z,q as W,r as de,s as Et}from"./chunk-N3Q3AWGW.js";import{b as X,c as be,d as Ke,e as Ve,f as Ge,i as qe,j as ze,k as Je}from"./chunk-W3FK73MD.js";import{a as Ct}from"./chunk-EN4AHLL3.js";import{Ca as Ee,Da as ut,J as tt,K as nt,L as rt,Lb as St,M as ot,Mb as vt,Na as ft,b as Xe,c as he,cb as gt,db as bt,eb as ht,ha as st,ia as at,ja as it,qa as dt,r as Ye,ra as ct,t as Qe,u as Ze,ua as lt,v as et}from"./chunk-RJWAB4VR.js";import{J as ge,K as ie,L as H,M as J,T as je,u as We}from"./chunk-G2XUZCF2.js";import{o as He,q as pe}from"./chunk-DUKHVPU5.js";import{join as De}from"path";import{createHash as Rn}from"crypto";import{mkdirSync as Pt,mkdtempSync as Pn,renameSync as An,rmSync as At,statSync as _n,writeFileSync as _t}from"fs";import{tmpdir as Tn}from"os";import{extname as Nn,join as ee,resolve as Mn,sep as Bn}from"path";var On=1024*1024,kt=500,Ln=64,Fn=/\.(?:cmd|bat)$/i;async function Tt(e,t,n={}){let r=Se(e);if(!r.ok)return D(r.reason,r.detail);let a=JSON.stringify(Ke),o;try{Pt(t.workDir,{recursive:!0}),o=Pn(ee(Tn(),"codebaseiq-probe-")),e.argv.includes("{schemaFile}")&&_t(ee(o,"schema.json"),a)}catch(s){return xt(o),D("spawn-failed",`could not prepare the agent sandbox: ${te(In(s))}`)}try{let s=ee(o,"schema.json"),d=ee(o,"output.json"),i=e.argv.includes("{outputFile}"),l=new Map([["{schemaJson}",a],["{schemaFile}",s],["{outputFile}",d]]),c=bt(r.path,e.argv.slice(1).map(S=>l.get(S)??S)),p;try{p=await vt({command:c.binary,args:c.args,label:`agent probe command ${e.name}`,timeoutMs:e.timeoutMs,maxStdoutBytes:e.maxOutputBytes,maxStderrBytes:On,cwd:t.workDir,env:Un(n.env??process.env),input:Ge(t.description,t.languages),signal:n.signal})}catch(S){return Hn(S,n.signal)}if(p.status!==0){let S=wt(p.stdout),b=p.status===null?`signal ${p.signal}`:`code ${p.status}`,m=S.kind==="error"?S.detail:p.stderr.trim()||p.stdout.trim();return D("agent-error",`${e.name} exited with ${b}: ${te(m)}`)}let g=[];if(i){let S=Wn(d,e.maxOutputBytes);if(S==="too-large")return D("output-too-large",`${e.name} wrote more than ${e.maxOutputBytes} bytes.`);S!==null&&g.push(S)}g.push(p.stdout);for(let S of g){let b=wt(S);if(b.kind==="error")return D("agent-error",b.detail);if(b.kind==="none")continue;let{probes:m,diagnostics:x}=be(b.value);return X(m)?{ok:!0,probes:m,diagnostics:x,raw:S.trim()}:D("invalid-probes",Vn(x))}return D("no-json",`${e.name} printed no JSON object: ${te(p.stdout.trim())}`)}finally{xt(o)}}function xt(e){if(e!==void 0)try{At(e,{recursive:!0,force:!0,maxRetries:3})}catch{}}function In(e){return e instanceof Error?e.message:String(e)}function D(e,t){return{ok:!1,reason:e,detail:t}}function Dn(e){let t=ze({agent:{commands:[e]}}).filter(n=>n.level==="error");return t.length>0?t.map(n=>`${n.path}: ${n.message}`).join(" "):Je.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=Dn(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(Bn),o;if(a){o=$n(Mn(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=ht(n);return o===null?gt(n)?{ok:!1,reason:"misconfigured",detail:r}:{ok:!1,reason:"spawn-failed",detail:`argv[0] "${n}" was not found on PATH.`}:process.platform==="win32"&&Fn.test(o)?{ok:!1,reason:"misconfigured",detail:r}:{ok:!0,path:o}}function $n(e,t=process.platform){return t!=="win32"||Nn(e)!==""||ye(e)!=="missing"?e:[".exe",".com"].map(n=>`${e}${n}`).find(n=>ye(n)==="file")??e}function ye(e){try{return _n(e).isFile()?"file":"other"}catch{return"missing"}}function Un(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&!/^CODEBASEIQ_/i.test(n)&&(t[n]=r);return t}function Hn(e,t){if(!(e instanceof St))throw e;switch(e.kind){case"spawn":return D("spawn-failed",e.message);case"timeout":return D("timeout",e.message);case"stdout-limit":case"stderr-limit":return D("output-too-large",e.message);case"aborted":throw t?H(t,e.message):e}}function Wn(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 wt(e){let t=Rt(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(Mt(t.structured_output))return{kind:"object",value:t.structured_output};let n=typeof t.result=="string"?Rt(t.result):null;return n?{kind:"object",value:n}:{kind:"none"}}function Rt(e){let t=e.trim();return Nt(t)??jn(t)}function Nt(e){try{let t=JSON.parse(e);return Mt(t)?t:null}catch{return null}}function jn(e){let t=/\{\s*["}]/g,n=null,r=0;for(let a=0;a<Ln;){t.lastIndex=r;let o=t.exec(e);if(!o)break;let s=Kn(e,o.index),d=s===-1?null:Nt(e.slice(o.index,s+1));d?(n=d,r=s+1):(r=o.index+1,a++)}return n}function Kn(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 Mt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Vn(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>kt?`${e.slice(0,kt)}...`:e}var Gn=64*1024,qn=3600*1e3;function Bt(e,t,n=Date.now){let r=(a,o)=>ee(e,`${Rn("sha256").update(JSON.stringify([a,3,o])).digest("hex")}.json`);return{get(a,o){try{let s=JSON.parse(pe(r(a,o),{maxBytes:Gn,inputKind:"agent probe cache entry"}));if(typeof s.storedAt!="number"||n()-s.storedAt>=t*qn)return;let{probes:d}=be(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{Pt(e,{recursive:!0}),_t(i,JSON.stringify({storedAt:n(),probes:s})),An(i,d)}catch{try{At(i,{force:!0})}catch{}}}}}import{BlockList as zn,isIP as Jn}from"net";var Ce=64*1024*1024,Xn=2,Ot="embedding request aborted",Yn="codebaseiq embedding canary: parse a retry delay from a config file",N=class extends Error{constructor(n,r,a){super(r);this.kind=n;this.status=a;this.name="EmbeddingClientError"}kind;status},ne=new zn;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 Qn=[".local",".lan",".home.arpa",".internal"];function Lt(e){let t;try{t=new URL(e).hostname}catch{return!1}let n=(t.startsWith("[")?t.slice(1,-1):t).replace(/\.$/,""),r=Jn(n);return r!==0?ne.check(n,r===4?"ipv4":"ipv6"):n==="localhost"||Qn.some(a=>n.endsWith(a))}function Dt(e,t={}){let n=t.fetchImpl??fetch,r=t.env??process.env,a=e.baseUrl.replace(/\/+$/,"");function o(){let c=e.apiKeyEnv?r[e.apiKeyEnv]:void 0;return c||void 0}function s(){let c;try{c=new URL(e.baseUrl)}catch{throw new N("invalid-endpoint",`embedding endpoint "${e.name}" has an invalid baseUrl`)}if(c.protocol!=="http:"&&c.protocol!=="https:")throw new N("invalid-endpoint",`embedding endpoint "${e.name}" must use http or https`);if(c.username!==""||c.password!=="")throw new N("invalid-endpoint",`embedding endpoint "${e.name}" must not embed credentials in baseUrl; use apiKeyEnv`);if(!e.allowRemote&&!Lt(e.baseUrl))throw new N("remote-not-allowed",`embedding endpoint "${e.name}" is not on a private network; set allowRemote to use it`);if(c.protocol==="http:"&&o()!==void 0&&!Lt(e.baseUrl))throw new N("insecure-token-transport",`embedding endpoint "${e.name}" would send its API key over plain http to a non-private host; use https`)}function d(c){let p={};c&&(p["content-type"]="application/json");let g=o();return g&&(p.authorization=`Bearer ${g}`),p}async function i(c,p,g,S){let b={model:e.model,input:c,encoding_format:"float",...e.dimensions!==void 0?{dimensions:e.dimensions}:{}},{status:m,text:x}=await Ft(n,`${a}/embeddings`,{method:"POST",headers:d(!0),body:JSON.stringify(b)},p,!0,S);if(m<200||m>=300)throw new N("http",`embeddings request failed with HTTP ${m}`,m);return nr(x,c.length,g)}async function l(c,p,g){try{return await i(c,e.requestTimeoutMs,p,g)}catch(S){if(!Zn(S))throw S;return i(c,e.requestTimeoutMs,p,g)}}return{async checkHealth({signal:c}={}){try{s()}catch(g){return ve(g)}try{await Ft(n,`${a}/models`,{method:"GET",headers:d(!1)},e.healthTimeoutMs,!1,c)}catch(g){return c?.aborted?ve(g,c):{ok:!1,reason:"unreachable",detail:ke(g)}}let p=ge();try{let[g]=await i([e.documentPrefix+Yn],e.warmTimeoutMs,{dims:e.dimensions},c);return{ok:!0,model:e.model,dimensions:g.length,latencyMs:Math.round(ge()-p),canary:g}}catch(g){return ve(g,c)}},async embed(c,p,{signal:g}={}){if(s(),c.length===0)return[];let S=p==="query"?e.queryPrefix:e.documentPrefix,b=Math.max(1,Math.floor(e.batchSize)),m=[];for(let R=0;R<c.length;R+=b)m.push(c.slice(R,R+b).map(A=>S+A));let x={dims:e.dimensions};return(await Ct(m,Xn,R=>l(R,x,g))).flat()}}}function Zn(e){return e instanceof N&&(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 N))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 Ft(e,t,n,r,a,o){J(o,Ot);let s=new AbortController,d=setTimeout(()=>{s.abort(new N("timeout",`no response within ${r}ms`))},r),i=()=>s.abort(o?.reason);o?.addEventListener("abort",i,{once:!0});try{let l=await $t(e(t,{...n,signal:s.signal,redirect:"error"}),s.signal);return{status:l.status,text:a?await tr(l,s.signal):""}}catch(l){throw o?.aborted&&s.signal.reason===o.reason?H(o,Ot):l instanceof N?l:s.signal.aborted&&s.signal.reason instanceof N?s.signal.reason:new N("network",`could not reach the embeddings endpoint: ${er(l)}`)}finally{clearTimeout(d),o?.removeEventListener("abort",i),s.abort()}}function er(e){let t=e instanceof Error?e.cause:void 0;return typeof t?.code=="string"?t.code:ke(e)}async function tr(e,t){let n=Number(e.headers.get("content-length"));if(Number.isFinite(n)&&n>Ce)throw It();if(!e.body)return"";let r=e.body.getReader(),a=[],o=0;for(;;){let{done:s,value:d}=await $t(r.read(),t);if(s)break;if(o+=d.byteLength,o>Ce)throw r.cancel().catch(()=>{}),It();a.push(d)}return new TextDecoder().decode(Buffer.concat(a))}function It(){return new N("too-large",`embeddings response exceeded the ${Ce} byte limit`)}function $t(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 nr(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 l=typeof d=="object"&&d!==null?d:{},c=l.index===void 0?i:l.index;if(typeof c!="number"||!Number.isInteger(c)||c<0||c>=t||s.has(c))throw j("embedding indexes are not a permutation of the inputs");s.add(c),o[c]=l.embedding}),o.map(d=>rr(d,n))}function rr(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 N("bad-response",`embeddings response rejected: ${e}`)}import{createHash as Kt}from"crypto";var Ut=2,Ht=200,or=new Set(["string","template_string","string_literal","raw_string_literal","char_literal","concatenated_string"]),sr={class_declaration:"name",abstract_class_declaration:"name",class:"name",class_definition:"name",trait_item:"name",impl_item:"type",mod_item:"name"},Wt=Ye({kind:"callable-units",invalidation:Qe("callable-units"),serialize:e=>JSON.stringify({version:Ut,...e}),deserialize:e=>{try{let t=JSON.parse(e);return t.version!==Ut?null:{language:t.language,contentHash:t.contentHash,units:t.units}}catch{return null}}});function ar(e){return Kt("sha256").update(e).digest("hex")}function Vt(e,t,n){let r=ar(n),a=Wt.read(e,t,r);if(a&&a.contentHash===r)return a;let o=tt(e,t,n);if(!o)return null;let s={language:o.language,contentHash:r,units:ir(o.tree,o.language)};return Wt.write(e,t,r,s),s}function ir(e,t){let n=[],r=new Map,a=[],o=s=>{let d=ot(s,t),i=d?.functionNode.childForFieldName("body");if(d&&i){let c=`${a.join(".")}#${d.name}`,p=r.get(c)??0;r.set(c,p+1),n.push(dr(d.name,[...a],p,d.definitionNode,i,t)),a.push(d.name);for(let g of s.children)o(g);a.pop();return}let l=cr(s);l&&a.push(l);for(let c of s.children)o(c);l&&a.pop()};return o(e.rootNode),n}function dr(e,t,n,r,a,o){let s=[],d=[],i=new Set,l=c=>{if(rt(c))return;let p=nt(c,o);if(p&&i.add(p.calleeLeaf),or.has(c.type)){s.push(c.text.replace(/\r\n/g,`
2
+ import{K as yt,f as mt,g as pt,p as Z,q as W,r as de,s as Et}from"./chunk-C7QWUBR2.js";import{b as X,c as be,d as Ke,e as Ve,f as Ge,i as qe,j as ze,k as Je}from"./chunk-7UCDGXRW.js";import{a as Ct}from"./chunk-EN4AHLL3.js";import{Ca as Ee,Da as ut,J as tt,K as nt,L as rt,M as ot,Na as ft,Pb as St,Qb as vt,b as Xe,c as he,cb as gt,db as bt,eb as ht,ha as st,ia as at,ja as it,qa as dt,r as Ye,ra as ct,t as Qe,u as Ze,ua as lt,v as et}from"./chunk-FTTV7IRX.js";import{J as ge,K as ie,L as H,M as J,T as je,u as We}from"./chunk-5T44HG5Y.js";import{o as He,q as pe}from"./chunk-DUKHVPU5.js";import{join as De}from"path";import{createHash as Rn}from"crypto";import{mkdirSync as Pt,mkdtempSync as Pn,renameSync as An,rmSync as At,statSync as _n,writeFileSync as _t}from"fs";import{tmpdir as Tn}from"os";import{extname as Nn,join as ee,resolve as Mn,sep as Bn}from"path";var On=1024*1024,kt=500,Ln=64,Fn=/\.(?:cmd|bat)$/i;async function Tt(e,t,n={}){let r=Se(e);if(!r.ok)return D(r.reason,r.detail);let a=JSON.stringify(Ke),o;try{Pt(t.workDir,{recursive:!0}),o=Pn(ee(Tn(),"codebaseiq-probe-")),e.argv.includes("{schemaFile}")&&_t(ee(o,"schema.json"),a)}catch(s){return xt(o),D("spawn-failed",`could not prepare the agent sandbox: ${te(In(s))}`)}try{let s=ee(o,"schema.json"),d=ee(o,"output.json"),i=e.argv.includes("{outputFile}"),l=new Map([["{schemaJson}",a],["{schemaFile}",s],["{outputFile}",d]]),c=bt(r.path,e.argv.slice(1).map(S=>l.get(S)??S)),p;try{p=await vt({command:c.binary,args:c.args,label:`agent probe command ${e.name}`,timeoutMs:e.timeoutMs,maxStdoutBytes:e.maxOutputBytes,maxStderrBytes:On,cwd:t.workDir,env:Un(n.env??process.env),input:Ge(t.description,t.languages),signal:n.signal})}catch(S){return Hn(S,n.signal)}if(p.status!==0){let S=wt(p.stdout),b=p.status===null?`signal ${p.signal}`:`code ${p.status}`,m=S.kind==="error"?S.detail:p.stderr.trim()||p.stdout.trim();return D("agent-error",`${e.name} exited with ${b}: ${te(m)}`)}let g=[];if(i){let S=Wn(d,e.maxOutputBytes);if(S==="too-large")return D("output-too-large",`${e.name} wrote more than ${e.maxOutputBytes} bytes.`);S!==null&&g.push(S)}g.push(p.stdout);for(let S of g){let b=wt(S);if(b.kind==="error")return D("agent-error",b.detail);if(b.kind==="none")continue;let{probes:m,diagnostics:x}=be(b.value);return X(m)?{ok:!0,probes:m,diagnostics:x,raw:S.trim()}:D("invalid-probes",Vn(x))}return D("no-json",`${e.name} printed no JSON object: ${te(p.stdout.trim())}`)}finally{xt(o)}}function xt(e){if(e!==void 0)try{At(e,{recursive:!0,force:!0,maxRetries:3})}catch{}}function In(e){return e instanceof Error?e.message:String(e)}function D(e,t){return{ok:!1,reason:e,detail:t}}function Dn(e){let t=ze({agent:{commands:[e]}}).filter(n=>n.level==="error");return t.length>0?t.map(n=>`${n.path}: ${n.message}`).join(" "):Je.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=Dn(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(Bn),o;if(a){o=$n(Mn(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=ht(n);return o===null?gt(n)?{ok:!1,reason:"misconfigured",detail:r}:{ok:!1,reason:"spawn-failed",detail:`argv[0] "${n}" was not found on PATH.`}:process.platform==="win32"&&Fn.test(o)?{ok:!1,reason:"misconfigured",detail:r}:{ok:!0,path:o}}function $n(e,t=process.platform){return t!=="win32"||Nn(e)!==""||ye(e)!=="missing"?e:[".exe",".com"].map(n=>`${e}${n}`).find(n=>ye(n)==="file")??e}function ye(e){try{return _n(e).isFile()?"file":"other"}catch{return"missing"}}function Un(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&!/^CODEBASEIQ_/i.test(n)&&(t[n]=r);return t}function Hn(e,t){if(!(e instanceof St))throw e;switch(e.kind){case"spawn":return D("spawn-failed",e.message);case"timeout":return D("timeout",e.message);case"stdout-limit":case"stderr-limit":return D("output-too-large",e.message);case"aborted":throw t?H(t,e.message):e}}function Wn(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 wt(e){let t=Rt(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(Mt(t.structured_output))return{kind:"object",value:t.structured_output};let n=typeof t.result=="string"?Rt(t.result):null;return n?{kind:"object",value:n}:{kind:"none"}}function Rt(e){let t=e.trim();return Nt(t)??jn(t)}function Nt(e){try{let t=JSON.parse(e);return Mt(t)?t:null}catch{return null}}function jn(e){let t=/\{\s*["}]/g,n=null,r=0;for(let a=0;a<Ln;){t.lastIndex=r;let o=t.exec(e);if(!o)break;let s=Kn(e,o.index),d=s===-1?null:Nt(e.slice(o.index,s+1));d?(n=d,r=s+1):(r=o.index+1,a++)}return n}function Kn(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 Mt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Vn(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>kt?`${e.slice(0,kt)}...`:e}var Gn=64*1024,qn=3600*1e3;function Bt(e,t,n=Date.now){let r=(a,o)=>ee(e,`${Rn("sha256").update(JSON.stringify([a,3,o])).digest("hex")}.json`);return{get(a,o){try{let s=JSON.parse(pe(r(a,o),{maxBytes:Gn,inputKind:"agent probe cache entry"}));if(typeof s.storedAt!="number"||n()-s.storedAt>=t*qn)return;let{probes:d}=be(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{Pt(e,{recursive:!0}),_t(i,JSON.stringify({storedAt:n(),probes:s})),An(i,d)}catch{try{At(i,{force:!0})}catch{}}}}}import{BlockList as zn,isIP as Jn}from"net";var Ce=64*1024*1024,Xn=2,Ot="embedding request aborted",Yn="codebaseiq embedding canary: parse a retry delay from a config file",N=class extends Error{constructor(n,r,a){super(r);this.kind=n;this.status=a;this.name="EmbeddingClientError"}kind;status},ne=new zn;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 Qn=[".local",".lan",".home.arpa",".internal"];function Lt(e){let t;try{t=new URL(e).hostname}catch{return!1}let n=(t.startsWith("[")?t.slice(1,-1):t).replace(/\.$/,""),r=Jn(n);return r!==0?ne.check(n,r===4?"ipv4":"ipv6"):n==="localhost"||Qn.some(a=>n.endsWith(a))}function Dt(e,t={}){let n=t.fetchImpl??fetch,r=t.env??process.env,a=e.baseUrl.replace(/\/+$/,"");function o(){let c=e.apiKeyEnv?r[e.apiKeyEnv]:void 0;return c||void 0}function s(){let c;try{c=new URL(e.baseUrl)}catch{throw new N("invalid-endpoint",`embedding endpoint "${e.name}" has an invalid baseUrl`)}if(c.protocol!=="http:"&&c.protocol!=="https:")throw new N("invalid-endpoint",`embedding endpoint "${e.name}" must use http or https`);if(c.username!==""||c.password!=="")throw new N("invalid-endpoint",`embedding endpoint "${e.name}" must not embed credentials in baseUrl; use apiKeyEnv`);if(!e.allowRemote&&!Lt(e.baseUrl))throw new N("remote-not-allowed",`embedding endpoint "${e.name}" is not on a private network; set allowRemote to use it`);if(c.protocol==="http:"&&o()!==void 0&&!Lt(e.baseUrl))throw new N("insecure-token-transport",`embedding endpoint "${e.name}" would send its API key over plain http to a non-private host; use https`)}function d(c){let p={};c&&(p["content-type"]="application/json");let g=o();return g&&(p.authorization=`Bearer ${g}`),p}async function i(c,p,g,S){let b={model:e.model,input:c,encoding_format:"float",...e.dimensions!==void 0?{dimensions:e.dimensions}:{}},{status:m,text:x}=await Ft(n,`${a}/embeddings`,{method:"POST",headers:d(!0),body:JSON.stringify(b)},p,!0,S);if(m<200||m>=300)throw new N("http",`embeddings request failed with HTTP ${m}`,m);return nr(x,c.length,g)}async function l(c,p,g){try{return await i(c,e.requestTimeoutMs,p,g)}catch(S){if(!Zn(S))throw S;return i(c,e.requestTimeoutMs,p,g)}}return{async checkHealth({signal:c}={}){try{s()}catch(g){return ve(g)}try{await Ft(n,`${a}/models`,{method:"GET",headers:d(!1)},e.healthTimeoutMs,!1,c)}catch(g){return c?.aborted?ve(g,c):{ok:!1,reason:"unreachable",detail:ke(g)}}let p=ge();try{let[g]=await i([e.documentPrefix+Yn],e.warmTimeoutMs,{dims:e.dimensions},c);return{ok:!0,model:e.model,dimensions:g.length,latencyMs:Math.round(ge()-p),canary:g}}catch(g){return ve(g,c)}},async embed(c,p,{signal:g}={}){if(s(),c.length===0)return[];let S=p==="query"?e.queryPrefix:e.documentPrefix,b=Math.max(1,Math.floor(e.batchSize)),m=[];for(let R=0;R<c.length;R+=b)m.push(c.slice(R,R+b).map(A=>S+A));let x={dims:e.dimensions};return(await Ct(m,Xn,R=>l(R,x,g))).flat()}}}function Zn(e){return e instanceof N&&(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 N))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 Ft(e,t,n,r,a,o){J(o,Ot);let s=new AbortController,d=setTimeout(()=>{s.abort(new N("timeout",`no response within ${r}ms`))},r),i=()=>s.abort(o?.reason);o?.addEventListener("abort",i,{once:!0});try{let l=await $t(e(t,{...n,signal:s.signal,redirect:"error"}),s.signal);return{status:l.status,text:a?await tr(l,s.signal):""}}catch(l){throw o?.aborted&&s.signal.reason===o.reason?H(o,Ot):l instanceof N?l:s.signal.aborted&&s.signal.reason instanceof N?s.signal.reason:new N("network",`could not reach the embeddings endpoint: ${er(l)}`)}finally{clearTimeout(d),o?.removeEventListener("abort",i),s.abort()}}function er(e){let t=e instanceof Error?e.cause:void 0;return typeof t?.code=="string"?t.code:ke(e)}async function tr(e,t){let n=Number(e.headers.get("content-length"));if(Number.isFinite(n)&&n>Ce)throw It();if(!e.body)return"";let r=e.body.getReader(),a=[],o=0;for(;;){let{done:s,value:d}=await $t(r.read(),t);if(s)break;if(o+=d.byteLength,o>Ce)throw r.cancel().catch(()=>{}),It();a.push(d)}return new TextDecoder().decode(Buffer.concat(a))}function It(){return new N("too-large",`embeddings response exceeded the ${Ce} byte limit`)}function $t(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 nr(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 l=typeof d=="object"&&d!==null?d:{},c=l.index===void 0?i:l.index;if(typeof c!="number"||!Number.isInteger(c)||c<0||c>=t||s.has(c))throw j("embedding indexes are not a permutation of the inputs");s.add(c),o[c]=l.embedding}),o.map(d=>rr(d,n))}function rr(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 N("bad-response",`embeddings response rejected: ${e}`)}import{createHash as Kt}from"crypto";var Ut=2,Ht=200,or=new Set(["string","template_string","string_literal","raw_string_literal","char_literal","concatenated_string"]),sr={class_declaration:"name",abstract_class_declaration:"name",class:"name",class_definition:"name",trait_item:"name",impl_item:"type",mod_item:"name"},Wt=Ye({kind:"callable-units",invalidation:Qe("callable-units"),serialize:e=>JSON.stringify({version:Ut,...e}),deserialize:e=>{try{let t=JSON.parse(e);return t.version!==Ut?null:{language:t.language,contentHash:t.contentHash,units:t.units}}catch{return null}}});function ar(e){return Kt("sha256").update(e).digest("hex")}function Vt(e,t,n){let r=ar(n),a=Wt.read(e,t,r);if(a&&a.contentHash===r)return a;let o=tt(e,t,n);if(!o)return null;let s={language:o.language,contentHash:r,units:ir(o.tree,o.language)};return Wt.write(e,t,r,s),s}function ir(e,t){let n=[],r=new Map,a=[],o=s=>{let d=ot(s,t),i=d?.functionNode.childForFieldName("body");if(d&&i){let c=`${a.join(".")}#${d.name}`,p=r.get(c)??0;r.set(c,p+1),n.push(dr(d.name,[...a],p,d.definitionNode,i,t)),a.push(d.name);for(let g of s.children)o(g);a.pop();return}let l=cr(s);l&&a.push(l);for(let c of s.children)o(c);l&&a.pop()};return o(e.rootNode),n}function dr(e,t,n,r,a,o){let s=[],d=[],i=new Set,l=c=>{if(rt(c))return;let p=nt(c,o);if(p&&i.add(p.calleeLeaf),or.has(c.type)){s.push(c.text.replace(/\r\n/g,`
3
3
  `)),d.push("\0L");return}if(c.childCount===0){s.push(c.text),d.push(c.text);return}for(let g of c.children)l(g)};return l(a),{name:e,container:t,ordinal:n,startLine:r.startPosition.row,endLine:r.endPosition.row,bodyStartLine:a.startPosition.row,bodyLines:a.text.split(/\r?\n/).filter(c=>c.trim().length>0).length,tokenCount:s.length,signature:lr(r,a),exactHash:jt(s),shapeHash:jt(d),calleeLeaves:[...i].sort(),exported:fr(r)}}function cr(e){let t=sr[e.type];return t?e.childForFieldName(t)?.text??null:null}function lr(e,t){let n=e.text.lastIndexOf(t.text),a=(n>=0?e.text.slice(0,n):ur(e.text)).replace(/\s+/g," ").trim().replace(/[=:]?\s*$/,"").trim();return a.length>Ht?`${a.slice(0,Ht-1)}\u2026`:a}function ur(e){let t=e.indexOf(`
4
4
  `);return t>=0?e.slice(0,t):e}function fr(e){if(e.namedChildren.some(n=>n.type==="visibility_modifier"&&n.text.startsWith("pub")))return!0;let t=e;for(let n=0;t&&n<3;n++,t=t.parent)if(t.type==="export_statement")return!0;return!1}function jt(e){return Kt("sha256").update(e.join("")).digest("hex").slice(0,24)}var Re=["name","container","doc","signature","path"],mr=1e3,pr=150,gr=400,br=3,xe=/@deprecated\b|#\[deprecated\b|\bdeprecated\s*[:(]/i,Gt=/^\s*(?:\/\/|\/\*|\*|#|@)/,hr=new Set(pt()),Er=/(?:^|\/)(?:__generated__|generated)\/|\.(?:generated|gen|g)\.[a-z0-9]+$|\.pb2?\.[a-z0-9]+$|_pb2?\.[a-z0-9]+$/i,we=/@generated\b|\bcode generated\b.*\bdo not edit\b/i,yr=40,Sr=/^(?:\/\/|--|#(?![[!\w]))/,vr=/^\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,Cr=/^\s*export\s*\{([^}\n]*)/,kr=/[\p{L}\p{N}_$]+/gu,xr=2,wr=Xe("builder-candidate-corpus",{clearGroups:["whole-project","definition-catalog"]});function Y(e){return wr.get(e,()=>Ar(e))}function $(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 l of d)o.add(l)}}return{words:r,variants:a,set:o}}function Pe(e){return W(e).map(Et)}function Rr(e){let t=0,n=0,r=0,a=-1;for(let i=0;i<e.length&&a<0;i+=1){let l=e[i];l==="["?t+=1:l==="]"?t=Math.max(0,t-1):l==="{"?n+=1:l==="}"?n=Math.max(0,n-1):l==="<"?r+=1:l===">"&&e[i-1]!=="="&&e[i-1]!=="-"?r=Math.max(0,r-1):l==="("&&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 l=e[i];if(l==="(")o+=1;else if(l===")"&&(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 Pr(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,mr)}function Ar(e){let t=new Map,n=new Set;for(let s of lt(e)){if(s.symbol.startsWith("local ")||!s.isFunctionLike&&!s.isTypeLike||e.isIgnored(s.relativePath)||Ee(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=et(e,s);if(Wr(s,d))continue;let i=t.get(s),l=Mr(e,s,d,i);for(let c of i){let p=Or(c,l);p&&r.push({definition:c,candidate:p})}}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=yt(e,new Set,r.map(({definition:s})=>s.symbolId)),o=r.map(({definition:s,candidate:d})=>{let i=[...a.get(s.symbolId)??[]].filter(([l,c])=>l!==d.file&&c.occurrences>0&&Ee(l)!=="test").map(([l])=>l).sort();return{...d,referencedFrom:i,consumable:d.exported||i.length>0}});return Tr(o,r.map(({definition:s})=>_r(s)))}function _r(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 Tr(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 l of Re)for(let c of s.fields[l].set)i.add(c);for(let l of i)zt(n,l,d);for(let l of s.fields.name.set)r.set(l,(r.get(l)??0)+1);zt(a,s.name,d);for(let l of s.calleeLeaves)o.add(l)}),{candidates:e,locations:t,byToken:n,nameDocFreq:r,byName:a,calledLeaves:o}}var qt=new WeakMap;function Jt(e,t,n,r){let a=qt.get(t);a||(a=new Map,qt.set(t,a));let o=a.get(n);return o||(o=Nr(e,t.locations[n],t.candidates[n].name),a.set(n,o)),o.get(r)??[]}function Nr(e,t,n){let r=new Map;for(let o of ft(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=ut(e,o,n,d);a.set(o,s.flatMap(([l,c])=>{let p=i.filter(g=>g>=l&&g<=c);return p.length>0?p.map(g=>[g,g]):[[l,c]]}))}return a}function zt(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function Mr(e,t,n,r){let a=null;return{lines:n,units:Br(e,t),endLines:r.map(o=>o.endLine).sort((o,s)=>o-s),exportedNames:()=>a??=Ur(n)}}function Br(e,t){let n=new Map,r=Ze(e,t);if(!r)return n;for(let a of Vt(e,t,r)?.units??[]){let o=n.get(a.name);o?o.push(a):n.set(a.name,[a])}return n}function Or(e,t){let{units:n}=t,r=e.isTypeLike?null:Lr(n.get(e.leaf),e.startLine),a=!e.isTypeLike&&(r!==null||it(e.symbol)||hr.has(e.kind??-1));if(!e.isTypeLike&&!a)return null;let o=dt(ct(e.documentation)),s=jr(a&&(!o||!o.includes("("))&&r?r.signature:o??r?.signature??"").slice(0,gr),d=a&&s?Rr(s):{params:null,returns:null},i=Pr(e.documentation),l=Fr(e,r),c=e.leaf;return{symbol:e.symbol,name:c,kind:a?e.parentTypeName?"method":"function":Ir(e,s),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,container:l,doc:i,signature:s||null,paramsText:d.params,returnsText:d.returns,nameWords:Pe(c),fields:{name:$(c),container:$(l??""),doc:$(i,3,pr),signature:$(s),path:$(e.relativePath.replace(/\.[^./]+$/,""))},calleeLeaves:r?.calleeLeaves??[],hasBody:r!==null,exported:r?.exported===!0||Hr(t.exportedNames(),e),deprecated:Dr(t,e,i)}}function Lr(e,t){let n=null;for(let r of e??[]){let a=Math.abs(r.startLine-t);a<=br&&(!n||a<Math.abs(n.startLine-t))&&(n=r)}return n}function Fr(e,t){return e.parentTypeName?e.parentTypeName:e.enclosingSymbol&&at(e.enclosingSymbol)!=="namespace"?st(e.enclosingSymbol)||null:t?.container.at(-1)??null}function Ir(e,t){let r=(/^(?:export\s+)?(?:default\s+)?(?:declare\s+)?(?:abstract\s+)?(class|struct|interface|trait|protocol)\b/.exec(t)?.[1]??mt(e.kind??0)).toLowerCase();return r==="class"||r==="struct"?"class":r==="interface"||r==="trait"||r==="protocol"?"interface":"type"}function Dr(e,t,n){if(xe.test(n))return!0;let{lines:r}=e,a=r[t.startLine];if(a!==void 0&&Gt.test(a)&&xe.test(a))return!0;let o=$r(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&&!Gt.test(i))return!1;if(xe.test(i))return!0;s?s=!i.includes("/*"):s=i.endsWith("*/")&&!i.includes("/*")}return!1}function $r(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 Ur(e){let t=new Map,n=new Set;return e.forEach((r,a)=>{if(!r.includes("export"))return;let o=vr.exec(r)?.[1];if(o){let s=t.get(o);s?s.push(a):t.set(o,[a])}for(let s of Cr.exec(r)?.[1]?.match(kr)??[])n.add(s)}),{declared:t,listed:n}}function Hr(e,t){if(e.listed.has(t.leaf))return!0;let n=t.startLine-xr;return e.declared.get(t.leaf)?.some(r=>r>=n&&r<=t.startLine)??!1}function Wr(e,t){if(Er.test(e.replace(/\\/g,"/")))return!0;let n=!1;for(let[r,a]of t.slice(0,yr).entries()){let o=a.trim();if(n){if(we.test(o))return!0;n=!o.includes("*/")}else{if(o===""||r===0&&o.startsWith("#!"))continue;if(o.startsWith("/*")){if(we.test(o))return!0;n=!o.includes("*/",2)}else if(Sr.test(o)){if(we.test(o))return!0}else return!1}}return!1}function jr(e){return e.replace(/\s+/g," ").trim()}var Kr={name:1,container:.8,doc:.6,signature:.5,path:.3},Vr=200,Gr=3,qr=5,zr=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 Yt(e,t,n={}){let r=Jr(e,t,n.scope),a=[];for(let o of Yr(e,r)){if(!Zt(r,e.candidates[o]))continue;let s=en(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,Vr).map(o=>tn(r,e,o)),unresolvedProbes:r.calls.filter(o=>o.status!=="matched").map(o=>({probe:o.probe,status:o.status}))}}function Qt(e,t,n){return Zt(t,e.candidates[n])?tn(t,e,en(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 Zt(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 Jr(e,t,n){let r=new Set,a=i=>{for(let l of W(i))for(let c of de(l))r.add(c)},o=[];for(let i of t.terms){let l=[],c=[];for(let g of i){let S=Ae(g);S.length!==0&&(l.push(g),c.push(S),a(g))}if(c.length===0)continue;let p=Math.max(...c.map(g=>Xr(e,g)));o.push({labels:l,synonyms:c,weight:Math.log((e.candidates.length+1)/(p+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=>Zr(e,i));return{groups:o,totalWeight:o.reduce((i,l)=>i+l.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 $(e).variants}function Xr(e,t){return Math.min(...t.map(n=>Math.max(0,...n.map(r=>e.nameDocFreq.get(r)??0))))}function Yr(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 Qr=/[.#:/]/;function Zr(e,t){let n=t.replace(/`/g,""),r=Qr.test(n),a=r?n.split(/[.#:/]+/).filter(Boolean).at(-1)??n:n,o=e.byName.get(a)??[],s=r?o.filter(i=>to(e.candidates[i]).has(n)):o;if(s.length>0)return new Set(s.map(l=>eo(e.candidates[l]))).size>qr?{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 eo(e){return`${e.file}\0${e.container??""}`}function to(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 en(e,t,n){let r=t.candidates[n],a=e.names.some(c=>no(c,r.nameWords)),o=0,s=0,d=0,i=[];for(let c of e.groups){let p={label:c.labels[0],field:null};for(let g of Re){let S=c.synonyms.findIndex(b=>ro(r.fields[g],b));if(!(S<0)){p={label:c.labels[S],field:g};break}}i.push(p),p.field&&(o+=c.weight*Kr[p.field]),p.field==="name"&&(s+=c.weight,d+=1)}let l=e.totalWeight;return{index:n,match:l>0?o/l:0,nameCoverage:l>0?s/l:0,nameGroups:d,exactName:a,hits:i}}function no(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function ro(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 tn(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}=so(e,r);return{...n,candidate:r,callContainment:r.hasBody&&a.length>0?o.length/a.length:null,callsFound:o,fit:s,fitNote:d,specializedWords:oo(e,t,r),isCallTarget:e.callTargets.has(n.index)}}function oo(e,t,n){let r=n.fields.name;return r.words.filter((a,o)=>(t.nameDocFreq.get(a)??0)<=Gr&&!zr.has(a)&&!r.variants[o].some(s=>e.vocab.has(s)))}function so(e,t){if(t.kind!=="function"&&t.kind!=="method")return{fit:"unknown",note:null};let n=[ao(e,t),io(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 ao(e,t){if(e.returns.words.length===0)return null;let n=t.returnsText;return n?nn($(n),e.returns.words)?{verdict:"fits",note:`returns ${Xt(n)}`}:{verdict:"conflicts",note:`returns ${Xt(n)}, probe expects ${e.returns.label}`}:null}function io(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}`}:nn($(t.paramsText),e.params.words)?{verdict:"fits",note:`parameters include ${e.params.label}`}:null}function nn(e,t){return t.some(n=>n.some(r=>e.set.has(r)))}function Xt(e){return e.length>40?`${e.slice(0,39)}\u2026`:e}import{createHash as Eo}from"crypto";var co=.6,lo=.35,rn=.5,uo=.75,fo=.5,Ne="blocked: file-internal (not exported, no references from other files)",Me="blocked: marked @deprecated",oe=["reuse","rework","compose"];function sn(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 l=Qt(t,r,i);l&&a.set(i,l)};for(let i of r.callTargets)o(i);let s=new Map;for(let i of[...a.values()].filter(l=>po(r,l)))for(let l of i.candidate.calleeLeaves)for(let c of bo(e,t,i.candidate,l)){if(c===i.index)continue;let p=s.get(c);p?p.push(i):s.set(c,[i])}for(let i of s.keys())o(i);let d=[];for(let i of a.values()){let l=mo(r,i,s.get(i.index)??[]);l&&d.push(l)}return d.sort(ho)}function mo(e,t,n){let r=cn(t),a=go(e,t,n),o=t.exactName||t.nameCoverage>=uo,s=t.candidate.consumable&&!t.candidate.deprecated;return a.length>0&&!o&&s?_e(t,"compose",[...Te(t),...a]):an(t,r)?_e(t,"reuse",Te(t)):(t.exactName||t.match>=lo)&&r.length>0?_e(t,"rework",[...Te(t),...r.map(d=>d.text)]):null}function _e(e,t,n){let r=e.exactName||(e.callContainment??0)>=fo&&e.fit==="fits";return{candidate:e.candidate,bucket:t,tier:r?"direct":"signal",score:Fe(e.exactName?Math.max(e.match,.9):e.match),why:n}}function an(e,t){return(e.exactName||e.match>=co)&&t.length===0}function po(e,t){return an(t,cn(t))&&!t.isCallTarget&&!dn(e,t)}function dn(e,t){return e.groups.length>=2&&t.nameGroups===1&&t.specializedWords.length===0&&t.hits.some(n=>n.field===null)}function go(e,t,n){let r=[];t.isCallTarget&&r.push(`name matches call probe ${t.candidate.name}`),dn(e,t)&&r.push(`part of the task: name covers 1 of ${e.groups.length} concepts`);let a=n.filter(o=>on(o)>on(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 on(e){return e.exactName?Math.max(e.match,.9):e.match}function bo(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:Jt(e,t,a,n.file).some(([s,d])=>s>=n.startLine&&d<=n.endLine)})}function cn(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:Ne}),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:Me});let r=[...new Set(e.hits.flatMap(o=>o.field&&o.field!=="name"?[o.field]:[]))],a=e.exactName||e.nameCoverage>=rn||(e.callContainment??0)>=rn;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 Te(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(Be(e.candidate)),e.fit==="fits"&&e.fitNote&&t.push(`signature fits: ${e.fitNote}`),t}function Be(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 Le(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 ho(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 Fe(e){return Math.round(e*1e3)/1e3}var mn=5,pn=1200,yo=.05,So=.12,vo=15,Co=3,ko=.5,xo=200,wo=300,ln=1e-9;function gn(e,t,n={}){let r=Y(e),a=Yt(r,t,{scope:n.scope}),o=sn(e,r,a);return{candidates:Le(o,n.limit??mn,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 un=new WeakMap;function bn(e,t=pn){return hn(Y(e),t).cards}function hn(e,t){let n=un.get(e);n||(n=new Map,un.set(e,n));let r=n.get(t);if(!r){let a=e.candidates.map((s,d)=>{let i=Po(s,t);return{cardHash:Ro(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 Ro(e){return Eo("sha256").update(`card-format-${1}
5
5
  ${e}`).digest("hex")}function Po(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,xo)}`,`doc: ${e.doc.slice(0,wo)}`,`path: ${n(e.file.replace(/\.[^./]+$/,""))}`].join(" | ");return`${r}
@@ -14,4 +14,4 @@ ${a}`.slice(0,t)}function En(e,t,n={}){let{topBandMargin:r=yo,maxCardChars:a=pn}
14
14
  `),Uo(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 (
15
15
  SELECT card_hash FROM vectors ORDER BY last_used_at ASC, embedded_at ASC, card_hash ASC LIMIT ?
16
16
  )`)}}catch(r){ce("disabled (open failed)",r);try{n?.close()}catch{}return null}}function Uo(e,t){let n={schema_version:String(Oo),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 Sn(e){return Buffer.from(e.buffer,e.byteOffset,e.byteLength)}function Ho(e){return new Float32Array(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength))}function Wo(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 jo="builder";function ua(e){return De(e,jo)}var Ko=.8,Cn="inside an agent session: pass probes (--term/--name/--calls) instead of a description",Vo=3e4,Go=6e4,qo=2,zo=50,Jo=12,$e=2e3,Xo=5,se="builder query aborted",Yo=2147483647;function Qo(e){return e>=$e?`vector search returns at most ${$e} hits; lower-ranked units are not listed`:void 0}function fa(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 l(){return Object.entries(a).some(([u,f])=>f!==void 0&&(u==="CLAUDECODE"||u.startsWith("CODEX_")))}function c(u){let f=s.get(u.name);return f||(f={client:Dt(u,{fetchImpl:e.fetchImpl,env:a})},s.set(u.name,f)),f}function p(u,f,h){u.health=void 0,u.failure={state:f,detail:h,openUntil:o()+Go}}async function g(u,f,h=!1){let E=c(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<Vo,y;if(C)y=E.health.value;else{let k=await E.client.checkHealth({signal:f});if(!k.ok){J(f,se);let _=Zo(k.reason);return p(E,_,k.detail),{ok:!1,state:_,detail:k.detail}}y=k,E.health={value:k,checkedAt:o()},E.failure=void 0}let w=S(E,u,y,!C);return w.ok?{ok:!0,endpoint:u,store:w.held.store,client:E.client,...w.held.forked?{note:`model weights differ from the shared ${u.model} store; using a store forked for ${u.name}`}:{}}:w}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 w=y.key;y.close();let k=Ie(n,C,{storeKey:vn(w,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 b(u){return i(f=>{let h=bn(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(w=>Q(v,y[w.candidateIndex])).map(w=>w.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 x(u,f,h,E){let{endpoint:v,store:C,client:y}=u,w=C.missing(f.hashes);if(w.length===0)return{embedded:0,budgetExhausted:!1};let k=AbortSignal.timeout(Math.min(E,Yo)),_=h?AbortSignal.any([h,k]):k,L=Math.max(1,Math.floor(v.batchSize))*qo,T={embedded:0,budgetExhausted:!1};return(await C.withRefreshLock(async()=>{for(let q=0;q<w.length;q+=L){let z=w.slice(q,q+L);try{let U=await y.embed(z.map(F=>f.textByHash.get(F)),"document",{signal:_});C.put(z.map((F,me)=>({cardHash:F,vector:U[me]}))),T.embedded+=z.length}catch(U){if(h?.aborted)throw H(h,se);if(k.aborted){T.budgetExhausted=!0;return}p(c(v),"degraded",ue(U)),T.note=`embedding stopped: ${ue(U)}`;return}}})).acquired?T.embedded>0&&C.prune():T.note="another process is already embedding this repository",T}async function P(u,f,h,E){let v=await g(u,E);if(!v.ok)return{kind:"failed",reason:`${v.state}: ${v.detail}`};let C=b(f.scope),y=await x(v,C,E,t.indexBudgetMs),{embeddedUnits:w,fraction:k}=m(v.store,C),_;try{let[F]=await v.client.embed([h],"query",{signal:E}),me=Math.min($e,Math.max(zo,(f.limit??Xo)*Jo));_=v.store.topK(F,me,C.scopedHashes??new Set(C.hashes))}catch(F){if(E?.aborted)throw H(E,se);return p(c(u),"degraded",ue(F)),{kind:"failed",reason:`degraded: ${ue(F)}`}}let L=i(F=>En(F,_,{topBandMargin:t.topBandMargin,maxCardChars:t.maxCardChars,limit:f.limit,scope:f.scope,bucket:f.bucket})),T=C.hashes.length,Ue=w<T?`partial embeddings: ${w} of ${T} 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,Qo(_.length)].filter(F=>F!==void 0),U={provider:`embeddings:${u.name}`,probes:null,unresolvedProbes:[],candidates:L,coverage:{corpusUnits:T,embeddedUnits:w,...z.length>0?{note:z.join("; ")}:{}}};return k>=t.minCoverage?{kind:"answer",answer:U}:{kind:"degraded",answer:U,fraction:k,reason:`degraded: embedded ${w} of ${T} units (${le(k)}), below the ${le(t.minCoverage)} minimum`}}function R(){return d??=Bt(De(n,"agent-probes"),t.cacheTtlHours,o),d}async function A(u,f,h,E){if(l())return{kind:"failed",reason:Cn};let v=R(),C=v.get(u.argv,h);if(!C){let y=await Tt(u,{description:h,languages:r,workDir:De(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}`,...B(f,C)}}}function B(u,f){let h=i(E=>gn(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 M(u,f){return{...u,fallbacksTried:f,evidence:"heuristic"}}function I(u,f){return M({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 M({provider:"agent:caller",...B(u,u.probes)},[]);let v=Ve(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=[],w=[];for(let k of C){J(h,se);let _=await ae(k,u,v,h);if(_.kind==="answer")return M(_.answer,y);let L={provider:qe(k),reason:_.reason};y.push(L),_.kind==="degraded"&&w.push({entry:L,answer:_.answer,fraction:_.fraction})}if(w.length>0){let k=w.reduce((_,L)=>L.fraction>_.fraction?L:_);return M(k.answer,y.filter(_=>_!==k.entry))}return I(y,"no provider answered")}function fe(u){let f=`agent:${u.name}`;if(l())return{provider:f,state:"skipped",detail:Cn};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 g(u,f,!0);if(!E.ok)return{provider:h,state:E.state,detail:E.detail};let v=b(void 0),{embeddedUnits:C,fraction:y}=m(E.store,v),w=`${u.model} reachable; embedded ${C} of ${v.hashes.length} units (${le(y)})`;return{provider:h,state:y>=t.minCoverage?"ok":"degraded",detail:E.note?`${w}; ${E.note}`:w,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 kn(u={}){let{endpoint:f,signal:h,endsAt:E,budgetMs:v=t.indexBudgetMs}=u,C=f===void 0?t.endpoints:t.endpoints.filter(w=>w.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 w of C){let k=await g(w,h);if(!k.ok){y.push(`embeddings:${w.name} ${k.state}: ${k.detail}`);continue}let _=b(void 0),L=E===void 0?v:Math.max(1,Math.floor((E-o())*Ko)),T=await x(k,_,h,L);return{provider:`embeddings:${w.name}`,embedded:T.embedded,coverage:m(k.store,_).fraction,budgetExhausted:T.budgetExhausted,...T.note?{note:T.note}:{}}}throw new Error(`No embeddings endpoint could be refreshed: ${y.join("; ")}`)}function xn(){for(let u of s.values())u.held?.store.close(),u.held=void 0}return{query:K,providerStatus:G,refreshEmbeddings:kn,close:xn}}function Zo(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{ua as a,fa as b};
17
- //# sourceMappingURL=chunk-FQA3KIFX.js.map
17
+ //# sourceMappingURL=chunk-5DSL3NT2.js.map