@qitqode/qitqode-android-arm64 0.2.14 → 0.2.16
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.
- package/bun +2 -2
- package/bundle/{chunk-wrzn87w0.js → chunk-098mr0zz.js} +1 -1
- package/bundle/{chunk-j15wejz0.js → chunk-0catm9vq.js} +1 -1
- package/bundle/{chunk-kdqhwa65.js → chunk-0cqs1qkh.js} +1 -1
- package/bundle/{chunk-d10qre1b.js → chunk-0f3ncvfe.js} +1 -1
- package/bundle/{chunk-583d91xq.js → chunk-0gqwvt8w.js} +2 -2
- package/bundle/chunk-0mb55ytc.js +2 -0
- package/bundle/{chunk-9zsp3qkh.js → chunk-0n2ncnwz.js} +1 -1
- package/bundle/chunk-0y0hm0m5.js +2 -0
- package/bundle/chunk-120e8yr1.js +2 -0
- package/bundle/{chunk-spcdwmy4.js → chunk-1aneepm5.js} +1 -1
- package/bundle/chunk-1dxm8yev.js +2 -0
- package/bundle/{chunk-96sra8g8.js → chunk-1jg7cybp.js} +1 -1
- package/bundle/{chunk-ngygp66y.js → chunk-1k5nfw7g.js} +1 -1
- package/bundle/{chunk-fmcg649e.js → chunk-1kksj8cn.js} +1 -1
- package/bundle/chunk-1pgpv979.js +2 -0
- package/bundle/{chunk-szfqmkj6.js → chunk-1xsjkf4c.js} +1 -1
- package/bundle/{chunk-zx63mepv.js → chunk-1yetxft4.js} +1 -1
- package/bundle/chunk-23zh9s18.js +2 -0
- package/bundle/{chunk-8qpfphdz.js → chunk-24pf9s68.js} +1 -1
- package/bundle/chunk-2a0zf12g.js +2 -0
- package/bundle/chunk-2b8x31p3.js +2 -0
- package/bundle/chunk-2cvmdss3.js +2 -0
- package/bundle/{chunk-bm8azfnt.js → chunk-2kvghwar.js} +1 -1
- package/bundle/{chunk-ch7s512a.js → chunk-2nkjwqpm.js} +1 -1
- package/bundle/chunk-2qbsg6dp.js +2 -0
- package/bundle/{chunk-9ttebtcf.js → chunk-2rvs18fx.js} +1 -1
- package/bundle/{chunk-rxt6gktt.js → chunk-2thbax1j.js} +1 -1
- package/bundle/{chunk-6y0wgz2j.js → chunk-2zxygnx4.js} +1 -1
- package/bundle/{chunk-zgwasq3p.js → chunk-36kg3v3k.js} +1 -1
- package/bundle/{chunk-1gdt9q05.js → chunk-37hh7eee.js} +1 -1
- package/bundle/chunk-39mwv068.js +2 -0
- package/bundle/{chunk-set1f1wr.js → chunk-39z0qxkt.js} +1 -1
- package/bundle/{chunk-p0852vfn.js → chunk-3dfy9k0t.js} +2 -2
- package/bundle/{chunk-et3tgx7t.js → chunk-3e26pryk.js} +1 -1
- package/bundle/{chunk-vzkdzhn0.js → chunk-3eddms0g.js} +1 -1
- package/bundle/chunk-3re79hkf.js +2 -0
- package/bundle/{chunk-sy76e7nr.js → chunk-3vjs8aht.js} +1 -1
- package/bundle/{chunk-k769v1ds.js → chunk-3z7r4c0p.js} +1 -1
- package/bundle/chunk-40pe0tde.js +11 -0
- package/bundle/{chunk-0ejx0yqx.js → chunk-47nber5v.js} +1 -1
- package/bundle/{chunk-bga4kqd1.js → chunk-491f4ab9.js} +2 -2
- package/bundle/{chunk-3152y1q9.js → chunk-4bp91rza.js} +1 -1
- package/bundle/{chunk-pdcxmr6x.js → chunk-4dy64hgp.js} +1 -1
- package/bundle/{chunk-0mztgsxp.js → chunk-4fqwg54p.js} +1 -1
- package/bundle/{chunk-2w3n0q9m.js → chunk-4gv7nsdd.js} +2 -2
- package/bundle/{chunk-2ascwm7j.js → chunk-4nw19yab.js} +1 -1
- package/bundle/chunk-51fyaa6r.js +2 -0
- package/bundle/{chunk-9znfb8f2.js → chunk-52f62kr0.js} +2 -2
- package/bundle/chunk-52n4tdeh.js +5 -0
- package/bundle/{chunk-x4jnyj09.js → chunk-543jma8r.js} +1 -1
- package/bundle/chunk-58q03ah1.js +2 -0
- package/bundle/{chunk-hrcqbadm.js → chunk-5fhy0wb0.js} +1 -1
- package/bundle/{chunk-8zpsgfb6.js → chunk-5fym1zr2.js} +1 -1
- package/bundle/{chunk-a3g8de96.js → chunk-5k5jdayv.js} +1 -1
- package/bundle/chunk-5nmqgqj2.js +2 -0
- package/bundle/{chunk-psmwrvqs.js → chunk-5t69v8jg.js} +2 -2
- package/bundle/{chunk-7w571q26.js → chunk-5vtbg7pj.js} +1 -1
- package/bundle/{chunk-g738e799.js → chunk-5xmtzs15.js} +2 -2
- package/bundle/chunk-5ydg5ny1.js +2 -0
- package/bundle/{chunk-v5me0cj9.js → chunk-5z5rk3ng.js} +1 -1
- package/bundle/{chunk-5dvy83ms.js → chunk-62mb6wxm.js} +2 -2
- package/bundle/chunk-62mytrwv.js +2 -0
- package/bundle/{chunk-edvfqxfr.js → chunk-6396bg4p.js} +1 -1
- package/bundle/chunk-63bccmze.js +2 -0
- package/bundle/{chunk-1ypzf18e.js → chunk-64x1vtdq.js} +1 -1
- package/bundle/{chunk-9mabvb06.js → chunk-6kx4atkt.js} +1 -1
- package/bundle/{chunk-dmb0ez0m.js → chunk-6r7vm4xc.js} +3 -3
- package/bundle/{chunk-tcyzj3rz.js → chunk-6rggm6tm.js} +1 -1
- package/bundle/{chunk-fp2xgnjn.js → chunk-6vpc1y3w.js} +2 -2
- package/bundle/{chunk-71jmhvef.js → chunk-6vxddv5w.js} +2 -2
- package/bundle/chunk-6ynaebaw.js +2 -0
- package/bundle/{chunk-ep4drmt9.js → chunk-700jhn67.js} +1 -1
- package/bundle/{chunk-fdmz0502.js → chunk-76jbys6j.js} +2 -2
- package/bundle/chunk-782y3dm8.js +2 -0
- package/bundle/{chunk-d7h1dp0h.js → chunk-89g9wzc2.js} +1 -1
- package/bundle/chunk-8q50bha4.js +2 -0
- package/bundle/chunk-8v6qbhm1.js +2 -0
- package/bundle/chunk-955jtenj.js +2 -0
- package/bundle/chunk-95yzwxpf.js +2 -0
- package/bundle/{chunk-2w79k0mh.js → chunk-96281xfb.js} +2 -2
- package/bundle/{chunk-bdcd2mcb.js → chunk-96657nrr.js} +2 -2
- package/bundle/chunk-99ansgsj.js +2 -0
- package/bundle/{chunk-3c73rngn.js → chunk-9dd2krfn.js} +1 -1
- package/bundle/chunk-9exxjnxc.js +2 -0
- package/bundle/{chunk-eqsank84.js → chunk-9ge1mkfs.js} +1 -1
- package/bundle/{chunk-4r7fbkcm.js → chunk-9mmaja9n.js} +1 -1
- package/bundle/{chunk-mjkwd1sz.js → chunk-9rd7q5e9.js} +1 -1
- package/bundle/{chunk-6cztstry.js → chunk-9skj2w9e.js} +2 -2
- package/bundle/{chunk-nb4xtk1n.js → chunk-9tdbts1r.js} +1 -1
- package/bundle/{chunk-sg9enzsp.js → chunk-9tfm1dk2.js} +2 -2
- package/bundle/{chunk-z6qyx227.js → chunk-9xaea8h1.js} +1 -1
- package/bundle/{chunk-meehnnv9.js → chunk-a0c6w901.js} +2 -2
- package/bundle/chunk-a2tp2f6s.js +2 -0
- package/bundle/{chunk-69htq8kq.js → chunk-a3ynq3h7.js} +1 -1
- package/bundle/chunk-a4y0wjtq.js +3 -0
- package/bundle/{chunk-6dd2dx69.js → chunk-afagt413.js} +2 -2
- package/bundle/{chunk-px69995t.js → chunk-afzx47y2.js} +1 -1
- package/bundle/chunk-ag3s3t7x.js +2 -0
- package/bundle/{chunk-n7zd97hy.js → chunk-ajdn1n77.js} +2 -2
- package/bundle/chunk-arwm1qxm.js +2 -0
- package/bundle/{chunk-adws0hhk.js → chunk-awt3q88j.js} +2 -2
- package/bundle/{chunk-qn1fhqyw.js → chunk-az2pxgx6.js} +2 -2
- package/bundle/chunk-b0gq0s8a.js +2 -0
- package/bundle/{chunk-48rg4yhk.js → chunk-b2zfr7jz.js} +2 -2
- package/bundle/{chunk-mbmaeq0a.js → chunk-b63733cw.js} +1 -1
- package/bundle/chunk-b7430vg8.js +2 -0
- package/bundle/{chunk-07b4pkk6.js → chunk-b7dw5ged.js} +1 -1
- package/bundle/{chunk-prz2fkn9.js → chunk-b83qf145.js} +1 -1
- package/bundle/{chunk-veptx3fk.js → chunk-b8w33ck9.js} +1 -1
- package/bundle/{chunk-674pexjx.js → chunk-bd21p9zz.js} +2 -2
- package/bundle/chunk-be2z0tr4.js +2 -0
- package/bundle/{chunk-x0de4z05.js → chunk-bkqemdv8.js} +2 -2
- package/bundle/chunk-bq585t67.js +2 -0
- package/bundle/chunk-bts3gw8w.js +2 -0
- package/bundle/{chunk-qz20b42s.js → chunk-c0sr83np.js} +1 -1
- package/bundle/{chunk-zh7e6kqs.js → chunk-c4tdfar1.js} +1 -1
- package/bundle/chunk-c6ege2yp.js +2 -0
- package/bundle/{chunk-00ft63qn.js → chunk-chs4bkgh.js} +1 -1
- package/bundle/{chunk-8b9z8j3z.js → chunk-cm426ssg.js} +1 -1
- package/bundle/{chunk-crqycrs4.js → chunk-d4y5hyjg.js} +2 -2
- package/bundle/chunk-de0edzjs.js +2 -0
- package/bundle/{chunk-4hvenszg.js → chunk-der5kj1b.js} +1 -1
- package/bundle/{chunk-6d4xc6br.js → chunk-dhykktcp.js} +1 -1
- package/bundle/{chunk-8jkqyf9n.js → chunk-dm7hfb7f.js} +2 -2
- package/bundle/chunk-dntnvfdz.js +2 -0
- package/bundle/{chunk-q1dmxn63.js → chunk-dptvy1zn.js} +2 -2
- package/bundle/{chunk-2k2szpze.js → chunk-dqt8rrey.js} +1 -1
- package/bundle/{chunk-ky3fhz9z.js → chunk-dr003xka.js} +1 -1
- package/bundle/chunk-dtyzk0j7.js +2 -0
- package/bundle/{chunk-qrztx1b4.js → chunk-dwza14dk.js} +2 -2
- package/bundle/chunk-e3tmbywr.js +2 -0
- package/bundle/{chunk-ej0yzstw.js → chunk-e4nap6v9.js} +2 -2
- package/bundle/{chunk-5h1s0akp.js → chunk-e7x8v549.js} +1 -1
- package/bundle/{chunk-1e75j4m1.js → chunk-e826jvr2.js} +2 -2
- package/bundle/{chunk-9z7y4x7q.js → chunk-edm4c812.js} +1 -1
- package/bundle/{chunk-ws720v4j.js → chunk-eearwfay.js} +1 -1
- package/bundle/{chunk-gkf7x1yj.js → chunk-ekavngf7.js} +1 -1
- package/bundle/chunk-em637k9q.js +2 -0
- package/bundle/{chunk-8gkz5550.js → chunk-epncmz5t.js} +1 -1
- package/bundle/chunk-eytpz91c.js +8 -0
- package/bundle/chunk-f4qcwbx0.js +2 -0
- package/bundle/{chunk-a8askx4y.js → chunk-f6gd8809.js} +1 -1
- package/bundle/{chunk-e8s4mp5n.js → chunk-fcbmedh3.js} +2 -2
- package/bundle/{chunk-4ycg2c6f.js → chunk-fg5f3a8a.js} +2 -2
- package/bundle/chunk-fj7jcv7m.js +2 -0
- package/bundle/{chunk-47jkx37s.js → chunk-ft4msj4z.js} +3 -3
- package/bundle/chunk-fyntc5hj.js +2 -0
- package/bundle/chunk-fyt4yaq7.js +2 -0
- package/bundle/chunk-g4hcxhfs.js +2 -0
- package/bundle/{chunk-c5cyt23k.js → chunk-g7twcprm.js} +2 -2
- package/bundle/{chunk-9amnqaeq.js → chunk-g8844pb4.js} +1 -1
- package/bundle/{chunk-w136zswr.js → chunk-ganwjd6s.js} +3 -3
- package/bundle/chunk-gdew108b.js +2 -0
- package/bundle/chunk-gdy74wte.js +2 -0
- package/bundle/{chunk-7a4sb6q7.js → chunk-gse0cgqc.js} +1 -1
- package/bundle/{chunk-z0dj15g9.js → chunk-gsjgbm0d.js} +1 -1
- package/bundle/{chunk-a1mbach4.js → chunk-gt10s0ks.js} +1 -1
- package/bundle/{chunk-qpk7jp6t.js → chunk-gxpx2nd8.js} +1 -1
- package/bundle/{chunk-4p9fny77.js → chunk-gxq2fwnc.js} +1 -1
- package/bundle/chunk-gz90qgcn.js +2 -0
- package/bundle/chunk-gzz78dnm.js +2 -0
- package/bundle/{chunk-840mmmzz.js → chunk-h3yazfmh.js} +4 -4
- package/bundle/{chunk-d4faz5xa.js → chunk-h429rzqp.js} +1 -1
- package/bundle/{chunk-f0dp1tf9.js → chunk-h5y0pwwc.js} +1 -1
- package/bundle/{chunk-62gefpwn.js → chunk-h6b6acrv.js} +2 -2
- package/bundle/{chunk-19rs84t8.js → chunk-h8bq75er.js} +1 -1
- package/bundle/{chunk-99df6wvm.js → chunk-ha147mdc.js} +1 -1
- package/bundle/{chunk-xdcwx384.js → chunk-ha1w0xzh.js} +1 -1
- package/bundle/{chunk-5341jv20.js → chunk-ha294vpj.js} +1 -1
- package/bundle/chunk-hfrjkgyk.js +2 -0
- package/bundle/chunk-hjpt1n6g.js +2 -0
- package/bundle/{chunk-bzh71a92.js → chunk-hvdre0mb.js} +1 -1
- package/bundle/{chunk-86sfzgnf.js → chunk-hxf2a10r.js} +1 -1
- package/bundle/{chunk-4ppw719f.js → chunk-j09qf4zh.js} +1 -1
- package/bundle/chunk-j0jayfyn.js +35 -0
- package/bundle/{chunk-ffz334ab.js → chunk-j5b0yc0f.js} +1 -1
- package/bundle/{chunk-n6pn4f3r.js → chunk-j767byd1.js} +1 -1
- package/bundle/chunk-j794z99k.js +2 -0
- package/bundle/{chunk-y1v7mf1a.js → chunk-j95mkzwg.js} +123 -123
- package/bundle/{chunk-rn3je2hv.js → chunk-jcznttek.js} +1 -1
- package/bundle/{chunk-4v29ayke.js → chunk-jgw20mxx.js} +1 -1
- package/bundle/{chunk-175720ws.js → chunk-jhdpwndc.js} +2 -2
- package/bundle/{chunk-9gxyt2ay.js → chunk-jkqa49xc.js} +2 -2
- package/bundle/{chunk-sb3cgb4v.js → chunk-jmg64erz.js} +1 -1
- package/bundle/chunk-jpw7z507.js +2 -0
- package/bundle/{chunk-3cs1qf8x.js → chunk-jr622341.js} +1 -1
- package/bundle/{chunk-qpggztkq.js → chunk-jv69hdp0.js} +2 -2
- package/bundle/chunk-jx9c90ft.js +2 -0
- package/bundle/{chunk-fpzkyzny.js → chunk-kevhkmn2.js} +2 -2
- package/bundle/{chunk-bxnsrggq.js → chunk-khpjjjsb.js} +1 -1
- package/bundle/chunk-kkfrys0w.js +2 -0
- package/bundle/chunk-kkq2vwm6.js +2 -0
- package/bundle/{chunk-qqsj69m2.js → chunk-km1tyeyy.js} +1 -1
- package/bundle/chunk-kp0w1p79.js +2 -0
- package/bundle/chunk-kr7t73tg.js +3 -0
- package/bundle/chunk-kt7q9620.js +2 -0
- package/bundle/{chunk-8a9sj8gp.js → chunk-kzcb1pt4.js} +1 -1
- package/bundle/{chunk-jwv6fda1.js → chunk-m0f6cf9n.js} +2 -2
- package/bundle/chunk-m30bgt2t.js +2 -0
- package/bundle/chunk-m318f9es.js +2 -0
- package/bundle/{chunk-1mfdmm2t.js → chunk-m5r6zq6v.js} +1 -1
- package/bundle/chunk-m6g6za7b.js +2 -0
- package/bundle/chunk-m8djypsy.js +11 -0
- package/bundle/chunk-ma0vvbvy.js +2 -0
- package/bundle/chunk-mha4n5md.js +2 -0
- package/bundle/{chunk-s9epttpy.js → chunk-mhq2a5ms.js} +1 -1
- package/bundle/chunk-mp9qhnxg.js +2 -0
- package/bundle/{chunk-gd0j16gn.js → chunk-mqdvthkm.js} +1 -1
- package/bundle/{chunk-69k7cdtv.js → chunk-mqe1qa6t.js} +2 -2
- package/bundle/{chunk-j45p2v4a.js → chunk-mz6swd88.js} +3 -3
- package/bundle/{chunk-0m4gvjcv.js → chunk-n25t4j9w.js} +2 -2
- package/bundle/{chunk-hx13a8es.js → chunk-n7ewvphw.js} +3 -3
- package/bundle/chunk-n9wre9wx.js +2 -0
- package/bundle/chunk-ncbj74tk.js +3 -0
- package/bundle/{chunk-06tgmvh6.js → chunk-ne3z7yye.js} +2 -2
- package/bundle/chunk-nnyvn2pm.js +2 -0
- package/bundle/chunk-nyhx3822.js +2 -0
- package/bundle/{chunk-zjyaze0d.js → chunk-p54bzjtv.js} +1 -1
- package/bundle/{chunk-dvp0r93q.js → chunk-p5d5qyzq.js} +1 -1
- package/bundle/{chunk-m8kjtp60.js → chunk-p6mxxem5.js} +1 -1
- package/bundle/{chunk-fd04358e.js → chunk-p76c9s6g.js} +310 -309
- package/bundle/chunk-p8etcskm.js +2 -0
- package/bundle/{chunk-b350g18y.js → chunk-pf4gwr34.js} +2 -2
- package/bundle/{chunk-wf0n1cs9.js → chunk-pf61zhms.js} +1 -1
- package/bundle/{chunk-sh03ka27.js → chunk-pfx8ts02.js} +1 -1
- package/bundle/{chunk-e611m0p4.js → chunk-phvp9h7w.js} +1 -1
- package/bundle/chunk-pv71d7f3.js +2 -0
- package/bundle/{chunk-6wmtbebc.js → chunk-pwcmc8j7.js} +1 -1
- package/bundle/{chunk-g77kddrs.js → chunk-pyt4xpze.js} +2 -2
- package/bundle/{chunk-1bq15kf0.js → chunk-q0pd8bac.js} +2 -2
- package/bundle/{chunk-yg9n2a2d.js → chunk-q12dtxep.js} +1 -1
- package/bundle/{chunk-v1axkp21.js → chunk-q2j2dm96.js} +2 -2
- package/bundle/{chunk-rx9eh3db.js → chunk-qf1hh45g.js} +3 -3
- package/bundle/{chunk-p4xqfkbh.js → chunk-qqjspfqw.js} +1 -1
- package/bundle/{chunk-9kc2th5c.js → chunk-qvnsgyfk.js} +2 -2
- package/bundle/{chunk-rqap90xh.js → chunk-qz35c4xy.js} +2 -2
- package/bundle/{chunk-bemyyen3.js → chunk-r3z77rjn.js} +1 -1
- package/bundle/{chunk-chnr7pe5.js → chunk-r7mcn9ey.js} +1 -1
- package/bundle/{chunk-nzz7gzg2.js → chunk-rmpgmjtd.js} +1 -1
- package/bundle/{chunk-k0chq88p.js → chunk-rpt3rm31.js} +1 -1
- package/bundle/chunk-rteaec1s.js +2 -0
- package/bundle/chunk-rxwcah73.js +2 -0
- package/bundle/{chunk-s0gmxpxm.js → chunk-s1gy4hnw.js} +2 -2
- package/bundle/{chunk-4s1n38ds.js → chunk-s2ma1nz3.js} +2 -2
- package/bundle/chunk-s3gjc4m0.js +2 -0
- package/bundle/{chunk-6yshpz0z.js → chunk-s5taq9jy.js} +2 -2
- package/bundle/{chunk-5mf4qrye.js → chunk-s7017cak.js} +2 -2
- package/bundle/{chunk-6pt6nqwk.js → chunk-s9bn800b.js} +1 -1
- package/bundle/{chunk-73a7ts8r.js → chunk-sa3rjs2s.js} +1 -1
- package/bundle/{chunk-wfpnv00c.js → chunk-sprbs7aj.js} +2 -2
- package/bundle/{chunk-10q04xh5.js → chunk-sq2z7keb.js} +1 -1
- package/bundle/{chunk-w8nj5ph5.js → chunk-sqrx9csx.js} +1 -1
- package/bundle/{chunk-art8gejd.js → chunk-srf4jqcj.js} +1 -1
- package/bundle/{chunk-ffyj5nsg.js → chunk-ssp3nw24.js} +2 -2
- package/bundle/{chunk-6kch0q2d.js → chunk-svnhycdw.js} +2 -2
- package/bundle/chunk-swm990q6.js +2 -0
- package/bundle/chunk-sy42ayp2.js +2 -0
- package/bundle/{chunk-5rvvfgfy.js → chunk-t3kxce69.js} +2 -2
- package/bundle/chunk-t7mvej98.js +2 -0
- package/bundle/{chunk-6j53vtzd.js → chunk-t8pmy758.js} +1 -1
- package/bundle/{chunk-v7v0krrj.js → chunk-t9srpmte.js} +1 -1
- package/bundle/{chunk-358wdvj7.js → chunk-tatecas7.js} +2 -2
- package/bundle/chunk-teagh4hx.js +2 -0
- package/bundle/{chunk-avksqxan.js → chunk-tf40p520.js} +1 -1
- package/bundle/{chunk-y5ydtbpd.js → chunk-tpgksx59.js} +1 -1
- package/bundle/{chunk-02tmc2st.js → chunk-tr4cze2c.js} +1 -1
- package/bundle/chunk-tv4cp6f9.js +2 -0
- package/bundle/chunk-tw618904.js +2 -0
- package/bundle/{chunk-zpjtse0z.js → chunk-v1bqh3m6.js} +176 -176
- package/bundle/{chunk-j46bxb1b.js → chunk-v3bfzxxg.js} +1 -1
- package/bundle/{chunk-vr13f6b5.js → chunk-v5gf0wx6.js} +2 -2
- package/bundle/{chunk-d385e2qt.js → chunk-v6mnbwtz.js} +1 -1
- package/bundle/{chunk-bq6cvf16.js → chunk-v93gr6n9.js} +2 -2
- package/bundle/chunk-vdpffam0.js +2 -0
- package/bundle/chunk-ve5w7nkb.js +2 -0
- package/bundle/chunk-vey57h4x.js +30 -0
- package/bundle/{chunk-pwq2f75j.js → chunk-vf492zs6.js} +1 -1
- package/bundle/{chunk-fkq0v5qv.js → chunk-vg9ec44m.js} +2 -2
- package/bundle/{chunk-61b81z2h.js → chunk-vh3n53qq.js} +1 -1
- package/bundle/{chunk-bmdqb48f.js → chunk-vk8gxf4y.js} +1 -1
- package/bundle/{chunk-rd08wx37.js → chunk-vr222v2n.js} +2 -2
- package/bundle/chunk-vrpca62q.js +2 -0
- package/bundle/{chunk-x3dzzq0t.js → chunk-w5fx69cw.js} +1 -1
- package/bundle/{chunk-05bkxat0.js → chunk-w9w59zjv.js} +2 -2
- package/bundle/{chunk-xmf59618.js → chunk-wbz79hns.js} +1 -1
- package/bundle/{chunk-gfvq78gy.js → chunk-wdrfzx4m.js} +1 -1
- package/bundle/{chunk-j3agzs13.js → chunk-wf18y499.js} +2 -2
- package/bundle/chunk-wvvygzz2.js +2 -0
- package/bundle/{chunk-w4fr00s7.js → chunk-wyxc99aa.js} +2 -2
- package/bundle/{chunk-5q98z8ck.js → chunk-x2mbre12.js} +2 -2
- package/bundle/{chunk-2d61z24r.js → chunk-x8rr2f15.js} +1 -1
- package/bundle/{chunk-7s9msscb.js → chunk-xpmgqa5n.js} +1 -1
- package/bundle/{chunk-rws2tsdv.js → chunk-xrwsttb7.js} +1 -1
- package/bundle/{chunk-wmj3xndt.js → chunk-xz6psr05.js} +1 -1
- package/bundle/{chunk-4xqwt6dr.js → chunk-xzshjp04.js} +2 -2
- package/bundle/chunk-y27gwnx9.js +2 -0
- package/bundle/chunk-y2ms7q84.js +2 -0
- package/bundle/{chunk-1pft3sar.js → chunk-y8bjb32m.js} +1 -1
- package/bundle/{chunk-h036zy9e.js → chunk-ya7wrt5f.js} +2 -2
- package/bundle/{chunk-ahgb3r1c.js → chunk-ycjz7y1x.js} +2 -2
- package/bundle/{chunk-10kj86va.js → chunk-ykqx1z0b.js} +1 -1
- package/bundle/chunk-yq4vck53.js +2 -0
- package/bundle/{chunk-j2snkw45.js → chunk-yxsc90ba.js} +2 -2
- package/bundle/{chunk-5cwy8y78.js → chunk-yy5qqab3.js} +2 -2
- package/bundle/{chunk-86reb44c.js → chunk-z38am71w.js} +1 -1
- package/bundle/{chunk-pwrwb7mn.js → chunk-z6mqdbj1.js} +1 -1
- package/bundle/{chunk-nyxn7npc.js → chunk-z87ew6d3.js} +1 -1
- package/bundle/{chunk-m6967jtv.js → chunk-z9k4506p.js} +2 -2
- package/bundle/{chunk-hf39qx6t.js → chunk-zezz8xfw.js} +2 -2
- package/bundle/{chunk-ffx0cr44.js → chunk-zg72kz2k.js} +2 -2
- package/bundle/chunk-zkxc41ek.js +2 -0
- package/bundle/{chunk-tz1bzrnh.js → chunk-zssy3srh.js} +1 -1
- package/bundle/{chunk-ae1g5y4r.js → chunk-zyz4na64.js} +1 -1
- package/bundle/{chunk-e18hshcg.js → chunk-zzsetq5f.js} +1 -1
- package/bundle/index.js +3 -3
- package/bundle/parser.worker.js +2 -2
- package/bundle/worker.js +1 -1
- package/package.json +1 -1
- package/bundle/chunk-00r3he5x.js +0 -2
- package/bundle/chunk-0ks20gz1.js +0 -2
- package/bundle/chunk-1a08ffyd.js +0 -2
- package/bundle/chunk-1r7anzk5.js +0 -2
- package/bundle/chunk-26e51217.js +0 -2
- package/bundle/chunk-2g4kxtz0.js +0 -2
- package/bundle/chunk-2jzay8a9.js +0 -2
- package/bundle/chunk-2q78bdtj.js +0 -2
- package/bundle/chunk-30rghawe.js +0 -2
- package/bundle/chunk-31a47ptm.js +0 -10
- package/bundle/chunk-33mzqyyb.js +0 -3
- package/bundle/chunk-34yk99ep.js +0 -2
- package/bundle/chunk-3dajnr1w.js +0 -2
- package/bundle/chunk-3ege6krg.js +0 -2
- package/bundle/chunk-43vpxggb.js +0 -2
- package/bundle/chunk-49y7zg15.js +0 -2
- package/bundle/chunk-5qhsfjzq.js +0 -3
- package/bundle/chunk-5xxn06g0.js +0 -2
- package/bundle/chunk-7cp30q0t.js +0 -2
- package/bundle/chunk-7xc73qb1.js +0 -2
- package/bundle/chunk-8gz8fk6r.js +0 -2
- package/bundle/chunk-8ht7cq3h.js +0 -2
- package/bundle/chunk-8qv0119d.js +0 -2
- package/bundle/chunk-9m0eawt5.js +0 -2
- package/bundle/chunk-9thgxbze.js +0 -2
- package/bundle/chunk-a32y70fe.js +0 -2
- package/bundle/chunk-avzaqy6a.js +0 -2
- package/bundle/chunk-az12tp53.js +0 -2
- package/bundle/chunk-b5dpzcc7.js +0 -2
- package/bundle/chunk-bcgtqx3g.js +0 -2
- package/bundle/chunk-bde5d507.js +0 -2
- package/bundle/chunk-bzzggc3s.js +0 -2
- package/bundle/chunk-c8qx439t.js +0 -2
- package/bundle/chunk-ckw51fn6.js +0 -2
- package/bundle/chunk-denp0wrq.js +0 -2
- package/bundle/chunk-depxzjer.js +0 -2
- package/bundle/chunk-dhvqpcf3.js +0 -2
- package/bundle/chunk-dkqqswbv.js +0 -2
- package/bundle/chunk-dn0437c1.js +0 -5
- package/bundle/chunk-e5t7jsxa.js +0 -2
- package/bundle/chunk-eb811dt2.js +0 -2
- package/bundle/chunk-fbz2xv2w.js +0 -2
- package/bundle/chunk-gbvcb4k1.js +0 -2
- package/bundle/chunk-gdtnqzbp.js +0 -2
- package/bundle/chunk-gkfvhh28.js +0 -2
- package/bundle/chunk-gnh8c49b.js +0 -2
- package/bundle/chunk-gvf6ek9f.js +0 -2
- package/bundle/chunk-gvx5hmhk.js +0 -2
- package/bundle/chunk-hham7r33.js +0 -2
- package/bundle/chunk-hsjbe5zy.js +0 -2
- package/bundle/chunk-j1bv93m4.js +0 -31
- package/bundle/chunk-jvvctqjd.js +0 -8
- package/bundle/chunk-jvx7jtm4.js +0 -3
- package/bundle/chunk-k6gdmqff.js +0 -2
- package/bundle/chunk-kzkb4648.js +0 -2
- package/bundle/chunk-m2540waa.js +0 -2
- package/bundle/chunk-mscvm1rm.js +0 -2
- package/bundle/chunk-mw3hh526.js +0 -2
- package/bundle/chunk-n3nsrk5n.js +0 -2
- package/bundle/chunk-n9nmc4q4.js +0 -2
- package/bundle/chunk-nj4as8vy.js +0 -2
- package/bundle/chunk-nrzca9yd.js +0 -2
- package/bundle/chunk-nxm6gpyv.js +0 -2
- package/bundle/chunk-pp10epga.js +0 -8
- package/bundle/chunk-qbjqkezn.js +0 -2
- package/bundle/chunk-qhtp1xvx.js +0 -2
- package/bundle/chunk-qkztgpay.js +0 -2
- package/bundle/chunk-rnf3dy0y.js +0 -2
- package/bundle/chunk-rry4kq85.js +0 -2
- package/bundle/chunk-ryfj80q6.js +0 -2
- package/bundle/chunk-snx49w8h.js +0 -2
- package/bundle/chunk-t21mdqbb.js +0 -2
- package/bundle/chunk-tn2yyqeb.js +0 -2
- package/bundle/chunk-ttebf3nt.js +0 -2
- package/bundle/chunk-twpfh0mx.js +0 -2
- package/bundle/chunk-tzf6d5qy.js +0 -2
- package/bundle/chunk-v2mq09wx.js +0 -2
- package/bundle/chunk-v59a02aj.js +0 -2
- package/bundle/chunk-vnstr4g1.js +0 -2
- package/bundle/chunk-vxr4rzt0.js +0 -2
- package/bundle/chunk-w0h9rczg.js +0 -2
- package/bundle/chunk-w214dwws.js +0 -2
- package/bundle/chunk-w8344et5.js +0 -2
- package/bundle/chunk-weyg78et.js +0 -2
- package/bundle/chunk-xchj8gna.js +0 -2
- package/bundle/chunk-y18ptwk2.js +0 -2
- package/bundle/chunk-y3dpyz2d.js +0 -2
- package/bundle/chunk-ykvgmje9.js +0 -35
- package/bundle/chunk-yvjecrjy.js +0 -2
- package/bundle/chunk-yw2x6by6.js +0 -2
- package/bundle/chunk-z0r4syk8.js +0 -2
- package/bundle/chunk-z7c00g63.js +0 -2
- package/bundle/chunk-znr0saas.js +0 -2
- package/bundle/chunk-zqqt7v17.js +0 -2
- package/bundle/chunk-zwrgh1hc.js +0 -2
package/bundle/chunk-dn0437c1.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Sl as an,Tl as _i,Ul as bn,Vl as Ni,Xl as Yr,Yl as zr}from"./chunk-47jkx37s.js";import{Am as go,Bm as Kn,Cm as lo,Dm as so,Em as _o,Fm as No,Gm as po,Hm as Ao,Im as To,Jm as Ir,Km as Oo,Lm as $o,Mm as Do,Nm as Lr,Om as vo,Pm as dr,Qm as Bo,Rm as Gr,Sm as Jr,Tm as Mr,Um as Sr,Vm as Cr,Wm as Hr,Xm as Qo,Ym as Io,Zl as uo,Zm as Fo,_l as yo,am as er,bm as mr,cm as ur,cn as ui,dm as yr,em as fr,fm as gr,gm as lr,hm as sr,im as _r,jm as Nr,km as pr,lm as Ar,mm as V,nm as Tr,om as Or,pm as $r,qm as Dr,rm as vr,sm as Br,tm as j,um as v,vm as yn,wm as un,xm as Xo,ym as Qr,zm as Z}from"./chunk-31a47ptm.js";import{Jn as Fn,Nn as jn}from"./chunk-j3agzs13.js";import{On as gi}from"./chunk-3152y1q9.js";import{Pn as Mo}from"./chunk-71jmhvef.js";import{Ar as hr,Br as ti,Dr as ni,xr as Wn,yr as hn,zr as Nn}from"./chunk-9znfb8f2.js";import{Er as ri}from"./chunk-6kch0q2d.js";import{Fs as gn}from"./chunk-1mfdmm2t.js";import{ct as ro}from"./chunk-fdmz0502.js";import{gt as Ro}from"./chunk-8jkqyf9n.js";import{Pt as nn,Yt as c}from"./chunk-5dvy83ms.js";import{$t as Xr,cu as qo,du as k,hu as mo,mu as $n}from"./chunk-ffx0cr44.js";import{nu as a}from"./chunk-33mzqyyb.js";import{cA as pn,kA as Jn,yA as Cn}from"./chunk-wfpnv00c.js";import{$E as ln,BC as vn,FF as h,NE as Ko,UE as Xn,VO as N,gI as r,jL as Zr,kK as Uo,nC as cn,oJ as Ln,pF as Ur}from"./chunk-9kc2th5c.js";import{wP as On}from"./chunk-sh03ka27.js";var Vo={};On(Vo,{run:()=>$i});var mn={time_created:j().notNull().$default(()=>Date.now()),time_updated:j().notNull().$onUpdate(()=>Date.now())};var J=un("project",{id:v().$type().primaryKey(),worktree:v().notNull(),vcs:v(),name:v(),icon_url:v(),icon_color:v(),...mn,time_initialized:j(),sandboxes:v({mode:"json"}).notNull().$type(),commands:v({mode:"json"}).$type()});var fn=un("session",{id:v().$type().primaryKey(),project_id:v().$type().notNull().references(()=>J.id,{onDelete:"cascade"}),workspace_id:v().$type(),parent_id:v().$type(),context_from:v().$type(),context_watermark:v().$type(),slug:v().notNull(),directory:v().notNull(),title:v().notNull(),version:v().notNull(),share_url:v(),summary_additions:j(),summary_deletions:j(),summary_files:j(),summary_diffs:v({mode:"json"}).$type(),revert:v({mode:"json"}).$type(),permission:v({mode:"json"}).$type(),...mn,time_compacting:j(),time_archived:j(),last_checkpoint_message_id:v().$type()},(n)=>[yn("session_project_idx").on(n.project_id),yn("session_workspace_idx").on(n.workspace_id),yn("session_parent_idx").on(n.parent_id),yn("session_context_from_idx").on(n.context_from)]),eo=un("message",{id:v().$type().primaryKey(),session_id:v().$type().notNull().references(()=>fn.id,{onDelete:"cascade"}),agent_id:v().notNull().default("main"),...mn,data:v({mode:"json"}).notNull().$type()},(n)=>[yn("message_session_time_created_id_idx").on(n.session_id,n.time_created,n.id),yn("message_session_agent_idx").on(n.session_id,n.agent_id,n.id)]),Yo=un("part",{id:v().$type().primaryKey(),message_id:v().$type().notNull().references(()=>eo.id,{onDelete:"cascade"}),session_id:v().$type().notNull(),...mn,data:v({mode:"json"}).notNull().$type()},(n)=>[yn("part_message_id_id_idx").on(n.message_id,n.id),yn("part_session_idx").on(n.session_id)]),zo=un("todo",{session_id:v().$type().notNull().references(()=>fn.id,{onDelete:"cascade"}),content:v().notNull(),status:v().notNull(),position:j().notNull(),...mn},(n)=>[Xo({columns:[n.session_id,n.position]}),yn("todo_session_idx").on(n.session_id)]),co=un("permission",{project_id:v().primaryKey().references(()=>J.id,{onDelete:"cascade"}),...mn,data:v({mode:"json"}).notNull().$type()});var ko=un("session_share",{session_id:v().primaryKey().references(()=>fn.id,{onDelete:"cascade"}),id:v().notNull(),secret:v().notNull(),url:v().notNull(),...mn});import z from"path";var U=c.create({service:"json-migration"});async function $i(n,o){let i=z.join($n.Path.data,"storage");if(!await mo.exists(i))return U.info("storage directory does not exist, skipping migration"),{projects:0,sessions:0,messages:0,parts:0,todos:0,permissions:0,shares:0,errors:[]};U.info("starting json to sqlite migration",{storageDir:i});let l=performance.now();n.run("PRAGMA journal_mode = WAL"),n.run("PRAGMA synchronous = OFF"),n.run("PRAGMA cache_size = 10000"),n.run("PRAGMA temp_store = MEMORY");let e={projects:0,sessions:0,messages:0,parts:0,todos:0,permissions:0,shares:0,errors:[]},A={sessions:0,todos:0,permissions:0,shares:0},_=e.errors,T=1000,M=Date.now();async function x(f){return qo.scan(f,{cwd:i,absolute:!0})}async function C(f,d,S){let B=S-d,p=Array(B);for(let E=0;E<B;E++)p[E]=mo.readJson(f[d+E]);let G=await Promise.allSettled(p),W=Array(B);for(let E=0;E<G.length;E++){let q=G[E];if(q.status==="fulfilled"){W[E]=q.value;continue}_.push(`failed to read ${f[d+E]}: ${q.reason}`)}return W}function H(f,d,S){if(f.length===0)return 0;try{return n.insert(d).values(f).onConflictDoNothing().run(),f.length}catch(B){return _.push(`failed to migrate ${S} batch: ${B}`),0}}U.info("scanning files...");let[K,$,Q,L,g,s,m]=await Promise.all([x("project/*.json"),x("session/*/*.json"),x("message/*/*.json"),x("part/*/*.json"),x("todo/*.json"),x("permission/*.json"),x("session_share/*.json")]);U.info("file scan complete",{projects:K.length,sessions:$.length,messages:Q.length,parts:L.length,todos:g.length,permissions:s.length,shares:m.length});let y=Math.max(1,K.length+$.length+Q.length+L.length+g.length+s.length+m.length),t=o?.progress,u=0,D=(f,d)=>{u=Math.min(y,u+d),t?.({current:u,total:y,label:f})};t?.({current:u,total:y,label:"starting"}),n.run("BEGIN TRANSACTION");let I=new Set,O=[];for(let f=0;f<K.length;f+=T){let d=Math.min(f+T,K.length),S=await C(K,f,d);O.length=0;for(let B=0;B<S.length;B++){let p=S[B];if(!p)continue;let G=z.basename(K[f+B],".json");I.add(G),O.push({id:G,worktree:p.worktree??"/",vcs:p.vcs,name:p.name??void 0,icon_url:p.icon?.url,icon_color:p.icon?.color,time_created:p.time?.created??M,time_updated:p.time?.updated??M,time_initialized:p.time?.initialized,sandboxes:p.sandboxes??[],commands:p.commands})}e.projects+=H(O,J,"project"),D("projects",d-f)}U.info("migrated projects",{count:e.projects,duration:Math.round(performance.now()-l)});let P=$.map((f)=>z.basename(z.dirname(f))),Y=new Set,en=[];for(let f=0;f<$.length;f+=T){let d=Math.min(f+T,$.length),S=await C($,f,d);en.length=0;for(let B=0;B<S.length;B++){let p=S[B];if(!p)continue;let G=z.basename($[f+B],".json"),W=P[f+B];if(!I.has(W)){A.sessions++;continue}Y.add(G),en.push({id:G,project_id:W,parent_id:p.parentID??null,slug:p.slug??"",directory:p.directory??"",title:p.title??"",version:p.version??"",share_url:p.share?.url??null,summary_additions:p.summary?.additions??null,summary_deletions:p.summary?.deletions??null,summary_files:p.summary?.files??null,summary_diffs:p.summary?.diffs??null,revert:p.revert??null,permission:p.permission??null,time_created:p.time?.created??M,time_updated:p.time?.updated??M,time_compacting:p.time?.compacting??null,time_archived:p.time?.archived??null})}e.sessions+=H(en,fn,"session"),D("sessions",d-f)}if(U.info("migrated sessions",{count:e.sessions}),A.sessions>0)U.warn("skipped orphaned sessions",{count:A.sessions});let sn=[],R=[],kn=new Map;for(let f of Q){let d=z.basename(z.dirname(f));if(!Y.has(d))continue;sn.push(f),R.push(d)}for(let f=0;f<sn.length;f+=T){let d=Math.min(f+T,sn.length),S=await C(sn,f,d),B=Array(S.length),p=0;for(let G=0;G<S.length;G++){let W=S[G];if(!W)continue;let E=sn[f+G],q=z.basename(E,".json"),xn=R[f+G];kn.set(q,xn);let Bn=W;delete Bn.id,delete Bn.sessionID,B[p++]={id:q,session_id:xn,time_created:W.time?.created??M,time_updated:W.time?.updated??M,data:Bn}}B.length=p,e.messages+=H(B,eo,"message"),D("messages",d-f)}U.info("migrated messages",{count:e.messages});for(let f=0;f<L.length;f+=T){let d=Math.min(f+T,L.length),S=await C(L,f,d),B=Array(S.length),p=0;for(let G=0;G<S.length;G++){let W=S[G];if(!W)continue;let E=L[f+G],q=z.basename(E,".json"),xn=z.basename(z.dirname(E)),Bn=kn.get(xn);if(!Bn){_.push(`part missing message session: ${E}`);continue}if(!Y.has(Bn))continue;let wn=W;delete wn.id,delete wn.messageID,delete wn.sessionID,B[p++]={id:q,message_id:xn,session_id:Bn,time_created:W.time?.created??M,time_updated:W.time?.updated??M,data:wn}}B.length=p,e.parts+=H(B,Yo,"part"),D("parts",d-f)}U.info("migrated parts",{count:e.parts});let Tn=g.map((f)=>z.basename(f,".json"));for(let f=0;f<g.length;f+=T){let d=Math.min(f+T,g.length),S=await C(g,f,d),B=[];for(let p=0;p<S.length;p++){let G=S[p];if(!G)continue;let W=Tn[f+p];if(!Y.has(W)){A.todos++;continue}if(!Array.isArray(G)){_.push(`todo not an array: ${g[f+p]}`);continue}for(let E=0;E<G.length;E++){let q=G[E];if(!q?.content||!q?.status)continue;B.push({session_id:W,content:q.content,status:q.status,position:E,time_created:M,time_updated:M})}}e.todos+=H(B,zo,"todo"),D("todos",d-f)}if(U.info("migrated todos",{count:e.todos}),A.todos>0)U.warn("skipped orphaned todos",{count:A.todos});let qn=s.map((f)=>z.basename(f,".json")),Hn=[];for(let f=0;f<s.length;f+=T){let d=Math.min(f+T,s.length),S=await C(s,f,d);Hn.length=0;for(let B=0;B<S.length;B++){let p=S[B];if(!p)continue;let G=qn[f+B];if(!I.has(G)){A.permissions++;continue}Hn.push({project_id:G,data:p})}e.permissions+=H(Hn,co,"permission"),D("permissions",d-f)}if(U.info("migrated permissions",{count:e.permissions}),A.permissions>0)U.warn("skipped orphaned permissions",{count:A.permissions});let Vn=m.map((f)=>z.basename(f,".json")),dn=[];for(let f=0;f<m.length;f+=T){let d=Math.min(f+T,m.length),S=await C(m,f,d);dn.length=0;for(let B=0;B<S.length;B++){let p=S[B];if(!p)continue;let G=Vn[f+B];if(!Y.has(G)){A.shares++;continue}if(!p?.id||!p?.secret||!p?.url){_.push(`session_share missing id/secret/url: ${m[f+B]}`);continue}dn.push({session_id:G,id:p.id,secret:p.secret,url:p.url})}e.shares+=H(dn,ko,"session_share"),D("shares",d-f)}if(U.info("migrated session shares",{count:e.shares}),A.shares>0)U.warn("skipped orphaned session shares",{count:A.shares});if(n.run("COMMIT"),U.info("json migration complete",{projects:e.projects,sessions:e.sessions,messages:e.messages,parts:e.parts,todos:e.todos,permissions:e.permissions,shares:e.shares,errorCount:e.errors.length,duration:Math.round(performance.now()-l)}),e.errors.length>0)U.warn("migration errors",{errors:e.errors.slice(0,20)});return t?.({current:y,total:y,label:"complete"}),e}var In={};On(In,{use:()=>Ce,transaction:()=>xe,textDecoder:()=>re,sumDistinct:()=>rr,sum:()=>or,sql:()=>V,relationsOrderToSQL:()=>Rt,relationsFilterToSQL:()=>Kt,relationToSQL:()=>xt,relationExtrasToSQL:()=>Ht,processRelations:()=>Ct,placeholder:()=>Or,param:()=>Ar,orderSelectedFields:()=>oe,orderByOperators:()=>St,or:()=>lo,operators:()=>Mt,notLike:()=>Gr,notInArray:()=>Ir,notIlike:()=>Mr,notExists:()=>Lr,notBetween:()=>dr,not:()=>so,noopMapper:()=>Nr,noopEncoder:()=>_r,noopDecoder:()=>sr,ne:()=>go,name:()=>gr,min:()=>tr,max:()=>ir,mapUpdateSet:()=>ne,mapResultRow:()=>ht,mapRelationalRow:()=>Jt,mapColumnsInSQLToAlias:()=>it,mapColumnsInAliasedSQLToAlias:()=>rt,lte:()=>Ao,lt:()=>po,like:()=>Bo,l2Distance:()=>Xt,l1Distance:()=>Zt,jaccardDistance:()=>Ut,isWithEnum:()=>bt,isView:()=>vr,isTable:()=>Yi,isSQLWrapper:()=>mr,isNull:()=>Oo,isNotNull:()=>$o,isDriverValueEncoder:()=>lr,isConfig:()=>at,is:()=>Mi,innerProduct:()=>Wt,inArray:()=>To,ilike:()=>Jr,haveSameKeys:()=>jt,hasOwnEntityKind:()=>Ji,hammingDistance:()=>Pt,gte:()=>No,gt:()=>_o,getViewSelectedFields:()=>Ft,getViewName:()=>Br,getTableUniqueName:()=>Xi,getTableName:()=>Zi,getTableLikeName:()=>wt,getTableColumns:()=>Vt,getTableAsAliasSQL:()=>Gt,getOriginalColumnFromAlias:()=>ot,getOrderByOperators:()=>dt,getColumns:()=>qt,getColumnTable:()=>Ci,getColumnNameAndConfig:()=>kt,getChannelPath:()=>li,fillPlaceholders:()=>$r,fieldSelectionToSQL:()=>Lt,extractTablesFromSchema:()=>It,extractExtendedColumnType:()=>mt,exists:()=>Do,eq:()=>Z,entityKind:()=>Gi,effect:()=>He,desc:()=>Io,defineRelationsPart:()=>Qt,defineRelations:()=>Bt,createRelationsHelper:()=>vt,countDistinct:()=>bo,count:()=>fo,cosineDistance:()=>Et,close:()=>Se,buildRelationsParts:()=>Dt,buildRelations:()=>$t,bindIfParam:()=>Qr,between:()=>vo,avgDistinct:()=>nr,avg:()=>ho,assertUnreachable:()=>ct,asc:()=>Qo,arrayOverlaps:()=>Hr,arrayContains:()=>Sr,arrayContained:()=>Cr,applyMixins:()=>zt,and:()=>Kn,aliasedTableColumn:()=>nt,aliasedTable:()=>hi,aliasedRelation:()=>bi,aliasedColumn:()=>ai,WithSubquery:()=>ci,ViewSelectionAliasProxyHandler:()=>ji,ViewBaseConfig:()=>ki,View:()=>Dr,TransactionRollbackError:()=>ft,TableSchema:()=>Ui,TableColumns:()=>Wi,TableAliasProxyHandler:()=>Fi,Table:()=>Pi,Subquery:()=>zi,StringChunk:()=>ur,SQL:()=>yr,RelationsHelperStatic:()=>Ot,RelationsBuilderTable:()=>Tt,RelationsBuilderJunctionColumn:()=>At,RelationsBuilderColumn:()=>pt,RelationTableAliasProxyHandler:()=>wi,Relation:()=>Nt,QueryPromise:()=>tt,Placeholder:()=>Tr,Path:()=>Eo,Param:()=>pr,OriginalName:()=>Ei,One:()=>_t,NotFoundError:()=>Me,NoopLogger:()=>di,Name:()=>fr,Many:()=>st,IsAlias:()=>Ri,FakePrimitiveParam:()=>er,ExtraConfigColumns:()=>Ki,ExtraConfigBuilder:()=>xi,DrizzleQueryError:()=>yt,DrizzleError:()=>ut,DefaultLogger:()=>Li,Count:()=>lt,ConsoleLogWriter:()=>Ii,ColumnTableAliasProxyHandler:()=>Vi,ColumnBuilder:()=>et,ColumnAliasProxyHandler:()=>qi,Column:()=>Si,Client:()=>Mn,CONSTANTS:()=>Yt,BaseName:()=>Hi,AggregatedField:()=>gt});import Di from"crypto";import wo,{existsSync as vi,readdirSync as Bi}from"fs";import{join as Qi}from"path";function jo(n){if(wo.existsSync(`${n.migrationsFolder}/meta/_journal.json`))throw Error('We detected that you have old drizzle-kit migration folders. You must upgrade drizzle-kit and run "drizzle-kit up"');let o=n.migrationsFolder,i=[],l=Bi(o).map((e)=>({path:Qi(o,e,"migration.sql"),name:e})).filter((e)=>vi(e.path));l.sort((e,A)=>e.name.localeCompare(A.name));for(let e of l){let A=e.path,_=e.name.slice(0,14),T=wo.readFileSync(A).toString(),M=T.split("--> statement-breakpoint").map((C)=>{return C}),x=Fo(_);i.push({sql:M,bps:!0,folderMillis:x,hash:Di.createHash("sha256").update(T).digest("hex"),name:e.name})}return i}function ao(n,o){if(Array.isArray(o)||"migrationsJournal"in o){let l=Array.isArray(o)?o:o.migrationsJournal,e=Array.isArray(o)?void 0:o.migrationsTable,A=l.map((_)=>({sql:_.sql.split("--> statement-breakpoint"),folderMillis:_.timestamp,hash:"",bps:!0,name:_.name}));return n.dialect.migrate(A,n.session,{migrationsTable:e})}let i=jo(o);return n.dialect.migrate(i,n.session,o)}function fo(n){return V`count(${n||V.raw("*")})`.mapWith(Number)}function bo(n){return V`count(distinct ${n})`.mapWith(Number)}function ho(n){return V`avg(${n})`.mapWith(String)}function nr(n){return V`avg(distinct ${n})`.mapWith(String)}function or(n){return V`sum(${n})`.mapWith(String)}function rr(n){return V`sum(distinct ${n})`.mapWith(String)}function ir(n){return V`max(${n})`.mapWith(uo(n,yo)?n:String)}function tr(n){return V`min(${n})`.mapWith(uo(n,yo)?n:String)}import oo from"path";var Un={};On(Un,{workspaceID:()=>De,useEffect:()=>Qe,use:()=>Be,make:()=>ve,invalidate:()=>Le,has:()=>Ie,get:()=>xo,directory:()=>no,context:()=>Ho,bind:()=>$e});import{EventEmitter as ie}from"events";var Rn=new ie;var Lo=new Set;function xr(n){return Lo.add(n),()=>{Lo.delete(n)}}async function Go(n){await Promise.allSettled([...Lo].map((o)=>o(n)))}function En(n){return n()}var jr={};On(jr,{setInitialized:()=>se,list:()=>ge,layer:()=>Fr,get:()=>le,fromRow:()=>_n,defaultLayer:()=>Co,UpdateInput:()=>fe,Service:()=>Gn,Info:()=>Vr,Event:()=>wr});import*as F from"fs/promises";import*as cr from"os";import*as Dn from"path";var te=N.String.pipe(N.brand("ProjectID")),w=te.pipe(Fn((n)=>({global:n.make("global"),zod:a.string().pipe(a.custom())})));import*as Qn from"fs/promises";import*as b from"path";import*as Er from"crypto";async function Jo(n){let o=b.resolve(n);while(!0){let i=b.join(o,".git"),l=await Qn.stat(i).catch(()=>null);if(l){if(l.isDirectory())return i;let _=(await Qn.readFile(i,"utf-8")).trim().match(/^gitdir:\s*(.+)$/);if(!_)return null;let T=b.isAbsolute(_[1])?_[1]:b.resolve(o,_[1]);return b.resolve(T,"../..")}let e=b.dirname(o);if(e===o)return null;o=e}}async function Kr(n){let o=await Qn.readFile(n,"utf-8").catch(()=>null);if(o===null)return null;return o.trim()||null}async function Rr(n){let o=await Kr(n);if(o)return o;let i=Er.randomUUID();try{return await Qn.writeFile(n,i,{flag:"wx"}),i}catch(l){if(l.code!=="EEXIST")throw l;let e=await Kr(n);if(e)return e;throw Error(`Project ID file was concurrently created but is empty: ${n}`)}}async function Pr(n){let o=await Jo(n);if(o){let l=b.join(o,"qitqode-project-id");return w.make(await Rr(l))}let i=b.join(n,".qitqode-project-id");return w.make(await Rr(i))}async function me(n){let o=await Jo(n);if(!o)return;let i=Dn.join(n,".qitqode-project-id"),l=Dn.join(o,"qitqode-project-id"),e=(T)=>F.access(T).then(()=>!0).catch(()=>!1);if(await e(i)){if(!await e(l)){let T=await F.readFile(i,"utf-8");await F.writeFile(l,T)}await F.unlink(i).catch(()=>{})}let A=Dn.join(o,"info","exclude");if(await F.mkdir(Dn.dirname(A),{recursive:!0}),!(await F.readFile(A,"utf-8").catch(()=>"")).includes(".qitqode-project-id"))await F.appendFile(A,`
|
|
3
|
-
.qitqode-project-id
|
|
4
|
-
`)}var Wr=c.create({service:"project"}),ue=262144,So=N.Literal("git"),kr=N.Struct({url:N.optional(N.String),override:N.optional(N.String),color:N.optional(N.String)}),qr=N.Struct({start:N.optional(N.String.annotate({description:"Startup script to run when creating a new workspace (worktree)"}))}),ye=N.Struct({created:N.Number,updated:N.Number,initialized:N.optional(N.Number)}),Vr=N.Struct({id:w,worktree:N.String,vcs:N.optional(So),name:N.optional(N.String),icon:N.optional(kr),commands:N.optional(qr),time:ye,sandboxes:N.Array(N.String)}).annotate({identifier:"Project"}).pipe(Fn((n)=>({zod:jn(n)}))),wr={Updated:zr.define("project.updated",Vr.zod)};function _n(n){let o=n.icon_url||n.icon_color?{url:n.icon_url??void 0,color:n.icon_color??void 0}:void 0;return{id:n.id,worktree:n.worktree,vcs:n.vcs?N.decodeUnknownSync(So)(n.vcs):void 0,name:n.name??void 0,icon:o,time:{created:n.time_created,updated:n.time_updated,initialized:n.time_initialized??void 0},sandboxes:n.sandboxes,commands:n.commands??void 0}}var fe=a.object({projectID:w.zod,name:a.string().optional(),icon:jn(kr).optional(),commands:jn(qr).optional()});class Gn extends vn.Service()("@qitqode/Project"){}var Fr=h.effect(Gn,r.gen(function*(){let n=yield*k.Service,o=yield*Zr.Path,i=yield*an.ChildProcessSpawner,l=r.fnUntraced(function*(t,u){return yield*Yr(i,t,u)},r.catch(()=>r.succeed({code:1,text:"",stderr:""}))),e=(t)=>r.sync(()=>In.use(t)),A=(t)=>r.sync(()=>Rn.emit("event",{directory:"global",project:t.id,payload:{type:wr.Updated.type,properties:t}})),_=N.decodeUnknownSync(N.optional(So))(nn.QITQODE_FAKE_VCS),T=(t,u)=>{if(!u)return t;if(u=u.replace(/[\r\n]+$/,""),!u)return t;if(u=k.windowsPath(u),o.isAbsolute(u))return o.normalize(u);return o.resolve(t,u)},M=yield*Ur.Scope,x=r.fn("Project.fromDirectory")(function*(t){Wr.info("fromDirectory",{directory:t});let u=yield*r.gen(function*(){if(nn.QITQODE_DISABLE_GIT)return{id:w.global,worktree:t,sandbox:t,vcs:_};let Y=(yield*n.up({targets:[".git"],start:t}).pipe(r.orDie))[0];if(!Y)return{id:w.global,worktree:"/",sandbox:"/",vcs:_};let en=o.dirname(Y),sn=process.env.HOME??process.env.USERPROFILE??cr.homedir();if(en===sn||Dn.parse(en).root===en)return Wr.warn("ignoring .git at home or filesystem root, snapshots disabled",{dotgit:Y}),{id:w.global,worktree:t,sandbox:t,vcs:_};let R=en,kn=yield*r.sync(()=>Mo("git")),Tn;if(!kn)return{id:Tn??w.global,worktree:R,sandbox:R,vcs:_};let qn=yield*l(["rev-parse","--git-common-dir"],{cwd:R});if(qn.code!==0)return{id:Tn??w.global,worktree:R,sandbox:R,vcs:_};let Hn=(()=>{let dn=T(R,qn.text.trim());return dn===R?R:o.dirname(dn)})();if(Tn==null)yield*r.promise(()=>me(R)),Tn=yield*r.promise(()=>Pr(R));let Vn=yield*l(["rev-parse","--show-toplevel"],{cwd:R});if(Vn.code!==0)return{id:Tn,worktree:R,sandbox:R,vcs:_};return R=T(R,Vn.text.trim()),{id:Tn,sandbox:R,worktree:Hn,vcs:"git"}}),D=yield*e((P)=>P.select().from(J).where(Z(J.id,u.id)).get()),I=D?_n(D):{id:u.id,worktree:u.worktree,vcs:u.vcs,sandboxes:[],time:{created:Date.now(),updated:Date.now()}};if(nn.QITQODE_EXPERIMENTAL_ICON_DISCOVERY)yield*C(I).pipe(r.ignore,r.forkIn(M));let O={...I,worktree:u.worktree,vcs:u.vcs,time:{...I.time,updated:Date.now()}};if(u.sandbox!==O.worktree&&!O.sandboxes.includes(u.sandbox))O.sandboxes.push(u.sandbox);if(O.sandboxes=yield*r.forEach(O.sandboxes,(P)=>n.exists(P).pipe(r.orDie,r.map((Y)=>Y?P:void 0)),{concurrency:16}).pipe(r.map((P)=>P.filter((Y)=>Y!==void 0))),yield*e((P)=>P.insert(J).values({id:O.id,worktree:O.worktree,vcs:O.vcs??null,name:O.name,icon_url:O.icon?.url,icon_color:O.icon?.color,time_created:O.time.created,time_updated:O.time.updated,time_initialized:O.time.initialized,sandboxes:O.sandboxes,commands:O.commands}).onConflictDoUpdate({target:J.id,set:{worktree:O.worktree,vcs:O.vcs??null,name:O.name,icon_url:O.icon?.url,icon_color:O.icon?.color,time_updated:O.time.updated,time_initialized:O.time.initialized,sandboxes:O.sandboxes,commands:O.commands}}).run()),u.id!==w.global)yield*e((P)=>P.update(fn).set({project_id:u.id}).where(Kn(Z(fn.project_id,w.global),Z(fn.directory,u.worktree))).run());return yield*A(O),{project:O,sandbox:u.sandbox}}),C=r.fn("Project.discover")(function*(t){if(t.vcs!=="git")return;if(t.icon?.override)return;if(t.icon?.url)return;let D=(yield*n.glob("**/favicon.{ico,png,svg,jpg,jpeg,webp}",{cwd:t.worktree,absolute:!0,include:"file"}).pipe(r.orDie)).sort((sn,R)=>sn.length-R.length)[0];if(!D)return;let I=yield*n.stat(D).pipe(r.orDie);if(Number(I.size)>ue)return;let O=yield*n.readFile(D).pipe(r.orDie),P=Buffer.from(O).toString("base64"),en=`data:${k.mimeType(D)};base64,${P}`;yield*$({projectID:t.id,icon:{url:en}})}),H=r.fn("Project.list")(function*(){return yield*e((t)=>t.select().from(J).all().map(_n))}),K=r.fn("Project.get")(function*(t){let u=yield*e((D)=>D.select().from(J).where(Z(J.id,t)).get());return u?_n(u):void 0}),$=r.fn("Project.update")(function*(t){let u=yield*e((I)=>I.update(J).set({name:t.name,icon_url:t.icon?.url,icon_color:t.icon?.color,commands:t.commands,time_updated:Date.now()}).where(Z(J.id,t.projectID)).returning().get());if(!u)throw Error(`Project not found: ${t.projectID}`);let D=_n(u);return yield*A(D),D}),Q=r.fn("Project.initGit")(function*(t){if(t.project.vcs==="git")return t.project;if(!(yield*r.sync(()=>Mo("git"))))throw Error("Git is not installed");let u=yield*l(["init","--quiet"],{cwd:t.directory});if(u.code!==0)throw Error(u.stderr.trim()||u.text.trim()||"Failed to initialize git repository");let{project:D}=yield*x(t.directory);return D}),L=r.fn("Project.setInitialized")(function*(t){yield*e((u)=>u.update(J).set({time_initialized:Date.now()}).where(Z(J.id,t)).run())}),g=r.fn("Project.sandboxes")(function*(t){let u=yield*e((I)=>I.select().from(J).where(Z(J.id,t)).get());if(!u)return[];let D=_n(u);return yield*r.forEach(D.sandboxes,(I)=>n.isDir(I).pipe(r.orDie,r.map((O)=>O?I:void 0)),{concurrency:16}).pipe(r.map((I)=>I.filter((O)=>O!==void 0)))}),s=r.fnUntraced(function*(t,u){let D=yield*e((I)=>I.update(J).set({sandboxes:u,time_updated:Date.now()}).where(Z(J.id,t)).returning().get());if(!D)throw Error(`Project not found: ${t}`);yield*A(_n(D))}),m=r.fn("Project.addSandbox")(function*(t,u){let D=yield*e((O)=>O.select().from(J).where(Z(J.id,t)).get());if(!D)throw Error(`Project not found: ${t}`);let I=[...D.sandboxes];if(!I.includes(u))I.push(u);yield*s(t,I)}),y=r.fn("Project.removeSandbox")(function*(t,u){let D=yield*e((O)=>O.select().from(J).where(Z(J.id,t)).get());if(!D)throw Error(`Project not found: ${t}`);let I=D.sandboxes.filter((O)=>O!==u);yield*s(t,I)});return Gn.of({fromDirectory:x,discover:C,list:H,get:K,update:$,initGit:Q,setInitialized:L,sandboxes:g,addSandbox:m,removeSandbox:y})})),Co=Fr.pipe(h.provide(bn),h.provide(k.defaultLayer),h.provide(Xr.layer));function ge(){return In.use((n)=>n.select().from(J).all().map((o)=>_n(o)))}function le(n){let o=In.use((i)=>i.select().from(J).where(Z(J.id,n)).get());if(!o)return;return _n(o)}function se(n){In.use((o)=>o.update(J).set({time_initialized:Date.now()}).where(Z(J.id,n)).run())}import{parse as _e}from"path";var rn=gn.create("instance");hr(()=>rn.use());var tn=new Map,Ne=ni(Gn,Co),pe=new Set(["/etc","/proc","/sys","/dev","/boot","/root","/var","/private/etc","/private/var"]);function Ae(n){if(n===_e(n).root)return"filesystem root is not a valid project directory";for(let o of pe)if(n===o||k.contains(o,n))return"target is a protected system directory";return null}function Te(n){let o=Ae(n);if(o)throw Error("Access denied: "+o)}var Pn={all:void 0};function ar(n){return En(async()=>{let o=n.project&&n.worktree?{directory:n.directory,worktree:n.worktree,project:n.project}:await Ne.runPromise((i)=>i.fromDirectory(n.directory)).then(({project:i,sandbox:l})=>({directory:n.directory,worktree:l,project:i}));return await rn.provide(o,async()=>{await n.init?.()}),o})}function br(n,o){let i=o.catch((l)=>{if(tn.get(n)===i)tn.delete(n);throw l});return tn.set(n,i),i}var on={async provide(n){let o=k.resolve(n.directory);Te(o);let i=tn.get(o);if(!i)c.Default.info("creating instance",{directory:o}),i=br(o,ar({directory:o,init:n.init}));let l=await i;return rn.provide(l,async()=>{return n.fn()})},get current(){return rn.use()},get directory(){return rn.use().directory},get worktree(){return rn.use().worktree},get project(){return rn.use().project},containsPath(n,o){let i=o??on;if(k.contains(i.directory,n))return!0;if(i.worktree==="/")return!1;return k.contains(i.worktree,n)},bind(n){let o=rn.use();return(...i)=>rn.provide(o,()=>n(...i))},restore(n,o){return rn.provide(n,o)},async reload(n){let o=k.resolve(n.directory);c.Default.info("reloading instance",{directory:o}),await Go(o),tn.delete(o);let i=br(o,ar({...n,directory:o}));return Rn.emit("event",{directory:o,project:n.project?.id,workspace:Nn.workspaceID,payload:{type:"server.instance.disposed",properties:{directory:o}}}),await i},async dispose(){let{directory:n,project:o}=on;c.Default.info("disposing instance",{directory:n}),await Go(n),tn.delete(n),Rn.emit("event",{directory:n,project:o.id,workspace:Nn.workspaceID,payload:{type:"server.instance.disposed",properties:{directory:n}}})},async disposeAll(){if(Pn.all)return Pn.all;return Pn.all=En(async()=>{c.Default.info("disposing all instances");let n=[...tn.entries()];for(let[o,i]of n){if(tn.get(o)!==i)continue;let l=await i.catch((e)=>{c.Default.warn("instance dispose failed",{key:o,error:e});return});if(!l){if(tn.get(o)===i)tn.delete(o);continue}if(tn.get(o)!==i)continue;await rn.provide(l,async()=>{await on.dispose()})}}).finally(()=>{Pn.all=void 0}),Pn.all}};var oi="~qitqode/InstanceState",$e=(n)=>{try{return on.bind(n)}catch(l){if(!(l instanceof gn.NotFound))throw l}let o=Ln.getCurrent(),i=o?vn.getReferenceUnsafe(o.context,Wn):void 0;if(!i)return n;return(...l)=>on.restore(i,()=>n(...l))},Ho=r.gen(function*(){return(yield*Wn)??on.current}),De=r.gen(function*(){return(yield*hn)??Nn.workspaceID}),no=r.map(Ho,(n)=>n.directory),ve=(n)=>r.gen(function*(){let o=yield*Jn.make({capacity:Number.POSITIVE_INFINITY,lookup:()=>r.gen(function*(){return yield*n(yield*Ho)})}),i=xr((l)=>r.runPromise(Jn.invalidate(o,l).pipe(r.provide(ri))));return yield*r.addFinalizer(()=>r.sync(i)),{[oi]:oi,cache:o}}),xo=(n)=>r.gen(function*(){return yield*Jn.get(n.cache,yield*no)}),Be=(n,o)=>r.map(xo(n),o),Qe=(n,o)=>r.flatMap(xo(n),o),Ie=(n)=>r.gen(function*(){return yield*Jn.has(n.cache,yield*no)}),Le=(n)=>r.gen(function*(){return yield*Jn.invalidate(n.cache,yield*no)});var ei={};On(ei,{make:()=>de});function ii(n,o,i){if(n&&o!==void 0)return Nn.restore(o,()=>on.restore(n,i));if(n)return on.restore(n,i);if(o!==void 0)return Nn.restore(o,i);return i()}function de(){return r.gen(function*(){let n=yield*r.context(),i=(yield*Wn)??(()=>{try{return on.current}catch(_){if(!(_ instanceof gn.NotFound))throw _}})(),l=(yield*hn)??Nn.workspaceID,e=(_)=>ti(_,{instance:i,workspace:l}),A=(_)=>e(_).pipe(r.provide(n));return{promise:(_)=>ii(i,l,()=>r.runPromise(A(_))),fork:(_)=>ii(i,l,()=>r.runFork(A(_)))}})}var mi={};On(mi,{make:()=>Ge,Cancelled:()=>Zn});class Zn extends N.TaggedErrorClass()("RunnerCancelled",{}){}var Ge=(n,o)=>{let i=pn.makeUnsafe({_tag:"Idle"}),l=o?.onIdle??r.void,e=o?.onBusy??r.void,A=o?.onInterrupt,_=0,T=()=>pn.getUnsafe(i),M=()=>{return _+=1,_},x=(m,y)=>Xn.isFailure(y)&&Ko.hasInterruptsOnly(y.cause)?ln.fail(m,new Zn).pipe(r.asVoid):ln.done(m,y).pipe(r.asVoid),C=()=>pn.modify(i,(m)=>[m._tag==="Idle"?l:r.void,m]).pipe(r.flatten),H=(m,y,t)=>pn.modify(i,(u)=>[r.gen(function*(){if(u._tag==="Running"&&u.run.id===m)yield*l;yield*x(y,t)}),u._tag==="Running"&&u.run.id===m?{_tag:"Idle"}:u]).pipe(r.flatten),K=(m,y)=>r.gen(function*(){let t=M(),u=yield*m.pipe(r.onExit((D)=>H(t,y,D)),r.forkIn(n));return{id:t,done:y,fiber:u}}),$=(m)=>pn.modifyEffect(i,r.fnUntraced(function*(y){if(y._tag==="Shell"&&y.shell.id===m)return[l,{_tag:"Idle"}];if(y._tag==="ShellThenRun"&&y.shell.id===m){let t=yield*K(y.run.work,y.run.done);return[r.void,{_tag:"Running",run:t}]}return[r.void,y]})).pipe(r.flatten),Q=(m)=>Ln.interrupt(m.fiber),L=(m)=>pn.modifyEffect(i,r.fnUntraced(function*(y){switch(y._tag){case"Running":case"ShellThenRun":if(o?.onReentryWarn)yield*o.onReentryWarn({label:o.label??"(unlabeled)",existingRunId:y.run.id});return[ln.await(y.run.done),y];case"Shell":{let t={id:M(),done:yield*ln.make(),work:m};return[ln.await(t.done),{_tag:"ShellThenRun",shell:y.shell,run:t}]}case"Idle":{let t=yield*ln.make(),u=yield*K(m,t);return[ln.await(t),{_tag:"Running",run:u}]}}})).pipe(r.flatten,r.catch((y)=>y instanceof Zn?A??r.die(y):r.fail(y))),g=(m)=>pn.modifyEffect(i,r.fnUntraced(function*(y){if(y._tag!=="Idle")return[r.sync(()=>{if(o?.busy)o.busy();throw Error("Runner is busy")}),y];yield*e;let t=M(),u=yield*m.pipe(r.ensuring($(t)),r.forkChild),D={id:t,fiber:u};return[r.gen(function*(){let I=yield*Ln.await(u);if(Xn.isSuccess(I))return I.value;if(Ko.hasInterruptsOnly(I.cause)&&A)return yield*A;return yield*r.failCause(I.cause)}),{_tag:"Shell",shell:D}]})).pipe(r.flatten),s=pn.modify(i,(m)=>{switch(m._tag){case"Idle":return[r.void,m];case"Running":return[r.gen(function*(){yield*Ln.interrupt(m.run.fiber);let y=yield*Ln.await(m.run.fiber);yield*x(m.run.done,y),yield*ln.await(m.run.done).pipe(r.exit,r.asVoid),yield*C()}),{_tag:"Idle"}];case"Shell":return[r.gen(function*(){yield*Q(m.shell),yield*C()}),{_tag:"Idle"}];case"ShellThenRun":return[r.gen(function*(){yield*ln.fail(m.run.done,new Zn).pipe(r.asVoid),yield*Q(m.shell),yield*C()}),{_tag:"Idle"}]}}).pipe(r.flatten);return{get state(){return T()},get busy(){return T()._tag!=="Idle"},ensureRunning:L,startShell:g,cancel:s}};import{Database as Je}from"bun:sqlite";function yi(n){let o=new Je(n,{create:!0});return ui({client:o})}var Me=ro.create("NotFoundError",a.object({message:a.string()})),fi=c.create({service:"db"});function li(){if(["latest","beta","prod"].includes(Ro)||nn.QITQODE_DISABLE_CHANNEL_DB)return oo.join($n.Path.data,"qitqode.db");let n=Ro.replace(/[^a-zA-Z0-9._-]/g,"-");return oo.join($n.Path.data,`qitqode-${n}.db`)}var Eo=En(()=>{if(nn.QITQODE_DB){if(nn.QITQODE_DB===":memory:"||oo.isAbsolute(nn.QITQODE_DB))return nn.QITQODE_DB;return oo.join($n.Path.data,nn.QITQODE_DB)}return li()}),Mn=gi(()=>{fi.info("opening database",{path:Eo});let n=yi(Eo);n.run("PRAGMA journal_mode = WAL"),n.run("PRAGMA synchronous = NORMAL"),n.run("PRAGMA busy_timeout = 5000"),n.run("PRAGMA cache_size = -64000"),n.run("PRAGMA foreign_keys = ON"),n.run("PRAGMA wal_checkpoint(PASSIVE)");let o=[{sql:"CREATE TABLE `project` (\n\t`id` text PRIMARY KEY,\n\t`worktree` text NOT NULL,\n\t`vcs` text,\n\t`name` text,\n\t`icon_url` text,\n\t`icon_color` text,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\t`time_initialized` integer,\n\t`sandboxes` text NOT NULL\n);\n--> statement-breakpoint\nCREATE TABLE `message` (\n\t`id` text PRIMARY KEY,\n\t`session_id` text NOT NULL,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\t`data` text NOT NULL,\n\tCONSTRAINT `fk_message_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nCREATE TABLE `part` (\n\t`id` text PRIMARY KEY,\n\t`message_id` text NOT NULL,\n\t`session_id` text NOT NULL,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\t`data` text NOT NULL,\n\tCONSTRAINT `fk_part_message_id_message_id_fk` FOREIGN KEY (`message_id`) REFERENCES `message`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nCREATE TABLE `permission` (\n\t`project_id` text PRIMARY KEY,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\t`data` text NOT NULL,\n\tCONSTRAINT `fk_permission_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nCREATE TABLE `session` (\n\t`id` text PRIMARY KEY,\n\t`project_id` text NOT NULL,\n\t`parent_id` text,\n\t`slug` text NOT NULL,\n\t`directory` text NOT NULL,\n\t`title` text NOT NULL,\n\t`version` text NOT NULL,\n\t`share_url` text,\n\t`summary_additions` integer,\n\t`summary_deletions` integer,\n\t`summary_files` integer,\n\t`summary_diffs` text,\n\t`revert` text,\n\t`permission` text,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\t`time_compacting` integer,\n\t`time_archived` integer,\n\tCONSTRAINT `fk_session_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nCREATE TABLE `todo` (\n\t`session_id` text NOT NULL,\n\t`content` text NOT NULL,\n\t`status` text NOT NULL,\n\t`priority` text NOT NULL,\n\t`position` integer NOT NULL,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\tCONSTRAINT `todo_pk` PRIMARY KEY(`session_id`, `position`),\n\tCONSTRAINT `fk_todo_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nCREATE TABLE `session_share` (\n\t`session_id` text PRIMARY KEY,\n\t`id` text NOT NULL,\n\t`secret` text NOT NULL,\n\t`url` text NOT NULL,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\tCONSTRAINT `fk_session_share_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nCREATE INDEX `message_session_idx` ON `message` (`session_id`);--> statement-breakpoint\nCREATE INDEX `part_message_idx` ON `part` (`message_id`);--> statement-breakpoint\nCREATE INDEX `part_session_idx` ON `part` (`session_id`);--> statement-breakpoint\nCREATE INDEX `session_project_idx` ON `session` (`project_id`);--> statement-breakpoint\nCREATE INDEX `session_parent_idx` ON `session` (`parent_id`);--> statement-breakpoint\nCREATE INDEX `todo_session_idx` ON `todo` (`session_id`);",timestamp:1769552633000,name:"20260127222353_familiar_lady_ursula"},{sql:"ALTER TABLE `project` ADD `commands` text;",timestamp:1770830228000,name:"20260211171708_add_project_commands"},{sql:"CREATE TABLE `control_account` (\n\t`email` text NOT NULL,\n\t`url` text NOT NULL,\n\t`access_token` text NOT NULL,\n\t`refresh_token` text NOT NULL,\n\t`token_expiry` integer,\n\t`active` integer NOT NULL,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\tCONSTRAINT `control_account_pk` PRIMARY KEY(`email`, `url`)\n);\n",timestamp:1770993676000,name:"20260213144116_wakeful_the_professor"},{sql:"CREATE TABLE `workspace` (\n\t`id` text PRIMARY KEY,\n\t`branch` text,\n\t`project_id` text NOT NULL,\n\t`config` text NOT NULL,\n\tCONSTRAINT `fk_workspace_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE\n);\n",timestamp:1772056728000,name:"20260225215848_workspace"},{sql:"ALTER TABLE `session` ADD `workspace_id` text;--> statement-breakpoint\nCREATE INDEX `session_workspace_idx` ON `session` (`workspace_id`);",timestamp:1772228279000,name:"20260227213759_add_session_workspace_id"},{sql:"CREATE TABLE `account` (\n\t`id` text PRIMARY KEY,\n\t`email` text NOT NULL,\n\t`url` text NOT NULL,\n\t`access_token` text NOT NULL,\n\t`refresh_token` text NOT NULL,\n\t`token_expiry` integer,\n\t`selected_org_id` text,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL\n);\n--> statement-breakpoint\nCREATE TABLE `account_state` (\n\t`id` integer PRIMARY KEY NOT NULL,\n\t`active_account_id` text,\n\tFOREIGN KEY (`active_account_id`) REFERENCES `account`(`id`) ON UPDATE no action ON DELETE set null\n);\n",timestamp:1772310750000,name:"20260228203230_blue_harpoon"},{sql:"ALTER TABLE `workspace` ADD `type` text NOT NULL;--> statement-breakpoint\nALTER TABLE `workspace` ADD `name` text;--> statement-breakpoint\nALTER TABLE `workspace` ADD `directory` text;--> statement-breakpoint\nALTER TABLE `workspace` ADD `extra` text;--> statement-breakpoint\nALTER TABLE `workspace` DROP COLUMN `config`;",timestamp:1772579546000,name:"20260303231226_add_workspace_fields"},{sql:"ALTER TABLE `account_state` ADD `active_org_id` text;--> statement-breakpoint\nUPDATE `account_state` SET `active_org_id` = (SELECT `selected_org_id` FROM `account` WHERE `account`.`id` = `account_state`.`active_account_id`);--> statement-breakpoint\nALTER TABLE `account` DROP COLUMN `selected_org_id`;\n",timestamp:1773097200000,name:"20260309230000_move_org_to_state"},{sql:"DROP INDEX IF EXISTS `message_session_idx`;--> statement-breakpoint\nDROP INDEX IF EXISTS `part_message_idx`;--> statement-breakpoint\nCREATE INDEX `message_session_time_created_id_idx` ON `message` (`session_id`,`time_created`,`id`);--> statement-breakpoint\nCREATE INDEX `part_message_id_id_idx` ON `part` (`message_id`,`id`);",timestamp:1773290071000,name:"20260312043431_session_message_cursor"},{sql:"CREATE TABLE `event_sequence` (\n\t`aggregate_id` text PRIMARY KEY,\n\t`seq` integer NOT NULL\n);\n--> statement-breakpoint\nCREATE TABLE `event` (\n\t`id` text PRIMARY KEY,\n\t`aggregate_id` text NOT NULL,\n\t`seq` integer NOT NULL,\n\t`type` text NOT NULL,\n\t`data` text NOT NULL,\n\tCONSTRAINT `fk_event_aggregate_id_event_sequence_aggregate_id_fk` FOREIGN KEY (`aggregate_id`) REFERENCES `event_sequence`(`aggregate_id`) ON DELETE CASCADE\n);\n",timestamp:1774309702000,name:"20260323234822_events"},{sql:"PRAGMA foreign_keys=OFF;--> statement-breakpoint\nCREATE TABLE `__new_workspace` (\n\t`id` text PRIMARY KEY,\n\t`type` text NOT NULL,\n\t`name` text DEFAULT '' NOT NULL,\n\t`branch` text,\n\t`directory` text,\n\t`extra` text,\n\t`project_id` text NOT NULL,\n\tCONSTRAINT `fk_workspace_project_id_project_id_fk` FOREIGN KEY (`project_id`) REFERENCES `project`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nINSERT INTO `__new_workspace`(`id`, `type`, `branch`, `name`, `directory`, `extra`, `project_id`) SELECT `id`, `type`, `branch`, `name`, `directory`, `extra`, `project_id` FROM `workspace`;--> statement-breakpoint\nDROP TABLE `workspace`;--> statement-breakpoint\nALTER TABLE `__new_workspace` RENAME TO `workspace`;--> statement-breakpoint\nPRAGMA foreign_keys=ON;",timestamp:1775843113000,name:"20260410174513_workspace-name"},{sql:"CREATE TABLE `session_entry` (\n\t`id` text PRIMARY KEY,\n\t`session_id` text NOT NULL,\n\t`type` text NOT NULL,\n\t`time_created` integer NOT NULL,\n\t`time_updated` integer NOT NULL,\n\t`data` text NOT NULL,\n\tCONSTRAINT `fk_session_entry_session_id_session_id_fk` FOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON DELETE CASCADE\n);\n--> statement-breakpoint\nCREATE INDEX `session_entry_session_idx` ON `session_entry` (`session_id`);--> statement-breakpoint\nCREATE INDEX `session_entry_session_type_idx` ON `session_entry` (`session_id`,`type`);--> statement-breakpoint\nCREATE INDEX `session_entry_time_created_idx` ON `session_entry` (`time_created`);",timestamp:1776103196000,name:"20260413175956_chief_energizer"},{sql:"ALTER TABLE `session` ADD `context_from` text;--> statement-breakpoint\nALTER TABLE `session` ADD `context_watermark` text;--> statement-breakpoint\nCREATE INDEX `session_context_from_idx` ON `session` (`context_from`);\n",timestamp:1776873600000,name:"20260422160000_context_inheritance"},{sql:"CREATE TABLE `task_registry` (\n `id` text PRIMARY KEY,\n `parent_session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE CASCADE,\n `status` text NOT NULL,\n `agent` text NOT NULL,\n `description` text NOT NULL,\n `context_mode` text NOT NULL,\n `background` integer NOT NULL,\n `last_turn_time` integer NOT NULL,\n `turn_count` integer NOT NULL DEFAULT 0,\n `error` text,\n `time_completed` integer,\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL\n);--> statement-breakpoint\nCREATE INDEX `task_registry_parent_idx` ON `task_registry` (`parent_session_id`);--> statement-breakpoint\nCREATE INDEX `task_registry_status_idx` ON `task_registry` (`status`);--> statement-breakpoint\nCREATE INDEX `task_registry_status_last_turn_idx` ON `task_registry` (`status`, `last_turn_time`);\n",timestamp:1776877200000,name:"20260422170000_task_registry"},{sql:"DROP INDEX IF EXISTS `session_entry_session_idx`;--> statement-breakpoint\nDROP INDEX IF EXISTS `session_entry_session_type_idx`;--> statement-breakpoint\nDROP INDEX IF EXISTS `session_entry_time_created_idx`;--> statement-breakpoint\nDROP TABLE IF EXISTS `session_entry`;\n",timestamp:1776956061000,name:"20260423145421_remove_session_entry"},{sql:"DROP INDEX IF EXISTS `task_registry_parent_idx`;--> statement-breakpoint\nDROP INDEX IF EXISTS `task_registry_status_idx`;--> statement-breakpoint\nDROP INDEX IF EXISTS `task_registry_status_last_turn_idx`;--> statement-breakpoint\nALTER TABLE `task_registry` RENAME TO `actor_registry`;--> statement-breakpoint\nCREATE INDEX `actor_registry_parent_idx` ON `actor_registry` (`parent_session_id`);--> statement-breakpoint\nCREATE INDEX `actor_registry_status_idx` ON `actor_registry` (`status`);--> statement-breakpoint\nCREATE INDEX `actor_registry_status_last_turn_idx` ON `actor_registry` (`status`, `last_turn_time`);\n",timestamp:1778803200000,name:"20260515000000_actor_rename"},{sql:"CREATE TABLE `memory_fts` (\n `path` text PRIMARY KEY NOT NULL,\n `scope` text NOT NULL,\n `scope_id` text DEFAULT '' NOT NULL,\n `type` text NOT NULL,\n `body` text NOT NULL,\n `fingerprint` text NOT NULL,\n `last_indexed_at` integer NOT NULL\n);\n--> statement-breakpoint\nCREATE INDEX `memory_fts_scope_idx` ON `memory_fts` (`scope`, `scope_id`);\n--> statement-breakpoint\nCREATE INDEX `memory_fts_type_idx` ON `memory_fts` (`type`);\n--> statement-breakpoint\nCREATE VIRTUAL TABLE `memory_fts_idx` USING fts5(\n body,\n content='memory_fts',\n content_rowid='rowid',\n tokenize='unicode61 remove_diacritics 1'\n);\n--> statement-breakpoint\nCREATE TRIGGER `memory_fts_ai` AFTER INSERT ON `memory_fts` BEGIN\n INSERT INTO `memory_fts_idx`(rowid, body) VALUES (NEW.rowid, NEW.body);\nEND;\n--> statement-breakpoint\nCREATE TRIGGER `memory_fts_ad` AFTER DELETE ON `memory_fts` BEGIN\n DELETE FROM `memory_fts_idx` WHERE rowid = OLD.rowid;\nEND;\n--> statement-breakpoint\nCREATE TRIGGER `memory_fts_au` AFTER UPDATE ON `memory_fts` BEGIN\n DELETE FROM `memory_fts_idx` WHERE rowid = OLD.rowid;\n INSERT INTO `memory_fts_idx`(rowid, body) VALUES (NEW.rowid, NEW.body);\nEND;\n",timestamp:1778806800000,name:"20260515010000_memory_fts"},{sql:"CREATE TABLE `task` (\n `id` text NOT NULL,\n `session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE CASCADE,\n `parent_task_id` text,\n `kind` text NOT NULL DEFAULT 'user',\n `status` text NOT NULL,\n `focus` integer NOT NULL DEFAULT 0,\n `summary` text NOT NULL,\n `created_at` integer NOT NULL,\n `last_event_at` integer NOT NULL,\n `ended_at` integer,\n `cleanup_after` integer,\n PRIMARY KEY (`session_id`, `id`)\n);--> statement-breakpoint\nCREATE INDEX `task_session_idx` ON `task` (`session_id`);--> statement-breakpoint\nCREATE INDEX `task_parent_idx` ON `task` (`session_id`, `parent_task_id`);--> statement-breakpoint\nCREATE INDEX `task_status_idx` ON `task` (`status`);--> statement-breakpoint\nCREATE INDEX `task_kind_idx` ON `task` (`kind`);--> statement-breakpoint\nCREATE UNIQUE INDEX `task_focus_per_session_idx` ON `task` (`session_id`) WHERE focus = 1;--> statement-breakpoint\nCREATE TABLE `task_event` (\n `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n `session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE CASCADE,\n `task_id` text NOT NULL,\n `at` integer NOT NULL,\n `kind` text NOT NULL,\n `summary` text,\n FOREIGN KEY (`session_id`, `task_id`) REFERENCES `task`(`session_id`, `id`) ON DELETE CASCADE\n);--> statement-breakpoint\nCREATE INDEX `task_event_task_idx` ON `task_event` (`session_id`, `task_id`, `at`);\n",timestamp:1778810400000,name:"20260515020000_user_task"},{sql:"ALTER TABLE `session` ADD `last_checkpoint_message_id` text;\n",timestamp:1779148800000,name:"20260519000000_last_checkpoint_message_id"},{sql:"ALTER TABLE `message` ADD `agent_id` text;--> statement-breakpoint\nCREATE INDEX `message_session_agent_idx` ON `message` (`session_id`,`agent_id`,`id`);\n",timestamp:1779321600000,name:"20260521000000_message_agent_id"},{sql:"DROP TABLE `actor_registry`;--> statement-breakpoint\nCREATE TABLE `actor_registry` (\n `session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE CASCADE,\n `actor_id` text NOT NULL,\n `mode` text NOT NULL,\n `parent_actor_id` text,\n `status` text NOT NULL,\n `agent` text NOT NULL,\n `description` text NOT NULL,\n `context_mode` text NOT NULL,\n `context_watermark` text,\n `background` integer NOT NULL,\n `tools` text,\n `last_turn_time` integer NOT NULL,\n `turn_count` integer NOT NULL DEFAULT 0,\n `error` text,\n `time_completed` integer,\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL,\n PRIMARY KEY (`session_id`, `actor_id`)\n);--> statement-breakpoint\nCREATE INDEX `actor_registry_session_agent_idx` ON `actor_registry` (`session_id`, `agent`);--> statement-breakpoint\nCREATE INDEX `actor_registry_session_parent_idx` ON `actor_registry` (`session_id`, `parent_actor_id`);--> statement-breakpoint\nCREATE INDEX `actor_registry_status_idx` ON `actor_registry` (`status`);--> statement-breakpoint\nCREATE INDEX `actor_registry_status_last_turn_idx` ON `actor_registry` (`status`, `last_turn_time`);\n",timestamp:1779321660000,name:"20260521000100_actor_registry_v6"},{sql:"DROP TRIGGER IF EXISTS `memory_fts_ai`;--> statement-breakpoint\nDROP TRIGGER IF EXISTS `memory_fts_ad`;--> statement-breakpoint\nDROP TRIGGER IF EXISTS `memory_fts_au`;--> statement-breakpoint\nDROP TABLE IF EXISTS `memory_fts_idx`;--> statement-breakpoint\nDROP TABLE IF EXISTS `memory_fts`;--> statement-breakpoint\nCREATE TABLE `memory_fts` (\n `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,\n `path` text NOT NULL UNIQUE,\n `scope` text NOT NULL,\n `scope_id` text DEFAULT '' NOT NULL,\n `type` text NOT NULL,\n `body` text NOT NULL,\n `fingerprint` text NOT NULL,\n `last_indexed_at` integer NOT NULL\n);--> statement-breakpoint\nCREATE INDEX `memory_fts_scope_idx` ON `memory_fts` (`scope`, `scope_id`);--> statement-breakpoint\nCREATE INDEX `memory_fts_type_idx` ON `memory_fts` (`type`);--> statement-breakpoint\nCREATE VIRTUAL TABLE `memory_fts_idx` USING fts5(\n body,\n content='memory_fts',\n content_rowid='id',\n tokenize='unicode61 remove_diacritics 1'\n);--> statement-breakpoint\nCREATE TRIGGER `memory_fts_ai` AFTER INSERT ON `memory_fts` BEGIN\n INSERT INTO `memory_fts_idx`(rowid, body) VALUES (NEW.id, NEW.body);\nEND;--> statement-breakpoint\nCREATE TRIGGER `memory_fts_ad` AFTER DELETE ON `memory_fts` BEGIN\n DELETE FROM `memory_fts_idx` WHERE rowid = OLD.id;\nEND;--> statement-breakpoint\nCREATE TRIGGER `memory_fts_au` AFTER UPDATE ON `memory_fts` BEGIN\n DELETE FROM `memory_fts_idx` WHERE rowid = OLD.id;\n INSERT INTO `memory_fts_idx`(rowid, body) VALUES (NEW.id, NEW.body);\nEND;\n",timestamp:1779325200000,name:"20260521010000_memory_fts_v6"},{sql:"-- Fix v6.1 trigger pattern: external content FTS5 vtab requires the 'delete'\n-- magic command to remove OLD body's tokens, NOT a plain DELETE FROM the vtab.\n-- The previous DELETE FROM pattern was contentless-mode syntax misapplied to\n-- external-content mode, leaving stale tokens accumulating until vtab corrupts.\nDROP TRIGGER IF EXISTS `memory_fts_ai`;--> statement-breakpoint\nDROP TRIGGER IF EXISTS `memory_fts_ad`;--> statement-breakpoint\nDROP TRIGGER IF EXISTS `memory_fts_au`;--> statement-breakpoint\nCREATE TRIGGER `memory_fts_ai` AFTER INSERT ON `memory_fts` BEGIN\n INSERT INTO `memory_fts_idx`(rowid, body) VALUES (NEW.id, NEW.body);\nEND;--> statement-breakpoint\nCREATE TRIGGER `memory_fts_ad` AFTER DELETE ON `memory_fts` BEGIN\n INSERT INTO `memory_fts_idx`(`memory_fts_idx`, rowid, body) VALUES('delete', OLD.id, OLD.body);\nEND;--> statement-breakpoint\nCREATE TRIGGER `memory_fts_au` AFTER UPDATE ON `memory_fts` BEGIN\n INSERT INTO `memory_fts_idx`(`memory_fts_idx`, rowid, body) VALUES('delete', OLD.id, OLD.body);\n INSERT INTO `memory_fts_idx`(rowid, body) VALUES (NEW.id, NEW.body);\nEND;\n",timestamp:1779328800000,name:"20260521020000_memory_fts_triggers"},{sql:"UPDATE `message` SET `agent_id` = 'main' WHERE `agent_id` IS NULL;--> statement-breakpoint\nCREATE TABLE `message_new` (\n `id` text PRIMARY KEY NOT NULL,\n `session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE CASCADE,\n `agent_id` text NOT NULL DEFAULT 'main',\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL,\n `data` text NOT NULL\n);--> statement-breakpoint\nINSERT INTO `message_new` SELECT `id`, `session_id`, COALESCE(`agent_id`, 'main'), `time_created`, `time_updated`, `data` FROM `message`;--> statement-breakpoint\nDROP TABLE `message`;--> statement-breakpoint\nALTER TABLE `message_new` RENAME TO `message`;--> statement-breakpoint\nCREATE INDEX `message_session_time_created_id_idx` ON `message` (`session_id`,`time_created`,`id`);--> statement-breakpoint\nCREATE INDEX `message_session_agent_idx` ON `message` (`session_id`,`agent_id`,`id`);\n",timestamp:1779753600000,name:"20260526000000_agent_id_main"},{sql:"ALTER TABLE `actor_registry` ADD COLUMN `last_outcome` text;--> statement-breakpoint\nALTER TABLE `actor_registry` ADD COLUMN `lifecycle` text NOT NULL DEFAULT 'ephemeral';--> statement-breakpoint\nALTER TABLE `actor_registry` RENAME COLUMN `error` TO `last_error`;--> statement-breakpoint\nUPDATE `actor_registry` SET `last_outcome` = 'success' WHERE `status` = 'completed';--> statement-breakpoint\nUPDATE `actor_registry` SET `last_outcome` = 'failure' WHERE `status` = 'failed';--> statement-breakpoint\nUPDATE `actor_registry` SET `last_outcome` = 'cancelled' WHERE `status` = 'cancelled';--> statement-breakpoint\nUPDATE `actor_registry` SET `status` = 'idle' WHERE `status` IN ('completed','failed','cancelled');--> statement-breakpoint\nUPDATE `actor_registry` SET `lifecycle` = CASE `mode` WHEN 'peer' THEN 'persistent' WHEN 'main' THEN 'persistent' ELSE 'ephemeral' END;\n",timestamp:1779840000000,name:"20260527000000_actor_lifecycle"},{sql:"CREATE TABLE `inbox` (\n `id` text PRIMARY KEY NOT NULL,\n `receiver_session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE CASCADE,\n `receiver_actor_id` text NOT NULL,\n `sender_session_id` text,\n `sender_actor_id` text,\n `type` text NOT NULL DEFAULT 'text',\n `content` text NOT NULL,\n `created_at` integer NOT NULL\n);--> statement-breakpoint\nCREATE INDEX `inbox_receiver_idx` ON `inbox` (`receiver_session_id`,`receiver_actor_id`,`id`);--> statement-breakpoint\nCREATE INDEX `inbox_created_idx` ON `inbox` (`created_at`);\n",timestamp:1779840060000,name:"20260527000100_inbox"},{sql:"-- todo: drop priority column\nALTER TABLE `todo` DROP COLUMN `priority`;\n--> statement-breakpoint\n\n-- task: drop focus-dependent index before dropping its column\nDROP INDEX `task_focus_per_session_idx`;\n--> statement-breakpoint\nDROP INDEX `task_kind_idx`;\n--> statement-breakpoint\nALTER TABLE `task` DROP COLUMN `focus`;\n--> statement-breakpoint\nALTER TABLE `task` DROP COLUMN `kind`;\n--> statement-breakpoint\n\n-- migrate status values: proposed/active -> open\nUPDATE `task` SET `status` = 'open' WHERE `status` IN ('proposed', 'active');\n",timestamp:1780012800000,name:"20260529000000_task_todo_redesign"},{sql:"ALTER TABLE `task` ADD COLUMN `owner` text;\n",timestamp:1780444800000,name:"20260603000000_task_in_progress_owner"},{sql:"CREATE TABLE `workflow_run` (\n `id` text PRIMARY KEY NOT NULL,\n `session_id` text NOT NULL REFERENCES `session`(`id`) ON DELETE CASCADE,\n `name` text NOT NULL,\n `status` text NOT NULL,\n `running` integer NOT NULL DEFAULT 0,\n `succeeded` integer NOT NULL DEFAULT 0,\n `failed` integer NOT NULL DEFAULT 0,\n `current_phase` text,\n `parent_actor_id` text,\n `args` text,\n `error` text,\n `time_created` integer NOT NULL,\n `time_updated` integer NOT NULL\n);--> statement-breakpoint\nCREATE INDEX `workflow_run_session_idx` ON `workflow_run` (`session_id`);--> statement-breakpoint\nCREATE INDEX `workflow_run_status_idx` ON `workflow_run` (`status`);\n",timestamp:1780444800000,name:"20260603000000_workflow_run"},{sql:"ALTER TABLE `workflow_run` ADD COLUMN `script_sha` text;\n",timestamp:1780531200000,name:"20260604000000_workflow_script_sha"},{sql:"CREATE TABLE `claude_import` (\n `source_uuid` text PRIMARY KEY NOT NULL,\n `session_id` text NOT NULL,\n `source_path` text NOT NULL,\n `source_mtime` integer NOT NULL,\n `time_imported` integer NOT NULL\n);\n",timestamp:1780876800000,name:"20260608000000_claude_import"},{sql:"ALTER TABLE `claude_import` ADD `message_ids` text;\n",timestamp:1780880400000,name:"20260608010000_claude_import_message_ids"},{sql:"CREATE TABLE `history_fts` (\n `part_id` text PRIMARY KEY NOT NULL,\n `session_id` text NOT NULL,\n `message_id` text NOT NULL,\n `project_id` text NOT NULL,\n `kind` text NOT NULL,\n `tool_name` text,\n `body` text NOT NULL,\n `time_created` integer NOT NULL\n);--> statement-breakpoint\nCREATE INDEX `history_fts_session_idx` ON `history_fts` (`session_id`, `time_created`);--> statement-breakpoint\nCREATE INDEX `history_fts_project_idx` ON `history_fts` (`project_id`, `time_created`);--> statement-breakpoint\nCREATE INDEX `history_fts_message_idx` ON `history_fts` (`message_id`);--> statement-breakpoint\nCREATE VIRTUAL TABLE `history_fts_idx` USING fts5(\n body,\n content='history_fts',\n content_rowid='rowid',\n tokenize='unicode61 remove_diacritics 1'\n);--> statement-breakpoint\nCREATE TRIGGER `history_fts_ai` AFTER INSERT ON `history_fts` BEGIN\n INSERT INTO `history_fts_idx`(rowid, body) VALUES (NEW.rowid, NEW.body);\nEND;--> statement-breakpoint\nCREATE TRIGGER `history_fts_ad` AFTER DELETE ON `history_fts` BEGIN\n INSERT INTO `history_fts_idx`(`history_fts_idx`, rowid, body) VALUES('delete', OLD.rowid, OLD.body);\nEND;--> statement-breakpoint\nCREATE TRIGGER `history_fts_au` AFTER UPDATE ON `history_fts` BEGIN\n INSERT INTO `history_fts_idx`(`history_fts_idx`, rowid, body) VALUES('delete', OLD.rowid, OLD.body);\n INSERT INTO `history_fts_idx`(rowid, body) VALUES (NEW.rowid, NEW.body);\nEND;\n",timestamp:1780963200000,name:"20260609000000_history_fts"},{sql:"ALTER TABLE `workflow_run` ADD COLUMN `agent_timeout_ms` integer;\n",timestamp:1781046000000,name:"20260609230000_workflow_agent_timeout"},{sql:"CREATE TABLE `external_import` (\n `source` text NOT NULL,\n `source_key` text NOT NULL,\n `session_id` text NOT NULL,\n `source_path` text NOT NULL,\n `source_mtime` integer NOT NULL,\n `time_imported` integer NOT NULL,\n `message_ids` text,\n PRIMARY KEY (`source`, `source_key`)\n);\n\nINSERT INTO `external_import` (`source`, `source_key`, `session_id`, `source_path`, `source_mtime`, `time_imported`, `message_ids`)\nSELECT 'cc', `source_uuid`, `session_id`, `source_path`, `source_mtime`, `time_imported`, `message_ids`\nFROM `claude_import`;\n\nDROP TABLE `claude_import`;\n",timestamp:1781222400000,name:"20260612000000_external_import"}];if(o.length>0){if(fi.info("applying migrations",{count:o.length,mode:"bundled"}),nn.QITQODE_SKIP_MIGRATIONS)for(let i of o)i.sql="select 1;";ao(n,o)}return n});function Se(){Mn().$client.close(),Mn.reset()}var Yn=gn.create("database");function Ce(n){try{return n(Yn.use().tx)}catch(o){if(o instanceof gn.NotFound){let i=[],l=Yn.provide({effects:i,tx:Mn()},()=>n(Mn()));for(let e of i)e();return l}throw o}}function He(n){let o=Un.bind(n);try{Yn.use().effects.push(o)}catch{o()}}function xe(n,o){try{return n(Yn.use().tx)}catch(i){if(i instanceof gn.NotFound){let l=[],e=Un.bind((_)=>Yn.provide({tx:_,effects:l},()=>n(_))),A=Mn().transaction(e,{behavior:o?.behavior});for(let _ of l)_();return A}throw i}}var Oi={};On(Oi,{layer:()=>Ti,defaultLayer:()=>we,Service:()=>to,NotFoundError:()=>Zo});import X from"path";var Sn={};On(Sn,{layer:()=>pi,defaultLayer:()=>Ee,Service:()=>io,Git:()=>Sn});var Ke=["--no-optional-locks","-c","core.autocrlf=false","-c","core.fsmonitor=false","-c","core.longpaths=true","-c","core.symlinks=true","-c","core.quotepath=false"],zn=(n)=>n.text().trim(),Po=(n)=>n.split("\x00").filter(Boolean),Re=(n)=>({exitCode:1,text:()=>"",stdout:Buffer.alloc(0),stderr:Buffer.from(n instanceof Error?n.message:String(n))}),si=(n)=>{if(n==="??")return"added";if(n.includes("U"))return"modified";if(n.includes("A")&&!n.includes("D"))return"added";if(n.includes("D")&&!n.includes("A"))return"deleted";return"modified"};class io extends vn.Service()("@qitqode/Git"){}var pi=h.effect(io,r.gen(function*(){let n=yield*an.ChildProcessSpawner,o=r.fn("Git.run")(function*(g,s){let m=_i.make("git",[...Ke,...g],{cwd:s.cwd,env:s.env,extendEnv:!0,stdin:"ignore",stdout:"pipe",stderr:"pipe"}),y=yield*Ni(n,m);return{exitCode:y.code,text:()=>y.text,stdout:Buffer.from(y.text),stderr:Buffer.from(y.stderr)}},r.scoped,r.catch((g)=>r.succeed(Re(g)))),i=r.fn("Git.text")(function*(g,s){return(yield*o(g,s)).text()}),l=r.fn("Git.lines")(function*(g,s){return(yield*i(g,s)).split(/\r?\n/).map((m)=>m.trim()).filter(Boolean)}),e=r.fnUntraced(function*(g){return yield*l(["for-each-ref","--format=%(refname:short)","refs/heads"],{cwd:g})}),A=r.fnUntraced(function*(g,s){let m=yield*o(["config","init.defaultBranch"],{cwd:g}),y=zn(m);if(!y||!s.includes(y))return;return{name:y,ref:y}}),_=r.fnUntraced(function*(g){let s=yield*l(["remote"],{cwd:g});if(s.includes("origin"))return"origin";if(s.length===1)return s[0];if(s.includes("upstream"))return"upstream";return s[0]}),T=r.fn("Git.branch")(function*(g){let s=yield*o(["symbolic-ref","--quiet","--short","HEAD"],{cwd:g});if(s.exitCode!==0)return;return zn(s)||void 0}),M=r.fn("Git.prefix")(function*(g){let s=yield*o(["rev-parse","--show-prefix"],{cwd:g});if(s.exitCode!==0)return"";return zn(s)}),x=r.fn("Git.defaultBranch")(function*(g){let s=yield*_(g);if(s){let t=yield*o(["symbolic-ref",`refs/remotes/${s}/HEAD`],{cwd:g});if(t.exitCode===0){let u=zn(t).replace(/^refs\/remotes\//,""),D=u.startsWith(`${s}/`)?u.slice(`${s}/`.length):"";if(D)return{name:D,ref:u}}}let m=yield*e(g),y=yield*A(g,m);if(y)return y;if(m.includes("main"))return{name:"main",ref:"main"};if(m.includes("master"))return{name:"master",ref:"master"}}),C=r.fn("Git.hasHead")(function*(g){return(yield*o(["rev-parse","--verify","HEAD"],{cwd:g})).exitCode===0}),H=r.fn("Git.mergeBase")(function*(g,s,m="HEAD"){let y=yield*o(["merge-base",s,m],{cwd:g});if(y.exitCode!==0)return;return zn(y)||void 0}),K=r.fn("Git.show")(function*(g,s,m,y=""){let t=y?`${y}${m}`:m,u=yield*o(["show",`${s}:${t}`],{cwd:g});if(u.exitCode!==0)return"";if(u.stdout.includes(0))return"";return u.text()}),$=r.fn("Git.status")(function*(g){return Po(yield*i(["status","--porcelain=v1","--untracked-files=all","--no-renames","-z","--","."],{cwd:g})).flatMap((s)=>{let m=s.slice(3);if(!m)return[];let y=s.slice(0,2);return[{file:m,code:y,status:si(y)}]})}),Q=r.fn("Git.diff")(function*(g,s){let m=Po(yield*i(["diff","--no-ext-diff","--no-renames","--name-status","-z",s,"--","."],{cwd:g}));return m.flatMap((y,t)=>{if(t%2!==0)return[];let u=m[t+1];if(!y||!u)return[];return[{file:u,code:y,status:si(y)}]})}),L=r.fn("Git.stats")(function*(g,s){return Po(yield*i(["diff","--no-ext-diff","--no-renames","--numstat","-z",s,"--","."],{cwd:g})).flatMap((m)=>{let y=m.indexOf("\t"),t=m.indexOf("\t",y+1);if(y===-1||t===-1)return[];let u=m.slice(t+1);if(!u)return[];let D=m.slice(0,y),I=m.slice(y+1,t),O=D==="-"?0:Number.parseInt(D||"0",10),P=I==="-"?0:Number.parseInt(I||"0",10);return[{file:u,additions:Number.isFinite(O)?O:0,deletions:Number.isFinite(P)?P:0}]})});return io.of({run:o,branch:T,prefix:M,defaultBranch:x,hasHead:C,mergeBase:H,show:K,status:$,diff:Q,stats:L})})),Ee=pi.pipe(h.provide(bn));var An=c.create({service:"storage"}),Zo=ro.create("NotFoundError",a.object({message:a.string()})),Pe=N.Struct({path:N.optional(N.Struct({root:N.optional(N.String)}))}),We=N.Struct({id:N.String}),Ue=N.Struct({id:N.String}),Ze=N.Struct({additions:N.Number,deletions:N.Number}),Xe=N.Struct({id:N.String,projectID:N.String,summary:N.Struct({diffs:N.Array(Ze)})}),Ye=N.decodeUnknownOption(Pe),ze=N.decodeUnknownOption(We),ce=N.decodeUnknownOption(Ue),ke=N.decodeUnknownOption(Xe);class to extends vn.Service()("@qitqode/Storage"){}function qe(n,o){return X.join(n,...o)+".json"}function Wo(n){if(!n||typeof n!=="object")return!1;if("code"in n&&n.code==="ENOENT")return!0;if("reason"in n&&n.reason&&typeof n.reason==="object"&&"_tag"in n.reason)return n.reason._tag==="NotFound";return!1}function Ve(n){let o=Number.parseInt(n,10);return Number.isNaN(o)?0:o}var Ai=[r.fn("Storage.migration.1")(function*(n,o,i){let l=X.resolve(n,"../project");if(!(yield*o.isDir(l)))return;let e=yield*o.glob("*",{cwd:l,include:"all"});for(let A of e){let _=X.join(l,A);if(!(yield*o.isDir(_)))continue;An.info(`migrating project ${A}`);let T=A,M="/";if(T!=="global"){for(let H of yield*o.glob("storage/session/message/*/*.json",{cwd:_,absolute:!0})){let K=Ye(yield*o.readJson(H),{onExcessProperty:"preserve"}),$=cn.isSome(K)?K.value.path?.root:void 0;if(!$)continue;M=$;break}if(!M)continue;if(!(yield*o.isDir(M)))continue;let x=yield*i.run(["rev-list","--max-parents=0","--all"],{cwd:M}),[C]=x.text().split(`
|
|
5
|
-
`).filter(Boolean).map((H)=>H.trim()).toSorted();if(!C)continue;T=C,yield*o.writeWithDirs(X.join(n,"project",T+".json"),JSON.stringify({id:C,vcs:"git",worktree:M,time:{created:Date.now(),initialized:Date.now()}},null,2)),An.info(`migrating sessions for project ${T}`);for(let H of yield*o.glob("storage/session/info/*.json",{cwd:_,absolute:!0})){let K=X.join(n,"session",T,X.basename(H));An.info("copying",{sessionFile:H,dest:K});let $=yield*o.readJson(H),Q=ze($,{onExcessProperty:"preserve"});if(yield*o.writeWithDirs(K,JSON.stringify($,null,2)),cn.isNone(Q))continue;An.info(`migrating messages for session ${Q.value.id}`);for(let L of yield*o.glob(`storage/session/message/${Q.value.id}/*.json`,{cwd:_,absolute:!0})){let g=X.join(n,"message",Q.value.id,X.basename(L));An.info("copying",{msgFile:L,dest:g});let s=yield*o.readJson(L),m=ce(s,{onExcessProperty:"preserve"});if(yield*o.writeWithDirs(g,JSON.stringify(s,null,2)),cn.isNone(m))continue;An.info(`migrating parts for message ${m.value.id}`);for(let y of yield*o.glob(`storage/session/part/${Q.value.id}/${m.value.id}/*.json`,{cwd:_,absolute:!0})){let t=X.join(n,"part",m.value.id,X.basename(y)),u=yield*o.readJson(y);An.info("copying",{partFile:y,dest:t}),yield*o.writeWithDirs(t,JSON.stringify(u,null,2))}}}}}}),r.fn("Storage.migration.2")(function*(n,o){for(let i of yield*o.glob("session/*/*.json",{cwd:n,absolute:!0})){let l=yield*o.readJson(i),e=ke(l,{onExcessProperty:"preserve"});if(cn.isNone(e))continue;let A=e.value.summary.diffs;yield*o.writeWithDirs(X.join(n,"session_diff",e.value.id+".json"),JSON.stringify(A,null,2)),yield*o.writeWithDirs(X.join(n,"session",e.value.projectID,e.value.id+".json"),JSON.stringify({...l,summary:{additions:A.reduce((_,T)=>_+T.additions,0),deletions:A.reduce((_,T)=>_+T.deletions,0)}},null,2))}})],Ti=h.effect(to,r.gen(function*(){let n=yield*k.Service,o=yield*Sn.Service,i=yield*Uo.make({lookup:()=>Cn.make(),idleTimeToLive:0}),l=yield*r.cached(r.gen(function*(){let $=X.join($n.Path.data,"storage"),Q=X.join($,"migration"),L=yield*n.readFileString(Q).pipe(r.map(Ve),r.catchIf(Wo,()=>r.succeed(0)),r.orElseSucceed(()=>0));for(let g=L;g<Ai.length;g++){An.info("running migration",{index:g});let s=Ai[g],m=yield*r.exit(s($,n,o));if(Xn.isFailure(m)){An.error("failed to run migration",{index:g,cause:m.cause});break}yield*n.writeWithDirs(Q,String(g+1))}return{dir:$}})),e=($)=>r.fail(new Zo({message:`Resource not found: ${$}`})),A=($,Q)=>Q.pipe(r.catchIf(Wo,()=>e($))),_=r.fnUntraced(function*($,Q){yield*n.writeWithDirs($,JSON.stringify(Q,null,2))}),T=($,Q)=>r.scoped(r.gen(function*(){let L=qe((yield*l).dir,$);return yield*Q(L,yield*Uo.get(i,L))})),M=r.fn("Storage.remove")(function*($){yield*T($,(Q,L)=>Cn.withWriteLock(L,n.remove(Q).pipe(r.catchIf(Wo,()=>r.void))))}),x=($)=>r.gen(function*(){return yield*T($,(L,g)=>Cn.withReadLock(g,A(L,n.readJson(L))))}),C=($,Q)=>r.gen(function*(){return yield*T($,(g,s)=>Cn.withWriteLock(s,r.gen(function*(){let m=yield*A(g,n.readJson(g));return Q(m),yield*_(g,m),m})))}),H=($,Q)=>r.gen(function*(){yield*T($,(L,g)=>Cn.withWriteLock(g,_(L,Q)))}),K=r.fn("Storage.list")(function*($){let Q=(yield*l).dir,L=X.join(Q,...$);return(yield*n.glob("**/*",{cwd:L,include:"file"}).pipe(r.catch(()=>r.succeed([])))).map((s)=>[...$,...s.slice(0,-5).split(X.sep)]).toSorted((s,m)=>s.join("/").localeCompare(m.join("/")))});return to.of({remove:M,read:x,update:C,write:H,list:K})})),we=Ti.pipe(h.provide(k.defaultLayer),h.provide(Sn.defaultLayer));export{Rn as pl,xr as ql,En as rl,mn as sl,J as tl,fn as ul,eo as vl,Yo as wl,zo as xl,co as yl,ko as zl,Vo as Al,fo as Bl,In as Cl,Sn as Dl,Zo as El,Oi as Fl,w as Gl,Jo as Hl,Pr as Il,se as Jl,jr as Kl,Ae as Ll,on as Ml,Un as Nl,de as Ol,ei as Pl,mi as Ql};
|
package/bundle/chunk-e5t7jsxa.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ip as h}from"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-sh03ka27.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};
|
package/bundle/chunk-eb811dt2.js
DELETED
package/bundle/chunk-fbz2xv2w.js
DELETED
package/bundle/chunk-gbvcb4k1.js
DELETED
package/bundle/chunk-gdtnqzbp.js
DELETED
package/bundle/chunk-gkfvhh28.js
DELETED
package/bundle/chunk-gnh8c49b.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{a,b,c,d,e,f,g}from"./chunk-6d4xc6br.js";import"./chunk-6y0wgz2j.js";import"./chunk-rn3je2hv.js";import"./chunk-9z7y4x7q.js";import"./chunk-p0852vfn.js";import"./chunk-ej0yzstw.js";import"./chunk-w8nj5ph5.js";import"./chunk-psmwrvqs.js";import"./chunk-9gxyt2ay.js";import"./chunk-fd04358e.js";import"./chunk-qn1fhqyw.js";import"./chunk-674pexjx.js";import"./chunk-zjyaze0d.js";import"./chunk-xdcwx384.js";import"./chunk-rd08wx37.js";import"./chunk-fp2xgnjn.js";import"./chunk-y1v7mf1a.js";import"./chunk-358wdvj7.js";import"./chunk-dn0437c1.js";import"./chunk-47jkx37s.js";import"./chunk-31a47ptm.js";import"./chunk-jwv6fda1.js";import"./chunk-hx13a8es.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-qrztx1b4.js";import"./chunk-j1bv93m4.js";import"./chunk-pp10epga.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-m6967jtv.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-3cs1qf8x.js";import"./chunk-4xqwt6dr.js";import"./chunk-g77kddrs.js";import"./chunk-9znfb8f2.js";import"./chunk-6kch0q2d.js";import"./chunk-6cztstry.js";import"./chunk-1mfdmm2t.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import"./chunk-fdmz0502.js";import"./chunk-1a08ffyd.js";import"./chunk-8jkqyf9n.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-hf39qx6t.js";import"./chunk-x0de4z05.js";import"./chunk-sh03ka27.js";export{f as statusEffect,a as resolveApiKeyFlag,e as logoutEffect,d as loginEffect,c as interactiveLogin,b as apiKeyLoginEffect,g as AuthCommand};
|
package/bundle/chunk-gvf6ek9f.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{vg as a,wg as b,xg as c}from"./chunk-583d91xq.js";import"./chunk-y1v7mf1a.js";import"./chunk-358wdvj7.js";import"./chunk-dn0437c1.js";import"./chunk-47jkx37s.js";import"./chunk-31a47ptm.js";import"./chunk-jwv6fda1.js";import"./chunk-hx13a8es.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-qrztx1b4.js";import"./chunk-j1bv93m4.js";import"./chunk-pp10epga.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-m6967jtv.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-3cs1qf8x.js";import"./chunk-9znfb8f2.js";import"./chunk-6kch0q2d.js";import"./chunk-6cztstry.js";import"./chunk-1mfdmm2t.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import"./chunk-fdmz0502.js";import"./chunk-1a08ffyd.js";import"./chunk-8jkqyf9n.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-x0de4z05.js";import"./chunk-sh03ka27.js";export{b as run,a as encodeDir,c as ClaudeImport};
|
package/bundle/chunk-gvx5hmhk.js
DELETED
package/bundle/chunk-hham7r33.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{iP as a,jP as b,kP as c,lP as d,mP as e,nP as f,oP as g,pP as h,qP as i,rP as j}from"./chunk-hf39qx6t.js";import"./chunk-sh03ka27.js";export{c as TreeCursor,b as Tree,f as Query,j as Parser,d as Node,i as MIN_COMPATIBLE_VERSION,a as LookaheadIterator,g as Language,h as LANGUAGE_VERSION,e as CaptureQuantifier};
|
package/bundle/chunk-hsjbe5zy.js
DELETED
package/bundle/chunk-j1bv93m4.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Zo as MJ,bp as $J,tp as kJ}from"./chunk-pp10epga.js";import{Ip as qJ}from"./chunk-crqycrs4.js";import{et as F}from"./chunk-1a08ffyd.js";import{It as LJ}from"./chunk-6yshpz0z.js";import{Pt as e,Xt as SJ}from"./chunk-5dvy83ms.js";import{ju as OJ,mu as QJ}from"./chunk-ffx0cr44.js";var cJ=0.9,mJ=256,VJ="[Earlier tool result removed to fit the request size limit]",c;function h(J){return Buffer.byteLength(JSON.stringify(J),"utf8")}function NJ(){return e.QITQODE_QLEX_MAX_REQUEST_BYTES??c}function JJ(J){let K=e.QITQODE_QLEX_MAX_REQUEST_BYTES;if(K!==void 0)return K;let Z=Math.max(1,Math.min(Math.floor(J*cJ),Math.floor(J)-1));return c=c===void 0?Z:Math.min(c,Z),c}function m(J,K){return!!J&&typeof J==="object"&&J.role===K}function DJ(J){let K=[],Z=0;while(Z<J.length){let $=Z,z=J[Z];if(Z++,m(z,"assistant")&&Array.isArray(z?.tool_calls)&&z.tool_calls.length>0)while(Z<J.length&&m(J[Z],"tool"))Z++;K.push({start:$,end:Z})}return K}function WJ(J,K){if(K.length===0)return[];let Z=-1;for(let $=K.length-1;$>=0;$--){let z=K[$],X=!1;for(let Y=z.start;Y<z.end;Y++)if(m(J[Y],"user"))X=!0;if(X){Z=$;break}}return K.filter(($,z)=>{if(z===K.length-1)return!1;if(z===Z)return!1;if($.start===0&&m(J[0],"system"))return!1;return!0})}function KJ(J,K){let Z=h(J),$={toolResultsElided:0,unitsDropped:0},z=()=>({body:J,bytes:Z,originalBytes:Z,reduced:!1,actions:$});if(!J||typeof J!=="object")return z();let X=J.messages;if(!Array.isArray(X))return z();let Y=X.map((j)=>j&&typeof j==="object"?{...j}:j),H=()=>({...J,messages:Y}),V=()=>h(H())<=K;{let j=Y;for(let N of WJ(j,DJ(j))){let L=!1;for(let O=N.start;O<N.end;O++){let k=j[O];if(!m(k,"tool"))continue;let w=k?.content;if(typeof w!=="string"||w.length<mJ)continue;if(w===VJ)continue;j[O]={...k,content:VJ},$.toolResultsElided++,L=!0}if(L&&V())break}}if(!V())for(;;){let j=Y,L=WJ(j,DJ(j))[0];if(!L)break;if(Y=[...j.slice(0,L.start),...j.slice(L.end)],$.unitsDropped++,V())break}let U=H(),P=h(U);return{body:U,bytes:P,originalBytes:Z,reduced:P<Z&&P<=K,actions:$}}import y from"fs/promises";import EJ from"path";import{randomUUID as dJ}from"crypto";var E=SJ({service:"provider.qlex"}),iJ=F.streamUrl(),lJ=F.omniqueryBaseUrl()+"/runOrchestrated",rJ=new Set(["rate_limited","transient","stream_truncated","stream_failed"]);function d(J,K){return K!==!1&&rJ.has(J)}function a(J){return typeof J==="string"&&/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(J)?J:void 0}function x(J,K){let Z=J;if(K.status!==void 0)Z.status=K.status;if(K.upstreamCode!==void 0)Z.upstreamCode=K.upstreamCode;let $=a(K.requestId);if($!==void 0)Z.requestId=$;if(Z.category=K.category,Z.retryable=d(K.category,K.retryable),K.outputBudgetRecoveryAvailable!==void 0)Z.outputBudgetRecoveryAvailable=K.outputBudgetRecoveryAvailable;if(K.outputBudgetRecoveryTokens!==void 0)Z.outputBudgetRecoveryTokens=K.outputBudgetRecoveryTokens}function b(J,K){return{...J,...K}}class wJ extends Error{name="QlexNotLoggedInError";constructor(J){super(F.copy().notLoggedIn);x(this,b({category:"invalid_credentials",retryable:!1},J))}}class RJ extends Error{name="QlexInsufficientBalanceError";constructor(J,K){super(F.copy().insufficientBalance(J));x(this,b({status:402,category:"billing",retryable:!1},K))}}class CJ extends Error{name="QlexRateLimitError";constructor(J){super(F.copy().rateLimit);x(this,b({status:429,category:"rate_limited",retryable:!0},J))}}class AJ extends Error{name="QlexInvalidCredentialsError";constructor(J,K){super(F.copy().invalidCredentials(J));x(this,b({status:401,category:"invalid_credentials",retryable:!1},K))}}class TJ extends Error{name="QlexRequestRejectedError";constructor(J,K,Z){super(F.copy().requestRejected(J,K));x(this,b({status:400,category:"request_rejected",retryable:!1},Z))}}class t extends Error{name="QlexRequestTooLargeError";stage;constructor(J="irreducible",K,Z){super(J==="after-reduction"?F.copy().requestTooLargeAfterReduction(K):F.copy().requestTooLargeIrreducible(K));this.stage=J,x(this,b({status:413,category:"request_too_large",retryable:!1},Z))}}class BJ extends Error{name="QlexRequestNotSentError";constructor(J,K){super(F.copy().requestNotSent(J));x(this,b({category:"request_rejected",retryable:!1},K))}}class u extends Error{name="QlexGatewayError";constructor(J,K){super(F.copy().gatewayUnavailable(J));x(this,b({category:"gateway_routing",retryable:!1},K))}}var oJ=60000,sJ=320000;function aK(J){return F.sanitizeUpstreamError(J)}class v extends Error{name="QlexStreamError";constructor(J,K,Z){let $=b({category:"unknown",retryable:!1},K);super($.category==="output_budget_exhausted"?F.copy().outputBudgetExhausted():$.category==="empty_output"?F.copy().emptyOutput():$.category==="stream_truncated"?F.copy().streamCutOff(Z):$.category==="stream_failed"?F.copy().streamFailedAfterRetries(Z):F.copy().streamFailed(J));x(this,$),LJ(this)}}var aJ=[{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|socket connection was closed unexpectedly|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}],tJ={ERR_EMPTY_RESULT:{category:"empty_output",retryable:!1},ERR_TRUNCATED_OUTPUT:{category:"stream_truncated",retryable:!0},ERR_STREAM:{category:"stream_failed",retryable:!0}},eJ=/^\s*(ERR_[A-Z0-9_]+)\b(?:\s*(?:[\u2014\u2013:-]\s*)?)?/i,JK=/\b(req_[A-Za-z0-9][A-Za-z0-9_-]*)\b/;function GJ(J){let K=J??"",Z=eJ.exec(K),$=Z?K.slice(Z[0].length):K,z=IJ($),X=Z?.[1]?.toUpperCase()??z.upstreamCode,Y=z.requestId??a(JK.exec(K)?.[1]),H=z.retryable;if(X!==void 0){let V=tJ[X];if(V!==void 0)return{...V,upstreamCode:X,retryable:d(V.category,H??V.retryable),...Y?{requestId:Y}:{}}}for(let V of aJ)if(V.match.test($))return{category:V.category,retryable:d(V.category,H??V.retryable),...X?{upstreamCode:X}:{},...Y?{requestId:Y}:{}};return{category:"unknown",retryable:d("unknown",H),...X?{upstreamCode:X}:{},...Y?{requestId:Y}:{}}}function KK(J){return MJ(J)}function IJ(J){try{let K=JSON.parse(J);if(!K||typeof K!=="object"||Array.isArray(K))return{};let Z=K,$=Z.error&&typeof Z.error==="object"&&!Array.isArray(Z.error)?Z.error:void 0,z=Z.details&&typeof Z.details==="object"&&!Array.isArray(Z.details)?Z.details:void 0,X=[Z.requestId,$?.requestId,z?.requestId].map(a).find((V)=>V!==void 0),Y=Z.retryable===!1||$?.retryable===!1?!1:Z.retryable===!0||$?.retryable===!0?!0:void 0,H=$?.code??Z.code;return{...X!==void 0?{requestId:X}:{},...Y!==void 0?{retryable:Y}:{},...typeof H==="string"&&/^[A-Z][A-Z0-9_]{0,63}$/i.test(H)?{upstreamCode:H.toUpperCase()}:{}}}catch{return{}}}function xJ(J,K){let Z,$,z,X=!1;try{let N=JSON.parse(K);if(N&&typeof N==="object"){let L=N.error&&typeof N.error==="object"?N.error:void 0;if(typeof L?.code==="string")Z=L.code;else if(typeof N.code==="string")Z=N.code;if(typeof L?.message==="string")$=L.message;else if(typeof N.message==="string")$=N.message;if(typeof N.details?.field==="string")z=N.details.field}}catch(N){X=/^\s*[\[{]/.test(K)&&(ZK(K)||/unexpected end|end of json|unterminated string/i.test(String(N)))}let Y=Z?.toUpperCase()??"",{requestId:H,retryable:V}=IJ(K),U=(()=>{if(X)return"stream_truncated";if(J===402)return"billing";if(J===413)return"request_too_large";if(J===429)return"rate_limited";if(J===401||J===403)return Y==="ERR_GATEWAY_REQUIRED"||KK(K)?"gateway_routing":"invalid_credentials";if(Y.includes("CONFIG"))return"configuration";if(J>=500)return"transient";if(J>=400)return"request_rejected";return"unknown"})(),P=d(U,V),j={status:J,category:U,retryable:P};if(Z!==void 0)j.upstreamCode=Z;if($!==void 0)j.upstreamMessage=$;if(z!==void 0)j.field=z;if(H!==void 0)j.requestId=H;return j}function ZK(J){let K=0,Z=!1,$=!1;for(let z of J){if(Z){if($)$=!1;else if(z==="\\")$=!0;else if(z==='"')Z=!1;continue}if(z==='"')Z=!0;else if(z==="{"||z==="[")K++;else if(z==="}"||z==="]")K--;if(K<0)return!1}return Z||K>0}function $K(J){let K=F.tierBudgetFacts(J.tier),Z=J.advisory,$=Z?.tierOutputLimit??K?.output;if(J.requestedTotal!==void 0)return{total:$===void 0?J.requestedTotal:Math.min(J.requestedTotal,$)};if(!Z&&!K)return{};let z=Z?.reasoningReserveTokens??K?.reasoningReserve??0,X=Z?.visibleOutputFloorTokens??K?.visibleOutputFloor??0,Y=Z?.recommendedTotalTokens??Z?.tierRecommendedStepTokens??K?.recommendedTotal??K?.recommendedStep??$,H=Z?.viableTotalFloorTokens??K?.viableTotalFloor??z+X,V=Y===void 0?H:Math.max(Y,H),U=Z?.reasoningReported??K?.reasoning;return{total:$===void 0?V:Math.min(V,$),reasoningBudget:U&&z>0?Math.min(z,V):void 0}}var zK=new Set(["coding","agent","research","review","chat"]);function XK(J){if(J===void 0)return;if(typeof J==="string"&&zK.has(J))return J;throw Error(`invalid Qortex posture: ${String(J)}`)}function YK(J){if(J===void 0)return;let K=Array.isArray(J)?J:[J];if(K.every((Z)=>typeof Z==="string"&&/^[^/\s]+\/[^/\s]+$/.test(Z)))return Array.isArray(J)?K:J;throw Error(`invalid Qortex directive registry key: ${String(J)}`)}function s(J){if(typeof J==="string")return J;if(Array.isArray(J))return J.map((K)=>{if(typeof K==="string")return K;if(K&&typeof K==="object"){let Z=K;if(typeof Z.text==="string")return Z.text;if(typeof Z.content==="string")return Z.content}return""}).join("");if(J===void 0||J===null)return"";return String(J)}var HK="[Tool call]",VK="[Tool returned no output]";function bJ(J){if(!Array.isArray(J))return{messages:J,dropped:[]};let K=[];return{messages:J.flatMap(($,z)=>{if(!$||typeof $!=="object")return K.push({index:z,role:typeof $,reason:"not-an-object"}),[];let X=$,Y=s(X.content);if(Y.trim().length>0)return[{...X,content:Y}];if(X.role==="assistant"&&Array.isArray(X.tool_calls)&&X.tool_calls.length>0)return[{...X,content:HK}];if(X.role==="tool"&&typeof X.tool_call_id==="string"&&X.tool_call_id.trim().length>0)return[{...X,content:VK}];return K.push({index:z,role:typeof X.role==="string"?X.role:"unknown",reason:"empty-content"}),[]}),dropped:K}}function DK(J){return bJ(J).messages}function WK(J){if(!Array.isArray(J))return!1;return J.some((K)=>!!K&&typeof K==="object"&&K.role==="user")}function NK(J){if(!Array.isArray(J))return!1;return J.some((K)=>{if(!K||typeof K!=="object")return!1;let Z=K;if(Z.role!=="user")return!1;return s(Z.content).trim().length>0})}function GK(J){if(!Array.isArray(J))return J;let K=(X)=>!!X&&typeof X==="object"&&X.role==="system",Z=0;while(Z<J.length&&K(J[Z]))Z++;if(Z<=1)return J;let $=J.slice(0,Z),z=$.map((X)=>typeof X.content==="string"?X.content:String(X.content??"")).filter((X)=>X.length>0).join(`
|
|
3
|
-
|
|
4
|
-
`);return[{...$[0],role:"system",content:z},...J.slice(Z)]}var n="<tool_call>",r="</tool_call>";function jK(J){if(!Array.isArray(J)||J.length===0)return;let K=J.map((Z)=>{try{return JSON.stringify(Z)}catch{return}}).filter((Z)=>Z!==void 0);if(K.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>",...K,"</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 UK=3;function XJ(J){let K=J;for(let Z=0;Z<UK;Z++){if(K!==null&&typeof K==="object")return K;if(typeof K!=="string")return;try{K=JSON.parse(K)}catch{return}}return}function PK(J){let K=J?.tool_calls;if(!Array.isArray(K))return;for(let Z of K){let $=Z?.function;if(!$)continue;E.debug("tool call ingress",{tool:typeof $.name==="string"?$.name:"?",source:"native",args:YJ($.arguments)})}}function YJ(J,K=300){let Z;try{Z=typeof J==="string"?J:JSON.stringify(J)??String(J)}catch{Z="<unrenderable>"}return Z.length<=K?Z:`${Z.slice(0,K)}\u2026 (${Z.length} chars total)`}function _K(J){let K=J.function??{},Z=typeof K.name==="string"?K.name:"",$=K.arguments===void 0?{}:XJ(K.arguments);if($===void 0)E.warn("dropping unrecoverable tool-call arguments while re-encoding history",{tool:Z,raw:YJ(K.arguments)});return`${n}
|
|
6
|
-
${JSON.stringify({name:Z,arguments:$??{}})}
|
|
7
|
-
${r}`}function hJ(J,K){if(!Array.isArray(J))return J;let Z=J.map((z)=>{if(!z||typeof z!=="object")return z;let X=z;if(X.role==="assistant"&&Array.isArray(X.tool_calls)){let Y=X.tool_calls.map(_K).join(`
|
|
8
|
-
`),H=s(X.content),{tool_calls:V,...U}=X;return{...U,content:H.length>0?`${H}
|
|
9
|
-
${Y}`:Y}}if(X.role==="tool"){let{tool_call_id:Y,name:H,...V}=X;return{...V,role:"user",content:`<tool_response>
|
|
10
|
-
${s(X.content)}
|
|
11
|
-
</tool_response>`}}return z}),$=jK(K);if($){let z=0;while(z<Z.length&&!!Z[z]&&typeof Z[z]==="object"&&Z[z].role==="system")z++;Z.splice(z,0,{role:"system",content:$})}return Z}function FK(){return process.env.QITQODE_TOOL_PROTOCOL==="text"?"text":"native"}function OK(J){if(Array.isArray(J.tools)&&J.tools.length>0)return!0;let K=J.messages;if(!Array.isArray(K))return!1;return K.some((Z)=>{if(!Z||typeof Z!=="object")return!1;let $=Z;return $.role==="tool"||$.role==="assistant"&&Array.isArray($.tool_calls)})}function jJ(J,K){let Z=K?.toolMode??"native",$=J.model??"adaptive",z={stream:J.stream??!0};if(J.temperature!==void 0)z.temperature=J.temperature;if(J.max_tokens!==void 0)z.max_tokens=J.max_tokens;let X=$K({tier:$,advisory:K?.outputAdvisory,requestedTotal:z.max_tokens});if(X.total!==void 0)z.max_tokens=X.total;if(X.reasoningBudget!==void 0)z.thinking={budget_tokens:X.reasoningBudget};if(K?.outputBudgetRecoveryTokens!==void 0){let P=typeof z.max_tokens==="number"?z.max_tokens:0,j=K.outputAdvisory?.tierOutputLimit??F.tierBudgetFacts($)?.output,N=Math.min(K.outputBudgetRecoveryTokens,j??K.outputBudgetRecoveryTokens);if(N>P)z.max_tokens=N}if(J.tools!==void 0)z.tools=J.tools;if(J.tool_choice!==void 0)z.tool_choice=J.tool_choice;if(J.stream_options!==void 0)z.stream_options=J.stream_options;let Y=Z==="text"?hJ(J.messages,J.tools):J.messages,H={},V=XK(J.posture);if(V!==void 0)H.posture=V;let U=YK(J.directive);if(U!==void 0)H.directive=U;if(J.modelPersona!==void 0)H.modelPersona=J.modelPersona;return{tier:$,messages:GK(DK(Y)),opts:z,...H}}var i=new Map,p=EJ.join(QJ.Path.data,"qlex-tier-advisories.json"),QK="qlex-tier-advisories",SK=2592000000,UJ=!1,LK;function fJ(J,K){if(!J||typeof J!=="object")return;let Z=J;if(typeof Z.capturedAt!=="number"||K-Z.capturedAt>SK)return;if(!Z.advisory)return;return{advisory:Z.advisory,capturedAt:Z.capturedAt}}async function MK(){if(UJ)return;try{let J=JSON.parse(await y.readFile(p,"utf8")),K=Date.now();for(let[Z,$]of Object.entries(J)){let z=fJ($,K);if(z)vJ(Z,z.advisory,z.capturedAt)}}catch{}UJ=!0}function kK(){return LK??=MK()}function vJ(J,K,Z=Date.now()){i.set(J,{advisory:K,capturedAt:Z})}async function qK(J){await OJ.withLock(QK,async()=>{let K={};try{let $=JSON.parse(await y.readFile(p,"utf8")),z=Date.now();for(let[X,Y]of Object.entries($)){let H=fJ(Y,z);if(H)K[X]=H}}catch{}for(let[$,z]of J){let X=K[$];if(!X||X.capturedAt<=z.capturedAt)K[$]=z}await y.mkdir(EJ.dirname(p),{recursive:!0});let Z=`${p}.${process.pid}.${dJ()}.tmp`;try{await y.writeFile(Z,JSON.stringify(K)),await y.rename(Z,p)}catch($){throw await y.rm(Z,{force:!0}).catch(()=>{}),$}})}function EK(){if(l)return;l=!0,zJ=zJ.then(()=>{return l=!1,qK([...i].map(([J,K])=>[J,K]))}).catch((J)=>{l=!1,E.warn("failed to persist tier output advisories",{file:p,error:J instanceof Error?J.message:String(J)})})}function f(J){return typeof J==="number"&&Number.isFinite(J)&&J>0?J:void 0}function wK(J,K){let Z={},$=f(K.tierOutputLimit),z=f(K.tierRecommendedStepTokens),X=f(K.reasoningReserveTokens),Y=f(K.visibleOutputFloorTokens),H=f(K.recommendedTotalTokens),V=f(K.viableTotalFloorTokens),U=f(K.budgetPolicyVersion);if($!==void 0)Z.tierOutputLimit=$;if(z!==void 0)Z.tierRecommendedStepTokens=z;if(X!==void 0)Z.reasoningReserveTokens=X;if(Y!==void 0)Z.visibleOutputFloorTokens=Y;if(H!==void 0)Z.recommendedTotalTokens=H;if(V!==void 0)Z.viableTotalFloorTokens=V;if(typeof K.reasoningReported==="boolean")Z.reasoningReported=K.reasoningReported;if(U!==void 0)Z.budgetPolicyVersion=U;if(Object.keys(Z).length===0)return;vJ(J,Z),EK()}function RK(J){return i.get(J)?.advisory}function tK(){i.clear()}function eK(){return zJ}function CK(J){let K=(Z)=>typeof Z==="string"&&(Z.startsWith("qlex")||Z.startsWith("qortex"));return K(J.id)||K(J.object)}function AK(J){return J.id==="qortex-routing"&&J.object==="qortex.routing.status"&&J.status==="free-fallback"}function JZ(J){if(!J||typeof J!=="object")return!1;let K=J,Z=K.qortex_routing;return K.id==="qlex-stream"&&K.object==="chat.completion.chunk"&&Array.isArray(K.choices)&&!!Z&&typeof Z==="object"&&Z.status==="free-fallback"}function TK(J){let K=[],Z=J.indexOf(`
|
|
12
|
-
`)===-1?[J]:J.split(`
|
|
13
|
-
`);for(let Y of Z){let H=Y.endsWith("\r")?Y.slice(0,-1):Y;if(!H.startsWith("data:"))continue;let V=H.slice(5);if(V.startsWith(" "))V=V.slice(1);K.push(V)}if(K.length===0)return{kind:"skip"};let $=K.length===1?K[0]:K.join(`
|
|
14
|
-
`);if($==="")return{kind:"skip"};if($==="[DONE]")return{kind:"done"};if($.startsWith("[ERROR]"))return{kind:"error",message:$.slice(7).trim()||"qlex stream error"};let z=$.charCodeAt(0),X=z===123||z===91||z===32||z===9||z===10||z===13;try{if(!X)return{kind:"token",content:$};let Y=JSON.parse($);if(Y&&typeof Y==="object"){let H=Y.id;if(H==="qlex-cost"||H==="qortex-cost")return{kind:"cost",cost:Y};if(H==="qlex-stream"&&Y.usage&&typeof Y.usage==="object"){let P=Y.choices,j;if(Array.isArray(P)&&P[0]&&typeof P[0]==="object"){let N=P[0].finish_reason;if(typeof N==="string")j=N}return{kind:"usage",usage:Y.usage,finishReason:j}}if(AK(Y))return{kind:"control",control:"free-tier-fallback",chunk:Y};if(Array.isArray(Y.choices))return{kind:"passthrough",chunk:Y};let V=Y,U=typeof V.content==="string"?V.content:typeof V.text==="string"?V.text:typeof V.delta==="string"?V.delta:void 0;if(U!==void 0)return{kind:"token",content:U};if(CK(Y)){let P=Y.object;return{kind:"control",control:typeof P==="string"&&P.endsWith(".tier.outputLimits")?"tier-output-limits":"unknown",chunk:Y}}}}catch{}return{kind:"token",content:$}}function BK(J,K){let Z=Math.min(J.length,K.length-1);for(let $=Z;$>=1;$--)if(K.startsWith(J.slice(J.length-$)))return $;return 0}function IK(J){if(typeof J==="string"){try{let Z=JSON.parse(J);if(Z!==null&&typeof Z==="object")return J}catch{}let K=XJ(J);return JSON.stringify(K??J)}return JSON.stringify(J??{})}class gJ{onText;onToolCall;pending="";inBlock=!1;constructor(J,K){this.onText=J;this.onToolCall=K}feed(J){this.pending+=J,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(J){while(!0)if(!this.inBlock){let K=this.pending.indexOf(n);if(K===-1){let Z=J?0:BK(this.pending,n),$=this.pending.length-Z;if($>0)this.onText(this.pending.slice(0,$)),this.pending=Z>0?this.pending.slice($):"";return}if(K>0)this.onText(this.pending.slice(0,K));this.pending=this.pending.slice(K+n.length),this.inBlock=!0}else{let K=this.pending.indexOf(r);if(K===-1)return;if(this.emitBlock(this.pending.slice(0,K),!1),this.pending=this.pending.slice(K+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(J,K){try{let Z=JSON.parse(J.trim());if(Z&&typeof Z==="object"&&typeof Z.name==="string"){this.onToolCall({name:Z.name,arguments:IK(Z.arguments)});return}}catch{}this.onText(`${n}${J}${K?"":r}`)}}function ZJ(J,K,Z){let $={id:"qlex-stream",object:"chat.completion.chunk",created:Math.floor(Date.now()/1000),model:"qlex",choices:[{index:0,delta:J,finish_reason:K}]};if(Z)$.usage=Z;return`data: ${JSON.stringify($)}
|
|
17
|
-
|
|
18
|
-
`}function xK(J,K){let Z=K?.toolProtocolEnabled===!0,$=K?.tier,z=K?.requestedOutputBudget,X=K?.idleTimeoutMs??sJ,Y=J.getReader(),H=new TextDecoder,V=new TextEncoder,U="",P=!1,j=!1,N,L,O,k,w=!1,I=!1,g=0,T=0;return new ReadableStream({async start(q){let B=(G)=>{if(G.length>0)w=!0;T+=G.length;let D=P?{content:G}:{role:"assistant",content:G};P=!0,q.enqueue(V.encode(ZJ(D,null)))},S=0,A=Z?new gJ(B,(G)=>{E.debug("tool call ingress",{tool:G.name,source:"text-shim",args:YJ(G.arguments),objectShaped:XJ(G.arguments)!==void 0});let D={...P?{}:{role:"assistant"},tool_calls:[{index:S,id:`qlexcall_${Date.now().toString(36)}_${S}`,type:"function",function:{name:G.name,arguments:G.arguments}}]};P=!0,I=!0,S++,q.enqueue(V.encode(ZJ(D,null)))}):void 0,HJ=(G)=>A?A.feed(G):B(G),Q=()=>{A?.flush();let D=N||L!==void 0||O!==void 0?{prompt_tokens:N?.tokens.prompt??O?.prompt??0,completion_tokens:N?.tokens.completion??O?.completion??0,total_tokens:N?.tokens.total??(N?.tokens.prompt??O?.prompt??0)+(N?.tokens.completion??O?.completion??0),cost_usd:N?.cost_usd,cost_credits:N?.cost_credits??N?.cost_qredits,context_window:L}:void 0;if(D&&(D.cost_usd??0)>0&&D.prompt_tokens===0)E.warn("qlex billed turn reported zero prompt tokens",{tier:$,completionTokens:D.completion_tokens,costUsd:D.cost_usd,source:N?"cost.summary":"usage frame"});let W=S>0?"tool_calls":k??"stop";if(W==="length"||W==="max_tokens"){let _=o($??"adaptive",z),C=_!==void 0;E.debug("qlex output budget exhausted",{tier:$,contentStreamed:w,outputBudgetRecoveryAvailable:C}),q.error(new v("output budget exhausted",{category:"output_budget_exhausted",retryable:!1,outputBudgetRecoveryAvailable:C,outputBudgetRecoveryTokens:_})),j=!0;return}if(!w&&!I&&k!=="tool_calls"){let _=o($??"adaptive",z),C=_!==void 0;E.debug("qlex completed without visible output",{tier:$,outputBudgetRecoveryAvailable:C}),q.error(new v("empty output",{category:"empty_output",retryable:!1,outputBudgetRecoveryAvailable:C,outputBudgetRecoveryTokens:_})),j=!0;return}if(q.enqueue(V.encode(ZJ({},W,D))),q.enqueue(V.encode(`data: [DONE]
|
|
19
|
-
|
|
20
|
-
`)),!N&&$!==void 0)E.info("qlex cost frame absent on stream finish",{tier:$});q.close(),j=!0},M=(G)=>{let D=TK(G);switch(g++,D.kind){case"skip":return!1;case"token":return HJ(D.content),!1;case"passthrough":{let W=D.chunk.choices;if(Array.isArray(W)&&W[0]&&typeof W[0]==="object"){let _=W[0].finish_reason;if(typeof _==="string")k=_;let C=W[0].delta;if(typeof C?.content==="string"&&C.content.length>0)w=!0;if(Array.isArray(C?.tool_calls))I=!0;PK(W[0].delta)}P=!0;{let _=D.chunk.choices?.[0]?.delta?.content;if(typeof _==="string")T+=_.length}return q.enqueue(V.encode(`data: ${JSON.stringify(D.chunk)}
|
|
21
|
-
|
|
22
|
-
`)),!1}case"cost":if(D.cost.final)N=D.cost;return!1;case"usage":if(D.usage.context_window!==void 0)L=D.usage.context_window;if(D.usage.prompt_tokens!==void 0&&D.usage.completion_tokens!==void 0)O={prompt:D.usage.prompt_tokens,completion:D.usage.completion_tokens};if(D.finishReason!==void 0)k=D.finishReason;return!1;case"control":{if(D.control==="tier-output-limits"){let W=D.chunk;if($!==void 0)wK($,W);E.debug("qlex tier output limits",{tierOutputLimit:W.tierOutputLimit,tierRecommendedStepTokens:W.tierRecommendedStepTokens,tierStepGuidance:W.tierStepGuidance,reasoningReserveTokens:W.reasoningReserveTokens,visibleOutputFloorTokens:W.visibleOutputFloorTokens,recommendedTotalTokens:W.recommendedTotalTokens,viableTotalFloorTokens:W.viableTotalFloorTokens,reasoningReported:W.reasoningReported,budgetPolicyVersion:W.budgetPolicyVersion})}else if(D.control==="free-tier-fallback")q.enqueue(V.encode(`data: ${JSON.stringify({id:"qlex-stream",object:"chat.completion.chunk",created:Math.floor(Date.now()/1000),model:"qlex",choices:[],qortex_routing:{status:"free-fallback"}})}
|
|
23
|
-
|
|
24
|
-
`));else E.debug("qlex control frame dropped",{id:D.chunk.id,object:D.chunk.object});return!1}case"done":return Q(),!0;case"error":{let W=GJ(D.message);E.warn("qlex stream error frame",{tier:$,raw:D.message,frameIndex:g,streamedContentChars:T,contentStreamed:P,upstreamCode:W.upstreamCode,requestId:W.requestId,category:W.category,retryable:W.retryable});let _=W.category==="output_budget_exhausted"||W.category==="empty_output"?o($??"adaptive",z):void 0;if(W.retryable===!1&&_!==void 0)W.outputBudgetRecoveryAvailable=!0,W.outputBudgetRecoveryTokens=_;return q.error(new v(D.message,W,{textKept:w})),j=!0,!0}}},R=async()=>{if(!(X>0))return Y.read();let G;try{return await Promise.race([Y.read(),new Promise((D,W)=>{G=setTimeout(()=>{let _=Math.round(X/1000);E.warn("qlex stream idle timeout",{tier:$,idleTimeoutMs:X,frameIndex:g,streamedContentChars:T,contentStreamed:P}),W(new v(`the gateway sent nothing for ${_}s`,{category:"transient",retryable:!0})),Y.cancel(Error(`qlex stream idle for ${_}s`)).catch(()=>{})},X)})])}finally{if(G!==void 0)clearTimeout(G)}};try{while(!0){let{done:D,value:W}=await R();if(D)break;U+=H.decode(W,{stream:!0});let _;while((_=U.indexOf(`
|
|
25
|
-
|
|
26
|
-
`))!==-1){let C=U.slice(0,_);if(U=U.slice(_+2),M(C))return}}U+=H.decode();let G=U.replace(/\r?\n$/,"");if(G.length>0&&M(G))return;if(!j)Q()}catch(G){if(j)return;if(G instanceof v){q.error(G);return}let D=G instanceof Error?G.message:String(G);q.error(new v(D,GJ(D),{textKept:w}))}finally{Y.releaseLock()}},cancel(q){Y.cancel(q).catch(()=>{})}})}function yJ(J){return{content:typeof J.content==="string"?J.content:J.choices?.[0]?.message?.content??"",finishReason:J.choices?.[0]?.finish_reason??"stop"}}function bK(J){let K=J??{},{content:Z,finishReason:$}=yJ(K),z=K.usage??{},X=z.prompt_tokens??0,Y=z.completion_tokens??0,H="orch-"+Date.now().toString(36),V=Math.floor(Date.now()/1000),U=(O,k,w)=>{let I={id:H,object:"chat.completion.chunk",created:V,model:"orchestrated",choices:[{index:0,delta:O,finish_reason:k}]};if(w)I.usage=w;return`data: ${JSON.stringify(I)}
|
|
27
|
-
|
|
28
|
-
`},P={prompt_tokens:X,completion_tokens:Y,total_tokens:z.total_tokens??X+Y};if(typeof z.cost_usd==="number")P.cost_usd=z.cost_usd;if(typeof z.cost_credits==="number")P.cost_credits=z.cost_credits;if(typeof z.context_window==="number")P.context_window=z.context_window;let j=[U({role:"assistant",content:""},null),U({content:Z},null),U({},$,P),`data: [DONE]
|
|
29
|
-
|
|
30
|
-
`],N=new TextEncoder,L=new ReadableStream({start(O){for(let k of j)O.enqueue(N.encode(k));O.close()}});return new Response(L,{status:200,headers:{"content-type":"text/event-stream"}})}function KZ(J){let K=J??{},{content:Z,finishReason:$}=yJ(K),z=K.usage??{},X=z.prompt_tokens??0,Y=z.completion_tokens??0,H={id:"orch-"+Date.now(),object:"chat.completion",created:Math.floor(Date.now()/1000),model:"orchestrated",choices:[{index:0,message:{role:"assistant",content:Z},finish_reason:$}],usage:{prompt_tokens:X,completion_tokens:Y,total_tokens:z.total_tokens??X+Y,...typeof z.cost_usd==="number"?{cost_usd:z.cost_usd}:{},...typeof z.context_window==="number"?{context_window:z.context_window}:{}}};return new Response(JSON.stringify(H),{status:200,headers:{"content-type":"application/json"}})}async function hK(J,K,Z){let $=xJ(J,K);if(!$.requestId)$.requestId=a(Z.requestId);let z=K?`HTTP ${J}: ${K}`:`HTTP ${J}`;switch(E.error("gateway rejected request",{tier:Z.tier,status:J,category:$.category,upstreamCode:$.upstreamCode,field:$.field,retryable:$.retryable}),$.category){case"billing":return new RJ(K||void 0,$);case"rate_limited":return new CJ($);case"gateway_routing":return new u(`HTTP ${J}`,$);case"invalid_credentials":return await Z.onInvalidCredentials?.().catch(()=>{}),new AJ(z,$);case"request_too_large":return new t("irreducible",$.upstreamMessage??K??void 0,$);case"request_rejected":case"tool_protocol":return new TJ($.upstreamMessage??K??void 0,$.field,$);case"configuration":case"transient":case"unknown":default:return new u(z,$)}}function PJ(J){let K=NJ();if(K===void 0)return J;let Z=h(J);if(Z<=K)return J;let $=KJ(J,K);return E.warn("request over known size ceiling, reducing before send",{tier:J.tier,bytes:Z,ceiling:K,reducedBytes:$.bytes,fits:$.reduced,...$.actions}),$.bytes<Z?$.body:J}function _J(J){let K=h(J),Z=JJ(K),$=KJ(J,Z);if(!$.reduced)throw E.error("request too large and cannot be reduced further",{tier:J.tier,rejectedBytes:K,ceiling:Z,reducedBytes:$.bytes,...$.actions}),new t("irreducible");return E.warn("request too large, retrying once with reduced history",{tier:J.tier,rejectedBytes:K,ceiling:Z,reducedBytes:$.bytes,...$.actions,notice:F.copy().requestTooLargeRecovering()}),$.body}function FJ(J){let K=h(J);throw JJ(K),E.error("reduced request still too large",{tier:J.tier,rejectedBytes:K}),new t("after-reduction")}function fK(J,K=globalThis.fetch,Z,$){let z=$?.responseTimeoutMs??oJ;return async(X,Y)=>{if(Y?.method==="POST"&&typeof Y?.body==="string"){let H;try{H=JSON.parse(Y.body)}catch{return K(X,Y)}let U=(typeof H.model==="string"?H.model:void 0)?.split("/").at(-1);if(U&&F.isDecisionTier(U))F.assertChatTierSupported(U);let P=FK();await kK();let j=RK(H.model??"adaptive"),N=jJ(H,{toolMode:P,outputAdvisory:j});if(WK(H.messages)&&!NK(N.messages)){let{dropped:Q}=bJ(P==="text"?hJ(H.messages,H.tools):H.messages);throw E.error("refusing to send: user message lost in normalization",{tier:N.tier,toolMode:P,inputRoles:Array.isArray(H.messages)?H.messages.map((M)=>M&&typeof M==="object"?String(M.role):"?"):"not-an-array",droppedCount:Q.length,dropped:Q}),new BJ("your message could not be turned into sendable content")}let L=await J(),O=typeof L==="string"?{key:L,method:"sso"}:L;if(!O?.key)throw new wJ;let k=new Headers(Y.headers),w=()=>{if(O.method==="api-key")k.delete("Authorization"),k.set("x-api-key",O.key);else k.delete("x-api-key"),k.set("Authorization",`Bearer ${O.key}`)};w(),k.set("Content-Type","application/json");let I=!1,g=async(Q,M,R)=>{let G=xJ(Q,M),D=async()=>({retry:!1,error:await hK(Q,M,{onInvalidCredentials:Z,tier:N.tier,requestId:R?.get("x-request-id")??R?.get("request-id")??R?.get("x-qlex-request-id")??void 0})});if(G.category!=="invalid_credentials"||I)return D();I=!0;let W=$J(O),_=await kJ(O);if(_.kind==="recovered"&&$J(_.credential)!==W)return O=_.credential,w(),{retry:!0};if(_.kind==="inconclusive")return{retry:!1,error:new u(`HTTP ${Q}: ${_.reason}`,G)};return D()};if(N.tier==="orchestrated"){let Q=Y.signal,M=async(D)=>{let W=new AbortController,_=()=>W.abort(Q?.reason);if(Q)if(Q.aborted)W.abort(Q.reason);else Q.addEventListener("abort",_,{once:!0});let C=!1,pJ=setTimeout(()=>{C=!0,W.abort()},z);try{return await K(lJ,{method:"POST",headers:k,body:JSON.stringify(D),signal:W.signal})}catch(uJ){if(C)throw new u(`no response within ${Math.round(z/1000)}s`);throw uJ}finally{clearTimeout(pJ),Q?.removeEventListener("abort",_)}},R=PJ(N),G=await M(R);if(G.status===413){if(await G.body?.cancel().catch(()=>{}),R=_J(R),G=await M(R),G.status===413)await G.body?.cancel().catch(()=>{}),FJ(R)}while(!G.ok){let D=await G.text().catch(()=>""),W=await g(G.status,D,G.headers);if(!W.retry)throw W.error;G=await M(R)}return bK(await G.json())}let T=Y.signal,q=async(Q)=>{let M=new AbortController,R=()=>M.abort(T?.reason);if(T)if(T.aborted)M.abort(T.reason);else T.addEventListener("abort",R,{once:!0});let G=()=>T?.removeEventListener("abort",R),D=!1,W=setTimeout(()=>{D=!0,M.abort()},z);try{return{res:await K(iJ,{method:"POST",headers:k,body:JSON.stringify(Q),signal:M.signal}),detach:G}}catch(_){if(G(),D)throw new u(`no response within ${Math.round(z/1000)}s`);throw _}finally{clearTimeout(W)}},B=PJ(N),{res:S,detach:A}=await q(B);if(S.status===400&&P==="native"&&OK(H))A(),await S.body?.cancel().catch(()=>{}),B=jJ(H,{toolMode:"text",outputAdvisory:j}),{res:S,detach:A}=await q(B);if(S.status===413){if(A(),await S.body?.cancel().catch(()=>{}),B=_J(B),{res:S,detach:A}=await q(B),S.status===413)A(),await S.body?.cancel().catch(()=>{}),FJ(B)}try{while(!S.ok){let Q=await S.text().catch(()=>""),M=await g(S.status,Q,S.headers);if(A(),!M.retry)throw M.error;({res:S,detach:A}=await q(B))}}catch(Q){throw A(),Q}if(H.stream!==!1&&S.body){let Q=Array.isArray(H.tools)&&H.tools.length>0;return new Response(xK(S.body,{toolProtocolEnabled:Q,tier:N.tier,requestedOutputBudget:N.opts.max_tokens}),{status:S.status,statusText:S.statusText,headers:{"content-type":"text/event-stream"}})}return S}return K(X,Y)}}function ZZ(J){let K=J.getToken??(async()=>J.bearerToken),Z=fK(K,globalThis.fetch,J.onInvalidCredentials);return qJ({name:J.name??"qlex",baseURL:F.streamBaseUrl(),fetch:Z})}function $Z(J,K){return o(J,K)!==void 0}var vK=2;function o(J,K){let Z=i.get(J)?.advisory,$=F.tierBudgetFacts(J),z=Z?.tierOutputLimit??$?.output;if(!z)return;let X=K??Z?.recommendedTotalTokens??Z?.tierRecommendedStepTokens??$?.recommendedTotal??$?.recommendedStep;if(!X||X>=z)return;let Y=Z?.recommendedTotalTokens??Z?.tierRecommendedStepTokens??$?.recommendedTotal??$?.recommendedStep??X,H=Math.min(z,Math.max(X+1,X*vK,Y));return H>X?H:void 0}var l=!1,zJ=Promise.resolve();
|
|
31
|
-
export{iJ as Zn,lJ as _n,d as $n,a as ao,wJ as bo,RJ as co,CJ as do,AJ as eo,TJ as fo,t as go,BJ as ho,u as io,oJ as jo,sJ as ko,aK as lo,v as mo,GJ as no,KK as oo,IJ as po,xJ as qo,$K as ro,s as so,bJ as to,DK as uo,WK as vo,NK as wo,GK as xo,n as yo,r as zo,jK as Ao,XJ as Bo,hJ as Co,FK as Do,OK as Eo,jJ as Fo,wK as Go,RK as Ho,tK as Io,eK as Jo,JZ as Ko,TK as Lo,BK as Mo,IK as No,gJ as Oo,xK as Po,bK as Qo,KZ as Ro,fK as So,ZZ as To,$Z as Uo,o as Vo};
|
package/bundle/chunk-jvvctqjd.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{a as $B,b as zB}from"./chunk-6d4xc6br.js";import"./chunk-6y0wgz2j.js";import"./chunk-rn3je2hv.js";import{B as VB,C as XB}from"./chunk-tz1sv9kt.js";import{D as BB,F as JB}from"./chunk-ajyfms68.js";import"./chunk-9z7y4x7q.js";import{aa as YB,ba as ZB}from"./chunk-6j53vtzd.js";import"./chunk-p0852vfn.js";import"./chunk-ej0yzstw.js";import{fe as e}from"./chunk-w8nj5ph5.js";import{Xf as p,Yf as w,Zf as O,_f as g}from"./chunk-bga4kqd1.js";import{cg as z}from"./chunk-psmwrvqs.js";import{Eg as t}from"./chunk-9gxyt2ay.js";import{Ah as x}from"./chunk-fd04358e.js";import"./chunk-qn1fhqyw.js";import"./chunk-674pexjx.js";import"./chunk-zjyaze0d.js";import"./chunk-xdcwx384.js";import"./chunk-rd08wx37.js";import"./chunk-fp2xgnjn.js";import{Pj as n,Sk as r,wj as A}from"./chunk-y1v7mf1a.js";import"./chunk-358wdvj7.js";import{Ll as T}from"./chunk-dn0437c1.js";import"./chunk-47jkx37s.js";import"./chunk-31a47ptm.js";import"./chunk-jwv6fda1.js";import"./chunk-hx13a8es.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-qrztx1b4.js";import"./chunk-j1bv93m4.js";import{Yo as o,cp as a,rp as s}from"./chunk-pp10epga.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-m6967jtv.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-3cs1qf8x.js";import"./chunk-4xqwt6dr.js";import"./chunk-g77kddrs.js";import"./chunk-9znfb8f2.js";import"./chunk-6kch0q2d.js";import"./chunk-6cztstry.js";import{Is as i}from"./chunk-1mfdmm2t.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import"./chunk-fdmz0502.js";import{dt as d}from"./chunk-1a08ffyd.js";import{Bt as f,Ct as c,Dt as u,Ft as l}from"./chunk-8jkqyf9n.js";import{Jt as L}from"./chunk-6yshpz0z.js";import{St as P}from"./chunk-5dvy83ms.js";import{eu as E,gu as y}from"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import{gI as N}from"./chunk-9kc2th5c.js";import"./chunk-hf39qx6t.js";import"./chunk-x0de4z05.js";import{yP as k}from"./chunk-sh03ka27.js";import D from"path";import{fileURLToPath as MB}from"url";import{writeHeapSnapshot as GB}from"v8";import QB,{EOL as M}from"os";var WB={free:"free",adaptive:"adaptive",fast:"fast",economical:"economical",maxInt:"max-int",orchestrated:"orchestrated"},m=ZB;function R(B){if(B.agent)return B.agent;return m}function bB(B,J){if(D.isAbsolute(B)||B.includes("/")||B.includes("\\")||B.startsWith(".")||B.startsWith("~"))return{error:"Directory not found: "+J};return{error:`Unknown command "${B}"`,hint:"Run `qitqode --help` to see the available commands, or pass an existing directory to start the TUI there."}}function jB(B){for(let[J,Z]of Object.entries(WB))if(B[J]){let X=d[Z];if(X)return`${X.providerID}/${X.modelID}`}return}function FB(B){return async(Z,X)=>{let G=new Request(Z,X),Y=G.body?await G.text():void 0,H=await B.call("fetch",{url:G.url,method:G.method,headers:Object.fromEntries(G.headers.entries()),body:Y});return new Response(H.body,{status:H.status,headers:H.headers})}}function _B(B){return{subscribe:async(J)=>{return B.on("global.event",(Z)=>{J(Z)})}}}async function qB(){if(typeof globalThis.QITQODE_WORKER_PATH<"u")return globalThis.QITQODE_WORKER_PATH;let B=new URL("./cli/cmd/tui/worker.js",import.meta.url);if(await E(MB(B)))return B;return new URL("./worker.ts",import.meta.url)}async function yB(B){let J=process.stdin.isTTY?void 0:await Bun.stdin.text();if(!B)return J;if(!J)return B;return J+`
|
|
3
|
-
`+B}async function v(B){let J=o({baseUrl:B.url,fetch:B.fetch,directory:B.directory}),Z=[{permission:"question",action:"deny",pattern:"*"},{permission:"plan_enter",action:"deny",pattern:"*"},{permission:"plan_exit",action:"deny",pattern:"*"}],X=await XB(J.session,B)??(await J.session.create({permission:Z})).data?.id;if(!X){z.error("headless: failed to create session");return}let G=await J.event.subscribe(),Y=YB({sessionID:X,query:async()=>{return(await J.session.status()).data?.[X]}}),H=G.stream[Symbol.asyncIterator](),U=Y.completion.then(()=>"DONE");(async()=>{try{while(!0){let Q=await Promise.race([H.next(),U]);if(Q==="DONE")break;let K=Q;if(K.done)break;let b=K.value;Y.onEvent(b);let W=b.properties;if(b.type==="message.part.updated"){let $=W?.part;if(!$||$.sessionID!==X)continue;if($.type==="text"&&$.time?.end){let V=String($.text??"").trim();if(V)process.stdout.write(V+M)}}if(b.type==="permission.asked"){if(!W||W.sessionID!==X)continue;await J.permission.reply({requestID:String(W.id),reply:"once"})}if(b.type==="session.error"){if(!W||W.sessionID!==X||!W.error)continue;let $=W.error,V=$?.data!==null&&typeof $?.data==="object"&&"message"in $.data?String($.data.message):String($?.name??$);z.error(V)}}}finally{Y.stop(),await H.return?.(void 0).catch(()=>{})}})().catch((Q)=>{console.error(Q),process.exit(1)});let h=B.model?r.parseModel(B.model):void 0;await J.session.prompt({sessionID:X,agent:B.agent,model:h,parts:[{type:"text",text:B.prompt}]}),Y.markStarted(),await Y.completion}var sB=e({command:"$0 [project]",describe:"start qitqode tui",builder:(B)=>p(B).positional("project",{type:"string",describe:"path to start qitqode in"}).options(g).option("never-ask",{type:"boolean",describe:"start in never-ask mode \u2014 auto-decide without asking (permissions excluded), toggle at runtime with /never-ask",default:!1}).check((J)=>{if(J.dark&&J.light)throw Error("--dark and --light are mutually exclusive");if(J.sso&&!J.headless)throw Error("--sso requires --headless");if(J.sso&&J["api-key"]!==void 0)throw Error("--sso and --api-key are mutually exclusive");let Z=Object.keys(WB).filter((X)=>J[X]);if(Z.length>1)throw Error(`${Z.map((X)=>`--${X}`).join(" and ")} are mutually exclusive \u2014 choose one tier flag`);if(Z.length===1&&J.model)throw Error(`--${Z[0]} and --model are mutually exclusive \u2014 use one or the other`);return!0}),handler:async(B)=>{if(B.monochrome)process.env.QITQODE_TUI_ACCESSIBLE="1",process.env.NO_COLOR="1";let J=JB();try{BB();let Z=VB(B);if(Z){z.error(Z),process.exitCode=1;return}let X=jB(B)??B.model,G=y(process.env.PWD??process.cwd()),Y=B.project?y(D.isAbsolute(B.project)?B.project:D.join(G,B.project)):y(process.cwd());if(B.project&&!await E(Y)){let V=bB(B.project,Y);if(z.error(V.error),V.hint)z.println(V.hint);process.exitCode=1;return}let H=T(Y);if(H){if(B.project){z.error("Cannot start in "+Y+": "+H),process.exitCode=1;return}let V=y(QB.homedir());if(T(V)){z.error("Cannot start in "+Y+": "+H),process.exitCode=1;return}P.warn("unsafe start directory, falling back to home",{requested:Y,home:V}),Y=V}let U=await qB();try{process.chdir(Y)}catch{z.error("Failed to change directory to "+Y);return}let C=y(process.cwd()),h=l({[c]:"worker",[f]:u()}),Q=new Worker(U,{env:h});Q.onerror=(V)=>{P.error("thread error",{message:V.message,filename:V.filename,lineno:V.lineno,colno:V.colno,error:V.error})};let K=i(Q),b=()=>{K.call("reload",void 0).catch((V)=>{P.warn("worker reload failed",{error:L(V)})})};process.on("SIGUSR2",b);let W=!1,$=async()=>{if(W)return;W=!0,process.off("SIGUSR2",b),await n(K.call("shutdown",void 0),5000).catch((V)=>{P.warn("worker shutdown failed",{error:L(V)})}),Q.terminate()};try{let V=import("./chunk-2g4kxtz0.js"),HB=import("./chunk-vnstr4g1.js").then(({TuiConfig:q})=>q.get()),S=await yB(B.prompt),KB=await HB;if(B.headless&&w(O(B))){z.error("--headless cannot be combined with network-listener flags (--port, --hostname, --mdns)"),process.exitCode=1;return}let I=O(B),_=w(I)?{url:(await K.call("server",I)).url,fetch:void 0,events:void 0}:{url:"http://qitqode.internal",fetch:FB(K),events:_B(K)};if(setTimeout(()=>{K.call("checkUpgrade",{directory:C}).catch(()=>{})},1000).unref?.(),B.headless){if(!S){z.error("--headless requires a prompt: pass --prompt or pipe input via stdin"),process.exitCode=1;return}if(B.sso){try{let j=await t({tryOpen:!1,onCode:(F)=>{if(process.stdout.write(M),process.stdout.write(" To sign in, open: "+F.verificationUri+M),process.stdout.write(" and enter code: "+F.userCode+M),F.verificationUriComplete)process.stdout.write(M+" Or open this link directly:"+M+" "+F.verificationUriComplete+M);process.stdout.write(M+" Waiting for approval... (ctrl+c to cancel)"+M)}});await x.runPromise(N.gen(function*(){yield*(yield*A.Service).set("forgewise",s(j,{rotateRefreshToken:!0}))})),process.stdout.write(" Signed in as "+(j.name||j.email)+M)}catch(j){z.error("SSO sign-in failed: "+L(j)),process.exitCode=1;return}await v({url:_.url,fetch:_.fetch,prompt:S,model:X,agent:R(B)??m,directory:C,continue:B.continue,sessionID:B.session,fork:B.fork});return}let q=$B(typeof B["api-key"]==="string"?String(B["api-key"]):"");if(q)await x.runPromise(zB(q));else if(!await x.runPromise(N.gen(function*(){if(yield*N.promise(()=>a()))return!0;return!!(yield*(yield*A.Service).get("forgewise"))}))){z.error(`Not signed in. Use one of:
|
|
4
|
-
qitqode auth login (browser / device-code flow)
|
|
5
|
-
qitqode auth login --api-key (paste a Qortex API key)
|
|
6
|
-
--api-key <key> (inline for this run)
|
|
7
|
-
$QLEX_API_KEY (environment variable)
|
|
8
|
-
$QITQODE_KEY (environment variable)`),process.exitCode=1;return}await v({url:_.url,fetch:_.fetch,prompt:S,model:X,agent:R(B)??m,directory:C,continue:B.continue,sessionID:B.session,fork:B.fork})}else{let{tui:q}=await V;await q({url:_.url,async onSnapshot(){let j=GB("tui.heapsnapshot"),F=await K.call("snapshot",void 0);return[j,F]},config:KB,directory:C,fetch:_.fetch,events:_.events,args:{continue:B.continue,sessionID:B.session,agent:R(B),model:X,prompt:S,fork:B.fork,neverAsk:B["never-ask"]||B.fullauto||!1,fullauto:B.fullauto||!1,themeMode:B.dark?"dark":B.light?"light":void 0,monochrome:B.monochrome||!1,headless:!1}})}}finally{await $()}}finally{J?.()}}});export{R as resolveStartupAgent,bB as missingProjectReport,sB as TuiThreadCommand};
|
package/bundle/chunk-jvx7jtm4.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{jg as E}from"./chunk-g738e799.js";import"./chunk-583d91xq.js";import"./chunk-e8s4mp5n.js";import"./chunk-9gxyt2ay.js";import"./chunk-5qhsfjzq.js";import"./chunk-nfg7nt13.js";import"./chunk-4s1n38ds.js";import"./chunk-2w79k0mh.js";import"./chunk-fd04358e.js";import"./chunk-qn1fhqyw.js";import"./chunk-674pexjx.js";import"./chunk-zjyaze0d.js";import"./chunk-xdcwx384.js";import"./chunk-rd08wx37.js";import"./chunk-fp2xgnjn.js";import"./chunk-y1v7mf1a.js";import"./chunk-358wdvj7.js";import"./chunk-dn0437c1.js";import"./chunk-47jkx37s.js";import"./chunk-31a47ptm.js";import"./chunk-jwv6fda1.js";import"./chunk-hx13a8es.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-qrztx1b4.js";import"./chunk-j1bv93m4.js";import"./chunk-pp10epga.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-m6967jtv.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-3cs1qf8x.js";import"./chunk-4xqwt6dr.js";import"./chunk-g77kddrs.js";import"./chunk-9znfb8f2.js";import"./chunk-6kch0q2d.js";import"./chunk-6cztstry.js";import"./chunk-1mfdmm2t.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import"./chunk-fdmz0502.js";import"./chunk-1a08ffyd.js";import"./chunk-8jkqyf9n.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-hf39qx6t.js";import"./chunk-x0de4z05.js";import{yP as z}from"./chunk-sh03ka27.js";var J={command:"generate",handler:async()=>{let A=await E.openapi();for(let q of Object.values(A.paths))for(let y of["get","post","put","delete","patch"]){let k=q[y];if(!k?.operationId)continue;k["x-codeSamples"]=[{lang:"js",source:['import { createQitQodeClient } from "@qitqode/sdk"',"","const client = createQitQodeClient()",`await client.${k.operationId}({`," ...","})"].join(`
|
|
3
|
-
`)}]}let F=JSON.stringify(A,null,2),B=await import("./chunk-dmb0ez0m.js"),C=await import("./chunk-6pt6nqwk.js"),D=await import("./chunk-gfvq78gy.js"),G=await(B.format??B.default?.format)(F,{parser:"json",plugins:[C.default??C,D.default??D],printWidth:120});await new Promise((q,y)=>{process.stdout.write(G,(k)=>{if(k)y(k);else q()})})}};export{J as GenerateCommand};
|
package/bundle/chunk-k6gdmqff.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Bg as i,Cg as j,Dg as k,Eg as l,Fg as m,Gg as n}from"./chunk-9gxyt2ay.js";import"./chunk-qn1fhqyw.js";import{ep as a,fp as b,gp as c,hp as d,ip as e,jp as f,np as g,op as h}from"./chunk-pp10epga.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-1mfdmm2t.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-1a08ffyd.js";import"./chunk-8jkqyf9n.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-sh03ka27.js";export{f as resolveDevicePoll,h as refreshAccessToken,g as probeToken,l as loginDevice,n as loginBrowser,m as login,b as isReplitEnv,j as isNearExpiry,c as getConfig,i as getCallbackUri,k as fetchQreditsBalance,a as checkoutApiKey,d as ForgewiseError,e as DeviceFlowUnsupportedError};
|
package/bundle/chunk-kzkb4648.js
DELETED
package/bundle/chunk-m2540waa.js
DELETED
package/bundle/chunk-mscvm1rm.js
DELETED
package/bundle/chunk-mw3hh526.js
DELETED
package/bundle/chunk-n3nsrk5n.js
DELETED
package/bundle/chunk-n9nmc4q4.js
DELETED
package/bundle/chunk-nj4as8vy.js
DELETED
package/bundle/chunk-nrzca9yd.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{dg as a,eg as b}from"./chunk-5rvvfgfy.js";import"./chunk-1mfdmm2t.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-8jkqyf9n.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-sh03ka27.js";export{a as start,b as Heap};
|
package/bundle/chunk-nxm6gpyv.js
DELETED