@qitqode/qitqode-android-arm64 0.1.26 → 0.1.27

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 (418) hide show
  1. package/bundle/chunk-02y04bsz.js +2 -0
  2. package/bundle/{chunk-x3z8q0ep.js → chunk-04tw0r4s.js} +1 -1
  3. package/bundle/chunk-07ws99b1.js +2 -0
  4. package/bundle/chunk-09c4ngag.js +2 -0
  5. package/bundle/{chunk-se195e52.js → chunk-09kba1hg.js} +2 -2
  6. package/bundle/{chunk-pfn1db1m.js → chunk-0a0vat1h.js} +2 -2
  7. package/bundle/{chunk-txty44v2.js → chunk-0eqwm9a8.js} +2 -2
  8. package/bundle/chunk-0jgst767.js +2 -0
  9. package/bundle/chunk-0psrr9vp.js +2 -0
  10. package/bundle/chunk-0srrmwqs.js +2 -0
  11. package/bundle/{chunk-eq33vmze.js → chunk-0x3sbyny.js} +2 -2
  12. package/bundle/chunk-0zkejr6k.js +2 -0
  13. package/bundle/{chunk-z2q3mg73.js → chunk-12bssxd4.js} +2 -2
  14. package/bundle/chunk-14n6rvh2.js +2 -0
  15. package/bundle/{chunk-1qbm1k9y.js → chunk-17psxhve.js} +3 -3
  16. package/bundle/{chunk-hz1hd1bd.js → chunk-1bhvt33f.js} +1 -1
  17. package/bundle/{chunk-49tqzsy0.js → chunk-1dwcga8g.js} +2 -2
  18. package/bundle/{chunk-9qtf8khv.js → chunk-1fbeendk.js} +1 -1
  19. package/bundle/chunk-1fja3j80.js +2 -0
  20. package/bundle/chunk-1j73cnvz.js +2 -0
  21. package/bundle/{chunk-eqaym8gm.js → chunk-1qshjfzm.js} +1 -1
  22. package/bundle/{chunk-d31yrcrn.js → chunk-1rp1cvmc.js} +2 -2
  23. package/bundle/{chunk-vx837ete.js → chunk-1sgby720.js} +1 -1
  24. package/bundle/{chunk-wefjbwv6.js → chunk-1t9jne14.js} +1 -1
  25. package/bundle/chunk-1yddn03z.js +2 -0
  26. package/bundle/{chunk-qngs31yf.js → chunk-26nfphsg.js} +1 -1
  27. package/bundle/{chunk-kkdgzeva.js → chunk-27yxgy03.js} +2 -2
  28. package/bundle/{chunk-b79k456s.js → chunk-2ahqhh4z.js} +1 -1
  29. package/bundle/{chunk-fx7w497c.js → chunk-2bn4b42t.js} +1 -1
  30. package/bundle/{chunk-4k70wrhf.js → chunk-2dzk5txw.js} +1 -1
  31. package/bundle/{chunk-56qm8xpt.js → chunk-2jmxt3fb.js} +1 -1
  32. package/bundle/{chunk-r1yqmd4y.js → chunk-2km50rd3.js} +1 -1
  33. package/bundle/{chunk-j87bvp1b.js → chunk-2q96x1t5.js} +1 -1
  34. package/bundle/{chunk-77e1wh0j.js → chunk-2rs39vj2.js} +2 -2
  35. package/bundle/{chunk-qb5qemtp.js → chunk-2tnarng3.js} +1 -1
  36. package/bundle/{chunk-cr06m77n.js → chunk-2vepzgek.js} +2 -2
  37. package/bundle/{chunk-s86fj82v.js → chunk-2wcv3sq5.js} +2 -2
  38. package/bundle/{chunk-k7h6tfzj.js → chunk-371r2111.js} +1 -1
  39. package/bundle/{chunk-5jtd006j.js → chunk-37n34pzd.js} +2 -2
  40. package/bundle/chunk-38g8yzw0.js +2 -0
  41. package/bundle/chunk-3bkd0ar3.js +2 -0
  42. package/bundle/{chunk-6nkcfncg.js → chunk-3bmzjznz.js} +1 -1
  43. package/bundle/chunk-3c7d3dqt.js +3 -0
  44. package/bundle/{chunk-7n2kpqh5.js → chunk-3nwve06r.js} +1 -1
  45. package/bundle/{chunk-ptf09vmp.js → chunk-3nyqh1d6.js} +1 -1
  46. package/bundle/{chunk-7rxsj310.js → chunk-463f9wre.js} +2 -2
  47. package/bundle/{chunk-cyjzqa5p.js → chunk-47b084yv.js} +204 -202
  48. package/bundle/{chunk-6s2f5sv4.js → chunk-48fvrggx.js} +1 -1
  49. package/bundle/chunk-4amgp4yd.js +3 -0
  50. package/bundle/chunk-4k7kbhps.js +2 -0
  51. package/bundle/{chunk-f3c9667r.js → chunk-4qqkqrn9.js} +2 -2
  52. package/bundle/chunk-4sz3jbc5.js +2 -0
  53. package/bundle/{chunk-1n4w8dya.js → chunk-4tbwha3m.js} +2 -2
  54. package/bundle/{chunk-admgf65a.js → chunk-4ypcf4tg.js} +1 -1
  55. package/bundle/chunk-4z4p492c.js +3 -0
  56. package/bundle/chunk-55b9699f.js +2 -0
  57. package/bundle/{chunk-dv5zf5gz.js → chunk-5a5t01ka.js} +1 -1
  58. package/bundle/{chunk-880msfsd.js → chunk-5fgx6fa4.js} +1 -1
  59. package/bundle/{chunk-t1vtdgd6.js → chunk-5fz8tph5.js} +1 -1
  60. package/bundle/{chunk-e57d1he9.js → chunk-5qam3c8r.js} +1 -1
  61. package/bundle/{chunk-fffj9447.js → chunk-61c62e5s.js} +2 -2
  62. package/bundle/chunk-6d9wsjxm.js +2 -0
  63. package/bundle/{chunk-f6y7a5w3.js → chunk-6fp8a9ek.js} +2 -2
  64. package/bundle/chunk-6gz9cthq.js +2 -0
  65. package/bundle/{chunk-st74db4c.js → chunk-6hv59ere.js} +1 -1
  66. package/bundle/{chunk-56pwz1kk.js → chunk-6nbzdb0r.js} +1 -1
  67. package/bundle/{chunk-8ahpk8td.js → chunk-6p7yg5sr.js} +1 -1
  68. package/bundle/chunk-6q87abbr.js +2 -0
  69. package/bundle/{chunk-kfk1zqc1.js → chunk-6qy1ghrx.js} +1 -1
  70. package/bundle/chunk-730a2d1k.js +2 -0
  71. package/bundle/chunk-7bd0x9vf.js +2 -0
  72. package/bundle/chunk-7czkntef.js +2 -0
  73. package/bundle/chunk-7ex57nyh.js +2 -0
  74. package/bundle/chunk-7gpczxbh.js +2 -0
  75. package/bundle/chunk-7j0bgeh2.js +2 -0
  76. package/bundle/{chunk-w3pzv615.js → chunk-7jbz3dgt.js} +1 -1
  77. package/bundle/{chunk-0ndvy0nh.js → chunk-7ppd2phw.js} +2 -2
  78. package/bundle/chunk-7py443fe.js +2 -0
  79. package/bundle/{chunk-ykxde207.js → chunk-7yrhe3xq.js} +2 -2
  80. package/bundle/{chunk-3s0d17xe.js → chunk-89q1y7tc.js} +1 -1
  81. package/bundle/{chunk-9wm41z2f.js → chunk-89v6dgpp.js} +2 -2
  82. package/bundle/chunk-8cdm8gh2.js +2 -0
  83. package/bundle/chunk-90q5sae0.js +2 -0
  84. package/bundle/{chunk-ygwe0vf1.js → chunk-90zd5rss.js} +2 -2
  85. package/bundle/chunk-9grvepmd.js +2 -0
  86. package/bundle/chunk-9hrh15p2.js +2 -0
  87. package/bundle/{chunk-t7tstr83.js → chunk-9j1qqdr2.js} +1 -1
  88. package/bundle/{chunk-hkmb3zer.js → chunk-9t84mh6t.js} +2 -2
  89. package/bundle/{chunk-58gp7wbg.js → chunk-a1p2f16h.js} +2 -2
  90. package/bundle/{chunk-fk8cctjy.js → chunk-a1pw9r6f.js} +2 -2
  91. package/bundle/chunk-a2qz9m10.js +2 -0
  92. package/bundle/{chunk-0w5npkgr.js → chunk-ab6cabxh.js} +1 -1
  93. package/bundle/{chunk-jzcz92pq.js → chunk-ad46r434.js} +2 -2
  94. package/bundle/{chunk-qmhcbdkg.js → chunk-ak5ngp50.js} +2 -2
  95. package/bundle/{chunk-j7zs1yg2.js → chunk-apbgb4h0.js} +1 -1
  96. package/bundle/chunk-av6ezvxm.js +2 -0
  97. package/bundle/{chunk-s2za1y84.js → chunk-aztre27e.js} +1 -1
  98. package/bundle/{chunk-xdv9xt0y.js → chunk-b0syck9r.js} +2 -2
  99. package/bundle/{chunk-sdsggxm4.js → chunk-b2z0kjss.js} +2 -2
  100. package/bundle/{chunk-s1h0k1yj.js → chunk-b3dqcbsc.js} +1 -1
  101. package/bundle/{chunk-xdwej3ae.js → chunk-b75gpv0q.js} +1 -1
  102. package/bundle/chunk-b7mg883n.js +3 -0
  103. package/bundle/{chunk-ewvgbg68.js → chunk-b8tw709r.js} +1 -1
  104. package/bundle/{chunk-7fmy4cvn.js → chunk-b9za12y1.js} +1 -1
  105. package/bundle/{chunk-dazye86e.js → chunk-baet4zev.js} +2 -2
  106. package/bundle/{chunk-hybq019j.js → chunk-be216spx.js} +2 -2
  107. package/bundle/chunk-beksar7w.js +2 -0
  108. package/bundle/chunk-bg66rqrx.js +2 -0
  109. package/bundle/{chunk-cn10hn58.js → chunk-brpx707p.js} +1 -1
  110. package/bundle/{chunk-32zrch7h.js → chunk-bss414qz.js} +1 -1
  111. package/bundle/{chunk-vthm5q05.js → chunk-btneef3z.js} +1 -1
  112. package/bundle/{chunk-5mec6cde.js → chunk-btz9jvec.js} +1 -1
  113. package/bundle/{chunk-6nk3wx6f.js → chunk-bvkq0a5q.js} +1 -1
  114. package/bundle/{chunk-kn318ev4.js → chunk-c01z3cvg.js} +2 -2
  115. package/bundle/{chunk-4nck07pc.js → chunk-c0796v8j.js} +2 -2
  116. package/bundle/{chunk-z559gc3n.js → chunk-c5e6sk9c.js} +1 -1
  117. package/bundle/chunk-c7yy1km8.js +2 -0
  118. package/bundle/{chunk-453wpzg6.js → chunk-c8k32724.js} +1 -1
  119. package/bundle/{chunk-2q76qax6.js → chunk-cafzcmrg.js} +2 -2
  120. package/bundle/{chunk-g6dgc5af.js → chunk-cdhmc0t0.js} +1 -1
  121. package/bundle/{chunk-xc3fadkh.js → chunk-chmrvbbj.js} +1 -1
  122. package/bundle/{chunk-6vb26adv.js → chunk-cpmmvwgw.js} +1 -1
  123. package/bundle/{chunk-vpqd0t8a.js → chunk-crx18k6g.js} +2 -2
  124. package/bundle/{chunk-14ag9ea0.js → chunk-ct48575c.js} +1 -1
  125. package/bundle/chunk-ct6dv8st.js +2 -0
  126. package/bundle/{chunk-5ymj2q6j.js → chunk-cvdxgsq1.js} +2 -2
  127. package/bundle/{chunk-41ftye7w.js → chunk-cvwa142e.js} +1 -1
  128. package/bundle/chunk-cy9s1ma5.js +2 -0
  129. package/bundle/{chunk-fxb6vjcb.js → chunk-d5bxan80.js} +2 -2
  130. package/bundle/{chunk-p0k4sv89.js → chunk-d6r4xwtg.js} +4 -4
  131. package/bundle/{chunk-vyjsng14.js → chunk-deae0y1j.js} +1 -1
  132. package/bundle/{chunk-rf625fxx.js → chunk-dfnv7vkn.js} +1 -1
  133. package/bundle/{chunk-06x1p3t4.js → chunk-dhjp0zx2.js} +1 -1
  134. package/bundle/{chunk-xak2r993.js → chunk-dq9kpj4a.js} +2 -2
  135. package/bundle/{chunk-kp84yba1.js → chunk-dqed63ek.js} +1 -1
  136. package/bundle/{chunk-7tbvr236.js → chunk-drs1gv2b.js} +1 -1
  137. package/bundle/{chunk-xqxpjbqk.js → chunk-ds69qc8b.js} +1 -1
  138. package/bundle/chunk-dtv1vp0d.js +2 -0
  139. package/bundle/chunk-dvk2wwjj.js +2 -0
  140. package/bundle/{chunk-tyy4gx61.js → chunk-dzxzcb2e.js} +1 -1
  141. package/bundle/chunk-e0jy9qxd.js +2 -0
  142. package/bundle/{chunk-t6xm49ea.js → chunk-eb9mytjq.js} +1 -1
  143. package/bundle/{chunk-hjratj6g.js → chunk-ecn8gbtz.js} +1 -1
  144. package/bundle/chunk-erg0ske8.js +2 -0
  145. package/bundle/chunk-ew51rwdp.js +9 -0
  146. package/bundle/{chunk-3bb7y9pq.js → chunk-exh6cg1r.js} +2 -2
  147. package/bundle/{chunk-afhg3w2j.js → chunk-f45tp3e3.js} +1 -1
  148. package/bundle/chunk-f72pppr7.js +2 -0
  149. package/bundle/{chunk-fk3praj7.js → chunk-fddsgvjy.js} +1 -1
  150. package/bundle/{chunk-pnj8s20t.js → chunk-fff3151r.js} +1 -1
  151. package/bundle/{chunk-0mekr486.js → chunk-fkgv2hqd.js} +1 -1
  152. package/bundle/{chunk-zvsafnkp.js → chunk-fnbpap62.js} +2 -2
  153. package/bundle/{chunk-5yaahmjb.js → chunk-g1dwbvkg.js} +1 -1
  154. package/bundle/{chunk-1xkwm21b.js → chunk-g3dhsmbt.js} +3 -3
  155. package/bundle/{chunk-c0k8j498.js → chunk-g7rjtehn.js} +1 -1
  156. package/bundle/chunk-gbyy8sh5.js +2 -0
  157. package/bundle/{chunk-e58pdw5k.js → chunk-gf0pdgjs.js} +2 -2
  158. package/bundle/{chunk-0m2tj2h9.js → chunk-ggqst87g.js} +1 -1
  159. package/bundle/chunk-gk34kh8p.js +2 -0
  160. package/bundle/{chunk-1yx4jesj.js → chunk-gm85xefs.js} +1 -1
  161. package/bundle/chunk-gn50xqbd.js +2 -0
  162. package/bundle/{chunk-wmrq9qqf.js → chunk-gsez13bg.js} +1 -1
  163. package/bundle/{chunk-njzpswgt.js → chunk-gsvdt4kq.js} +7 -7
  164. package/bundle/{chunk-s54c8fpf.js → chunk-h0rpmne5.js} +1 -1
  165. package/bundle/chunk-h7s2w1e2.js +2 -0
  166. package/bundle/chunk-h7yya9pv.js +7610 -0
  167. package/bundle/{chunk-91khd3fq.js → chunk-h9pvnp5c.js} +1 -1
  168. package/bundle/chunk-hgxdg1y5.js +2 -0
  169. package/bundle/{chunk-07net7s8.js → chunk-hj5y7fvk.js} +1 -1
  170. package/bundle/chunk-hmv2cdnz.js +2 -0
  171. package/bundle/chunk-ht81ensf.js +2 -0
  172. package/bundle/chunk-j59ktwny.js +2 -0
  173. package/bundle/{chunk-3zn71txs.js → chunk-j5kb0y1m.js} +1 -1
  174. package/bundle/{chunk-6wdwwpsc.js → chunk-j5y10dn6.js} +2 -2
  175. package/bundle/{chunk-qpv4438m.js → chunk-j6emx6jn.js} +2 -2
  176. package/bundle/{chunk-x36jhtex.js → chunk-j8efst22.js} +1 -1
  177. package/bundle/{chunk-z3hj5bfd.js → chunk-j94bdaav.js} +2 -2
  178. package/bundle/{chunk-z4ae6jmb.js → chunk-j9pcnkkq.js} +3 -3
  179. package/bundle/{chunk-ppvmy940.js → chunk-jg7s9rqz.js} +2 -2
  180. package/bundle/chunk-jh3nw7fd.js +2 -0
  181. package/bundle/chunk-jh6yvzee.js +2 -0
  182. package/bundle/{chunk-y2ch07yv.js → chunk-jje0srjq.js} +2 -2
  183. package/bundle/{chunk-nxjbbq5h.js → chunk-jm1ptn8n.js} +1 -1
  184. package/bundle/chunk-jmz2mq3t.js +2 -0
  185. package/bundle/{chunk-2yb59jwr.js → chunk-jnabd9gn.js} +1 -1
  186. package/bundle/chunk-k309zez0.js +3 -0
  187. package/bundle/chunk-k3fn3yed.js +2 -0
  188. package/bundle/{chunk-wg42cxrw.js → chunk-k7gq9bra.js} +1 -1
  189. package/bundle/{chunk-n07rsssz.js → chunk-k9b1jcqw.js} +1 -1
  190. package/bundle/{chunk-qan3kwbv.js → chunk-kavhpdvb.js} +1 -1
  191. package/bundle/{chunk-qm9ezq93.js → chunk-kdcnder5.js} +1 -1
  192. package/bundle/{chunk-28vnspd4.js → chunk-kfsb2stm.js} +1 -1
  193. package/bundle/{chunk-kvz0vzsn.js → chunk-knpt9n8f.js} +1 -1
  194. package/bundle/chunk-kpw6nghv.js +2 -0
  195. package/bundle/{chunk-cbmw8fy2.js → chunk-kqn9h2gk.js} +1 -1
  196. package/bundle/{chunk-9zrwbxx0.js → chunk-ksyh6h3a.js} +2 -2
  197. package/bundle/{chunk-kbyk7hyn.js → chunk-m02zt1a3.js} +2 -2
  198. package/bundle/{chunk-yqtfvgrp.js → chunk-m1h5a4vg.js} +1 -1
  199. package/bundle/{chunk-kpnfndkg.js → chunk-m2ekhbdp.js} +1 -1
  200. package/bundle/{chunk-atbm0pnt.js → chunk-m2x9xhha.js} +2 -2
  201. package/bundle/chunk-m5ghbt5y.js +2 -0
  202. package/bundle/{chunk-7ryv0f5h.js → chunk-m612agnk.js} +1 -1
  203. package/bundle/{chunk-05amr7y9.js → chunk-m67tcnk4.js} +1 -1
  204. package/bundle/{chunk-2sy1wx99.js → chunk-m8yv4sd2.js} +1 -1
  205. package/bundle/{chunk-vy9xre57.js → chunk-mdck9s88.js} +1 -1
  206. package/bundle/{chunk-613kegcn.js → chunk-mgk9sh16.js} +1 -1
  207. package/bundle/{chunk-7e1aw8rw.js → chunk-mk6cddvd.js} +1 -1
  208. package/bundle/chunk-mn41f9qv.js +2 -0
  209. package/bundle/chunk-mqjf9sbm.js +2 -0
  210. package/bundle/{chunk-n10atvac.js → chunk-msegx0t7.js} +1 -1
  211. package/bundle/{chunk-8bzwgcjb.js → chunk-mskwkcgj.js} +1 -1
  212. package/bundle/chunk-n5gwrrbb.js +2 -0
  213. package/bundle/{chunk-1xpx1t40.js → chunk-n8h6x2en.js} +2 -2
  214. package/bundle/chunk-nfjhem1c.js +2 -0
  215. package/bundle/{chunk-j0ftbmex.js → chunk-ngchsw2g.js} +2 -2
  216. package/bundle/{chunk-3rgct4bd.js → chunk-nj4d554m.js} +1 -1
  217. package/bundle/{chunk-d2n09yvh.js → chunk-njnwdgvd.js} +2 -2
  218. package/bundle/{chunk-w4hbw37v.js → chunk-nt4e3em9.js} +1 -1
  219. package/bundle/chunk-nx90tvwg.js +2 -0
  220. package/bundle/{chunk-f416n3mp.js → chunk-nxbkh4k9.js} +2 -2
  221. package/bundle/chunk-nxyyn2ra.js +2 -0
  222. package/bundle/{chunk-md7vpe1e.js → chunk-nzehfpxp.js} +1 -1
  223. package/bundle/chunk-p5tceb4k.js +2 -0
  224. package/bundle/{chunk-3w64fpwn.js → chunk-p68rwmhc.js} +2 -2
  225. package/bundle/{chunk-nszqy06d.js → chunk-pekm54ce.js} +1 -1
  226. package/bundle/{chunk-fvy5w4dh.js → chunk-pget15wc.js} +1 -1
  227. package/bundle/{chunk-tedrfa7d.js → chunk-phxrg7aw.js} +2 -2
  228. package/bundle/{chunk-81engf0t.js → chunk-ppfjf7qx.js} +1 -1
  229. package/bundle/{chunk-s5krbdvd.js → chunk-q1v2pytx.js} +1 -1
  230. package/bundle/{chunk-w01gjnty.js → chunk-q6ztpfcs.js} +2 -2
  231. package/bundle/{chunk-yvj021eg.js → chunk-qhc90p4a.js} +2 -2
  232. package/bundle/chunk-qjgm3e2p.js +2 -0
  233. package/bundle/{chunk-qkwhgfjt.js → chunk-qjjch1zt.js} +2 -2
  234. package/bundle/{chunk-f3rrd2p6.js → chunk-qjn86fc0.js} +1 -1
  235. package/bundle/{chunk-qq71akpw.js → chunk-qrey2gwb.js} +2 -2
  236. package/bundle/chunk-qt1wffbh.js +3 -0
  237. package/bundle/{chunk-z2m09m4w.js → chunk-qt2c4bty.js} +1 -1
  238. package/bundle/{chunk-pjbbdm96.js → chunk-qv2s39dv.js} +2 -2
  239. package/bundle/chunk-r08957sm.js +11 -0
  240. package/bundle/chunk-r1616dce.js +2 -0
  241. package/bundle/chunk-s07j8hfy.js +2 -0
  242. package/bundle/{chunk-01gwb793.js → chunk-s3yna2wm.js} +1 -1
  243. package/bundle/{chunk-0vqrakhw.js → chunk-s6bar2f9.js} +1 -1
  244. package/bundle/chunk-sbyey0qb.js +2 -0
  245. package/bundle/{chunk-ze00x1xb.js → chunk-scnz207s.js} +2 -2
  246. package/bundle/{chunk-xcs2jbz9.js → chunk-sermjas1.js} +1 -1
  247. package/bundle/chunk-sj5v361q.js +2 -0
  248. package/bundle/chunk-smtvgr3w.js +2 -0
  249. package/bundle/{chunk-ynfbz3sz.js → chunk-snm5q21k.js} +2 -2
  250. package/bundle/{chunk-4920vf6a.js → chunk-srh4xvsj.js} +1 -1
  251. package/bundle/{chunk-m7txgh5w.js → chunk-stezw26z.js} +1 -1
  252. package/bundle/{chunk-g7vahvkz.js → chunk-szr0f7k2.js} +1 -1
  253. package/bundle/{chunk-vw673y0t.js → chunk-t12xrrfr.js} +2 -2
  254. package/bundle/{chunk-6fpfr8tk.js → chunk-tj78jsp9.js} +1 -1
  255. package/bundle/chunk-tpndnprb.js +2 -0
  256. package/bundle/{chunk-jdkxeqw5.js → chunk-tr8sf0dk.js} +1 -1
  257. package/bundle/{chunk-hyckncza.js → chunk-v2zp22r3.js} +2 -2
  258. package/bundle/{chunk-0cehm5fn.js → chunk-v4xcysh0.js} +1 -1
  259. package/bundle/{chunk-7qxn24qa.js → chunk-v965rsr8.js} +2 -2
  260. package/bundle/{chunk-0304b7xg.js → chunk-va316nee.js} +1 -1
  261. package/bundle/chunk-vfdhqf4h.js +28 -0
  262. package/bundle/{chunk-6h2faxs9.js → chunk-vg2fmyje.js} +2 -2
  263. package/bundle/{chunk-yt1yk4j1.js → chunk-vj62pc0h.js} +1 -1
  264. package/bundle/{chunk-2jn2hd12.js → chunk-vkskqhag.js} +2 -2
  265. package/bundle/{chunk-hk8j5ht8.js → chunk-vn7nkrqb.js} +2 -2
  266. package/bundle/{chunk-g8wvr7a1.js → chunk-vsjyr170.js} +2 -2
  267. package/bundle/chunk-vwxfgea7.js +2 -0
  268. package/bundle/chunk-w0kgcz1t.js +2 -0
  269. package/bundle/{chunk-zjvzc0my.js → chunk-w87a3mzm.js} +1 -1
  270. package/bundle/chunk-wajmd3r7.js +2 -0
  271. package/bundle/{chunk-9p83me3p.js → chunk-whxjkz9a.js} +2 -2
  272. package/bundle/chunk-wksczmes.js +2 -0
  273. package/bundle/{chunk-2kdn66xt.js → chunk-wnqwb6fd.js} +1 -1
  274. package/bundle/chunk-wrw22v0a.js +616 -0
  275. package/bundle/chunk-wsxta33r.js +2 -0
  276. package/bundle/{chunk-rvrjw0fy.js → chunk-wsy0m70r.js} +1 -1
  277. package/bundle/{chunk-w2gpgapp.js → chunk-wy46mbwt.js} +1 -1
  278. package/bundle/{chunk-cqhpbfcn.js → chunk-wz0zcddf.js} +3 -3
  279. package/bundle/{chunk-q2exgz82.js → chunk-x067eetw.js} +1 -1
  280. package/bundle/{chunk-fkat2pw6.js → chunk-xc5044tm.js} +1 -1
  281. package/bundle/chunk-xck0sq3k.js +2 -0
  282. package/bundle/chunk-xjyhtm8r.js +2 -0
  283. package/bundle/{chunk-wg5dv21f.js → chunk-xn2ds2s4.js} +2 -2
  284. package/bundle/{chunk-rs0nx844.js → chunk-xpc2zgj7.js} +2 -2
  285. package/bundle/{chunk-54pk7nna.js → chunk-xrxyrr00.js} +1 -1
  286. package/bundle/{chunk-zna6neq5.js → chunk-xs3xtz6x.js} +1 -1
  287. package/bundle/{chunk-crap29f6.js → chunk-xxbqhg9n.js} +1 -1
  288. package/bundle/{chunk-gaxbbxk6.js → chunk-y062spw2.js} +1 -1
  289. package/bundle/{chunk-bse8p94q.js → chunk-y2v09y71.js} +1 -1
  290. package/bundle/chunk-y9p87bfd.js +2 -0
  291. package/bundle/{chunk-g4qwkcdv.js → chunk-yajd975f.js} +1 -1
  292. package/bundle/{chunk-5dm3p5r6.js → chunk-ydp0q1hk.js} +1 -1
  293. package/bundle/{chunk-gxa2r4zc.js → chunk-yfkvjphe.js} +1 -1
  294. package/bundle/chunk-ygc5qegv.js +2 -0
  295. package/bundle/{chunk-kbg3k1az.js → chunk-yhk7d1j0.js} +1 -1
  296. package/bundle/chunk-yhwx62yf.js +2 -0
  297. package/bundle/chunk-yjqmzm51.js +2 -0
  298. package/bundle/{chunk-49ypxzfx.js → chunk-yjtdgcq5.js} +1 -1
  299. package/bundle/{chunk-mg239rc3.js → chunk-yp0a8q29.js} +3 -3
  300. package/bundle/{chunk-p31yg62z.js → chunk-yq3m8190.js} +2 -2
  301. package/bundle/{chunk-rze20q68.js → chunk-yt3f3j35.js} +1 -1
  302. package/bundle/{chunk-tfggzzqw.js → chunk-ywkvq7zb.js} +1 -1
  303. package/bundle/chunk-z4z8hk7e.js +2 -0
  304. package/bundle/chunk-z7y9pdj7.js +2 -0
  305. package/bundle/chunk-z8g819cz.js +2 -0
  306. package/bundle/{chunk-h56jxxvj.js → chunk-z8v2tsz2.js} +1 -1
  307. package/bundle/{chunk-vztxv9dj.js → chunk-zb0me4kk.js} +1 -1
  308. package/bundle/{chunk-7ez3ye6e.js → chunk-zcm2jdr5.js} +1 -1
  309. package/bundle/chunk-zqv7fx25.js +2 -0
  310. package/bundle/{chunk-hb4d06q0.js → chunk-zrc54vc4.js} +2 -2
  311. package/bundle/chunk-zs2a1f20.js +2 -0
  312. package/bundle/chunk-zt1nbwmm.js +2 -0
  313. package/bundle/{chunk-fd9zrmhr.js → chunk-ztc3gm8y.js} +2 -2
  314. package/bundle/{chunk-08y06vgt.js → chunk-zxaaxb99.js} +2 -2
  315. package/bundle/{chunk-x3931we7.js → chunk-zyhdxggp.js} +2 -2
  316. package/bundle/index.js +3 -3
  317. package/bundle/parser.worker.js +2 -2
  318. package/bundle/qffi.node +0 -0
  319. package/bundle/worker.js +1 -1
  320. package/package.json +1 -1
  321. package/bundle/chunk-09ecxdmd.js +0 -2
  322. package/bundle/chunk-0jaj2g7x.js +0 -2
  323. package/bundle/chunk-0nr2925m.js +0 -2
  324. package/bundle/chunk-0wbq1y92.js +0 -2
  325. package/bundle/chunk-12pxszgn.js +0 -2
  326. package/bundle/chunk-1337582e.js +0 -2
  327. package/bundle/chunk-182jf8fz.js +0 -2
  328. package/bundle/chunk-1ht3zcsh.js +0 -2
  329. package/bundle/chunk-25zkavr0.js +0 -2
  330. package/bundle/chunk-2cm91ktc.js +0 -3
  331. package/bundle/chunk-2jfd82jk.js +0 -2
  332. package/bundle/chunk-2k7bbzj2.js +0 -2
  333. package/bundle/chunk-30081kwd.js +0 -2
  334. package/bundle/chunk-3kdhvq0p.js +0 -3
  335. package/bundle/chunk-3vag59se.js +0 -2
  336. package/bundle/chunk-3x5v6sjw.js +0 -2
  337. package/bundle/chunk-43ep9d7a.js +0 -2
  338. package/bundle/chunk-48j09m6e.js +0 -3
  339. package/bundle/chunk-4qqja22v.js +0 -2
  340. package/bundle/chunk-5gazgxt5.js +0 -2
  341. package/bundle/chunk-63znhwx0.js +0 -2
  342. package/bundle/chunk-6hmyy7n6.js +0 -2
  343. package/bundle/chunk-7dyddrpk.js +0 -2
  344. package/bundle/chunk-7penjsgq.js +0 -2
  345. package/bundle/chunk-7t5gzkj6.js +0 -2
  346. package/bundle/chunk-89vgt8vq.js +0 -2
  347. package/bundle/chunk-8e8n82f9.js +0 -2
  348. package/bundle/chunk-97exhw9j.js +0 -2
  349. package/bundle/chunk-9cvkaht5.js +0 -2
  350. package/bundle/chunk-akdvstd9.js +0 -2
  351. package/bundle/chunk-ave2e4sa.js +0 -2
  352. package/bundle/chunk-axnwehc7.js +0 -2
  353. package/bundle/chunk-bmzyxspj.js +0 -2
  354. package/bundle/chunk-bvaqpfv8.js +0 -2
  355. package/bundle/chunk-cxb05cdg.js +0 -2
  356. package/bundle/chunk-cxe92z5c.js +0 -2
  357. package/bundle/chunk-d5wp85kw.js +0 -2
  358. package/bundle/chunk-dm5xnb4t.js +0 -2
  359. package/bundle/chunk-dpeqsvan.js +0 -2
  360. package/bundle/chunk-drxtmg5c.js +0 -2
  361. package/bundle/chunk-e9pfdjcy.js +0 -2
  362. package/bundle/chunk-ejn5hfzd.js +0 -2
  363. package/bundle/chunk-ek1fawsj.js +0 -3
  364. package/bundle/chunk-ernd18jb.js +0 -2
  365. package/bundle/chunk-ff9b4cg8.js +0 -2
  366. package/bundle/chunk-fpff6a4q.js +0 -2
  367. package/bundle/chunk-gq361kdt.js +0 -2
  368. package/bundle/chunk-hbagpppv.js +0 -2
  369. package/bundle/chunk-hf473xav.js +0 -2
  370. package/bundle/chunk-hr88054m.js +0 -2
  371. package/bundle/chunk-j3czd7v2.js +0 -28
  372. package/bundle/chunk-j9m2d6t5.js +0 -2
  373. package/bundle/chunk-jd9edy2s.js +0 -2
  374. package/bundle/chunk-jwtdbx31.js +0 -2
  375. package/bundle/chunk-kbjwdv1x.js +0 -8223
  376. package/bundle/chunk-krkxrej2.js +0 -2
  377. package/bundle/chunk-m26mcy8p.js +0 -2
  378. package/bundle/chunk-m62wgqp1.js +0 -2
  379. package/bundle/chunk-m84cn9c6.js +0 -2
  380. package/bundle/chunk-mvc7pvtq.js +0 -2
  381. package/bundle/chunk-nfp9xtca.js +0 -3
  382. package/bundle/chunk-ngz5xw45.js +0 -3
  383. package/bundle/chunk-p5t9mq8r.js +0 -2
  384. package/bundle/chunk-pfbykat1.js +0 -2
  385. package/bundle/chunk-qd0nvn4z.js +0 -2
  386. package/bundle/chunk-qh99kv2j.js +0 -2
  387. package/bundle/chunk-qyrafh4m.js +0 -2
  388. package/bundle/chunk-rc37cw86.js +0 -2
  389. package/bundle/chunk-rmpty636.js +0 -2
  390. package/bundle/chunk-rz54qjew.js +0 -2
  391. package/bundle/chunk-s3wjwxme.js +0 -2
  392. package/bundle/chunk-s4ncnbgd.js +0 -2
  393. package/bundle/chunk-snz3w30x.js +0 -2
  394. package/bundle/chunk-srw748gr.js +0 -2
  395. package/bundle/chunk-tn167yyz.js +0 -2
  396. package/bundle/chunk-v1xwe58d.js +0 -2
  397. package/bundle/chunk-vh05n2x3.js +0 -2
  398. package/bundle/chunk-vrfegg5f.js +0 -2
  399. package/bundle/chunk-w12tky28.js +0 -2
  400. package/bundle/chunk-w9ct698t.js +0 -2
  401. package/bundle/chunk-wms4skr9.js +0 -11
  402. package/bundle/chunk-wr5hdsst.js +0 -9
  403. package/bundle/chunk-wxnqgh8t.js +0 -2
  404. package/bundle/chunk-wzmte7sy.js +0 -3
  405. package/bundle/chunk-x0h1jdxt.js +0 -2
  406. package/bundle/chunk-x6hsmnhz.js +0 -2
  407. package/bundle/chunk-xg9e0enb.js +0 -2
  408. package/bundle/chunk-xtxxb25n.js +0 -2
  409. package/bundle/chunk-y3s7sh1e.js +0 -2
  410. package/bundle/chunk-ydvheqw9.js +0 -2
  411. package/bundle/chunk-yxnq0d7k.js +0 -2
  412. package/bundle/chunk-z2raegj9.js +0 -2
  413. package/bundle/chunk-z3pyhmg6.js +0 -2
  414. package/bundle/chunk-z7pg6sw1.js +0 -2
  415. package/bundle/chunk-z84376c6.js +0 -2
  416. package/bundle/chunk-zn8th65r.js +0 -2
  417. package/bundle/chunk-ztv1brgn.js +0 -2
  418. package/bundle/chunk-zyxvd9fj.js +0 -2
@@ -1,8 +1,8 @@
1
1
  // @bun
2
- import{Cp as s$}from"./chunk-7qxn24qa.js";import{Op as Z2,Pp as X2,Rp as J2}from"./chunk-7ryv0f5h.js";import{Vs as L$}from"./chunk-n07rsssz.js";import{$t as $2,Ot as g,Rt as l,St as F}from"./chunk-08y06vgt.js";import{pu as B$}from"./chunk-9p83me3p.js";import{uu as p2}from"./chunk-9wm41z2f.js";import{AD as r$,FC as M$,PF as K$,SN as Q,WC as Q$,qI as U}from"./chunk-ynfbz3sz.js";import{CP as n2,EP as j$,GP as U$}from"./chunk-s2za1y84.js";var _$={};j$(_$,{sweepStaleAuthTmp:()=>o$,layer:()=>a$,defaultLayer:()=>q2,WellKnown:()=>x$,Service:()=>J$,Oauth:()=>N$,OAUTH_DUMMY_KEY:()=>F2,Info:()=>t$,AuthError:()=>Y$,Auth:()=>_$,Api:()=>T$});import R2 from"path";var A={};j$(A,{setKeySequenceForTest:()=>x2,setKeyForTest:()=>T2,resetForTest:()=>N2,isEnvelope:()=>U2,encryptionKey:()=>B2,encrypt:()=>_2,decrypt:()=>w2,AuthKeyring:()=>A});import e from"crypto";import{execFile as Q2}from"child_process";var y="qitqode",m="auth-encryption-key",p$="__qitqode_encrypted__";function U2(Z){return typeof Z==="object"&&Z!==null&&Z[p$]===1&&Z.alg==="aes-256-gcm"}function c(Z,$,X){return new Promise((J)=>{let O=Q2(Z,$,{timeout:5000},(z,W)=>{let G=z?z.code??1:0;J({code:typeof G==="number"?G:1,stdout:W??""})});if(X!==void 0)O.stdin?.write(X),O.stdin?.end()})}async function n$(Z,$){return(await c(Z,$)).code===0}async function K2(){if(process.env.QITQODE_DISABLE_KEYRING)return;if(process.platform==="darwin"){if(!await n$("security",["help"]))return;return{async get(){let Z=await c("security",["find-generic-password","-s",y,"-a",m,"-w"]);return Z.code===0?Z.stdout.trim():void 0},async set(Z){return(await c("security",["add-generic-password","-U","-s",y,"-a",m,"-w",Z])).code===0}}}if(process.platform==="linux"){if(!await n$("secret-tool",["search","service",y])){let Z=await c("secret-tool",["lookup","service",y,"account",m]);if(Z.code!==0&&Z.code!==1)return}return{async get(){let Z=await c("secret-tool",["lookup","service",y,"account",m]);return Z.code===0&&Z.stdout.trim()?Z.stdout.trim():void 0},async set(Z){return(await c("secret-tool",["store","--label","QitQode auth encryption key","service",y,"account",m],Z)).code===0}}}return}var $$,u;function B2(){if(u!==void 0&&u.length>0)return Promise.resolve(u.shift());return $$??=(async()=>{let Z=await K2();if(!Z)return;let $=await Z.get();if($){let X=Buffer.from($,"base64");if(X.length===32)return X;return}return g.withLock("auth-keyring-init",async()=>{let X=await Z.get();if(X){let W=Buffer.from(X,"base64");return W.length===32?W:void 0}let J=e.randomBytes(32);if(!await Z.set(J.toString("base64")))return;let O=await Z.get();if(!O)return;let z=Buffer.from(O,"base64");return z.length===32?z:void 0})})(),$$}function N2(){$$=void 0,u=void 0}function T2(Z){$$=Promise.resolve(Z),u=void 0}function x2(Z){u=[...Z]}function _2(Z,$){let X=e.randomBytes(12),J=e.createCipheriv("aes-256-gcm",$,X),O=Buffer.concat([J.update(Z,"utf8"),J.final()]);return{[p$]:1,alg:"aes-256-gcm",iv:X.toString("base64"),tag:J.getAuthTag().toString("base64"),data:O.toString("base64")}}function w2(Z,$){let X=e.createDecipheriv("aes-256-gcm",$,Buffer.from(Z.iv,"base64"));return X.setAuthTag(Buffer.from(Z.tag,"base64")),Buffer.concat([X.update(Buffer.from(Z.data,"base64")),X.final()]).toString("utf8")}var F2="qitqode-oauth-dummy-key",X$=R2.join(l.Path.data,"auth.json"),S2=60000;async function o$(){let Z=X$+".tmp";try{let{stat:$,unlink:X}=await import("fs/promises"),J=await $(Z);if(Date.now()-J.mtimeMs>=S2)await X(Z).catch(()=>{return})}catch{}}var Z$=(Z)=>($)=>new Y$({message:Z,cause:$});class N$ extends Q.Class("OAuth")({type:Q.Literal("oauth"),refresh:Q.String,access:Q.String,expires:Q.Number,accountId:Q.optional(Q.String),enterpriseUrl:Q.optional(Q.String)}){}class T$ extends Q.Class("ApiAuth")({type:Q.Literal("api"),key:Q.String,metadata:Q.optional(Q.Record(Q.String,Q.String))}){}class x$ extends Q.Class("WellKnownAuth")({type:Q.Literal("wellknown"),key:Q.String,token:Q.String}){}var i$=Q.Union([N$,T$,x$]).annotate({discriminator:"type",identifier:"Auth"}),t$=Object.assign(i$,{zod:s$(i$)});class Y$ extends Q.TaggedErrorClass()("AuthError",{message:Q.String,cause:Q.optional(Q.Defect)}){}class J$ extends r$.Service()("@qitqode/Auth"){}var a$=K$.effect(J$,U.gen(function*(){let Z=yield*B$.Service,$=Q.decodeUnknownOption(t$);yield*U.promise(()=>o$());let X=U.fn("Auth.readFile")(function*(){let I=yield*Z.readJson(X$).pipe(U.orElseSucceed(()=>({})));if(!A.isEnvelope(I))return I;let D=yield*U.promise(()=>A.encryptionKey());if(!D)return yield*U.fail(new Y$({message:"auth.json is encrypted but the OS keyring is unavailable. Restore keyring access or delete auth.json and log in again."}));return yield*U.try({try:()=>JSON.parse(A.decrypt(I,D)),catch:Z$("Failed to decrypt auth data (keyring key mismatch?)")})}),J=U.fn("Auth.writeFile")(function*(I){let D=yield*U.promise(()=>A.encryptionKey()),L=D?A.encrypt(JSON.stringify(I),D):I,M=X$+".tmp";yield*Z.writeJson(M,L).pipe(U.mapError(Z$("Failed to write auth data"))),yield*Z.chmod(M,384).pipe(U.mapError(Z$("Failed to set auth file permissions"))),yield*Z.rename(M,X$).pipe(U.mapError(Z$("Failed to atomically replace auth data")))}),O=U.fn("Auth.all")(function*(){let I=yield*X(),D=Q$.filterMap(I,(L)=>M$.fromOption($(L),()=>{return}));if(process.env.QITQODE_AUTH_CONTENT)try{let L=JSON.parse(process.env.QITQODE_AUTH_CONTENT);return{...Q$.filterMap(L,(B)=>M$.fromOption($(B),()=>{return})),...D}}catch(L){console.error("[Auth] Failed to parse QITQODE_AUTH_CONTENT env var:",L)}return D}),z=U.fn("Auth.get")(function*(I){return(yield*O())[I]}),W="auth-file",G=U.fn("Auth.set")(function*(I,D){yield*U.scoped(U.gen(function*(){yield*g.effect(W);let L=I.replace(/\/+$/,""),M=yield*O();if(L!==I)delete M[I];delete M[L+"/"],yield*J({...M,[L]:D})}))}),V=U.fn("Auth.remove")(function*(I){yield*U.scoped(U.gen(function*(){yield*g.effect(W);let D=I.replace(/\/+$/,""),L=yield*O();delete L[I],delete L[D],yield*J(L)}))});return J$.of({get:z,all:O,set:G,remove:V})})),q2=a$.pipe(K$.provide(B$.defaultLayer));function e$({onRequest:Z,onSseError:$,onSseEvent:X,responseTransformer:J,responseValidator:O,sseDefaultRetryDelay:z,sseMaxRetryAttempts:W,sseMaxRetryDelay:G,sseSleepFn:V,url:I,...D}){let L,M=V??((K)=>new Promise((T)=>setTimeout(T,K)));return{stream:async function*(){let K=z??3000,T=0,R=D.signal??new AbortController().signal;while(!0){if(R.aborted)break;T++;let t=D.headers instanceof Headers?D.headers:new Headers(D.headers);if(L!==void 0)t.set("Last-Event-ID",L);try{let P={redirect:"follow",...D,body:D.serializedBody,headers:t,signal:R},h=new Request(I,P);if(Z)h=await Z(I,P);let x=await(D.fetch??globalThis.fetch)(h);if(!x.ok)throw Error(`SSE failed: ${x.status} ${x.statusText}`);if(!x.body)throw Error("No body in SSE response");let q=x.body.pipeThrough(new TextDecoderStream).getReader(),_="",c$=()=>{try{q.cancel()}catch{}};R.addEventListener("abort",c$);try{while(!0){let{done:L2,value:I2}=await q.read();if(L2)break;_+=I2,_=_.replace(/\r\n?/g,`
2
+ import{$p as s$}from"./chunk-v965rsr8.js";import{lq as Z2,mq as X2,oq as J2}from"./chunk-m612agnk.js";import{st as L$}from"./chunk-k9b1jcqw.js";import{lu as g,ou as l,pu as F,yu as $2}from"./chunk-zxaaxb99.js";import{Ou as B$}from"./chunk-whxjkz9a.js";import{Tu as p2}from"./chunk-89v6dgpp.js";import{PI as U,ZD as r$,cD as M$,mG as K$,pO as Q,tD as Q$}from"./chunk-snm5q21k.js";import{$P as n2,bQ as j$,dQ as U$}from"./chunk-aztre27e.js";var _$={};j$(_$,{sweepStaleAuthTmp:()=>o$,layer:()=>a$,defaultLayer:()=>q2,WellKnown:()=>x$,Service:()=>J$,Oauth:()=>N$,OAUTH_DUMMY_KEY:()=>F2,Info:()=>t$,AuthError:()=>Y$,Auth:()=>_$,Api:()=>T$});import R2 from"path";var A={};j$(A,{setKeySequenceForTest:()=>x2,setKeyForTest:()=>T2,resetForTest:()=>N2,isEnvelope:()=>U2,encryptionKey:()=>B2,encrypt:()=>_2,decrypt:()=>w2,AuthKeyring:()=>A});import e from"crypto";import{execFile as Q2}from"child_process";var y="qitqode",m="auth-encryption-key",p$="__qitqode_encrypted__";function U2(Z){return typeof Z==="object"&&Z!==null&&Z[p$]===1&&Z.alg==="aes-256-gcm"}function c(Z,$,X){return new Promise((J)=>{let O=Q2(Z,$,{timeout:5000},(z,W)=>{let G=z?z.code??1:0;J({code:typeof G==="number"?G:1,stdout:W??""})});if(X!==void 0)O.stdin?.write(X),O.stdin?.end()})}async function n$(Z,$){return(await c(Z,$)).code===0}async function K2(){if(process.env.QITQODE_DISABLE_KEYRING)return;if(process.platform==="darwin"){if(!await n$("security",["help"]))return;return{async get(){let Z=await c("security",["find-generic-password","-s",y,"-a",m,"-w"]);return Z.code===0?Z.stdout.trim():void 0},async set(Z){return(await c("security",["add-generic-password","-U","-s",y,"-a",m,"-w",Z])).code===0}}}if(process.platform==="linux"){if(!await n$("secret-tool",["search","service",y])){let Z=await c("secret-tool",["lookup","service",y,"account",m]);if(Z.code!==0&&Z.code!==1)return}return{async get(){let Z=await c("secret-tool",["lookup","service",y,"account",m]);return Z.code===0&&Z.stdout.trim()?Z.stdout.trim():void 0},async set(Z){return(await c("secret-tool",["store","--label","QitQode auth encryption key","service",y,"account",m],Z)).code===0}}}return}var $$,u;function B2(){if(u!==void 0&&u.length>0)return Promise.resolve(u.shift());return $$??=(async()=>{let Z=await K2();if(!Z)return;let $=await Z.get();if($){let X=Buffer.from($,"base64");if(X.length===32)return X;return}return g.withLock("auth-keyring-init",async()=>{let X=await Z.get();if(X){let W=Buffer.from(X,"base64");return W.length===32?W:void 0}let J=e.randomBytes(32);if(!await Z.set(J.toString("base64")))return;let O=await Z.get();if(!O)return;let z=Buffer.from(O,"base64");return z.length===32?z:void 0})})(),$$}function N2(){$$=void 0,u=void 0}function T2(Z){$$=Promise.resolve(Z),u=void 0}function x2(Z){u=[...Z]}function _2(Z,$){let X=e.randomBytes(12),J=e.createCipheriv("aes-256-gcm",$,X),O=Buffer.concat([J.update(Z,"utf8"),J.final()]);return{[p$]:1,alg:"aes-256-gcm",iv:X.toString("base64"),tag:J.getAuthTag().toString("base64"),data:O.toString("base64")}}function w2(Z,$){let X=e.createDecipheriv("aes-256-gcm",$,Buffer.from(Z.iv,"base64"));return X.setAuthTag(Buffer.from(Z.tag,"base64")),Buffer.concat([X.update(Buffer.from(Z.data,"base64")),X.final()]).toString("utf8")}var F2="qitqode-oauth-dummy-key",X$=R2.join(l.Path.data,"auth.json"),S2=60000;async function o$(){let Z=X$+".tmp";try{let{stat:$,unlink:X}=await import("fs/promises"),J=await $(Z);if(Date.now()-J.mtimeMs>=S2)await X(Z).catch(()=>{return})}catch{}}var Z$=(Z)=>($)=>new Y$({message:Z,cause:$});class N$ extends Q.Class("OAuth")({type:Q.Literal("oauth"),refresh:Q.String,access:Q.String,expires:Q.Number,accountId:Q.optional(Q.String),enterpriseUrl:Q.optional(Q.String)}){}class T$ extends Q.Class("ApiAuth")({type:Q.Literal("api"),key:Q.String,metadata:Q.optional(Q.Record(Q.String,Q.String))}){}class x$ extends Q.Class("WellKnownAuth")({type:Q.Literal("wellknown"),key:Q.String,token:Q.String}){}var i$=Q.Union([N$,T$,x$]).annotate({discriminator:"type",identifier:"Auth"}),t$=Object.assign(i$,{zod:s$(i$)});class Y$ extends Q.TaggedErrorClass()("AuthError",{message:Q.String,cause:Q.optional(Q.Defect)}){}class J$ extends r$.Service()("@qitqode/Auth"){}var a$=K$.effect(J$,U.gen(function*(){let Z=yield*B$.Service,$=Q.decodeUnknownOption(t$);yield*U.promise(()=>o$());let X=U.fn("Auth.readFile")(function*(){let I=yield*Z.readJson(X$).pipe(U.orElseSucceed(()=>({})));if(!A.isEnvelope(I))return I;let D=yield*U.promise(()=>A.encryptionKey());if(!D)return yield*U.fail(new Y$({message:"auth.json is encrypted but the OS keyring is unavailable. Restore keyring access or delete auth.json and log in again."}));return yield*U.try({try:()=>JSON.parse(A.decrypt(I,D)),catch:Z$("Failed to decrypt auth data (keyring key mismatch?)")})}),J=U.fn("Auth.writeFile")(function*(I){let D=yield*U.promise(()=>A.encryptionKey()),L=D?A.encrypt(JSON.stringify(I),D):I,M=X$+".tmp";yield*Z.writeJson(M,L).pipe(U.mapError(Z$("Failed to write auth data"))),yield*Z.chmod(M,384).pipe(U.mapError(Z$("Failed to set auth file permissions"))),yield*Z.rename(M,X$).pipe(U.mapError(Z$("Failed to atomically replace auth data")))}),O=U.fn("Auth.all")(function*(){let I=yield*X(),D=Q$.filterMap(I,(L)=>M$.fromOption($(L),()=>{return}));if(process.env.QITQODE_AUTH_CONTENT)try{let L=JSON.parse(process.env.QITQODE_AUTH_CONTENT);return{...Q$.filterMap(L,(B)=>M$.fromOption($(B),()=>{return})),...D}}catch(L){console.error("[Auth] Failed to parse QITQODE_AUTH_CONTENT env var:",L)}return D}),z=U.fn("Auth.get")(function*(I){return(yield*O())[I]}),W="auth-file",G=U.fn("Auth.set")(function*(I,D){yield*U.scoped(U.gen(function*(){yield*g.effect(W);let L=I.replace(/\/+$/,""),M=yield*O();if(L!==I)delete M[I];delete M[L+"/"],yield*J({...M,[L]:D})}))}),V=U.fn("Auth.remove")(function*(I){yield*U.scoped(U.gen(function*(){yield*g.effect(W);let D=I.replace(/\/+$/,""),L=yield*O();delete L[I],delete L[D],yield*J(L)}))});return J$.of({get:z,all:O,set:G,remove:V})})),q2=a$.pipe(K$.provide(B$.defaultLayer));function e$({onRequest:Z,onSseError:$,onSseEvent:X,responseTransformer:J,responseValidator:O,sseDefaultRetryDelay:z,sseMaxRetryAttempts:W,sseMaxRetryDelay:G,sseSleepFn:V,url:I,...D}){let L,M=V??((K)=>new Promise((T)=>setTimeout(T,K)));return{stream:async function*(){let K=z??3000,T=0,R=D.signal??new AbortController().signal;while(!0){if(R.aborted)break;T++;let t=D.headers instanceof Headers?D.headers:new Headers(D.headers);if(L!==void 0)t.set("Last-Event-ID",L);try{let P={redirect:"follow",...D,body:D.serializedBody,headers:t,signal:R},h=new Request(I,P);if(Z)h=await Z(I,P);let x=await(D.fetch??globalThis.fetch)(h);if(!x.ok)throw Error(`SSE failed: ${x.status} ${x.statusText}`);if(!x.body)throw Error("No body in SSE response");let q=x.body.pipeThrough(new TextDecoderStream).getReader(),_="",c$=()=>{try{q.cancel()}catch{}};R.addEventListener("abort",c$);try{while(!0){let{done:L2,value:I2}=await q.read();if(L2)break;_+=I2,_=_.replace(/\r\n?/g,`
3
3
  `);let u$=_.split(`
4
4
 
5
5
  `);_=u$.pop()??"";for(let j2 of u$){let M2=j2.split(`
6
6
  `),a=[],d$;for(let H of M2)if(H.startsWith("data:"))a.push(H.replace(/^data:\s*/,""));else if(H.startsWith("event:"))d$=H.replace(/^event:\s*/,"");else if(H.startsWith("id:"))L=H.replace(/^id:\s*/,"");else if(H.startsWith("retry:")){let l$=Number.parseInt(H.replace(/^retry:\s*/,""),10);if(!Number.isNaN(l$))K=l$}let b,m$=!1;if(a.length){let H=a.join(`
7
7
  `);try{b=JSON.parse(H),m$=!0}catch{b=H}}if(m$){if(O)await O(b);if(J)b=await J(b)}if(X?.({data:b,event:d$,id:L,retry:K}),a.length)yield b}}}finally{R.removeEventListener("abort",c$),q.releaseLock()}break}catch(P){if($?.(P),W!==void 0&&T>=W)break;let h=Math.min(K*2**(T-1),G??30000);await M(h)}}}()}}var H2=(Z)=>{switch(Z){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},E2=(Z)=>{switch(Z){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},A2=(Z)=>{switch(Z){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},O$=({allowReserved:Z,explode:$,name:X,style:J,value:O})=>{if(!$){let G=(Z?O:O.map((V)=>encodeURIComponent(V))).join(E2(J));switch(J){case"label":return`.${G}`;case"matrix":return`;${X}=${G}`;case"simple":return G;default:return`${X}=${G}`}}let z=H2(J),W=O.map((G)=>{if(J==="label"||J==="simple")return Z?G:encodeURIComponent(G);return d({allowReserved:Z,name:X,value:G})}).join(z);return J==="label"||J==="matrix"?z+W:W},d=({allowReserved:Z,name:$,value:X})=>{if(X===void 0||X===null)return"";if(typeof X==="object")throw Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return`${$}=${Z?X:encodeURIComponent(X)}`},W$=({allowReserved:Z,explode:$,name:X,style:J,value:O,valueOnly:z})=>{if(O instanceof Date)return z?O.toISOString():`${X}=${O.toISOString()}`;if(J!=="deepObject"&&!$){let V=[];Object.entries(O).forEach(([D,L])=>{V=[...V,D,Z?L:encodeURIComponent(L)]});let I=V.join(",");switch(J){case"form":return`${X}=${I}`;case"label":return`.${I}`;case"matrix":return`;${X}=${I}`;default:return I}}let W=A2(J),G=Object.entries(O).map(([V,I])=>d({allowReserved:Z,name:J==="deepObject"?`${X}[${V}]`:V,value:I})).join(W);return J==="label"||J==="matrix"?W+G:G};var P2=/\{[^{}]+\}/g,g2=({path:Z,url:$})=>{let X=$,J=$.match(P2);if(J)for(let O of J){let z=!1,W=O.substring(1,O.length-1),G="simple";if(W.endsWith("*"))z=!0,W=W.substring(0,W.length-1);if(W.startsWith("."))W=W.substring(1),G="label";else if(W.startsWith(";"))W=W.substring(1),G="matrix";let V=Z[W];if(V===void 0||V===null)continue;if(Array.isArray(V)){X=X.replace(O,O$({explode:z,name:W,style:G,value:V}));continue}if(typeof V==="object"){X=X.replace(O,W$({explode:z,name:W,style:G,value:V,valueOnly:!0}));continue}if(G==="matrix"){X=X.replace(O,`;${d({name:W,value:V})}`);continue}let I=encodeURIComponent(G==="label"?`.${V}`:V);X=X.replace(O,I)}return X},$1=({baseUrl:Z,path:$,query:X,querySerializer:J,url:O})=>{let z=O.startsWith("/")?O:`/${O}`,W=(Z??"")+z;if($)W=g2({path:$,url:W});let G=X?J(X):"";if(G.startsWith("?"))G=G.substring(1);if(G)W+=`?${G}`;return W};function w$(Z){let $=Z.body!==void 0;if($&&Z.bodySerializer){if("serializedBody"in Z)return Z.serializedBody!==void 0&&Z.serializedBody!==""?Z.serializedBody:null;return Z.body!==""?Z.body:null}if($)return Z.body;return}var Z1=async(Z,$)=>{let X=typeof $==="function"?await $(Z):$;if(!X)return;if(Z.scheme==="bearer")return`Bearer ${X}`;if(Z.scheme==="basic")return`Basic ${btoa(X)}`;return X};var R$={bodySerializer:(Z)=>JSON.stringify(Z,($,X)=>typeof X==="bigint"?X.toString():X)};var X1=({parameters:Z={},...$}={})=>{return(J)=>{let O=[];if(J&&typeof J==="object")for(let z in J){let W=J[z];if(W===void 0||W===null)continue;let G=Z[z]||$;if(Array.isArray(W)){let V=O$({allowReserved:G.allowReserved,explode:!0,name:z,style:"form",value:W,...G.array});if(V)O.push(V)}else if(typeof W==="object"){let V=W$({allowReserved:G.allowReserved,explode:!0,name:z,style:"deepObject",value:W,...G.object});if(V)O.push(V)}else{let V=d({allowReserved:G.allowReserved,name:z,value:W});if(V)O.push(V)}}return O.join("&")}},J1=(Z)=>{if(!Z)return"stream";let $=Z.split(";")[0]?.trim();if(!$)return;if($.startsWith("application/json")||$.endsWith("+json"))return"json";if($==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some((X)=>$.startsWith(X)))return"blob";if($.startsWith("text/"))return"text";return},k2=(Z,$)=>{if(!$)return!1;if(Z.headers.has($)||Z.query?.[$]||Z.headers.get("Cookie")?.includes(`${$}=`))return!0;return!1};async function Y1(Z){for(let $ of Z.security??[]){if(k2(Z,$.name))continue;let X=await Z1($,Z.auth);if(!X)continue;let J=$.name??"Authorization";switch($.in){case"query":if(!Z.query)Z.query={};Z.query[J]=X;break;case"cookie":Z.headers.append("Cookie",`${J}=${X}`);break;case"header":default:Z.headers.set(J,X);break}}}var F$=(Z)=>$1({baseUrl:Z.baseUrl,path:Z.path,query:Z.query,querySerializer:typeof Z.querySerializer==="function"?Z.querySerializer:X1(Z.querySerializer),url:Z.url}),S$=(Z,$)=>{let X={...Z,...$};if(X.baseUrl?.endsWith("/"))X.baseUrl=X.baseUrl.substring(0,X.baseUrl.length-1);return X.headers=V$(Z.headers,$.headers),X},h2=(Z)=>{let $=[];return Z.forEach((X,J)=>{$.push([J,X])}),$},V$=(...Z)=>{let $=new Headers;for(let X of Z){if(!X)continue;let J=X instanceof Headers?h2(X):Object.entries(X);for(let[O,z]of J)if(z===null)$.delete(O);else if(Array.isArray(z))for(let W of z)$.append(O,W);else if(z!==void 0)$.set(O,typeof z==="object"?JSON.stringify(z):z)}return $};class G${fns=[];clear(){this.fns=[]}eject(Z){let $=this.getInterceptorIndex(Z);if(this.fns[$])this.fns[$]=null}exists(Z){let $=this.getInterceptorIndex(Z);return Boolean(this.fns[$])}getInterceptorIndex(Z){if(typeof Z==="number")return this.fns[Z]?Z:-1;return this.fns.indexOf(Z)}update(Z,$){let X=this.getInterceptorIndex(Z);if(this.fns[X])return this.fns[X]=$,Z;return!1}use(Z){return this.fns.push(Z),this.fns.length-1}}var O1=()=>({error:new G$,request:new G$,response:new G$}),b2=X1({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),C2={"Content-Type":"application/json"},n=(Z={})=>({...R$,headers:C2,parseAs:"auto",querySerializer:b2,...Z});var p=(Z={})=>{let $=S$(n(),Z),X=()=>({...$}),J=(D)=>{return $=S$($,D),X()},O=O1(),z=async(D)=>{let L={...$,...D,fetch:D.fetch??$.fetch??globalThis.fetch,headers:V$($.headers,D.headers),serializedBody:void 0};if(L.security)await Y1(L);if(L.requestValidator)await L.requestValidator(L);if(L.body!==void 0&&L.bodySerializer)L.serializedBody=L.bodySerializer(L.body);if(L.body===void 0||L.serializedBody==="")L.headers.delete("Content-Type");let M=L,B=F$(M);return{opts:M,url:B}},W=async(D)=>{let L=D.throwOnError??$.throwOnError,M=D.responseStyle??$.responseStyle,B,N;try{let{opts:K,url:T}=await z(D),R={redirect:"follow",...K,body:w$(K)};B=new Request(T,R);for(let x of O.request.fns)if(x)B=await x(B,K);let t=K.fetch;N=await t(B);for(let x of O.response.fns)if(x)N=await x(N,B,K);let P={request:B,response:N};if(N.ok){let x=(K.parseAs==="auto"?J1(N.headers.get("Content-Type")):K.parseAs)??"json";if(N.status===204||N.headers.get("Content-Length")==="0"){let _;switch(x){case"arrayBuffer":case"blob":case"text":_=await N[x]();break;case"formData":_=new FormData;break;case"stream":_=N.body;break;case"json":default:_={};break}return K.responseStyle==="data"?_:{data:_,...P}}let q;switch(x){case"arrayBuffer":case"blob":case"formData":case"text":q=await N[x]();break;case"json":{let _=await N.text();q=_?JSON.parse(_):{};break}case"stream":return K.responseStyle==="data"?N.body:{data:N.body,...P}}if(x==="json"){if(K.responseValidator)await K.responseValidator(q);if(K.responseTransformer)q=await K.responseTransformer(q)}return K.responseStyle==="data"?q:{data:q,...P}}let h=await N.text(),I$;try{I$=JSON.parse(h)}catch{}throw I$??h}catch(K){let T=K;for(let R of O.error.fns)if(R)T=await R(T,N,B,D);if(T=T||{},L)throw T;return M==="data"?void 0:{error:T,request:B,response:N}}},G=(D)=>(L)=>W({...L,method:D}),V=(D)=>async(L)=>{let{opts:M,url:B}=await z(L);return e$({...M,body:M.body,method:D,onRequest:async(N,K)=>{let T=new Request(N,K);for(let R of O.request.fns)if(R)T=await R(T,M);return T},serializedBody:w$(M),url:B})};return{buildUrl:(D)=>F$({...$,...D}),connect:G("CONNECT"),delete:G("DELETE"),get:G("GET"),getConfig:X,head:G("HEAD"),interceptors:O,options:G("OPTIONS"),patch:G("PATCH"),post:G("POST"),put:G("PUT"),request:W,setConfig:J,sse:{connect:V("CONNECT"),delete:V("DELETE"),get:V("GET"),head:V("HEAD"),options:V("OPTIONS"),patch:V("PATCH"),post:V("POST"),put:V("PUT"),trace:V("TRACE")},trace:G("TRACE")}};var v2={$body_:"body",$headers_:"headers",$path_:"path",$query_:"query"},f2=Object.entries(v2),W1=(Z,$)=>{if(!$)$=new Map;for(let X of Z)if("in"in X){if(X.key)$.set(X.key,{in:X.in,map:X.map})}else if("key"in X)$.set(X.key,{map:X.map});else if(X.args)W1(X.args,$);return $},y2=(Z)=>{for(let[$,X]of Object.entries(Z))if(X&&typeof X==="object"&&!Array.isArray(X)&&!Object.keys(X).length)delete Z[$]},Y=(Z,$)=>{let X={body:Object.create(null),headers:Object.create(null),path:Object.create(null),query:Object.create(null)},J=W1($),O;for(let[z,W]of Z.entries()){if($[z])O=$[z];if(!O)continue;if("in"in O)if(O.key){let G=J.get(O.key),V=G.map||O.key;if(G.in)X[G.in][V]=W}else X.body=W;else for(let[G,V]of Object.entries(W??{})){let I=J.get(G);if(I)if(I.in){let D=I.map||G;X[I.in][D]=V}else X[I.map]=V;else{let D=f2.find(([L])=>G.startsWith(L));if(D){let[L,M]=D;X[M][G.slice(L.length)]=V}else if("allowExtra"in O&&O.allowExtra){for(let[L,M]of Object.entries(O.allowExtra))if(M){X[L][G]=V;break}}}}}return y2(X),X};var G1=p(n({baseUrl:"http://localhost:4096"}));class j{client;constructor(Z){this.client=Z?.client??G1}}class V1{defaultKey="default";instances=new Map;get(Z){let $=this.instances.get(Z??this.defaultKey);if(!$)throw Error('No SDK client found. Create one with "new QitQodeClient()" to fix this error.');return $}set(Z,$){this.instances.set($??this.defaultKey,Z)}}class z1 extends j{get(Z){return(Z?.client??this.client).get({url:"/global/config",...Z})}update(Z,$){let X=Y([Z],[{args:[{key:"config",map:"body"}]}]);return($?.client??this.client).patch({url:"/global/config",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}}class D1 extends j{scan(Z){return(Z?.client??this.client).get({url:"/global/import/scan",...Z})}run(Z,$){let X=Y([Z],[{args:[{in:"body",key:"sources"},{in:"body",key:"force"}]}]);return($?.client??this.client).post({url:"/global/import/run",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}}class L1 extends j{health(Z){return(Z?.client??this.client).get({url:"/global/health",...Z})}event(Z){return(Z?.client??this.client).sse.get({url:"/global/event",...Z})}dispose(Z){return(Z?.client??this.client).post({url:"/global/dispose",...Z})}upgrade(Z,$){let X=Y([Z],[{args:[{in:"body",key:"target"}]}]);return($?.client??this.client).post({url:"/global/upgrade",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}_config;get config(){return this._config??=new z1({client:this.client})}_import;get import(){return this._import??=new D1({client:this.client})}}class I1 extends j{remove(Z,$){let X=Y([Z],[{args:[{in:"path",key:"providerID"}]}]);return($?.client??this.client).delete({url:"/auth/{providerID}",...$,...X})}set(Z,$){let X=Y([Z],[{args:[{in:"path",key:"providerID"},{key:"auth",map:"body"}]}]);return($?.client??this.client).put({url:"/auth/{providerID}",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}}class j1 extends j{log(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"service"},{in:"body",key:"level"},{in:"body",key:"message"},{in:"body",key:"extra"}]}]);return($?.client??this.client).post({url:"/log",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}agents(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/agent",...$,...X})}skills(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/skill",...$,...X})}}class M1 extends j{list(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/experimental/workspace/adaptor",...$,...X})}}class Q1 extends j{list(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/experimental/workspace",...$,...X})}create(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"id"},{in:"body",key:"type"},{in:"body",key:"branch"},{in:"body",key:"extra"}]}]);return($?.client??this.client).post({url:"/experimental/workspace",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}status(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/experimental/workspace/status",...$,...X})}remove(Z,$){let X=Y([Z],[{args:[{in:"path",key:"id"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).delete({url:"/experimental/workspace/{id}",...$,...X})}sessionRestore(Z,$){let X=Y([Z],[{args:[{in:"path",key:"id"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"sessionID"}]}]);return($?.client??this.client).post({url:"/experimental/workspace/{id}/session-restore",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}_adaptor;get adaptor(){return this._adaptor??=new M1({client:this.client})}}class U1 extends j{get(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/experimental/console",...$,...X})}listOrgs(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/experimental/console/orgs",...$,...X})}switchOrg(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"accountID"},{in:"body",key:"orgID"}]}]);return($?.client??this.client).post({url:"/experimental/console/switch",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}}class K1 extends j{list(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"roots"},{in:"query",key:"start"},{in:"query",key:"cursor"},{in:"query",key:"search"},{in:"query",key:"limit"},{in:"query",key:"archived"}]}]);return($?.client??this.client).get({url:"/experimental/session",...$,...X})}}class B1 extends j{list(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/experimental/resource",...$,...X})}}class N1 extends j{_workspace;get workspace(){return this._workspace??=new Q1({client:this.client})}_console;get console(){return this._console??=new U1({client:this.client})}_session;get session(){return this._session??=new K1({client:this.client})}_resource;get resource(){return this._resource??=new B1({client:this.client})}}class T1 extends j{list(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/project",...$,...X})}current(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/project/current",...$,...X})}initGit(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).post({url:"/project/git/init",...$,...X})}update(Z,$){let X=Y([Z],[{args:[{in:"path",key:"projectID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"name"},{in:"body",key:"icon"},{in:"body",key:"commands"}]}]);return($?.client??this.client).patch({url:"/project/{projectID}",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}}class x1 extends j{list(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/pty",...$,...X})}create(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"command"},{in:"body",key:"args"},{in:"body",key:"cwd"},{in:"body",key:"title"},{in:"body",key:"env"}]}]);return($?.client??this.client).post({url:"/pty",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}remove(Z,$){let X=Y([Z],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).delete({url:"/pty/{ptyID}",...$,...X})}get(Z,$){let X=Y([Z],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/pty/{ptyID}",...$,...X})}update(Z,$){let X=Y([Z],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"title"},{in:"body",key:"size"}]}]);return($?.client??this.client).put({url:"/pty/{ptyID}",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}connectToken(Z,$){let X=Y([Z],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).post({url:"/pty/{ptyID}/connect-token",...$,...X})}connect(Z,$){let X=Y([Z],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/pty/{ptyID}/connect",...$,...X})}}class _1 extends j{get(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/config",...$,...X})}update(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"config",map:"body"}]}]);return($?.client??this.client).patch({url:"/config",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}providers(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/config/providers",...$,...X})}}class w1 extends j{ids(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/experimental/tool/ids",...$,...X})}list(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"provider"},{in:"query",key:"model"}]}]);return($?.client??this.client).get({url:"/experimental/tool",...$,...X})}}class R1 extends j{remove(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"worktreeRemoveInput",map:"body"}]}]);return($?.client??this.client).delete({url:"/experimental/worktree",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}list(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/experimental/worktree",...$,...X})}create(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"worktreeCreateInput",map:"body"}]}]);return($?.client??this.client).post({url:"/experimental/worktree",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}reset(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"worktreeResetInput",map:"body"}]}]);return($?.client??this.client).post({url:"/experimental/worktree/reset",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}}class F1 extends j{list(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"roots"},{in:"query",key:"start"},{in:"query",key:"search"},{in:"query",key:"limit"}]}]);return($?.client??this.client).get({url:"/session",...$,...X})}create(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"parentID"},{in:"body",key:"contextFrom"},{in:"body",key:"contextWatermark"},{in:"body",key:"title"},{in:"body",key:"permission"},{in:"body",key:"workspaceID"}]}]);return($?.client??this.client).post({url:"/session",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}status(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/session/status",...$,...X})}delete(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).delete({url:"/session/{sessionID}",...$,...X})}get(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/session/{sessionID}",...$,...X})}update(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"title"},{in:"body",key:"permission"},{in:"body",key:"time"}]}]);return($?.client??this.client).patch({url:"/session/{sessionID}",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}children(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/session/{sessionID}/children",...$,...X})}init(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"modelID"},{in:"body",key:"providerID"},{in:"body",key:"messageID"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/init",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}fork(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"messageID"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/fork",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}abort(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/abort",...$,...X})}actors(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/session/{sessionID}/actors",...$,...X})}todo(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/session/{sessionID}/todo",...$,...X})}task(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/session/{sessionID}/task",...$,...X})}unshare(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).delete({url:"/session/{sessionID}/share",...$,...X})}share(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/share",...$,...X})}diff(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"messageID"}]}]);return($?.client??this.client).get({url:"/session/{sessionID}/diff",...$,...X})}summarize(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"providerID"},{in:"body",key:"modelID"},{in:"body",key:"auto"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/summarize",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}revert(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"messageID"},{in:"body",key:"partID"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/revert",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}unrevert(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/unrevert",...$,...X})}messages(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"limit"},{in:"query",key:"before"},{in:"query",key:"agent_id"}]}]);return($?.client??this.client).get({url:"/session/{sessionID}/message",...$,...X})}prompt(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"messageID"},{in:"body",key:"model"},{in:"body",key:"modelRef"},{in:"body",key:"agent"},{in:"body",key:"agentID"},{in:"body",key:"task_id"},{in:"body",key:"source"},{in:"body",key:"provenance"},{in:"body",key:"noReply"},{in:"body",key:"tools"},{in:"body",key:"format"},{in:"body",key:"system"},{in:"body",key:"variant"},{in:"body",key:"parts"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/message",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}deleteMessage(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"messageID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).delete({url:"/session/{sessionID}/message/{messageID}",...$,...X})}message(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"messageID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/session/{sessionID}/message/{messageID}",...$,...X})}promptAsync(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"messageID"},{in:"body",key:"model"},{in:"body",key:"modelRef"},{in:"body",key:"agent"},{in:"body",key:"agentID"},{in:"body",key:"task_id"},{in:"body",key:"source"},{in:"body",key:"provenance"},{in:"body",key:"noReply"},{in:"body",key:"tools"},{in:"body",key:"format"},{in:"body",key:"system"},{in:"body",key:"variant"},{in:"body",key:"parts"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/prompt_async",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}command(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"messageID"},{in:"body",key:"agent"},{in:"body",key:"model"},{in:"body",key:"arguments"},{in:"body",key:"command"},{in:"body",key:"variant"},{in:"body",key:"parts"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/command",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}predict(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/predict",...$,...X})}shell(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"messageID"},{in:"body",key:"agent"},{in:"body",key:"model"},{in:"body",key:"modelRef"},{in:"body",key:"command"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/shell",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}}class S1 extends j{delete(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"messageID"},{in:"path",key:"partID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).delete({url:"/session/{sessionID}/message/{messageID}/part/{partID}",...$,...X})}update(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"messageID"},{in:"path",key:"partID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"part",map:"body"}]}]);return($?.client??this.client).patch({url:"/session/{sessionID}/message/{messageID}/part/{partID}",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}}class q1 extends j{respond(Z,$){let X=Y([Z],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"permissionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"response"}]}]);return($?.client??this.client).post({url:"/session/{sessionID}/permissions/{permissionID}",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}reply(Z,$){let X=Y([Z],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"reply"},{in:"body",key:"message"}]}]);return($?.client??this.client).post({url:"/permission/{requestID}/reply",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}list(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/permission",...$,...X})}}class H1 extends j{balance(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/qredits/balance",...$,...X})}}class E1 extends j{list(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"sessionID"}]}]);return($?.client??this.client).get({url:"/workflows",...$,...X})}resume(Z,$){let X=Y([Z],[{args:[{in:"path",key:"runID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).post({url:"/workflows/{runID}/resume",...$,...X})}}class A1 extends j{list(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/question",...$,...X})}neverAsk(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/question/never-ask",...$,...X})}setNeverAsk(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"enabled"}]}]);return($?.client??this.client).post({url:"/question/never-ask",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}reply(Z,$){let X=Y([Z],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"answers"}]}]);return($?.client??this.client).post({url:"/question/{requestID}/reply",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}reject(Z,$){let X=Y([Z],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).post({url:"/question/{requestID}/reject",...$,...X})}}class P1 extends j{list(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/bash-interactive",...$,...X})}reply(Z,$){let X=Y([Z],[{args:[{in:"path",key:"id"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"output"},{in:"body",key:"exitCode"}]}]);return($?.client??this.client).post({url:"/bash-interactive/{id}/reply",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}}class g1 extends j{_interactive;get interactive(){return this._interactive??=new P1({client:this.client})}}class k1 extends j{authorize(Z,$){let X=Y([Z],[{args:[{in:"path",key:"providerID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"method"},{in:"body",key:"inputs"}]}]);return($?.client??this.client).post({url:"/provider/{providerID}/oauth/authorize",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}callback(Z,$){let X=Y([Z],[{args:[{in:"path",key:"providerID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"method"},{in:"body",key:"code"}]}]);return($?.client??this.client).post({url:"/provider/{providerID}/oauth/callback",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}}class h1 extends j{list(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/provider",...$,...X})}auth(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/provider/auth",...$,...X})}_oauth;get oauth(){return this._oauth??=new k1({client:this.client})}}class b1 extends j{list(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"body",map:"body"}]}]);return($?.client??this.client).post({url:"/sync/history",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}}class C1 extends j{start(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).post({url:"/sync/start",...$,...X})}replay(Z,$){let X=Y([Z],[{args:[{in:"query",key:"query_directory",map:"directory"},{in:"query",key:"workspace"},{in:"body",key:"body_directory",map:"directory"},{in:"body",key:"events"}]}]);return($?.client??this.client).post({url:"/sync/replay",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}_history;get history(){return this._history??=new b1({client:this.client})}}class v1 extends j{text(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"pattern"}]}]);return($?.client??this.client).get({url:"/find",...$,...X})}files(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"query"},{in:"query",key:"dirs"},{in:"query",key:"type"},{in:"query",key:"limit"}]}]);return($?.client??this.client).get({url:"/find/file",...$,...X})}symbols(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"query"}]}]);return($?.client??this.client).get({url:"/find/symbol",...$,...X})}}class f1 extends j{list(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"path"}]}]);return($?.client??this.client).get({url:"/file",...$,...X})}read(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"path"}]}]);return($?.client??this.client).get({url:"/file/content",...$,...X})}status(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/file/status",...$,...X})}}class y1 extends j{subscribe(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).sse.get({url:"/event",...$,...X})}}class c1 extends j{remove(Z,$){let X=Y([Z],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).delete({url:"/mcp/{name}/auth",...$,...X})}start(Z,$){let X=Y([Z],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).post({url:"/mcp/{name}/auth",...$,...X})}callback(Z,$){let X=Y([Z],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"code"}]}]);return($?.client??this.client).post({url:"/mcp/{name}/auth/callback",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}authenticate(Z,$){let X=Y([Z],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).post({url:"/mcp/{name}/auth/authenticate",...$,...X})}}class u1 extends j{status(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/mcp",...$,...X})}add(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"name"},{in:"body",key:"config"}]}]);return($?.client??this.client).post({url:"/mcp",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}connect(Z,$){let X=Y([Z],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).post({url:"/mcp/{name}/connect",...$,...X})}disconnect(Z,$){let X=Y([Z],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).post({url:"/mcp/{name}/disconnect",...$,...X})}_auth;get auth(){return this._auth??=new c1({client:this.client})}}class d1 extends j{next(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/tui/control/next",...$,...X})}response(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"body",map:"body"}]}]);return($?.client??this.client).post({url:"/tui/control/response",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}}class m1 extends j{appendPrompt(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"text"}]}]);return($?.client??this.client).post({url:"/tui/append-prompt",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}openHelp(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).post({url:"/tui/open-help",...$,...X})}openSessions(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).post({url:"/tui/open-sessions",...$,...X})}openThemes(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).post({url:"/tui/open-themes",...$,...X})}openModels(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).post({url:"/tui/open-models",...$,...X})}submitPrompt(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).post({url:"/tui/submit-prompt",...$,...X})}clearPrompt(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).post({url:"/tui/clear-prompt",...$,...X})}executeCommand(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"command"}]}]);return($?.client??this.client).post({url:"/tui/execute-command",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}showToast(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"title"},{in:"body",key:"message"},{in:"body",key:"variant"},{in:"body",key:"duration"}]}]);return($?.client??this.client).post({url:"/tui/show-toast",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}publish(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"body",map:"body"}]}]);return($?.client??this.client).post({url:"/tui/publish",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}selectSession(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"sessionID"}]}]);return($?.client??this.client).post({url:"/tui/select-session",...$,...X,headers:{"Content-Type":"application/json",...$?.headers,...X.headers}})}_control;get control(){return this._control??=new d1({client:this.client})}}class l1 extends j{dispose(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).post({url:"/instance/dispose",...$,...X})}}class n1 extends j{get(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/path",...$,...X})}}class p1 extends j{get(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/vcs",...$,...X})}diff(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"mode"}]}]);return($?.client??this.client).get({url:"/vcs/diff",...$,...X})}}class i1 extends j{list(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/command",...$,...X})}}class r1 extends j{status(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/lsp",...$,...X})}}class s1 extends j{status(Z,$){let X=Y([Z],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return($?.client??this.client).get({url:"/formatter",...$,...X})}}class z$ extends j{static __registry=new V1;constructor(Z){super(Z);z$.__registry.set(this,Z?.key)}_global;get global(){return this._global??=new L1({client:this.client})}_auth;get auth(){return this._auth??=new I1({client:this.client})}_app;get app(){return this._app??=new j1({client:this.client})}_experimental;get experimental(){return this._experimental??=new N1({client:this.client})}_project;get project(){return this._project??=new T1({client:this.client})}_pty;get pty(){return this._pty??=new x1({client:this.client})}_config;get config(){return this._config??=new _1({client:this.client})}_tool;get tool(){return this._tool??=new w1({client:this.client})}_worktree;get worktree(){return this._worktree??=new R1({client:this.client})}_session;get session(){return this._session??=new F1({client:this.client})}_part;get part(){return this._part??=new S1({client:this.client})}_permission;get permission(){return this._permission??=new q1({client:this.client})}_qredits;get qredits(){return this._qredits??=new H1({client:this.client})}_workflow;get workflow(){return this._workflow??=new E1({client:this.client})}_question;get question(){return this._question??=new A1({client:this.client})}_bash;get bash(){return this._bash??=new g1({client:this.client})}_provider;get provider(){return this._provider??=new h1({client:this.client})}_sync;get sync(){return this._sync??=new C1({client:this.client})}_find;get find(){return this._find??=new v1({client:this.client})}_file;get file(){return this._file??=new f1({client:this.client})}_event;get event(){return this._event??=new y1({client:this.client})}_mcp;get mcp(){return this._mcp??=new u1({client:this.client})}_tui;get tui(){return this._tui??=new m1({client:this.client})}_instance;get instance(){return this._instance??=new l1({client:this.client})}_path;get path(){return this._path??=new n1({client:this.client})}_vcs;get vcs(){return this._vcs??=new p1({client:this.client})}_command;get command(){return this._command??=new i1({client:this.client})}_lsp;get lsp(){return this._lsp??=new r1({client:this.client})}_formatter;get formatter(){return this._formatter??=new s1({client:this.client})}}function o1(Z){if(!Z?.fetch)Z={...Z,fetch:(X)=>{return X.timeout=!1,fetch(X)}};if(Z?.directory)Z.headers={...Z.headers,"x-qitqode-directory":encodeURIComponent(Z.directory)};return Z}function c2(Z,$,X){if(!Z)return;if(!$)return Z;if(Z===$)return $;if(X&&Z===X($))return $;return Z}function u2(Z,$){if(Z.method!=="GET"&&Z.method!=="HEAD")return Z;let X=new URL(Z.url),J=!1;for(let[z,W]of[["x-qitqode-directory","directory"],["x-qitqode-workspace","workspace"]]){let G=c2(Z.headers.get(z),W==="directory"?$.directory:$.workspace,W==="directory"?encodeURIComponent:void 0);if(!G)continue;if(!X.searchParams.has(W))X.searchParams.set(W,G);J=!0}if(!J)return Z;let O=new Request(X,Z);return O.headers.delete("x-qitqode-directory"),O.headers.delete("x-qitqode-workspace"),O}function d2(Z){if(Z=o1(Z),Z?.experimental_workspaceID)Z.headers={...Z.headers,"x-qitqode-workspace":Z.experimental_workspaceID};let $=p(Z);return $.interceptors.request.use((X)=>u2(X,{directory:Z?.directory,workspace:Z?.experimental_workspaceID})),$.interceptors.response.use((X)=>{if(X.headers.get("content-type")==="text/html")throw Error("Request is not supported by this version of QitQode Server (Server responded with text/html)");return X}),new z$({client:$})}var i2=n2(p2(),1);import a1 from"path";var s2="QITQODE_KEY was rejected by the server (401/403). Check that the key is correct and has not expired.",q$=`[qitqode] ${s2}`;function t1(Z){if(Z?.type!=="api"||typeof Z.key!=="string")return;let X=Z.metadata?.method==="api-key"?"api-key":"sso";return{key:Z.key,method:X}}async function i(){if(process.env.QITQODE_KEY)return{key:process.env.QITQODE_KEY,method:"api-key"};let Z=a1.join(l.Path.data,"auth.json");try{let{readFile:$}=await import("fs/promises"),X=await g.withLock("auth-file",async()=>{let J=await $(Z,"utf8"),O=JSON.parse(J);return t1(O?.forgewise)});if(X)return X}catch{}if(process.env.QITQODE_AUTH_CONTENT)try{let $=JSON.parse(process.env.QITQODE_AUTH_CONTENT);return t1($?.forgewise)}catch{}return}async function D$(){if(process.env.QITQODE_KEY)return;let Z=a1.join(l.Path.data,"auth.json"),{readFile:$,writeFile:X,chmod:J,rename:O}=await import("fs/promises");await g.withLock("auth-file",async()=>{let z=await $(Z,"utf8"),W=JSON.parse(z);if(!("forgewise"in W))return;delete W.forgewise;let G=Z+".tmp";await X(G,JSON.stringify(W,null,2),"utf8"),await J(G,384),await O(G,Z)})}function r(Z){return Z.method==="api-key"?{"x-api-key":Z.key}:{authorization:`Bearer ${Z.key}`}}var y$={};j$(y$,{toolDescriptionEffect:()=>OZ,resolveWorkflowSummaries:()=>XZ,resolveWorkflowSpec:()=>JZ,resolveToolManifest:()=>z2,resolveToolDescription:()=>D2,resolveTierRatings:()=>LZ,resolveSubmitBatch:()=>xZ,resolveRetrieveBatch:()=>_Z,resolvePrompt:()=>W2,resolveListTiers:()=>DZ,resolveGetHistory:()=>MZ,resolveGenerateInlineComments:()=>BZ,resolveGenerateDocumentation:()=>KZ,resolveForgewiseConfig:()=>zZ,resolveFetchQreditsBalance:()=>QZ,resolveCompressTrajectorySafe:()=>IZ,resolveChatCompletion:()=>TZ,resolveChatBoolean:()=>NZ,resolveBraveSearch:()=>jZ,resolveBashArity:()=>YZ,resolveAnalyzeCodeForIssues:()=>UZ,resolveAgentPrompt:()=>$Z,remoteStats:()=>S,isBackendBillingError:()=>o2,clearRemoteCache:()=>e2,beginIdempotentAttempt:()=>O2,BackendRemote:()=>y$,BackendRateLimitError:()=>o,BackendInsufficientBalanceError:()=>s,BackendAuthRejectedError:()=>k});import{createHash as Y2,randomUUID as e1}from"crypto";var w=$2.create({service:"backend.remote"}),h$=30000,b$=5000,v=new Map,S={failures:0,authRejections:0,missingPrompts:0,missingToolDescriptions:0},H$=new Set,E$=new Set;class k extends Error{name="BackendAuthRejectedError";constructor(Z){super(L$.copy().invalidCredentials(Z))}}class s extends Error{name="BackendInsufficientBalanceError";status=402;code;constructor(Z,$){super(L$.copy().insufficientBalance(Z));this.code=$}}class o extends Error{name="BackendRateLimitError";status=429;retryAfterMs;constructor(Z,$){let X=Z!==void 0?` Retry in about ${Math.max(1,Math.round(Z/1000))}s.`:"";super(L$.copy().rateLimit+X+($?` (${$})`:""));this.retryAfterMs=Z}}function o2(Z){return Z instanceof s||Z instanceof o}var t2=600000,C=new Map;function a2(Z,$){try{return Y2("sha256").update(`${Z}\x00${JSON.stringify($)}`).digest("hex").slice(0,16)}catch{return"unscoped"}}function O2(Z,$,X){let J=Date.now(),O;try{O=Y2("sha256").update(`${Z}\x00${$}\x00${JSON.stringify(X)??""}`).digest("hex")}catch{return{key:`${$}-${e1()}`,settle:()=>{}}}let z=()=>C.delete(O),W=C.get(O);if(W&&W.expires>J)return{key:W.key,settle:z};if(C.size>256){for(let[V,I]of C)if(I.expires<=J)C.delete(V)}let G=`${$}-${O.slice(0,16)}-${e1()}`;return C.set(O,{key:G,expires:J+t2}),{key:G,settle:z}}function e2(){v.clear(),g$.clear(),A$.clear(),H$.clear(),E$.clear(),C.clear()}async function f(Z,$){let X=F.QITQODE_BACKEND_URL,J=Date.now(),O=`${X}::${Z}`,z=v.get(O);if(z&&z.expires>J)return z.value;try{let W=await i(),G=W?r(W):void 0,I=await $(J2({baseUrl:X,headers:G,fetch:(D,L)=>fetch(D,{...L,signal:L?.signal??AbortSignal.timeout(b$)})}));return v.set(O,{value:I,expires:J+h$}),I}catch(W){if(W instanceof X2){if(S.authRejections++,await D$().catch(()=>{}),w.warn("backend rejected the credential; prompting re-auth",{cacheKey:Z,baseUrl:X,status:W.status}),process.env.QITQODE_KEY)w.error(q$),console.error(q$);throw new k(`HTTP ${W.status}`)}throw S.failures++,w.warn("backend request failed; surfacing error",{cacheKey:Z,baseUrl:X,error:W instanceof Error?W.message:String(W)}),W}}async function W2(Z){if(Z.indexOf("/")<=0)return;return f(`prompt:${Z}`,($)=>$.prompt(Z).then((X)=>X??void 0))}async function $Z(Z){let $=`agent/${Z}`,X=await W2($);if(X===void 0||X===""){if(!H$.has(Z))H$.add(Z),S.missingPrompts++,w.warn("backend served no content for agent prompt; running with an empty prompt",{prompt:$,baseUrl:F.QITQODE_BACKEND_URL,missingPrompts:S.missingPrompts})}return X}var A$=new Map;function P$(Z){let $=A$.get(Z);if(!$)$={unsupported:!1},A$.set(Z,$);return $}async function ZZ(){let Z=P$(F.QITQODE_BACKEND_URL);if(Z.inFlight)return Z.inFlight;let $=f("workflow.catalog",(X)=>X.workflowSpecs().then((J)=>J??void 0)).then((X)=>{let J=new Map;for(let O of X??[])if(O&&typeof O.name==="string"&&typeof O.script==="string")J.set(O.name,O);return J});Z.inFlight=$;try{return await $}finally{if(Z.inFlight===$)Z.inFlight=void 0}}async function G2(Z,$){let X=F.QITQODE_BACKEND_URL;if(!P$(X).unsupported)try{return Z(await ZZ())}catch(J){if(!V2(J))throw J;P$(X).unsupported=!0,w.warn("backend has no workflowSpecs route; falling back to per-name workflow lookups",{baseUrl:X})}return $()}async function XZ(){return G2((Z)=>[...Z.values()].map(({script:$,...X})=>X),()=>f("workflow.list",(Z)=>Z.workflowSummaries()))}async function JZ(Z){return G2(($)=>$.get(Z),()=>f(`workflow.get:${Z}`,($)=>$.workflowSpec(Z).then((X)=>X??void 0)))}async function YZ(){return f("permission.arity",(Z)=>Z.bashArity())}var g$=new Map;function k$(Z){let $=g$.get(Z);if(!$)$={unsupported:!1},g$.set(Z,$);return $}function V2(Z){return Z instanceof Z2&&(Z.status===404||Z.status===501)}async function z2(){let Z=k$(F.QITQODE_BACKEND_URL);if(Z.inFlight)return Z.inFlight;let $=f("tool.manifest",(X)=>X.toolManifest().then((J)=>J??void 0)).then((X)=>{let J=new Map;for(let O of X??[])if(O&&typeof O.id==="string"&&typeof O.description==="string")J.set(O.id,O.description);return J});Z.inFlight=$;try{return await $}finally{if(Z.inFlight===$)Z.inFlight=void 0}}async function D2(Z){let $=F.QITQODE_BACKEND_URL,X;if(!k$($).unsupported)try{X=(await z2()).get(Z)}catch(J){if(!V2(J))throw J;k$($).unsupported=!0,w.warn("backend has no toolManifest route; falling back to one request per tool description",{baseUrl:$})}if(X===void 0||X==="")X=await f(`tool.description:${Z}`,(J)=>J.toolDescription(Z).then((O)=>O??void 0));if(X===void 0||X===""){if(!E$.has(Z))E$.add(Z),S.missingToolDescriptions++,w.warn("backend served no content for tool description; running with an empty description",{tool:Z,baseUrl:F.QITQODE_BACKEND_URL,missingToolDescriptions:S.missingToolDescriptions})}return X}function OZ(Z){return U.promise(()=>D2(Z)).pipe(U.catchDefect(($)=>$ instanceof k?U.succeed(void 0):U.die($)))}function WZ(Z){if(!Z)return{};try{let $=JSON.parse(Z);if($&&typeof $==="object")return{code:typeof $.error==="string"?$.error:void 0,detail:typeof $.message==="string"?$.message:void 0}}catch{}return{detail:Z.slice(0,300)}}function GZ(Z){let $=Z.headers?.get?.("retry-after-ms");if($){let J=Number.parseFloat($);if(!Number.isNaN(J))return J}let X=Z.headers?.get?.("retry-after");if(X){let J=Number.parseFloat(X);if(!Number.isNaN(J))return Math.ceil(J*1000);let O=Date.parse(X)-Date.now();if(!Number.isNaN(O)&&O>0)return Math.ceil(O)}return}async function C$(Z,$){let X=await Z.text().catch(()=>""),{code:J,detail:O}=WZ(X);if(Z.status===402)return new s(O,J);if(Z.status===429)return new o(GZ(Z),O);let z=O?`: ${O}`:J?`: ${J}`:"";return Error(`${$} failed: ${Z.status}${z}`)}function v$(Z,$){let{error:X,message:J}=Z;if(X==="insufficient_balance")return new s(J,X);if(X==="rate_limited"||X==="too_many_requests")return new o(void 0,J);return Error(`${$} returned failure: ${X??"unknown error"}${J?` \u2014 ${J}`:""}`)}async function E(Z,$,X,J={}){let O=F.QITQODE_BACKEND_URL,z=`${O}::post:${Z}`;if(!J.noCache){let W=Date.now(),G=v.get(z);if(G&&G.expires>W)return G.value}try{let W=await i(),G=W?r(W):{},V=J.billable?O2(a2(O,G),$,X):void 0,I=V?{"x-idempotency-key":V.key}:{},D=await fetch(`${O}/${$}`,{method:"POST",headers:{"Content-Type":"application/json",...G,...I},body:JSON.stringify(X),signal:J.signal});if(D.status===401||D.status===403){V?.settle();let B=await D.text().catch(()=>"");if(B.includes("ERR_GATEWAY_REQUIRED"))throw Error(`Backend routing error: ${B}`);throw S.authRejections++,await D$().catch(()=>{}),w.warn("backend rejected the credential; prompting re-auth",{fnName:$,baseUrl:O,status:D.status}),new k(`HTTP ${D.status}`)}if(!D.ok){let B=await C$(D,`Backend POST /${$}`);if(D.status<500)V?.settle();throw B}let L=await D.json();if(!L.success)throw V?.settle(),v$(L,`Backend POST /${$}`);V?.settle();let M=L.data;if(!J.noCache)v.set(z,{value:M,expires:Date.now()+h$});return M}catch(W){if(W instanceof k)throw W;throw S.failures++,w.warn("backend POST request failed; surfacing error",{fnName:$,baseUrl:O,error:W instanceof Error?W.message:String(W)}),W}}async function f$(Z,$,X={}){let J=F.QITQODE_BACKEND_URL;try{let O=await i(),z=O?r(O):{},W=new URLSearchParams(Object.entries($).map(([D,L])=>[D,String(L)])).toString(),G=W?`${J}/${Z}?${W}`:`${J}/${Z}`,V=await fetch(G,{method:"GET",headers:{...z},signal:X.signal});if(V.status===401||V.status===403){let D=await V.text().catch(()=>"");if(D.includes("ERR_GATEWAY_REQUIRED"))throw Error(`Backend routing error: ${D}`);throw S.authRejections++,await D$().catch(()=>{}),w.warn("backend rejected the credential; prompting re-auth",{fnName:Z,baseUrl:J,status:V.status}),new k(`HTTP ${V.status}`)}if(!V.ok)throw await C$(V,`Backend GET /${Z}`);let I=await V.json();if(!I.success)throw v$(I,`Backend GET /${Z}`);return I.data}catch(O){if(O instanceof k)throw O;throw S.failures++,w.warn("backend GET request failed; surfacing error",{fnName:Z,baseUrl:J,error:O instanceof Error?O.message:String(O)}),O}}async function VZ(Z,$,X){let J=F.QITQODE_BACKEND_URL,O=`${J}::public:${Z}`,z=Date.now(),W=v.get(O);if(W&&W.expires>z)return W.value;try{let G=await fetch(`${J}/${$}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(X),signal:AbortSignal.timeout(b$)});if(!G.ok)throw await C$(G,`Backend public POST /${$}`);let V=await G.json();if(!V.success)throw v$(V,`Backend public POST /${$}`);let I=V.data;return v.set(O,{value:I,expires:z+h$}),I}catch(G){throw S.failures++,w.warn("backend public request failed; surfacing error",{fnName:$,baseUrl:J,error:G instanceof Error?G.message:String(G)}),G}}async function zZ(){try{return await VZ("forgewise.config","forgewiseConfig",{})}catch(Z){let $=await i().catch(()=>null);if(!$)throw Z;let X=F.QITQODE_BACKEND_URL,J=await fetch(`${X}/forgewiseConfig`,{method:"POST",headers:{"Content-Type":"application/json",...r($)},body:JSON.stringify({}),signal:AbortSignal.timeout(b$)}).catch(()=>null);if(!J?.ok)throw Z;let O=await J.json().catch(()=>null);if(!O?.success)throw Z;return O.data}}async function DZ(){return f$("listTiers",{}).then((Z)=>{if(!Array.isArray(Z))return[];return Z.flatMap(($)=>{if(typeof $==="string")return[{id:$}];if(!$||typeof $!=="object"||Array.isArray($))return[];let X=$;return typeof X.id==="string"?[{id:X.id,...typeof X.label==="string"?{label:X.label}:{},...typeof X.providerID==="string"?{providerID:X.providerID}:{},...typeof X.modelID==="string"?{modelID:X.modelID}:{}}]:[]})}).catch((Z)=>{return w.warn("listTiers fetch failed; using hardcoded tier fallback",{error:Z instanceof Error?Z.message:String(Z)}),[]})}async function LZ(){return f$("TIER_RATINGS",{}).catch((Z)=>{w.warn("TIER_RATINGS fetch failed; using hardcoded rating fallback",{error:Z instanceof Error?Z.message:String(Z)});return})}async function IZ(Z){return E("compaction.trajectory","compressTrajectorySafe",Z,{noCache:!0,billable:!0,signal:AbortSignal.timeout(120000)})}async function jZ(Z,$){let X=$?.timeoutMs??30000,J={query:Z};if($?.numResults)J.options={count:$.numResults};return E("brave.search","braveSearch",J,{noCache:!0,signal:AbortSignal.timeout(X)})}async function MZ(Z){return E("qredits.history","getHistory",Z,{noCache:!0})}async function QZ(Z){return E("forgewise.qredits.balance","fetchQreditsBalance",Z,{noCache:!0})}async function UZ(Z){return E(`code.analyze:${Z.filePath}`,"analyzeCodeForIssues",Z,{noCache:!0,billable:!0,signal:AbortSignal.timeout(60000)})}async function KZ(Z){return E(`code.docs:${Z.filePath}:${Z.functionName??""}`,"generateDocumentation",Z,{noCache:!0,billable:!0,signal:AbortSignal.timeout(60000)})}async function BZ(Z){return E(`code.comments:${Z.filePath}`,"generateInlineComments",Z,{noCache:!0,billable:!0,signal:AbortSignal.timeout(60000)})}async function NZ(Z,$,X){return E("chat.boolean","chatBoolean",{sample:Z,test:$},{noCache:!0,billable:!0,signal:AbortSignal.timeout(X?.timeoutMs??30000)})}async function TZ(Z,$){let X={message:Z},J={};if($?.provider!==void 0)J.provider=$.provider;if($?.temperature!==void 0)J.temperature=$.temperature;if($?.maxTokens!==void 0)J.maxTokens=$.maxTokens;if(Object.keys(J).length>0)X.options=J;return E("chat.completion","chatCompletion",X,{noCache:!0,billable:!0,signal:AbortSignal.timeout($?.timeoutMs??30000)})}async function xZ(Z){return E("batch.submit","submitBatch",Z,{noCache:!0,billable:!0,signal:AbortSignal.timeout(60000)})}async function _Z(Z){return f$("retrieveBatch",{batchId:Z.batchId},{signal:AbortSignal.timeout(30000)})}
8
- export{F2 as jp,_$ as kp,o1 as lp,d2 as mp,s2 as np,q$ as op,i as pp,D$ as qp,k as rp,s as sp,o as tp,zZ as up,DZ as vp,LZ as wp,MZ as xp,QZ as yp,y$ as zp};
8
+ export{F2 as Ip,_$ as Jp,o1 as Kp,d2 as Lp,s2 as Mp,q$ as Np,i as Op,D$ as Pp,k as Qp,s as Rp,o as Sp,zZ as Tp,DZ as Up,LZ as Vp,MZ as Wp,QZ as Xp,y$ as Yp};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{M as R9}from"./chunk-2jn2hd12.js";import{Dd as E9}from"./chunk-3kdhvq0p.js";import{Ed as P6,Hd as p$,Id as S9,Jd as U9,Md as H9,Nd as q6}from"./chunk-y2ch07yv.js";import"./chunk-kkdgzeva.js";import{Qd as T0}from"./chunk-g4qwkcdv.js";import{Uf as O}from"./chunk-0ndvy0nh.js";import{Zg as j9,qh as I9,uh as E$}from"./chunk-kbjwdv1x.js";import"./chunk-ek1fawsj.js";import"./chunk-3w64fpwn.js";import"./chunk-pfn1db1m.js";import"./chunk-h56jxxvj.js";import"./chunk-x36jhtex.js";import"./chunk-fk8cctjy.js";import"./chunk-fxb6vjcb.js";import{Oj as O6,Pj as M0,Uk as w9,Wk as D9,dl as b9,yj as T9}from"./chunk-njzpswgt.js";import{ql as N9}from"./chunk-2cm91ktc.js";import{Fl as A0,Ol as T$}from"./chunk-ygwe0vf1.js";import"./chunk-1qbm1k9y.js";import"./chunk-3rgct4bd.js";import"./chunk-atbm0pnt.js";import"./chunk-s86fj82v.js";import"./chunk-58gp7wbg.js";import"./chunk-w4hbw37v.js";import"./chunk-qmhcbdkg.js";import"./chunk-7qxn24qa.js";import"./chunk-vx837ete.js";import"./chunk-ppvmy940.js";import"./chunk-1n4w8dya.js";import"./chunk-7ryv0f5h.js";import"./chunk-p31yg62z.js";import"./chunk-5mec6cde.js";import"./chunk-cqtkxwd8.js";import"./chunk-0mekr486.js";import"./chunk-x3931we7.js";import"./chunk-w01gjnty.js";import"./chunk-nxjbbq5h.js";import"./chunk-z559gc3n.js";import"./chunk-kbyk7hyn.js";import"./chunk-6h2faxs9.js";import"./chunk-4nck07pc.js";import"./chunk-d2n09yvh.js";import"./chunk-f3c9667r.js";import"./chunk-qpv4438m.js";import"./chunk-hybq019j.js";import"./chunk-z2q3mg73.js";import"./chunk-n07rsssz.js";import{_s as V9,bt as R6,ct as L9,ht as F9}from"./chunk-08y06vgt.js";import{iu as C6,tu as A9}from"./chunk-9p83me3p.js";import"./chunk-9wm41z2f.js";import"./chunk-48j09m6e.js";import"./chunk-se195e52.js";import"./chunk-vw673y0t.js";import"./chunk-tedrfa7d.js";import{qI as M9}from"./chunk-ynfbz3sz.js";import"./chunk-rs0nx844.js";import"./chunk-qkwhgfjt.js";import{CP as q0,DP as D,GP as E}from"./chunk-s2za1y84.js";var JZ=D((zZ)=>{/*!
2
+ import{N as R9}from"./chunk-vkskqhag.js";import{Ed as E9}from"./chunk-qt1wffbh.js";import{Fd as P6,Id as p$,Jd as S9,Kd as U9,Nd as H9,Od as q6}from"./chunk-jje0srjq.js";import"./chunk-27yxgy03.js";import{Rd as T0}from"./chunk-yajd975f.js";import{Vf as O}from"./chunk-7ppd2phw.js";import{Wg as j9,dh as I9,hh as E$}from"./chunk-wrw22v0a.js";import"./chunk-h7yya9pv.js";import"./chunk-p68rwmhc.js";import"./chunk-0a0vat1h.js";import"./chunk-z8v2tsz2.js";import"./chunk-j8efst22.js";import"./chunk-a1pw9r6f.js";import"./chunk-d5bxan80.js";import{Cl as b9,Xj as T9,lk as O6,mk as M0,rl as w9,tl as D9}from"./chunk-gsvdt4kq.js";import{Pl as N9}from"./chunk-b7mg883n.js";import{cm as A0,lm as T$}from"./chunk-90zd5rss.js";import"./chunk-17psxhve.js";import"./chunk-nj4d554m.js";import"./chunk-m2x9xhha.js";import"./chunk-2wcv3sq5.js";import"./chunk-a1p2f16h.js";import"./chunk-nt4e3em9.js";import"./chunk-ak5ngp50.js";import"./chunk-v965rsr8.js";import"./chunk-1sgby720.js";import"./chunk-jg7s9rqz.js";import"./chunk-4tbwha3m.js";import"./chunk-m612agnk.js";import"./chunk-yq3m8190.js";import"./chunk-btz9jvec.js";import"./chunk-cqtkxwd8.js";import"./chunk-fkgv2hqd.js";import"./chunk-zyhdxggp.js";import"./chunk-q6ztpfcs.js";import"./chunk-jm1ptn8n.js";import"./chunk-c5e6sk9c.js";import"./chunk-m02zt1a3.js";import"./chunk-vg2fmyje.js";import"./chunk-c0796v8j.js";import"./chunk-njnwdgvd.js";import"./chunk-4qqkqrn9.js";import"./chunk-j6emx6jn.js";import"./chunk-be216spx.js";import"./chunk-12bssxd4.js";import"./chunk-k9b1jcqw.js";import{At as R6,Bt as L9,Gt as F9,xt as V9}from"./chunk-zxaaxb99.js";import{Hu as C6,Su as A9}from"./chunk-whxjkz9a.js";import"./chunk-89v6dgpp.js";import"./chunk-k309zez0.js";import"./chunk-09kba1hg.js";import"./chunk-t12xrrfr.js";import"./chunk-phxrg7aw.js";import{PI as M9}from"./chunk-snm5q21k.js";import"./chunk-xpc2zgj7.js";import"./chunk-qjjch1zt.js";import{$P as q0,aQ as D,dQ as E}from"./chunk-aztre27e.js";var JZ=D((zZ)=>{/*!
3
3
  * content-type
4
4
  * Copyright(c) 2015 Douglas Christopher Wilson
5
5
  * MIT Licensed
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import"./chunk-aztre27e.js";var e="./libopentui-c48jzvfh.so";export{e as default};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  var j=Object.create;var{getPrototypeOf:k,defineProperty:i,getOwnPropertyNames:l}=Object;var m=Object.prototype.hasOwnProperty;function n(a){return this[a]}var o,p,s=(a,b,c)=>{var d=a!=null&&typeof a==="object";if(d){var g=b?o??=new WeakMap:p??=new WeakMap,e=g.get(a);if(e)return e}c=a!=null?j(k(a)):{};let h=b||!a||!a.__esModule?i(c,"default",{value:a,enumerable:!0}):c;for(let f of l(a))if(!m.call(h,f))i(h,f,{get:n.bind(a,f),enumerable:!0});if(d)g.set(a,h);return h};var t=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var q=(a)=>a;function r(a,b){this[a]=q.bind(null,b)}var u=(a,b)=>{for(var c in b)i(a,c,{get:b[c],enumerable:!0,configurable:!0,set:r.bind(b,c)})};var v=(a,b)=>()=>(a&&(b=a(a=0)),b);var w=import.meta.require,x=(a,b,c)=>{if(b!=null){if(typeof b!=="object"&&typeof b!=="function")throw TypeError('Object expected to be assigned to "using" declaration');let d;if(c)d=b[Symbol.asyncDispose];if(d===void 0)d=b[Symbol.dispose];if(typeof d!=="function")throw TypeError("Object not disposable");a.push([c,d,b])}else if(c)a.push([c]);return b},y=(a,b,c)=>{let d=(e)=>b=c?new SuppressedError(e,b,"An error was suppressed during disposal"):(c=!0,e),g=(e)=>{while(e=a.pop())try{var h=e[1]&&e[1].call(e[2]);if(e[0])return Promise.resolve(h).then(g,(f)=>(d(f),g()))}catch(f){d(f)}if(c)throw b};return g()};
3
- export{s as CP,t as DP,u as EP,v as FP,w as GP,x as HP,y as IP};
3
+ export{s as $P,t as aQ,u as bQ,v as cQ,w as dQ,x as eQ,y as fQ};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Fe as T,He as VG,Je as c,Ne as h,Ye as l,Ze as R,_e as b,cf as f,df as i,ef as v}from"./chunk-pjbbdm96.js";import{Yq as KG,Zq as s,cr as BG,er as S}from"./chunk-5mec6cde.js";import{Tu as G}from"./chunk-se195e52.js";var EG=G.object({error:G.object({message:G.string(),type:G.string().nullish(),param:G.any().nullish(),code:G.union([G.string(),G.number()]).nullish()})}),n={errorSchema:EG,errorToMessage:(Q)=>Q.error.message};function $G(Q){var Y,Z,$,U,z,j;if(Q==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let K=(Y=Q.prompt_tokens)!=null?Y:0,W=(Z=Q.completion_tokens)!=null?Z:0,X=(U=($=Q.prompt_tokens_details)==null?void 0:$.cached_tokens)!=null?U:0,J=(j=(z=Q.completion_tokens_details)==null?void 0:z.reasoning_tokens)!=null?j:0;return{inputTokens:{total:K,noCache:K-X,cacheRead:X,cacheWrite:void 0},outputTokens:{total:W,text:W-J,reasoning:J},raw:Q}}function C(Q){var Y,Z;return(Z=(Y=Q==null?void 0:Q.providerOptions)==null?void 0:Y.openaiCompatible)!=null?Z:{}}function HG(Q){switch(Q){case"audio/wav":return"wav";case"audio/mp3":case"audio/mpeg":return"mp3";default:return null}}function AG(Q){var Y,Z,$;let U=[];for(let{role:z,content:j,...K}of Q){let W=C({...K});switch(z){case"system":{U.push({role:"system",content:j,...W});break}case"user":{if(j.length===1&&j[0].type==="text"){U.push({role:"user",content:j[0].text,...C(j[0])});break}U.push({role:"user",content:j.map((X)=>{var J;let B=C(X);switch(X.type){case"text":return{type:"text",text:X.text,...B};case"file":{if(X.mediaType.startsWith("image/")){let L=X.mediaType==="image/*"?"image/jpeg":X.mediaType;return{type:"image_url",image_url:{url:X.data instanceof URL?X.data.toString():`data:${L};base64,${c(X.data)}`},...B}}if(X.mediaType.startsWith("audio/")){if(X.data instanceof URL)throw new S({functionality:"audio file parts with URLs"});let L=HG(X.mediaType);if(L===null)throw new S({functionality:`audio media type ${X.mediaType}`});return{type:"input_audio",input_audio:{data:c(X.data),format:L},...B}}if(X.mediaType==="application/pdf"){if(X.data instanceof URL)throw new S({functionality:"PDF file parts with URLs"});return{type:"file",file:{filename:(J=X.filename)!=null?J:"document.pdf",file_data:`data:application/pdf;base64,${c(X.data)}`},...B}}if(X.mediaType.startsWith("text/"))return{type:"text",text:X.data instanceof URL?X.data.toString():typeof X.data==="string"?new TextDecoder().decode(VG(X.data)):new TextDecoder().decode(X.data),...B};throw new S({functionality:`file part media type ${X.mediaType}`})}}}),...W});break}case"assistant":{let X="",J="",B=[];for(let L of j){let N=C(L);switch(L.type){case"text":{X+=L.text;break}case"reasoning":{J+=L.text;break}case"tool-call":{let H=(Z=(Y=L.providerOptions)==null?void 0:Y.google)==null?void 0:Z.thoughtSignature;B.push({id:L.toolCallId,type:"function",function:{name:L.toolName,arguments:JSON.stringify(L.input)},...N,...H?{extra_content:{google:{thought_signature:String(H)}}}:{}});break}}}U.push({role:"assistant",content:X,...J.length>0?{reasoning_content:J}:{},tool_calls:B.length>0?B:void 0,...W});break}case"tool":{for(let X of j){if(X.type==="tool-approval-response")continue;let J=X.output,B;switch(J.type){case"text":case"error-text":B=J.value;break;case"execution-denied":B=($=J.reason)!=null?$:"Tool execution denied.";break;case"content":case"json":case"error-json":B=JSON.stringify(J.value);break}let L=C(X);U.push({role:"tool",tool_call_id:X.toolCallId,content:B,...L})}break}default:throw Error(`Unsupported role: ${z}`)}}return U}function JG({id:Q,model:Y,created:Z}){return{id:Q!=null?Q:void 0,modelId:Y!=null?Y:void 0,timestamp:Z!=null?new Date(Z*1000):void 0}}function UG(Q){switch(Q){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"other"}}var d=G.object({user:G.string().optional(),reasoningEffort:G.string().optional(),textVerbosity:G.string().optional(),strictJsonSchema:G.boolean().optional()});function PG({tools:Q,toolChoice:Y}){Q=(Q==null?void 0:Q.length)?Q:void 0;let Z=[];if(Q==null)return{tools:void 0,toolChoice:void 0,toolWarnings:Z};let $=[];for(let z of Q)if(z.type==="provider")Z.push({type:"unsupported",feature:`provider-defined tool ${z.id}`});else $.push({type:"function",function:{name:z.name,description:z.description,parameters:z.inputSchema,...z.strict!=null?{strict:z.strict}:{}}});if(Y==null)return{tools:$,toolChoice:void 0,toolWarnings:Z};let U=Y.type;switch(U){case"auto":case"none":case"required":return{tools:$,toolChoice:U,toolWarnings:Z};case"tool":return{tools:$,toolChoice:{type:"function",function:{name:Y.toolName}},toolWarnings:Z};default:throw new S({functionality:`tool choice type: ${U}`})}}var CG=class{constructor(Q,Y){this.specificationVersion="v3";var Z,$;this.modelId=Q,this.config=Y;let U=(Z=Y.errorStructure)!=null?Z:n;this.chunkSchema=DG(U.errorSchema),this.failedResponseHandler=f(U),this.supportsStructuredOutputs=($=Y.supportsStructuredOutputs)!=null?$:!1}get provider(){return this.config.provider}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}get supportedUrls(){var Q,Y,Z;return(Z=(Y=(Q=this.config).supportedUrls)==null?void 0:Y.call(Q))!=null?Z:{}}transformRequestBody(Q){var Y,Z,$;return($=(Z=(Y=this.config).transformRequestBody)==null?void 0:Z.call(Y,Q))!=null?$:Q}async getArgs({prompt:Q,maxOutputTokens:Y,temperature:Z,topP:$,topK:U,frequencyPenalty:z,presencePenalty:j,providerOptions:K,stopSequences:W,responseFormat:X,seed:J,toolChoice:B,tools:L}){var N,H,E,V,q;let A=[],I=await R({provider:"openai-compatible",providerOptions:K,schema:d});if(I!=null)A.push({type:"other",message:"The 'openai-compatible' key in providerOptions is deprecated. Use 'openaiCompatible' instead."});let D=Object.assign(I!=null?I:{},(N=await R({provider:"openaiCompatible",providerOptions:K,schema:d}))!=null?N:{},(H=await R({provider:this.providerOptionsName,providerOptions:K,schema:d}))!=null?H:{}),P=(E=D==null?void 0:D.strictJsonSchema)!=null?E:!0;if(U!=null)A.push({type:"unsupported",feature:"topK"});if((X==null?void 0:X.type)==="json"&&X.schema!=null&&!this.supportsStructuredOutputs)A.push({type:"unsupported",feature:"responseFormat",details:"JSON response format schema is only supported with structuredOutputs"});let{tools:w,toolChoice:y,toolWarnings:u}=PG({tools:L,toolChoice:B});return{args:{model:this.modelId,user:D.user,max_tokens:Y,temperature:Z,top_p:$,frequency_penalty:z,presence_penalty:j,response_format:(X==null?void 0:X.type)==="json"?this.supportsStructuredOutputs===!0&&X.schema!=null?{type:"json_schema",json_schema:{schema:X.schema,strict:P,name:(V=X.name)!=null?V:"response",description:X.description}}:{type:"json_object"}:void 0,stop:W,seed:J,...Object.fromEntries(Object.entries((q=K==null?void 0:K[this.providerOptionsName])!=null?q:{}).filter(([g])=>!Object.keys(d.shape).includes(g))),reasoning_effort:D.reasoningEffort,verbosity:D.textVerbosity,messages:AG(Q),tools:w,tool_choice:y},warnings:[...A,...u]}}async doGenerate(Q){var Y,Z,$,U,z,j,K,W;let{args:X,warnings:J}=await this.getArgs({...Q}),B=this.transformRequestBody(X),L=JSON.stringify(B),{responseHeaders:N,value:H,rawValue:E}=await b({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:T(this.config.headers(),Q.headers),body:B,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:v(qG),abortSignal:Q.abortSignal,fetch:this.config.fetch}),V=H.choices[0],q=[],A=V.message.content;if(A!=null&&A.length>0)q.push({type:"text",text:A});let I=(Y=V.message.reasoning_content)!=null?Y:V.message.reasoning;if(I!=null&&I.length>0)q.push({type:"reasoning",text:I});if(V.message.tool_calls!=null)for(let w of V.message.tool_calls){let y=($=(Z=w.extra_content)==null?void 0:Z.google)==null?void 0:$.thought_signature;q.push({type:"tool-call",toolCallId:(U=w.id)!=null?U:h(),toolName:w.function.name,input:w.function.arguments,...y?{providerMetadata:{[this.providerOptionsName]:{thoughtSignature:y}}}:{}})}let D={[this.providerOptionsName]:{},...await((j=(z=this.config.metadataExtractor)==null?void 0:z.extractMetadata)==null?void 0:j.call(z,{parsedBody:E}))},P=(K=H.usage)==null?void 0:K.completion_tokens_details;if((P==null?void 0:P.accepted_prediction_tokens)!=null)D[this.providerOptionsName].acceptedPredictionTokens=P==null?void 0:P.accepted_prediction_tokens;if((P==null?void 0:P.rejected_prediction_tokens)!=null)D[this.providerOptionsName].rejectedPredictionTokens=P==null?void 0:P.rejected_prediction_tokens;return{content:q,finishReason:{unified:UG(V.finish_reason),raw:(W=V.finish_reason)!=null?W:void 0},usage:$G(H.usage),providerMetadata:D,request:{body:L},response:{...JG(H),headers:N,body:E},warnings:J}}async doStream(Q){var Y;let{args:Z,warnings:$}=await this.getArgs({...Q}),U=this.transformRequestBody({...Z,stream:!0,stream_options:this.config.includeUsage?{include_usage:!0}:void 0}),z=(Y=this.config.metadataExtractor)==null?void 0:Y.createStreamExtractor(),{responseHeaders:j,value:K}=await b({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:T(this.config.headers(),Q.headers),body:U,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:i(this.chunkSchema),abortSignal:Q.abortSignal,fetch:this.config.fetch}),W=[],X={unified:"other",raw:void 0},J=void 0,B=!0,L=this.providerOptionsName,N=!1,H=!1;return{stream:K.pipeThrough(new TransformStream({start(E){E.enqueue({type:"stream-start",warnings:$})},transform(E,V){var q,A,I,D,P,w,y,u,g,a,r,t,e,o,GG,QG,XG,YG;if(Q.includeRawChunks)V.enqueue({type:"raw",rawValue:E.rawValue});if(!E.success){X={unified:"error",raw:void 0},V.enqueue({type:"error",error:E.error});return}if(z==null||z.processChunk(E.rawValue),"error"in E.value){X={unified:"error",raw:void 0},V.enqueue({type:"error",error:E.value.error.message});return}let _=E.value;if(B)B=!1,V.enqueue({type:"response-metadata",...JG(_)});if(_.usage!=null)J=_.usage;let O=_.choices[0];if((O==null?void 0:O.finish_reason)!=null)X={unified:UG(O.finish_reason),raw:(q=O.finish_reason)!=null?q:void 0};if((O==null?void 0:O.delta)==null)return;let k=O.delta,ZG=(A=k.reasoning_content)!=null?A:k.reasoning;if(ZG){if(!N)V.enqueue({type:"reasoning-start",id:"reasoning-0"}),N=!0;V.enqueue({type:"reasoning-delta",id:"reasoning-0",delta:ZG})}if(k.content){if(N)V.enqueue({type:"reasoning-end",id:"reasoning-0"}),N=!1;if(!H)V.enqueue({type:"text-start",id:"txt-0"}),H=!0;V.enqueue({type:"text-delta",id:"txt-0",delta:k.content})}if(k.tool_calls!=null){if(N)V.enqueue({type:"reasoning-end",id:"reasoning-0"}),N=!1;for(let x of k.tool_calls){let m=(I=x.index)!=null?I:W.length;if(W[m]==null){if(x.id==null)throw new s({data:x,message:"Expected 'id' to be a string."});if(((D=x.function)==null?void 0:D.name)==null)throw new s({data:x,message:"Expected 'function.name' to be a string."});V.enqueue({type:"tool-input-start",id:x.id,toolName:x.function.name}),W[m]={id:x.id,type:"function",function:{name:x.function.name,arguments:(P=x.function.arguments)!=null?P:""},hasFinished:!1,thoughtSignature:(u=(y=(w=x.extra_content)==null?void 0:w.google)==null?void 0:y.thought_signature)!=null?u:void 0};let M=W[m];if(((g=M.function)==null?void 0:g.name)!=null&&((a=M.function)==null?void 0:a.arguments)!=null){if(M.function.arguments.length>0)V.enqueue({type:"tool-input-delta",id:M.id,delta:M.function.arguments});if(l(M.function.arguments))V.enqueue({type:"tool-input-end",id:M.id}),V.enqueue({type:"tool-call",toolCallId:(r=M.id)!=null?r:h(),toolName:M.function.name,input:M.function.arguments,...M.thoughtSignature?{providerMetadata:{[L]:{thoughtSignature:M.thoughtSignature}}}:{}}),M.hasFinished=!0}continue}let F=W[m];if(F.hasFinished)continue;if(((t=x.function)==null?void 0:t.arguments)!=null)F.function.arguments+=(o=(e=x.function)==null?void 0:e.arguments)!=null?o:"";if(V.enqueue({type:"tool-input-delta",id:F.id,delta:(GG=x.function.arguments)!=null?GG:""}),((QG=F.function)==null?void 0:QG.name)!=null&&((XG=F.function)==null?void 0:XG.arguments)!=null&&l(F.function.arguments))V.enqueue({type:"tool-input-end",id:F.id}),V.enqueue({type:"tool-call",toolCallId:(YG=F.id)!=null?YG:h(),toolName:F.function.name,input:F.function.arguments,...F.thoughtSignature?{providerMetadata:{[L]:{thoughtSignature:F.thoughtSignature}}}:{}}),F.hasFinished=!0}}},flush(E){var V,q,A,I,D;if(N)E.enqueue({type:"reasoning-end",id:"reasoning-0"});if(H)E.enqueue({type:"text-end",id:"txt-0"});for(let w of W.filter((y)=>!y.hasFinished))E.enqueue({type:"tool-input-end",id:w.id}),E.enqueue({type:"tool-call",toolCallId:(V=w.id)!=null?V:h(),toolName:w.function.name,input:w.function.arguments,...w.thoughtSignature?{providerMetadata:{[L]:{thoughtSignature:w.thoughtSignature}}}:{}});let P={[L]:{},...z==null?void 0:z.buildMetadata()};if(((q=J==null?void 0:J.completion_tokens_details)==null?void 0:q.accepted_prediction_tokens)!=null)P[L].acceptedPredictionTokens=(A=J==null?void 0:J.completion_tokens_details)==null?void 0:A.accepted_prediction_tokens;if(((I=J==null?void 0:J.completion_tokens_details)==null?void 0:I.rejected_prediction_tokens)!=null)P[L].rejectedPredictionTokens=(D=J==null?void 0:J.completion_tokens_details)==null?void 0:D.rejected_prediction_tokens;E.enqueue({type:"finish",finishReason:X,usage:$G(J),providerMetadata:P})}})),request:{body:U},response:{headers:j}}}},WG=G.looseObject({prompt_tokens:G.number().nullish(),completion_tokens:G.number().nullish(),total_tokens:G.number().nullish(),prompt_tokens_details:G.object({cached_tokens:G.number().nullish()}).nullish(),completion_tokens_details:G.object({reasoning_tokens:G.number().nullish(),accepted_prediction_tokens:G.number().nullish(),rejected_prediction_tokens:G.number().nullish()}).nullish()}).nullish(),qG=G.looseObject({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({message:G.object({role:G.literal("assistant").nullish(),content:G.string().nullish(),reasoning_content:G.string().nullish(),reasoning:G.string().nullish(),tool_calls:G.array(G.object({id:G.string().nullish(),function:G.object({name:G.string(),arguments:G.string()}),extra_content:G.object({google:G.object({thought_signature:G.string().nullish()}).nullish()}).nullish()})).nullish()}),finish_reason:G.string().nullish()})),usage:WG}),wG=G.looseObject({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({delta:G.object({role:G.enum(["assistant"]).nullish(),content:G.string().nullish(),reasoning_content:G.string().nullish(),reasoning:G.string().nullish(),tool_calls:G.array(G.object({index:G.number().nullish(),id:G.string().nullish(),function:G.object({name:G.string().nullish(),arguments:G.string().nullish()}),extra_content:G.object({google:G.object({thought_signature:G.string().nullish()}).nullish()}).nullish()})).nullish()}).nullish(),finish_reason:G.string().nullish()})),usage:WG}),DG=(Q)=>G.union([wG,Q]);function jG(Q){var Y,Z;if(Q==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let $=(Y=Q.prompt_tokens)!=null?Y:0,U=(Z=Q.completion_tokens)!=null?Z:0;return{inputTokens:{total:$,noCache:$,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:U,text:U,reasoning:void 0},raw:Q}}function xG({prompt:Q,user:Y="user",assistant:Z="assistant"}){let $="";if(Q[0].role==="system")$+=`${Q[0].content}
2
+ import{$e as b,Ge as T,Ie as VG,Ke as c,Oe as h,Ze as l,_e as R,df as f,ef as i,ff as v}from"./chunk-qv2s39dv.js";import{Br as BG,Dr as S,vr as KG,wr as s}from"./chunk-btz9jvec.js";import{qv as G}from"./chunk-09kba1hg.js";var EG=G.object({error:G.object({message:G.string(),type:G.string().nullish(),param:G.any().nullish(),code:G.union([G.string(),G.number()]).nullish()})}),n={errorSchema:EG,errorToMessage:(Q)=>Q.error.message};function $G(Q){var Y,Z,$,U,z,j;if(Q==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let K=(Y=Q.prompt_tokens)!=null?Y:0,W=(Z=Q.completion_tokens)!=null?Z:0,X=(U=($=Q.prompt_tokens_details)==null?void 0:$.cached_tokens)!=null?U:0,J=(j=(z=Q.completion_tokens_details)==null?void 0:z.reasoning_tokens)!=null?j:0;return{inputTokens:{total:K,noCache:K-X,cacheRead:X,cacheWrite:void 0},outputTokens:{total:W,text:W-J,reasoning:J},raw:Q}}function C(Q){var Y,Z;return(Z=(Y=Q==null?void 0:Q.providerOptions)==null?void 0:Y.openaiCompatible)!=null?Z:{}}function HG(Q){switch(Q){case"audio/wav":return"wav";case"audio/mp3":case"audio/mpeg":return"mp3";default:return null}}function AG(Q){var Y,Z,$;let U=[];for(let{role:z,content:j,...K}of Q){let W=C({...K});switch(z){case"system":{U.push({role:"system",content:j,...W});break}case"user":{if(j.length===1&&j[0].type==="text"){U.push({role:"user",content:j[0].text,...C(j[0])});break}U.push({role:"user",content:j.map((X)=>{var J;let B=C(X);switch(X.type){case"text":return{type:"text",text:X.text,...B};case"file":{if(X.mediaType.startsWith("image/")){let L=X.mediaType==="image/*"?"image/jpeg":X.mediaType;return{type:"image_url",image_url:{url:X.data instanceof URL?X.data.toString():`data:${L};base64,${c(X.data)}`},...B}}if(X.mediaType.startsWith("audio/")){if(X.data instanceof URL)throw new S({functionality:"audio file parts with URLs"});let L=HG(X.mediaType);if(L===null)throw new S({functionality:`audio media type ${X.mediaType}`});return{type:"input_audio",input_audio:{data:c(X.data),format:L},...B}}if(X.mediaType==="application/pdf"){if(X.data instanceof URL)throw new S({functionality:"PDF file parts with URLs"});return{type:"file",file:{filename:(J=X.filename)!=null?J:"document.pdf",file_data:`data:application/pdf;base64,${c(X.data)}`},...B}}if(X.mediaType.startsWith("text/"))return{type:"text",text:X.data instanceof URL?X.data.toString():typeof X.data==="string"?new TextDecoder().decode(VG(X.data)):new TextDecoder().decode(X.data),...B};throw new S({functionality:`file part media type ${X.mediaType}`})}}}),...W});break}case"assistant":{let X="",J="",B=[];for(let L of j){let N=C(L);switch(L.type){case"text":{X+=L.text;break}case"reasoning":{J+=L.text;break}case"tool-call":{let H=(Z=(Y=L.providerOptions)==null?void 0:Y.google)==null?void 0:Z.thoughtSignature;B.push({id:L.toolCallId,type:"function",function:{name:L.toolName,arguments:JSON.stringify(L.input)},...N,...H?{extra_content:{google:{thought_signature:String(H)}}}:{}});break}}}U.push({role:"assistant",content:X,...J.length>0?{reasoning_content:J}:{},tool_calls:B.length>0?B:void 0,...W});break}case"tool":{for(let X of j){if(X.type==="tool-approval-response")continue;let J=X.output,B;switch(J.type){case"text":case"error-text":B=J.value;break;case"execution-denied":B=($=J.reason)!=null?$:"Tool execution denied.";break;case"content":case"json":case"error-json":B=JSON.stringify(J.value);break}let L=C(X);U.push({role:"tool",tool_call_id:X.toolCallId,content:B,...L})}break}default:throw Error(`Unsupported role: ${z}`)}}return U}function JG({id:Q,model:Y,created:Z}){return{id:Q!=null?Q:void 0,modelId:Y!=null?Y:void 0,timestamp:Z!=null?new Date(Z*1000):void 0}}function UG(Q){switch(Q){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"other"}}var d=G.object({user:G.string().optional(),reasoningEffort:G.string().optional(),textVerbosity:G.string().optional(),strictJsonSchema:G.boolean().optional()});function PG({tools:Q,toolChoice:Y}){Q=(Q==null?void 0:Q.length)?Q:void 0;let Z=[];if(Q==null)return{tools:void 0,toolChoice:void 0,toolWarnings:Z};let $=[];for(let z of Q)if(z.type==="provider")Z.push({type:"unsupported",feature:`provider-defined tool ${z.id}`});else $.push({type:"function",function:{name:z.name,description:z.description,parameters:z.inputSchema,...z.strict!=null?{strict:z.strict}:{}}});if(Y==null)return{tools:$,toolChoice:void 0,toolWarnings:Z};let U=Y.type;switch(U){case"auto":case"none":case"required":return{tools:$,toolChoice:U,toolWarnings:Z};case"tool":return{tools:$,toolChoice:{type:"function",function:{name:Y.toolName}},toolWarnings:Z};default:throw new S({functionality:`tool choice type: ${U}`})}}var CG=class{constructor(Q,Y){this.specificationVersion="v3";var Z,$;this.modelId=Q,this.config=Y;let U=(Z=Y.errorStructure)!=null?Z:n;this.chunkSchema=DG(U.errorSchema),this.failedResponseHandler=f(U),this.supportsStructuredOutputs=($=Y.supportsStructuredOutputs)!=null?$:!1}get provider(){return this.config.provider}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}get supportedUrls(){var Q,Y,Z;return(Z=(Y=(Q=this.config).supportedUrls)==null?void 0:Y.call(Q))!=null?Z:{}}transformRequestBody(Q){var Y,Z,$;return($=(Z=(Y=this.config).transformRequestBody)==null?void 0:Z.call(Y,Q))!=null?$:Q}async getArgs({prompt:Q,maxOutputTokens:Y,temperature:Z,topP:$,topK:U,frequencyPenalty:z,presencePenalty:j,providerOptions:K,stopSequences:W,responseFormat:X,seed:J,toolChoice:B,tools:L}){var N,H,E,V,q;let A=[],I=await R({provider:"openai-compatible",providerOptions:K,schema:d});if(I!=null)A.push({type:"other",message:"The 'openai-compatible' key in providerOptions is deprecated. Use 'openaiCompatible' instead."});let D=Object.assign(I!=null?I:{},(N=await R({provider:"openaiCompatible",providerOptions:K,schema:d}))!=null?N:{},(H=await R({provider:this.providerOptionsName,providerOptions:K,schema:d}))!=null?H:{}),P=(E=D==null?void 0:D.strictJsonSchema)!=null?E:!0;if(U!=null)A.push({type:"unsupported",feature:"topK"});if((X==null?void 0:X.type)==="json"&&X.schema!=null&&!this.supportsStructuredOutputs)A.push({type:"unsupported",feature:"responseFormat",details:"JSON response format schema is only supported with structuredOutputs"});let{tools:w,toolChoice:y,toolWarnings:u}=PG({tools:L,toolChoice:B});return{args:{model:this.modelId,user:D.user,max_tokens:Y,temperature:Z,top_p:$,frequency_penalty:z,presence_penalty:j,response_format:(X==null?void 0:X.type)==="json"?this.supportsStructuredOutputs===!0&&X.schema!=null?{type:"json_schema",json_schema:{schema:X.schema,strict:P,name:(V=X.name)!=null?V:"response",description:X.description}}:{type:"json_object"}:void 0,stop:W,seed:J,...Object.fromEntries(Object.entries((q=K==null?void 0:K[this.providerOptionsName])!=null?q:{}).filter(([g])=>!Object.keys(d.shape).includes(g))),reasoning_effort:D.reasoningEffort,verbosity:D.textVerbosity,messages:AG(Q),tools:w,tool_choice:y},warnings:[...A,...u]}}async doGenerate(Q){var Y,Z,$,U,z,j,K,W;let{args:X,warnings:J}=await this.getArgs({...Q}),B=this.transformRequestBody(X),L=JSON.stringify(B),{responseHeaders:N,value:H,rawValue:E}=await b({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:T(this.config.headers(),Q.headers),body:B,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:v(qG),abortSignal:Q.abortSignal,fetch:this.config.fetch}),V=H.choices[0],q=[],A=V.message.content;if(A!=null&&A.length>0)q.push({type:"text",text:A});let I=(Y=V.message.reasoning_content)!=null?Y:V.message.reasoning;if(I!=null&&I.length>0)q.push({type:"reasoning",text:I});if(V.message.tool_calls!=null)for(let w of V.message.tool_calls){let y=($=(Z=w.extra_content)==null?void 0:Z.google)==null?void 0:$.thought_signature;q.push({type:"tool-call",toolCallId:(U=w.id)!=null?U:h(),toolName:w.function.name,input:w.function.arguments,...y?{providerMetadata:{[this.providerOptionsName]:{thoughtSignature:y}}}:{}})}let D={[this.providerOptionsName]:{},...await((j=(z=this.config.metadataExtractor)==null?void 0:z.extractMetadata)==null?void 0:j.call(z,{parsedBody:E}))},P=(K=H.usage)==null?void 0:K.completion_tokens_details;if((P==null?void 0:P.accepted_prediction_tokens)!=null)D[this.providerOptionsName].acceptedPredictionTokens=P==null?void 0:P.accepted_prediction_tokens;if((P==null?void 0:P.rejected_prediction_tokens)!=null)D[this.providerOptionsName].rejectedPredictionTokens=P==null?void 0:P.rejected_prediction_tokens;return{content:q,finishReason:{unified:UG(V.finish_reason),raw:(W=V.finish_reason)!=null?W:void 0},usage:$G(H.usage),providerMetadata:D,request:{body:L},response:{...JG(H),headers:N,body:E},warnings:J}}async doStream(Q){var Y;let{args:Z,warnings:$}=await this.getArgs({...Q}),U=this.transformRequestBody({...Z,stream:!0,stream_options:this.config.includeUsage?{include_usage:!0}:void 0}),z=(Y=this.config.metadataExtractor)==null?void 0:Y.createStreamExtractor(),{responseHeaders:j,value:K}=await b({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:T(this.config.headers(),Q.headers),body:U,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:i(this.chunkSchema),abortSignal:Q.abortSignal,fetch:this.config.fetch}),W=[],X={unified:"other",raw:void 0},J=void 0,B=!0,L=this.providerOptionsName,N=!1,H=!1;return{stream:K.pipeThrough(new TransformStream({start(E){E.enqueue({type:"stream-start",warnings:$})},transform(E,V){var q,A,I,D,P,w,y,u,g,a,r,t,e,o,GG,QG,XG,YG;if(Q.includeRawChunks)V.enqueue({type:"raw",rawValue:E.rawValue});if(!E.success){X={unified:"error",raw:void 0},V.enqueue({type:"error",error:E.error});return}if(z==null||z.processChunk(E.rawValue),"error"in E.value){X={unified:"error",raw:void 0},V.enqueue({type:"error",error:E.value.error.message});return}let _=E.value;if(B)B=!1,V.enqueue({type:"response-metadata",...JG(_)});if(_.usage!=null)J=_.usage;let O=_.choices[0];if((O==null?void 0:O.finish_reason)!=null)X={unified:UG(O.finish_reason),raw:(q=O.finish_reason)!=null?q:void 0};if((O==null?void 0:O.delta)==null)return;let k=O.delta,ZG=(A=k.reasoning_content)!=null?A:k.reasoning;if(ZG){if(!N)V.enqueue({type:"reasoning-start",id:"reasoning-0"}),N=!0;V.enqueue({type:"reasoning-delta",id:"reasoning-0",delta:ZG})}if(k.content){if(N)V.enqueue({type:"reasoning-end",id:"reasoning-0"}),N=!1;if(!H)V.enqueue({type:"text-start",id:"txt-0"}),H=!0;V.enqueue({type:"text-delta",id:"txt-0",delta:k.content})}if(k.tool_calls!=null){if(N)V.enqueue({type:"reasoning-end",id:"reasoning-0"}),N=!1;for(let x of k.tool_calls){let m=(I=x.index)!=null?I:W.length;if(W[m]==null){if(x.id==null)throw new s({data:x,message:"Expected 'id' to be a string."});if(((D=x.function)==null?void 0:D.name)==null)throw new s({data:x,message:"Expected 'function.name' to be a string."});V.enqueue({type:"tool-input-start",id:x.id,toolName:x.function.name}),W[m]={id:x.id,type:"function",function:{name:x.function.name,arguments:(P=x.function.arguments)!=null?P:""},hasFinished:!1,thoughtSignature:(u=(y=(w=x.extra_content)==null?void 0:w.google)==null?void 0:y.thought_signature)!=null?u:void 0};let M=W[m];if(((g=M.function)==null?void 0:g.name)!=null&&((a=M.function)==null?void 0:a.arguments)!=null){if(M.function.arguments.length>0)V.enqueue({type:"tool-input-delta",id:M.id,delta:M.function.arguments});if(l(M.function.arguments))V.enqueue({type:"tool-input-end",id:M.id}),V.enqueue({type:"tool-call",toolCallId:(r=M.id)!=null?r:h(),toolName:M.function.name,input:M.function.arguments,...M.thoughtSignature?{providerMetadata:{[L]:{thoughtSignature:M.thoughtSignature}}}:{}}),M.hasFinished=!0}continue}let F=W[m];if(F.hasFinished)continue;if(((t=x.function)==null?void 0:t.arguments)!=null)F.function.arguments+=(o=(e=x.function)==null?void 0:e.arguments)!=null?o:"";if(V.enqueue({type:"tool-input-delta",id:F.id,delta:(GG=x.function.arguments)!=null?GG:""}),((QG=F.function)==null?void 0:QG.name)!=null&&((XG=F.function)==null?void 0:XG.arguments)!=null&&l(F.function.arguments))V.enqueue({type:"tool-input-end",id:F.id}),V.enqueue({type:"tool-call",toolCallId:(YG=F.id)!=null?YG:h(),toolName:F.function.name,input:F.function.arguments,...F.thoughtSignature?{providerMetadata:{[L]:{thoughtSignature:F.thoughtSignature}}}:{}}),F.hasFinished=!0}}},flush(E){var V,q,A,I,D;if(N)E.enqueue({type:"reasoning-end",id:"reasoning-0"});if(H)E.enqueue({type:"text-end",id:"txt-0"});for(let w of W.filter((y)=>!y.hasFinished))E.enqueue({type:"tool-input-end",id:w.id}),E.enqueue({type:"tool-call",toolCallId:(V=w.id)!=null?V:h(),toolName:w.function.name,input:w.function.arguments,...w.thoughtSignature?{providerMetadata:{[L]:{thoughtSignature:w.thoughtSignature}}}:{}});let P={[L]:{},...z==null?void 0:z.buildMetadata()};if(((q=J==null?void 0:J.completion_tokens_details)==null?void 0:q.accepted_prediction_tokens)!=null)P[L].acceptedPredictionTokens=(A=J==null?void 0:J.completion_tokens_details)==null?void 0:A.accepted_prediction_tokens;if(((I=J==null?void 0:J.completion_tokens_details)==null?void 0:I.rejected_prediction_tokens)!=null)P[L].rejectedPredictionTokens=(D=J==null?void 0:J.completion_tokens_details)==null?void 0:D.rejected_prediction_tokens;E.enqueue({type:"finish",finishReason:X,usage:$G(J),providerMetadata:P})}})),request:{body:U},response:{headers:j}}}},WG=G.looseObject({prompt_tokens:G.number().nullish(),completion_tokens:G.number().nullish(),total_tokens:G.number().nullish(),prompt_tokens_details:G.object({cached_tokens:G.number().nullish()}).nullish(),completion_tokens_details:G.object({reasoning_tokens:G.number().nullish(),accepted_prediction_tokens:G.number().nullish(),rejected_prediction_tokens:G.number().nullish()}).nullish()}).nullish(),qG=G.looseObject({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({message:G.object({role:G.literal("assistant").nullish(),content:G.string().nullish(),reasoning_content:G.string().nullish(),reasoning:G.string().nullish(),tool_calls:G.array(G.object({id:G.string().nullish(),function:G.object({name:G.string(),arguments:G.string()}),extra_content:G.object({google:G.object({thought_signature:G.string().nullish()}).nullish()}).nullish()})).nullish()}),finish_reason:G.string().nullish()})),usage:WG}),wG=G.looseObject({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({delta:G.object({role:G.enum(["assistant"]).nullish(),content:G.string().nullish(),reasoning_content:G.string().nullish(),reasoning:G.string().nullish(),tool_calls:G.array(G.object({index:G.number().nullish(),id:G.string().nullish(),function:G.object({name:G.string().nullish(),arguments:G.string().nullish()}),extra_content:G.object({google:G.object({thought_signature:G.string().nullish()}).nullish()}).nullish()})).nullish()}).nullish(),finish_reason:G.string().nullish()})),usage:WG}),DG=(Q)=>G.union([wG,Q]);function jG(Q){var Y,Z;if(Q==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let $=(Y=Q.prompt_tokens)!=null?Y:0,U=(Z=Q.completion_tokens)!=null?Z:0;return{inputTokens:{total:$,noCache:$,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:U,text:U,reasoning:void 0},raw:Q}}function xG({prompt:Q,user:Y="user",assistant:Z="assistant"}){let $="";if(Q[0].role==="system")$+=`${Q[0].content}
3
3
 
4
4
  `,Q=Q.slice(1);for(let{role:U,content:z}of Q)switch(U){case"system":throw new KG({message:"Unexpected system message in prompt: ${content}",prompt:Q});case"user":{let j=z.map((K)=>{switch(K.type){case"text":return K.text}}).filter(Boolean).join("");$+=`${Y}:
5
5
  ${j}
@@ -10,4 +10,4 @@ ${j}
10
10
  `;break}case"tool":throw new S({functionality:"tool messages"});default:throw Error(`Unsupported role: ${U}`)}return $+=`${Z}:
11
11
  `,{prompt:$,stopSequences:[`
12
12
  ${Y}:`]}}function LG({id:Q,model:Y,created:Z}){return{id:Q!=null?Q:void 0,modelId:Y!=null?Y:void 0,timestamp:Z!=null?new Date(Z*1000):void 0}}function zG(Q){switch(Q){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"other"}}var IG=G.object({echo:G.boolean().optional(),logitBias:G.record(G.string(),G.number()).optional(),suffix:G.string().optional(),user:G.string().optional()}),mG=class{constructor(Q,Y){this.specificationVersion="v3";var Z;this.modelId=Q,this.config=Y;let $=(Z=Y.errorStructure)!=null?Z:n;this.chunkSchema=MG($.errorSchema),this.failedResponseHandler=f($)}get provider(){return this.config.provider}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}get supportedUrls(){var Q,Y,Z;return(Z=(Y=(Q=this.config).supportedUrls)==null?void 0:Y.call(Q))!=null?Z:{}}async getArgs({prompt:Q,maxOutputTokens:Y,temperature:Z,topP:$,topK:U,frequencyPenalty:z,presencePenalty:j,stopSequences:K,responseFormat:W,seed:X,providerOptions:J,tools:B,toolChoice:L}){var N;let H=[],E=(N=await R({provider:this.providerOptionsName,providerOptions:J,schema:IG}))!=null?N:{};if(U!=null)H.push({type:"unsupported",feature:"topK"});if(B==null?void 0:B.length)H.push({type:"unsupported",feature:"tools"});if(L!=null)H.push({type:"unsupported",feature:"toolChoice"});if(W!=null&&W.type!=="text")H.push({type:"unsupported",feature:"responseFormat",details:"JSON response format is not supported."});let{prompt:V,stopSequences:q}=xG({prompt:Q}),A=[...q!=null?q:[],...K!=null?K:[]];return{args:{model:this.modelId,echo:E.echo,logit_bias:E.logitBias,suffix:E.suffix,user:E.user,max_tokens:Y,temperature:Z,top_p:$,frequency_penalty:z,presence_penalty:j,seed:X,...J==null?void 0:J[this.providerOptionsName],prompt:V,stop:A.length>0?A:void 0},warnings:H}}async doGenerate(Q){let{args:Y,warnings:Z}=await this.getArgs(Q),{responseHeaders:$,value:U,rawValue:z}=await b({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:T(this.config.headers(),Q.headers),body:Y,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:v(FG),abortSignal:Q.abortSignal,fetch:this.config.fetch}),j=U.choices[0],K=[];if(j.text!=null&&j.text.length>0)K.push({type:"text",text:j.text});return{content:K,usage:jG(U.usage),finishReason:{unified:zG(j.finish_reason),raw:j.finish_reason},request:{body:Y},response:{...LG(U),headers:$,body:z},warnings:Z}}async doStream(Q){let{args:Y,warnings:Z}=await this.getArgs(Q),$={...Y,stream:!0,stream_options:this.config.includeUsage?{include_usage:!0}:void 0},{responseHeaders:U,value:z}=await b({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:T(this.config.headers(),Q.headers),body:$,failedResponseHandler:this.failedResponseHandler,successfulResponseHandler:i(this.chunkSchema),abortSignal:Q.abortSignal,fetch:this.config.fetch}),j={unified:"other",raw:void 0},K=void 0,W=!0;return{stream:z.pipeThrough(new TransformStream({start(X){X.enqueue({type:"stream-start",warnings:Z})},transform(X,J){var B;if(Q.includeRawChunks)J.enqueue({type:"raw",rawValue:X.rawValue});if(!X.success){j={unified:"error",raw:void 0},J.enqueue({type:"error",error:X.error});return}let L=X.value;if("error"in L){j={unified:"error",raw:void 0},J.enqueue({type:"error",error:L.error});return}if(W)W=!1,J.enqueue({type:"response-metadata",...LG(L)}),J.enqueue({type:"text-start",id:"0"});if(L.usage!=null)K=L.usage;let N=L.choices[0];if((N==null?void 0:N.finish_reason)!=null)j={unified:zG(N.finish_reason),raw:(B=N.finish_reason)!=null?B:void 0};if((N==null?void 0:N.text)!=null)J.enqueue({type:"text-delta",id:"0",delta:N.text})},flush(X){if(!W)X.enqueue({type:"text-end",id:"0"});X.enqueue({type:"finish",finishReason:j,usage:jG(K)})}})),request:{body:$},response:{headers:U}}}},NG=G.object({prompt_tokens:G.number(),completion_tokens:G.number(),total_tokens:G.number()}),FG=G.object({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({text:G.string(),finish_reason:G.string()})),usage:NG.nullish()}),MG=(Q)=>G.union([G.object({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({text:G.string(),finish_reason:G.string().nullish(),index:G.number()})),usage:NG.nullish()}),Q]),p=G.object({dimensions:G.number().optional(),user:G.string().optional()}),sG=class{constructor(Q,Y){this.specificationVersion="v3",this.modelId=Q,this.config=Y}get provider(){return this.config.provider}get maxEmbeddingsPerCall(){var Q;return(Q=this.config.maxEmbeddingsPerCall)!=null?Q:2048}get supportsParallelCalls(){var Q;return(Q=this.config.supportsParallelCalls)!=null?Q:!0}get providerOptionsName(){return this.config.provider.split(".")[0].trim()}async doEmbed({values:Q,headers:Y,abortSignal:Z,providerOptions:$}){var U,z,j;let K=[],W=await R({provider:"openai-compatible",providerOptions:$,schema:p});if(W!=null)K.push({type:"other",message:"The 'openai-compatible' key in providerOptions is deprecated. Use 'openaiCompatible' instead."});let X=Object.assign(W!=null?W:{},(U=await R({provider:"openaiCompatible",providerOptions:$,schema:p}))!=null?U:{},(z=await R({provider:this.providerOptionsName,providerOptions:$,schema:p}))!=null?z:{});if(Q.length>this.maxEmbeddingsPerCall)throw new BG({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:Q});let{responseHeaders:J,value:B,rawValue:L}=await b({url:this.config.url({path:"/embeddings",modelId:this.modelId}),headers:T(this.config.headers(),Y),body:{model:this.modelId,input:Q,encoding_format:"float",dimensions:X.dimensions,user:X.user},failedResponseHandler:f((j=this.config.errorStructure)!=null?j:n),successfulResponseHandler:v(SG),abortSignal:Z,fetch:this.config.fetch});return{warnings:K,embeddings:B.data.map((N)=>N.embedding),usage:B.usage?{tokens:B.usage.prompt_tokens}:void 0,providerMetadata:B.providerMetadata,response:{headers:J,body:L}}}},SG=G.object({data:G.array(G.object({embedding:G.array(G.number())})),usage:G.object({prompt_tokens:G.number()}).nullish(),providerMetadata:G.record(G.string(),G.record(G.string(),G.any())).optional()});var nG=G.object({data:G.array(G.object({b64_json:G.string()}))});
13
- export{CG as Ce,mG as De,sG as Ee};
13
+ export{CG as De,mG as Ee,sG as Fe};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Ik as e}from"./chunk-njzpswgt.js";import{Il as r}from"./chunk-ygwe0vf1.js";import{vu as o}from"./chunk-48j09m6e.js";var s=o.object({id:e.zod,type:o.string(),name:o.string(),branch:o.string().nullable(),directory:o.string().nullable(),extra:o.unknown().nullable(),projectID:r.zod});
3
- export{s as Kg};
2
+ import{fl as e}from"./chunk-gsvdt4kq.js";import{fm as r}from"./chunk-90zd5rss.js";import{Uu as o}from"./chunk-k309zez0.js";var s=o.object({id:e.zod,type:o.string(),name:o.string(),branch:o.string().nullable(),directory:o.string().nullable(),extra:o.unknown().nullable(),projectID:r.zod});
3
+ export{s as Lg};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{BP as B}from"./chunk-qkwhgfjt.js";import{DP as z,GP as A}from"./chunk-s2za1y84.js";var F=z((k)=>{Object.defineProperty(k,"__esModule",{value:!0});k.getMachineId=void 0;var C=A("fs"),D=B();async function E(){let v=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let w of v)try{return(await C.promises.readFile(w,{encoding:"utf8"})).trim()}catch(b){D.diag.debug(`error reading machine id: ${b}`)}return}k.getMachineId=E});export default F();
2
+ import{_P as B}from"./chunk-qjjch1zt.js";import{aQ as z,dQ as A}from"./chunk-aztre27e.js";var F=z((k)=>{Object.defineProperty(k,"__esModule",{value:!0});k.getMachineId=void 0;var C=A("fs"),D=B();async function E(){let v=["/etc/machine-id","/var/lib/dbus/machine-id"];for(let w of v)try{return(await C.promises.readFile(w,{encoding:"utf8"})).trim()}catch(b){D.diag.debug(`error reading machine id: ${b}`)}return}k.getMachineId=E});export default F();
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ed as T,Gd as q,Hd as N,Id as w,Jd as X,Md as D}from"./chunk-y2ch07yv.js";import"./chunk-kkdgzeva.js";import{Uf as Q}from"./chunk-0ndvy0nh.js";import{uh as A}from"./chunk-kbjwdv1x.js";import"./chunk-ek1fawsj.js";import"./chunk-3w64fpwn.js";import"./chunk-pfn1db1m.js";import"./chunk-h56jxxvj.js";import"./chunk-x36jhtex.js";import"./chunk-fk8cctjy.js";import"./chunk-fxb6vjcb.js";import"./chunk-njzpswgt.js";import{gl as $}from"./chunk-2cm91ktc.js";import"./chunk-ygwe0vf1.js";import"./chunk-1qbm1k9y.js";import"./chunk-3rgct4bd.js";import"./chunk-atbm0pnt.js";import"./chunk-s86fj82v.js";import"./chunk-58gp7wbg.js";import"./chunk-w4hbw37v.js";import"./chunk-qmhcbdkg.js";import"./chunk-7qxn24qa.js";import"./chunk-vx837ete.js";import"./chunk-ppvmy940.js";import"./chunk-1n4w8dya.js";import"./chunk-7ryv0f5h.js";import"./chunk-p31yg62z.js";import"./chunk-5mec6cde.js";import"./chunk-cqtkxwd8.js";import"./chunk-0mekr486.js";import"./chunk-x3931we7.js";import"./chunk-w01gjnty.js";import"./chunk-nxjbbq5h.js";import"./chunk-z559gc3n.js";import"./chunk-kbyk7hyn.js";import"./chunk-6h2faxs9.js";import"./chunk-4nck07pc.js";import"./chunk-d2n09yvh.js";import"./chunk-f3c9667r.js";import"./chunk-qpv4438m.js";import"./chunk-hybq019j.js";import"./chunk-z2q3mg73.js";import"./chunk-n07rsssz.js";import{Rt as W}from"./chunk-08y06vgt.js";import{iu as _,tu as Y}from"./chunk-9p83me3p.js";import"./chunk-9wm41z2f.js";import"./chunk-48j09m6e.js";import"./chunk-se195e52.js";import"./chunk-vw673y0t.js";import"./chunk-tedrfa7d.js";import"./chunk-ynfbz3sz.js";import"./chunk-rs0nx844.js";import"./chunk-qkwhgfjt.js";import"./chunk-s2za1y84.js";import V from"fs/promises";import L from"path";import R from"os";var g={command:"uninstall",describe:"uninstall qitqode and remove all related files",builder:(j)=>j.option("keep-config",{alias:"c",type:"boolean",describe:"keep configuration files",default:!1}).option("keep-data",{alias:"d",type:"boolean",describe:"keep session data and snapshots",default:!1}).option("dry-run",{type:"boolean",describe:"show what would be removed without removing",default:!1}).option("force",{alias:"f",type:"boolean",describe:"skip confirmation prompts",default:!1}),handler:async(j)=>{Q.empty(),Q.println(Q.logo(" ")),Q.empty(),w("Uninstall QitQode");let B=await A.runPromise($.Service.use((J)=>J.method()));N.info(`Installation method: ${B}`);let E=await v(j,B);if(await z(E,B),!j.force&&!j.dryRun){let J=await q({message:"Are you sure you want to uninstall?",initialValue:!1});if(!J||T(J)){X("Cancelled");return}}if(j.dryRun){N.warn("Dry run - no changes made"),X("Done");return}await G(B,E),X("Done")}};async function v(j,B){let E=[{path:W.Path.data,label:"Data",keep:j.keepData},{path:W.Path.cache,label:"Cache",keep:!1},{path:W.Path.config,label:"Config",keep:j.keepConfig},{path:W.Path.state,label:"State",keep:!1}],J=B==="curl"?await P():null,H=B==="curl"?process.execPath:null;return{directories:E,shellConfig:J,binary:H}}async function z(j,B){N.message("The following will be removed:");for(let E of j.directories){if(!await V.access(E.path).then(()=>!0).catch(()=>!1))continue;let H=await F(E.path),K=S(H),O=E.keep?Q.Style.TEXT_DIM+"(keeping)":"",M=E.keep?"\u25CB":"\u2713";N.info(` ${M} ${E.label}: ${Z(E.path)} ${Q.Style.TEXT_DIM}(${K})${O}`)}if(j.binary)N.info(` \u2713 Binary: ${Z(j.binary)}`);if(j.shellConfig)N.info(` \u2713 Shell PATH in ${Z(j.shellConfig)}`);if(B!=="curl"&&B!=="unknown"){let E={npm:"npm uninstall -g @qitqode/cli",pnpm:"pnpm uninstall -g @qitqode/cli",bun:"bun remove -g @qitqode/cli"};N.info(` \u2713 Package: ${E[B]||B}`)}}async function G(j,B){let E=D(),J=[];for(let H of B.directories){if(H.keep){N.step(`Skipping ${H.label} (--keep-${H.label.toLowerCase()})`);continue}if(!await V.access(H.path).then(()=>!0).catch(()=>!1))continue;E.start(`Removing ${H.label}...`);let O=await V.rm(H.path,{recursive:!0,force:!0}).catch((M)=>M);if(O){E.stop(`Failed to remove ${H.label}`,1),J.push(`${H.label}: ${O.message}`);continue}E.stop(`Removed ${H.label}`)}if(B.shellConfig){E.start("Cleaning shell config...");let H=await k(B.shellConfig).catch((K)=>K);if(H)E.stop("Failed to clean shell config",1),J.push(`Shell config: ${H.message}`);else E.stop("Cleaned shell config")}if(j!=="curl"&&j!=="unknown"){let K={npm:["npm","uninstall","-g","@qitqode/cli"],pnpm:["pnpm","uninstall","-g","@qitqode/cli"],bun:["bun","remove","-g","@qitqode/cli"]}[j];if(K){E.start(`Running ${K.join(" ")}...`);let O=await _.run(K,{nothrow:!0});if(O.code!==0)E.stop(`Package manager uninstall failed: exit code ${O.code}`,1),N.warn(`You may need to run manually: ${K.join(" ")}`);else E.stop("Package removed")}else N.warn(`Uninstall not supported for method "${j}" yet, skipping package removal`)}if(j==="curl"&&B.binary){Q.empty(),N.message("To finish removing the binary, run:"),N.info(` rm "${B.binary}"`);let H=L.dirname(B.binary);if(H.includes(".qitqode"))N.info(` rmdir "${H}" 2>/dev/null`)}if(J.length>0){Q.empty(),N.warn("Some operations failed:");for(let H of J)N.error(` ${H}`)}Q.empty(),N.success("Thank you for using QitQode!")}async function P(){let j=L.basename(process.env.SHELL||"bash"),B=R.homedir(),E=process.env.XDG_CONFIG_HOME||L.join(B,".config"),J={fish:[L.join(E,"fish","config.fish")],zsh:[L.join(B,".zshrc"),L.join(B,".zshenv"),L.join(E,"zsh",".zshrc"),L.join(E,"zsh",".zshenv")],bash:[L.join(B,".bashrc"),L.join(B,".bash_profile"),L.join(B,".profile"),L.join(E,"bash",".bashrc"),L.join(E,"bash",".bash_profile")],ash:[L.join(B,".ashrc"),L.join(B,".profile")],sh:[L.join(B,".profile")]},H=J[j]||J.bash;for(let K of H){if(!await V.access(K).then(()=>!0).catch(()=>!1))continue;let M=await Y.readText(K).catch(()=>"");if(M.includes("# qitqode")||M.includes(".qitqode/bin"))return K}return null}async function k(j){let E=(await Y.readText(j)).split(`
2
+ import{Fd as T,Hd as q,Id as N,Jd as w,Kd as X,Nd as D}from"./chunk-jje0srjq.js";import"./chunk-27yxgy03.js";import{Vf as Q}from"./chunk-7ppd2phw.js";import{hh as A}from"./chunk-wrw22v0a.js";import"./chunk-h7yya9pv.js";import"./chunk-p68rwmhc.js";import"./chunk-0a0vat1h.js";import"./chunk-z8v2tsz2.js";import"./chunk-j8efst22.js";import"./chunk-a1pw9r6f.js";import"./chunk-d5bxan80.js";import"./chunk-gsvdt4kq.js";import{Fl as $}from"./chunk-b7mg883n.js";import"./chunk-90zd5rss.js";import"./chunk-17psxhve.js";import"./chunk-nj4d554m.js";import"./chunk-m2x9xhha.js";import"./chunk-2wcv3sq5.js";import"./chunk-a1p2f16h.js";import"./chunk-nt4e3em9.js";import"./chunk-ak5ngp50.js";import"./chunk-v965rsr8.js";import"./chunk-1sgby720.js";import"./chunk-jg7s9rqz.js";import"./chunk-4tbwha3m.js";import"./chunk-m612agnk.js";import"./chunk-yq3m8190.js";import"./chunk-btz9jvec.js";import"./chunk-cqtkxwd8.js";import"./chunk-fkgv2hqd.js";import"./chunk-zyhdxggp.js";import"./chunk-q6ztpfcs.js";import"./chunk-jm1ptn8n.js";import"./chunk-c5e6sk9c.js";import"./chunk-m02zt1a3.js";import"./chunk-vg2fmyje.js";import"./chunk-c0796v8j.js";import"./chunk-njnwdgvd.js";import"./chunk-4qqkqrn9.js";import"./chunk-j6emx6jn.js";import"./chunk-be216spx.js";import"./chunk-12bssxd4.js";import"./chunk-k9b1jcqw.js";import{ou as W}from"./chunk-zxaaxb99.js";import{Hu as _,Su as Y}from"./chunk-whxjkz9a.js";import"./chunk-89v6dgpp.js";import"./chunk-k309zez0.js";import"./chunk-09kba1hg.js";import"./chunk-t12xrrfr.js";import"./chunk-phxrg7aw.js";import"./chunk-snm5q21k.js";import"./chunk-xpc2zgj7.js";import"./chunk-qjjch1zt.js";import"./chunk-aztre27e.js";import V from"fs/promises";import L from"path";import R from"os";var g={command:"uninstall",describe:"uninstall qitqode and remove all related files",builder:(j)=>j.option("keep-config",{alias:"c",type:"boolean",describe:"keep configuration files",default:!1}).option("keep-data",{alias:"d",type:"boolean",describe:"keep session data and snapshots",default:!1}).option("dry-run",{type:"boolean",describe:"show what would be removed without removing",default:!1}).option("force",{alias:"f",type:"boolean",describe:"skip confirmation prompts",default:!1}),handler:async(j)=>{Q.empty(),Q.println(Q.logo(" ")),Q.empty(),w("Uninstall QitQode");let B=await A.runPromise($.Service.use((J)=>J.method()));N.info(`Installation method: ${B}`);let E=await v(j,B);if(await z(E,B),!j.force&&!j.dryRun){let J=await q({message:"Are you sure you want to uninstall?",initialValue:!1});if(!J||T(J)){X("Cancelled");return}}if(j.dryRun){N.warn("Dry run - no changes made"),X("Done");return}await G(B,E),X("Done")}};async function v(j,B){let E=[{path:W.Path.data,label:"Data",keep:j.keepData},{path:W.Path.cache,label:"Cache",keep:!1},{path:W.Path.config,label:"Config",keep:j.keepConfig},{path:W.Path.state,label:"State",keep:!1}],J=B==="curl"?await P():null,H=B==="curl"?process.execPath:null;return{directories:E,shellConfig:J,binary:H}}async function z(j,B){N.message("The following will be removed:");for(let E of j.directories){if(!await V.access(E.path).then(()=>!0).catch(()=>!1))continue;let H=await F(E.path),K=S(H),O=E.keep?Q.Style.TEXT_DIM+"(keeping)":"",M=E.keep?"\u25CB":"\u2713";N.info(` ${M} ${E.label}: ${Z(E.path)} ${Q.Style.TEXT_DIM}(${K})${O}`)}if(j.binary)N.info(` \u2713 Binary: ${Z(j.binary)}`);if(j.shellConfig)N.info(` \u2713 Shell PATH in ${Z(j.shellConfig)}`);if(B!=="curl"&&B!=="unknown"){let E={npm:"npm uninstall -g @qitqode/cli",pnpm:"pnpm uninstall -g @qitqode/cli",bun:"bun remove -g @qitqode/cli"};N.info(` \u2713 Package: ${E[B]||B}`)}}async function G(j,B){let E=D(),J=[];for(let H of B.directories){if(H.keep){N.step(`Skipping ${H.label} (--keep-${H.label.toLowerCase()})`);continue}if(!await V.access(H.path).then(()=>!0).catch(()=>!1))continue;E.start(`Removing ${H.label}...`);let O=await V.rm(H.path,{recursive:!0,force:!0}).catch((M)=>M);if(O){E.stop(`Failed to remove ${H.label}`,1),J.push(`${H.label}: ${O.message}`);continue}E.stop(`Removed ${H.label}`)}if(B.shellConfig){E.start("Cleaning shell config...");let H=await k(B.shellConfig).catch((K)=>K);if(H)E.stop("Failed to clean shell config",1),J.push(`Shell config: ${H.message}`);else E.stop("Cleaned shell config")}if(j!=="curl"&&j!=="unknown"){let K={npm:["npm","uninstall","-g","@qitqode/cli"],pnpm:["pnpm","uninstall","-g","@qitqode/cli"],bun:["bun","remove","-g","@qitqode/cli"]}[j];if(K){E.start(`Running ${K.join(" ")}...`);let O=await _.run(K,{nothrow:!0});if(O.code!==0)E.stop(`Package manager uninstall failed: exit code ${O.code}`,1),N.warn(`You may need to run manually: ${K.join(" ")}`);else E.stop("Package removed")}else N.warn(`Uninstall not supported for method "${j}" yet, skipping package removal`)}if(j==="curl"&&B.binary){Q.empty(),N.message("To finish removing the binary, run:"),N.info(` rm "${B.binary}"`);let H=L.dirname(B.binary);if(H.includes(".qitqode"))N.info(` rmdir "${H}" 2>/dev/null`)}if(J.length>0){Q.empty(),N.warn("Some operations failed:");for(let H of J)N.error(` ${H}`)}Q.empty(),N.success("Thank you for using QitQode!")}async function P(){let j=L.basename(process.env.SHELL||"bash"),B=R.homedir(),E=process.env.XDG_CONFIG_HOME||L.join(B,".config"),J={fish:[L.join(E,"fish","config.fish")],zsh:[L.join(B,".zshrc"),L.join(B,".zshenv"),L.join(E,"zsh",".zshrc"),L.join(E,"zsh",".zshenv")],bash:[L.join(B,".bashrc"),L.join(B,".bash_profile"),L.join(B,".profile"),L.join(E,"bash",".bashrc"),L.join(E,"bash",".bash_profile")],ash:[L.join(B,".ashrc"),L.join(B,".profile")],sh:[L.join(B,".profile")]},H=J[j]||J.bash;for(let K of H){if(!await V.access(K).then(()=>!0).catch(()=>!1))continue;let M=await Y.readText(K).catch(()=>"");if(M.includes("# qitqode")||M.includes(".qitqode/bin"))return K}return null}async function k(j){let E=(await Y.readText(j)).split(`
3
3
  `),J=[],H=!1;for(let O of E){let M=O.trim();if(M==="# qitqode"){H=!0;continue}if(H){if(H=!1,M.includes(".qitqode/bin")||M.includes("fish_add_path"))continue}if(M.startsWith("export PATH=")&&M.includes(".qitqode/bin")||M.startsWith("fish_add_path")&&M.includes(".qitqode"))continue;J.push(O)}while(J.length>0&&J[J.length-1].trim()==="")J.pop();let K=J.join(`
4
4
  `)+`
5
5
  `;await Y.write(j,K)}async function F(j){let B=0,E=async(J)=>{let H=await V.readdir(J,{withFileTypes:!0}).catch(()=>[]);for(let K of H){let O=L.join(J,K.name);if(K.isDirectory()){await E(O);continue}if(K.isFile()){let M=await V.stat(O).catch(()=>null);if(M)B+=M.size}}};return await E(j),B}function S(j){if(j<1024)return`${j} B`;if(j<1048576)return`${(j/1024).toFixed(1)} KB`;if(j<1073741824)return`${(j/1048576).toFixed(1)} MB`;return`${(j/1073741824).toFixed(1)} GB`}function Z(j){let B=R.homedir();if(j===B||j.startsWith(B+L.sep))return"~"+j.slice(B.length);return j}export{g as UninstallCommand};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{rm as f,sm as Gj,tm as Rj,um as Hj,xm as s}from"./chunk-17psxhve.js";import{Fp as xj}from"./chunk-a1p2f16h.js";import{aq as vj}from"./chunk-1sgby720.js";import{Bs as P,Cs as wj,Is as k,Js as Kj}from"./chunk-4qqkqrn9.js";import{ku as Ij,lu as Jj,ou as Nj,pu as I,tt as a,ut as y,yu as h}from"./chunk-zxaaxb99.js";import{Su as i}from"./chunk-whxjkz9a.js";import{Uu as j}from"./chunk-k309zez0.js";import{HG as d,PI as Q,ZD as Wj,mG as o,oP as l,pO as C}from"./chunk-snm5q21k.js";import{$P as Mj,bQ as Oj,dQ as Ej}from"./chunk-aztre27e.js";var tj={};Oj(tj,{stopRefresh:()=>aj,startRefresh:()=>sj,refresh:()=>jj,readModelCatalogResponse:()=>Pj,get:()=>fj,Provider:()=>cj,Model:()=>pj,MODEL_CATALOG_MAX_BYTES:()=>Aj,Data:()=>S});import hj from"path";var U={};Oj(U,{layer:()=>Bj,isPreview:()=>ij,isNewerVersion:()=>qj,isLocal:()=>mj,getReleaseType:()=>yj,defaultLayer:()=>uj,UpgradeFailedError:()=>x,USER_AGENT:()=>Sj,Service:()=>E,Installation:()=>U,Info:()=>Uj,Event:()=>Cj});var _j=(J)=>J.pipe(k.retryTransient({retryOn:"errors-and-responses",times:2,schedule:d.exponential(200).pipe(d.jittered)}));import Yj from"path";var z=Mj(xj(),1);import n from"crypto";import v from"fs";import Zj from"path";class H extends Error{constructor(J){super(J);this.name="SelfUpdateError"}}function $j(J){let V=J?.platform??process.platform,_=J?.arch??process.arch,$=J?.libc??"bionic",W=["qitqode",V==="win32"?"windows":V,_];if(_==="x64")W.push("baseline");if(V==="linux"&&$==="musl")W.push("musl");return`@qitqode/${W.join("-")}`}function kj(J,V){if(V.integrity){let _=V.integrity.match(/^(sha512|sha384|sha256)-([A-Za-z0-9+/=]+)$/);if(!_)throw new H(`registry returned an unrecognized integrity string: ${V.integrity}`);if(n.createHash(_[1]).update(J).digest("base64")!==_[2])throw new H(`checksum mismatch: downloaded tarball does not match the registry ${_[1]} integrity value; refusing to install`);return}if(V.shasum){if(n.createHash("sha1").update(J).digest("hex")!==V.shasum.toLowerCase())throw new H("checksum mismatch: downloaded tarball does not match the registry shasum; refusing to install");return}throw new H("registry provided no integrity metadata for the tarball; refusing to install")}function Qj(J,V){let _=(w,R)=>{let G=w,q=w+R;while(G<q&&J[G]!==0)G++;return new TextDecoder().decode(J.subarray(w,G))},$=0,W;while($+512<=J.length){if(J.subarray($,$+512).every((Z)=>Z===0))break;let R=_($+124,12).trim(),G=R?parseInt(R,8):0;if(!Number.isFinite(G)||G<0)throw new H("downloaded tarball is corrupt (bad tar header)");let q=String.fromCharCode(J[$+156]),B=_($,100),N=_($+345,155);if(N)B=`${N}/${B}`;if(W)B=W,W=void 0;let b=$+512,X=b+G;if(q==="L")W=new TextDecoder().decode(J.subarray(b,X)).replace(/\0+$/,"");else if((q==="0"||q==="\x00"||q==="")&&B===V)return J.slice(b,X);$=b+Math.ceil(G/512)*512}return}var A=(J)=>String(J instanceof Error?J.message:J),u=(J)=>Q.fail(new H(J)),p=(J,V)=>Q.try({try:J,catch:(_)=>new H(V(_))}),Xj=Q.fnUntraced(function*(J){let{target:V,execPath:_,packageName:$,registry:W}=J,w=J.gunzip??((K)=>Bun.gunzipSync(K)),R=Zj.dirname(_);yield*p(()=>v.accessSync(R,v.constants.W_OK),()=>`no write permission for ${R}; cannot replace ${_}. Fix the directory permissions or re-run with sufficient privileges.`);let G=`${W}/${$}/${encodeURIComponent(V)}`,B=(yield*J.fetchJson(G).pipe(Q.mapError((K)=>new H(`download failed: could not fetch ${$}@${V} from ${W} (${A(K)}). Check your network connection and that version ${V} exists.`))))?.dist;if(!B?.tarball)return yield*u(`registry response for ${$}@${V} has no tarball URL; cannot self-update`);let N=B.tarball,b=yield*J.fetchBytes(N).pipe(Q.mapError((K)=>new H(`download failed: could not download ${N} (${A(K)}). Check your network connection and try again.`)));yield*Q.try({try:()=>kj(b,B),catch:(K)=>K instanceof H?K:new H(A(K))});let X=yield*Q.try({try:()=>w(b),catch:()=>new H("downloaded tarball is corrupt (gunzip failed); try again")}),Z=Qj(X,"package/bin/qitqode")??Qj(X,"package/bin/qitqode.exe");if(!Z||Z.length===0)return yield*u(`tarball for ${$}@${V} does not contain the expected binary at bin/qitqode`);let O=Zj.join(R,`.qitqode-upgrade-${process.pid}`),Y=`${_}.backup-${process.pid}`,D=(K)=>{try{v.rmSync(K,{force:!0})}catch{}};yield*p(()=>v.writeFileSync(O,Z,{mode:493}),(K)=>{return D(O),`no write permission: could not write ${O} (${A(K)})`});let L=yield*J.runVersion(O).pipe(Q.mapError((K)=>{return D(O),new H(`downloaded binary failed its --version check (${A(K)}); keeping the current installation`)}));if(L.code!==0)return D(O),yield*u(`downloaded binary failed its --version check (exit ${L.code}); keeping the current installation`);let m=L.stdout.trim();if(m&&!m.includes(V))return D(O),yield*u(`downloaded binary reports version "${m}" instead of ${V}; keeping the current installation`);yield*p(()=>v.renameSync(_,Y),(K)=>{return D(O),`could not move the current binary aside (${A(K)}); check permissions on ${_}`}),yield*Q.try({try:()=>v.renameSync(O,_),catch:(K)=>{try{v.renameSync(Y,_)}catch{return new H(`failed to install the new binary AND failed to restore the old one; your previous binary is preserved at ${Y} \u2014 move it back to ${_} manually`)}return D(O),new H(`could not install the new binary (${A(K)}); the previous version was restored`)}}),D(Y)});var c=h.create({service:"installation"}),M="@qitqode/cli";function qj(J,V){if(!z.default.valid(J)||!z.default.valid(V))return!1;return z.default.gt(V,J)}var Cj={Updated:s.define("installation.updated",j.object({version:j.string()})),UpdateAvailable:s.define("installation.update-available",j.object({version:j.string()}))};function yj(J,V){if(!qj(J,V))throw Error(`Version ${V} is not newer than ${J}`);let _=z.default.major(J),$=z.default.minor(J),W=z.default.major(V),w=z.default.minor(V);if(W>_)return"major";if(w>$)return"minor";return"patch"}var Uj=j.object({version:j.string(),latest:j.string()}).meta({ref:"InstallationInfo"}),Sj=`qitqode/${y}/${a}/${I.QITQODE_CLIENT}`;function ij(){return y!=="latest"}function mj(){return y==="local"}class x extends C.TaggedErrorClass()("UpgradeFailedError",{stderr:C.String}){}var nj=C.Struct({version:C.String});class E extends Wj.Service()("@qitqode/Installation"){}var Bj=o.effect(E,Q.gen(function*(){let J=yield*k.HttpClient,V=k.filterStatusOk(_j(J)),_=yield*f.ChildProcessSpawner,$=(X,Z)=>Gj.make(X[0],X.slice(1),{cwd:Z?.cwd,env:Z?.env,extendEnv:!0}),W=Q.fnUntraced(function*(X){let Z=yield*Hj(_,X);return{code:Z.code,stdout:Z.text,stderr:Z.stderr}},Q.scoped),w=Q.fnUntraced(function*(X,Z){let O=yield*_.spawn($(X,Z)),Y=yield*l.mkString(l.decodeText(O.stdout));return yield*O.exitCode,Y},Q.scoped,Q.catch(()=>Q.succeed(""))),R=Q.fnUntraced(function*(X,Z){return yield*W($(X,Z))},Q.catch(()=>Q.succeed({code:f.ExitCode(1),stdout:"",stderr:""}))),G=Q.fn("Installation.method")(function*(){if(process.execPath.includes(Yj.join(".qitqode","bin")))return"curl";if(process.execPath.includes(Yj.join(".local","bin")))return"curl";let X=process.execPath.toLowerCase(),Z=[{name:"npm",command:()=>w(["npm","list","-g","--depth=0"])},{name:"pnpm",command:()=>w(["pnpm","list","-g","--depth=0"])},{name:"bun",command:()=>w(["bun","pm","ls","-g"])}];Z.sort((O,Y)=>{let D=X.includes(O.name),L=X.includes(Y.name);if(D&&!L)return-1;if(!D&&L)return 1;return 0});for(let O of Z)if((yield*O.command()).includes(M))return O.name;return"unknown"}),q=Q.fn("Installation.latest")(function*(X){let Z=X||(yield*G());if(Z==="curl"){let Y=(yield*w(["curl","-sI","https://github.com/qitqode/qitqode/releases/latest"])).match(/^location:.*\/tag\/v([0-9][^\s/]*)/im);if(Y)return Y[1];return yield*Q.die(Error("failed to resolve latest version from GitHub releases redirect"))}if(Z==="npm"||Z==="bun"||Z==="pnpm"){let Y=(yield*w(["npm","config","get","registry"])).trim()||"https://registry.npmjs.org",D=Y.endsWith("/")?Y.slice(0,-1):Y,L=yield*V.execute(P.get(`${D}/${encodeURIComponent(M)}/${y}`).pipe(P.acceptJson));return(yield*wj.schemaBodyJson(nj)(L)).version}return c.warn("unsupported update channel, skipping",{method:Z}),yield*Q.die(Error(`unsupported update channel: ${Z}`))},Q.orDie),B=Q.fnUntraced(function*(){let Z=(yield*w(["npm","config","get","registry"])).trim()||"https://registry.npmjs.org";return Z.endsWith("/")?Z.slice(0,-1):Z}),N=Q.fnUntraced(function*(X){let Z=yield*B();yield*Xj({target:X,execPath:process.env.QITQODE_SELF_UPDATE_TARGET_BINARY||process.execPath,packageName:$j(),registry:Z,fetchJson:(O)=>V.execute(P.get(O).pipe(P.acceptJson)).pipe(Q.flatMap((Y)=>Y.json)),fetchBytes:(O)=>V.execute(P.get(O)).pipe(Q.flatMap((Y)=>Y.arrayBuffer),Q.map((Y)=>new Uint8Array(Y))),runVersion:(O)=>R([O,"--version"]).pipe(Q.map((Y)=>({code:Y.code,stdout:Y.stdout})))}).pipe(Q.mapError((O)=>new x({stderr:O.message})))}),b=Q.fn("Installation.upgrade")(function*(X,Z){if(X==="curl"){yield*N(Z),c.info("upgraded",{method:X,target:Z});return}let Y=yield*(()=>{if(X==="npm")return R(["npm","install","-g",`${M}@${Z}`]);if(X==="pnpm")return R(["pnpm","install","-g",`${M}@${Z}`]);if(X==="bun")return R(["bun","install","-g",`${M}@${Z}`]);return new x({stderr:`Unknown method: ${X}`})})();if(Y.code!==0){let D=Y.stderr||"";return yield*new x({stderr:D})}c.info("upgraded",{method:X,target:Z,stdout:Y.stdout,stderr:Y.stderr}),yield*w([process.execPath,"--version"])});return E.of({info:Q.fn("Installation.info")(function*(){return{version:a,latest:yield*q()}}),method:G,latest:q,upgrade:b})})),uj=Bj.pipe(o.provide(Kj.layer),o.provide(Rj));var t=j.lazy(()=>j.union([j.string(),j.number(),j.boolean(),j.null(),j.array(t),j.record(j.string(),t)])),Dj=j.object({input:j.number(),output:j.number(),cache_read:j.number().optional(),cache_write:j.number().optional(),context_over_200k:j.object({input:j.number(),output:j.number(),cache_read:j.number().optional(),cache_write:j.number().optional()}).optional()}),r=j.object({id:j.string(),name:j.string(),family:j.string().optional(),release_date:j.string(),attachment:j.boolean(),reasoning:j.boolean(),temperature:j.boolean().optional(),tool_call:j.boolean(),interleaved:j.union([j.literal(!0),j.object({field:j.enum(["reasoning_content","reasoning_details"])}).strict()]).optional(),cost:Dj.optional(),limit:j.object({context:j.number(),input:j.number().optional(),output:j.number()}),modalities:j.object({input:j.array(j.enum(["text","audio","image","video","pdf"])),output:j.array(j.enum(["text","audio","image","video","pdf"]))}).optional(),experimental:j.object({modes:j.record(j.string(),j.object({cost:Dj.optional(),provider:j.object({body:j.record(j.string(),t).optional(),headers:j.record(j.string(),j.string()).optional()}).optional()})).optional()}).optional(),status:j.enum(["alpha","beta","deprecated"]).optional(),provider:j.object({npm:j.string().optional(),api:j.string().optional()}).optional()}),e=j.object({api:j.string().optional(),name:j.string(),env:j.array(j.string()),id:j.string(),npm:j.string().optional(),models:j.record(j.string(),r)});var Vj=h.create({service:"models.dev"}),bj=Fj(),F=hj.join(Nj.Path.cache,bj==="https://models.dev"?"models.json":`models-${Ij.fast(bj)}.json`),gj=300000,Aj=8388608,T,dj=j.record(j.string(),e),pj=r,cj=e;function Fj(){return I.QITQODE_MODELS_URL||"https://models.dev"}function lj(){return Date.now()-Number(i.stat(F)?.mtimeMs??0)<gj}function Lj(J){return!J&&lj()}function g(J){let V=dj.parse(typeof J==="string"?JSON.parse(J):J);for(let[_,$]of Object.entries(V))if($.id!==_)throw Error(`Invalid model provider: ${_}`);return V}async function zj(J){let V=await i.readJson(J).catch(()=>{return});if(!V)return;try{return g(V)}catch(_){Vj.warn("Ignoring invalid model catalog cache",{file:J,error:_});return}}async function Pj(J,V,_=Aj){let $=J.headers.get("content-type")?.split(";")[0]?.trim().toLowerCase();if($!=="application/json"&&!$?.endsWith("+json"))throw Error(`Invalid model catalog content type: ${$||"missing"}`);let W=Number(J.headers.get("content-length"));if(Number.isFinite(W)&&W>_)throw Error("Model catalog response is too large");if(!J.body)return"";let w=J.body.getReader(),R=()=>void w.cancel(V.reason);V.addEventListener("abort",R,{once:!0});let G=new Uint8Array(_),q=0;try{for(;;){let B=await w.read();if(B.done)break;if(q+=B.value.byteLength,q>_)throw await w.cancel(),Error("Model catalog response is too large");G.set(B.value,q-B.value.byteLength)}}finally{V.removeEventListener("abort",R)}return new TextDecoder().decode(G.subarray(0,q))}var Tj=async()=>{let J=AbortSignal.timeout(1e4),V=await fetch(`${Fj()}/api.json`,{headers:{"User-Agent":U.USER_AGENT},signal:J});if(!V.ok)return;let _=g(await Pj(V,J));return JSON.stringify(_)},S=vj(async()=>{let J=await zj(I.QITQODE_MODELS_PATH??F);if(J)return J;let V=await import("./chunk-1bhvt33f.js").then((_)=>g(_.snapshot)).catch(()=>{return});if(V)return V;if(I.QITQODE_DISABLE_MODELS_FETCH)return{};return Jj.withLock(`models-dev:${F}`,async()=>{let _=await zj(I.QITQODE_MODELS_PATH??F);if(_)return _;let $=await Tj();if($)return await i.write(F,$).catch((W)=>{Vj.error("Failed to write models cache",{error:W})}),g($);return{}})});async function fj(){return S()}async function jj(J=!1){if(Lj(J))return S.reset();await Jj.withLock(`models-dev:${F}`,async()=>{if(Lj(J))return S.reset();let V=await Tj();if(!V)return;await i.write(F,V),S.reset()}).catch((V)=>{Vj.error("Failed to fetch models.dev",{error:V})})}function sj(){if(T||I.QITQODE_DISABLE_MODELS_FETCH||process.argv.includes("--get-yargs-completions"))return;jj(),T=setInterval(async()=>{await jj()},3600000),T.unref()}function aj(){if(!T)return;clearInterval(T),T=void 0}
3
+ export{_j as El,U as Fl,Aj as Gl,pj as Hl,cj as Il,Pj as Jl,S as Kl,fj as Ll,jj as Ml,sj as Nl,aj as Ol,tj as Pl};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-s2za1y84.js";var{create:Zr,defineProperty:xt,getOwnPropertyDescriptor:Xr,getOwnPropertyNames:Yr,getPrototypeOf:es}=Object,ts=Object.prototype.hasOwnProperty,A=(e,s)=>()=>(s||e((s={exports:{}}).exports,s),s.exports),Xt=(e,s)=>{for(var n in s)xt(e,n,{get:s[n],enumerable:!0})},rs=(e,s,n,o)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of Yr(s))!ts.call(e,c)&&c!==n&&xt(e,c,{get:()=>s[c],enumerable:!(o=Xr(s,c))||o.enumerable});return e},xe=(e,s,n)=>(n=e!=null?Zr(es(e)):{},rs(s||!e||!e.__esModule?xt(n,"default",{value:e,enumerable:!0}):n,e)),ss=A((e,s)=>{var n=String,o=function(){return{isColorSupported:!1,reset:n,bold:n,dim:n,italic:n,underline:n,inverse:n,hidden:n,strikethrough:n,black:n,red:n,green:n,yellow:n,blue:n,magenta:n,cyan:n,white:n,gray:n,bgBlack:n,bgRed:n,bgGreen:n,bgYellow:n,bgBlue:n,bgMagenta:n,bgCyan:n,bgWhite:n,blackBright:n,redBright:n,greenBright:n,yellowBright:n,blueBright:n,magentaBright:n,cyanBright:n,whiteBright:n,bgBlackBright:n,bgRedBright:n,bgGreenBright:n,bgYellowBright:n,bgBlueBright:n,bgMagentaBright:n,bgCyanBright:n,bgWhiteBright:n}};s.exports=o(),s.exports.createColors=o}),Yt=A(()=>{}),kt=A((e,s)=>{var n=ss(),o=Yt(),c=class i extends Error{constructor(h,p,m,u,r,t){super(h),this.name="CssSyntaxError",this.reason=h,r&&(this.file=r),u&&(this.source=u),t&&(this.plugin=t),typeof p<"u"&&typeof m<"u"&&(typeof p=="number"?(this.line=p,this.column=m):(this.line=p.line,this.column=p.column,this.endLine=m.line,this.endColumn=m.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,i)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(h){if(!this.source)return"";let p=this.source;h==null&&(h=n.isColorSupported);let m=(l)=>l,u=(l)=>l,r=(l)=>l;if(h){let{bold:l,gray:w,red:y}=n.createColors(!0);u=(v)=>l(y(v)),m=(v)=>w(v),o&&(r=(v)=>o(v))}let t=p.split(/\r?\n/),f=Math.max(this.line-3,0),a=Math.min(this.line+2,t.length),d=String(a).length;return t.slice(f,a).map((l,w)=>{let y=f+1+w,v=" "+(" "+y).slice(-d)+" | ";if(y===this.line){if(l.length>160){let x=20,b=Math.max(0,this.column-x),T=Math.max(this.column+x,this.endColumn+x),O=l.slice(b,T),k=m(v.replace(/\d/g," "))+l.slice(0,Math.min(this.column-1,x-1)).replace(/[^\t]/g," ");return u(">")+m(v)+r(O)+`
2
+ import"./chunk-aztre27e.js";var{create:Zr,defineProperty:xt,getOwnPropertyDescriptor:Xr,getOwnPropertyNames:Yr,getPrototypeOf:es}=Object,ts=Object.prototype.hasOwnProperty,A=(e,s)=>()=>(s||e((s={exports:{}}).exports,s),s.exports),Xt=(e,s)=>{for(var n in s)xt(e,n,{get:s[n],enumerable:!0})},rs=(e,s,n,o)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of Yr(s))!ts.call(e,c)&&c!==n&&xt(e,c,{get:()=>s[c],enumerable:!(o=Xr(s,c))||o.enumerable});return e},xe=(e,s,n)=>(n=e!=null?Zr(es(e)):{},rs(s||!e||!e.__esModule?xt(n,"default",{value:e,enumerable:!0}):n,e)),ss=A((e,s)=>{var n=String,o=function(){return{isColorSupported:!1,reset:n,bold:n,dim:n,italic:n,underline:n,inverse:n,hidden:n,strikethrough:n,black:n,red:n,green:n,yellow:n,blue:n,magenta:n,cyan:n,white:n,gray:n,bgBlack:n,bgRed:n,bgGreen:n,bgYellow:n,bgBlue:n,bgMagenta:n,bgCyan:n,bgWhite:n,blackBright:n,redBright:n,greenBright:n,yellowBright:n,blueBright:n,magentaBright:n,cyanBright:n,whiteBright:n,bgBlackBright:n,bgRedBright:n,bgGreenBright:n,bgYellowBright:n,bgBlueBright:n,bgMagentaBright:n,bgCyanBright:n,bgWhiteBright:n}};s.exports=o(),s.exports.createColors=o}),Yt=A(()=>{}),kt=A((e,s)=>{var n=ss(),o=Yt(),c=class i extends Error{constructor(h,p,m,u,r,t){super(h),this.name="CssSyntaxError",this.reason=h,r&&(this.file=r),u&&(this.source=u),t&&(this.plugin=t),typeof p<"u"&&typeof m<"u"&&(typeof p=="number"?(this.line=p,this.column=m):(this.line=p.line,this.column=p.column,this.endLine=m.line,this.endColumn=m.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,i)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(h){if(!this.source)return"";let p=this.source;h==null&&(h=n.isColorSupported);let m=(l)=>l,u=(l)=>l,r=(l)=>l;if(h){let{bold:l,gray:w,red:y}=n.createColors(!0);u=(v)=>l(y(v)),m=(v)=>w(v),o&&(r=(v)=>o(v))}let t=p.split(/\r?\n/),f=Math.max(this.line-3,0),a=Math.min(this.line+2,t.length),d=String(a).length;return t.slice(f,a).map((l,w)=>{let y=f+1+w,v=" "+(" "+y).slice(-d)+" | ";if(y===this.line){if(l.length>160){let x=20,b=Math.max(0,this.column-x),T=Math.max(this.column+x,this.endColumn+x),O=l.slice(b,T),k=m(v.replace(/\d/g," "))+l.slice(0,Math.min(this.column-1,x-1)).replace(/[^\t]/g," ");return u(">")+m(v)+r(O)+`
3
3
  `+k+u("^")}let g=m(v.replace(/\d/g," "))+l.slice(0,this.column-1).replace(/[^\t]/g," ");return u(">")+m(v)+r(l)+`
4
4
  `+g+u("^")}return" "+m(v)+r(l)}).join(`
5
5
  `)}toString(){let h=this.showSourceCode();return h&&(h=`
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Dq as l,Eq as p,Iq as h,Jq as yQ,Kq as c,Lq as PQ,Mq as MQ,Nq as i,Rq as kQ,Sp as g,Up as jQ,Yp as RQ,Zp as ZQ,gq as o,lq as xQ,mq as NQ,pq as bQ,tq as f,wq as C}from"./chunk-p31yg62z.js";import{Tq as e,cr as wQ,er as YQ}from"./chunk-5mec6cde.js";import"./chunk-cqtkxwd8.js";import"./chunk-0mekr486.js";import{Tu as Q}from"./chunk-se195e52.js";import"./chunk-vw673y0t.js";import"./chunk-s2za1y84.js";var _Q="3.0.63",vQ=f(()=>C(Q.object({error:Q.object({code:Q.number().nullable(),message:Q.string(),status:Q.string()})}))),QQ=PQ({errorSchema:vQ,errorToMessage:(X)=>X.error.message}),hQ=Q.union([Q.object({text:Q.string()}),Q.object({inlineData:Q.object({mimeType:Q.string(),data:Q.string()})})]),mQ=f(()=>C(Q.object({outputDimensionality:Q.number().optional(),taskType:Q.enum(["SEMANTIC_SIMILARITY","CLASSIFICATION","CLUSTERING","RETRIEVAL_DOCUMENT","RETRIEVAL_QUERY","QUESTION_ANSWERING","FACT_VERIFICATION","CODE_RETRIEVAL_QUERY"]).optional(),content:Q.array(Q.array(hQ).min(1).nullable()).optional()}))),uQ=class{constructor(X,Y){this.specificationVersion="v3",this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0,this.modelId=X,this.config=Y}get provider(){return this.config.provider}async doEmbed({values:X,headers:Y,abortSignal:Z,providerOptions:$}){let J=await l({provider:"google",providerOptions:$,schema:mQ});if(X.length>this.maxEmbeddingsPerCall)throw new wQ({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:X});let L=g(await c(this.config.headers),Y),H=J==null?void 0:J.content;if(H!=null&&H.length!==X.length)throw Error(`The number of multimodal content entries (${H.length}) must match the number of values (${X.length}).`);if(X.length===1){let U=H==null?void 0:H[0],G=X[0]?[{text:X[0]}]:[],D=U!=null?[...G,...U]:[{text:X[0]}],{responseHeaders:N,value:E,rawValue:q}=await p({url:`${this.config.baseURL}/models/${this.modelId}:embedContent`,headers:L,body:{model:`models/${this.modelId}`,content:{parts:D},outputDimensionality:J==null?void 0:J.outputDimensionality,taskType:J==null?void 0:J.taskType},failedResponseHandler:QQ,successfulResponseHandler:i(dQ),abortSignal:Z,fetch:this.config.fetch});return{warnings:[],embeddings:[E.embedding.values],usage:void 0,response:{headers:N,body:q}}}let{responseHeaders:w,value:V,rawValue:x}=await p({url:`${this.config.baseURL}/models/${this.modelId}:batchEmbedContents`,headers:L,body:{requests:X.map((U,G)=>{let D=H==null?void 0:H[G],N=U?[{text:U}]:[];return{model:`models/${this.modelId}`,content:{role:"user",parts:D!=null?[...N,...D]:[{text:U}]},outputDimensionality:J==null?void 0:J.outputDimensionality,taskType:J==null?void 0:J.taskType}})},failedResponseHandler:QQ,successfulResponseHandler:i(cQ),abortSignal:Z,fetch:this.config.fetch});return{warnings:[],embeddings:V.embeddings.map((U)=>U.values),usage:void 0,response:{headers:w,body:x}}}},cQ=f(()=>C(Q.object({embeddings:Q.array(Q.object({values:Q.array(Q.number())}))}))),dQ=f(()=>C(Q.object({embedding:Q.object({values:Q.array(Q.number())})})));function AQ(X){var Y,Z,$,J;if(X==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let L=(Y=X.promptTokenCount)!=null?Y:0,H=(Z=X.candidatesTokenCount)!=null?Z:0,w=($=X.cachedContentTokenCount)!=null?$:0,V=(J=X.thoughtsTokenCount)!=null?J:0;return{inputTokens:{total:L,noCache:L-w,cacheRead:w,cacheWrite:void 0},outputTokens:{total:H+V,text:H,reasoning:V},raw:X}}function u(X,Y=!0){if(X==null)return;if(gQ(X)){if(Y)return;if(typeof X==="object"&&X.description)return{type:"object",description:X.description};return{type:"object"}}if(typeof X==="boolean")return{type:"boolean",properties:{}};let{type:Z,description:$,required:J,properties:L,items:H,allOf:w,anyOf:V,oneOf:x,format:U,const:G,minLength:D,enum:N}=X,E={};if($)E.description=$;if(J)E.required=J;if(U)E.format=U;if(G!==void 0)E.enum=[G];if(Z)if(Array.isArray(Z)){let q=Z.includes("null"),j=Z.filter((B)=>B!=="null");if(j.length===0)E.type="null";else if(E.anyOf=j.map((B)=>({type:B})),q)E.nullable=!0}else E.type=Z;if(N!==void 0)E.enum=N;if(L!=null)E.properties=Object.entries(L).reduce((q,[j,B])=>{return q[j]=u(B,!1),q},{});if(H)E.items=Array.isArray(H)?H.map((q)=>u(q,!1)):u(H,!1);if(w)E.allOf=w.map((q)=>u(q,!1));if(V)if(V.some((q)=>typeof q==="object"&&(q==null?void 0:q.type)==="null")){let q=V.filter((j)=>!(typeof j==="object"&&(j==null?void 0:j.type)==="null"));if(q.length===1){let j=u(q[0],!1);if(typeof j==="object")E.nullable=!0,Object.assign(E,j)}else E.anyOf=q.map((j)=>u(j,!1)),E.nullable=!0}else E.anyOf=V.map((q)=>u(q,!1));if(x)E.oneOf=x.map((q)=>u(q,!1));if(D!==void 0)E.minLength=D;return E}function gQ(X){return X!=null&&typeof X==="object"&&X.type==="object"&&(X.properties==null||Object.keys(X.properties).length===0)&&!X.additionalProperties}var pQ=/^data:([^;,]+);base64,(.+)$/s;function iQ(X){let Y=pQ.exec(X);if(Y==null)return;return{mediaType:Y[1],data:Y[2]}}function lQ(X){let Y=iQ(X);if(Y==null)return;return{inlineData:{mimeType:Y.mediaType,data:Y.data}}}function sQ(X,Y,Z){let $=[],J=[];for(let L of Z)switch(L.type){case"text":{J.push(L.text);break}case"image-data":case"file-data":{$.push({inlineData:{mimeType:L.mediaType,data:L.data}});break}case"image-url":case"file-url":{let H=lQ(L.url);if(H!=null)$.push(H);else J.push(JSON.stringify(L));break}default:{J.push(JSON.stringify(L));break}}X.push({functionResponse:{name:Y,response:{name:Y,content:J.length>0?J.join(`
2
+ import{Fq as o,Kq as xQ,Lq as NQ,Oq as bQ,Sq as f,Vq as C,ar as l,br as p,fr as h,gr as yQ,hr as c,ir as PQ,jr as MQ,kr as i,or as kQ,pq as g,rq as jQ,vq as RQ,wq as ZQ}from"./chunk-yq3m8190.js";import{Br as wQ,Dr as YQ,qr as e}from"./chunk-btz9jvec.js";import"./chunk-cqtkxwd8.js";import"./chunk-fkgv2hqd.js";import{qv as Q}from"./chunk-09kba1hg.js";import"./chunk-t12xrrfr.js";import"./chunk-aztre27e.js";var _Q="3.0.63",vQ=f(()=>C(Q.object({error:Q.object({code:Q.number().nullable(),message:Q.string(),status:Q.string()})}))),QQ=PQ({errorSchema:vQ,errorToMessage:(X)=>X.error.message}),hQ=Q.union([Q.object({text:Q.string()}),Q.object({inlineData:Q.object({mimeType:Q.string(),data:Q.string()})})]),mQ=f(()=>C(Q.object({outputDimensionality:Q.number().optional(),taskType:Q.enum(["SEMANTIC_SIMILARITY","CLASSIFICATION","CLUSTERING","RETRIEVAL_DOCUMENT","RETRIEVAL_QUERY","QUESTION_ANSWERING","FACT_VERIFICATION","CODE_RETRIEVAL_QUERY"]).optional(),content:Q.array(Q.array(hQ).min(1).nullable()).optional()}))),uQ=class{constructor(X,Y){this.specificationVersion="v3",this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0,this.modelId=X,this.config=Y}get provider(){return this.config.provider}async doEmbed({values:X,headers:Y,abortSignal:Z,providerOptions:$}){let J=await l({provider:"google",providerOptions:$,schema:mQ});if(X.length>this.maxEmbeddingsPerCall)throw new wQ({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:X});let L=g(await c(this.config.headers),Y),H=J==null?void 0:J.content;if(H!=null&&H.length!==X.length)throw Error(`The number of multimodal content entries (${H.length}) must match the number of values (${X.length}).`);if(X.length===1){let U=H==null?void 0:H[0],G=X[0]?[{text:X[0]}]:[],D=U!=null?[...G,...U]:[{text:X[0]}],{responseHeaders:N,value:E,rawValue:q}=await p({url:`${this.config.baseURL}/models/${this.modelId}:embedContent`,headers:L,body:{model:`models/${this.modelId}`,content:{parts:D},outputDimensionality:J==null?void 0:J.outputDimensionality,taskType:J==null?void 0:J.taskType},failedResponseHandler:QQ,successfulResponseHandler:i(dQ),abortSignal:Z,fetch:this.config.fetch});return{warnings:[],embeddings:[E.embedding.values],usage:void 0,response:{headers:N,body:q}}}let{responseHeaders:w,value:V,rawValue:x}=await p({url:`${this.config.baseURL}/models/${this.modelId}:batchEmbedContents`,headers:L,body:{requests:X.map((U,G)=>{let D=H==null?void 0:H[G],N=U?[{text:U}]:[];return{model:`models/${this.modelId}`,content:{role:"user",parts:D!=null?[...N,...D]:[{text:U}]},outputDimensionality:J==null?void 0:J.outputDimensionality,taskType:J==null?void 0:J.taskType}})},failedResponseHandler:QQ,successfulResponseHandler:i(cQ),abortSignal:Z,fetch:this.config.fetch});return{warnings:[],embeddings:V.embeddings.map((U)=>U.values),usage:void 0,response:{headers:w,body:x}}}},cQ=f(()=>C(Q.object({embeddings:Q.array(Q.object({values:Q.array(Q.number())}))}))),dQ=f(()=>C(Q.object({embedding:Q.object({values:Q.array(Q.number())})})));function AQ(X){var Y,Z,$,J;if(X==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let L=(Y=X.promptTokenCount)!=null?Y:0,H=(Z=X.candidatesTokenCount)!=null?Z:0,w=($=X.cachedContentTokenCount)!=null?$:0,V=(J=X.thoughtsTokenCount)!=null?J:0;return{inputTokens:{total:L,noCache:L-w,cacheRead:w,cacheWrite:void 0},outputTokens:{total:H+V,text:H,reasoning:V},raw:X}}function u(X,Y=!0){if(X==null)return;if(gQ(X)){if(Y)return;if(typeof X==="object"&&X.description)return{type:"object",description:X.description};return{type:"object"}}if(typeof X==="boolean")return{type:"boolean",properties:{}};let{type:Z,description:$,required:J,properties:L,items:H,allOf:w,anyOf:V,oneOf:x,format:U,const:G,minLength:D,enum:N}=X,E={};if($)E.description=$;if(J)E.required=J;if(U)E.format=U;if(G!==void 0)E.enum=[G];if(Z)if(Array.isArray(Z)){let q=Z.includes("null"),j=Z.filter((B)=>B!=="null");if(j.length===0)E.type="null";else if(E.anyOf=j.map((B)=>({type:B})),q)E.nullable=!0}else E.type=Z;if(N!==void 0)E.enum=N;if(L!=null)E.properties=Object.entries(L).reduce((q,[j,B])=>{return q[j]=u(B,!1),q},{});if(H)E.items=Array.isArray(H)?H.map((q)=>u(q,!1)):u(H,!1);if(w)E.allOf=w.map((q)=>u(q,!1));if(V)if(V.some((q)=>typeof q==="object"&&(q==null?void 0:q.type)==="null")){let q=V.filter((j)=>!(typeof j==="object"&&(j==null?void 0:j.type)==="null"));if(q.length===1){let j=u(q[0],!1);if(typeof j==="object")E.nullable=!0,Object.assign(E,j)}else E.anyOf=q.map((j)=>u(j,!1)),E.nullable=!0}else E.anyOf=V.map((q)=>u(q,!1));if(x)E.oneOf=x.map((q)=>u(q,!1));if(D!==void 0)E.minLength=D;return E}function gQ(X){return X!=null&&typeof X==="object"&&X.type==="object"&&(X.properties==null||Object.keys(X.properties).length===0)&&!X.additionalProperties}var pQ=/^data:([^;,]+);base64,(.+)$/s;function iQ(X){let Y=pQ.exec(X);if(Y==null)return;return{mediaType:Y[1],data:Y[2]}}function lQ(X){let Y=iQ(X);if(Y==null)return;return{inlineData:{mimeType:Y.mediaType,data:Y.data}}}function sQ(X,Y,Z){let $=[],J=[];for(let L of Z)switch(L.type){case"text":{J.push(L.text);break}case"image-data":case"file-data":{$.push({inlineData:{mimeType:L.mediaType,data:L.data}});break}case"image-url":case"file-url":{let H=lQ(L.url);if(H!=null)$.push(H);else J.push(JSON.stringify(L));break}default:{J.push(JSON.stringify(L));break}}X.push({functionResponse:{name:Y,response:{name:Y,content:J.length>0?J.join(`
3
3
  `):"Tool executed successfully."},...$.length>0?{parts:$}:{}}})}function nQ(X,Y,Z){for(let $ of Z)switch($.type){case"text":X.push({functionResponse:{name:Y,response:{name:Y,content:$.text}}});break;case"image-data":X.push({inlineData:{mimeType:String($.mediaType),data:String($.data)}},{text:"Tool executed successfully and returned this image as a response"});break;default:X.push({text:JSON.stringify($)});break}}function aQ(X,Y){var Z,$,J,L,H,w,V,x;let U=[],G=[],D=!0,N=(Z=Y==null?void 0:Y.isGemmaModel)!=null?Z:!1,E=($=Y==null?void 0:Y.providerOptionsName)!=null?$:"google",q=(J=Y==null?void 0:Y.supportsFunctionResponseParts)!=null?J:!0;for(let{role:j,content:B}of X)switch(j){case"system":{if(!D)throw new YQ({functionality:"system messages are only supported at the beginning of the conversation"});U.push({text:B});break}case"user":{D=!1;let K=[];for(let F of B)switch(F.type){case"text":{K.push({text:F.text});break}case"file":{let b=F.mediaType==="image/*"?"image/jpeg":F.mediaType;K.push(F.data instanceof URL?{fileData:{mimeType:b,fileUri:F.data.toString()}}:{inlineData:{mimeType:b,data:ZQ(F.data)}});break}}G.push({role:"user",parts:K});break}case"assistant":{D=!1,G.push({role:"model",parts:B.map((K)=>{var F,b,S,k;let z=(k=(F=K.providerOptions)==null?void 0:F[E])!=null?k:E!=="google"?(b=K.providerOptions)==null?void 0:b.google:(S=K.providerOptions)==null?void 0:S.vertex,y=(z==null?void 0:z.thoughtSignature)!=null?String(z.thoughtSignature):void 0;switch(K.type){case"text":return K.text.length===0?void 0:{text:K.text,thoughtSignature:y};case"reasoning":return K.text.length===0?void 0:{text:K.text,thought:!0,thoughtSignature:y};case"file":{if(K.data instanceof URL)throw new YQ({functionality:"File data URLs in assistant messages are not supported"});return{inlineData:{mimeType:K.mediaType,data:ZQ(K.data)},...(z==null?void 0:z.thought)===!0?{thought:!0}:{},thoughtSignature:y}}case"tool-call":{let P=(z==null?void 0:z.serverToolCallId)!=null?String(z.serverToolCallId):void 0,O=(z==null?void 0:z.serverToolType)!=null?String(z.serverToolType):void 0;if(P&&O)return{toolCall:{toolType:O,args:typeof K.input==="string"?JSON.parse(K.input):K.input,id:P},thoughtSignature:y};return{functionCall:{name:K.toolName,args:K.input},thoughtSignature:y}}case"tool-result":{let P=(z==null?void 0:z.serverToolCallId)!=null?String(z.serverToolCallId):void 0,O=(z==null?void 0:z.serverToolType)!=null?String(z.serverToolType):void 0;if(P&&O)return{toolResponse:{toolType:O,response:K.output.type==="json"?K.output.value:{},id:P},thoughtSignature:y};return}}}).filter((K)=>K!==void 0)});break}case"tool":{D=!1;let K=[];for(let F of B){if(F.type==="tool-approval-response")continue;let b=(V=(L=F.providerOptions)==null?void 0:L[E])!=null?V:E!=="google"?(H=F.providerOptions)==null?void 0:H.google:(w=F.providerOptions)==null?void 0:w.vertex,S=(b==null?void 0:b.serverToolCallId)!=null?String(b.serverToolCallId):void 0,k=(b==null?void 0:b.serverToolType)!=null?String(b.serverToolType):void 0;if(S&&k){let y=(b==null?void 0:b.thoughtSignature)!=null?String(b.thoughtSignature):void 0;if(G.length>0){let P=G[G.length-1];if(P.role==="model"){P.parts.push({toolResponse:{toolType:k,response:F.output.type==="json"?F.output.value:{},id:S},thoughtSignature:y});continue}}}let z=F.output;if(z.type==="content")if(q)sQ(K,F.toolName,z.value);else nQ(K,F.toolName,z.value);else K.push({functionResponse:{name:F.toolName,response:{name:F.toolName,content:z.type==="execution-denied"?(x=z.reason)!=null?x:"Tool execution denied.":z.value}}})}G.push({role:"user",parts:K});break}}if(N&&U.length>0&&G.length>0&&G[0].role==="user"){let j=U.map((B)=>B.text).join(`
4
4
 
5
5
  `);G[0].parts.unshift({text:j+`
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$j as u,Ij as s,Nj as e,Oj as j,Pj as v,ak as f}from"./chunk-njzpswgt.js";import{El as D,Il as b,Jl as a,Kl as t,vl as r,wl as C,xl as k,yl as m}from"./chunk-ygwe0vf1.js";import{bn as x,cn as q,en as n,fn as o,hn as K,jn as c,qn as i}from"./chunk-3rgct4bd.js";import{$t as Q_,Rt as O_}from"./chunk-08y06vgt.js";import{ou as d,tu as g}from"./chunk-9p83me3p.js";import{EP as S_}from"./chunk-s2za1y84.js";var l={};S_(l,{run:()=>h_,encodeDir:()=>k_,ClaudeImport:()=>l});import E_ from"path";import W_ from"path";import{access as X_,readFile as Y_}from"fs/promises";var G=n("external_import",{source:q().$type().notNull(),source_key:q().notNull(),session_id:q().$type().notNull(),source_path:q().notNull(),source_mtime:x().notNull(),time_imported:x().notNull(),message_ids:q({mode:"json"}).$type()},(N)=>[o({columns:[N.source,N.source_key]})]);function Z_(){return{scanned:0,imported:0,resynced:0,skipped:0,errors:[]}}async function L_(N){if(!N||!await g.exists(N))return{id:b.global,worktree:N||"/",vcs:null};if(!await a(N))return{id:b.global,worktree:N,vcs:null};return{id:await t(N),worktree:N,vcs:"git"}}function __(N){return N.split(`
2
+ import{fk as s,kk as e,lk as j,mk as v,yk as u,zk as f}from"./chunk-gsvdt4kq.js";import{Ul as r,Vl as C,Wl as k,Xl as m,bm as D,fm as b,gm as a,hm as t}from"./chunk-90zd5rss.js";import{An as x,Bn as q,Dn as n,En as o,Gn as K,In as c,Pn as i}from"./chunk-nj4d554m.js";import{ou as O_,yu as Q_}from"./chunk-zxaaxb99.js";import{Nu as d,Su as g}from"./chunk-whxjkz9a.js";import{bQ as S_}from"./chunk-aztre27e.js";var l={};S_(l,{run:()=>h_,encodeDir:()=>k_,ClaudeImport:()=>l});import E_ from"path";import W_ from"path";import{access as X_,readFile as Y_}from"fs/promises";var G=n("external_import",{source:q().$type().notNull(),source_key:q().notNull(),session_id:q().$type().notNull(),source_path:q().notNull(),source_mtime:x().notNull(),time_imported:x().notNull(),message_ids:q({mode:"json"}).$type()},(N)=>[o({columns:[N.source,N.source_key]})]);function Z_(){return{scanned:0,imported:0,resynced:0,skipped:0,errors:[]}}async function L_(N){if(!N||!await g.exists(N))return{id:b.global,worktree:N||"/",vcs:null};if(!await a(N))return{id:b.global,worktree:N,vcs:null};return{id:await t(N),worktree:N,vcs:"git"}}function __(N){return N.split(`
3
3
  `).map((_)=>_.trim()).filter(Boolean).flatMap((_)=>{try{return[JSON.parse(_)]}catch{return[]}})}function N_(N){let _=N.find((H)=>H.trim()&&!H.trim().startsWith("<"));if(!_)return;return _.trim().replace(/\s+/g," ").slice(0,100)}function R_(N,_){return D.use((H)=>H.select().from(G).where(c(K(G.source,N),K(G.source_key,_))).get())}function G_(N,_){if(!_)return{existing:void 0,existingUpdated:void 0};let H=_,O=D.use((Z)=>Z.select({updated:C.time_updated}).from(C).where(K(C.id,H.session_id)).get());if(!O)return D.use((Z)=>Z.delete(G).where(c(K(G.source,N),K(G.source_key,H.source_key))).run()),{existing:void 0,existingUpdated:void 0};return{existing:_,existingUpdated:O.updated}}function J_(N,_,H,O){N.insert(r).values({id:_.id,worktree:_.worktree,vcs:_.vcs,sandboxes:[],time_created:H,time_updated:O}).onConflictDoNothing().run()}function K_(N,_,H){if(_.message_ids?.length)for(let O=0;O<_.message_ids.length;O+=500)N.delete(k).where(i(k.id,_.message_ids.slice(O,O+500))).run();else N.delete(k).where(K(k.session_id,H)).run()}function A_(N,_,H){N.update(C).set({project_id:H.projectId,directory:H.directory,version:H.version,time_updated:Math.max(H.existingUpdated??0,H.timeUpdated)}).where(K(C.id,_)).run()}function $_(N){return async(_)=>F_({...N,force:_?.force})}async function F_(N){let _=Z_();if(!await X_(N.root).then(()=>!0).catch(()=>!1))return _;let H=await d.scan(N.pattern,{cwd:N.root,absolute:!0});for(let O of H){_.scanned++;try{let Z=W_.basename(O,".jsonl"),A=await g.statAsync(O);if(!A){_.skipped++;continue}let F=Math.floor(Number(A.mtimeMs)),Y=R_(N.source,Z);if(Y&&Y.source_mtime===F&&!N.force){_.skipped++;continue}let S=G_(N.source,Y);Y=S.existing;let T=S.existingUpdated,Q=Y?Y.session_id:e.descending(),V=N.parse(await Y_(O,"utf-8"),Q);if(!V||V.messages.length===0){_.skipped++;continue}let E=await L_(V.cwd),U=Date.now(),X=V.messages.map(($)=>$.info.id);if(D.transaction(($)=>{if(J_($,E,V.timeCreated,V.timeUpdated),Y)K_($,Y,Q),A_($,Q,{projectId:E.id,directory:V.cwd,version:V.version,existingUpdated:T,timeUpdated:V.timeUpdated});else $.insert(C).values({id:Q,project_id:E.id,slug:s.create(),directory:V.cwd,title:V.title,version:V.version,time_created:V.timeCreated,time_updated:V.timeUpdated}).run();for(let L of V.messages){let{id:B,sessionID:I,agentID:w,...z}=L.info;$.insert(k).values({id:B,session_id:Q,agent_id:"main",time_created:L.info.time.created,data:z}).onConflictDoUpdate({target:k.id,set:{data:z}}).run();for(let J of L.parts){let{id:y,sessionID:p,messageID:P,...h}=J.part;$.insert(m).values({id:y,message_id:L.info.id,session_id:Q,time_created:J.time,data:h}).onConflictDoUpdate({target:m.id,set:{data:h}}).run()}}$.insert(G).values({source:N.source,source_key:Z,session_id:Q,source_path:O,source_mtime:F,time_imported:U,message_ids:X}).onConflictDoUpdate({target:[G.source,G.source_key],set:{session_id:Q,source_path:O,source_mtime:F,time_imported:U,message_ids:X}}).run()}),Y)_.resynced++;else _.imported++}catch(Z){_.errors.push(`${O}: ${Z}`)}}if(_.imported+_.resynced>0||_.errors.length>0)N.log.info(N.logMessage,{..._,errors:_.errors.length});return _}var B_=Q_.create({service:"claude-import"});function k_(N){return N.replace(/[^a-zA-Z0-9]/g,"-")}function z_(N){if(!N)return{providerID:u.anthropic,modelID:f.make("unknown")};let _=N.indexOf("/");if(_===-1)return{providerID:u.anthropic,modelID:f.make(N)};return{providerID:u.make(N.slice(0,_)),modelID:f.make(N.slice(_+1))}}function H_(N){let _=N??{};return{input:_.input_tokens??0,output:_.output_tokens??0,reasoning:0,cache:{read:_.cache_read_input_tokens??0,write:_.cache_creation_input_tokens??0}}}function C_(N){if(typeof N==="string")return N;if(Array.isArray(N))return N.map((_)=>_&&typeof _==="object"&&("type"in _)&&_.type==="text"?_.text:JSON.stringify(_)).join(`
4
4
  `);return N==null?"":JSON.stringify(N)}function U_(N,_){let H=__(N);if(H.length===0)return;let O,Z,A,F=0,Y,S=[],T=new Map,Q=null,V=null,E=z_(void 0),U=()=>{if(Q)S.push(Q);Q=null};for(let X of H){if(X.type!=="user"&&X.type!=="assistant")continue;let $=X.timestamp?Date.parse(X.timestamp):Date.now();if(!O&&X.cwd)O=X.cwd;if(!Z&&X.version)Z=X.version;if(A===void 0)A=$;F=Math.max(F,$);let L=X.message;if(!L)continue;if(X.type==="user"){let z=L.content,J=typeof z==="string"?[]:Array.isArray(z)?z:[];for(let W of J.filter((R)=>R?.type==="tool_result")){let R=T.get(W.tool_use_id);if(!R)continue;let M=C_(W.content);R.part.state=W.is_error?{status:"error",input:R.part.state.input??{},error:M,time:{start:R.start,end:$}}:{status:"completed",input:R.part.state.input??{},output:M,title:R.part.tool,metadata:{},time:{start:R.start,end:$}}}let y=typeof z==="string"?z.trim()?[z]:[]:J.filter((W)=>W?.type==="text"&&typeof W.text==="string"&&W.text.trim()).map((W)=>W.text),p=J.filter((W)=>W?.type==="image"&&W.source);if(y.length===0&&p.length===0)continue;U();let P=j.ascending(),h=[];for(let W of y)h.push({part:{id:v.ascending(),sessionID:_,messageID:P,type:"text",text:W},time:$});for(let W of p){let R=W.source.media_type??"image/png",M=W.source.type==="base64"?`data:${R};base64,${W.source.data}`:W.source.url??"";if(M)h.push({part:{id:v.ascending(),sessionID:_,messageID:P,type:"file",mime:R,url:M},time:$})}let V_={id:P,sessionID:_,role:"user",agent:"main",time:{created:$},model:{providerID:E.providerID,modelID:E.modelID}};if(S.push({info:V_,parts:h}),V=P,!Y)Y=N_(y);continue}let B=z_(L.model);if(E=B,!V){let z=j.ascending();S.push({info:{id:z,sessionID:_,role:"user",agent:"main",time:{created:$},model:{providerID:B.providerID,modelID:B.modelID}},parts:[]}),V=z}if(!Q||Q.info.role!=="assistant"||Q.info.parentID!==V)U(),Q={info:{id:j.ascending(),sessionID:_,role:"assistant",time:{created:$,completed:$},parentID:V,modelID:B.modelID,providerID:B.providerID,mode:"build",agent:"main",path:{cwd:O??X.cwd??"",root:O??X.cwd??""},cost:0,tokens:H_(L.usage)},parts:[]};let I=Q.info;I.time.completed=$,I.tokens=H_(L.usage);let w=Q.info.id;for(let z of Array.isArray(L.content)?L.content:[])if(z?.type==="thinking"||z?.type==="reasoning")Q.parts.push({part:{id:v.ascending(),sessionID:_,messageID:w,type:"reasoning",text:z.thinking??z.text??"",time:{start:$,end:$}},time:$});else if(z?.type==="text"&&typeof z.text==="string")Q.parts.push({part:{id:v.ascending(),sessionID:_,messageID:w,type:"text",text:z.text},time:$});else if(z?.type==="tool_use"){let J={id:v.ascending(),sessionID:_,messageID:w,type:"tool",callID:z.id,tool:z.name,state:{status:"pending",input:z.input??{},raw:JSON.stringify(z.input??{})}};Q.parts.push({part:J,time:$}),T.set(z.id,{part:J,start:$})}}return U(),{cwd:O??"",version:Z??"claude-code",title:Y??"Claude Code session",timeCreated:A??Date.now(),timeUpdated:F||A||Date.now(),messages:S}}var h_=$_({source:"cc",root:E_.join(O_.Path.home,".claude","projects"),pattern:"*/*.jsonl",log:B_,logMessage:"claude import",parse:U_});
5
- export{G as ag,Z_ as bg,L_ as cg,__ as dg,N_ as eg,R_ as fg,G_ as gg,J_ as hg,K_ as ig,A_ as jg,$_ as kg,k_ as lg,h_ as mg,l as ng};
5
+ export{G as bg,Z_ as cg,L_ as dg,__ as eg,N_ as fg,R_ as gg,G_ as hg,J_ as ig,K_ as jg,A_ as kg,$_ as lg,k_ as mg,h_ as ng,l as og};