@qitqode/qitqode-android-arm64 0.2.9 → 0.2.10

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 (425) hide show
  1. package/bundle/chunk-062chtrq.js +2 -0
  2. package/bundle/chunk-062vs7bp.js +2 -0
  3. package/bundle/chunk-08g14hmz.js +2 -0
  4. package/bundle/{chunk-wgkcyqn1.js → chunk-0bhzhh7s.js} +2 -2
  5. package/bundle/{chunk-cfwz1hgr.js → chunk-0mwzxqt5.js} +3 -3
  6. package/bundle/{chunk-mr17tppa.js → chunk-0sfc21qe.js} +2 -2
  7. package/bundle/{chunk-7adsab4h.js → chunk-0tkznq75.js} +1 -1
  8. package/bundle/chunk-0w2v8dfy.js +2 -0
  9. package/bundle/chunk-10fr7a2y.js +2 -0
  10. package/bundle/chunk-141p12c4.js +4 -0
  11. package/bundle/chunk-15bjhfav.js +3 -0
  12. package/bundle/{chunk-92r1gw2j.js → chunk-1h96bk6p.js} +2 -2
  13. package/bundle/chunk-1hv61m11.js +2 -0
  14. package/bundle/{chunk-0z1keh2w.js → chunk-1m78yy4k.js} +1 -1
  15. package/bundle/chunk-1q10jyka.js +29 -0
  16. package/bundle/{chunk-g4tyaj0m.js → chunk-1r81q7m3.js} +1 -1
  17. package/bundle/{chunk-29q89bge.js → chunk-2cvwrabw.js} +2 -2
  18. package/bundle/{chunk-8p0t8qah.js → chunk-2dmcpqak.js} +1 -1
  19. package/bundle/{chunk-35fj1sfm.js → chunk-2fbkw84y.js} +2 -2
  20. package/bundle/chunk-2mkvx8b2.js +2 -0
  21. package/bundle/chunk-2rykfc3a.js +2 -0
  22. package/bundle/chunk-2w5hx4fs.js +2 -0
  23. package/bundle/{chunk-t3w43rft.js → chunk-2y5bthrp.js} +1 -1
  24. package/bundle/chunk-2yy63sxz.js +2 -0
  25. package/bundle/chunk-2z3fe4qw.js +2 -0
  26. package/bundle/{chunk-g7v6sp3c.js → chunk-2zjet9tx.js} +2 -2
  27. package/bundle/{chunk-qgkb6n8k.js → chunk-32xd626h.js} +2 -2
  28. package/bundle/chunk-361cmmrp.js +2 -0
  29. package/bundle/{chunk-eg1m81ax.js → chunk-3mtjxmw1.js} +1 -1
  30. package/bundle/chunk-3r6dq1h3.js +2 -0
  31. package/bundle/{chunk-wtt5wms9.js → chunk-3sj0jv91.js} +1 -1
  32. package/bundle/{chunk-hz02vrqs.js → chunk-3vae1s42.js} +1 -1
  33. package/bundle/{chunk-t18ka1e7.js → chunk-3yfjgks3.js} +1 -1
  34. package/bundle/{chunk-phf37x1c.js → chunk-3zzrdpsx.js} +1 -1
  35. package/bundle/chunk-4a12wv2m.js +2 -0
  36. package/bundle/{chunk-1rgt2vmt.js → chunk-4a9jqe5s.js} +1 -1
  37. package/bundle/{chunk-wqk1v8t0.js → chunk-4sa9t0vx.js} +2 -2
  38. package/bundle/{chunk-qbnt4ynd.js → chunk-532fnfmw.js} +2 -2
  39. package/bundle/chunk-547a55ba.js +2 -0
  40. package/bundle/{chunk-vr8nwzp0.js → chunk-56yp5v0w.js} +1 -1
  41. package/bundle/{chunk-ag8wxwwz.js → chunk-5fcyb122.js} +1 -1
  42. package/bundle/{chunk-4pmvxnkj.js → chunk-5nm5egq0.js} +2 -2
  43. package/bundle/{chunk-1v0khv7p.js → chunk-5p2r8bxx.js} +1 -1
  44. package/bundle/{chunk-5bv63rqj.js → chunk-5rqjze1g.js} +1 -1
  45. package/bundle/{chunk-sy9w1t2y.js → chunk-5w7ebtcd.js} +1 -1
  46. package/bundle/chunk-5ztmc770.js +2 -0
  47. package/bundle/{chunk-a1z8rnq7.js → chunk-61t4g8bh.js} +4 -4
  48. package/bundle/chunk-62x3r2q8.js +2 -0
  49. package/bundle/chunk-62y6zk9x.js +2 -0
  50. package/bundle/{chunk-c76cjhn0.js → chunk-6axm2qtj.js} +1 -1
  51. package/bundle/{chunk-zfrftgcy.js → chunk-6gbdvz6p.js} +1 -1
  52. package/bundle/{chunk-fa8pwdwv.js → chunk-6mnk5sg3.js} +1 -1
  53. package/bundle/chunk-6th7vpwm.js +2 -0
  54. package/bundle/{chunk-8yzghzjq.js → chunk-6wjdhvdf.js} +1 -1
  55. package/bundle/{chunk-a8bjcvda.js → chunk-6y58jzak.js} +1 -1
  56. package/bundle/chunk-6ybh5smv.js +2 -0
  57. package/bundle/chunk-73kprndw.js +2 -0
  58. package/bundle/chunk-79fr19xf.js +2 -0
  59. package/bundle/{chunk-3va85mbe.js → chunk-7a3txs9f.js} +2 -2
  60. package/bundle/chunk-7ezr478e.js +2 -0
  61. package/bundle/chunk-7gj1vqyj.js +2 -0
  62. package/bundle/{chunk-eacpc64g.js → chunk-7hdb1fhq.js} +2 -2
  63. package/bundle/{chunk-t8fjgkp8.js → chunk-7rbg6mg9.js} +2 -2
  64. package/bundle/{chunk-59csnjc3.js → chunk-7s0nq2aa.js} +2 -2
  65. package/bundle/chunk-7ywfkwb4.js +2 -0
  66. package/bundle/chunk-819qr675.js +2 -0
  67. package/bundle/{chunk-g6y2c5az.js → chunk-81dvy370.js} +1 -1
  68. package/bundle/chunk-85fnnwm2.js +2 -0
  69. package/bundle/chunk-89fwh84w.js +2 -0
  70. package/bundle/chunk-8e724g3k.js +2 -0
  71. package/bundle/{chunk-k6981ysw.js → chunk-8gpjmj42.js} +3 -3
  72. package/bundle/{chunk-wtxh5m6j.js → chunk-8nnajdwf.js} +3 -3
  73. package/bundle/chunk-8peby2d1.js +2 -0
  74. package/bundle/{chunk-702bt91p.js → chunk-8rkszwxq.js} +6 -6
  75. package/bundle/{chunk-w0nc0gcx.js → chunk-8v60bqm0.js} +1 -1
  76. package/bundle/chunk-9894a2yn.js +2 -0
  77. package/bundle/chunk-98ye2nwt.js +2 -0
  78. package/bundle/{chunk-48gap82w.js → chunk-9bbwxp5d.js} +1 -1
  79. package/bundle/{chunk-z0kbyr00.js → chunk-9d0exvey.js} +2 -2
  80. package/bundle/{chunk-8ysp6vf8.js → chunk-9fjcgdea.js} +1 -1
  81. package/bundle/{chunk-jpn9zfj5.js → chunk-9nf5650d.js} +1 -1
  82. package/bundle/{chunk-n6tqtk6h.js → chunk-9pj10pgd.js} +2 -2
  83. package/bundle/chunk-9s4excg8.js +2 -0
  84. package/bundle/{chunk-t6zz47zk.js → chunk-9s5h0f1y.js} +2 -2
  85. package/bundle/{chunk-p8ak162p.js → chunk-9tz18e54.js} +1 -1
  86. package/bundle/{chunk-fs1vb39f.js → chunk-9zy5tsry.js} +3 -3
  87. package/bundle/{chunk-bc2krtaf.js → chunk-a70m6kyn.js} +1 -1
  88. package/bundle/{chunk-cr5tknvb.js → chunk-acsqvgdw.js} +1 -1
  89. package/bundle/chunk-aetgcegz.js +2 -0
  90. package/bundle/chunk-agas0nay.js +2 -0
  91. package/bundle/{chunk-vs3s49jw.js → chunk-ajnzv5jt.js} +2 -2
  92. package/bundle/{chunk-9cf2ktyh.js → chunk-asxmkyz2.js} +1 -1
  93. package/bundle/{chunk-0ffmwhw7.js → chunk-at4dge22.js} +1 -1
  94. package/bundle/{chunk-sa0rrreh.js → chunk-atacnspd.js} +2 -2
  95. package/bundle/chunk-ayknzc4m.js +2 -0
  96. package/bundle/chunk-azss4acq.js +3 -0
  97. package/bundle/chunk-b2ybst88.js +2 -0
  98. package/bundle/{chunk-cghz0855.js → chunk-b8rzn48q.js} +1 -1
  99. package/bundle/{chunk-dhvx9p54.js → chunk-b9f78x5g.js} +1 -1
  100. package/bundle/chunk-bd5vtjd7.js +2 -0
  101. package/bundle/chunk-bjqqk6jt.js +2 -0
  102. package/bundle/{chunk-mv7q6ach.js → chunk-brk1jca3.js} +1 -1
  103. package/bundle/{chunk-5r7c6vvx.js → chunk-by1kwg4r.js} +2 -2
  104. package/bundle/{chunk-1acn5me8.js → chunk-c1c8ch3g.js} +327 -313
  105. package/bundle/{chunk-2nheahmq.js → chunk-c2ns2csn.js} +1 -1
  106. package/bundle/{chunk-qk5vy2pr.js → chunk-c3ey896z.js} +1 -1
  107. package/bundle/{chunk-b7sr9rn3.js → chunk-c8080519.js} +1 -1
  108. package/bundle/{chunk-vd8cmdpv.js → chunk-c8yc8qcd.js} +1 -1
  109. package/bundle/{chunk-nas631g2.js → chunk-c9cngded.js} +1 -1
  110. package/bundle/{chunk-ejhhrece.js → chunk-ccdjzn2m.js} +3 -3
  111. package/bundle/{chunk-rk0fnvp5.js → chunk-cdenq7jb.js} +1 -1
  112. package/bundle/chunk-cpkcdykz.js +2 -0
  113. package/bundle/{chunk-56wq8cqj.js → chunk-cs825mxr.js} +1 -1
  114. package/bundle/{chunk-1bxfzd6r.js → chunk-cxtwavyf.js} +4 -4
  115. package/bundle/chunk-cyafm8d6.js +2 -0
  116. package/bundle/{chunk-eewe7tx1.js → chunk-d0dsgxk4.js} +2 -2
  117. package/bundle/{chunk-g3n465ee.js → chunk-d1fv2c7s.js} +2 -2
  118. package/bundle/{chunk-1p9s5jj1.js → chunk-d1xfv4d3.js} +1 -1
  119. package/bundle/chunk-d4316r53.js +2 -0
  120. package/bundle/chunk-d8ym7mcg.js +2 -0
  121. package/bundle/{chunk-53jstmdp.js → chunk-d9w2bn2e.js} +1 -1
  122. package/bundle/{chunk-g26redah.js → chunk-dd461rg3.js} +1 -1
  123. package/bundle/{chunk-e0vrxetq.js → chunk-djfrkbd5.js} +1 -1
  124. package/bundle/{chunk-mrq35ftw.js → chunk-dm447tgc.js} +2 -2
  125. package/bundle/{chunk-7pckez5z.js → chunk-dnjyepb2.js} +2 -2
  126. package/bundle/chunk-dnpjxjkp.js +2 -0
  127. package/bundle/{chunk-0a4pmkc9.js → chunk-dp6ms01y.js} +2 -2
  128. package/bundle/{chunk-rdreeyv0.js → chunk-dx7rexx3.js} +3 -3
  129. package/bundle/{chunk-kre93a89.js → chunk-dz3kcsb6.js} +2 -2
  130. package/bundle/{chunk-dcv6wj9x.js → chunk-dzma8zvf.js} +2 -2
  131. package/bundle/{chunk-e2wfj86b.js → chunk-e10c0crf.js} +1 -1
  132. package/bundle/{chunk-wn63q3xp.js → chunk-e1x1mp9m.js} +1 -1
  133. package/bundle/{chunk-tk4z6r09.js → chunk-e3mrw0k7.js} +1 -1
  134. package/bundle/chunk-e5gjqtby.js +2 -0
  135. package/bundle/{chunk-3z2zn8rj.js → chunk-e72jwbfc.js} +1 -1
  136. package/bundle/{chunk-85wh85pk.js → chunk-eabbrt1p.js} +1 -1
  137. package/bundle/{chunk-jr80q31w.js → chunk-ecz4h0a2.js} +1 -1
  138. package/bundle/chunk-ee3mqzms.js +2 -0
  139. package/bundle/chunk-eme9xmh3.js +2 -0
  140. package/bundle/{chunk-cf9m9m9q.js → chunk-eqpep2m2.js} +1 -1
  141. package/bundle/chunk-er5f61s5.js +2 -0
  142. package/bundle/chunk-er716522.js +2 -0
  143. package/bundle/{chunk-qgek59e6.js → chunk-ev6jwt7q.js} +1 -1
  144. package/bundle/chunk-ez3gacqe.js +2 -0
  145. package/bundle/{chunk-ax64ngf2.js → chunk-f0ab2f28.js} +1 -1
  146. package/bundle/{chunk-ggncq8w8.js → chunk-f17se3hh.js} +1 -1
  147. package/bundle/chunk-f3y5kr76.js +14 -0
  148. package/bundle/{chunk-vsqvnxbz.js → chunk-f6btedtt.js} +1 -1
  149. package/bundle/{chunk-nsp1za8t.js → chunk-f6vy70p6.js} +2 -2
  150. package/bundle/{chunk-0s4cp6q2.js → chunk-ff8q10gk.js} +2 -2
  151. package/bundle/chunk-fkc7wf1p.js +2 -0
  152. package/bundle/chunk-fm6z8nqb.js +2 -0
  153. package/bundle/{chunk-fw1f47de.js → chunk-fsndgr9a.js} +1 -1
  154. package/bundle/{chunk-pqg1wjb5.js → chunk-fvv1cret.js} +1 -1
  155. package/bundle/{chunk-j10a984e.js → chunk-g08qj9z3.js} +2 -2
  156. package/bundle/chunk-g0qwm23d.js +2 -0
  157. package/bundle/chunk-g4yn8cj8.js +2 -0
  158. package/bundle/{chunk-rwwvy89t.js → chunk-g52wmt1v.js} +1 -1
  159. package/bundle/{chunk-trstb8ee.js → chunk-gb51fn3r.js} +1 -1
  160. package/bundle/{chunk-kgv68cpb.js → chunk-gbnf7zf9.js} +1 -1
  161. package/bundle/{chunk-0w19vmd7.js → chunk-ge7csm6m.js} +2 -2
  162. package/bundle/{chunk-bkfafcbw.js → chunk-gksbv613.js} +2 -2
  163. package/bundle/{chunk-afr8m0q1.js → chunk-gmq1kwn0.js} +1 -1
  164. package/bundle/{chunk-b5ym419d.js → chunk-gq3zb4wv.js} +2 -2
  165. package/bundle/{chunk-tbx741en.js → chunk-gqgjybjc.js} +1 -1
  166. package/bundle/{chunk-bhg69t69.js → chunk-gx4v8z64.js} +2 -2
  167. package/bundle/{chunk-sm1g81cv.js → chunk-h0pvxre5.js} +1 -1
  168. package/bundle/chunk-h1spsy3y.js +2 -0
  169. package/bundle/{chunk-sbjymf20.js → chunk-h2p984qb.js} +2 -2
  170. package/bundle/{chunk-gznt3dv8.js → chunk-h6z86aay.js} +1 -1
  171. package/bundle/chunk-h8gkv40j.js +2 -0
  172. package/bundle/{chunk-zsg29gba.js → chunk-h91zmzs5.js} +1 -1
  173. package/bundle/{chunk-zrhw1szj.js → chunk-hgm8yfcb.js} +1 -1
  174. package/bundle/chunk-j59kmb49.js +2 -0
  175. package/bundle/chunk-j5z95b6f.js +3 -0
  176. package/bundle/{chunk-52xvhxek.js → chunk-j7637cwg.js} +2 -2
  177. package/bundle/{chunk-rwnwjm82.js → chunk-jbcqhw3x.js} +2 -2
  178. package/bundle/{chunk-maa21rh9.js → chunk-je8fcsa9.js} +1 -1
  179. package/bundle/{chunk-y0h3jfkj.js → chunk-jt6bvxtr.js} +1 -1
  180. package/bundle/chunk-jv37ghev.js +2 -0
  181. package/bundle/chunk-k10rtgsk.js +5 -0
  182. package/bundle/chunk-k3hcb6qf.js +2 -0
  183. package/bundle/chunk-k5d822n2.js +3 -0
  184. package/bundle/{chunk-2vaphpz0.js → chunk-kc8n5cgb.js} +1 -1
  185. package/bundle/chunk-kcqeh1e5.js +2 -0
  186. package/bundle/{chunk-5xkp27b1.js → chunk-kds2g7r2.js} +1 -1
  187. package/bundle/{chunk-scnbt714.js → chunk-kec1xw1n.js} +1 -1
  188. package/bundle/{chunk-13jq2ygc.js → chunk-kk850sdw.js} +2 -2
  189. package/bundle/{chunk-3bb4aqh9.js → chunk-m01h6kk1.js} +1 -1
  190. package/bundle/{chunk-e0hha3be.js → chunk-m4j6t713.js} +1 -1
  191. package/bundle/chunk-m8ytbq04.js +2 -0
  192. package/bundle/chunk-mf9nc4xz.js +2 -0
  193. package/bundle/{chunk-7thhd7ds.js → chunk-mmqyter3.js} +1 -1
  194. package/bundle/{chunk-y31f8k5f.js → chunk-mn0pshpv.js} +1 -1
  195. package/bundle/{chunk-s2tc3qs0.js → chunk-mn5cacf6.js} +2 -2
  196. package/bundle/{chunk-0egrckx0.js → chunk-mp1x10t5.js} +2 -2
  197. package/bundle/chunk-mxby91bj.js +2 -0
  198. package/bundle/chunk-mzv1gh6f.js +2 -0
  199. package/bundle/chunk-n0hsvvw8.js +2 -0
  200. package/bundle/{chunk-az3nss5m.js → chunk-ngyv4fhn.js} +2 -2
  201. package/bundle/{chunk-g9nwqwqp.js → chunk-nh4zk07t.js} +1 -1
  202. package/bundle/{chunk-8jmb5bd4.js → chunk-nk5vrenn.js} +2 -2
  203. package/bundle/chunk-nm1v9z14.js +2 -0
  204. package/bundle/chunk-nnkfdhh9.js +2 -0
  205. package/bundle/{chunk-jqj1ay7x.js → chunk-npdgfqaw.js} +1 -1
  206. package/bundle/{chunk-p2fte9vz.js → chunk-nq4x6792.js} +2 -2
  207. package/bundle/{chunk-wr6rnxr5.js → chunk-nqk8d62j.js} +1 -1
  208. package/bundle/{chunk-7jy53zqy.js → chunk-p506eydh.js} +1 -1
  209. package/bundle/{chunk-phpxxd48.js → chunk-p6jf1fyt.js} +1 -1
  210. package/bundle/chunk-p7nstcxa.js +2 -0
  211. package/bundle/{chunk-6ps30qax.js → chunk-pbanj1gk.js} +2 -2
  212. package/bundle/{chunk-vph4w4yy.js → chunk-pchv413c.js} +2 -2
  213. package/bundle/{chunk-qsme16gk.js → chunk-pf2vq6t1.js} +2 -2
  214. package/bundle/chunk-pfwkvv7g.js +2 -0
  215. package/bundle/{chunk-ntr0ezf2.js → chunk-pky8h8rh.js} +1 -1
  216. package/bundle/chunk-pn1jz8qj.js +2 -0
  217. package/bundle/chunk-pqvmtfk7.js +2 -0
  218. package/bundle/chunk-prgw26g3.js +2 -0
  219. package/bundle/{chunk-kckr30tf.js → chunk-psqtptrs.js} +1 -1
  220. package/bundle/chunk-pv9ty6v7.js +2 -0
  221. package/bundle/{chunk-060wbpz4.js → chunk-pwsajn96.js} +1 -1
  222. package/bundle/{chunk-vgt3artc.js → chunk-pxm0x3e0.js} +1 -1
  223. package/bundle/chunk-pyf649pz.js +2 -0
  224. package/bundle/{chunk-wd8f9r4k.js → chunk-q0xgxygw.js} +1 -1
  225. package/bundle/{chunk-rye1yjnr.js → chunk-q26s0wb5.js} +1 -1
  226. package/bundle/{chunk-a48mx917.js → chunk-q4mtwv1w.js} +2 -2
  227. package/bundle/chunk-q4rstre7.js +2 -0
  228. package/bundle/chunk-q6jk2v6g.js +2 -0
  229. package/bundle/{chunk-5wx962mw.js → chunk-q7s6z0nz.js} +1 -1
  230. package/bundle/{chunk-jmmtcr2r.js → chunk-q8fjktv4.js} +1 -1
  231. package/bundle/{chunk-m7tmgvh6.js → chunk-qbewhcsz.js} +1 -1
  232. package/bundle/chunk-qd43npx3.js +2 -0
  233. package/bundle/{chunk-ydgst3h8.js → chunk-qdafm7qg.js} +2 -2
  234. package/bundle/chunk-qdb21y83.js +2 -0
  235. package/bundle/{chunk-72crs18f.js → chunk-qdbx1qkr.js} +1 -1
  236. package/bundle/{chunk-6vnqbejg.js → chunk-qdh2dm62.js} +1 -1
  237. package/bundle/chunk-qeksaefy.js +2 -0
  238. package/bundle/{chunk-qk1jkc0n.js → chunk-qjw2zcq5.js} +1 -1
  239. package/bundle/{chunk-dt3bsmfe.js → chunk-qm9fm5ja.js} +2 -2
  240. package/bundle/{chunk-h8mfbbjh.js → chunk-qq9yc2tp.js} +2 -2
  241. package/bundle/{chunk-0tcggtwv.js → chunk-qtyapmy7.js} +1 -1
  242. package/bundle/{chunk-c987bemn.js → chunk-qyan69nb.js} +1 -1
  243. package/bundle/chunk-r7t9yb9d.js +2 -0
  244. package/bundle/{chunk-6tqbnxar.js → chunk-r81w6skn.js} +1 -1
  245. package/bundle/{chunk-f4mnp6xd.js → chunk-rk21wv4k.js} +1 -1
  246. package/bundle/{chunk-ccf4pgkr.js → chunk-rpdgn9z3.js} +2 -2
  247. package/bundle/chunk-rxnd79h7.js +7 -0
  248. package/bundle/chunk-s05hqtx1.js +3 -0
  249. package/bundle/chunk-s27cz24e.js +808 -0
  250. package/bundle/chunk-sdv3a4w3.js +2 -0
  251. package/bundle/{chunk-zwhmg9dj.js → chunk-se8d5xg9.js} +1 -1
  252. package/bundle/chunk-sk89becn.js +2 -0
  253. package/bundle/{chunk-sz0favtz.js → chunk-snf6ahg7.js} +1 -1
  254. package/bundle/{chunk-dgcannw0.js → chunk-t2r51r6v.js} +1 -1
  255. package/bundle/{chunk-rva2ekrt.js → chunk-t5wdstzv.js} +1 -1
  256. package/bundle/{chunk-vkkz40je.js → chunk-t9pq363q.js} +2 -2
  257. package/bundle/chunk-tc0996xz.js +2 -0
  258. package/bundle/chunk-td9hm9be.js +2 -0
  259. package/bundle/{chunk-xy8arehp.js → chunk-tdevq564.js} +1 -1
  260. package/bundle/chunk-te91d271.js +2 -0
  261. package/bundle/chunk-tfs50mgj.js +2 -0
  262. package/bundle/{chunk-5cw8235e.js → chunk-tg1f56s3.js} +1 -1
  263. package/bundle/chunk-thecq33z.js +3 -0
  264. package/bundle/{chunk-f2v4g7t1.js → chunk-tjfer79w.js} +1 -1
  265. package/bundle/chunk-tjvtp9d9.js +2 -0
  266. package/bundle/chunk-tkm9m3n0.js +2 -0
  267. package/bundle/{chunk-ynf17943.js → chunk-tm79yrf3.js} +2 -2
  268. package/bundle/{chunk-fv5mrdyc.js → chunk-v03xq38e.js} +2 -2
  269. package/bundle/chunk-v0hnn7nb.js +2 -0
  270. package/bundle/{chunk-ftvvm4r5.js → chunk-v16n1fep.js} +2 -2
  271. package/bundle/chunk-v1s1rcqx.js +2 -0
  272. package/bundle/chunk-v4dt4062.js +2 -0
  273. package/bundle/{chunk-makegrxs.js → chunk-v8bxj01h.js} +1 -1
  274. package/bundle/{chunk-ryrxgn6d.js → chunk-v8rqgt7h.js} +1 -1
  275. package/bundle/{chunk-m4r8sepw.js → chunk-vbb1jg02.js} +1 -1
  276. package/bundle/{chunk-2kh0tg92.js → chunk-vbfc0wgv.js} +2 -2
  277. package/bundle/{chunk-d839fr0w.js → chunk-vjt6mh10.js} +2 -2
  278. package/bundle/{chunk-gsg6zn7e.js → chunk-vk35g121.js} +2 -2
  279. package/bundle/{chunk-dwkrqtbc.js → chunk-vsfj16v9.js} +2 -2
  280. package/bundle/{chunk-zqdjk4rf.js → chunk-vy93mn7d.js} +2 -2
  281. package/bundle/{chunk-1har4t9a.js → chunk-waa781eh.js} +1 -1
  282. package/bundle/{chunk-wb47k8ah.js → chunk-wbt31xap.js} +2 -2
  283. package/bundle/{chunk-0tm6589k.js → chunk-wd2xmkdp.js} +2 -2
  284. package/bundle/{chunk-fej5x648.js → chunk-wecs14rz.js} +1 -1
  285. package/bundle/chunk-wgrq86kd.js +2 -0
  286. package/bundle/{chunk-4y9wbfd2.js → chunk-wh2qqhep.js} +2 -2
  287. package/bundle/{chunk-g878zd6e.js → chunk-x0hhw46n.js} +1 -1
  288. package/bundle/{chunk-w7a33cwa.js → chunk-x308f9j4.js} +2 -2
  289. package/bundle/{chunk-y3gy62q5.js → chunk-x50adh71.js} +1 -1
  290. package/bundle/chunk-x8ks2bn7.js +2 -0
  291. package/bundle/{chunk-s5aefff0.js → chunk-xcmbxny8.js} +1 -1
  292. package/bundle/{chunk-rmsqb6r4.js → chunk-xgf4k9q7.js} +1 -1
  293. package/bundle/{chunk-2caaqmec.js → chunk-xj0zc9za.js} +1 -1
  294. package/bundle/{chunk-27saej0r.js → chunk-xnxw5zz9.js} +2 -2
  295. package/bundle/{chunk-fjftb2sz.js → chunk-xqwk2zsx.js} +2 -2
  296. package/bundle/{chunk-d30k7dpf.js → chunk-xstxdw7v.js} +1 -1
  297. package/bundle/{chunk-dwqvcdmf.js → chunk-xv03hbgj.js} +1 -1
  298. package/bundle/{chunk-bwadggys.js → chunk-xvvt886p.js} +2 -2
  299. package/bundle/{chunk-bnw744ej.js → chunk-xy2ty5h5.js} +2 -2
  300. package/bundle/{chunk-wm9nh9nb.js → chunk-yce8ph5b.js} +2 -2
  301. package/bundle/{chunk-fh3d0wce.js → chunk-yexzxx6f.js} +1 -1
  302. package/bundle/{chunk-eyr5ymt8.js → chunk-yh1t6jrj.js} +1 -1
  303. package/bundle/chunk-yspstxkq.js +2 -0
  304. package/bundle/{chunk-ykpj10nz.js → chunk-yydqavgh.js} +2 -2
  305. package/bundle/{chunk-k3m7jfdh.js → chunk-yzd6cyep.js} +1 -1
  306. package/bundle/chunk-z023h7t8.js +2 -0
  307. package/bundle/chunk-z0383stv.js +2 -0
  308. package/bundle/{chunk-vbfej8ds.js → chunk-z0m1qm7j.js} +2 -2
  309. package/bundle/{chunk-bpfq8fz4.js → chunk-z69tt390.js} +1 -1
  310. package/bundle/chunk-zewrmk8x.js +2 -0
  311. package/bundle/{chunk-29gwtcey.js → chunk-zfqgh9h7.js} +1 -1
  312. package/bundle/{chunk-h1bvqstw.js → chunk-zskdxbbh.js} +1 -1
  313. package/bundle/{chunk-kveztc6k.js → chunk-ztvkzex1.js} +1 -1
  314. package/bundle/index.js +3 -3
  315. package/bundle/parser.worker.js +2 -2
  316. package/bundle/worker.js +1 -1
  317. package/package.json +1 -1
  318. package/bundle/chunk-03zpnwk2.js +0 -2
  319. package/bundle/chunk-0aqdzyar.js +0 -2
  320. package/bundle/chunk-0eh3yc6e.js +0 -2
  321. package/bundle/chunk-0mh600tv.js +0 -2
  322. package/bundle/chunk-1a6q1f5n.js +0 -7
  323. package/bundle/chunk-2a5gjgvp.js +0 -2
  324. package/bundle/chunk-2phyc1c0.js +0 -2
  325. package/bundle/chunk-2pkfphgb.js +0 -2
  326. package/bundle/chunk-30wp95w1.js +0 -2
  327. package/bundle/chunk-32fpqd0n.js +0 -2
  328. package/bundle/chunk-3f2cjzb4.js +0 -2
  329. package/bundle/chunk-3qvap1kv.js +0 -2
  330. package/bundle/chunk-42hvspe7.js +0 -2
  331. package/bundle/chunk-452tk6v3.js +0 -2
  332. package/bundle/chunk-4gqb1hps.js +0 -2
  333. package/bundle/chunk-50qgz5ka.js +0 -2
  334. package/bundle/chunk-539cw9r0.js +0 -2
  335. package/bundle/chunk-5b0xyq5z.js +0 -2
  336. package/bundle/chunk-5j4nxpdy.js +0 -2
  337. package/bundle/chunk-5nxgk6hw.js +0 -2
  338. package/bundle/chunk-5qkvhr6y.js +0 -2
  339. package/bundle/chunk-6dpdkzrk.js +0 -2
  340. package/bundle/chunk-6p6m5956.js +0 -3
  341. package/bundle/chunk-705qkpra.js +0 -28
  342. package/bundle/chunk-76c400ze.js +0 -2
  343. package/bundle/chunk-7bxxc4a3.js +0 -2
  344. package/bundle/chunk-7g59hc61.js +0 -2
  345. package/bundle/chunk-7p88j56s.js +0 -2
  346. package/bundle/chunk-7r92d7v9.js +0 -14
  347. package/bundle/chunk-7trngc9g.js +0 -2
  348. package/bundle/chunk-8cebbmtf.js +0 -2
  349. package/bundle/chunk-8j1xcdmd.js +0 -2
  350. package/bundle/chunk-90r2z49k.js +0 -2
  351. package/bundle/chunk-94mjwy22.js +0 -2
  352. package/bundle/chunk-9bw6bx5c.js +0 -2
  353. package/bundle/chunk-aenrd7dk.js +0 -2
  354. package/bundle/chunk-ahmy80vb.js +0 -2
  355. package/bundle/chunk-avn12jkt.js +0 -2
  356. package/bundle/chunk-brk6bge4.js +0 -3
  357. package/bundle/chunk-ce5e7j62.js +0 -2
  358. package/bundle/chunk-cw1gwjx9.js +0 -2
  359. package/bundle/chunk-czw30fjs.js +0 -2
  360. package/bundle/chunk-dtcvqrmn.js +0 -2
  361. package/bundle/chunk-dwhsvpag.js +0 -2
  362. package/bundle/chunk-e0hfpdje.js +0 -2
  363. package/bundle/chunk-e5jk67xh.js +0 -2
  364. package/bundle/chunk-eg4pq4hv.js +0 -2
  365. package/bundle/chunk-ew3yz97p.js +0 -2
  366. package/bundle/chunk-f2yfyhh8.js +0 -2
  367. package/bundle/chunk-fd8x2nb4.js +0 -2
  368. package/bundle/chunk-fveaq0pb.js +0 -2
  369. package/bundle/chunk-gbvm6dpv.js +0 -2
  370. package/bundle/chunk-gkbx6edf.js +0 -2
  371. package/bundle/chunk-gq9hb2e8.js +0 -2
  372. package/bundle/chunk-gswhjd1h.js +0 -3
  373. package/bundle/chunk-h5w91zr4.js +0 -2
  374. package/bundle/chunk-hmpb3c21.js +0 -2
  375. package/bundle/chunk-hq7s4f75.js +0 -2
  376. package/bundle/chunk-j1h64m65.js +0 -2
  377. package/bundle/chunk-j32rr7rt.js +0 -2
  378. package/bundle/chunk-j871xzr7.js +0 -2
  379. package/bundle/chunk-k1qd8ecm.js +0 -808
  380. package/bundle/chunk-kx88qekb.js +0 -2
  381. package/bundle/chunk-m4g4djss.js +0 -2
  382. package/bundle/chunk-mt2by7rx.js +0 -3
  383. package/bundle/chunk-mwkms65j.js +0 -3
  384. package/bundle/chunk-n61e0znt.js +0 -2
  385. package/bundle/chunk-ndd4cn3z.js +0 -2
  386. package/bundle/chunk-nr2j8ytn.js +0 -3
  387. package/bundle/chunk-nsw5x43k.js +0 -2
  388. package/bundle/chunk-p5b5ekhh.js +0 -2
  389. package/bundle/chunk-pf23nw4z.js +0 -2
  390. package/bundle/chunk-pw3cv89g.js +0 -2
  391. package/bundle/chunk-qwmae3vk.js +0 -5
  392. package/bundle/chunk-rdk62809.js +0 -2
  393. package/bundle/chunk-rew6r516.js +0 -2
  394. package/bundle/chunk-rjcz4kbm.js +0 -2
  395. package/bundle/chunk-skgr9ypq.js +0 -2
  396. package/bundle/chunk-sv40pwe2.js +0 -2
  397. package/bundle/chunk-tax3ecy5.js +0 -2
  398. package/bundle/chunk-tfhpjmny.js +0 -2
  399. package/bundle/chunk-tnete6ye.js +0 -2
  400. package/bundle/chunk-tpyq7ycb.js +0 -2
  401. package/bundle/chunk-tr0rm1ka.js +0 -2
  402. package/bundle/chunk-ty14zznd.js +0 -2
  403. package/bundle/chunk-v5h5wxw5.js +0 -2
  404. package/bundle/chunk-v6141yq1.js +0 -2
  405. package/bundle/chunk-vjs69r6x.js +0 -2
  406. package/bundle/chunk-vmhar83s.js +0 -2
  407. package/bundle/chunk-vpjyk76v.js +0 -2
  408. package/bundle/chunk-vqvnw12p.js +0 -2
  409. package/bundle/chunk-w0sztk4y.js +0 -2
  410. package/bundle/chunk-w6bb320d.js +0 -2
  411. package/bundle/chunk-wqw6yjrg.js +0 -2
  412. package/bundle/chunk-ws08rxge.js +0 -2
  413. package/bundle/chunk-wwvek9zf.js +0 -3
  414. package/bundle/chunk-wz3dvc3g.js +0 -2
  415. package/bundle/chunk-x2pmqvdc.js +0 -2
  416. package/bundle/chunk-x4wfq39v.js +0 -2
  417. package/bundle/chunk-x7a3kqe5.js +0 -2
  418. package/bundle/chunk-xb22grz6.js +0 -2
  419. package/bundle/chunk-y3eeva80.js +0 -2
  420. package/bundle/chunk-yb6m08zj.js +0 -2
  421. package/bundle/chunk-ybcqkgs7.js +0 -2
  422. package/bundle/chunk-zj1jc1xt.js +0 -2
  423. package/bundle/chunk-zm0m0504.js +0 -2
  424. package/bundle/chunk-zq32jhj1.js +0 -2
  425. package/bundle/chunk-zxwjxszn.js +0 -2
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Qd as b}from"./chunk-vkkz40je.js";import{be as f}from"./chunk-f4mnp6xd.js";import{Ch as S}from"./chunk-1acn5me8.js";import"./chunk-vs3s49jw.js";import"./chunk-kre93a89.js";import"./chunk-060wbpz4.js";import"./chunk-zrhw1szj.js";import"./chunk-t8fjgkp8.js";import"./chunk-0egrckx0.js";import{dl as v}from"./chunk-k1qd8ecm.js";import"./chunk-bhg69t69.js";import{El as R,Ol as k,wl as U}from"./chunk-fv5mrdyc.js";import"./chunk-rdreeyv0.js";import"./chunk-rmsqb6r4.js";import"./chunk-7pckez5z.js";import"./chunk-k6981ysw.js";import"./chunk-sa0rrreh.js";import"./chunk-ydgst3h8.js";import"./chunk-6tqbnxar.js";import"./chunk-0w19vmd7.js";import"./chunk-eewe7tx1.js";import"./chunk-4y9wbfd2.js";import"./chunk-wm9nh9nb.js";import"./chunk-scnbt714.js";import"./chunk-cqtkxwd8.js";import"./chunk-y3gy62q5.js";import"./chunk-az3nss5m.js";import"./chunk-p2fte9vz.js";import"./chunk-ggncq8w8.js";import"./chunk-t3w43rft.js";import"./chunk-eacpc64g.js";import"./chunk-27saej0r.js";import"./chunk-b5ym419d.js";import"./chunk-29q89bge.js";import"./chunk-wqk1v8t0.js";import{Fr as Z}from"./chunk-rwwvy89t.js";import"./chunk-z0kbyr00.js";import"./chunk-sbjymf20.js";import"./chunk-dt3bsmfe.js";import"./chunk-vbfej8ds.js";import"./chunk-0tm6589k.js";import"./chunk-fveaq0pb.js";import"./chunk-gswhjd1h.js";import"./chunk-wgkcyqn1.js";import"./chunk-59csnjc3.js";import"./chunk-1bxfzd6r.js";import"./chunk-6p6m5956.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-w7a33cwa.js";import"./chunk-g7v6sp3c.js";import"./chunk-s2tc3qs0.js";import"./chunk-n6tqtk6h.js";import"./chunk-e0vrxetq.js";var i=f({command:"stats",describe:"show token usage and cost statistics",builder:(z)=>{return z.option("days",{describe:"show stats for the last N days (default: all time)",type:"number"}).option("tools",{describe:"number of tools to show (default: all)",type:"number"}).option("models",{describe:"show model statistics (default: hidden). Pass a number to show top N, otherwise shows all"}).option("project",{describe:"filter by project (default: all projects, empty string: current project)",type:"string"})},handler:async(z)=>{await b(process.cwd(),async()=>{let E=await y(z.days,z.project),_;if(z.models===!0)_=1/0;else if(typeof z.models==="number")_=z.models;u(E,z.tools,_)})}});async function w(){return k.project}async function p(){return R.use((E)=>E.select().from(U).all()).map((E)=>v.fromRow(E))}async function y(z,E){let _=await p(),L=86400000,J=(()=>{if(z===void 0)return 0;if(z===0){let V=new Date;return V.setHours(0,0,0,0),V.getTime()}return Date.now()-z*86400000})(),K=(()=>{if(z===void 0)return;if(z===0)return 1;return z})(),Y=J>0?_.filter((V)=>V.time.updated>=J):_;if(E!==void 0)if(E===""){let V=await w();Y=Y.filter((F)=>F.projectID===V.id)}else Y=Y.filter((V)=>V.projectID===E);let G={totalSessions:Y.length,totalMessages:0,totalCost:0,totalTokens:{input:0,output:0,reasoning:0,cache:{read:0,write:0}},toolUsage:{},modelUsage:{},dateRange:{earliest:Date.now(),latest:Date.now()},days:0,costPerDay:0,tokensPerSession:0,medianTokensPerSession:0};if(Y.length>1000)console.log(`Large dataset detected (${Y.length} sessions). This may take a while...`);if(Y.length===0)return G.days=K??0,G;let C=Date.now(),x=0,X=[],h=20;for(let V=0;V<Y.length;V+=h){let D=Y.slice(V,V+h).map(async(Q)=>{let W=await S.runPromise(v.Service.use((O)=>O.messages({sessionID:Q.id,agentID:"*"}))),N=0,H={input:0,output:0,reasoning:0,cache:{read:0,write:0}},j={},A={};for(let O of W){if(O.info.role==="assistant"){N+=O.info.cost||0;let B=`${O.info.providerID}/${O.info.modelID}`;if(!A[B])A[B]={messages:0,tokens:{input:0,output:0,cache:{read:0,write:0}},cost:0};if(A[B].messages++,A[B].cost+=O.info.cost||0,O.info.tokens)H.input+=O.info.tokens.input||0,H.output+=O.info.tokens.output||0,H.reasoning+=O.info.tokens.reasoning||0,H.cache.read+=O.info.tokens.cache?.read||0,H.cache.write+=O.info.tokens.cache?.write||0,A[B].tokens.input+=O.info.tokens.input||0,A[B].tokens.output+=(O.info.tokens.output||0)+(O.info.tokens.reasoning||0),A[B].tokens.cache.read+=O.info.tokens.cache?.read||0,A[B].tokens.cache.write+=O.info.tokens.cache?.write||0}for(let B of O.parts)if(B.type==="tool"&&B.tool)j[B.tool]=(j[B.tool]||0)+1}return{messageCount:W.length,sessionCost:N,sessionTokens:H,sessionTotalTokens:H.input+H.output+H.reasoning+H.cache.read+H.cache.write,sessionToolUsage:j,sessionModelUsage:A,earliestTime:J>0?Q.time.updated:Q.time.created,latestTime:Q.time.updated}}),M=await Promise.all(D);for(let Q of M){C=Math.min(C,Q.earliestTime),x=Math.max(x,Q.latestTime),X.push(Q.sessionTotalTokens),G.totalMessages+=Q.messageCount,G.totalCost+=Q.sessionCost,G.totalTokens.input+=Q.sessionTokens.input,G.totalTokens.output+=Q.sessionTokens.output,G.totalTokens.reasoning+=Q.sessionTokens.reasoning,G.totalTokens.cache.read+=Q.sessionTokens.cache.read,G.totalTokens.cache.write+=Q.sessionTokens.cache.write;for(let[W,N]of Object.entries(Q.sessionToolUsage))G.toolUsage[W]=(G.toolUsage[W]||0)+N;for(let[W,N]of Object.entries(Q.sessionModelUsage)){if(!G.modelUsage[W])G.modelUsage[W]={messages:0,tokens:{input:0,output:0,cache:{read:0,write:0}},cost:0};G.modelUsage[W].messages+=N.messages,G.modelUsage[W].tokens.input+=N.tokens.input,G.modelUsage[W].tokens.output+=N.tokens.output,G.modelUsage[W].tokens.cache.read+=N.tokens.cache.read,G.modelUsage[W].tokens.cache.write+=N.tokens.cache.write,G.modelUsage[W].cost+=N.cost}}}let $=Math.max(1,Math.ceil((x-C)/86400000)),q=K??$;G.dateRange={earliest:C,latest:x},G.days=q,G.costPerDay=G.totalCost/q;let I=G.totalTokens.input+G.totalTokens.output+G.totalTokens.reasoning+G.totalTokens.cache.read+G.totalTokens.cache.write;G.tokensPerSession=Y.length>0?I/Y.length:0,X.sort((V,F)=>V-F);let P=Math.floor(X.length/2);return G.medianTokensPerSession=X.length===0?0:X.length%2===0?(X[P-1]+X[P])/2:X[P],G}function u(z,E,_){function J(x,X){let $=55-x.length-X.length,q=Math.max(0,$);return`\u2502${x}${" ".repeat(q)}${X} \u2502`}console.log("\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"),console.log("\u2502 OVERVIEW \u2502"),console.log("\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524"),console.log(J("Sessions",z.totalSessions.toLocaleString())),console.log(J("Messages",z.totalMessages.toLocaleString())),console.log(J("Days",z.days.toString())),console.log("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"),console.log(),console.log("\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"),console.log("\u2502 COST & TOKENS \u2502"),console.log("\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");let K=isNaN(z.totalCost)?0:z.totalCost,Y=isNaN(z.costPerDay)?0:z.costPerDay,G=isNaN(z.tokensPerSession)?0:z.tokensPerSession;console.log(J("Total Cost",`$${K.toFixed(2)}`)),console.log(J("Avg Cost/Day",`$${Y.toFixed(2)}`)),console.log(J("Avg Tokens/Session",Z.number(Math.round(G))));let C=isNaN(z.medianTokensPerSession)?0:z.medianTokensPerSession;if(console.log(J("Median Tokens/Session",Z.number(Math.round(C)))),console.log(J("Input",Z.number(z.totalTokens.input))),console.log(J("Output",Z.number(z.totalTokens.output))),console.log(J("Cache Read",Z.number(z.totalTokens.cache.read))),console.log(J("Cache Write",Z.number(z.totalTokens.cache.write))),console.log("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"),console.log(),_!==void 0&&Object.keys(z.modelUsage).length>0){let x=Object.entries(z.modelUsage).sort(([,h],[,$])=>$.messages-h.messages),X=_===1/0?x:x.slice(0,_);console.log("\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"),console.log("\u2502 MODEL USAGE \u2502"),console.log("\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");for(let[h,$]of X)console.log(`\u2502 ${h.padEnd(54)} \u2502`),console.log(J(" Messages",$.messages.toLocaleString())),console.log(J(" Input Tokens",Z.number($.tokens.input))),console.log(J(" Output Tokens",Z.number($.tokens.output))),console.log(J(" Cache Read",Z.number($.tokens.cache.read))),console.log(J(" Cache Write",Z.number($.tokens.cache.write))),console.log(J(" Cost",`$${$.cost.toFixed(4)}`)),console.log("\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");process.stdout.write("\x1B[1A"),console.log("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518")}if(console.log(),Object.keys(z.toolUsage).length>0){let x=Object.entries(z.toolUsage).sort(([,q],[,I])=>I-q),X=E?x.slice(0,E):x;console.log("\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"),console.log("\u2502 TOOL USAGE \u2502"),console.log("\u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524");let h=Math.max(...X.map(([,q])=>q)),$=Object.values(z.toolUsage).reduce((q,I)=>q+I,0);for(let[q,I]of X){let P=Math.max(1,Math.floor(I/h*20)),V="\u2588".repeat(P),F=(I/$*100).toFixed(1),D=18,W=` ${(q.length>18?q.substring(0,16)+"..":q).padEnd(18)} ${V.padEnd(20)} ${I.toString().padStart(3)} (${F.padStart(4)}%)`,N=Math.max(0,56-W.length-1);console.log(`\u2502${W}${" ".repeat(N)} \u2502`)}console.log("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518")}console.log()}export{u as displayStats,y as aggregateSessionStats,i as StatsCommand};
@@ -1,7 +0,0 @@
1
- // @bun
2
- import{T as I}from"./chunk-gbkz04ke.js";import{U as i,W as r}from"./chunk-c987bemn.js";import{Id as c}from"./chunk-0ffmwhw7.js";import{Jd as g}from"./chunk-eyr5ymt8.js";import{Kd as y}from"./chunk-y0h3jfkj.js";import{Ld as k}from"./chunk-1rgt2vmt.js";import{Md as A}from"./chunk-rk0fnvp5.js";import{$d as P,Rd as w,Sd as u,Ud as W,Vd as L,Wd as T,Yd as p,Zd as o,_d as b}from"./chunk-2kh0tg92.js";import"./chunk-52xvhxek.js";import{be as z}from"./chunk-f4mnp6xd.js";import{eg as Y}from"./chunk-bwadggys.js";import{Ch as M}from"./chunk-1acn5me8.js";import"./chunk-vs3s49jw.js";import"./chunk-kre93a89.js";import"./chunk-060wbpz4.js";import"./chunk-zrhw1szj.js";import"./chunk-t8fjgkp8.js";import"./chunk-0egrckx0.js";import{Rk as a,el as s,yj as R}from"./chunk-k1qd8ecm.js";import{ql as V}from"./chunk-bhg69t69.js";import{Ol as n}from"./chunk-fv5mrdyc.js";import"./chunk-rdreeyv0.js";import"./chunk-rmsqb6r4.js";import"./chunk-7pckez5z.js";import"./chunk-k6981ysw.js";import"./chunk-sa0rrreh.js";import"./chunk-ydgst3h8.js";import"./chunk-6tqbnxar.js";import"./chunk-0w19vmd7.js";import"./chunk-eewe7tx1.js";import"./chunk-4y9wbfd2.js";import"./chunk-wm9nh9nb.js";import"./chunk-scnbt714.js";import"./chunk-cqtkxwd8.js";import"./chunk-y3gy62q5.js";import"./chunk-az3nss5m.js";import"./chunk-p2fte9vz.js";import"./chunk-ggncq8w8.js";import"./chunk-t3w43rft.js";import"./chunk-eacpc64g.js";import"./chunk-27saej0r.js";import"./chunk-b5ym419d.js";import"./chunk-29q89bge.js";import"./chunk-wqk1v8t0.js";import"./chunk-rwwvy89t.js";import{Or as l}from"./chunk-z0kbyr00.js";import"./chunk-sbjymf20.js";import"./chunk-dt3bsmfe.js";import"./chunk-vbfej8ds.js";import"./chunk-0tm6589k.js";import"./chunk-fveaq0pb.js";import{ls as d}from"./chunk-gswhjd1h.js";import"./chunk-wgkcyqn1.js";import"./chunk-59csnjc3.js";import{lt as v}from"./chunk-1bxfzd6r.js";import"./chunk-6p6m5956.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-w7a33cwa.js";import{fH as O}from"./chunk-g7v6sp3c.js";import"./chunk-s2tc3qs0.js";import"./chunk-n6tqtk6h.js";import{xO as H1}from"./chunk-e0vrxetq.js";import f from"path";import{pathToFileURL as J1}from"url";import Q1 from"os";import{access as S1,readdir as X1}from"fs/promises";var q1={en:A,zh:k,ja:c,fr:y,ru:g},B1=q1[I()]??A;function U($,B){let J=B1[$]??A[$]??$;if(!B)return J;return J.replace(/\{(\w+)\}/g,(X,H)=>(H in B)?String(B[H]):`{${H}}`)}import{text as Z1}from"stream/consumers";var D=($,B)=>M.runPromise(O.gen(function*(){yield*(yield*R.Service).set($,B)}));async function t(){let $=await p({message:"Enter your API key",validate:(B)=>B&&B.length>0?void 0:"Required"});if(w($))throw new Y.CancelledError;return $}async function h($,B){let J=$.provider??B;if("refresh"in $){let{type:X,provider:H,refresh:Z,access:j,expires:q,metadata:S,...G}=$;await D(J,{type:"oauth",refresh:Z,access:j,expires:q,...G})}if("key"in $)await D(J,{type:"api",key:$.key,...$.metadata?{metadata:$.metadata}:{}})}async function x($,B,J){let X=0;if(J){let j=$.auth.methods.findIndex((q)=>q.label.toLowerCase()===J.toLowerCase());if(j===-1)W.error(`Unknown method "${J}" for ${B}. Available: ${$.auth.methods.map((q)=>q.label).join(", ")}`),process.exit(1);X=j}else if($.auth.methods.length>1){let j=await b({message:"Login method",options:$.auth.methods.map((q,S)=>({label:q.label,value:S.toString()}))});if(w(j))throw new Y.CancelledError;X=parseInt(j)}let H=$.auth.methods[X];await new Promise((j)=>setTimeout(j,10));let Z={};if(H.prompts)for(let j of H.prompts){if(j.when){let q=Z[j.when.key];if(q===void 0)continue;if(!(j.when.op==="eq"?q===j.when.value:q!==j.when.value))continue}if(j.condition&&!j.condition(Z))continue;if(j.type==="select"){let q=await b({message:j.message,options:j.options});if(w(q))throw new Y.CancelledError;Z[j.key]=q}else{let q=await P({message:j.message,placeholder:j.placeholder,validate:j.validate?(S)=>j.validate(S??""):void 0});if(w(q))throw new Y.CancelledError;Z[j.key]=q}}if(H.type==="oauth"){let j=await H.authorize(Z);if(j.url)W.info("Go to: "+j.url);if(j.method==="auto"){if(j.instructions)W.info(j.instructions);let q=o();q.start("Waiting for authorization...");let S=await j.callback();if(S.type==="failed")q.stop("Failed to authorize",1);if(S.type==="success")await h(S,B),q.stop("Login successful")}if(j.method==="code"){let q=await P({message:"Paste the authorization code here: ",validate:(G)=>G&&G.length>0?void 0:"Required"});if(w(q))throw new Y.CancelledError;let S=await j.callback(q);if(S.type==="failed")W.error("Failed to authorize");if(S.type==="success")await h(S,B),W.success("Login successful")}return T("Done"),!0}if(H.type==="api"){if(H.authorize){let j=await t(),q=await H.authorize(Z);if(q.type==="failed")W.error("Failed to authorize");if(q.type==="success"){let S=q.provider??B;await D(S,{type:"api",key:q.key??j}),W.success("Login successful")}return T("Done"),!0}}return!1}function G1($){let B=new Set,J=[];for(let X of $.hooks){if(!X.auth)continue;let H=X.auth.provider;if(B.has(H))continue;if(B.add(H),Object.hasOwn($.existingProviders,H))continue;if($.disabled.has(H))continue;if($.enabled&&!$.enabled.has(H))continue;J.push({id:H,name:$.providerNames[H]??H})}return J}function m($){let B=$?.loginExtension;if(!B||typeof B!=="object")return;let J=B;if(typeof J.id!=="string"||typeof J.run!=="function")return;return J}async function W1(){try{let J=await import("./chunk-aenrd7dk.js");for(let X of Object.values(J.modules??{})){let H=m(X);if(H)return H}}catch{}let $=f.join(import.meta.dir,"..","..","ext");await S1($).catch(()=>{return});let B=await X1($).catch(()=>[]);for(let J of B.filter((X)=>X.endsWith(".ts")&&!X.endsWith(".d.ts")))try{let X=m(await import(J1(f.join($,J)).href));if(X)return X}catch{}return}var l1=z({command:"providers",aliases:["auth"],describe:"manage AI providers and credentials",builder:($)=>$.command(Y1).command(_1).command(F1).command(K1).demandCommand(),async handler(){}}),Y1=z({command:"list",aliases:["ls"],describe:"list providers and credentials",async handler($){Y.empty();let B=f.join(v.Path.data,"auth.json"),J=Q1.homedir(),X=B===J||B.startsWith(J+f.sep)?"~"+B.slice(J.length):B;L(`Credentials ${Y.Style.TEXT_DIM}${X}`);let H=await M.runPromise(O.gen(function*(){let q=yield*R.Service;return Object.entries(yield*q.all())})),Z=await V.get();for(let[q,S]of H){let G=Z[q]?.name||q;W.info(`${G} ${Y.Style.TEXT_DIM}${S.type}`)}T(`${H.length} credentials`);let j=[];for(let[q,S]of Object.entries(Z))for(let G of S.env)if(process.env[G])j.push({provider:S.name||q,envVar:G});if(j.length>0){Y.empty(),L("Environment");for(let{provider:q,envVar:S}of j)W.info(`${q} ${Y.Style.TEXT_DIM}${S}`);T(`${j.length} environment variable`+(j.length===1?"":"s"))}}}),_1=z({command:"login [url]",describe:"log in to a provider",builder:($)=>$.positional("url",{describe:"qitqode auth provider",type:"string"}).option("provider",{alias:["p"],describe:"provider id or name to log in to (skips provider selection)",type:"string"}).option("method",{alias:["m"],describe:"login method label (skips method selection)",type:"string"}),async handler($){await n.provide({directory:process.cwd(),async fn(){if(Y.empty(),L("Add credential"),$.url){let Q=$.url.replace(/\/+$/,""),_=await fetch(`${Q}/.well-known/opencode`).then((j1)=>j1.json());W.info(`Running \`${_.auth.command.join(" ")}\``);let F=l.spawn(_.auth.command,{stdout:"pipe"});if(!F.stdout){W.error("Failed"),T("Done");return}let[C,N]=await Promise.all([F.exited,Z1(F.stdout)]);if(C!==0){W.error("Failed"),T("Done");return}await D(Q,{type:"wellknown",key:_.auth.env,token:N.trim()}),W.success("Logged into "+Q),T("Done");return}await V.refresh(!0).catch(()=>{});let B=await M.runPromise(s.Service.use((Q)=>Q.get())),J=new Set(B.disabled_providers??[]),X=B.enabled_providers?new Set(B.enabled_providers):void 0,H=await V.get().then((Q)=>{let _={};for(let[F,C]of Object.entries(Q))if((X?X.has(F):!0)&&!J.has(F))_[F]=C;return _}),Z=await M.runPromise(O.gen(function*(){return yield*(yield*a.Service).list()})),j=i,q=G1({hooks:Z,existingProviders:H,disabled:J,enabled:X,providerNames:Object.fromEntries(Object.entries(B.provider??{}).map(([Q,_])=>[Q,_.name]))}),S=[...r(d(H),j,(Q)=>({openai:"ChatGPT Plus/Pro or API key"})[Q.id]),...q.map((Q)=>({label:Q.name,value:Q.id,hint:"plugin"}))],G=await W1(),e=G?[G.id,...G.aliases??[]]:[],K;if(G&&$.provider&&e.includes($.provider)){await G.run();return}else if($.provider){let Q=$.provider,_=S.find((N)=>N.value===Q),F=S.find((N)=>N.label.toLowerCase()===Q.toLowerCase()),C=_??F;if(!C)W.error(`Unknown provider "${Q}"`),process.exit(1);K=C.value}else{let Q=await b({message:U("cli.providers.select"),options:[...G?.menu?[{label:G.menu.label,value:G.id,hint:G.menu.hint}]:[],{label:U("cli.providers.other"),value:"__other__"}]});if(w(Q))throw new Y.CancelledError;if(G&&Q===G.id){await G.run();return}let _=await u({message:U("cli.providers.select"),maxItems:8,options:[...S,{value:"other",label:"Other"}]});if(w(_))throw new Y.CancelledError;K=_}let E=Z.findLast((Q)=>Q.auth?.provider===K);if(E&&E.auth){if(await x({auth:E.auth},K,$.method))return}if(K==="other"){let Q=await P({message:"Enter provider id",validate:(F)=>F&&F.match(/^[0-9a-z-]+$/)?void 0:"a-z, 0-9 and hyphens only"});if(w(Q))throw new Y.CancelledError;K=Q.replace(/^@ai-sdk\//,"");let _=Z.findLast((F)=>F.auth?.provider===K);if(_&&_.auth){if(await x({auth:_.auth},K,$.method))return}W.warn(`This only stores a credential for ${K} - you will need configure it in qitqode.json, check the docs for examples.`)}if(K==="amazon-bedrock")W.info(`Amazon Bedrock authentication priority:
3
- 1. Bearer token (AWS_BEARER_TOKEN_BEDROCK or /connect)
4
- 2. AWS credential chain (profile, access keys, IAM roles, EKS IRSA)
5
-
6
- Configure via qitqode.json options (profile, region, endpoint) or
7
- AWS environment variables (AWS_PROFILE, AWS_REGION, AWS_ACCESS_KEY_ID, AWS_WEB_IDENTITY_TOKEN_FILE).`);if(K==="opencode")W.info("Create an api key at https://opencode.ai/auth");if(K==="vercel")W.info("You can create an api key at https://vercel.link/ai-gateway-token");if(["cloudflare","cloudflare-ai-gateway"].includes(K))W.info("Cloudflare AI Gateway can be configured with CLOUDFLARE_GATEWAY_ID, CLOUDFLARE_ACCOUNT_ID, and CLOUDFLARE_API_TOKEN environment variables. Read more: https://opencode.ai/docs/providers/#cloudflare-ai-gateway");let $1=await t();await D(K,{type:"api",key:$1}),T("Done")}})}}),F1=z({command:"logout",describe:"log out from a configured provider",async handler($){Y.empty();let B=await M.runPromise(O.gen(function*(){let Z=yield*R.Service;return Object.entries(yield*Z.all())}));if(L("Remove credential"),B.length===0){W.error("No credentials found");return}let J=await V.get(),X=await b({message:"Select provider",options:B.map(([Z,j])=>({label:(J[Z]?.name||Z)+Y.Style.TEXT_DIM+" ("+j.type+")",value:Z}))});if(w(X))throw new Y.CancelledError;let H=X;await M.runPromise(O.gen(function*(){yield*(yield*R.Service).remove(H)})),T("Logout successful")}}),K1=z({command:"whoami",describe:"show current logged-in user info",async handler($){Y.empty(),L("Current auth"),W.info("Run `qitqode auth list` to see all authenticated providers."),T("")}});export{G1 as resolvePluginProviders,K1 as ProvidersWhoamiCommand,F1 as ProvidersLogoutCommand,_1 as ProvidersLoginCommand,Y1 as ProvidersListCommand,l1 as ProvidersCommand};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import"./chunk-e0vrxetq.js";var G="./tree-sitter-bash-hq5s6fxb.wasm";export{G as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Qd as y}from"./chunk-vkkz40je.js";import{be as L}from"./chunk-f4mnp6xd.js";import{$g as N,Ch as w}from"./chunk-1acn5me8.js";import"./chunk-vs3s49jw.js";import"./chunk-kre93a89.js";import"./chunk-060wbpz4.js";import"./chunk-zrhw1szj.js";import"./chunk-t8fjgkp8.js";import"./chunk-0egrckx0.js";import{Wk as q,dl as v}from"./chunk-k1qd8ecm.js";import"./chunk-bhg69t69.js";import{El as k,Ol as O,wl as V,xl as A,yl as E}from"./chunk-fv5mrdyc.js";import"./chunk-rdreeyv0.js";import"./chunk-rmsqb6r4.js";import"./chunk-7pckez5z.js";import"./chunk-k6981ysw.js";import"./chunk-sa0rrreh.js";import"./chunk-ydgst3h8.js";import"./chunk-6tqbnxar.js";import"./chunk-0w19vmd7.js";import"./chunk-eewe7tx1.js";import"./chunk-4y9wbfd2.js";import"./chunk-wm9nh9nb.js";import"./chunk-scnbt714.js";import"./chunk-cqtkxwd8.js";import"./chunk-y3gy62q5.js";import"./chunk-az3nss5m.js";import"./chunk-p2fte9vz.js";import"./chunk-ggncq8w8.js";import"./chunk-t3w43rft.js";import"./chunk-eacpc64g.js";import"./chunk-27saej0r.js";import"./chunk-b5ym419d.js";import"./chunk-29q89bge.js";import"./chunk-wqk1v8t0.js";import"./chunk-rwwvy89t.js";import"./chunk-z0kbyr00.js";import"./chunk-sbjymf20.js";import"./chunk-dt3bsmfe.js";import"./chunk-vbfej8ds.js";import"./chunk-0tm6589k.js";import"./chunk-fveaq0pb.js";import"./chunk-gswhjd1h.js";import"./chunk-wgkcyqn1.js";import"./chunk-59csnjc3.js";import{gt as P}from"./chunk-1bxfzd6r.js";import"./chunk-6p6m5956.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-w7a33cwa.js";import"./chunk-g7v6sp3c.js";import"./chunk-s2tc3qs0.js";import"./chunk-n6tqtk6h.js";import"./chunk-e0vrxetq.js";import{EOL as X}from"os";function U(C){let G=C.match(/^https?:\/\/[^/]+\/share\/([a-zA-Z0-9_-]+)$/);return G?G[1]:null}function M(C,G){try{return new URL(C).origin===new URL(G).origin}catch{return!1}}function S(C){let G=C.find((z)=>z.type==="session");if(!G)return null;let Z=new Map,Q=new Map;for(let z of C)if(z.type==="message")Z.set(z.data.id,z.data);else if(z.type==="part"){if(!Q.has(z.data.messageID))Q.set(z.data.messageID,[]);Q.get(z.data.messageID).push(z.data)}if(Z.size===0)return null;return{info:G.data,messages:Array.from(Z.values()).map((z)=>({info:z,parts:Q.get(z.id)??[]}))}}var m=L({command:"import <file>",describe:"import session data from JSON file or URL",builder:(C)=>{return C.positional("file",{describe:"path to JSON file or share URL",type:"string",demandOption:!0})},handler:async(C)=>{await y(process.cwd(),async()=>{let G;if(C.file.startsWith("http://")||C.file.startsWith("https://")){let J=U(C.file);if(!J){let Y=await w.runPromise(N.Service.use((R)=>R.url()));process.stdout.write(`Invalid URL format. Expected: ${Y}/share/<slug>`),process.stdout.write(X);return}let _=new URL(C.file).origin,$=await w.runPromise(N.Service.use((Y)=>Y.request())),j=M(C.file,$.baseUrl)?$.headers:{},W=$.api.data(J),K=await fetch(`${_}${W}`,{headers:j});if(!K.ok&&W!==`/api/share/${J}/data`)K=await fetch(`${_}/api/share/${J}/data`,{headers:j});if(!K.ok){process.stdout.write(`Failed to fetch share data: ${K.statusText}`),process.stdout.write(X);return}let H=await K.json(),B=S(H);if(!B){process.stdout.write(`Share not found or empty: ${J}`),process.stdout.write(X);return}G=B}else if(G=await P.readJson(C.file).catch(()=>{return}),!G){process.stdout.write(`File not found: ${C.file}`),process.stdout.write(X);return}if(!G){process.stdout.write("Failed to read session data"),process.stdout.write(X);return}let Q=v.Info.parse({...G.info,projectID:O.project.id}),z=v.toRow(Q);k.use((J)=>J.insert(V).values(z).onConflictDoUpdate({target:V.id,set:{project_id:z.project_id}}).run());for(let J of G.messages){let F=q.Info.parse(J.info),{id:_,sessionID:$,...j}=F;k.use((W)=>W.insert(A).values({id:_,session_id:z.id,time_created:F.time?.created??Date.now(),data:j}).onConflictDoNothing().run());for(let W of J.parts){let K=q.Part.parse(W),{id:H,sessionID:B,messageID:Y,...R}=K;k.use((T)=>T.insert(E).values({id:H,message_id:Y,session_id:z.id,data:R}).onConflictDoNothing().run())}}process.stdout.write(`Imported session: ${G.info.id}`),process.stdout.write(X)})}});export{S as transformShareData,M as shouldAttachShareAuthHeaders,U as parseShareUrl,m as ImportCommand};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Af as h}from"./chunk-zqdjk4rf.js";import"./chunk-wm9nh9nb.js";import"./chunk-scnbt714.js";import"./chunk-cqtkxwd8.js";import"./chunk-y3gy62q5.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-e0vrxetq.js";var v=(q)=>{return h({baseURL:"https://gateway.ai.cloudflare.com/v1/compat",name:"Unified",...q||{}})},x=v();export{x as unified,v as createUnified};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{N as b,O as y,P as k,Q as S,R as D,S as x}from"./chunk-53jstmdp.js";import{Qd as m}from"./chunk-vkkz40je.js";import{Rd as f,Sd as w,Vd as h}from"./chunk-2kh0tg92.js";import"./chunk-52xvhxek.js";import{be as u}from"./chunk-f4mnp6xd.js";import{eg as a}from"./chunk-bwadggys.js";import"./chunk-1acn5me8.js";import"./chunk-vs3s49jw.js";import"./chunk-kre93a89.js";import"./chunk-060wbpz4.js";import"./chunk-zrhw1szj.js";import"./chunk-t8fjgkp8.js";import"./chunk-0egrckx0.js";import{Nj as p,dl as l}from"./chunk-k1qd8ecm.js";import"./chunk-bhg69t69.js";import"./chunk-fv5mrdyc.js";import"./chunk-rdreeyv0.js";import"./chunk-rmsqb6r4.js";import"./chunk-7pckez5z.js";import"./chunk-k6981ysw.js";import"./chunk-sa0rrreh.js";import"./chunk-ydgst3h8.js";import"./chunk-6tqbnxar.js";import"./chunk-0w19vmd7.js";import"./chunk-eewe7tx1.js";import"./chunk-4y9wbfd2.js";import"./chunk-wm9nh9nb.js";import"./chunk-scnbt714.js";import"./chunk-cqtkxwd8.js";import"./chunk-y3gy62q5.js";import"./chunk-az3nss5m.js";import"./chunk-p2fte9vz.js";import"./chunk-ggncq8w8.js";import"./chunk-t3w43rft.js";import"./chunk-eacpc64g.js";import"./chunk-27saej0r.js";import"./chunk-b5ym419d.js";import"./chunk-29q89bge.js";import"./chunk-wqk1v8t0.js";import"./chunk-rwwvy89t.js";import"./chunk-z0kbyr00.js";import"./chunk-sbjymf20.js";import"./chunk-dt3bsmfe.js";import"./chunk-vbfej8ds.js";import"./chunk-0tm6589k.js";import"./chunk-fveaq0pb.js";import"./chunk-gswhjd1h.js";import"./chunk-wgkcyqn1.js";import"./chunk-59csnjc3.js";import"./chunk-1bxfzd6r.js";import"./chunk-6p6m5956.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-w7a33cwa.js";import"./chunk-g7v6sp3c.js";import"./chunk-s2tc3qs0.js";import"./chunk-n6tqtk6h.js";import"./chunk-e0vrxetq.js";import{EOL as c}from"os";async function I(){a.empty(),h("Export session",{output:process.stderr});let t=[...l.list()];if(t.length===0)return;let o=await w({message:"Select session to export",maxItems:10,options:t.map((e)=>({label:e.title,value:e.id,hint:`${new Date(e.time.updated).toLocaleString()} \u2022 ${e.id.slice(-8)}`})),output:process.stderr});if(f(o))throw new a.CancelledError;return p.make(o)}var z=u({command:"export [sessionID]",describe:"export a complete session transcript as JSON or Markdown",builder:(t)=>t.positional("sessionID",{describe:"session id to export",type:"string"}).option("latest",{describe:"export the most recently updated session without prompting",type:"boolean",default:!1}).option("format",{alias:"f",describe:"output format (JSON defaults to stdout; Markdown defaults to a file in the project root)",choices:["json","markdown"],default:"json"}).option("output",{alias:"o",describe:"destination path, resolved from the current project root",type:"string"}).option("thinking",{describe:"include persisted assistant reasoning in Markdown",type:"boolean",default:!1}).option("tool-details",{describe:"include diagnostic tool inputs, outputs, and errors in Markdown",type:"boolean",default:!0}).option("assistant-metadata",{describe:"include agent, model, and duration metadata in Markdown",type:"boolean",default:!0}).option("sanitize",{describe:"redact sensitive transcript and file data",type:"boolean",default:!1}),handler:async(t)=>{await m(process.cwd(),async()=>{if(t.sessionID&&t.latest)throw Error("Use either a session ID or --latest, not both");let o=t.sessionID?p.make(t.sessionID):void 0;if(!o&&(t.latest||!process.stderr.isTTY))o=y()?.id;if(!o)o=await I();if(!o)throw Error("No sessions found in the current project");let e;try{e=await b(o)}catch{throw Error(`Session not found: ${o}`)}let r=t.sanitize?D(e):e,n=t.format,d=n==="json"?JSON.stringify(r,null,2)+c:x(r.info,r.messages,{thinking:t.thinking,toolDetails:t.toolDetails,assistantMetadata:t.assistantMetadata}),i=t.output??(n==="markdown"?k(r.info.id,n):void 0);if(!i){process.stdout.write(d);return}try{let s=await S(process.cwd(),i,d);process.stderr.write(`Session transcript written to ${s}${c}`)}catch(s){let E=s instanceof Error?s.message:String(s);throw Error(`Unable to write session transcript to ${i}: ${E}`)}})}});export{z as ExportCommand};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Bh as a,Ch as b}from"./chunk-1acn5me8.js";import"./chunk-vs3s49jw.js";import"./chunk-kre93a89.js";import"./chunk-060wbpz4.js";import"./chunk-zrhw1szj.js";import"./chunk-t8fjgkp8.js";import"./chunk-0egrckx0.js";import"./chunk-k1qd8ecm.js";import"./chunk-bhg69t69.js";import"./chunk-fv5mrdyc.js";import"./chunk-rdreeyv0.js";import"./chunk-rmsqb6r4.js";import"./chunk-7pckez5z.js";import"./chunk-k6981ysw.js";import"./chunk-sa0rrreh.js";import"./chunk-ydgst3h8.js";import"./chunk-6tqbnxar.js";import"./chunk-0w19vmd7.js";import"./chunk-eewe7tx1.js";import"./chunk-4y9wbfd2.js";import"./chunk-wm9nh9nb.js";import"./chunk-scnbt714.js";import"./chunk-cqtkxwd8.js";import"./chunk-y3gy62q5.js";import"./chunk-az3nss5m.js";import"./chunk-p2fte9vz.js";import"./chunk-ggncq8w8.js";import"./chunk-t3w43rft.js";import"./chunk-eacpc64g.js";import"./chunk-27saej0r.js";import"./chunk-b5ym419d.js";import"./chunk-29q89bge.js";import"./chunk-wqk1v8t0.js";import"./chunk-rwwvy89t.js";import"./chunk-z0kbyr00.js";import"./chunk-sbjymf20.js";import"./chunk-dt3bsmfe.js";import"./chunk-vbfej8ds.js";import"./chunk-0tm6589k.js";import"./chunk-fveaq0pb.js";import"./chunk-gswhjd1h.js";import"./chunk-wgkcyqn1.js";import"./chunk-59csnjc3.js";import"./chunk-1bxfzd6r.js";import"./chunk-6p6m5956.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-w7a33cwa.js";import"./chunk-g7v6sp3c.js";import"./chunk-s2tc3qs0.js";import"./chunk-n6tqtk6h.js";import"./chunk-e0vrxetq.js";export{b as AppRuntime,a as AppLayer};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import"./chunk-e0vrxetq.js";var l="./tree-sitter-javascript-nd0q4pe9.wasm";export{l as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{iq as a,jq as b}from"./chunk-t3w43rft.js";import"./chunk-e0vrxetq.js";export{a as generateSecret,b as generateCodeChallengeFromVerifier};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Eh as b}from"./chunk-kre93a89.js";import"./chunk-060wbpz4.js";import"./chunk-e0vrxetq.js";export{b as QuickJSAsyncWASMModule};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{uf as a}from"./chunk-fs1vb39f.js";import"./chunk-e0vrxetq.js";export default a();
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Mh as f,Nh as q,Oh as w,Ph as x}from"./chunk-060wbpz4.js";import"./chunk-e0vrxetq.js";export{w as applyModuleEvalRuntimeOptions,q as applyBaseRuntimeOptions,x as QuickJSWASMModule,f as QuickJSModuleCallbacks};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import"./chunk-e0vrxetq.js";var t="./highlights-ghv9g403.scm";export{t as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{hl as a,il as b,jl as c,kl as d,ll as e,ml as f,nl as g,ol as h,pl as i}from"./chunk-bhg69t69.js";import"./chunk-rdreeyv0.js";import"./chunk-sa0rrreh.js";import"./chunk-6tqbnxar.js";import"./chunk-wqk1v8t0.js";import"./chunk-rwwvy89t.js";import"./chunk-z0kbyr00.js";import"./chunk-sbjymf20.js";import"./chunk-gswhjd1h.js";import"./chunk-wgkcyqn1.js";import"./chunk-59csnjc3.js";import"./chunk-1bxfzd6r.js";import"./chunk-6p6m5956.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-w7a33cwa.js";import"./chunk-g7v6sp3c.js";import"./chunk-e0vrxetq.js";export{i as stopRefresh,h as startRefresh,g as refresh,d as readModelCatalogResponse,f as get,c as Provider,b as Model,a as MODEL_CATALOG_MAX_BYTES,e as Data};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Lg as o}from"./chunk-qgkb6n8k.js";import{xO as n}from"./chunk-e0vrxetq.js";async function a(){try{let{toJsonSchema:t}=await import("./chunk-0tcggtwv.js");return t}catch{throw new o("@valibot/to-json-schema")}}export{a as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Of as l}from"./chunk-ahmy80vb.js";import"./chunk-p8ak162p.js";import{Jg as q}from"./chunk-brk6bge4.js";import"./chunk-nfg7nt13.js";import"./chunk-qgkb6n8k.js";import{xO as C}from"./chunk-e0vrxetq.js";function J(){return async(f,b)=>{if("_zod"in f)return l()(f,{components:b.components,options:{io:"input",...b.options}});try{let{createSchema:w}=await import("./chunk-9cf2ktyh.js"),{schema:B,components:k}=w(f,{schemaType:"input",...b.options});if(k)b.components.schemas={...b.components.schemas,...k};return B}catch{throw Error(q('Missing dependencies "zod-openapi v4".'))}}}export{J as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import"./chunk-e0vrxetq.js";function n(){return(e)=>JSON.parse(JSON.stringify(e.Type()))}export{n as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Sn as a,Tn as b,Un as c,Vn as d,Wn as e,Xn as f,Yn as g,Zn as h,_n as i}from"./chunk-eewe7tx1.js";import"./chunk-wm9nh9nb.js";import"./chunk-scnbt714.js";import"./chunk-cqtkxwd8.js";import"./chunk-y3gy62q5.js";import"./chunk-az3nss5m.js";import"./chunk-6p6m5956.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-e0vrxetq.js";export{i as gateway,h as createGatewayProvider,h as createGateway,g as GatewayResponseError,d as GatewayRateLimitError,e as GatewayModelNotFoundError,c as GatewayInvalidRequestError,f as GatewayInternalServerError,a as GatewayError,b as GatewayAuthenticationError};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Lg as t}from"./chunk-qgkb6n8k.js";import{xO as o}from"./chunk-e0vrxetq.js";async function e(){try{let{toJSONSchema:r}=await import("./chunk-85wh85pk.js");return r}catch{throw new t("sury")}}export{e as default};
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{Kt as o}from"./chunk-a48mx917.js";var e=o;
3
- export{e as mt};
@@ -1,28 +0,0 @@
1
- // @bun
2
- import{Af as qH}from"./chunk-zqdjk4rf.js";import{co as QH,go as KH,yo as SH}from"./chunk-4y9wbfd2.js";import"./chunk-wm9nh9nb.js";import"./chunk-scnbt714.js";import"./chunk-cqtkxwd8.js";import"./chunk-y3gy62q5.js";import"./chunk-rwwvy89t.js";import"./chunk-z0kbyr00.js";import"./chunk-sbjymf20.js";import{ds as Q}from"./chunk-fveaq0pb.js";import"./chunk-gswhjd1h.js";import{Hs as OH}from"./chunk-wgkcyqn1.js";import{Os as t,Ws as FH}from"./chunk-59csnjc3.js";import{it as PH,lt as _H}from"./chunk-1bxfzd6r.js";import"./chunk-6p6m5956.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-w7a33cwa.js";import"./chunk-g7v6sp3c.js";import"./chunk-e0vrxetq.js";var vH=0.9,fH=256,XH="[Earlier tool result removed to fit the request size limit]",m;function v(H){return Buffer.byteLength(JSON.stringify(H),"utf8")}function DH(){return t.QITQODE_QLEX_MAX_REQUEST_BYTES??m}function e(H){let J=t.QITQODE_QLEX_MAX_REQUEST_BYTES;if(J!==void 0)return J;let K=Math.max(1,Math.min(Math.floor(H*vH),Math.floor(H)-1));return m=m===void 0?K:Math.min(m,K),m}function l(H,J){return!!H&&typeof H==="object"&&H.role===J}function YH(H){let J=[],K=0;while(K<H.length){let Z=K,$=H[K];if(K++,l($,"assistant")&&Array.isArray($?.tool_calls)&&$.tool_calls.length>0)while(K<H.length&&l(H[K],"tool"))K++;J.push({start:Z,end:K})}return J}function VH(H,J){if(J.length===0)return[];let K=-1;for(let Z=J.length-1;Z>=0;Z--){let $=J[Z],z=!1;for(let X=$.start;X<$.end;X++)if(l(H[X],"user"))z=!0;if(z){K=Z;break}}return J.filter((Z,$)=>{if($===J.length-1)return!1;if($===K)return!1;if(Z.start===0&&l(H[0],"system"))return!1;return!0})}function HH(H,J){let K=v(H),Z={toolResultsElided:0,unitsDropped:0},$=()=>({body:H,bytes:K,originalBytes:K,reduced:!1,actions:Z});if(!H||typeof H!=="object")return $();let z=H.messages;if(!Array.isArray(z))return $();let X=z.map((U)=>U&&typeof U==="object"?{...U}:U),Y=()=>({...H,messages:X}),V=()=>v(Y())<=J;{let U=X;for(let P of VH(U,YH(U))){let S=!1;for(let L=P.start;L<P.end;L++){let E=U[L];if(!l(E,"tool"))continue;let w=E?.content;if(typeof w!=="string"||w.length<fH)continue;if(w===XH)continue;U[L]={...E,content:XH},Z.toolResultsElided++,S=!0}if(S&&V())break}}if(!V())for(;;){let U=X,S=VH(U,YH(U))[0];if(!S)break;if(X=[...U.slice(0,S.start),...U.slice(S.end)],Z.unitsDropped++,V())break}let W=Y(),G=v(W);return{body:W,bytes:G,originalBytes:K,reduced:G<K&&G<=J,actions:Z}}import y from"fs/promises";import LH from"path";import{randomUUID as yH}from"crypto";var k=FH({service:"provider.qlex"}),pH=Q.streamUrl(),uH=Q.omniqueryBaseUrl()+"/runOrchestrated";function b(H,J){let K=H;if(J.status!==void 0)K.status=J.status;if(J.upstreamCode!==void 0)K.upstreamCode=J.upstreamCode;if(J.requestId!==void 0)K.requestId=J.requestId;if(K.category=J.category,K.retryable=J.retryable,J.outputBudgetRecoveryAvailable!==void 0)K.outputBudgetRecoveryAvailable=J.outputBudgetRecoveryAvailable;if(J.outputBudgetRecoveryTokens!==void 0)K.outputBudgetRecoveryTokens=J.outputBudgetRecoveryTokens}function x(H,J){return{...H,...J}}class MH extends Error{name="QlexNotLoggedInError";constructor(H){super(Q.copy().notLoggedIn);b(this,x({category:"invalid_credentials",retryable:!1},H))}}class kH extends Error{name="QlexInsufficientBalanceError";constructor(H,J){super(Q.copy().insufficientBalance(H));b(this,x({status:402,category:"billing",retryable:!1},J))}}class EH extends Error{name="QlexRateLimitError";constructor(H){super(Q.copy().rateLimit);b(this,x({status:429,category:"rate_limited",retryable:!0},H))}}class wH extends Error{name="QlexInvalidCredentialsError";constructor(H,J){super(Q.copy().invalidCredentials(H));b(this,x({status:401,category:"invalid_credentials",retryable:!1},J))}}class RH extends Error{name="QlexRequestRejectedError";constructor(H,J,K){super(Q.copy().requestRejected(H,J));b(this,x({status:400,category:"request_rejected",retryable:!1},K))}}class a extends Error{name="QlexRequestTooLargeError";stage;constructor(H="irreducible",J,K){super(H==="after-reduction"?Q.copy().requestTooLargeAfterReduction(J):Q.copy().requestTooLargeIrreducible(J));this.stage=H,b(this,x({status:413,category:"request_too_large",retryable:!1},K))}}class CH extends Error{name="QlexRequestNotSentError";constructor(H,J){super(Q.copy().requestNotSent(H));b(this,x({category:"request_rejected",retryable:!1},J))}}class u extends Error{name="QlexGatewayError";constructor(H,J){super(Q.copy().gatewayUnavailable(H));b(this,x({category:"gateway_routing",retryable:!1},J))}}var cH=60000,mH=320000;function lJ(H){return Q.sanitizeUpstreamError(H)}class g extends Error{name="QlexStreamError";constructor(H,J,K){let Z=x({category:"unknown",retryable:!1},J);super(Z.category==="output_budget_exhausted"?Q.copy().outputBudgetExhausted():Z.category==="empty_output"?Q.copy().emptyOutput():Z.category==="stream_truncated"?Q.copy().streamCutOff(K):Z.category==="stream_failed"?Q.copy().streamFailedAfterRetries(K):Q.copy().streamFailed(H));b(this,Z),OH(this)}}var lH=[{match:/\b(unauthori[sz]ed|forbidden|invalid[ _-]?(api[ _-]?key|token|credential)|expired[ _-]?token|authentication[ _-]?(failed|error)|401|403)\b/i,category:"invalid_credentials",retryable:!1},{match:/(output (?:token )?budget|maximum output tokens|max_tokens|finish[_ -]?reason.{0,20}(length|budget)|reasoning.{0,20}(budget|tokens))/i,category:"output_budget_exhausted",retryable:!1},{match:/\b(no visible output|empty output|produced no (?:visible )?(?:text|output)|nothing to display)\b/i,category:"empty_output",retryable:!1},{match:/\b(insufficient[ _-]?(credits?|qredits?|balance|funds)|payment[ _-]?required|quota[ _-]?exceeded|out[ _-]?of[ _-]?(credits?|qredits?)|402)\b/i,category:"billing",retryable:!1},{match:/\b(rate[ _-]?limit(ed|s)?|too[ _-]?many[ _-]?requests|429)\b/i,category:"rate_limited",retryable:!0},{match:/(unexpected end of (json|input|stream|data)|premature (close|end)|socket hang ?up|incomplete (response|output|json|message)|truncated|stream (ended|closed|terminated) (early|unexpectedly|prematurely)|\bECONNRESET\b|\bEPIPE\b)/i,category:"stream_truncated",retryable:!0},{match:/\b(overloaded|at capacity|service[ _-]?unavailable|temporarily[ _-]?unavailable|bad[ _-]?gateway|gateway[ _-]?time(d[ _-]?out|out)|timed[ _-]?out|502|503|504)\b/i,category:"transient",retryable:!0}],dH={ERR_EMPTY_RESULT:{category:"empty_output",retryable:!1},ERR_TRUNCATED_OUTPUT:{category:"stream_truncated",retryable:!0},ERR_STREAM:{category:"stream_failed",retryable:!0}},nH=/^\s*(ERR_[A-Z0-9_]+)\b(?:\s*(?:[\u2014\u2013:-]\s*)?)?/i,iH=/\b(req_[A-Za-z0-9][A-Za-z0-9_-]*)\b/;function rH(H){let J=H??"",K=nH.exec(J),Z=K?.[1]?.toUpperCase(),$=iH.exec(J)?.[1],z=K?J.slice(K[0].length):J;if(Z!==void 0){let X=dH[Z];if(X!==void 0)return{...X,upstreamCode:Z,...$?{requestId:$}:{}}}for(let X of lH)if(X.match.test(z))return{category:X.category,retryable:X.retryable,...Z?{upstreamCode:Z}:{},...$?{requestId:$}:{}};return{category:"unknown",retryable:!1,...Z?{upstreamCode:Z}:{},...$?{requestId:$}:{}}}function oH(H){return QH(H)}function AH(H,J){let K,Z,$,z=!1;try{let W=JSON.parse(J);if(W&&typeof W==="object"){let G=W.error&&typeof W.error==="object"?W.error:void 0;if(typeof G?.code==="string")K=G.code;else if(typeof W.code==="string")K=W.code;if(typeof G?.message==="string")Z=G.message;else if(typeof W.message==="string")Z=W.message;if(typeof W.details?.field==="string")$=W.details.field}}catch(W){z=/^\s*[\[{]/.test(J)&&(sH(J)||/unexpected end|end of json|unterminated string/i.test(String(W)))}let X=K?.toUpperCase()??"",Y=(()=>{if(z)return"stream_truncated";if(H===402)return"billing";if(H===413)return"request_too_large";if(H===429)return"rate_limited";if(H===401||H===403)return X==="ERR_GATEWAY_REQUIRED"||oH(J)?"gateway_routing":"invalid_credentials";if(X.includes("CONFIG"))return"configuration";if(H>=500)return"transient";if(H>=400)return"request_rejected";return"unknown"})(),V={status:H,category:Y,retryable:Y==="transient"||Y==="rate_limited"||Y==="stream_truncated"};if(K!==void 0)V.upstreamCode=K;if(Z!==void 0)V.upstreamMessage=Z;if($!==void 0)V.field=$;return V}function sH(H){let J=0,K=!1,Z=!1;for(let $ of H){if(K){if(Z)Z=!1;else if($==="\\")Z=!0;else if($==='"')K=!1;continue}if($==='"')K=!0;else if($==="{"||$==="[")J++;else if($==="}"||$==="]")J--;if(J<0)return!1}return K||J>0}function aH(H){let J=Q.tierBudgetFacts(H.tier),K=H.advisory,Z=K?.tierOutputLimit??J?.output;if(H.requestedTotal!==void 0)return{total:Z===void 0?H.requestedTotal:Math.min(H.requestedTotal,Z)};if(!K&&!J)return{};let $=K?.reasoningReserveTokens??J?.reasoningReserve??0,z=K?.visibleOutputFloorTokens??J?.visibleOutputFloor??0,X=K?.recommendedTotalTokens??K?.tierRecommendedStepTokens??J?.recommendedTotal??J?.recommendedStep??Z,Y=K?.viableTotalFloorTokens??J?.viableTotalFloor??$+z,V=X===void 0?Y:Math.max(X,Y),W=K?.reasoningReported??J?.reasoning;return{total:Z===void 0?V:Math.min(V,Z),reasoningBudget:W&&$>0?Math.min($,V):void 0}}var tH=new Set(["coding","agent","research","review","chat"]);function eH(H){if(H===void 0)return;if(typeof H==="string"&&tH.has(H))return H;throw Error(`invalid Qortex posture: ${String(H)}`)}function HJ(H){if(H===void 0)return;let J=Array.isArray(H)?H:[H];if(J.every((K)=>typeof K==="string"&&/^[^/\s]+\/[^/\s]+$/.test(K)))return Array.isArray(H)?J:H;throw Error(`invalid Qortex directive registry key: ${String(H)}`)}function s(H){if(typeof H==="string")return H;if(Array.isArray(H))return H.map((J)=>{if(typeof J==="string")return J;if(J&&typeof J==="object"){let K=J;if(typeof K.text==="string")return K.text;if(typeof K.content==="string")return K.content}return""}).join("");if(H===void 0||H===null)return"";return String(H)}var JJ="[Tool call]",KJ="[Tool returned no output]";function TH(H){if(!Array.isArray(H))return{messages:H,dropped:[]};let J=[];return{messages:H.flatMap((Z,$)=>{if(!Z||typeof Z!=="object")return J.push({index:$,role:typeof Z,reason:"not-an-object"}),[];let z=Z,X=s(z.content);if(X.trim().length>0)return[{...z,content:X}];if(z.role==="assistant"&&Array.isArray(z.tool_calls)&&z.tool_calls.length>0)return[{...z,content:JJ}];if(z.role==="tool"&&typeof z.tool_call_id==="string"&&z.tool_call_id.trim().length>0)return[{...z,content:KJ}];return J.push({index:$,role:typeof z.role==="string"?z.role:"unknown",reason:"empty-content"}),[]}),dropped:J}}function ZJ(H){return TH(H).messages}function $J(H){if(!Array.isArray(H))return!1;return H.some((J)=>!!J&&typeof J==="object"&&J.role==="user")}function zJ(H){if(!Array.isArray(H))return!1;return H.some((J)=>{if(!J||typeof J!=="object")return!1;let K=J;if(K.role!=="user")return!1;return s(K.content).trim().length>0})}function XJ(H){if(!Array.isArray(H))return H;let J=(z)=>!!z&&typeof z==="object"&&z.role==="system",K=0;while(K<H.length&&J(H[K]))K++;if(K<=1)return H;let Z=H.slice(0,K),$=Z.map((z)=>typeof z.content==="string"?z.content:String(z.content??"")).filter((z)=>z.length>0).join(`
3
-
4
- `);return[{...Z[0],role:"system",content:$},...H.slice(K)]}var d="<tool_call>",r="</tool_call>";function YJ(H){if(!Array.isArray(H)||H.length===0)return;let J=H.map((K)=>{try{return JSON.stringify(K)}catch{return}}).filter((K)=>K!==void 0);if(J.length===0)return;return["# Tools","","You may call one or more functions to assist with the user query.","","You are provided with function signatures within <tools></tools> XML tags:","<tools>",...J,"</tools>","","For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:","<tool_call>",'{"name": <function-name>, "arguments": <args-json-object>}',"</tool_call>","","Function results will be provided within <tool_response></tool_response> XML tags. Do not write <tool_response> blocks yourself.","Only use the functions declared above. Never invent function names, and never write out a function-call-like block in any other format."].join(`
5
- `)}var VJ=3;function $H(H){let J=H;for(let K=0;K<VJ;K++){if(J!==null&&typeof J==="object")return J;if(typeof J!=="string")return;try{J=JSON.parse(J)}catch{return}}return}function DJ(H){let J=H?.tool_calls;if(!Array.isArray(J))return;for(let K of J){let Z=K?.function;if(!Z)continue;k.debug("tool call ingress",{tool:typeof Z.name==="string"?Z.name:"?",source:"native",args:zH(Z.arguments)})}}function zH(H,J=300){let K;try{K=typeof H==="string"?H:JSON.stringify(H)??String(H)}catch{K="<unrenderable>"}return K.length<=J?K:`${K.slice(0,J)}\u2026 (${K.length} chars total)`}function WJ(H){let J=H.function??{},K=typeof J.name==="string"?J.name:"",Z=J.arguments===void 0?{}:$H(J.arguments);if(Z===void 0)k.warn("dropping unrecoverable tool-call arguments while re-encoding history",{tool:K,raw:zH(J.arguments)});return`${d}
6
- ${JSON.stringify({name:K,arguments:Z??{}})}
7
- ${r}`}function IH(H,J){if(!Array.isArray(H))return H;let K=H.map(($)=>{if(!$||typeof $!=="object")return $;let z=$;if(z.role==="assistant"&&Array.isArray(z.tool_calls)){let X=z.tool_calls.map(WJ).join(`
8
- `),Y=s(z.content),{tool_calls:V,...W}=z;return{...W,content:Y.length>0?`${Y}
9
- ${X}`:X}}if(z.role==="tool"){let{tool_call_id:X,name:Y,...V}=z;return{...V,role:"user",content:`<tool_response>
10
- ${s(z.content)}
11
- </tool_response>`}}return $}),Z=YJ(J);if(Z){let $=0;while($<K.length&&!!K[$]&&typeof K[$]==="object"&&K[$].role==="system")$++;K.splice($,0,{role:"system",content:Z})}return K}function NJ(){return process.env.QITQODE_TOOL_PROTOCOL==="text"?"text":"native"}function GJ(H){if(Array.isArray(H.tools)&&H.tools.length>0)return!0;let J=H.messages;if(!Array.isArray(J))return!1;return J.some((K)=>{if(!K||typeof K!=="object")return!1;let Z=K;return Z.role==="tool"||Z.role==="assistant"&&Array.isArray(Z.tool_calls)})}function WH(H,J){let K=J?.toolMode??"native",Z=H.model??"adaptive",$={stream:H.stream??!0};if(H.temperature!==void 0)$.temperature=H.temperature;if(H.max_tokens!==void 0)$.max_tokens=H.max_tokens;let z=aH({tier:Z,advisory:J?.outputAdvisory,requestedTotal:$.max_tokens});if(z.total!==void 0)$.max_tokens=z.total;if(z.reasoningBudget!==void 0)$.thinking={budget_tokens:z.reasoningBudget};if(J?.outputBudgetRecoveryTokens!==void 0){let G=typeof $.max_tokens==="number"?$.max_tokens:0,U=J.outputAdvisory?.tierOutputLimit??Q.tierBudgetFacts(Z)?.output,P=Math.min(J.outputBudgetRecoveryTokens,U??J.outputBudgetRecoveryTokens);if(P>G)$.max_tokens=P}if(H.tools!==void 0)$.tools=H.tools;if(H.tool_choice!==void 0)$.tool_choice=H.tool_choice;if(H.stream_options!==void 0)$.stream_options=H.stream_options;let X=K==="text"?IH(H.messages,H.tools):H.messages,Y={},V=eH(H.posture);if(V!==void 0)Y.posture=V;let W=HJ(H.directive);if(W!==void 0)Y.directive=W;if(H.modelPersona!==void 0)Y.modelPersona=H.modelPersona;return{tier:Z,messages:XJ(ZJ(X)),opts:$,...Y}}var n=new Map,p=LH.join(_H.Path.data,"qlex-tier-advisories.json"),jJ="qlex-tier-advisories",UJ=2592000000,NH=!1,PJ;function BH(H,J){if(!H||typeof H!=="object")return;let K=H;if(typeof K.capturedAt!=="number"||J-K.capturedAt>UJ)return;if(!K.advisory)return;return{advisory:K.advisory,capturedAt:K.capturedAt}}async function _J(){if(NH)return;try{let H=JSON.parse(await y.readFile(p,"utf8")),J=Date.now();for(let[K,Z]of Object.entries(H)){let $=BH(Z,J);if($)bH(K,$.advisory,$.capturedAt)}}catch{}NH=!0}function FJ(){return PJ??=_J()}function bH(H,J,K=Date.now()){n.set(H,{advisory:J,capturedAt:K})}async function OJ(H){await PH.withLock(jJ,async()=>{let J={};try{let Z=JSON.parse(await y.readFile(p,"utf8")),$=Date.now();for(let[z,X]of Object.entries(Z)){let Y=BH(X,$);if(Y)J[z]=Y}}catch{}for(let[Z,$]of H){let z=J[Z];if(!z||z.capturedAt<=$.capturedAt)J[Z]=$}await y.mkdir(LH.dirname(p),{recursive:!0});let K=`${p}.${process.pid}.${yH()}.tmp`;try{await y.writeFile(K,JSON.stringify(J)),await y.rename(K,p)}catch(Z){throw await y.rm(K,{force:!0}).catch(()=>{}),Z}})}function QJ(){if(i)return;i=!0,ZH=ZH.then(()=>{return i=!1,OJ([...n].map(([H,J])=>[H,J]))}).catch((H)=>{i=!1,k.warn("failed to persist tier output advisories",{file:p,error:H instanceof Error?H.message:String(H)})})}function f(H){return typeof H==="number"&&Number.isFinite(H)&&H>0?H:void 0}function SJ(H,J){let K={},Z=f(J.tierOutputLimit),$=f(J.tierRecommendedStepTokens),z=f(J.reasoningReserveTokens),X=f(J.visibleOutputFloorTokens),Y=f(J.recommendedTotalTokens),V=f(J.viableTotalFloorTokens),W=f(J.budgetPolicyVersion);if(Z!==void 0)K.tierOutputLimit=Z;if($!==void 0)K.tierRecommendedStepTokens=$;if(z!==void 0)K.reasoningReserveTokens=z;if(X!==void 0)K.visibleOutputFloorTokens=X;if(Y!==void 0)K.recommendedTotalTokens=Y;if(V!==void 0)K.viableTotalFloorTokens=V;if(typeof J.reasoningReported==="boolean")K.reasoningReported=J.reasoningReported;if(W!==void 0)K.budgetPolicyVersion=W;if(Object.keys(K).length===0)return;bH(H,K),QJ()}function qJ(H){return n.get(H)?.advisory}function dJ(){n.clear()}function nJ(){return ZH}function LJ(H){let J=(K)=>typeof K==="string"&&(K.startsWith("qlex")||K.startsWith("qortex"));return J(H.id)||J(H.object)}function MJ(H){let J=[],K=H.indexOf(`
12
- `)===-1?[H]:H.split(`
13
- `);for(let X of K){let Y=X.endsWith("\r")?X.slice(0,-1):X;if(!Y.startsWith("data:"))continue;let V=Y.slice(5);if(V.startsWith(" "))V=V.slice(1);J.push(V)}if(J.length===0)return{kind:"skip"};let Z=J.length===1?J[0]:J.join(`
14
- `);if(Z==="")return{kind:"skip"};if(Z==="[DONE]")return{kind:"done"};if(Z.startsWith("[ERROR]"))return{kind:"error",message:Z.slice(7).trim()||"qlex stream error"};let $=Z.charCodeAt(0),z=$===123||$===91||$===32||$===9||$===10||$===13;try{if(!z)return{kind:"token",content:Z};let X=JSON.parse(Z);if(X&&typeof X==="object"){let Y=X.id;if(Y==="qlex-cost"||Y==="qortex-cost")return{kind:"cost",cost:X};if(Y==="qlex-stream"&&X.usage&&typeof X.usage==="object"){let G=X.choices,U;if(Array.isArray(G)&&G[0]&&typeof G[0]==="object"){let P=G[0].finish_reason;if(typeof P==="string")U=P}return{kind:"usage",usage:X.usage,finishReason:U}}if(Array.isArray(X.choices))return{kind:"passthrough",chunk:X};let V=X,W=typeof V.content==="string"?V.content:typeof V.text==="string"?V.text:typeof V.delta==="string"?V.delta:void 0;if(W!==void 0)return{kind:"token",content:W};if(LJ(X)){let G=X.object;return{kind:"control",control:typeof G==="string"&&G.endsWith(".tier.outputLimits")?"tier-output-limits":"unknown",chunk:X}}}}catch{}return{kind:"token",content:Z}}function kJ(H,J){let K=Math.min(H.length,J.length-1);for(let Z=K;Z>=1;Z--)if(J.startsWith(H.slice(H.length-Z)))return Z;return 0}function EJ(H){if(typeof H==="string"){try{let K=JSON.parse(H);if(K!==null&&typeof K==="object")return H}catch{}let J=$H(H);return JSON.stringify(J??H)}return JSON.stringify(H??{})}class xH{onText;onToolCall;pending="";inBlock=!1;constructor(H,J){this.onText=H;this.onToolCall=J}feed(H){this.pending+=H,this.drain(!1)}flush(){if(this.drain(!0),this.inBlock)this.emitBlock(this.pending,!0),this.inBlock=!1;else if(this.pending.length>0)this.onText(this.pending);this.pending=""}drain(H){while(!0)if(!this.inBlock){let J=this.pending.indexOf(d);if(J===-1){let K=H?0:kJ(this.pending,d),Z=this.pending.length-K;if(Z>0)this.onText(this.pending.slice(0,Z)),this.pending=K>0?this.pending.slice(Z):"";return}if(J>0)this.onText(this.pending.slice(0,J));this.pending=this.pending.slice(J+d.length),this.inBlock=!0}else{let J=this.pending.indexOf(r);if(J===-1)return;if(this.emitBlock(this.pending.slice(0,J),!1),this.pending=this.pending.slice(J+r.length),this.pending.startsWith(`\r
15
- `))this.pending=this.pending.slice(2);else if(this.pending.startsWith(`
16
- `))this.pending=this.pending.slice(1);this.inBlock=!1}}emitBlock(H,J){try{let K=JSON.parse(H.trim());if(K&&typeof K==="object"&&typeof K.name==="string"){this.onToolCall({name:K.name,arguments:EJ(K.arguments)});return}}catch{}this.onText(`${d}${H}${J?"":r}`)}}function JH(H,J,K){let Z={id:"qlex-stream",object:"chat.completion.chunk",created:Math.floor(Date.now()/1000),model:"qlex",choices:[{index:0,delta:H,finish_reason:J}]};if(K)Z.usage=K;return`data: ${JSON.stringify(Z)}
17
-
18
- `}function wJ(H,J){let K=J?.toolProtocolEnabled===!0,Z=J?.tier,$=J?.requestedOutputBudget,z=J?.idleTimeoutMs??mH,X=H.getReader(),Y=new TextDecoder,V=new TextEncoder,W="",G=!1,U=!1,P,S,L,E,w=!1,C=!1,h=0,A=0;return new ReadableStream({async start(_){let I=(D)=>{if(D.length>0)w=!0;A+=D.length;let N=G?{content:D}:{role:"assistant",content:D};G=!0,_.enqueue(V.encode(JH(N,null)))},c=0,F=K?new xH(I,(D)=>{k.debug("tool call ingress",{tool:D.name,source:"text-shim",args:zH(D.arguments),objectShaped:$H(D.arguments)!==void 0});let N={...G?{}:{role:"assistant"},tool_calls:[{index:c,id:`qlexcall_${Date.now().toString(36)}_${c}`,type:"function",function:{name:D.name,arguments:D.arguments}}]};G=!0,C=!0,c++,_.enqueue(V.encode(JH(N,null)))}):void 0,q=(D)=>F?F.feed(D):I(D),R=()=>{F?.flush();let N=P||S!==void 0||L!==void 0?{prompt_tokens:P?.tokens.prompt??L?.prompt??0,completion_tokens:P?.tokens.completion??L?.completion??0,total_tokens:P?.tokens.total??(P?.tokens.prompt??L?.prompt??0)+(P?.tokens.completion??L?.completion??0),cost_usd:P?.cost_usd,cost_credits:P?.cost_credits??P?.cost_qredits,context_window:S}:void 0;if(N&&(N.cost_usd??0)>0&&N.prompt_tokens===0)k.warn("qlex billed turn reported zero prompt tokens",{tier:Z,completionTokens:N.completion_tokens,costUsd:N.cost_usd,source:P?"cost.summary":"usage frame"});let j=c>0?"tool_calls":E??"stop";if(j==="length"||j==="max_tokens"){let O=o(Z??"adaptive",$),T=O!==void 0;k.debug("qlex output budget exhausted",{tier:Z,contentStreamed:w,outputBudgetRecoveryAvailable:T}),_.error(new g("output budget exhausted",{category:"output_budget_exhausted",retryable:!1,outputBudgetRecoveryAvailable:T,outputBudgetRecoveryTokens:O})),U=!0;return}if(!w&&!C&&E!=="tool_calls"){let O=o(Z??"adaptive",$),T=O!==void 0;k.debug("qlex completed without visible output",{tier:Z,outputBudgetRecoveryAvailable:T}),_.error(new g("empty output",{category:"empty_output",retryable:!1,outputBudgetRecoveryAvailable:T,outputBudgetRecoveryTokens:O})),U=!0;return}if(_.enqueue(V.encode(JH({},j,N))),_.enqueue(V.encode(`data: [DONE]
19
-
20
- `)),!P&&Z!==void 0)k.info("qlex cost frame absent on stream finish",{tier:Z});_.close(),U=!0},M=(D)=>{let N=MJ(D);switch(h++,N.kind){case"skip":return!1;case"token":return q(N.content),!1;case"passthrough":{let j=N.chunk.choices;if(Array.isArray(j)&&j[0]&&typeof j[0]==="object"){let O=j[0].finish_reason;if(typeof O==="string")E=O;let T=j[0].delta;if(typeof T?.content==="string"&&T.content.length>0)w=!0;if(Array.isArray(T?.tool_calls))C=!0;DJ(j[0].delta)}G=!0;{let O=N.chunk.choices?.[0]?.delta?.content;if(typeof O==="string")A+=O.length}return _.enqueue(V.encode(`data: ${JSON.stringify(N.chunk)}
21
-
22
- `)),!1}case"cost":if(N.cost.final)P=N.cost;return!1;case"usage":if(N.usage.context_window!==void 0)S=N.usage.context_window;if(N.usage.prompt_tokens!==void 0&&N.usage.completion_tokens!==void 0)L={prompt:N.usage.prompt_tokens,completion:N.usage.completion_tokens};if(N.finishReason!==void 0)E=N.finishReason;return!1;case"control":{if(N.control==="tier-output-limits"){let j=N.chunk;if(Z!==void 0)SJ(Z,j);k.debug("qlex tier output limits",{tierOutputLimit:j.tierOutputLimit,tierRecommendedStepTokens:j.tierRecommendedStepTokens,tierStepGuidance:j.tierStepGuidance,reasoningReserveTokens:j.reasoningReserveTokens,visibleOutputFloorTokens:j.visibleOutputFloorTokens,recommendedTotalTokens:j.recommendedTotalTokens,viableTotalFloorTokens:j.viableTotalFloorTokens,reasoningReported:j.reasoningReported,budgetPolicyVersion:j.budgetPolicyVersion})}else k.debug("qlex control frame dropped",{id:N.chunk.id,object:N.chunk.object});return!1}case"done":return R(),!0;case"error":{let j=rH(N.message);k.warn("qlex stream error frame",{tier:Z,raw:N.message,frameIndex:h,streamedContentChars:A,contentStreamed:G,upstreamCode:j.upstreamCode,requestId:j.requestId,category:j.category,retryable:j.retryable});let O=j.category==="output_budget_exhausted"||j.category==="empty_output"?o(Z??"adaptive",$):void 0;if(j.retryable===!1&&O!==void 0)j.outputBudgetRecoveryAvailable=!0,j.outputBudgetRecoveryTokens=O;return _.error(new g(N.message,j,{textKept:w})),U=!0,!0}}},B=async()=>{if(!(z>0))return X.read();let D;try{return await Promise.race([X.read(),new Promise((N,j)=>{D=setTimeout(()=>{let O=Math.round(z/1000);k.warn("qlex stream idle timeout",{tier:Z,idleTimeoutMs:z,frameIndex:h,streamedContentChars:A,contentStreamed:G}),j(new g(`the gateway sent nothing for ${O}s`,{category:"transient",retryable:!0})),X.cancel(Error(`qlex stream idle for ${O}s`)).catch(()=>{})},z)})])}finally{if(D!==void 0)clearTimeout(D)}};try{while(!0){let{done:N,value:j}=await B();if(N)break;W+=Y.decode(j,{stream:!0});let O;while((O=W.indexOf(`
23
-
24
- `))!==-1){let T=W.slice(0,O);if(W=W.slice(O+2),M(T))return}}W+=Y.decode();let D=W.replace(/\r?\n$/,"");if(D.length>0&&M(D))return;if(!U)R()}catch(D){if(!U)_.error(D instanceof g?D:new g(D instanceof Error?D.message:String(D)))}finally{X.releaseLock()}},cancel(_){X.cancel(_).catch(()=>{})}})}function hH(H){return{content:typeof H.content==="string"?H.content:H.choices?.[0]?.message?.content??"",finishReason:H.choices?.[0]?.finish_reason??"stop"}}function RJ(H){let J=H??{},{content:K,finishReason:Z}=hH(J),$=J.usage??{},z=$.prompt_tokens??0,X=$.completion_tokens??0,Y="orch-"+Date.now().toString(36),V=Math.floor(Date.now()/1000),W=(L,E,w)=>{let C={id:Y,object:"chat.completion.chunk",created:V,model:"orchestrated",choices:[{index:0,delta:L,finish_reason:E}]};if(w)C.usage=w;return`data: ${JSON.stringify(C)}
25
-
26
- `},G={prompt_tokens:z,completion_tokens:X,total_tokens:$.total_tokens??z+X};if(typeof $.cost_usd==="number")G.cost_usd=$.cost_usd;if(typeof $.cost_credits==="number")G.cost_credits=$.cost_credits;if(typeof $.context_window==="number")G.context_window=$.context_window;let U=[W({role:"assistant",content:""},null),W({content:K},null),W({},Z,G),`data: [DONE]
27
-
28
- `],P=new TextEncoder,S=new ReadableStream({start(L){for(let E of U)L.enqueue(P.encode(E));L.close()}});return new Response(S,{status:200,headers:{"content-type":"text/event-stream"}})}function iJ(H){let J=H??{},{content:K,finishReason:Z}=hH(J),$=J.usage??{},z=$.prompt_tokens??0,X=$.completion_tokens??0,Y={id:"orch-"+Date.now(),object:"chat.completion",created:Math.floor(Date.now()/1000),model:"orchestrated",choices:[{index:0,message:{role:"assistant",content:K},finish_reason:Z}],usage:{prompt_tokens:z,completion_tokens:X,total_tokens:$.total_tokens??z+X,...typeof $.cost_usd==="number"?{cost_usd:$.cost_usd}:{},...typeof $.context_window==="number"?{context_window:$.context_window}:{}}};return new Response(JSON.stringify(Y),{status:200,headers:{"content-type":"application/json"}})}async function CJ(H,J,K){let Z=AH(H,J),$=J?`HTTP ${H}: ${J}`:`HTTP ${H}`;switch(k.error("gateway rejected request",{tier:K.tier,status:H,category:Z.category,upstreamCode:Z.upstreamCode,field:Z.field,retryable:Z.retryable}),Z.category){case"billing":return new kH(J||void 0,Z);case"rate_limited":return new EH(Z);case"gateway_routing":return new u(`HTTP ${H}`,Z);case"invalid_credentials":return await K.onInvalidCredentials?.().catch(()=>{}),new wH($,Z);case"request_too_large":return new a("irreducible",Z.upstreamMessage??J??void 0,Z);case"request_rejected":case"tool_protocol":return new RH(Z.upstreamMessage??J??void 0,Z.field,Z);case"configuration":case"transient":case"unknown":default:return new u($,Z)}}function GH(H){let J=DH();if(J===void 0)return H;let K=v(H);if(K<=J)return H;let Z=HH(H,J);return k.warn("request over known size ceiling, reducing before send",{tier:H.tier,bytes:K,ceiling:J,reducedBytes:Z.bytes,fits:Z.reduced,...Z.actions}),Z.bytes<K?Z.body:H}function jH(H){let J=v(H),K=e(J),Z=HH(H,K);if(!Z.reduced)throw k.error("request too large and cannot be reduced further",{tier:H.tier,rejectedBytes:J,ceiling:K,reducedBytes:Z.bytes,...Z.actions}),new a("irreducible");return k.warn("request too large, retrying once with reduced history",{tier:H.tier,rejectedBytes:J,ceiling:K,reducedBytes:Z.bytes,...Z.actions,notice:Q.copy().requestTooLargeRecovering()}),Z.body}function UH(H){let J=v(H);throw e(J),k.error("reduced request still too large",{tier:H.tier,rejectedBytes:J}),new a("after-reduction")}function AJ(H,J=globalThis.fetch,K,Z){let $=Z?.responseTimeoutMs??cH;return async(z,X)=>{if(X?.method==="POST"&&typeof X?.body==="string"){let Y;try{Y=JSON.parse(X.body)}catch{return J(z,X)}let V=NJ();await FJ();let W=qJ(Y.model??"adaptive"),G=WH(Y,{toolMode:V,outputAdvisory:W});if($J(Y.messages)&&!zJ(G.messages)){let{dropped:F}=TH(V==="text"?IH(Y.messages,Y.tools):Y.messages);throw k.error("refusing to send: user message lost in normalization",{tier:G.tier,toolMode:V,inputRoles:Array.isArray(Y.messages)?Y.messages.map((q)=>q&&typeof q==="object"?String(q.role):"?"):"not-an-array",droppedCount:F.length,dropped:F}),new CH("your message could not be turned into sendable content")}let U=await H(),P=typeof U==="string"?{key:U,method:"sso"}:U;if(!P?.key)throw new MH;let S=new Headers(X.headers),L=()=>{if(P.method==="api-key")S.delete("Authorization"),S.set("x-api-key",P.key);else S.delete("x-api-key"),S.set("Authorization",`Bearer ${P.key}`)};L(),S.set("Content-Type","application/json");let E=!1,w=async(F,q)=>{let R=AH(F,q),M=async()=>({retry:!1,error:await CJ(F,q,{onInvalidCredentials:K,tier:G.tier})});if(R.category!=="invalid_credentials"||E)return M();E=!0;let B=KH(P),D=await SH(P);if(D.kind==="recovered"&&KH(D.credential)!==B)return P=D.credential,L(),{retry:!0};if(D.kind==="inconclusive")return{retry:!1,error:new u(`HTTP ${F}: ${D.reason}`,R)};return M()};if(G.tier==="orchestrated"){let F=X.signal,q=async(B)=>{let D=new AbortController,N=()=>D.abort(F?.reason);if(F)if(F.aborted)D.abort(F.reason);else F.addEventListener("abort",N,{once:!0});let j=!1,O=setTimeout(()=>{j=!0,D.abort()},$);try{return await J(uH,{method:"POST",headers:S,body:JSON.stringify(B),signal:D.signal})}catch(T){if(j)throw new u(`no response within ${Math.round($/1000)}s`);throw T}finally{clearTimeout(O),F?.removeEventListener("abort",N)}},R=GH(G),M=await q(R);if(M.status===413){if(await M.body?.cancel().catch(()=>{}),R=jH(R),M=await q(R),M.status===413)await M.body?.cancel().catch(()=>{}),UH(R)}while(!M.ok){let B=await M.text().catch(()=>""),D=await w(M.status,B);if(!D.retry)throw D.error;M=await q(R)}return RJ(await M.json())}let C=X.signal,h=async(F)=>{let q=new AbortController,R=()=>q.abort(C?.reason);if(C)if(C.aborted)q.abort(C.reason);else C.addEventListener("abort",R,{once:!0});let M=()=>C?.removeEventListener("abort",R),B=!1,D=setTimeout(()=>{B=!0,q.abort()},$);try{return{res:await J(pH,{method:"POST",headers:S,body:JSON.stringify(F),signal:q.signal}),detach:M}}catch(N){if(M(),B)throw new u(`no response within ${Math.round($/1000)}s`);throw N}finally{clearTimeout(D)}},A=GH(G),{res:_,detach:I}=await h(A);if(_.status===400&&V==="native"&&GJ(Y))I(),await _.body?.cancel().catch(()=>{}),A=WH(Y,{toolMode:"text",outputAdvisory:W}),{res:_,detach:I}=await h(A);if(_.status===413){if(I(),await _.body?.cancel().catch(()=>{}),A=jH(A),{res:_,detach:I}=await h(A),_.status===413)I(),await _.body?.cancel().catch(()=>{}),UH(A)}try{while(!_.ok){let F=await _.text().catch(()=>""),q=await w(_.status,F);if(I(),!q.retry)throw q.error;({res:_,detach:I}=await h(A))}}catch(F){throw I(),F}if(Y.stream!==!1&&_.body){let F=Array.isArray(Y.tools)&&Y.tools.length>0;return new Response(wJ(_.body,{toolProtocolEnabled:F,tier:G.tier,requestedOutputBudget:G.opts.max_tokens}),{status:_.status,statusText:_.statusText,headers:{"content-type":"text/event-stream"}})}return _}return J(z,X)}}function rJ(H){let J=H.getToken??(async()=>H.bearerToken),K=AJ(J,globalThis.fetch,H.onInvalidCredentials);return qH({name:H.name??"qlex",baseURL:Q.streamBaseUrl(),fetch:K})}function oJ(H,J){return o(H,J)!==void 0}var TJ=2;function o(H,J){let K=n.get(H)?.advisory,Z=Q.tierBudgetFacts(H),$=K?.tierOutputLimit??Z?.output;if(!$)return;let z=J??K?.recommendedTotalTokens??K?.tierRecommendedStepTokens??Z?.recommendedTotal??Z?.recommendedStep;if(!z||z>=$)return;let X=K?.recommendedTotalTokens??K?.tierRecommendedStepTokens??Z?.recommendedTotal??Z?.recommendedStep??z,Y=Math.min($,Math.max(z+1,z*TJ,X));return Y>z?Y:void 0}var i=!1,ZH=Promise.resolve();export{wJ as transformQlexStream,RJ as toOrchestratedSSEStream,iJ as toOpenAICompletion,lJ as sanitizeUpstreamProviderError,NJ as resolveToolMode,YJ as renderToolProtocolPrompt,SJ as recordTierOutputAdvisory,aH as planTierBudget,kJ as partialTagSuffixLength,MJ as parseQlexFrame,AH as parseQlexError,TH as normalizeQlexMessagesWithReport,ZJ as normalizeQlexMessages,XJ as mergeLeadingSystemMessages,oH as isGatewayRequiredError,$J as hasUserRoleMessage,zJ as hasUsableUserMessage,GJ as hasToolContext,o as getTierOutputBudgetRecovery,qJ as getTierOutputAdvisory,nJ as flushTierOutputAdvisoryWrites,s as flattenMessageContent,IH as encodeToolProtocolMessages,EJ as encodeExtractedArguments,$H as decodeToolArgumentsToObject,rJ as createQlexProvider,AJ as createCustomFetch,dJ as clearTierOutputAdvisories,rH as classifyQlexStreamError,oJ as canIncreaseTierOutputBudget,WH as buildQlexBody,xH as ToolCallExtractor,d as TOOL_CALL_OPEN,r as TOOL_CALL_CLOSE,g as QlexStreamError,a as QlexRequestTooLargeError,RH as QlexRequestRejectedError,CH as QlexRequestNotSentError,EH as QlexRateLimitError,MH as QlexNotLoggedInError,wH as QlexInvalidCredentialsError,kH as QlexInsufficientBalanceError,u as QlexGatewayError,pH as QLEX_STREAM_URL,mH as QLEX_STREAM_IDLE_TIMEOUT_MS,cH as QLEX_RESPONSE_TIMEOUT_MS,uH as QLEX_ORCHESTRATED_URL};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{hg as a,ig as b,jg as c,kg as d,lg as e}from"./chunk-7r92d7v9.js";import"./chunk-0s4cp6q2.js";import"./chunk-mrq35ftw.js";import"./chunk-nsp1za8t.js";import"./chunk-brk6bge4.js";import"./chunk-nfg7nt13.js";import"./chunk-qgkb6n8k.js";import"./chunk-dcv6wj9x.js";import"./chunk-1acn5me8.js";import"./chunk-vs3s49jw.js";import"./chunk-kre93a89.js";import"./chunk-060wbpz4.js";import"./chunk-zrhw1szj.js";import"./chunk-t8fjgkp8.js";import"./chunk-0egrckx0.js";import"./chunk-k1qd8ecm.js";import"./chunk-bhg69t69.js";import"./chunk-fv5mrdyc.js";import"./chunk-rdreeyv0.js";import"./chunk-rmsqb6r4.js";import"./chunk-7pckez5z.js";import"./chunk-k6981ysw.js";import"./chunk-sa0rrreh.js";import"./chunk-ydgst3h8.js";import"./chunk-6tqbnxar.js";import"./chunk-0w19vmd7.js";import"./chunk-eewe7tx1.js";import"./chunk-4y9wbfd2.js";import"./chunk-wm9nh9nb.js";import"./chunk-scnbt714.js";import"./chunk-cqtkxwd8.js";import"./chunk-y3gy62q5.js";import"./chunk-az3nss5m.js";import"./chunk-p2fte9vz.js";import"./chunk-ggncq8w8.js";import"./chunk-t3w43rft.js";import"./chunk-eacpc64g.js";import"./chunk-27saej0r.js";import"./chunk-b5ym419d.js";import"./chunk-29q89bge.js";import"./chunk-wqk1v8t0.js";import"./chunk-rwwvy89t.js";import"./chunk-z0kbyr00.js";import"./chunk-sbjymf20.js";import"./chunk-dt3bsmfe.js";import"./chunk-vbfej8ds.js";import"./chunk-0tm6589k.js";import"./chunk-fveaq0pb.js";import"./chunk-gswhjd1h.js";import"./chunk-wgkcyqn1.js";import"./chunk-59csnjc3.js";import"./chunk-1bxfzd6r.js";import"./chunk-6p6m5956.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-w7a33cwa.js";import"./chunk-g7v6sp3c.js";import"./chunk-s2tc3qs0.js";import"./chunk-n6tqtk6h.js";import"./chunk-e0vrxetq.js";export{c as url,b as openapi,d as listen,e as Server,a as Default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{$d as I,Rd as m,Ud as P,Vd as R,Wd as k,Xd as O,Zd as q,_d as $}from"./chunk-2kh0tg92.js";import"./chunk-52xvhxek.js";import{be as h}from"./chunk-f4mnp6xd.js";import{eg as r}from"./chunk-bwadggys.js";import{Ch as L,rh as E}from"./chunk-1acn5me8.js";import"./chunk-vs3s49jw.js";import"./chunk-kre93a89.js";import"./chunk-060wbpz4.js";import"./chunk-zrhw1szj.js";import"./chunk-t8fjgkp8.js";import"./chunk-0egrckx0.js";import{Fj as N,Uk as x}from"./chunk-k1qd8ecm.js";import"./chunk-bhg69t69.js";import{Ol as i}from"./chunk-fv5mrdyc.js";import"./chunk-rdreeyv0.js";import"./chunk-rmsqb6r4.js";import"./chunk-7pckez5z.js";import"./chunk-k6981ysw.js";import"./chunk-sa0rrreh.js";import"./chunk-ydgst3h8.js";import"./chunk-6tqbnxar.js";import"./chunk-0w19vmd7.js";import"./chunk-eewe7tx1.js";import"./chunk-4y9wbfd2.js";import"./chunk-wm9nh9nb.js";import"./chunk-scnbt714.js";import"./chunk-cqtkxwd8.js";import"./chunk-y3gy62q5.js";import"./chunk-az3nss5m.js";import"./chunk-p2fte9vz.js";import"./chunk-ggncq8w8.js";import"./chunk-t3w43rft.js";import"./chunk-eacpc64g.js";import"./chunk-27saej0r.js";import"./chunk-b5ym419d.js";import"./chunk-29q89bge.js";import"./chunk-wqk1v8t0.js";import"./chunk-rwwvy89t.js";import"./chunk-z0kbyr00.js";import"./chunk-sbjymf20.js";import"./chunk-dt3bsmfe.js";import"./chunk-vbfej8ds.js";import"./chunk-0tm6589k.js";import"./chunk-fveaq0pb.js";import"./chunk-gswhjd1h.js";import"./chunk-wgkcyqn1.js";import"./chunk-59csnjc3.js";import{gt as C,lt as j}from"./chunk-1bxfzd6r.js";import"./chunk-6p6m5956.js";import"./chunk-a48mx917.js";import"./chunk-3va85mbe.js";import"./chunk-w7a33cwa.js";import"./chunk-g7v6sp3c.js";import"./chunk-s2tc3qs0.js";import"./chunk-n6tqtk6h.js";import{tO as F}from"./chunk-e0vrxetq.js";import u from"path";import U from"fs/promises";var T=F(N(),1);import{EOL as S}from"os";var c=["bash","read","write","edit","glob","grep","webfetch","actor","task"],B=h({command:"create",describe:"create a new agent",builder:(o)=>o.option("path",{type:"string",describe:"directory path to generate the agent file"}).option("description",{type:"string",describe:"what the agent should do"}).option("mode",{type:"string",describe:"agent mode",choices:["all","primary","subagent"]}).option("tools",{type:"string",describe:`comma-separated list of tools to enable (default: all). Available: "${c.join(", ")}"`}).option("model",{type:"string",alias:["m"],describe:"model to use in the format of provider/model"}),async handler(o){await i.provide({directory:process.cwd(),async fn(){let{path:l,description:t,mode:s,tools:p}=o,d=l&&t&&s&&p!==void 0;if(!d)r.empty(),R("Create agent");let D=i.project,g;if(l)g=u.join(l,"agent");else{let e="global";if(D.vcs==="git"){let n=await $({message:"Location",options:[{label:"Current project",value:"project",hint:i.worktree},{label:"Global",value:"global",hint:j.Path.config}]});if(m(n))throw new r.CancelledError;e=n}g=u.join(e==="global"?j.Path.config:u.join(i.worktree,".qitqode"),"agent")}let b;if(t)b=t;else{let e=await I({message:"Description",placeholder:"What should this agent do?",validate:(n)=>n&&n.length>0?void 0:"Required"});if(m(e))throw new r.CancelledError;b=e}let w=q();w.start("Generating agent configuration...");let G=o.model?x.parseModel(o.model):void 0,f=await L.runPromise(E.Service.use((e)=>e.generate({description:b,model:G}))).catch((e)=>{if(w.stop(`LLM failed to generate agent: ${e.message}`,1),d)process.exit(1);throw new r.CancelledError});w.stop(`Agent ${f.identifier} generated`);let y;if(p!==void 0)y=p?p.split(",").map((e)=>e.trim()):c;else{let e=await O({message:"Select tools to enable (Space to toggle)",options:c.map((n)=>({label:n,value:n})),initialValues:c});if(m(e))throw new r.CancelledError;y=e}let v;if(s)v=s;else{let e=await $({message:"Agent mode",options:[{label:"All",value:"all",hint:"Can function in both primary and subagent roles"},{label:"Primary",value:"primary",hint:"Acts as a primary/main agent"},{label:"Subagent",value:"subagent",hint:"Can be used as a subagent by other agents"}],initialValue:"all"});if(m(e))throw new r.CancelledError;v=e}let A={};for(let e of c)if(!y.includes(e))A[e]=!1;let M={description:f.whenToUse,mode:v};if(Object.keys(A).length>0)M.tools=A;let V=T.default.stringify(f.systemPrompt,M),a=u.join(g,`${f.identifier}.md`);if(await U.mkdir(g,{recursive:!0}),await C.exists(a)){if(d)console.error(`Error: Agent file already exists: ${a}`),process.exit(1);throw P.error(`Agent file already exists: ${a}`),new r.CancelledError}if(await C.write(a,V),d)console.log(a);else P.success(`Agent created: ${a}`),k("Done")}})}}),J=h({command:"list",describe:"list all available agents",async handler(){await i.provide({directory:process.cwd(),async fn(){let l=(await L.runPromise(E.Service.use((t)=>t.list()))).sort((t,s)=>{if(t.native!==s.native)return t.native?-1:1;return t.name.localeCompare(s.name)});for(let t of l)process.stdout.write(`${t.name} (${t.mode})`+S),process.stdout.write(` ${JSON.stringify(t.permission,null,2)}`+S)}})}}),ne=h({command:"agent",describe:"manage agents",builder:(o)=>o.command(B).command(J).demandCommand(),async handler(){}});export{ne as AgentCommand};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{xO as t}from"./chunk-e0vrxetq.js";var e=await import("./chunk-j871xzr7.js",{with:{type:"file"}}),a=e.default;export{a as default};
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{Of as a}from"./chunk-ahmy80vb.js";import"./chunk-p8ak162p.js";import"./chunk-nfg7nt13.js";import"./chunk-qgkb6n8k.js";import"./chunk-e0vrxetq.js";export{a as default};