@qitqode/qitqode-android-arm64 0.1.30 → 0.1.31
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/bundle/{chunk-37n34pzd.js → chunk-01my2y0c.js} +1 -1
- package/bundle/chunk-04n2ycg5.js +800 -0
- package/bundle/{chunk-6qy1ghrx.js → chunk-05mce0j3.js} +1 -1
- package/bundle/{chunk-g1dwbvkg.js → chunk-0bbs01f0.js} +1 -1
- package/bundle/{chunk-j6emx6jn.js → chunk-0dt0bxz6.js} +2 -2
- package/bundle/{chunk-mskwkcgj.js → chunk-0mx2psfc.js} +1 -1
- package/bundle/chunk-0p27fvfr.js +2 -0
- package/bundle/chunk-0qs1vx97.js +2 -0
- package/bundle/{chunk-f45tp3e3.js → chunk-0v0vqbn5.js} +1 -1
- package/bundle/chunk-0w0ctb90.js +2 -0
- package/bundle/{chunk-8qkhddq3.js → chunk-0yt5njh7.js} +2 -2
- package/bundle/{chunk-be216spx.js → chunk-10bjs581.js} +2 -2
- package/bundle/{chunk-bpbptx89.js → chunk-11x3t2tt.js} +1 -1
- package/bundle/{chunk-bss414qz.js → chunk-12vef2pr.js} +1 -1
- package/bundle/{chunk-jm1ptn8n.js → chunk-15hw2z9t.js} +1 -1
- package/bundle/chunk-1f7ajq8s.js +2 -0
- package/bundle/chunk-1fswr17z.js +2 -0
- package/bundle/{chunk-srh4xvsj.js → chunk-1gx18dm5.js} +1 -1
- package/bundle/chunk-1rhhhm88.js +2 -0
- package/bundle/{chunk-b0syck9r.js → chunk-1sgahe1s.js} +1 -1
- package/bundle/{chunk-26nfphsg.js → chunk-1vb79bw1.js} +1 -1
- package/bundle/chunk-1wbjh23g.js +2 -0
- package/bundle/chunk-20f83ca0.js +2 -0
- package/bundle/{chunk-371r2111.js → chunk-24jg9d61.js} +1 -1
- package/bundle/{chunk-1sgby720.js → chunk-2hc5z7b5.js} +1 -1
- package/bundle/{chunk-yq3m8190.js → chunk-2maqde7w.js} +2 -2
- package/bundle/{chunk-b8tw709r.js → chunk-2vn41ecx.js} +1 -1
- package/bundle/{chunk-w87a3mzm.js → chunk-2zq4k837.js} +1 -1
- package/bundle/chunk-31mnd3ph.js +3 -0
- package/bundle/{chunk-1bhvt33f.js → chunk-31qrzrwy.js} +1 -1
- package/bundle/{chunk-d5bxan80.js → chunk-326p5b10.js} +2 -2
- package/bundle/{chunk-0df4kede.js → chunk-33e9y2aw.js} +1 -1
- package/bundle/{chunk-zcm2jdr5.js → chunk-35xk4g91.js} +1 -1
- package/bundle/{chunk-5fz8tph5.js → chunk-3632wgg1.js} +1 -1
- package/bundle/{chunk-1ngtxja9.js → chunk-3bxg5bta.js} +1 -1
- package/bundle/{chunk-mgk9sh16.js → chunk-3c6p8tm3.js} +1 -1
- package/bundle/chunk-3h9rq2wq.js +2 -0
- package/bundle/{chunk-fqw4y7x0.js → chunk-3ytjm3az.js} +2 -2
- package/bundle/{chunk-2jmxt3fb.js → chunk-40efytmk.js} +1 -1
- package/bundle/chunk-42p59wm4.js +2 -0
- package/bundle/{chunk-wfs4pcwa.js → chunk-44a82dg0.js} +4 -4
- package/bundle/chunk-4512pvca.js +2 -0
- package/bundle/chunk-456bmaww.js +2 -0
- package/bundle/{chunk-c5e6sk9c.js → chunk-48ge2ryx.js} +1 -1
- package/bundle/chunk-48pajrnt.js +2 -0
- package/bundle/{chunk-12bssxd4.js → chunk-4cnwn1rh.js} +2 -2
- package/bundle/chunk-4d87mhwn.js +3 -0
- package/bundle/chunk-4fy9c54h.js +2 -0
- package/bundle/{chunk-hwbyqezq.js → chunk-4gkk28xk.js} +2 -2
- package/bundle/{chunk-4tbwha3m.js → chunk-4jtxtkj7.js} +2 -2
- package/bundle/{chunk-b3rpzkcb.js → chunk-50sv6y2e.js} +1 -1
- package/bundle/chunk-50tb3g5x.js +2 -0
- package/bundle/chunk-52bam8g7.js +2 -0
- package/bundle/{chunk-6fp8a9ek.js → chunk-53bqcctj.js} +1 -1
- package/bundle/chunk-53w4zqps.js +2 -0
- package/bundle/chunk-59y8q9m5.js +2 -0
- package/bundle/chunk-5eq1fft9.js +3 -0
- package/bundle/{chunk-a1pw9r6f.js → chunk-5hw6xa49.js} +2 -2
- package/bundle/{chunk-qrey2gwb.js → chunk-5q4harvc.js} +2 -2
- package/bundle/chunk-5tray1fw.js +3 -0
- package/bundle/{chunk-svvgv1s0.js → chunk-5v0xjs3x.js} +1 -1
- package/bundle/{chunk-my6sz5d6.js → chunk-60v5jvgt.js} +1 -1
- package/bundle/chunk-64ezpbwt.js +2 -0
- package/bundle/{chunk-2y90ad1v.js → chunk-68yw2hk9.js} +1 -1
- package/bundle/{chunk-5fgx6fa4.js → chunk-69nzndk7.js} +1 -1
- package/bundle/chunk-6bpe215q.js +2 -0
- package/bundle/chunk-6bphjajd.js +2 -0
- package/bundle/{chunk-chmrvbbj.js → chunk-6d5rrre9.js} +1 -1
- package/bundle/{chunk-g3dhsmbt.js → chunk-6hpgb8h4.js} +3 -3
- package/bundle/{chunk-drs1gv2b.js → chunk-6kp07m7p.js} +1 -1
- package/bundle/{chunk-wy46mbwt.js → chunk-6phh70sp.js} +1 -1
- package/bundle/chunk-6t1ehq36.js +2 -0
- package/bundle/{chunk-v2zp22r3.js → chunk-70ck4v3t.js} +1 -1
- package/bundle/{chunk-2tnarng3.js → chunk-71sjjjr8.js} +1 -1
- package/bundle/{chunk-ds69qc8b.js → chunk-71xz70r9.js} +1 -1
- package/bundle/{chunk-2dzk5txw.js → chunk-73e409hd.js} +1 -1
- package/bundle/{chunk-g7rjtehn.js → chunk-78ymd20x.js} +1 -1
- package/bundle/{chunk-szr0f7k2.js → chunk-7avcnwv8.js} +1 -1
- package/bundle/{chunk-z8v2tsz2.js → chunk-7hm0c2yg.js} +1 -1
- package/bundle/chunk-7mke41x0.js +2 -0
- package/bundle/chunk-7pfj4x1a.js +2 -0
- package/bundle/chunk-7ry9cvby.js +2 -0
- package/bundle/chunk-7wczs9mx.js +2 -0
- package/bundle/{chunk-aztre27e.js → chunk-7xm75w1e.js} +1 -1
- package/bundle/{chunk-s3yna2wm.js → chunk-7z5jh4ra.js} +1 -1
- package/bundle/{chunk-vj62pc0h.js → chunk-81qwdg5s.js} +1 -1
- package/bundle/{chunk-mrw279k3.js → chunk-83gqkmth.js} +1 -1
- package/bundle/chunk-873skv7w.js +2 -0
- package/bundle/{chunk-6hv59ere.js → chunk-8hytwgwf.js} +1 -1
- package/bundle/{chunk-wz0zcddf.js → chunk-8n20thvd.js} +2 -2
- package/bundle/{chunk-s07j8hfy.js → chunk-8qswepp2.js} +1 -1
- package/bundle/chunk-8v96pmqn.js +2 -0
- package/bundle/chunk-8y2scz6z.js +2 -0
- package/bundle/{chunk-wpajh5s5.js → chunk-8ymffyep.js} +1 -1
- package/bundle/chunk-8zx7vnx6.js +2 -0
- package/bundle/{chunk-qhc90p4a.js → chunk-93p131d5.js} +1 -1
- package/bundle/chunk-94a76f8w.js +2 -0
- package/bundle/{chunk-ppfjf7qx.js → chunk-9emq67vc.js} +1 -1
- package/bundle/{chunk-bvkq0a5q.js → chunk-9f1z9xce.js} +1 -1
- package/bundle/chunk-9mjz6e27.js +2 -0
- package/bundle/chunk-9ng7jjp7.js +2 -0
- package/bundle/chunk-9tpgnjy8.js +2 -0
- package/bundle/{chunk-0fmbz83g.js → chunk-9x5232dw.js} +1 -1
- package/bundle/{chunk-mk6cddvd.js → chunk-a1wdeapb.js} +1 -1
- package/bundle/{chunk-qjn86fc0.js → chunk-a7amey9s.js} +1 -1
- package/bundle/chunk-a7ym9f0v.js +2 -0
- package/bundle/chunk-a8f2xvy3.js +2 -0
- package/bundle/chunk-a99cvwta.js +2 -0
- package/bundle/chunk-abd1cfpg.js +2 -0
- package/bundle/{chunk-89v6dgpp.js → chunk-ag8kz1e7.js} +2 -2
- package/bundle/chunk-anwnwfjf.js +2 -0
- package/bundle/chunk-avys5mnz.js +2 -0
- package/bundle/chunk-axvjd10y.js +2 -0
- package/bundle/{chunk-m612agnk.js → chunk-ay8emwym.js} +1 -1
- package/bundle/chunk-b4pphqab.js +2 -0
- package/bundle/chunk-b6087ak4.js +2 -0
- package/bundle/{chunk-msegx0t7.js → chunk-b8gjz6bk.js} +1 -1
- package/bundle/chunk-bgw4fvg2.js +2 -0
- package/bundle/{chunk-gf0pdgjs.js → chunk-bh53dz71.js} +1 -1
- package/bundle/chunk-bn0h9dny.js +10 -0
- package/bundle/chunk-brkqxbjy.js +2 -0
- package/bundle/{chunk-09kba1hg.js → chunk-c11d28qn.js} +2 -2
- package/bundle/{chunk-ejjea8hh.js → chunk-c14s0kxq.js} +1 -1
- package/bundle/{chunk-sn4nez18.js → chunk-c1bdzxbx.js} +2 -2
- package/bundle/{chunk-ezja6njs.js → chunk-c1vnp55z.js} +1 -1
- package/bundle/chunk-c26qxt5g.js +2 -0
- package/bundle/chunk-c6zscb38.js +2 -0
- package/bundle/{chunk-pekm54ce.js → chunk-cfgvm15x.js} +1 -1
- package/bundle/{chunk-v4xcysh0.js → chunk-chpr8ekb.js} +1 -1
- package/bundle/chunk-cjww2jmv.js +3 -0
- package/bundle/{chunk-m67tcnk4.js → chunk-ck2gfaba.js} +1 -1
- package/bundle/chunk-cmbh77cs.js +7 -0
- package/bundle/{chunk-k8ss3135.js → chunk-cnmq5xtq.js} +218 -218
- package/bundle/{chunk-9j1qqdr2.js → chunk-cphrgyp6.js} +1 -1
- package/bundle/chunk-csz0dgyp.js +2 -0
- package/bundle/{chunk-eb9mytjq.js → chunk-ctaze2hn.js} +1 -1
- package/bundle/{chunk-5qam3c8r.js → chunk-cxnfy6qk.js} +1 -1
- package/bundle/{chunk-cafzcmrg.js → chunk-d07p6fpk.js} +2 -2
- package/bundle/{chunk-whcg14sc.js → chunk-d65qs4d0.js} +1 -1
- package/bundle/{chunk-dcvatax2.js → chunk-d68fzyw7.js} +2 -2
- package/bundle/{chunk-4qqkqrn9.js → chunk-d6ry9418.js} +2 -2
- package/bundle/{chunk-ztc3gm8y.js → chunk-dactgryw.js} +1 -1
- package/bundle/chunk-dafmkrhn.js +2 -0
- package/bundle/{chunk-dfnv7vkn.js → chunk-db405hjg.js} +1 -1
- package/bundle/chunk-dgprdym0.js +2 -0
- package/bundle/{chunk-7yrhe3xq.js → chunk-dnwefyhv.js} +1 -1
- package/bundle/{chunk-n26yf3he.js → chunk-drvkj3xg.js} +1 -1
- package/bundle/chunk-dryzt12j.js +2 -0
- package/bundle/chunk-dsamees2.js +2 -0
- package/bundle/{chunk-xpc2zgj7.js → chunk-dxpj0cxh.js} +2 -2
- package/bundle/{chunk-yjtdgcq5.js → chunk-dynv30gm.js} +1 -1
- package/bundle/chunk-dyqpxx3b.js +2 -0
- package/bundle/{chunk-2rs39vj2.js → chunk-e01wnqvc.js} +1 -1
- package/bundle/{chunk-2vepzgek.js → chunk-e10py6yr.js} +1 -1
- package/bundle/{chunk-qv2s39dv.js → chunk-e7ny0b3x.js} +1 -1
- package/bundle/{chunk-fjgyrsbw.js → chunk-eh7e49k4.js} +1 -1
- package/bundle/{chunk-42f7p0hq.js → chunk-ehhas0ew.js} +2 -2
- package/bundle/{chunk-n8h6x2en.js → chunk-ejrhvy38.js} +1 -1
- package/bundle/{chunk-dq9kpj4a.js → chunk-enpzvmtc.js} +1 -1
- package/bundle/chunk-excnptfy.js +2 -0
- package/bundle/chunk-ez8vkgfz.js +2 -0
- package/bundle/chunk-f2btnww9.js +2 -0
- package/bundle/chunk-f8eter69.js +5 -0
- package/bundle/{chunk-2km50rd3.js → chunk-fgg9txzb.js} +1 -1
- package/bundle/chunk-fjq3a347.js +2 -0
- package/bundle/{chunk-b9za12y1.js → chunk-fn9h4ync.js} +1 -1
- package/bundle/{chunk-ddnpx1yx.js → chunk-fq0x3esz.js} +5 -5
- package/bundle/{chunk-ngchsw2g.js → chunk-fvzwbjh8.js} +1 -1
- package/bundle/chunk-fxdtq2ed.js +2 -0
- package/bundle/{chunk-07g7cybt.js → chunk-fyqjm5fv.js} +1 -1
- package/bundle/{chunk-nzehfpxp.js → chunk-g10d6x57.js} +1 -1
- package/bundle/{chunk-zyhdxggp.js → chunk-g5rabwre.js} +2 -2
- package/bundle/{chunk-kfsb2stm.js → chunk-g7ccdh7r.js} +1 -1
- package/bundle/{chunk-3g1yz39h.js → chunk-g9cjsfvg.js} +1 -1
- package/bundle/{chunk-phxrg7aw.js → chunk-gagtmjmp.js} +2 -2
- package/bundle/{chunk-yp0a8q29.js → chunk-gb00fh4z.js} +3 -3
- package/bundle/{chunk-hw1dmx28.js → chunk-gbpvs0fx.js} +1 -1
- package/bundle/{chunk-zv6pjtz1.js → chunk-gbrnn2dk.js} +1 -1
- package/bundle/chunk-gcw4rn10.js +2 -0
- package/bundle/{chunk-j8efst22.js → chunk-gj0wt0cy.js} +1 -1
- package/bundle/{chunk-2q96x1t5.js → chunk-gsar6xda.js} +1 -1
- package/bundle/{chunk-xs3xtz6x.js → chunk-gt31468k.js} +1 -1
- package/bundle/{chunk-ecn8gbtz.js → chunk-gwp17r03.js} +1 -1
- package/bundle/chunk-gwzw92jt.js +2 -0
- package/bundle/{chunk-2bn4b42t.js → chunk-h2afsbm1.js} +1 -1
- package/bundle/{chunk-tj78jsp9.js → chunk-h4j5xzc8.js} +1 -1
- package/bundle/{chunk-b3dqcbsc.js → chunk-hbbsbyyq.js} +1 -1
- package/bundle/chunk-hnctaq8s.js +3 -0
- package/bundle/{chunk-vn7nkrqb.js → chunk-hnzegjgv.js} +1 -1
- package/bundle/chunk-hp7tssgv.js +2 -0
- package/bundle/chunk-ht0hbdmx.js +2 -0
- package/bundle/{chunk-j9pcnkkq.js → chunk-ht5w06x7.js} +2 -2
- package/bundle/{chunk-a1p2f16h.js → chunk-htz93dsd.js} +2 -2
- package/bundle/{chunk-q6ztpfcs.js → chunk-jbx3s7nw.js} +2 -2
- package/bundle/chunk-jcjbr3q7.js +2 -0
- package/bundle/{chunk-h9pvnp5c.js → chunk-jef04wyf.js} +1 -1
- package/bundle/{chunk-ct48575c.js → chunk-jh0bw59r.js} +1 -1
- package/bundle/{chunk-knpt9n8f.js → chunk-jrqb0jwy.js} +1 -1
- package/bundle/{chunk-1dwcga8g.js → chunk-js1n8tgv.js} +1 -1
- package/bundle/chunk-jxswwvr3.js +2 -0
- package/bundle/{chunk-1rp1cvmc.js → chunk-kf167jw7.js} +1 -1
- package/bundle/{chunk-wsy0m70r.js → chunk-kfxv5rfg.js} +1 -1
- package/bundle/{chunk-btz9jvec.js → chunk-kj20f048.js} +1 -1
- package/bundle/{chunk-j5kb0y1m.js → chunk-kq6b222y.js} +1 -1
- package/bundle/{chunk-1t9jne14.js → chunk-ktzq4ha1.js} +1 -1
- package/bundle/chunk-m5m448mg.js +3 -0
- package/bundle/chunk-mcg24gkb.js +5 -0
- package/bundle/chunk-mh0j6dzy.js +2 -0
- package/bundle/{chunk-1qshjfzm.js → chunk-mk1bfzg5.js} +1 -1
- package/bundle/chunk-mxzceza9.js +2 -0
- package/bundle/{chunk-t12xrrfr.js → chunk-mzs2pjyc.js} +2 -2
- package/bundle/chunk-n0dy98h2.js +2 -0
- package/bundle/{chunk-m02zt1a3.js → chunk-n9xns8by.js} +2 -2
- package/bundle/chunk-ngm6pqyt.js +2 -0
- package/bundle/chunk-ngtavamt.js +2 -0
- package/bundle/chunk-nkhc32s3.js +2 -0
- package/bundle/chunk-npse2xrd.js +2 -0
- package/bundle/{chunk-4p5e5tsz.js → chunk-nsk8dkwp.js} +1 -1
- package/bundle/{chunk-k7gq9bra.js → chunk-nv3eyyaj.js} +1 -1
- package/bundle/{chunk-ab6cabxh.js → chunk-p18axz0m.js} +1 -1
- package/bundle/{chunk-jje0srjq.js → chunk-p62gb4wj.js} +1 -1
- package/bundle/chunk-p6e4vqy7.js +2 -0
- package/bundle/{chunk-m1h5a4vg.js → chunk-p9qfbr02.js} +1 -1
- package/bundle/{chunk-yn6sbycg.js → chunk-pctt1qv8.js} +2 -2
- package/bundle/{chunk-ggqst87g.js → chunk-pe29yy6s.js} +1 -1
- package/bundle/chunk-pf9g671w.js +2 -0
- package/bundle/chunk-phv9kdq6.js +3 -0
- package/bundle/{chunk-3n1324bt.js → chunk-pp2eqkse.js} +1 -1
- package/bundle/{chunk-x067eetw.js → chunk-pp6vhqrr.js} +1 -1
- package/bundle/chunk-ppjnqexm.js +2 -0
- package/bundle/chunk-pqkjhn8h.js +2 -0
- package/bundle/{chunk-hxz2rdjq.js → chunk-pxvk3syj.js} +1 -1
- package/bundle/{chunk-b8bytvka.js → chunk-qbc36nbb.js} +2 -2
- package/bundle/{chunk-89q1y7tc.js → chunk-qc8rsn4v.js} +1 -1
- package/bundle/chunk-qd8w2gkd.js +2 -0
- package/bundle/{chunk-q1v2pytx.js → chunk-qrsveve6.js} +1 -1
- package/bundle/chunk-qvnb3j71.js +3 -0
- package/bundle/{chunk-2gerf08b.js → chunk-r4ndwym0.js} +2 -2
- package/bundle/chunk-r78czx4d.js +8 -0
- package/bundle/{chunk-7ppd2phw.js → chunk-rbk8seme.js} +1 -1
- package/bundle/{chunk-gj3hzx3d.js → chunk-redjxn13.js} +2 -2
- package/bundle/chunk-rf12t4n5.js +2 -0
- package/bundle/{chunk-04tw0r4s.js → chunk-rg0mrprz.js} +1 -1
- package/bundle/{chunk-cdhmc0t0.js → chunk-rjd8gbs5.js} +1 -1
- package/bundle/chunk-rpgne7xh.js +2 -0
- package/bundle/chunk-rvgj1vky.js +2 -0
- package/bundle/{chunk-c01z3cvg.js → chunk-rvkrgkeq.js} +1 -1
- package/bundle/{chunk-2ahqhh4z.js → chunk-rzhdkkpz.js} +1 -1
- package/bundle/{chunk-5v4py9p2.js → chunk-s9ntkjz3.js} +1 -1
- package/bundle/{chunk-kqn9h2gk.js → chunk-skqbaadf.js} +1 -1
- package/bundle/chunk-ss2jvqrg.js +2 -0
- package/bundle/{chunk-ydp0q1hk.js → chunk-ss2ms1r3.js} +1 -1
- package/bundle/chunk-ssajqv72.js +2 -0
- package/bundle/{chunk-1fbeendk.js → chunk-t56r99hp.js} +1 -1
- package/bundle/{chunk-xc5044tm.js → chunk-t8m74g39.js} +1 -1
- package/bundle/{chunk-s6bar2f9.js → chunk-t9mz17gb.js} +2 -2
- package/bundle/chunk-takew94z.js +9 -0
- package/bundle/{chunk-cvdxgsq1.js → chunk-tq0239xp.js} +1 -1
- package/bundle/{chunk-whxjkz9a.js → chunk-tqj69nh6.js} +2 -2
- package/bundle/{chunk-hj5y7fvk.js → chunk-tt30dybd.js} +1 -1
- package/bundle/{chunk-5a5t01ka.js → chunk-tvdmnee6.js} +1 -1
- package/bundle/chunk-tvwwq4b3.js +2 -0
- package/bundle/{chunk-dhjp0zx2.js → chunk-v1xjc3s8.js} +1 -1
- package/bundle/chunk-v2n26eg4.js +2 -0
- package/bundle/chunk-vb286b31.js +2 -0
- package/bundle/chunk-vbeb74ny.js +11 -0
- package/bundle/chunk-vcw00k0n.js +3 -0
- package/bundle/{chunk-7jbz3dgt.js → chunk-vhe0tth1.js} +1 -1
- package/bundle/{chunk-yfkvjphe.js → chunk-vvxmwyrw.js} +1 -1
- package/bundle/{chunk-p68rwmhc.js → chunk-vxyy2dp3.js} +2 -2
- package/bundle/{chunk-y2v09y71.js → chunk-vywnd5sf.js} +1 -1
- package/bundle/{chunk-0jgsp4c2.js → chunk-w18xs2h5.js} +1 -1
- package/bundle/{chunk-d6r4xwtg.js → chunk-wfb608qf.js} +3 -3
- package/bundle/chunk-x24y7qyd.js +2 -0
- package/bundle/{chunk-tr8sf0dk.js → chunk-x3y2xzhn.js} +1 -1
- package/bundle/{chunk-27yxgy03.js → chunk-x4sp99g6.js} +1 -1
- package/bundle/{chunk-3nwve06r.js → chunk-x562b0xk.js} +1 -1
- package/bundle/{chunk-61c62e5s.js → chunk-x7k5yeey.js} +1 -1
- package/bundle/{chunk-fkgv2hqd.js → chunk-x9rbv6p6.js} +1 -1
- package/bundle/{chunk-wnqwb6fd.js → chunk-xcmgkc57.js} +1 -1
- package/bundle/{chunk-gm85xefs.js → chunk-xm7wascx.js} +1 -1
- package/bundle/{chunk-6nbzdb0r.js → chunk-xthkjax9.js} +1 -1
- package/bundle/{chunk-scnz207s.js → chunk-xvwvd4kq.js} +2 -2
- package/bundle/{chunk-zb0me4kk.js → chunk-xzrb857v.js} +1 -1
- package/bundle/chunk-y2d0w09y.js +2 -0
- package/bundle/{chunk-3nyqh1d6.js → chunk-y3b4k38p.js} +1 -1
- package/bundle/{chunk-vg2fmyje.js → chunk-y9q0hb7b.js} +2 -2
- package/bundle/chunk-yb79f79m.js +2 -0
- package/bundle/{chunk-fnbpap62.js → chunk-yek0sk2q.js} +1 -1
- package/bundle/{chunk-3bmzjznz.js → chunk-yhbcbjfk.js} +1 -1
- package/bundle/{chunk-sermjas1.js → chunk-yjf3kyej.js} +1 -1
- package/bundle/chunk-yjnyzpmt.js +2 -0
- package/bundle/{chunk-0a0vat1h.js → chunk-yp5bypsp.js} +2 -2
- package/bundle/{chunk-h0rpmne5.js → chunk-yp8wyzzm.js} +1 -1
- package/bundle/chunk-yqbcnsa1.js +2 -0
- package/bundle/{chunk-4xh1qm90.js → chunk-yv0xrnn9.js} +1 -1
- package/bundle/chunk-z3mra3nm.js +2 -0
- package/bundle/{chunk-yy526n9c.js → chunk-z6pwkwdr.js} +1 -1
- package/bundle/{chunk-snm5q21k.js → chunk-zs8kqdsf.js} +2 -2
- package/bundle/{chunk-y062spw2.js → chunk-zscer8rc.js} +1 -1
- package/bundle/{chunk-qjjch1zt.js → chunk-zw815d68.js} +2 -2
- package/bundle/chunk-zy9w1vkc.js +2 -0
- 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-07ws99b1.js +0 -2
- package/bundle/chunk-09c4ngag.js +0 -2
- package/bundle/chunk-0ch32p4c.js +0 -3
- package/bundle/chunk-0jgst767.js +0 -2
- package/bundle/chunk-0psrr9vp.js +0 -2
- package/bundle/chunk-1j73cnvz.js +0 -2
- package/bundle/chunk-1yddn03z.js +0 -2
- package/bundle/chunk-27dgtm8r.js +0 -2
- package/bundle/chunk-2ec6ps8r.js +0 -5
- package/bundle/chunk-38g8yzw0.js +0 -2
- package/bundle/chunk-3bkd0ar3.js +0 -2
- package/bundle/chunk-3f4zht9e.js +0 -2
- package/bundle/chunk-3pxnp6jb.js +0 -2
- package/bundle/chunk-3szwfy7w.js +0 -3
- package/bundle/chunk-426dt7be.js +0 -2
- package/bundle/chunk-4amgp4yd.js +0 -3
- package/bundle/chunk-4pjm21a5.js +0 -2
- package/bundle/chunk-4sz3jbc5.js +0 -2
- package/bundle/chunk-58x5seqn.js +0 -2
- package/bundle/chunk-5xe6x2rt.js +0 -2
- package/bundle/chunk-618tmyx9.js +0 -2
- package/bundle/chunk-6d9wsjxm.js +0 -2
- package/bundle/chunk-730a2d1k.js +0 -2
- package/bundle/chunk-76wrw0cs.js +0 -2
- package/bundle/chunk-7bd0x9vf.js +0 -2
- package/bundle/chunk-7czkntef.js +0 -2
- package/bundle/chunk-7ex57nyh.js +0 -2
- package/bundle/chunk-7gpczxbh.js +0 -2
- package/bundle/chunk-7j0bgeh2.js +0 -2
- package/bundle/chunk-7py443fe.js +0 -2
- package/bundle/chunk-90q5sae0.js +0 -2
- package/bundle/chunk-9amwe0ed.js +0 -2
- package/bundle/chunk-9grvepmd.js +0 -2
- package/bundle/chunk-9hrh15p2.js +0 -2
- package/bundle/chunk-a0v55ywn.js +0 -8
- package/bundle/chunk-a2qz9m10.js +0 -2
- package/bundle/chunk-av6ezvxm.js +0 -2
- package/bundle/chunk-beksar7w.js +0 -2
- package/bundle/chunk-bg66rqrx.js +0 -2
- package/bundle/chunk-bn15mzd7.js +0 -2
- package/bundle/chunk-bt6yw07v.js +0 -2
- package/bundle/chunk-cy9s1ma5.js +0 -2
- package/bundle/chunk-d0nkvp57.js +0 -2
- package/bundle/chunk-dvk2wwjj.js +0 -2
- package/bundle/chunk-dxe29jj6.js +0 -2
- package/bundle/chunk-e0jy9qxd.js +0 -2
- package/bundle/chunk-eercqt72.js +0 -2
- package/bundle/chunk-efxd6b2k.js +0 -2
- package/bundle/chunk-eneawsj8.js +0 -2
- package/bundle/chunk-f72pppr7.js +0 -2
- package/bundle/chunk-feyphhxd.js +0 -2
- package/bundle/chunk-fnnch1e9.js +0 -2
- package/bundle/chunk-ft93f33g.js +0 -3
- package/bundle/chunk-gk34kh8p.js +0 -2
- package/bundle/chunk-gn50xqbd.js +0 -2
- package/bundle/chunk-h6rv626m.js +0 -2
- package/bundle/chunk-h7s2w1e2.js +0 -2
- package/bundle/chunk-hmv2cdnz.js +0 -2
- package/bundle/chunk-ht81ensf.js +0 -2
- package/bundle/chunk-hxpgs78j.js +0 -5
- package/bundle/chunk-j59ktwny.js +0 -2
- package/bundle/chunk-jmz2mq3t.js +0 -2
- package/bundle/chunk-jvqbvgjy.js +0 -11
- package/bundle/chunk-k309zez0.js +0 -3
- package/bundle/chunk-k3fn3yed.js +0 -2
- package/bundle/chunk-kpw6nghv.js +0 -2
- package/bundle/chunk-m5ghbt5y.js +0 -2
- package/bundle/chunk-mj4bepvj.js +0 -2
- package/bundle/chunk-mn41f9qv.js +0 -2
- package/bundle/chunk-mqjf9sbm.js +0 -2
- package/bundle/chunk-n5gwrrbb.js +0 -2
- package/bundle/chunk-nfjhem1c.js +0 -2
- package/bundle/chunk-ngytjdg2.js +0 -3
- package/bundle/chunk-nj4d554m.js +0 -11
- package/bundle/chunk-nrc3bj9p.js +0 -2
- package/bundle/chunk-nt4e3em9.js +0 -3
- package/bundle/chunk-nxyyn2ra.js +0 -2
- package/bundle/chunk-p5tceb4k.js +0 -2
- package/bundle/chunk-pvpy9kq1.js +0 -800
- package/bundle/chunk-qjgm3e2p.js +0 -2
- package/bundle/chunk-qt80mhdn.js +0 -2
- package/bundle/chunk-qtw5nrr4.js +0 -2
- package/bundle/chunk-rc9ex3vt.js +0 -2
- package/bundle/chunk-s9672vvv.js +0 -2
- package/bundle/chunk-sbyey0qb.js +0 -2
- package/bundle/chunk-shpq6es1.js +0 -3
- package/bundle/chunk-sj5v361q.js +0 -2
- package/bundle/chunk-ta3k9syc.js +0 -2
- package/bundle/chunk-tk5afan4.js +0 -2
- package/bundle/chunk-tpndnprb.js +0 -2
- package/bundle/chunk-v965rsr8.js +0 -3
- package/bundle/chunk-vcmrrt8b.js +0 -3
- package/bundle/chunk-vcrn3v70.js +0 -2
- package/bundle/chunk-vwxfgea7.js +0 -2
- package/bundle/chunk-w0kgcz1t.js +0 -2
- package/bundle/chunk-wgpsmxqx.js +0 -7
- package/bundle/chunk-wksczmes.js +0 -2
- package/bundle/chunk-wsxta33r.js +0 -2
- package/bundle/chunk-xck0sq3k.js +0 -2
- package/bundle/chunk-xjyhtm8r.js +0 -2
- package/bundle/chunk-xm08fc2q.js +0 -3
- package/bundle/chunk-ygc5qegv.js +0 -2
- package/bundle/chunk-yjqmzm51.js +0 -2
- package/bundle/chunk-yzc53n88.js +0 -2
- package/bundle/chunk-yzjc15vp.js +0 -9
- package/bundle/chunk-z7y9pdj7.js +0 -2
- package/bundle/chunk-z8g819cz.js +0 -2
- package/bundle/chunk-z8r65yw3.js +0 -2
- package/bundle/chunk-zt1nbwmm.js +0 -2
- package/bundle/chunk-zz36xg2n.js +0 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{sf as q,tf as i,uf as y,yf as n}from"./chunk-cvdxgsq1.js";import{aQ as o}from"./chunk-aztre27e.js";var Ej=o((wj)=>{var M=n(),U=y(),V=i(),a=q(),X=async(j=new Uint8Array,m)=>{if(j instanceof Uint8Array)return M.Uint8ArrayBlobAdapter.mutate(j);if(!j)return M.Uint8ArrayBlobAdapter.mutate(new Uint8Array);let w=m.streamCollector(j);return M.Uint8ArrayBlobAdapter.mutate(await w)};function _(j){return encodeURIComponent(j).replace(/[!'()*]/g,function(m){return"%"+m.charCodeAt(0).toString(16).toUpperCase()})}class Y{serdeContext;setSerdeContext(j){this.serdeContext=j}}class f extends Y{options;compositeErrorRegistry;constructor(j){super();this.options=j,this.compositeErrorRegistry=U.TypeRegistry.for(j.defaultNamespace);for(let m of j.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(m)}getRequestType(){return V.HttpRequest}getResponseType(){return V.HttpResponse}setSerdeContext(j){if(this.serdeContext=j,this.serializer.setSerdeContext(j),this.deserializer.setSerdeContext(j),this.getPayloadCodec())this.getPayloadCodec().setSerdeContext(j)}updateServiceEndpoint(j,m){if("url"in m){if(j.protocol=m.url.protocol,j.hostname=m.url.hostname,j.port=m.url.port?Number(m.url.port):void 0,j.path=m.url.pathname,j.fragment=m.url.hash||void 0,j.username=m.url.username||void 0,j.password=m.url.password||void 0,!j.query)j.query={};for(let[w,z]of m.url.searchParams.entries())j.query[w]=z;if(m.headers)for(let w in m.headers)j.headers[w]=m.headers[w].join(", ");return j}else{if(j.protocol=m.protocol,j.hostname=m.hostname,j.port=m.port?Number(m.port):void 0,j.path=m.path,j.query={...m.query},m.headers)for(let w in m.headers)j.headers[w]=m.headers[w];return j}}setHostPrefix(j,m,w){if(this.serdeContext?.disableHostPrefix)return;let z=U.NormalizedSchema.of(m.input),A=U.translateTraits(m.traits??{});if(A.endpoint){let B=A.endpoint?.[0];if(typeof B==="string"){for(let[F,D]of z.structIterator()){if(!D.getMergedTraits().hostLabel)continue;let J=w[F];if(typeof J!=="string")throw Error(`@smithy/core/schema - ${F} in input must be a string as hostLabel.`);B=B.replace(`{${F}}`,J)}j.hostname=B+j.hostname}}}deserializeMetadata(j){return{httpStatusCode:j.statusCode,requestId:j.headers["x-amzn-requestid"]??j.headers["x-amzn-request-id"]??j.headers["x-amz-request-id"],extendedRequestId:j.headers["x-amz-id-2"],cfId:j.headers["x-amz-cf-id"]}}async serializeEventStream({eventStream:j,requestSchema:m,initialRequest:w}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:j,requestSchema:m,initialRequest:w})}async deserializeEventStream({response:j,responseSchema:m,initialResponseContainer:w}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:j,responseSchema:m,initialResponseContainer:w})}async loadEventStreamCapability(){let{EventStreamSerde:j}=await import("./chunk-6qy1ghrx.js");return new j({marshaller:this.getEventStreamMarshaller(),serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}getDefaultContentType(){throw Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(j,m,w,z,A){return[]}getEventStreamMarshaller(){let j=this.serdeContext;if(!j.eventStreamMarshaller)throw Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return j.eventStreamMarshaller}}class b extends f{async serializeRequest(j,m,w){let z=m&&typeof m==="object"?m:{},A=this.serializer,B={},F={},D=await w.endpoint(),J=U.NormalizedSchema.of(j?.input),T=[],N=[],O=!1,P,I=new V.HttpRequest({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:B,headers:F,body:void 0});if(D){this.updateServiceEndpoint(I,D),this.setHostPrefix(I,j,z);let G=U.translateTraits(j.traits);if(G.http){I.method=G.http[0];let[K,Q]=G.http[1].split("?");if(I.path=="/")I.path=K;else I.path+=K;let R=new URLSearchParams(Q??"");for(let[W,$]of R)B[W]=$}}for(let[G,K]of J.structIterator()){let Q=K.getMergedTraits()??{},R=z[G];if(R==null&&!K.isIdempotencyToken()){if(Q.httpLabel){if(I.path.includes(`{${G}+}`)||I.path.includes(`{${G}}`))throw Error(`No value provided for input HTTP label: ${G}.`)}continue}if(Q.httpPayload)if(K.isStreaming())if(K.isStructSchema()){if(z[G])P=await this.serializeEventStream({eventStream:z[G],requestSchema:J})}else P=R;else A.write(K,R),P=A.flush();else if(Q.httpLabel){A.write(K,R);let W=A.flush();if(I.path.includes(`{${G}+}`))I.path=I.path.replace(`{${G}+}`,W.split("/").map(_).join("/"));else if(I.path.includes(`{${G}}`))I.path=I.path.replace(`{${G}}`,_(W))}else if(Q.httpHeader)A.write(K,R),F[Q.httpHeader.toLowerCase()]=String(A.flush());else if(typeof Q.httpPrefixHeaders==="string")for(let W in R){let $=R[W],E=Q.httpPrefixHeaders+W;A.write([K.getValueSchema(),{httpHeader:E}],$),F[E.toLowerCase()]=A.flush()}else if(Q.httpQuery||Q.httpQueryParams)this.serializeQuery(K,R,B);else O=!0,T.push(G),N.push(K)}if(O&&z){let[G,K]=(J.getName(!0)??"#Unknown").split("#"),Q=J.getSchema()[6],R=[3,G,K,J.getMergedTraits(),T,N,void 0];if(Q)R[6]=Q;else R.pop();A.write(R,z),P=A.flush()}return I.headers=F,I.query=B,I.body=P,I}serializeQuery(j,m,w){let z=this.serializer,A=j.getMergedTraits();if(A.httpQueryParams){for(let B in m)if(!(B in w)){let F=m[B],D=j.getValueSchema();Object.assign(D.getMergedTraits(),{...A,httpQuery:B,httpQueryParams:void 0}),this.serializeQuery(D,F,w)}return}if(j.isListSchema()){let B=!!j.getMergedTraits().sparse,F=[];for(let D of m){z.write([j.getValueSchema(),A],D);let J=z.flush();if(B||J!==void 0)F.push(J)}w[A.httpQuery]=F}else z.write([j,A],m),w[A.httpQuery]=z.flush()}async deserializeResponse(j,m,w){let z=this.deserializer,A=U.NormalizedSchema.of(j.output),B={};if(w.statusCode>=300){let D=await X(w.body,m);if(D.byteLength>0)Object.assign(B,await z.read(15,D));throw await this.handleError(j,m,w,B,this.deserializeMetadata(w)),Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(let D in w.headers){let J=w.headers[D];delete w.headers[D],w.headers[D.toLowerCase()]=J}let F=await this.deserializeHttpMessage(A,m,w,B);if(F.length){let D=await X(w.body,m);if(D.byteLength>0){let J=await z.read(A,D);for(let T of F)if(J[T]!=null)B[T]=J[T]}}else if(F.discardResponseBody)await X(w.body,m);return B.$metadata=this.deserializeMetadata(w),B}async deserializeHttpMessage(j,m,w,z,A){let B;if(z instanceof Set)B=A;else B=z;let F=!0,D=this.deserializer,J=U.NormalizedSchema.of(j),T=[];for(let[N,O]of J.structIterator()){let P=O.getMemberTraits();if(P.httpPayload){if(F=!1,O.isStreaming())if(O.isStructSchema())B[N]=await this.deserializeEventStream({response:w,responseSchema:J});else B[N]=M.sdkStreamMixin(w.body);else if(w.body){let G=await X(w.body,m);if(G.byteLength>0)B[N]=await D.read(O,G)}}else if(P.httpHeader){let I=String(P.httpHeader).toLowerCase(),G=w.headers[I];if(G!=null)if(O.isListSchema()){let K=O.getValueSchema();K.getMergedTraits().httpHeader=I;let Q;if(K.isTimestampSchema()&&K.getSchema()===4)Q=M.splitEvery(G,",",2);else Q=M.splitHeader(G);let R=[];for(let W of Q)R.push(await D.read(K,W.trim()));B[N]=R}else B[N]=await D.read(O,G)}else if(P.httpPrefixHeaders!==void 0){B[N]={};for(let I in w.headers)if(I.startsWith(P.httpPrefixHeaders)){let G=w.headers[I],K=O.getValueSchema();K.getMergedTraits().httpHeader=I,B[N][I.slice(P.httpPrefixHeaders.length)]=await D.read(K,G)}}else if(P.httpResponseCode)B[N]=w.statusCode;else T.push(N)}return T.discardResponseBody=F,T}}class d extends f{async serializeRequest(j,m,w){let z=this.serializer,A={},B={},F=await w.endpoint(),D=U.NormalizedSchema.of(j?.input),J=D.getSchema(),T,N=m&&typeof m==="object"?m:{},O=new V.HttpRequest({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:A,headers:B,body:void 0});if(F)this.updateServiceEndpoint(O,F),this.setHostPrefix(O,j,N);if(N){let P=D.getEventStreamMember();if(P){if(N[P]){let I={};for(let[G,K]of D.structIterator())if(G!==P&&N[G])z.write(K,N[G]),I[G]=z.flush();T=await this.serializeEventStream({eventStream:N[P],requestSchema:D,initialRequest:I})}}else z.write(J,N),T=z.flush()}return O.headers=Object.assign(O.headers,B),O.query=A,O.body=T,O.method="POST",O}async deserializeResponse(j,m,w){let z=this.deserializer,A=U.NormalizedSchema.of(j.output),B={};if(w.statusCode>=300){let D=await X(w.body,m);if(D.byteLength>0)Object.assign(B,await z.read(15,D));throw await this.handleError(j,m,w,B,this.deserializeMetadata(w)),Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(let D in w.headers){let J=w.headers[D];delete w.headers[D],w.headers[D.toLowerCase()]=J}let F=A.getEventStreamMember();if(F)B[F]=await this.deserializeEventStream({response:w,responseSchema:A,initialResponseContainer:B});else{let D=await X(w.body,m);if(D.byteLength>0)Object.assign(B,await z.read(A,D))}return B.$metadata=this.deserializeMetadata(w),B}}var p=(j,m,w,z,A,B)=>{if(m!=null&&m[w]!==void 0){let F=z();if(F==null||F.length<=0)throw Error("Empty value provided for input HTTP label: "+w+".");j=j.replace(A,B?F.split("/").map((D)=>_(D)).join("/"):_(F))}else throw Error("No value provided for input HTTP label: "+w+".");return j};function s(j,m){return new H(j,m)}class H{input;context;query={};method="";headers={};path="";body=null;hostname="";resolvePathStack=[];constructor(j,m){this.input=j,this.context=m}async build(){let{hostname:j,protocol:m="https",port:w,path:z}=await this.context.endpoint();this.path=z;for(let A of this.resolvePathStack)A(this.path);return new V.HttpRequest({protocol:m,hostname:this.hostname||j,port:w,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(j){return this.hostname=j,this}bp(j){return this.resolvePathStack.push((m)=>{this.path=`${m?.endsWith("/")?m.slice(0,-1):m||""}`+j}),this}p(j,m,w,z){return this.resolvePathStack.push((A)=>{this.path=p(A,this.input,j,m,w,z)}),this}h(j){return this.headers=j,this}q(j){return this.query=j,this}b(j){return this.body=j,this}m(j){return this.method=j,this}}function S(j,m){if(m.timestampFormat.useTrait){if(j.isTimestampSchema()&&(j.getSchema()===5||j.getSchema()===6||j.getSchema()===7))return j.getSchema()}let{httpLabel:w,httpPrefixHeaders:z,httpHeader:A,httpQuery:B}=j.getMergedTraits();return(m.httpBindings?typeof z==="string"||Boolean(A)?6:Boolean(B)||Boolean(w)?5:void 0:void 0)??m.timestampFormat.default}class x extends Y{settings;constructor(j){super();this.settings=j}read(j,m){let w=U.NormalizedSchema.of(j);if(w.isListSchema())return M.splitHeader(m).map((z)=>this.read(w.getValueSchema(),z));if(w.isBlobSchema())return(this.serdeContext?.base64Decoder??M.fromBase64)(m);if(w.isTimestampSchema())switch(S(w,this.settings)){case 5:return M._parseRfc3339DateTimeWithOffset(m);case 6:return M._parseRfc7231DateTime(m);case 7:return M._parseEpochTimestamp(m);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",m),new Date(m)}if(w.isStringSchema()){let z=w.getMergedTraits().mediaType,A=m;if(z){if(w.getMergedTraits().httpHeader)A=this.base64ToUtf8(A);if(z==="application/json"||z.endsWith("+json"))A=M.LazyJsonString.from(A);return A}}if(w.isNumericSchema())return Number(m);if(w.isBigIntegerSchema())return BigInt(m);if(w.isBigDecimalSchema())return new M.NumericValue(m,"bigDecimal");if(w.isBooleanSchema())return String(m).toLowerCase()==="true";return m}base64ToUtf8(j){return(this.serdeContext?.utf8Encoder??M.toUtf8)((this.serdeContext?.base64Decoder??M.fromBase64)(j))}}class v extends Y{codecDeserializer;stringDeserializer;constructor(j,m){super();this.codecDeserializer=j,this.stringDeserializer=new x(m)}setSerdeContext(j){this.stringDeserializer.setSerdeContext(j),this.codecDeserializer.setSerdeContext(j),this.serdeContext=j}read(j,m){let w=U.NormalizedSchema.of(j),z=w.getMergedTraits(),A=this.serdeContext?.utf8Encoder??M.toUtf8;if(z.httpHeader||z.httpResponseCode)return this.stringDeserializer.read(w,A(m));if(z.httpPayload){if(w.isBlobSchema()){let B=this.serdeContext?.utf8Decoder??M.fromUtf8;if(typeof m==="string")return B(m);return m}else if(w.isStringSchema()){if("byteLength"in m)return A(m);return m}}return this.codecDeserializer.read(w,m)}}class C extends Y{settings;stringBuffer="";constructor(j){super();this.settings=j}write(j,m){let w=U.NormalizedSchema.of(j);switch(typeof m){case"object":if(m===null){this.stringBuffer="null";return}if(w.isTimestampSchema()){if(!(m instanceof Date))throw Error(`@smithy/core/protocols - received non-Date value ${m} when schema expected Date in ${w.getName(!0)}`);switch(S(w,this.settings)){case 5:this.stringBuffer=m.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=M.dateToUtcString(m);break;case 7:this.stringBuffer=String(m.getTime()/1000);break;default:console.warn("Missing timestamp format, using epoch seconds",m),this.stringBuffer=String(m.getTime()/1000)}return}if(w.isBlobSchema()&&"byteLength"in m){this.stringBuffer=(this.serdeContext?.base64Encoder??M.toBase64)(m);return}if(w.isListSchema()&&Array.isArray(m)){let B="";for(let F of m){this.write([w.getValueSchema(),w.getMergedTraits()],F);let D=this.flush(),J=w.getValueSchema().isTimestampSchema()?D:M.quoteHeader(D);if(B!=="")B+=", ";B+=J}this.stringBuffer=B;return}this.stringBuffer=JSON.stringify(m,null,2);break;case"string":let z=w.getMergedTraits().mediaType,A=m;if(z){if(z==="application/json"||z.endsWith("+json"))A=M.LazyJsonString.from(A);if(w.getMergedTraits().httpHeader){this.stringBuffer=(this.serdeContext?.base64Encoder??M.toBase64)(A.toString());return}}this.stringBuffer=m;break;default:if(w.isIdempotencyToken())this.stringBuffer=M.generateIdempotencyToken();else this.stringBuffer=String(m)}}flush(){let j=this.stringBuffer;return this.stringBuffer="",j}}class h{codecSerializer;stringSerializer;buffer;constructor(j,m,w=new C(m)){this.codecSerializer=j,this.stringSerializer=w}setSerdeContext(j){this.codecSerializer.setSerdeContext(j),this.stringSerializer.setSerdeContext(j)}write(j,m){let w=U.NormalizedSchema.of(j),z=w.getMergedTraits();if(z.httpHeader||z.httpLabel||z.httpQuery){this.stringSerializer.write(w,m),this.buffer=this.stringSerializer.flush();return}return this.codecSerializer.write(w,m)}flush(){if(this.buffer!==void 0){let j=this.buffer;return this.buffer=void 0,j}return this.codecSerializer.flush()}}class c{name;kind;values;constructor({name:j,kind:m=a.FieldPosition.HEADER,values:w=[]}){this.name=j,this.kind=m,this.values=w}add(j){this.values.push(j)}set(j){this.values=j}remove(j){this.values=this.values.filter((m)=>m!==j)}toString(){return this.values.map((j)=>j.includes(",")||j.includes(" ")?`"${j}"`:j).join(", ")}get(){return this.values}}class g{entries={};encoding;constructor({fields:j=[],encoding:m="utf-8"}){j.forEach(this.setField.bind(this)),this.encoding=m}setField(j){this.entries[j.name.toLowerCase()]=j}getField(j){return this.entries[j.toLowerCase()]}removeField(j){delete this.entries[j.toLowerCase()]}getByType(j){return Object.values(this.entries).filter((m)=>m.kind===j)}}var u=(j)=>{return{setHttpHandler(m){j.httpHandler=m},httpHandler(){return j.httpHandler},updateHttpClientConfig(m,w){j.httpHandler?.updateHttpClientConfig(m,w)},httpHandlerConfigs(){return j.httpHandler.httpHandlerConfigs()}}},t=(j)=>{return{httpHandler:j.httpHandler()}},L="content-length";function k(j){return(m)=>async(w)=>{let z=w.request;if(V.HttpRequest.isInstance(z)){let{body:A,headers:B}=z;if(A&&Object.keys(B).map((F)=>F.toLowerCase()).indexOf(L)===-1)try{let F=j(A);z.headers={...z.headers,[L]:String(F)}}catch(F){}}return m({...w,request:z})}}var l={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},r=(j)=>({applyToStack:(m)=>{m.add(k(j.bodyLengthChecker),l)}}),Z=(j)=>encodeURIComponent(j).replace(/[!'()*]/g,e),e=(j)=>`%${j.charCodeAt(0).toString(16).toUpperCase()}`,jj=(j)=>j.split("/").map(Z).join("/");function mj(j){let m=[];for(let w of Object.keys(j).sort()){let z=j[w];if(w=Z(w),Array.isArray(z))for(let A=0,B=z.length;A<B;A++)m.push(`${w}=${Z(z[A])}`);else{let A=w;if(z||typeof z==="string")A+=`=${Z(z)}`;m.push(A)}}return m.join("&")}wj.HttpRequest=V.HttpRequest;wj.HttpResponse=V.HttpResponse;wj.isValidHostname=V.isValidHostname;wj.parseQueryString=V.parseQueryString;wj.parseUrl=V.parseUrl;wj.Field=c;wj.Fields=g;wj.FromStringShapeDeserializer=x;wj.HttpBindingProtocol=b;wj.HttpInterceptingShapeDeserializer=v;wj.HttpInterceptingShapeSerializer=h;wj.HttpProtocol=f;wj.RequestBuilder=H;wj.RpcProtocol=d;wj.SerdeContext=Y;wj.ToStringShapeSerializer=C;wj.buildQueryString=mj;wj.collectBody=X;wj.contentLengthMiddleware=k;wj.contentLengthMiddlewareOptions=l;wj.determineTimestampFormat=S;wj.escapeUri=Z;wj.escapeUriPath=jj;wj.extendedEncodeURIComponent=_;wj.getContentLengthPlugin=r;wj.getHttpHandlerExtensionConfiguration=u;wj.requestBuilder=s;wj.resolveHttpHandlerRuntimeConfig=t;wj.resolvedPath=p});
|
|
2
|
+
import{sf as q,tf as i,uf as y,yf as n}from"./chunk-tq0239xp.js";import{CO as o}from"./chunk-7xm75w1e.js";var Ej=o((wj)=>{var M=n(),U=y(),V=i(),a=q(),X=async(j=new Uint8Array,m)=>{if(j instanceof Uint8Array)return M.Uint8ArrayBlobAdapter.mutate(j);if(!j)return M.Uint8ArrayBlobAdapter.mutate(new Uint8Array);let w=m.streamCollector(j);return M.Uint8ArrayBlobAdapter.mutate(await w)};function _(j){return encodeURIComponent(j).replace(/[!'()*]/g,function(m){return"%"+m.charCodeAt(0).toString(16).toUpperCase()})}class Y{serdeContext;setSerdeContext(j){this.serdeContext=j}}class f extends Y{options;compositeErrorRegistry;constructor(j){super();this.options=j,this.compositeErrorRegistry=U.TypeRegistry.for(j.defaultNamespace);for(let m of j.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(m)}getRequestType(){return V.HttpRequest}getResponseType(){return V.HttpResponse}setSerdeContext(j){if(this.serdeContext=j,this.serializer.setSerdeContext(j),this.deserializer.setSerdeContext(j),this.getPayloadCodec())this.getPayloadCodec().setSerdeContext(j)}updateServiceEndpoint(j,m){if("url"in m){if(j.protocol=m.url.protocol,j.hostname=m.url.hostname,j.port=m.url.port?Number(m.url.port):void 0,j.path=m.url.pathname,j.fragment=m.url.hash||void 0,j.username=m.url.username||void 0,j.password=m.url.password||void 0,!j.query)j.query={};for(let[w,z]of m.url.searchParams.entries())j.query[w]=z;if(m.headers)for(let w in m.headers)j.headers[w]=m.headers[w].join(", ");return j}else{if(j.protocol=m.protocol,j.hostname=m.hostname,j.port=m.port?Number(m.port):void 0,j.path=m.path,j.query={...m.query},m.headers)for(let w in m.headers)j.headers[w]=m.headers[w];return j}}setHostPrefix(j,m,w){if(this.serdeContext?.disableHostPrefix)return;let z=U.NormalizedSchema.of(m.input),A=U.translateTraits(m.traits??{});if(A.endpoint){let B=A.endpoint?.[0];if(typeof B==="string"){for(let[F,D]of z.structIterator()){if(!D.getMergedTraits().hostLabel)continue;let J=w[F];if(typeof J!=="string")throw Error(`@smithy/core/schema - ${F} in input must be a string as hostLabel.`);B=B.replace(`{${F}}`,J)}j.hostname=B+j.hostname}}}deserializeMetadata(j){return{httpStatusCode:j.statusCode,requestId:j.headers["x-amzn-requestid"]??j.headers["x-amzn-request-id"]??j.headers["x-amz-request-id"],extendedRequestId:j.headers["x-amz-id-2"],cfId:j.headers["x-amz-cf-id"]}}async serializeEventStream({eventStream:j,requestSchema:m,initialRequest:w}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:j,requestSchema:m,initialRequest:w})}async deserializeEventStream({response:j,responseSchema:m,initialResponseContainer:w}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:j,responseSchema:m,initialResponseContainer:w})}async loadEventStreamCapability(){let{EventStreamSerde:j}=await import("./chunk-05mce0j3.js");return new j({marshaller:this.getEventStreamMarshaller(),serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}getDefaultContentType(){throw Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(j,m,w,z,A){return[]}getEventStreamMarshaller(){let j=this.serdeContext;if(!j.eventStreamMarshaller)throw Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return j.eventStreamMarshaller}}class b extends f{async serializeRequest(j,m,w){let z=m&&typeof m==="object"?m:{},A=this.serializer,B={},F={},D=await w.endpoint(),J=U.NormalizedSchema.of(j?.input),T=[],N=[],O=!1,P,I=new V.HttpRequest({protocol:"",hostname:"",port:void 0,path:"",fragment:void 0,query:B,headers:F,body:void 0});if(D){this.updateServiceEndpoint(I,D),this.setHostPrefix(I,j,z);let G=U.translateTraits(j.traits);if(G.http){I.method=G.http[0];let[K,Q]=G.http[1].split("?");if(I.path=="/")I.path=K;else I.path+=K;let R=new URLSearchParams(Q??"");for(let[W,$]of R)B[W]=$}}for(let[G,K]of J.structIterator()){let Q=K.getMergedTraits()??{},R=z[G];if(R==null&&!K.isIdempotencyToken()){if(Q.httpLabel){if(I.path.includes(`{${G}+}`)||I.path.includes(`{${G}}`))throw Error(`No value provided for input HTTP label: ${G}.`)}continue}if(Q.httpPayload)if(K.isStreaming())if(K.isStructSchema()){if(z[G])P=await this.serializeEventStream({eventStream:z[G],requestSchema:J})}else P=R;else A.write(K,R),P=A.flush();else if(Q.httpLabel){A.write(K,R);let W=A.flush();if(I.path.includes(`{${G}+}`))I.path=I.path.replace(`{${G}+}`,W.split("/").map(_).join("/"));else if(I.path.includes(`{${G}}`))I.path=I.path.replace(`{${G}}`,_(W))}else if(Q.httpHeader)A.write(K,R),F[Q.httpHeader.toLowerCase()]=String(A.flush());else if(typeof Q.httpPrefixHeaders==="string")for(let W in R){let $=R[W],E=Q.httpPrefixHeaders+W;A.write([K.getValueSchema(),{httpHeader:E}],$),F[E.toLowerCase()]=A.flush()}else if(Q.httpQuery||Q.httpQueryParams)this.serializeQuery(K,R,B);else O=!0,T.push(G),N.push(K)}if(O&&z){let[G,K]=(J.getName(!0)??"#Unknown").split("#"),Q=J.getSchema()[6],R=[3,G,K,J.getMergedTraits(),T,N,void 0];if(Q)R[6]=Q;else R.pop();A.write(R,z),P=A.flush()}return I.headers=F,I.query=B,I.body=P,I}serializeQuery(j,m,w){let z=this.serializer,A=j.getMergedTraits();if(A.httpQueryParams){for(let B in m)if(!(B in w)){let F=m[B],D=j.getValueSchema();Object.assign(D.getMergedTraits(),{...A,httpQuery:B,httpQueryParams:void 0}),this.serializeQuery(D,F,w)}return}if(j.isListSchema()){let B=!!j.getMergedTraits().sparse,F=[];for(let D of m){z.write([j.getValueSchema(),A],D);let J=z.flush();if(B||J!==void 0)F.push(J)}w[A.httpQuery]=F}else z.write([j,A],m),w[A.httpQuery]=z.flush()}async deserializeResponse(j,m,w){let z=this.deserializer,A=U.NormalizedSchema.of(j.output),B={};if(w.statusCode>=300){let D=await X(w.body,m);if(D.byteLength>0)Object.assign(B,await z.read(15,D));throw await this.handleError(j,m,w,B,this.deserializeMetadata(w)),Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.")}for(let D in w.headers){let J=w.headers[D];delete w.headers[D],w.headers[D.toLowerCase()]=J}let F=await this.deserializeHttpMessage(A,m,w,B);if(F.length){let D=await X(w.body,m);if(D.byteLength>0){let J=await z.read(A,D);for(let T of F)if(J[T]!=null)B[T]=J[T]}}else if(F.discardResponseBody)await X(w.body,m);return B.$metadata=this.deserializeMetadata(w),B}async deserializeHttpMessage(j,m,w,z,A){let B;if(z instanceof Set)B=A;else B=z;let F=!0,D=this.deserializer,J=U.NormalizedSchema.of(j),T=[];for(let[N,O]of J.structIterator()){let P=O.getMemberTraits();if(P.httpPayload){if(F=!1,O.isStreaming())if(O.isStructSchema())B[N]=await this.deserializeEventStream({response:w,responseSchema:J});else B[N]=M.sdkStreamMixin(w.body);else if(w.body){let G=await X(w.body,m);if(G.byteLength>0)B[N]=await D.read(O,G)}}else if(P.httpHeader){let I=String(P.httpHeader).toLowerCase(),G=w.headers[I];if(G!=null)if(O.isListSchema()){let K=O.getValueSchema();K.getMergedTraits().httpHeader=I;let Q;if(K.isTimestampSchema()&&K.getSchema()===4)Q=M.splitEvery(G,",",2);else Q=M.splitHeader(G);let R=[];for(let W of Q)R.push(await D.read(K,W.trim()));B[N]=R}else B[N]=await D.read(O,G)}else if(P.httpPrefixHeaders!==void 0){B[N]={};for(let I in w.headers)if(I.startsWith(P.httpPrefixHeaders)){let G=w.headers[I],K=O.getValueSchema();K.getMergedTraits().httpHeader=I,B[N][I.slice(P.httpPrefixHeaders.length)]=await D.read(K,G)}}else if(P.httpResponseCode)B[N]=w.statusCode;else T.push(N)}return T.discardResponseBody=F,T}}class d extends f{async serializeRequest(j,m,w){let z=this.serializer,A={},B={},F=await w.endpoint(),D=U.NormalizedSchema.of(j?.input),J=D.getSchema(),T,N=m&&typeof m==="object"?m:{},O=new V.HttpRequest({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:A,headers:B,body:void 0});if(F)this.updateServiceEndpoint(O,F),this.setHostPrefix(O,j,N);if(N){let P=D.getEventStreamMember();if(P){if(N[P]){let I={};for(let[G,K]of D.structIterator())if(G!==P&&N[G])z.write(K,N[G]),I[G]=z.flush();T=await this.serializeEventStream({eventStream:N[P],requestSchema:D,initialRequest:I})}}else z.write(J,N),T=z.flush()}return O.headers=Object.assign(O.headers,B),O.query=A,O.body=T,O.method="POST",O}async deserializeResponse(j,m,w){let z=this.deserializer,A=U.NormalizedSchema.of(j.output),B={};if(w.statusCode>=300){let D=await X(w.body,m);if(D.byteLength>0)Object.assign(B,await z.read(15,D));throw await this.handleError(j,m,w,B,this.deserializeMetadata(w)),Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(let D in w.headers){let J=w.headers[D];delete w.headers[D],w.headers[D.toLowerCase()]=J}let F=A.getEventStreamMember();if(F)B[F]=await this.deserializeEventStream({response:w,responseSchema:A,initialResponseContainer:B});else{let D=await X(w.body,m);if(D.byteLength>0)Object.assign(B,await z.read(A,D))}return B.$metadata=this.deserializeMetadata(w),B}}var p=(j,m,w,z,A,B)=>{if(m!=null&&m[w]!==void 0){let F=z();if(F==null||F.length<=0)throw Error("Empty value provided for input HTTP label: "+w+".");j=j.replace(A,B?F.split("/").map((D)=>_(D)).join("/"):_(F))}else throw Error("No value provided for input HTTP label: "+w+".");return j};function s(j,m){return new H(j,m)}class H{input;context;query={};method="";headers={};path="";body=null;hostname="";resolvePathStack=[];constructor(j,m){this.input=j,this.context=m}async build(){let{hostname:j,protocol:m="https",port:w,path:z}=await this.context.endpoint();this.path=z;for(let A of this.resolvePathStack)A(this.path);return new V.HttpRequest({protocol:m,hostname:this.hostname||j,port:w,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(j){return this.hostname=j,this}bp(j){return this.resolvePathStack.push((m)=>{this.path=`${m?.endsWith("/")?m.slice(0,-1):m||""}`+j}),this}p(j,m,w,z){return this.resolvePathStack.push((A)=>{this.path=p(A,this.input,j,m,w,z)}),this}h(j){return this.headers=j,this}q(j){return this.query=j,this}b(j){return this.body=j,this}m(j){return this.method=j,this}}function S(j,m){if(m.timestampFormat.useTrait){if(j.isTimestampSchema()&&(j.getSchema()===5||j.getSchema()===6||j.getSchema()===7))return j.getSchema()}let{httpLabel:w,httpPrefixHeaders:z,httpHeader:A,httpQuery:B}=j.getMergedTraits();return(m.httpBindings?typeof z==="string"||Boolean(A)?6:Boolean(B)||Boolean(w)?5:void 0:void 0)??m.timestampFormat.default}class x extends Y{settings;constructor(j){super();this.settings=j}read(j,m){let w=U.NormalizedSchema.of(j);if(w.isListSchema())return M.splitHeader(m).map((z)=>this.read(w.getValueSchema(),z));if(w.isBlobSchema())return(this.serdeContext?.base64Decoder??M.fromBase64)(m);if(w.isTimestampSchema())switch(S(w,this.settings)){case 5:return M._parseRfc3339DateTimeWithOffset(m);case 6:return M._parseRfc7231DateTime(m);case 7:return M._parseEpochTimestamp(m);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",m),new Date(m)}if(w.isStringSchema()){let z=w.getMergedTraits().mediaType,A=m;if(z){if(w.getMergedTraits().httpHeader)A=this.base64ToUtf8(A);if(z==="application/json"||z.endsWith("+json"))A=M.LazyJsonString.from(A);return A}}if(w.isNumericSchema())return Number(m);if(w.isBigIntegerSchema())return BigInt(m);if(w.isBigDecimalSchema())return new M.NumericValue(m,"bigDecimal");if(w.isBooleanSchema())return String(m).toLowerCase()==="true";return m}base64ToUtf8(j){return(this.serdeContext?.utf8Encoder??M.toUtf8)((this.serdeContext?.base64Decoder??M.fromBase64)(j))}}class v extends Y{codecDeserializer;stringDeserializer;constructor(j,m){super();this.codecDeserializer=j,this.stringDeserializer=new x(m)}setSerdeContext(j){this.stringDeserializer.setSerdeContext(j),this.codecDeserializer.setSerdeContext(j),this.serdeContext=j}read(j,m){let w=U.NormalizedSchema.of(j),z=w.getMergedTraits(),A=this.serdeContext?.utf8Encoder??M.toUtf8;if(z.httpHeader||z.httpResponseCode)return this.stringDeserializer.read(w,A(m));if(z.httpPayload){if(w.isBlobSchema()){let B=this.serdeContext?.utf8Decoder??M.fromUtf8;if(typeof m==="string")return B(m);return m}else if(w.isStringSchema()){if("byteLength"in m)return A(m);return m}}return this.codecDeserializer.read(w,m)}}class C extends Y{settings;stringBuffer="";constructor(j){super();this.settings=j}write(j,m){let w=U.NormalizedSchema.of(j);switch(typeof m){case"object":if(m===null){this.stringBuffer="null";return}if(w.isTimestampSchema()){if(!(m instanceof Date))throw Error(`@smithy/core/protocols - received non-Date value ${m} when schema expected Date in ${w.getName(!0)}`);switch(S(w,this.settings)){case 5:this.stringBuffer=m.toISOString().replace(".000Z","Z");break;case 6:this.stringBuffer=M.dateToUtcString(m);break;case 7:this.stringBuffer=String(m.getTime()/1000);break;default:console.warn("Missing timestamp format, using epoch seconds",m),this.stringBuffer=String(m.getTime()/1000)}return}if(w.isBlobSchema()&&"byteLength"in m){this.stringBuffer=(this.serdeContext?.base64Encoder??M.toBase64)(m);return}if(w.isListSchema()&&Array.isArray(m)){let B="";for(let F of m){this.write([w.getValueSchema(),w.getMergedTraits()],F);let D=this.flush(),J=w.getValueSchema().isTimestampSchema()?D:M.quoteHeader(D);if(B!=="")B+=", ";B+=J}this.stringBuffer=B;return}this.stringBuffer=JSON.stringify(m,null,2);break;case"string":let z=w.getMergedTraits().mediaType,A=m;if(z){if(z==="application/json"||z.endsWith("+json"))A=M.LazyJsonString.from(A);if(w.getMergedTraits().httpHeader){this.stringBuffer=(this.serdeContext?.base64Encoder??M.toBase64)(A.toString());return}}this.stringBuffer=m;break;default:if(w.isIdempotencyToken())this.stringBuffer=M.generateIdempotencyToken();else this.stringBuffer=String(m)}}flush(){let j=this.stringBuffer;return this.stringBuffer="",j}}class h{codecSerializer;stringSerializer;buffer;constructor(j,m,w=new C(m)){this.codecSerializer=j,this.stringSerializer=w}setSerdeContext(j){this.codecSerializer.setSerdeContext(j),this.stringSerializer.setSerdeContext(j)}write(j,m){let w=U.NormalizedSchema.of(j),z=w.getMergedTraits();if(z.httpHeader||z.httpLabel||z.httpQuery){this.stringSerializer.write(w,m),this.buffer=this.stringSerializer.flush();return}return this.codecSerializer.write(w,m)}flush(){if(this.buffer!==void 0){let j=this.buffer;return this.buffer=void 0,j}return this.codecSerializer.flush()}}class c{name;kind;values;constructor({name:j,kind:m=a.FieldPosition.HEADER,values:w=[]}){this.name=j,this.kind=m,this.values=w}add(j){this.values.push(j)}set(j){this.values=j}remove(j){this.values=this.values.filter((m)=>m!==j)}toString(){return this.values.map((j)=>j.includes(",")||j.includes(" ")?`"${j}"`:j).join(", ")}get(){return this.values}}class g{entries={};encoding;constructor({fields:j=[],encoding:m="utf-8"}){j.forEach(this.setField.bind(this)),this.encoding=m}setField(j){this.entries[j.name.toLowerCase()]=j}getField(j){return this.entries[j.toLowerCase()]}removeField(j){delete this.entries[j.toLowerCase()]}getByType(j){return Object.values(this.entries).filter((m)=>m.kind===j)}}var u=(j)=>{return{setHttpHandler(m){j.httpHandler=m},httpHandler(){return j.httpHandler},updateHttpClientConfig(m,w){j.httpHandler?.updateHttpClientConfig(m,w)},httpHandlerConfigs(){return j.httpHandler.httpHandlerConfigs()}}},t=(j)=>{return{httpHandler:j.httpHandler()}},L="content-length";function k(j){return(m)=>async(w)=>{let z=w.request;if(V.HttpRequest.isInstance(z)){let{body:A,headers:B}=z;if(A&&Object.keys(B).map((F)=>F.toLowerCase()).indexOf(L)===-1)try{let F=j(A);z.headers={...z.headers,[L]:String(F)}}catch(F){}}return m({...w,request:z})}}var l={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},r=(j)=>({applyToStack:(m)=>{m.add(k(j.bodyLengthChecker),l)}}),Z=(j)=>encodeURIComponent(j).replace(/[!'()*]/g,e),e=(j)=>`%${j.charCodeAt(0).toString(16).toUpperCase()}`,jj=(j)=>j.split("/").map(Z).join("/");function mj(j){let m=[];for(let w of Object.keys(j).sort()){let z=j[w];if(w=Z(w),Array.isArray(z))for(let A=0,B=z.length;A<B;A++)m.push(`${w}=${Z(z[A])}`);else{let A=w;if(z||typeof z==="string")A+=`=${Z(z)}`;m.push(A)}}return m.join("&")}wj.HttpRequest=V.HttpRequest;wj.HttpResponse=V.HttpResponse;wj.isValidHostname=V.isValidHostname;wj.parseQueryString=V.parseQueryString;wj.parseUrl=V.parseUrl;wj.Field=c;wj.Fields=g;wj.FromStringShapeDeserializer=x;wj.HttpBindingProtocol=b;wj.HttpInterceptingShapeDeserializer=v;wj.HttpInterceptingShapeSerializer=h;wj.HttpProtocol=f;wj.RequestBuilder=H;wj.RpcProtocol=d;wj.SerdeContext=Y;wj.ToStringShapeSerializer=C;wj.buildQueryString=mj;wj.collectBody=X;wj.contentLengthMiddleware=k;wj.contentLengthMiddlewareOptions=l;wj.determineTimestampFormat=S;wj.escapeUri=Z;wj.escapeUriPath=jj;wj.extendedEncodeURIComponent=_;wj.getContentLengthPlugin=r;wj.getHttpHandlerExtensionConfiguration=u;wj.requestBuilder=s;wj.resolveHttpHandlerRuntimeConfig=t;wj.resolvedPath=p});
|
|
3
3
|
export{Ej as Ce};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Cl as a}from"./chunk-04n2ycg5.js";import"./chunk-8ymffyep.js";import"./chunk-mcg24gkb.js";import"./chunk-redjxn13.js";import"./chunk-bn0h9dny.js";import"./chunk-r4ndwym0.js";import"./chunk-3ytjm3az.js";import"./chunk-htz93dsd.js";import"./chunk-vcw00k0n.js";import"./chunk-r78czx4d.js";import"./chunk-2hc5z7b5.js";import"./chunk-d68fzyw7.js";import"./chunk-4jtxtkj7.js";import"./chunk-ay8emwym.js";import"./chunk-2maqde7w.js";import"./chunk-kj20f048.js";import"./chunk-cqtkxwd8.js";import"./chunk-x9rbv6p6.js";import"./chunk-g5rabwre.js";import"./chunk-jbx3s7nw.js";import"./chunk-15hw2z9t.js";import"./chunk-48ge2ryx.js";import"./chunk-c1bdzxbx.js";import"./chunk-ehhas0ew.js";import"./chunk-d6ry9418.js";import"./chunk-0dt0bxz6.js";import"./chunk-10bjs581.js";import"./chunk-4cnwn1rh.js";import"./chunk-gcw4rn10.js";import"./chunk-m5m448mg.js";import"./chunk-tqj69nh6.js";import"./chunk-ag8kz1e7.js";import"./chunk-5tray1fw.js";import"./chunk-c11d28qn.js";import"./chunk-mzs2pjyc.js";import"./chunk-gagtmjmp.js";import"./chunk-zs8kqdsf.js";import"./chunk-zw815d68.js";import"./chunk-7xm75w1e.js";export{a as Session};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{$l as s,am as t,bm as u,dm as v,em as w}from"./chunk-mcg24gkb.js";import"./chunk-redjxn13.js";import{$m as c,Nm as a,_m as b,an as d,bn as e,cn as f,dn as g,en as h,fn as i,gn as j,hn as k,jn as l,kn as m,ln as n,nn as o,pn as p,wn as q,xn as r}from"./chunk-bn0h9dny.js";import"./chunk-vcw00k0n.js";import"./chunk-2hc5z7b5.js";import"./chunk-d68fzyw7.js";import"./chunk-c1bdzxbx.js";import"./chunk-ehhas0ew.js";import"./chunk-d6ry9418.js";import"./chunk-10bjs581.js";import"./chunk-4cnwn1rh.js";import"./chunk-m5m448mg.js";import"./chunk-tqj69nh6.js";import"./chunk-ag8kz1e7.js";import"./chunk-5tray1fw.js";import"./chunk-c11d28qn.js";import"./chunk-mzs2pjyc.js";import"./chunk-gagtmjmp.js";import"./chunk-zs8kqdsf.js";import"./chunk-7xm75w1e.js";export{a as sql,e as or,f as not,c as ne,j as lte,i as lt,p as like,l as isNull,m as isNotNull,k as inArray,h as gte,g as gt,n as exists,b as eq,r as desc,t as count,o as between,q as asc,d as and,w as Storage,v as NotFoundError,s as JsonMigration,u as Database};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Wf as a,Xf as b}from"./chunk-5v0xjs3x.js";import"./chunk-m5m448mg.js";import"./chunk-tqj69nh6.js";import"./chunk-ag8kz1e7.js";import"./chunk-5tray1fw.js";import"./chunk-c11d28qn.js";import"./chunk-mzs2pjyc.js";import"./chunk-gagtmjmp.js";import"./chunk-zs8kqdsf.js";import"./chunk-7xm75w1e.js";export{a as start,b as Heap};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Fd as T,Hd as q,Id as N,Jd as w,Kd as X,Nd as D}from"./chunk-p62gb4wj.js";import"./chunk-x4sp99g6.js";import{Vf as Q}from"./chunk-rbk8seme.js";import{gh as A}from"./chunk-fq0x3esz.js";import"./chunk-44a82dg0.js";import"./chunk-vxyy2dp3.js";import"./chunk-yp5bypsp.js";import"./chunk-7hm0c2yg.js";import"./chunk-gj0wt0cy.js";import"./chunk-5hw6xa49.js";import"./chunk-326p5b10.js";import"./chunk-04n2ycg5.js";import{Fl as $}from"./chunk-8ymffyep.js";import"./chunk-mcg24gkb.js";import"./chunk-redjxn13.js";import"./chunk-bn0h9dny.js";import"./chunk-r4ndwym0.js";import"./chunk-3ytjm3az.js";import"./chunk-htz93dsd.js";import"./chunk-vcw00k0n.js";import"./chunk-r78czx4d.js";import"./chunk-2hc5z7b5.js";import"./chunk-d68fzyw7.js";import"./chunk-4jtxtkj7.js";import"./chunk-ay8emwym.js";import"./chunk-2maqde7w.js";import"./chunk-kj20f048.js";import"./chunk-cqtkxwd8.js";import"./chunk-x9rbv6p6.js";import"./chunk-g5rabwre.js";import"./chunk-jbx3s7nw.js";import"./chunk-15hw2z9t.js";import"./chunk-48ge2ryx.js";import"./chunk-n9xns8by.js";import"./chunk-y9q0hb7b.js";import"./chunk-c1bdzxbx.js";import"./chunk-ehhas0ew.js";import"./chunk-d6ry9418.js";import"./chunk-0dt0bxz6.js";import"./chunk-10bjs581.js";import"./chunk-4cnwn1rh.js";import"./chunk-gcw4rn10.js";import{Qs as W}from"./chunk-m5m448mg.js";import{ht as _,st as Y}from"./chunk-tqj69nh6.js";import"./chunk-ag8kz1e7.js";import"./chunk-5tray1fw.js";import"./chunk-c11d28qn.js";import"./chunk-mzs2pjyc.js";import"./chunk-gagtmjmp.js";import"./chunk-zs8kqdsf.js";import"./chunk-dxpj0cxh.js";import"./chunk-zw815d68.js";import"./chunk-7xm75w1e.js";import V from"fs/promises";import L from"path";import R from"os";var g={command:"uninstall",describe:"uninstall qitqode and remove all related files",builder:(j)=>j.option("keep-config",{alias:"c",type:"boolean",describe:"keep configuration files",default:!1}).option("keep-data",{alias:"d",type:"boolean",describe:"keep session data and snapshots",default:!1}).option("dry-run",{type:"boolean",describe:"show what would be removed without removing",default:!1}).option("force",{alias:"f",type:"boolean",describe:"skip confirmation prompts",default:!1}),handler:async(j)=>{Q.empty(),Q.println(Q.logo(" ")),Q.empty(),w("Uninstall QitQode");let B=await A.runPromise($.Service.use((J)=>J.method()));N.info(`Installation method: ${B}`);let E=await v(j,B);if(await z(E,B),!j.force&&!j.dryRun){let J=await q({message:"Are you sure you want to uninstall?",initialValue:!1});if(!J||T(J)){X("Cancelled");return}}if(j.dryRun){N.warn("Dry run - no changes made"),X("Done");return}await G(B,E),X("Done")}};async function v(j,B){let E=[{path:W.Path.data,label:"Data",keep:j.keepData},{path:W.Path.cache,label:"Cache",keep:!1},{path:W.Path.config,label:"Config",keep:j.keepConfig},{path:W.Path.state,label:"State",keep:!1}],J=B==="curl"?await P():null,H=B==="curl"?process.execPath:null;return{directories:E,shellConfig:J,binary:H}}async function z(j,B){N.message("The following will be removed:");for(let E of j.directories){if(!await V.access(E.path).then(()=>!0).catch(()=>!1))continue;let H=await F(E.path),K=S(H),O=E.keep?Q.Style.TEXT_DIM+"(keeping)":"",M=E.keep?"\u25CB":"\u2713";N.info(` ${M} ${E.label}: ${Z(E.path)} ${Q.Style.TEXT_DIM}(${K})${O}`)}if(j.binary)N.info(` \u2713 Binary: ${Z(j.binary)}`);if(j.shellConfig)N.info(` \u2713 Shell PATH in ${Z(j.shellConfig)}`);if(B!=="curl"&&B!=="unknown"){let E={npm:"npm uninstall -g @qitqode/cli",pnpm:"pnpm uninstall -g @qitqode/cli",bun:"bun remove -g @qitqode/cli"};N.info(` \u2713 Package: ${E[B]||B}`)}}async function G(j,B){let E=D(),J=[];for(let H of B.directories){if(H.keep){N.step(`Skipping ${H.label} (--keep-${H.label.toLowerCase()})`);continue}if(!await V.access(H.path).then(()=>!0).catch(()=>!1))continue;E.start(`Removing ${H.label}...`);let O=await V.rm(H.path,{recursive:!0,force:!0}).catch((M)=>M);if(O){E.stop(`Failed to remove ${H.label}`,1),J.push(`${H.label}: ${O.message}`);continue}E.stop(`Removed ${H.label}`)}if(B.shellConfig){E.start("Cleaning shell config...");let H=await k(B.shellConfig).catch((K)=>K);if(H)E.stop("Failed to clean shell config",1),J.push(`Shell config: ${H.message}`);else E.stop("Cleaned shell config")}if(j!=="curl"&&j!=="unknown"){let K={npm:["npm","uninstall","-g","@qitqode/cli"],pnpm:["pnpm","uninstall","-g","@qitqode/cli"],bun:["bun","remove","-g","@qitqode/cli"]}[j];if(K){E.start(`Running ${K.join(" ")}...`);let O=await _.run(K,{nothrow:!0});if(O.code!==0)E.stop(`Package manager uninstall failed: exit code ${O.code}`,1),N.warn(`You may need to run manually: ${K.join(" ")}`);else E.stop("Package removed")}else N.warn(`Uninstall not supported for method "${j}" yet, skipping package removal`)}if(j==="curl"&&B.binary){Q.empty(),N.message("To finish removing the binary, run:"),N.info(` rm "${B.binary}"`);let H=L.dirname(B.binary);if(H.includes(".qitqode"))N.info(` rmdir "${H}" 2>/dev/null`)}if(J.length>0){Q.empty(),N.warn("Some operations failed:");for(let H of J)N.error(` ${H}`)}Q.empty(),N.success("Thank you for using QitQode!")}async function P(){let j=L.basename(process.env.SHELL||"bash"),B=R.homedir(),E=process.env.XDG_CONFIG_HOME||L.join(B,".config"),J={fish:[L.join(E,"fish","config.fish")],zsh:[L.join(B,".zshrc"),L.join(B,".zshenv"),L.join(E,"zsh",".zshrc"),L.join(E,"zsh",".zshenv")],bash:[L.join(B,".bashrc"),L.join(B,".bash_profile"),L.join(B,".profile"),L.join(E,"bash",".bashrc"),L.join(E,"bash",".bash_profile")],ash:[L.join(B,".ashrc"),L.join(B,".profile")],sh:[L.join(B,".profile")]},H=J[j]||J.bash;for(let K of H){if(!await V.access(K).then(()=>!0).catch(()=>!1))continue;let M=await Y.readText(K).catch(()=>"");if(M.includes("# qitqode")||M.includes(".qitqode/bin"))return K}return null}async function k(j){let E=(await Y.readText(j)).split(`
|
|
3
|
+
`),J=[],H=!1;for(let O of E){let M=O.trim();if(M==="# qitqode"){H=!0;continue}if(H){if(H=!1,M.includes(".qitqode/bin")||M.includes("fish_add_path"))continue}if(M.startsWith("export PATH=")&&M.includes(".qitqode/bin")||M.startsWith("fish_add_path")&&M.includes(".qitqode"))continue;J.push(O)}while(J.length>0&&J[J.length-1].trim()==="")J.pop();let K=J.join(`
|
|
4
|
+
`)+`
|
|
5
|
+
`;await Y.write(j,K)}async function F(j){let B=0,E=async(J)=>{let H=await V.readdir(J,{withFileTypes:!0}).catch(()=>[]);for(let K of H){let O=L.join(J,K.name);if(K.isDirectory()){await E(O);continue}if(K.isFile()){let M=await V.stat(O).catch(()=>null);if(M)B+=M.size}}};return await E(j),B}function S(j){if(j<1024)return`${j} B`;if(j<1048576)return`${(j/1024).toFixed(1)} KB`;if(j<1073741824)return`${(j/1048576).toFixed(1)} MB`;return`${(j/1073741824).toFixed(1)} GB`}function Z(j){let B=R.homedir();if(j===B||j.startsWith(B+L.sep))return"~"+j.slice(B.length);return j}export{g as UninstallCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Fq as a,Kq as o,Lq as GG,Oq as JG,Sq as NG,Vq as QG,_q as g,ar as v,br as k,hr as b,ir as R,jr as XG,kr as I,or as d,pq as V,rq as l,vq as e,wq as t}from"./chunk-yq3m8190.js";import{Ar as m,Dr as O,qr as f,wr as C}from"./chunk-btz9jvec.js";import"./chunk-cqtkxwd8.js";import"./chunk-fkgv2hqd.js";import{qv as G}from"./chunk-09kba1hg.js";import"./chunk-t12xrrfr.js";import"./chunk-aztre27e.js";function c(J){var Q,$,K,j,z,q;if(J==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let A=(Q=J.prompt_tokens)!=null?Q:0,Z=($=J.completion_tokens)!=null?$:0,N=(j=(K=J.prompt_tokens_details)==null?void 0:K.cached_tokens)!=null?j:0,X=(q=(z=J.completion_tokens_details)==null?void 0:z.reasoning_tokens)!=null?q:0;return{inputTokens:{total:A,noCache:A-N,cacheRead:N,cacheWrite:void 0},outputTokens:{total:Z,text:Z-X,reasoning:X},raw:J}}function _(J){switch(J){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"other"}}function u({id:J,model:Q,created:$}){return{id:J!=null?J:void 0,modelId:Q!=null?Q:void 0,timestamp:$!=null?new Date($*1000):void 0}}function i({tools:J,toolChoice:Q}){J=(J==null?void 0:J.length)?J:void 0;let $=[];if(J==null)return{tools:void 0,toolChoice:void 0,toolWarnings:$};let K=[];for(let z of J)if(z.type==="provider")$.push({type:"unsupported",feature:`provider-defined tool ${z.id}`});else K.push({type:"function",function:{name:z.name,description:z.description,parameters:z.inputSchema,...z.strict!=null?{strict:z.strict}:{}}});if(Q==null)return{tools:K,toolChoice:void 0,toolWarnings:$};let j=Q.type;switch(j){case"auto":case"none":case"required":return{tools:K,toolChoice:j,toolWarnings:$};case"tool":return{tools:K,toolChoice:{type:"function",function:{name:Q.toolName}},toolWarnings:$};default:throw new O({functionality:`tool choice type: ${j}`})}}var $G=G.object({enableThinking:G.boolean().optional(),thinkingBudget:G.number().positive().optional(),parallelToolCalls:G.boolean().optional()});function p(J){var Q,$,K,j;let z=c(J),q=($=(Q=J==null?void 0:J.prompt_tokens_details)==null?void 0:Q.cache_creation_input_tokens)!=null?$:0,A=((K=z.inputTokens.total)!=null?K:0)-((j=z.inputTokens.cacheRead)!=null?j:0)-q;return{...z,inputTokens:{...z.inputTokens,cacheWrite:q,noCache:A}}}function zG({data:J,mediaType:Q}){return J instanceof URL?J.toString():`data:${Q};base64,${t(J)}`}function BG({prompt:J,cacheControlValidator:Q}){var $,K;let j=[];for(let{role:z,content:q,...A}of J){let Z=Q==null?void 0:Q.getCacheControl(A.providerOptions);switch(z){case"system":{if(Z)j.push({role:"system",content:[{type:"text",text:q,cache_control:Z}]});else j.push({role:"system",content:q});break}case"user":{j.push({role:"user",content:q.map((N,X)=>{var E;let L=X===q.length-1,B=(E=Q==null?void 0:Q.getCacheControl(N.providerOptions))!=null?E:L?Z:void 0;switch(N.type){case"text":return{type:"text",text:N.text,...B?{cache_control:B}:{}};case"file":if(N.mediaType.startsWith("image/")){let U=N.mediaType==="image/*"?"image/jpeg":N.mediaType;return{type:"image_url",image_url:{url:zG({data:N.data,mediaType:U})},...B?{cache_control:B}:{}}}else throw new O({functionality:"Only image file parts are supported"})}})});break}case"assistant":{let N="",X=[];for(let E of q)switch(E.type){case"text":{N+=E.text;break}case"tool-call":{X.push({id:E.toolCallId,type:"function",function:{name:E.toolName,arguments:JSON.stringify(E.input)}});break}case"reasoning":{N+=E.text;break}}j.push({role:"assistant",content:Z?[{type:"text",text:N,cache_control:Z}]:N||null,tool_calls:X.length>0?X:void 0});break}case"tool":{let N=q.filter((X)=>X.type!=="tool-approval-response");for(let X=0;X<N.length;X++){let E=N[X],L=E.output,B=X===N.length-1,U=($=Q==null?void 0:Q.getCacheControl(E.providerOptions))!=null?$:B?Z:void 0,Y;switch(L.type){case"text":case"error-text":Y=L.value;break;case"execution-denied":Y=(K=L.reason)!=null?K:"Tool execution denied.";break;case"content":case"json":case"error-json":Y=JSON.stringify(L.value);break}j.push({role:"tool",tool_call_id:E.toolCallId,content:U?[{type:"text",text:Y,cache_control:U}]:Y})}break}default:throw Error(`Unsupported role: ${z}`)}}return j}var r=4;function EG(J){var Q;let $=J==null?void 0:J.alibaba;return(Q=$==null?void 0:$.cacheControl)!=null?Q:$==null?void 0:$.cache_control}var jG=class{constructor(){this.breakpointCount=0,this.warnings=[]}getCacheControl(J){let Q=EG(J);if(!Q)return;if(this.breakpointCount++,this.breakpointCount>r)this.warnings.push({type:"other",message:`Max breakpoint limit exceeded. Only the last ${r} cache markers will take effect.`});return Q}getWarnings(){return this.warnings}},KG=class{constructor(J,Q){this.specificationVersion="v3",this.supportedUrls={"image/*":[/^https?:\/\/.*$/]},this.modelId=J,this.config=Q}get provider(){return this.config.provider}async getArgs({prompt:J,maxOutputTokens:Q,temperature:$,topP:K,topK:j,frequencyPenalty:z,presencePenalty:q,stopSequences:A,responseFormat:Z,seed:N,providerOptions:X,tools:E,toolChoice:L}){var B;let U=[],Y=new jG,P=await v({provider:"alibaba",providerOptions:X,schema:$G});if(z!=null)U.push({type:"unsupported",feature:"frequencyPenalty"});let w={model:this.modelId,max_tokens:Q,temperature:$,top_p:K,top_k:j,presence_penalty:q,stop:A,seed:N,response_format:(Z==null?void 0:Z.type)==="json"?Z.schema!=null?{type:"json_schema",json_schema:{schema:Z.schema,name:(B=Z.name)!=null?B:"response",description:Z.description}}:{type:"json_object"}:void 0,...(P==null?void 0:P.enableThinking)!=null?{enable_thinking:P.enableThinking}:{},...(P==null?void 0:P.thinkingBudget)!=null?{thinking_budget:P.thinkingBudget}:{},messages:BG({prompt:J,cacheControlValidator:Y})},{tools:y,toolChoice:S,toolWarnings:F}=i({tools:E,toolChoice:L});return U.push(...Y.getWarnings()),{args:{...w,tools:y,tool_choice:S,...y!=null&&(P==null?void 0:P.parallelToolCalls)!==void 0?{parallel_tool_calls:P.parallelToolCalls}:{}},warnings:[...U,...F]}}async doGenerate(J){var Q;let{args:$,warnings:K}=await this.getArgs(J),{responseHeaders:j,value:z,rawValue:q}=await k({url:`${this.config.baseURL}/chat/completions`,headers:V(this.config.headers(),J.headers),body:$,failedResponseHandler:s,successfulResponseHandler:I(qG),abortSignal:J.abortSignal,fetch:this.config.fetch}),A=z.choices[0],Z=[],N=A.message.content;if(N!=null&&N.length>0)Z.push({type:"text",text:N});let X=A.message.reasoning_content;if(X!=null&&X.length>0)Z.push({type:"reasoning",text:X});if(A.message.tool_calls!=null)for(let E of A.message.tool_calls)Z.push({type:"tool-call",toolCallId:E.id,toolName:E.function.name,input:E.function.arguments});return{content:Z,finishReason:{unified:_(A.finish_reason),raw:(Q=A.finish_reason)!=null?Q:void 0},usage:p(z.usage),request:{body:JSON.stringify($)},response:{...u(z),headers:j,body:q},warnings:K}}async doStream(J){let{args:Q,warnings:$}=await this.getArgs(J),K={...Q,stream:!0,stream_options:this.config.includeUsage?{include_usage:!0}:void 0},{responseHeaders:j,value:z}=await k({url:`${this.config.baseURL}/chat/completions`,headers:V(this.config.headers(),J.headers),body:K,failedResponseHandler:s,successfulResponseHandler:XG(AG),abortSignal:J.abortSignal,fetch:this.config.fetch}),q={unified:"other",raw:void 0},A=void 0,Z=!0,N=!1,X=null,E=[];return{stream:z.pipeThrough(new TransformStream({start(L){L.enqueue({type:"stream-start",warnings:$})},transform(L,B){var U,Y,P,w;if(J.includeRawChunks)B.enqueue({type:"raw",rawValue:L.rawValue});if(!L.success){B.enqueue({type:"error",error:L.error});return}let y=L.value;if(Z)Z=!1,B.enqueue({type:"response-metadata",...u(y)});if(y.usage!=null)A=y.usage;if(y.choices.length===0)return;let S=y.choices[0],F=S.delta;if(F.reasoning_content!=null&&F.reasoning_content.length>0){if(X==null){if(N)B.enqueue({type:"text-end",id:"0"}),N=!1;X=a(),B.enqueue({type:"reasoning-start",id:X})}B.enqueue({type:"reasoning-delta",id:X,delta:F.reasoning_content})}if(F.content!=null&&F.content.length>0){if(X!=null)B.enqueue({type:"reasoning-end",id:X}),X=null;if(!N)B.enqueue({type:"text-start",id:"0"}),N=!0;B.enqueue({type:"text-delta",id:"0",delta:F.content})}if(F.tool_calls!=null){if(X!=null)B.enqueue({type:"reasoning-end",id:X}),X=null;if(N)B.enqueue({type:"text-end",id:"0"}),N=!1;for(let W of F.tool_calls){let M=(U=W.index)!=null?U:E.length;if(E[M]==null){if(W.id==null)throw new C({data:W,message:"Expected 'id' to be a string."});if(((Y=W.function)==null?void 0:Y.name)==null)throw new C({data:W,message:"Expected 'function.name' to be a string."});B.enqueue({type:"tool-input-start",id:W.id,toolName:W.function.name}),E[M]={id:W.id,type:"function",function:{name:W.function.name,arguments:(P=W.function.arguments)!=null?P:""},hasFinished:!1};let D=E[M];if(D.function.arguments.length>0)B.enqueue({type:"tool-input-delta",id:D.id,delta:D.function.arguments});if(g(D.function.arguments))B.enqueue({type:"tool-input-end",id:D.id}),B.enqueue({type:"tool-call",toolCallId:D.id,toolName:D.function.name,input:D.function.arguments}),D.hasFinished=!0;continue}let H=E[M];if(H.hasFinished)continue;if(((w=W.function)==null?void 0:w.arguments)!=null)H.function.arguments+=W.function.arguments,B.enqueue({type:"tool-input-delta",id:H.id,delta:W.function.arguments});if(g(H.function.arguments))B.enqueue({type:"tool-input-end",id:H.id}),B.enqueue({type:"tool-call",toolCallId:H.id,toolName:H.function.name,input:H.function.arguments}),H.hasFinished=!0}}if(S.finish_reason!=null)q={unified:_(S.finish_reason),raw:S.finish_reason}},flush(L){if(X!=null)L.enqueue({type:"reasoning-end",id:X});if(N)L.enqueue({type:"text-end",id:"0"});L.enqueue({type:"finish",finishReason:q,usage:p(A)})}})),request:{body:JSON.stringify(K)},response:{headers:j}}}},YG=G.object({prompt_tokens:G.number(),completion_tokens:G.number(),total_tokens:G.number(),prompt_tokens_details:G.object({cached_tokens:G.number().nullish(),cache_creation_input_tokens:G.number().nullish()}).nullish(),completion_tokens_details:G.object({reasoning_tokens:G.number().nullish()}).nullish()}),qG=G.object({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({message:G.object({role:G.literal("assistant").nullish(),content:G.string().nullish(),reasoning_content:G.string().nullish(),tool_calls:G.array(G.object({id:G.string(),type:G.literal("function"),function:G.object({name:G.string(),arguments:G.string()})})).nullish()}),finish_reason:G.string().nullish(),index:G.number()})),usage:YG.nullish()}),AG=G.object({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({delta:G.object({role:G.enum(["assistant"]).nullish(),content:G.string().nullish(),reasoning_content:G.string().nullish(),tool_calls:G.array(G.object({index:G.number().nullish(),id:G.string().nullish(),type:G.literal("function").nullish(),function:G.object({name:G.string().nullish(),arguments:G.string().nullish()}).nullish()})).nullish()}),finish_reason:G.string().nullish(),index:G.number()})),usage:YG.nullish()}),HG=NG(()=>QG(G.object({negativePrompt:G.string().nullish(),audioUrl:G.string().nullish(),promptExtend:G.boolean().nullish(),shotType:G.enum(["single","multi"]).nullish(),watermark:G.boolean().nullish(),audio:G.boolean().nullish(),referenceUrls:G.array(G.string()).nullish(),pollIntervalMs:G.number().positive().nullish(),pollTimeoutMs:G.number().positive().nullish()}).passthrough())),LG=G.object({code:G.string().nullish(),message:G.string(),request_id:G.string().nullish()}),n=R({errorSchema:LG,errorToMessage:(J)=>J.message}),PG=G.object({output:G.object({task_status:G.string(),task_id:G.string()}).nullish(),request_id:G.string().nullish()}),WG=G.object({output:G.object({task_id:G.string(),task_status:G.string(),video_url:G.string().nullish(),submit_time:G.string().nullish(),scheduled_time:G.string().nullish(),end_time:G.string().nullish(),orig_prompt:G.string().nullish(),actual_prompt:G.string().nullish(),code:G.string().nullish(),message:G.string().nullish()}).nullish(),usage:G.object({duration:G.number().nullish(),output_video_duration:G.number().nullish(),SR:G.number().nullish(),size:G.string().nullish()}).nullish(),request_id:G.string().nullish()});function UG(J){if(J.includes("-i2v"))return"i2v";if(J.includes("-r2v"))return"r2v";return"t2v"}var wG=class{constructor(J,Q){this.modelId=J,this.config=Q,this.specificationVersion="v3",this.maxVideosPerCall=1}get provider(){return this.config.provider}async doGenerate(J){var Q,$,K,j,z,q,A,Z,N,X,E;let L=(K=($=(Q=this.config._internal)==null?void 0:Q.currentDate)==null?void 0:$.call(Q))!=null?K:new Date,B=[],U=UG(this.modelId),Y=await v({provider:"alibaba",providerOptions:J.providerOptions,schema:HG}),P={};if(J.prompt!=null)P.prompt=J.prompt;if((Y==null?void 0:Y.negativePrompt)!=null)P.negative_prompt=Y.negativePrompt;if((Y==null?void 0:Y.audioUrl)!=null)P.audio_url=Y.audioUrl;if(U==="i2v"&&J.image!=null)if(J.image.type==="url")P.img_url=J.image.url;else{let x=typeof J.image.data==="string"?J.image.data:e(J.image.data);P.img_url=x}if(U==="r2v"&&(Y==null?void 0:Y.referenceUrls)!=null)P.reference_urls=Y.referenceUrls;let w={};if(J.duration!=null)w.duration=J.duration;if(J.seed!=null)w.seed=J.seed;if(J.resolution!=null)if(U==="i2v"){let x={"1280x720":"720P","720x1280":"720P","960x960":"720P","1088x832":"720P","832x1088":"720P","1920x1080":"1080P","1080x1920":"1080P","1440x1440":"1080P","1632x1248":"1080P","1248x1632":"1080P","832x480":"480P","480x832":"480P","624x624":"480P"};w.resolution=x[J.resolution]||J.resolution}else w.size=J.resolution.replace("x","*");if((Y==null?void 0:Y.promptExtend)!=null)w.prompt_extend=Y.promptExtend;if((Y==null?void 0:Y.shotType)!=null)w.shot_type=Y.shotType;if((Y==null?void 0:Y.watermark)!=null)w.watermark=Y.watermark;if((Y==null?void 0:Y.audio)!=null)w.audio=Y.audio;if(J.aspectRatio)B.push({type:"unsupported",feature:"aspectRatio",details:"Alibaba video models use explicit size/resolution dimensions. Use the resolution option or providerOptions.alibaba for size control."});if(J.fps)B.push({type:"unsupported",feature:"fps",details:"Alibaba video models do not support custom FPS."});if(J.n!=null&&J.n>1)B.push({type:"unsupported",feature:"n",details:"Alibaba video models only support generating 1 video per call."});let{value:y}=await k({url:`${this.config.baseURL}/api/v1/services/aigc/video-generation/video-synthesis`,headers:V(await b(this.config.headers),J.headers,{"X-DashScope-Async":"enable"}),body:{model:this.modelId,input:P,parameters:w},successfulResponseHandler:I(PG),failedResponseHandler:n,abortSignal:J.abortSignal,fetch:this.config.fetch}),S=(j=y.output)==null?void 0:j.task_id;if(!S)throw new f({name:"ALIBABA_VIDEO_GENERATION_ERROR",message:`No task_id returned from Alibaba API. Response: ${JSON.stringify(y)}`});let F=(z=Y==null?void 0:Y.pollIntervalMs)!=null?z:5000,W=(q=Y==null?void 0:Y.pollTimeoutMs)!=null?q:600000,M=Date.now(),H,D;while(!0){if(await l(F,{abortSignal:J.abortSignal}),Date.now()-M>W)throw new f({name:"ALIBABA_VIDEO_GENERATION_TIMEOUT",message:`Video generation timed out after ${W}ms`});let{value:x,responseHeaders:ZG}=await GG({url:`${this.config.baseURL}/api/v1/tasks/${S}`,headers:V(await b(this.config.headers),J.headers),successfulResponseHandler:I(WG),failedResponseHandler:n,abortSignal:J.abortSignal,fetch:this.config.fetch});D=ZG;let T=(A=x.output)==null?void 0:A.task_status;if(T==="SUCCEEDED"){H=x;break}if(T==="FAILED"||T==="CANCELED")throw new f({name:"ALIBABA_VIDEO_GENERATION_FAILED",message:`Video generation ${T.toLowerCase()}. Task ID: ${S}. ${(N=(Z=x.output)==null?void 0:Z.message)!=null?N:""}`})}let h=(X=H==null?void 0:H.output)==null?void 0:X.video_url;if(!h)throw new f({name:"ALIBABA_VIDEO_GENERATION_ERROR",message:`No video URL in response. Task ID: ${S}`});return{videos:[{type:"url",url:h,mediaType:"video/mp4"}],warnings:B,response:{timestamp:L,modelId:this.modelId,headers:D},providerMetadata:{alibaba:{taskId:S,videoUrl:h,...((E=H==null?void 0:H.output)==null?void 0:E.actual_prompt)?{actualPrompt:H.output.actual_prompt}:{},...(H==null?void 0:H.usage)?{usage:{duration:H.usage.duration,outputVideoDuration:H.usage.output_video_duration,resolution:H.usage.SR,size:H.usage.size}}:{}}}}}},SG="1.0.17",FG=G.object({error:G.object({message:G.string(),code:G.string().nullish(),type:G.string().nullish()})}),s=R({errorSchema:FG,errorToMessage:(J)=>J.error.message});function DG(J={}){var Q,$;let K=(Q=d(J.baseURL))!=null?Q:"https://dashscope-intl.aliyuncs.com/compatible-mode/v1",j=($=d(J.videoBaseURL))!=null?$:"https://dashscope-intl.aliyuncs.com",z=()=>o({Authorization:`Bearer ${JG({apiKey:J.apiKey,environmentVariableName:"ALIBABA_API_KEY",description:"Alibaba Cloud (DashScope)"})}`,...J.headers},`ai-sdk/alibaba/${SG}`),q=(N)=>{var X;return new KG(N,{provider:"alibaba.chat",baseURL:K,headers:z,fetch:J.fetch,includeUsage:(X=J.includeUsage)!=null?X:!0})},A=(N)=>new wG(N,{provider:"alibaba.video",baseURL:j,headers:z,fetch:J.fetch}),Z=function(N){if(new.target)throw Error("The Alibaba model function cannot be called with the new keyword.");return q(N)};return Z.specificationVersion="v3",Z.languageModel=q,Z.chatModel=q,Z.video=A,Z.videoModel=A,Z.imageModel=(N)=>{throw new m({modelId:N,modelType:"imageModel"})},Z.embeddingModel=(N)=>{throw new m({modelId:N,modelType:"embeddingModel"})},Z}var gG=DG();export{DG as createAlibaba,gG as alibaba,SG as VERSION};
|
|
2
|
+
import{Ap as g,Cp as v,Dp as k,Jp as b,Kp as R,Lp as XG,Mp as I,Qp as d,Ro as V,To as l,Xo as e,Yo as t,fp as a,kp as o,lp as GG,op as JG,sp as NG,vp as QG}from"./chunk-2maqde7w.js";import{Sp as f,Yp as C,aq as m,dq as O}from"./chunk-kj20f048.js";import"./chunk-cqtkxwd8.js";import"./chunk-x9rbv6p6.js";import{St as G}from"./chunk-c11d28qn.js";import"./chunk-mzs2pjyc.js";import"./chunk-7xm75w1e.js";function c(J){var Q,$,K,j,z,q;if(J==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let A=(Q=J.prompt_tokens)!=null?Q:0,Z=($=J.completion_tokens)!=null?$:0,N=(j=(K=J.prompt_tokens_details)==null?void 0:K.cached_tokens)!=null?j:0,X=(q=(z=J.completion_tokens_details)==null?void 0:z.reasoning_tokens)!=null?q:0;return{inputTokens:{total:A,noCache:A-N,cacheRead:N,cacheWrite:void 0},outputTokens:{total:Z,text:Z-X,reasoning:X},raw:J}}function _(J){switch(J){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"other"}}function u({id:J,model:Q,created:$}){return{id:J!=null?J:void 0,modelId:Q!=null?Q:void 0,timestamp:$!=null?new Date($*1000):void 0}}function i({tools:J,toolChoice:Q}){J=(J==null?void 0:J.length)?J:void 0;let $=[];if(J==null)return{tools:void 0,toolChoice:void 0,toolWarnings:$};let K=[];for(let z of J)if(z.type==="provider")$.push({type:"unsupported",feature:`provider-defined tool ${z.id}`});else K.push({type:"function",function:{name:z.name,description:z.description,parameters:z.inputSchema,...z.strict!=null?{strict:z.strict}:{}}});if(Q==null)return{tools:K,toolChoice:void 0,toolWarnings:$};let j=Q.type;switch(j){case"auto":case"none":case"required":return{tools:K,toolChoice:j,toolWarnings:$};case"tool":return{tools:K,toolChoice:{type:"function",function:{name:Q.toolName}},toolWarnings:$};default:throw new O({functionality:`tool choice type: ${j}`})}}var $G=G.object({enableThinking:G.boolean().optional(),thinkingBudget:G.number().positive().optional(),parallelToolCalls:G.boolean().optional()});function p(J){var Q,$,K,j;let z=c(J),q=($=(Q=J==null?void 0:J.prompt_tokens_details)==null?void 0:Q.cache_creation_input_tokens)!=null?$:0,A=((K=z.inputTokens.total)!=null?K:0)-((j=z.inputTokens.cacheRead)!=null?j:0)-q;return{...z,inputTokens:{...z.inputTokens,cacheWrite:q,noCache:A}}}function zG({data:J,mediaType:Q}){return J instanceof URL?J.toString():`data:${Q};base64,${t(J)}`}function BG({prompt:J,cacheControlValidator:Q}){var $,K;let j=[];for(let{role:z,content:q,...A}of J){let Z=Q==null?void 0:Q.getCacheControl(A.providerOptions);switch(z){case"system":{if(Z)j.push({role:"system",content:[{type:"text",text:q,cache_control:Z}]});else j.push({role:"system",content:q});break}case"user":{j.push({role:"user",content:q.map((N,X)=>{var E;let L=X===q.length-1,B=(E=Q==null?void 0:Q.getCacheControl(N.providerOptions))!=null?E:L?Z:void 0;switch(N.type){case"text":return{type:"text",text:N.text,...B?{cache_control:B}:{}};case"file":if(N.mediaType.startsWith("image/")){let U=N.mediaType==="image/*"?"image/jpeg":N.mediaType;return{type:"image_url",image_url:{url:zG({data:N.data,mediaType:U})},...B?{cache_control:B}:{}}}else throw new O({functionality:"Only image file parts are supported"})}})});break}case"assistant":{let N="",X=[];for(let E of q)switch(E.type){case"text":{N+=E.text;break}case"tool-call":{X.push({id:E.toolCallId,type:"function",function:{name:E.toolName,arguments:JSON.stringify(E.input)}});break}case"reasoning":{N+=E.text;break}}j.push({role:"assistant",content:Z?[{type:"text",text:N,cache_control:Z}]:N||null,tool_calls:X.length>0?X:void 0});break}case"tool":{let N=q.filter((X)=>X.type!=="tool-approval-response");for(let X=0;X<N.length;X++){let E=N[X],L=E.output,B=X===N.length-1,U=($=Q==null?void 0:Q.getCacheControl(E.providerOptions))!=null?$:B?Z:void 0,Y;switch(L.type){case"text":case"error-text":Y=L.value;break;case"execution-denied":Y=(K=L.reason)!=null?K:"Tool execution denied.";break;case"content":case"json":case"error-json":Y=JSON.stringify(L.value);break}j.push({role:"tool",tool_call_id:E.toolCallId,content:U?[{type:"text",text:Y,cache_control:U}]:Y})}break}default:throw Error(`Unsupported role: ${z}`)}}return j}var r=4;function EG(J){var Q;let $=J==null?void 0:J.alibaba;return(Q=$==null?void 0:$.cacheControl)!=null?Q:$==null?void 0:$.cache_control}var jG=class{constructor(){this.breakpointCount=0,this.warnings=[]}getCacheControl(J){let Q=EG(J);if(!Q)return;if(this.breakpointCount++,this.breakpointCount>r)this.warnings.push({type:"other",message:`Max breakpoint limit exceeded. Only the last ${r} cache markers will take effect.`});return Q}getWarnings(){return this.warnings}},KG=class{constructor(J,Q){this.specificationVersion="v3",this.supportedUrls={"image/*":[/^https?:\/\/.*$/]},this.modelId=J,this.config=Q}get provider(){return this.config.provider}async getArgs({prompt:J,maxOutputTokens:Q,temperature:$,topP:K,topK:j,frequencyPenalty:z,presencePenalty:q,stopSequences:A,responseFormat:Z,seed:N,providerOptions:X,tools:E,toolChoice:L}){var B;let U=[],Y=new jG,P=await v({provider:"alibaba",providerOptions:X,schema:$G});if(z!=null)U.push({type:"unsupported",feature:"frequencyPenalty"});let w={model:this.modelId,max_tokens:Q,temperature:$,top_p:K,top_k:j,presence_penalty:q,stop:A,seed:N,response_format:(Z==null?void 0:Z.type)==="json"?Z.schema!=null?{type:"json_schema",json_schema:{schema:Z.schema,name:(B=Z.name)!=null?B:"response",description:Z.description}}:{type:"json_object"}:void 0,...(P==null?void 0:P.enableThinking)!=null?{enable_thinking:P.enableThinking}:{},...(P==null?void 0:P.thinkingBudget)!=null?{thinking_budget:P.thinkingBudget}:{},messages:BG({prompt:J,cacheControlValidator:Y})},{tools:y,toolChoice:S,toolWarnings:F}=i({tools:E,toolChoice:L});return U.push(...Y.getWarnings()),{args:{...w,tools:y,tool_choice:S,...y!=null&&(P==null?void 0:P.parallelToolCalls)!==void 0?{parallel_tool_calls:P.parallelToolCalls}:{}},warnings:[...U,...F]}}async doGenerate(J){var Q;let{args:$,warnings:K}=await this.getArgs(J),{responseHeaders:j,value:z,rawValue:q}=await k({url:`${this.config.baseURL}/chat/completions`,headers:V(this.config.headers(),J.headers),body:$,failedResponseHandler:s,successfulResponseHandler:I(qG),abortSignal:J.abortSignal,fetch:this.config.fetch}),A=z.choices[0],Z=[],N=A.message.content;if(N!=null&&N.length>0)Z.push({type:"text",text:N});let X=A.message.reasoning_content;if(X!=null&&X.length>0)Z.push({type:"reasoning",text:X});if(A.message.tool_calls!=null)for(let E of A.message.tool_calls)Z.push({type:"tool-call",toolCallId:E.id,toolName:E.function.name,input:E.function.arguments});return{content:Z,finishReason:{unified:_(A.finish_reason),raw:(Q=A.finish_reason)!=null?Q:void 0},usage:p(z.usage),request:{body:JSON.stringify($)},response:{...u(z),headers:j,body:q},warnings:K}}async doStream(J){let{args:Q,warnings:$}=await this.getArgs(J),K={...Q,stream:!0,stream_options:this.config.includeUsage?{include_usage:!0}:void 0},{responseHeaders:j,value:z}=await k({url:`${this.config.baseURL}/chat/completions`,headers:V(this.config.headers(),J.headers),body:K,failedResponseHandler:s,successfulResponseHandler:XG(AG),abortSignal:J.abortSignal,fetch:this.config.fetch}),q={unified:"other",raw:void 0},A=void 0,Z=!0,N=!1,X=null,E=[];return{stream:z.pipeThrough(new TransformStream({start(L){L.enqueue({type:"stream-start",warnings:$})},transform(L,B){var U,Y,P,w;if(J.includeRawChunks)B.enqueue({type:"raw",rawValue:L.rawValue});if(!L.success){B.enqueue({type:"error",error:L.error});return}let y=L.value;if(Z)Z=!1,B.enqueue({type:"response-metadata",...u(y)});if(y.usage!=null)A=y.usage;if(y.choices.length===0)return;let S=y.choices[0],F=S.delta;if(F.reasoning_content!=null&&F.reasoning_content.length>0){if(X==null){if(N)B.enqueue({type:"text-end",id:"0"}),N=!1;X=a(),B.enqueue({type:"reasoning-start",id:X})}B.enqueue({type:"reasoning-delta",id:X,delta:F.reasoning_content})}if(F.content!=null&&F.content.length>0){if(X!=null)B.enqueue({type:"reasoning-end",id:X}),X=null;if(!N)B.enqueue({type:"text-start",id:"0"}),N=!0;B.enqueue({type:"text-delta",id:"0",delta:F.content})}if(F.tool_calls!=null){if(X!=null)B.enqueue({type:"reasoning-end",id:X}),X=null;if(N)B.enqueue({type:"text-end",id:"0"}),N=!1;for(let W of F.tool_calls){let M=(U=W.index)!=null?U:E.length;if(E[M]==null){if(W.id==null)throw new C({data:W,message:"Expected 'id' to be a string."});if(((Y=W.function)==null?void 0:Y.name)==null)throw new C({data:W,message:"Expected 'function.name' to be a string."});B.enqueue({type:"tool-input-start",id:W.id,toolName:W.function.name}),E[M]={id:W.id,type:"function",function:{name:W.function.name,arguments:(P=W.function.arguments)!=null?P:""},hasFinished:!1};let D=E[M];if(D.function.arguments.length>0)B.enqueue({type:"tool-input-delta",id:D.id,delta:D.function.arguments});if(g(D.function.arguments))B.enqueue({type:"tool-input-end",id:D.id}),B.enqueue({type:"tool-call",toolCallId:D.id,toolName:D.function.name,input:D.function.arguments}),D.hasFinished=!0;continue}let H=E[M];if(H.hasFinished)continue;if(((w=W.function)==null?void 0:w.arguments)!=null)H.function.arguments+=W.function.arguments,B.enqueue({type:"tool-input-delta",id:H.id,delta:W.function.arguments});if(g(H.function.arguments))B.enqueue({type:"tool-input-end",id:H.id}),B.enqueue({type:"tool-call",toolCallId:H.id,toolName:H.function.name,input:H.function.arguments}),H.hasFinished=!0}}if(S.finish_reason!=null)q={unified:_(S.finish_reason),raw:S.finish_reason}},flush(L){if(X!=null)L.enqueue({type:"reasoning-end",id:X});if(N)L.enqueue({type:"text-end",id:"0"});L.enqueue({type:"finish",finishReason:q,usage:p(A)})}})),request:{body:JSON.stringify(K)},response:{headers:j}}}},YG=G.object({prompt_tokens:G.number(),completion_tokens:G.number(),total_tokens:G.number(),prompt_tokens_details:G.object({cached_tokens:G.number().nullish(),cache_creation_input_tokens:G.number().nullish()}).nullish(),completion_tokens_details:G.object({reasoning_tokens:G.number().nullish()}).nullish()}),qG=G.object({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({message:G.object({role:G.literal("assistant").nullish(),content:G.string().nullish(),reasoning_content:G.string().nullish(),tool_calls:G.array(G.object({id:G.string(),type:G.literal("function"),function:G.object({name:G.string(),arguments:G.string()})})).nullish()}),finish_reason:G.string().nullish(),index:G.number()})),usage:YG.nullish()}),AG=G.object({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({delta:G.object({role:G.enum(["assistant"]).nullish(),content:G.string().nullish(),reasoning_content:G.string().nullish(),tool_calls:G.array(G.object({index:G.number().nullish(),id:G.string().nullish(),type:G.literal("function").nullish(),function:G.object({name:G.string().nullish(),arguments:G.string().nullish()}).nullish()})).nullish()}),finish_reason:G.string().nullish(),index:G.number()})),usage:YG.nullish()}),HG=NG(()=>QG(G.object({negativePrompt:G.string().nullish(),audioUrl:G.string().nullish(),promptExtend:G.boolean().nullish(),shotType:G.enum(["single","multi"]).nullish(),watermark:G.boolean().nullish(),audio:G.boolean().nullish(),referenceUrls:G.array(G.string()).nullish(),pollIntervalMs:G.number().positive().nullish(),pollTimeoutMs:G.number().positive().nullish()}).passthrough())),LG=G.object({code:G.string().nullish(),message:G.string(),request_id:G.string().nullish()}),n=R({errorSchema:LG,errorToMessage:(J)=>J.message}),PG=G.object({output:G.object({task_status:G.string(),task_id:G.string()}).nullish(),request_id:G.string().nullish()}),WG=G.object({output:G.object({task_id:G.string(),task_status:G.string(),video_url:G.string().nullish(),submit_time:G.string().nullish(),scheduled_time:G.string().nullish(),end_time:G.string().nullish(),orig_prompt:G.string().nullish(),actual_prompt:G.string().nullish(),code:G.string().nullish(),message:G.string().nullish()}).nullish(),usage:G.object({duration:G.number().nullish(),output_video_duration:G.number().nullish(),SR:G.number().nullish(),size:G.string().nullish()}).nullish(),request_id:G.string().nullish()});function UG(J){if(J.includes("-i2v"))return"i2v";if(J.includes("-r2v"))return"r2v";return"t2v"}var wG=class{constructor(J,Q){this.modelId=J,this.config=Q,this.specificationVersion="v3",this.maxVideosPerCall=1}get provider(){return this.config.provider}async doGenerate(J){var Q,$,K,j,z,q,A,Z,N,X,E;let L=(K=($=(Q=this.config._internal)==null?void 0:Q.currentDate)==null?void 0:$.call(Q))!=null?K:new Date,B=[],U=UG(this.modelId),Y=await v({provider:"alibaba",providerOptions:J.providerOptions,schema:HG}),P={};if(J.prompt!=null)P.prompt=J.prompt;if((Y==null?void 0:Y.negativePrompt)!=null)P.negative_prompt=Y.negativePrompt;if((Y==null?void 0:Y.audioUrl)!=null)P.audio_url=Y.audioUrl;if(U==="i2v"&&J.image!=null)if(J.image.type==="url")P.img_url=J.image.url;else{let x=typeof J.image.data==="string"?J.image.data:e(J.image.data);P.img_url=x}if(U==="r2v"&&(Y==null?void 0:Y.referenceUrls)!=null)P.reference_urls=Y.referenceUrls;let w={};if(J.duration!=null)w.duration=J.duration;if(J.seed!=null)w.seed=J.seed;if(J.resolution!=null)if(U==="i2v"){let x={"1280x720":"720P","720x1280":"720P","960x960":"720P","1088x832":"720P","832x1088":"720P","1920x1080":"1080P","1080x1920":"1080P","1440x1440":"1080P","1632x1248":"1080P","1248x1632":"1080P","832x480":"480P","480x832":"480P","624x624":"480P"};w.resolution=x[J.resolution]||J.resolution}else w.size=J.resolution.replace("x","*");if((Y==null?void 0:Y.promptExtend)!=null)w.prompt_extend=Y.promptExtend;if((Y==null?void 0:Y.shotType)!=null)w.shot_type=Y.shotType;if((Y==null?void 0:Y.watermark)!=null)w.watermark=Y.watermark;if((Y==null?void 0:Y.audio)!=null)w.audio=Y.audio;if(J.aspectRatio)B.push({type:"unsupported",feature:"aspectRatio",details:"Alibaba video models use explicit size/resolution dimensions. Use the resolution option or providerOptions.alibaba for size control."});if(J.fps)B.push({type:"unsupported",feature:"fps",details:"Alibaba video models do not support custom FPS."});if(J.n!=null&&J.n>1)B.push({type:"unsupported",feature:"n",details:"Alibaba video models only support generating 1 video per call."});let{value:y}=await k({url:`${this.config.baseURL}/api/v1/services/aigc/video-generation/video-synthesis`,headers:V(await b(this.config.headers),J.headers,{"X-DashScope-Async":"enable"}),body:{model:this.modelId,input:P,parameters:w},successfulResponseHandler:I(PG),failedResponseHandler:n,abortSignal:J.abortSignal,fetch:this.config.fetch}),S=(j=y.output)==null?void 0:j.task_id;if(!S)throw new f({name:"ALIBABA_VIDEO_GENERATION_ERROR",message:`No task_id returned from Alibaba API. Response: ${JSON.stringify(y)}`});let F=(z=Y==null?void 0:Y.pollIntervalMs)!=null?z:5000,W=(q=Y==null?void 0:Y.pollTimeoutMs)!=null?q:600000,M=Date.now(),H,D;while(!0){if(await l(F,{abortSignal:J.abortSignal}),Date.now()-M>W)throw new f({name:"ALIBABA_VIDEO_GENERATION_TIMEOUT",message:`Video generation timed out after ${W}ms`});let{value:x,responseHeaders:ZG}=await GG({url:`${this.config.baseURL}/api/v1/tasks/${S}`,headers:V(await b(this.config.headers),J.headers),successfulResponseHandler:I(WG),failedResponseHandler:n,abortSignal:J.abortSignal,fetch:this.config.fetch});D=ZG;let T=(A=x.output)==null?void 0:A.task_status;if(T==="SUCCEEDED"){H=x;break}if(T==="FAILED"||T==="CANCELED")throw new f({name:"ALIBABA_VIDEO_GENERATION_FAILED",message:`Video generation ${T.toLowerCase()}. Task ID: ${S}. ${(N=(Z=x.output)==null?void 0:Z.message)!=null?N:""}`})}let h=(X=H==null?void 0:H.output)==null?void 0:X.video_url;if(!h)throw new f({name:"ALIBABA_VIDEO_GENERATION_ERROR",message:`No video URL in response. Task ID: ${S}`});return{videos:[{type:"url",url:h,mediaType:"video/mp4"}],warnings:B,response:{timestamp:L,modelId:this.modelId,headers:D},providerMetadata:{alibaba:{taskId:S,videoUrl:h,...((E=H==null?void 0:H.output)==null?void 0:E.actual_prompt)?{actualPrompt:H.output.actual_prompt}:{},...(H==null?void 0:H.usage)?{usage:{duration:H.usage.duration,outputVideoDuration:H.usage.output_video_duration,resolution:H.usage.SR,size:H.usage.size}}:{}}}}}},SG="1.0.17",FG=G.object({error:G.object({message:G.string(),code:G.string().nullish(),type:G.string().nullish()})}),s=R({errorSchema:FG,errorToMessage:(J)=>J.error.message});function DG(J={}){var Q,$;let K=(Q=d(J.baseURL))!=null?Q:"https://dashscope-intl.aliyuncs.com/compatible-mode/v1",j=($=d(J.videoBaseURL))!=null?$:"https://dashscope-intl.aliyuncs.com",z=()=>o({Authorization:`Bearer ${JG({apiKey:J.apiKey,environmentVariableName:"ALIBABA_API_KEY",description:"Alibaba Cloud (DashScope)"})}`,...J.headers},`ai-sdk/alibaba/${SG}`),q=(N)=>{var X;return new KG(N,{provider:"alibaba.chat",baseURL:K,headers:z,fetch:J.fetch,includeUsage:(X=J.includeUsage)!=null?X:!0})},A=(N)=>new wG(N,{provider:"alibaba.video",baseURL:j,headers:z,fetch:J.fetch}),Z=function(N){if(new.target)throw Error("The Alibaba model function cannot be called with the new keyword.");return q(N)};return Z.specificationVersion="v3",Z.languageModel=q,Z.chatModel=q,Z.video=A,Z.videoModel=A,Z.imageModel=(N)=>{throw new m({modelId:N,modelType:"imageModel"})},Z.embeddingModel=(N)=>{throw new m({modelId:N,modelType:"embeddingModel"})},Z}var gG=DG();export{DG as createAlibaba,gG as alibaba,SG as VERSION};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Cd as H,Dd as I}from"./chunk-s9ntkjz3.js";import{Rd as G}from"./chunk-yajd975f.js";import{Of as B}from"./chunk-c1vnp55z.js";import{ag as E}from"./chunk-pctt1qv8.js";import"./chunk-11x3t2tt.js";import"./chunk-68yw2hk9.js";import"./chunk-takew94z.js";import"./chunk-cjww2jmv.js";import"./chunk-nfg7nt13.js";import"./chunk-xvwvd4kq.js";import"./chunk-qbc36nbb.js";import"./chunk-fq0x3esz.js";import"./chunk-44a82dg0.js";import"./chunk-vxyy2dp3.js";import"./chunk-yp5bypsp.js";import"./chunk-7hm0c2yg.js";import"./chunk-gj0wt0cy.js";import"./chunk-5hw6xa49.js";import"./chunk-326p5b10.js";import"./chunk-04n2ycg5.js";import"./chunk-8ymffyep.js";import"./chunk-mcg24gkb.js";import"./chunk-redjxn13.js";import"./chunk-bn0h9dny.js";import"./chunk-r4ndwym0.js";import"./chunk-3ytjm3az.js";import"./chunk-htz93dsd.js";import"./chunk-vcw00k0n.js";import{qo as D}from"./chunk-r78czx4d.js";import"./chunk-2hc5z7b5.js";import"./chunk-d68fzyw7.js";import"./chunk-4jtxtkj7.js";import"./chunk-ay8emwym.js";import"./chunk-2maqde7w.js";import"./chunk-kj20f048.js";import"./chunk-cqtkxwd8.js";import"./chunk-x9rbv6p6.js";import"./chunk-g5rabwre.js";import"./chunk-jbx3s7nw.js";import"./chunk-15hw2z9t.js";import"./chunk-48ge2ryx.js";import"./chunk-n9xns8by.js";import"./chunk-y9q0hb7b.js";import"./chunk-c1bdzxbx.js";import"./chunk-ehhas0ew.js";import"./chunk-d6ry9418.js";import"./chunk-0dt0bxz6.js";import"./chunk-10bjs581.js";import"./chunk-4cnwn1rh.js";import"./chunk-gcw4rn10.js";import{Rs as f}from"./chunk-m5m448mg.js";import"./chunk-tqj69nh6.js";import"./chunk-ag8kz1e7.js";import"./chunk-5tray1fw.js";import"./chunk-c11d28qn.js";import"./chunk-mzs2pjyc.js";import"./chunk-gagtmjmp.js";import"./chunk-zs8kqdsf.js";import"./chunk-dxpj0cxh.js";import"./chunk-zw815d68.js";import"./chunk-7xm75w1e.js";var T=G({command:"serve",builder:(b)=>B(b).option("auto-password",{type:"boolean",default:!1,describe:"generate a random ephemeral QITQODE_SERVER_PASSWORD for this run and print it"}),describe:"starts a headless qitqode server",handler:async(b)=>{let A=await H(b);if(b["auto-password"]&&!f.QITQODE_SERVER_PASSWORD){let z=crypto.randomUUID();process.env.QITQODE_SERVER_PASSWORD=z,console.log('Generated ephemeral server password (basic auth, username "qitqode"):'),console.log(` ${z}`)}if(I(A,f.QITQODE_SERVER_PASSWORD))console.error("ERROR: Binding to non-loopback address without QITQODE_SERVER_PASSWORD is not allowed."),console.error("Set QITQODE_SERVER_PASSWORD, pass --auto-password, or pass --no-auth to override (DANGEROUS)."),process.exit(1);if(!f.QITQODE_SERVER_PASSWORD)console.error(""),console.error("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"),console.error("\u2551 WARNING: server is running WITHOUT authentication. \u2551"),console.error("\u2551 \u2551"),console.error("\u2551 Any process or browser page that can reach this address can read \u2551"),console.error("\u2551 project files, run shell commands, and open terminals as you. \u2551"),console.error("\u2551 \u2551"),console.error("\u2551 Set QITQODE_SERVER_PASSWORD, or restart with --auto-password to \u2551"),console.error("\u2551 generate an ephemeral password for this run. \u2551"),console.error("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"),console.error("");if(process.env.QITQODE_KEY)console.log("Using QITQODE_KEY for authentication.");else if(!await D())console.error("Warning: no QitQode credential found. AI features will not work until you sign in (`qitqode auth login`) or set QITQODE_KEY.");let j=await E.listen(A);console.log(`qitqode server listening on http://${j.hostname}:${j.port}`),await new Promise(()=>{}),await j.stop()}});export{T as ServeCommand};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Cp as l,Dp as p,Hp as h,Ip as yQ,Jp as c,Kp as PQ,Lp as MQ,Mp as i,Qp as kQ,Ro as g,To as jQ,Xo as RQ,Yo as ZQ,fp as o,kp as xQ,lp as NQ,op as bQ,sp as f,vp as C}from"./chunk-2maqde7w.js";import{Sp as e,bq as wQ,dq as YQ}from"./chunk-kj20f048.js";import"./chunk-cqtkxwd8.js";import"./chunk-x9rbv6p6.js";import{St as Q}from"./chunk-c11d28qn.js";import"./chunk-mzs2pjyc.js";import"./chunk-7xm75w1e.js";var _Q="3.0.63",vQ=f(()=>C(Q.object({error:Q.object({code:Q.number().nullable(),message:Q.string(),status:Q.string()})}))),QQ=PQ({errorSchema:vQ,errorToMessage:(X)=>X.error.message}),hQ=Q.union([Q.object({text:Q.string()}),Q.object({inlineData:Q.object({mimeType:Q.string(),data:Q.string()})})]),mQ=f(()=>C(Q.object({outputDimensionality:Q.number().optional(),taskType:Q.enum(["SEMANTIC_SIMILARITY","CLASSIFICATION","CLUSTERING","RETRIEVAL_DOCUMENT","RETRIEVAL_QUERY","QUESTION_ANSWERING","FACT_VERIFICATION","CODE_RETRIEVAL_QUERY"]).optional(),content:Q.array(Q.array(hQ).min(1).nullable()).optional()}))),uQ=class{constructor(X,Y){this.specificationVersion="v3",this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0,this.modelId=X,this.config=Y}get provider(){return this.config.provider}async doEmbed({values:X,headers:Y,abortSignal:Z,providerOptions:$}){let J=await l({provider:"google",providerOptions:$,schema:mQ});if(X.length>this.maxEmbeddingsPerCall)throw new wQ({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:X});let L=g(await c(this.config.headers),Y),H=J==null?void 0:J.content;if(H!=null&&H.length!==X.length)throw Error(`The number of multimodal content entries (${H.length}) must match the number of values (${X.length}).`);if(X.length===1){let U=H==null?void 0:H[0],G=X[0]?[{text:X[0]}]:[],D=U!=null?[...G,...U]:[{text:X[0]}],{responseHeaders:N,value:E,rawValue:q}=await p({url:`${this.config.baseURL}/models/${this.modelId}:embedContent`,headers:L,body:{model:`models/${this.modelId}`,content:{parts:D},outputDimensionality:J==null?void 0:J.outputDimensionality,taskType:J==null?void 0:J.taskType},failedResponseHandler:QQ,successfulResponseHandler:i(dQ),abortSignal:Z,fetch:this.config.fetch});return{warnings:[],embeddings:[E.embedding.values],usage:void 0,response:{headers:N,body:q}}}let{responseHeaders:w,value:V,rawValue:x}=await p({url:`${this.config.baseURL}/models/${this.modelId}:batchEmbedContents`,headers:L,body:{requests:X.map((U,G)=>{let D=H==null?void 0:H[G],N=U?[{text:U}]:[];return{model:`models/${this.modelId}`,content:{role:"user",parts:D!=null?[...N,...D]:[{text:U}]},outputDimensionality:J==null?void 0:J.outputDimensionality,taskType:J==null?void 0:J.taskType}})},failedResponseHandler:QQ,successfulResponseHandler:i(cQ),abortSignal:Z,fetch:this.config.fetch});return{warnings:[],embeddings:V.embeddings.map((U)=>U.values),usage:void 0,response:{headers:w,body:x}}}},cQ=f(()=>C(Q.object({embeddings:Q.array(Q.object({values:Q.array(Q.number())}))}))),dQ=f(()=>C(Q.object({embedding:Q.object({values:Q.array(Q.number())})})));function AQ(X){var Y,Z,$,J;if(X==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let L=(Y=X.promptTokenCount)!=null?Y:0,H=(Z=X.candidatesTokenCount)!=null?Z:0,w=($=X.cachedContentTokenCount)!=null?$:0,V=(J=X.thoughtsTokenCount)!=null?J:0;return{inputTokens:{total:L,noCache:L-w,cacheRead:w,cacheWrite:void 0},outputTokens:{total:H+V,text:H,reasoning:V},raw:X}}function u(X,Y=!0){if(X==null)return;if(gQ(X)){if(Y)return;if(typeof X==="object"&&X.description)return{type:"object",description:X.description};return{type:"object"}}if(typeof X==="boolean")return{type:"boolean",properties:{}};let{type:Z,description:$,required:J,properties:L,items:H,allOf:w,anyOf:V,oneOf:x,format:U,const:G,minLength:D,enum:N}=X,E={};if($)E.description=$;if(J)E.required=J;if(U)E.format=U;if(G!==void 0)E.enum=[G];if(Z)if(Array.isArray(Z)){let q=Z.includes("null"),j=Z.filter((B)=>B!=="null");if(j.length===0)E.type="null";else if(E.anyOf=j.map((B)=>({type:B})),q)E.nullable=!0}else E.type=Z;if(N!==void 0)E.enum=N;if(L!=null)E.properties=Object.entries(L).reduce((q,[j,B])=>{return q[j]=u(B,!1),q},{});if(H)E.items=Array.isArray(H)?H.map((q)=>u(q,!1)):u(H,!1);if(w)E.allOf=w.map((q)=>u(q,!1));if(V)if(V.some((q)=>typeof q==="object"&&(q==null?void 0:q.type)==="null")){let q=V.filter((j)=>!(typeof j==="object"&&(j==null?void 0:j.type)==="null"));if(q.length===1){let j=u(q[0],!1);if(typeof j==="object")E.nullable=!0,Object.assign(E,j)}else E.anyOf=q.map((j)=>u(j,!1)),E.nullable=!0}else E.anyOf=V.map((q)=>u(q,!1));if(x)E.oneOf=x.map((q)=>u(q,!1));if(D!==void 0)E.minLength=D;return E}function gQ(X){return X!=null&&typeof X==="object"&&X.type==="object"&&(X.properties==null||Object.keys(X.properties).length===0)&&!X.additionalProperties}var pQ=/^data:([^;,]+);base64,(.+)$/s;function iQ(X){let Y=pQ.exec(X);if(Y==null)return;return{mediaType:Y[1],data:Y[2]}}function lQ(X){let Y=iQ(X);if(Y==null)return;return{inlineData:{mimeType:Y.mediaType,data:Y.data}}}function sQ(X,Y,Z){let $=[],J=[];for(let L of Z)switch(L.type){case"text":{J.push(L.text);break}case"image-data":case"file-data":{$.push({inlineData:{mimeType:L.mediaType,data:L.data}});break}case"image-url":case"file-url":{let H=lQ(L.url);if(H!=null)$.push(H);else J.push(JSON.stringify(L));break}default:{J.push(JSON.stringify(L));break}}X.push({functionResponse:{name:Y,response:{name:Y,content:J.length>0?J.join(`
|
|
3
3
|
`):"Tool executed successfully."},...$.length>0?{parts:$}:{}}})}function nQ(X,Y,Z){for(let $ of Z)switch($.type){case"text":X.push({functionResponse:{name:Y,response:{name:Y,content:$.text}}});break;case"image-data":X.push({inlineData:{mimeType:String($.mediaType),data:String($.data)}},{text:"Tool executed successfully and returned this image as a response"});break;default:X.push({text:JSON.stringify($)});break}}function aQ(X,Y){var Z,$,J,L,H,w,V,x;let U=[],G=[],D=!0,N=(Z=Y==null?void 0:Y.isGemmaModel)!=null?Z:!1,E=($=Y==null?void 0:Y.providerOptionsName)!=null?$:"google",q=(J=Y==null?void 0:Y.supportsFunctionResponseParts)!=null?J:!0;for(let{role:j,content:B}of X)switch(j){case"system":{if(!D)throw new YQ({functionality:"system messages are only supported at the beginning of the conversation"});U.push({text:B});break}case"user":{D=!1;let K=[];for(let F of B)switch(F.type){case"text":{K.push({text:F.text});break}case"file":{let b=F.mediaType==="image/*"?"image/jpeg":F.mediaType;K.push(F.data instanceof URL?{fileData:{mimeType:b,fileUri:F.data.toString()}}:{inlineData:{mimeType:b,data:ZQ(F.data)}});break}}G.push({role:"user",parts:K});break}case"assistant":{D=!1,G.push({role:"model",parts:B.map((K)=>{var F,b,S,k;let z=(k=(F=K.providerOptions)==null?void 0:F[E])!=null?k:E!=="google"?(b=K.providerOptions)==null?void 0:b.google:(S=K.providerOptions)==null?void 0:S.vertex,y=(z==null?void 0:z.thoughtSignature)!=null?String(z.thoughtSignature):void 0;switch(K.type){case"text":return K.text.length===0?void 0:{text:K.text,thoughtSignature:y};case"reasoning":return K.text.length===0?void 0:{text:K.text,thought:!0,thoughtSignature:y};case"file":{if(K.data instanceof URL)throw new YQ({functionality:"File data URLs in assistant messages are not supported"});return{inlineData:{mimeType:K.mediaType,data:ZQ(K.data)},...(z==null?void 0:z.thought)===!0?{thought:!0}:{},thoughtSignature:y}}case"tool-call":{let P=(z==null?void 0:z.serverToolCallId)!=null?String(z.serverToolCallId):void 0,O=(z==null?void 0:z.serverToolType)!=null?String(z.serverToolType):void 0;if(P&&O)return{toolCall:{toolType:O,args:typeof K.input==="string"?JSON.parse(K.input):K.input,id:P},thoughtSignature:y};return{functionCall:{name:K.toolName,args:K.input},thoughtSignature:y}}case"tool-result":{let P=(z==null?void 0:z.serverToolCallId)!=null?String(z.serverToolCallId):void 0,O=(z==null?void 0:z.serverToolType)!=null?String(z.serverToolType):void 0;if(P&&O)return{toolResponse:{toolType:O,response:K.output.type==="json"?K.output.value:{},id:P},thoughtSignature:y};return}}}).filter((K)=>K!==void 0)});break}case"tool":{D=!1;let K=[];for(let F of B){if(F.type==="tool-approval-response")continue;let b=(V=(L=F.providerOptions)==null?void 0:L[E])!=null?V:E!=="google"?(H=F.providerOptions)==null?void 0:H.google:(w=F.providerOptions)==null?void 0:w.vertex,S=(b==null?void 0:b.serverToolCallId)!=null?String(b.serverToolCallId):void 0,k=(b==null?void 0:b.serverToolType)!=null?String(b.serverToolType):void 0;if(S&&k){let y=(b==null?void 0:b.thoughtSignature)!=null?String(b.thoughtSignature):void 0;if(G.length>0){let P=G[G.length-1];if(P.role==="model"){P.parts.push({toolResponse:{toolType:k,response:F.output.type==="json"?F.output.value:{},id:S},thoughtSignature:y});continue}}}let z=F.output;if(z.type==="content")if(q)sQ(K,F.toolName,z.value);else nQ(K,F.toolName,z.value);else K.push({functionResponse:{name:F.toolName,response:{name:F.toolName,content:z.type==="execution-denied"?(x=z.reason)!=null?x:"Tool execution denied.":z.value}}})}G.push({role:"user",parts:K});break}}if(N&&U.length>0&&G.length>0&&G[0].role==="user"){let j=U.map((B)=>B.text).join(`
|
|
4
4
|
|
|
5
5
|
`);G[0].parts.unshift({text:j+`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$h as
|
|
2
|
+
import{$h as m5,Ah as vV,Ch as G$,Eh as iJ,Fh as dV,Gh as Q$,Ih as _0,Jh as p4,Kh as q5,Lh as P$,Mh as G1,Nh as _4,Oh as v4,Ph as K7,Qh as mV,Rh as GJ,Sh as r9,Th as W0,Uh as h2,Vh as N5,Wh as x5,Xh as w5,Yh as b5,Zh as P6,_h as L5,hh as J8,ih as fV,jh as V8,kh as c$,lh as EV,mh as zQ,nh as j$,oh as y$,ph as RJ,qh as CJ,rh as t4,sh as YQ,th as j1,vh as C5,xh as w6,yh as y1}from"./chunk-44a82dg0.js";import{ai as GY}from"./chunk-vxyy2dp3.js";import{Ui as U7}from"./chunk-5hw6xa49.js";import{$j as d8,$k as i9,Ak as D5,Al as E2,Bk as uZ,Bl as v0,Ck as pZ,Cl as J2,Dk as y5,Dl as V2,Hk as S3,Ik as k3,Nk as O5,Wj as u,Wk as F5,Xj as I$,Xk as O2,Zk as P5,_k as z5,bk as h9,ek as u4,fk as yZ,ik as B8,jk as A1,kk as F2,kl as hY,lk as x2,ll as A6,mk as Q2,ml as M2,nl as p8,ok as s6,ol as K2,pk as J$,pl as p2,rl as P2,sl as cV,tk as yJ,tl as p,uk as OJ,ul as xQ,wl as U2,xk as z0,xl as n9,yk as $1,yl as U6,zk as t0,zl as O7}from"./chunk-04n2ycg5.js";import{Fl as lV}from"./chunk-8ymffyep.js";import{Ql as e4,Tl as QV,Ul as DZ,Vl as k0,_l as z1,bm as a2,cm as l$,dm as D8,em as R$,fm as j5,im as IJ,jm as U$,lm as S2,mm as v,nm as FV,om as P0,pm as cZ}from"./chunk-mcg24gkb.js";import{rm as i1,sm as n1,tm as s1,wm as hJ,xm as D2}from"./chunk-redjxn13.js";import{Um as K1,Vm as X0,Wm as t1,Xm as M4,_m as G0,an as kY,gn as TY,hn as gY,jn as vQ,wn as dQ,xn as E8}from"./chunk-bn0h9dny.js";import{Pn as hV}from"./chunk-3ytjm3az.js";import{ho as lJ,jo as cJ}from"./chunk-vcw00k0n.js";import{Bo as $0}from"./chunk-r78czx4d.js";import{Fp as t$,Gp as RX,tp as W$,up as cY}from"./chunk-2maqde7w.js";import{gq as FY,hq as JY}from"./chunk-kj20f048.js";import{Bq as B6}from"./chunk-n9xns8by.js";import{Fq as I0,Kq as gV,Lq as u5}from"./chunk-c1bdzxbx.js";import{Nq as E0,Oq as a4,Rq as r4}from"./chunk-ehhas0ew.js";import{br as H$,cr as NJ,ir as KZ,jr as xJ}from"./chunk-d6ry9418.js";import{Sr as w2}from"./chunk-4cnwn1rh.js";import{Ur as M7}from"./chunk-gcw4rn10.js";import{Ds as H6,Is as MV,Ls as _6,Qs as q$,Rs as L0,Vr as w1,Zr as J5,_s as s,ds as O6,os as V5}from"./chunk-m5m448mg.js";import{$s as k5,bt as O$,dt as q4,ht as QJ,kt as gJ,nt as LV,ot as n2,st as V$}from"./chunk-tqj69nh6.js";import{tt as P3}from"./chunk-ag8kz1e7.js";import{ut as q}from"./chunk-5tray1fw.js";import{At as A2,Bt as R7,Ct as cX,Dt as m2,Et as c,Ft as o,Gt as i2,Ht as _2,It as C7,Jt as S7,Kt as T2,Lt as R0,Mt as i,Nt as l2,Ot as YX,Pt as k7,Qt as oX,Rt as uX,St as y2,vt as XX,xt as x,yt as lX,zt as z2}from"./chunk-c11d28qn.js";import{Tt as mX,nu as G9}from"./chunk-mzs2pjyc.js";import{Yy as s4,hz as L7}from"./chunk-gagtmjmp.js";import{EI as i8,JN as c9,LC as F6,LN as d5,MG as HZ,MN as c4,OE as _,QF as _J,QG as jZ,QN as c2,RM as c0,VB as W5,WD as G2,_I as AX,aO as TJ,bE as u2,hF as H8,iE as k2,nF as UJ,oN as K5,pH as Y,pN as G5,qN as H5,rB as B5,rN as m4,tN as E5,uB as Y0,uF as AJ,vN as l4,yE as d2,yN as v5,zC as Z2,zF as MJ}from"./chunk-zs8kqdsf.js";import{BO as J9,DO as L2,FO as K$,GO as mY,HO as lY}from"./chunk-7xm75w1e.js";var y0={};L2(y0,{layer:()=>lZ,defaultLayer:()=>YB,SessionStatus:()=>y0,Service:()=>X6,Info:()=>mZ,Event:()=>y7});var mZ=q.union([q.object({type:q.literal("idle")}),q.object({type:q.literal("retry"),attempt:q.number(),message:q.string(),next:q.number()}),q.object({type:q.literal("busy"),message:q.string().optional()})]).meta({ref:"SessionStatus"}),y7={Status:D2.define("session.status",q.object({sessionID:F2.zod,status:mZ})),Idle:D2.define("session.idle",q.object({sessionID:F2.zod}))};class X6 extends Z2.Service()("@qitqode/SessionStatus"){}var lZ=_.effect(X6,Y.gen(function*(){let $=yield*u.Service,Z=yield*v.make(Y.fn("SessionStatus.state")(()=>Y.succeed(new Map))),X=Y.fn("SessionStatus.get")(function*(V){return(yield*v.get(Z)).get(V)??{type:"idle"}}),Q=Y.fn("SessionStatus.list")(function*(){return new Map(yield*v.get(Z))}),J=Y.fn("SessionStatus.set")(function*(V,B){let D=yield*v.get(Z);if(yield*$.publish(y7.Status,{sessionID:V,status:B}),B.type==="idle"){yield*$.publish(y7.Idle,{sessionID:V}),D.delete(V);return}D.set(V,B)});return X6.of({get:X,list:Q,set:J})})),YB=lZ.pipe(_.provide(u.layer));var O0={};L2(O0,{layer:()=>oZ,defaultLayer:()=>QB,SessionRunState:()=>O0,Service:()=>Q6});class Q6 extends Z2.Service()("@qitqode/SessionRunState"){}var Y6=($,Z)=>`${$}:${Z}`,oZ=_.effect(Q6,Y.gen(function*(){let $=yield*y0.Service,Z=E0.create({service:"SessionRunState"}),X=yield*v.make(Y.fn("SessionRunState.state")(function*(){let W=yield*d2.Scope,K=new Map;return yield*Y.addFinalizer(Y.fnUntraced(function*(){yield*Y.forEach(K.values(),(j)=>j.cancel,{concurrency:8,discard:!0}),K.clear()})),{runners:K,scope:W}})),Q=Y.fn("SessionRunState.runner")(function*(W,K,j){let G=Y6(W,K),z=yield*v.get(X),O=z.runners.get(G);if(O)return O;let P=K==="main",w=cZ.make(z.scope,{label:G,onReentryWarn:(L)=>Z.warn("runner-reentry",L),onIdle:P?Y.gen(function*(){z.runners.delete(G),yield*$.set(W,{type:"idle"})}):Y.sync(()=>{z.runners.delete(G)}),onBusy:P?$.set(W,{type:"busy"}):Y.void,onInterrupt:j,busy:()=>{throw new O7(W)}});return z.runners.set(G,w),w}),J=Y.fn("SessionRunState.assertNotBusy")(function*(W){if((yield*v.get(X)).runners.get(Y6(W,"main"))?.busy)throw new O7(W)}),V=Y.fn("SessionRunState.cancel")(function*(W){let K=Y6(W,"main"),G=(yield*v.get(X)).runners.get(K);if(!G||!G.busy){yield*$.set(W,{type:"idle"});return}yield*G.cancel}),B=Y.fn("SessionRunState.cancelActor")(function*(W,K){let j=Y6(W,K),z=(yield*v.get(X)).runners.get(j);if(!z||!z.busy)return;yield*z.cancel}),D=Y.fn("SessionRunState.ensureRunning")(function*(W,K,j,G){return yield*(yield*Q(W,K,j)).ensureRunning(G)}),H=Y.fn("SessionRunState.startShell")(function*(W,K,j){return yield*(yield*Q(W,"main",K)).startShell(j)});return Q6.of({assertNotBusy:J,cancel:V,cancelActor:B,ensureRunning:D,startShell:H})})),QB=oZ.pipe(_.provide(y0.defaultLayer));var F0={};L2(F0,{parseVerdictFromCompletion:()=>BB,layer:()=>iZ,defaultLayer:()=>VB,Verdict:()=>r$,Service:()=>V6,Goal:()=>F0,Event:()=>P7});var r$=q.object({ok:q.boolean(),impossible:q.boolean().optional(),reason:q.string()}),P7={Updated:D2.define("session.goal",q.object({sessionID:F2.zod,goal:q.object({condition:q.string()}).optional(),lastVerdict:r$.extend({attempt:q.number(),messageID:q.string().optional(),error:q.boolean().optional()}).optional()}))},J6=`You are evaluating a stop-condition hook in QitQode. Read the conversation transcript carefully, then judge whether the user-provided condition is satisfied.
|
|
3
3
|
|
|
4
4
|
Your response must be a JSON object with one of these shapes:
|
|
5
5
|
- {"ok": true, "reason": "<quote evidence from the transcript that satisfies the condition>"}
|
|
@@ -508,7 +508,7 @@ If you repeat the same output again, the session will be terminated.
|
|
|
508
508
|
`)})});function hQ($){if(!$.lastFinished)return;let Z=[];for(let J=$.msgs.length-1;J>=0&&Z.length<t9;J--){let V=$.msgs[J];if(V.info.role!=="assistant"||!V.info.finish)continue;let B=f8(V.parts);if(B===void 0)break;Z.push(B)}if(!(Z.length===t9&&Z.every((J)=>J===Z[0])))return;let Q=$.msgs.findLast((J)=>J.info.role==="user");if(!Q||Q.parts.some((J)=>J.type==="text"&&J.text?.includes("repeating the same action")))return;Q.parts.push({id:Q2.ascending(),messageID:Q.info.id,sessionID:$.sessionID,type:"text",synthetic:!0,text:["<system-reminder>",`Your last ${t9} steps have been identical \u2014 you appear to be`,"repeating the same action without making progress. Stop and reconsider:","the current approach is not working. Try a different strategy, use a","different tool, or if you are blocked, explain the blocker to the user","instead of repeating the same step again.","</system-reminder>"].join(`
|
|
509
509
|
`)})}var e9=s.create({service:"auto-dream"}),$Z=86400000,eK=7,$G=30,mQ=1e4,ZZ="Auto Dream",XZ="Auto Distill",fQ=0,EQ=0,lQ=["Run one automatic dream memory consolidation pass for the current project.","","Use the memory files as the working index and the raw qitqode trajectory database as the source of truth.","Use bash for read-only SQLite and filesystem inspection. Do not modify the database.","Consolidate only durable, verified information into project memory."].join(`
|
|
510
510
|
`),cQ=["Run one automatic distill pass for the current project.","","Review the past month of sessions and identify repeated manual workflows worth packaging.","Use the raw qitqode trajectory database as the source of truth and memory files to spot cross-session patterns.","Inventory existing skills, agents, and commands first so you reuse or extend instead of duplicating.","Use bash for read-only SQLite and filesystem inspection. Do not modify the database.","Produce a compact shortlist, then create only the high-confidence missing assets."].join(`
|
|
511
|
-
`);function oQ($){return Y.gen(function*(){if(!$.enabled)return!1;let Z=$.intervalDays*$Z,X=yield*Y.sync(()=>a2.use((V)=>V.select({time_created:k0.time_created}).from(k0).where(G0(k0.title,$.title)).orderBy(E8(k0.time_created)).limit(1).get())),Q=Date.now(),J=X?Q-X.time_created:1/0;if(!X){let V=yield*Y.sync(()=>a2.use((B)=>B.select({time_created:k0.time_created}).from(k0).where(vQ(k0.parent_id)).orderBy(dQ(k0.time_created)).limit(1).get()));if(!V||Q-V.time_created<Z)return e9.info(`auto-${$.label} skipped \u2014 project too young`,{projectAge:V?Math.round((Q-V.time_created)/$Z)+"d":"empty",interval:$.intervalDays+"d"}),!1}if(J<Z)return e9.info(`auto-${$.label} skipped \u2014 last run too recent`,{lastRunAgo:Math.round(J/$Z)+"d",interval:$.intervalDays+"d"}),!1;return e9.info(`auto-${$.label} triggering`,{lastRun:X?new Date(X.time_created).toISOString():"never",interval:$.intervalDays+"d"}),!0})}function uQ($){let Z=$.dream?.auto!==!1;if(!Z)return Y.succeed(!1);let X=Date.now();if(X-fQ<mQ)return Y.succeed(!1);fQ=X;let Q=$.dream?.interval_days??eK;return oQ({enabled:Z,intervalDays:Q,title:ZZ,label:"dream"})}function pQ($){let Z=$.distill?.auto!==!1;if(!Z)return Y.succeed(!1);let X=Date.now();if(X-EQ<mQ)return Y.succeed(!1);EQ=X;let Q=$.distill?.interval_days??$G;return oQ({enabled:Z,intervalDays:Q,title:XZ,label:"distill"})}var iQ=Y.fnUntraced(function*($){let Z=yield*$.config.get(),X=yield*uQ(Z).pipe(Y.catch(()=>Y.succeed(!1))),Q=yield*pQ(Z).pipe(Y.catch(()=>Y.succeed(!1))),J={providerID:$.lastUser.model.providerID,modelID:$.lastUser.model.modelID};if(!X&&!Q)return;let{AppRuntime:V}=yield*Y.promise(()=>import("./chunk-h6rv626m.js"));if(X)V.runPromise(E2.use((B)=>Y.gen(function*(){let D=yield*B.create({title:ZZ});yield*(yield*$.promptServiceTag).prompt({sessionID:D.id,agent:"dream",model:J,parts:[{type:"text",text:lQ}]})}))).catch((B)=>$.log.error("auto-dream prompt failed",{error:String(B)}));if(Q)V.runPromise(E2.use((B)=>Y.gen(function*(){let D=yield*B.create({title:XZ});yield*(yield*$.promptServiceTag).prompt({sessionID:D.id,agent:"distill",model:J,parts:[{type:"text",text:cQ}]})}))).catch((B)=>$.log.error("auto-distill prompt failed",{error:String(B)}))});var XG=($)=>$.pipe(Y.catchDefect((Z)=>Z instanceof $0.BackendAuthRejectedError?Y.succeed(void 0):Y.die(Z))),YZ=($)=>XG(Y.promise(()=>$0.resolvePrompt($))).pipe(Y.map((Z)=>Z??"")),nQ=Y.gen(function*(){let $=yield*YZ("session/build-switch"),Z=yield*YZ("session/max-steps"),X=yield*YZ("session/compose");return{buildSwitch:$,maxSteps:Z,promptCompose:X}});var sQ=E0.create({service:"session.prompt"}),YG=s.create({service:"session.prompt"});function aQ($,Z,X,Q){return Y.gen(function*(){let{bus:J,status:V,sessions:B,agents:D,provider:H,processor:W,prune:K,checkpoint:j,compaction:G,config:z,plugin:O,permission:P,fsys:w,registry:L,scope:F,instruction:U,state:y,goal:S,taskGateState:I,taskRegistry:M,revert:f,summary:b,sys:k,llm:h,actorRegistry:N,inbox:A}=yield*S4,R=yield*nQ,C=R.buildSwitch,T=R.maxSteps,l=R.promptCompose,d=(t,N2,j2)=>DQ(H,J,t,N2,j2),g=(t,N2)=>OQ(B,t,N2),E=a9(B),m=1024,e=new class extends Set{add(t){if(super.add(t),this.size>1024){let N2=this.values().next().value;if(N2!==void 0)this.delete(N2)}return this}},n=(t)=>o9({getOps:$,...t}),a=qQ({agents:D,provider:H,llm:h,sessions:B,elog:sQ}),H2=NQ({sessions:B,fsys:w,buildSwitch:C,promptCompose:l});return{runLoop:Y.fn("SessionPrompt.run")(function*(t,N2,j2){let g0=yield*v.context,R2=sQ.with({sessionID:t}),X2,q2=0,b2=yield*B.get(t),r2,w0,D0=N2??"main",p0=GQ({sessionID:t,agentID:D0,task_id:j2,plugin:O,bus:J,prune:K,scope:F}),{cancellation:h0,agentMetrics:M$,publishAgentRequest:i0,schedulePrune:n0}=p0,N1=KQ({sessionID:t,agentID:D0,task_id:j2,session:b2,cancellation:h0,plugin:O});return yield*Y.gen(function*(){yield*p0.before;let s0=(t2,Y2)=>g4(sY(t2,Y2,p.parts(Y2.id))),s$=!1,K8=kQ({sessionID:t,bus:J,appendSyntheticUserTurn:E,slog:R2}),f0=SQ({sessionID:t,sessions:B,bus:J,appendSyntheticUserTurn:E,slog:R2}),{autoContinueOutputLength:G8,autoContinueInvalidOutput:_Z,autoRetryStructuredOutput:oV,handleTextRepeat:uV,writeContentFilterError:IZ,writeModelError:RZ}=f0,CZ=FQ({sessionID:t,agentID:N2,agents:D,taskGateState:I,taskRegistry:M,appendSyntheticUserTurn:E,slog:R2}),SZ=PQ({sessionID:t,agentID:N2,session:b2,goal:S,bus:J,appendSyntheticUserTurn:E,slog:R2});while(!0){if(!N2||N2==="main")yield*V.set(t,{type:"busy"});yield*A.drain(t,N2??"main").pipe(Y.ignore),yield*R2.info("loop",{step:q2});let t2=yield*p.filterCompactedEffect(t,{contextFrom:b2.contextFrom,contextWatermark:b2.contextWatermark,agentID:N2??"main"}),Y2,TZ,a0,H7,b0,gZ=[];for(let W2=t2.length-1;W2>=0;W2--){let K0=t2[W2];if(!Y2&&K0.info.role==="user")Y2=K0.info,TZ=K0;if(!a0&&K0.info.role==="assistant")a0=K0.info,H7=K0;if(!b0&&K0.info.role==="assistant"&&K0.info.finish)b0=K0.info;if(Y2&&b0)break;if(!b0){let $6=K0.parts.filter((a$)=>a$.type==="subtask");gZ.push(...$6)}}if(!Y2)throw Error("No user message found in stream. This should never happen.");yield*TQ({sessionID:t,msgs:t2,checkpoint:j,config:z});let nV=H7?.parts.some((W2)=>W2.type==="tool"&&!W2.metadata?.providerExecuted)??!1;if(a0?.finish==="length"&&!nV&&Y2.id<a0.id&&(yield*G8({lastUser:Y2,assistant:a0})))continue;if(a0){let W2=d9({phase:"existing-assistant",lastUser:Y2,assistant:a0,parts:H7?.parts??[]});if(W2.type==="filtered"){yield*IZ({assistant:a0}),yield*R2.info("exiting loop",{classification:W2.type});break}if(W2.type==="failed"){yield*RZ({assistant:a0,reason:W2.reason}),yield*R2.info("exiting loop",{classification:W2.type,reason:W2.reason});break}if(W2.type==="think-only"||W2.type==="invalid"){let K0=W2.type==="invalid"?W2.reason:"think-only";if(yield*_Z({lastUser:Y2,assistant:a0,reason:K0}))continue;yield*R2.info("exiting loop",{classification:W2.type});break}if(W2.type==="final"&&W2.degraded)yield*R2.warn("degraded final on abnormal finish",{finish:a0.finish});if(W2.type!=="continue"){if(yield*CZ(Y2))continue;if(yield*SZ(Y2))continue;yield*R2.info("exiting loop",{classification:W2.type});break}}if(q2++,q2===1)yield*a({session:b2,modelID:Y2.model.modelID,providerID:Y2.model.providerID,history:t2}).pipe(Y.ignore,Y.forkIn(F));if(q2===1&&!b2.parentID)yield*iQ({config:z,lastUser:Y2,promptServiceTag:Q,log:YG});let r0=yield*d(Y2.model.providerID,Y2.model.modelID,t);w0=r0,r2=b0;let hZ=gZ.pop();if(hZ?.type==="subtask"){yield*n({task:hZ,model:r0,lastUser:Y2,sessionID:t,session:b2,msgs:t2});continue}let fZ=TZ;if(fZ?.parts.some((W2)=>W2.type==="compaction")){let W2=fZ.parts.find((a$)=>a$.type==="compaction"),K0=yield*B.messages({sessionID:t,agentID:Y2.agentID??"main"});if((yield*G.process({parentID:Y2.id,messages:K0,sessionID:t,auto:W2?.auto??!1,overflow:W2?.overflow,agentID:Y2.agentID}))==="stop")break;continue}yield*gQ({sessionID:t,msgs:t2,lastFinished:b0,model:r0,config:z}),hQ({sessionID:t,msgs:t2,lastFinished:b0});let _$=yield*D.get(Y2.agent),j7=_$?.native===!0&&_$?.hidden===!0;if(!s$&&!j7&&b0&&b0.tokens){let W2=yield*$();yield*K.fireCheckpoints({sessionID:t,model:r0,tokens:b0.tokens,promptOps:W2,agentID:Y2.agentID}).pipe(Y.ignore)}if(!s$&&b0&&b0.tokens){if(yield*BQ({config:z,checkpoint:j,compaction:G,prune:K},{sessionID:t,lastFinished:b0,lastUser:Y2,model:r0,msgs:t2,isBoundedComputation:j7})){s$=!0;continue}}if(s$=!1,!_$)throw yield*m9(D,J,Y2.agent,t);let sV=_$.steps??1/0,aV=q2>=sV;t2=yield*H2({messages:t2,agent:_$,session:b2});let EZ=E4({sessionID:t,parentID:Y2.id,agentID:Y2.agentID,agent:_$.name,variant:Y2.model.variant,cwd:g0.directory,root:g0.worktree,modelID:r0.id,providerID:r0.providerID});yield*B.updateMessage(EZ);let e2=yield*W.create({assistantMessage:EZ,sessionID:t,model:r0,agentMetrics:M$}),rV=yield*Y.gen(function*(){let W2={value:X2},K0=yield*aY({sessionID:t,resolvedAgentID:D0,step:q2,task_id:j2,lastUser:Y2,lastFinished:b0,msgs:t2,agent:_$,session:b2,model:r0,handle:e2,structured:W2,resolveTools:Z,createStructuredOutputTool:X,summary:b,scope:F,plugin:O}),{tools:$6,format:a$,query:tV}=K0,{cancelledByPlugin:eV,withUserQueryPost:$B}=rY({sessionID:t,agentID:D0,step:q2,lastUser:Y2,msgs:t2,query:tV,handle:e2,plugin:O,sessions:B,cancellation:h0,trajectoryForStep:s0}),ZB=Y.fnUntraced(function*(Z6){if(Z6==="continue"&&(yield*G8({lastUser:Y2,assistant:e2.message})))return"continue";if(Z6==="text-repeat"){if(yield*uV({lastUser:Y2}))return"continue";return"break"}if(W2.value!==void 0)return X2=W2.value,e2.message.structured=W2.value,e2.message.finish=e2.message.finish??"stop",yield*B.updateMessage(e2.message),"break";let B$=d9({phase:"after-process",lastUser:Y2,assistant:e2.message,parts:p.parts(e2.message.id),processResult:Z6});if(B$.type==="filtered")return yield*IZ({assistant:e2.message}),"break";if(B$.type==="failed")return yield*RZ({assistant:e2.message,reason:B$.reason}),"break";if(B$.type!=="continue"&&!e2.message.error&&a$.type==="json_schema"){if(yield*oV({lastUser:Y2,assistant:e2.message}))return"continue";return"break"}if((B$.type==="think-only"||B$.type==="invalid")&&a$.type!=="json_schema"){let XB=B$.type==="invalid"?B$.reason:"think-only";if(yield*_Z({lastUser:Y2,assistant:e2.message,reason:XB}))return"continue";return"break"}if(B$.type==="final"&&B$.degraded)yield*R2.warn("degraded final on abnormal finish",{finish:e2.message.finish});if(Z6==="stop")return"break";return}),D7=yield*QQ({sessionID:t,lastUser:Y2,agent:_$,session:b2,model:r0,msgs:t2,tools:$6,format:a$,handle:e2,isLastStep:aV,task_id:j2,instructionsNotified:e,maxStepsText:T,actorRegistry:N,bus:J,config:z,instruction:U,llm:h,registry:L,status:V,sys:k,cancelledByPlugin:eV,withUserQueryPost:$B,slog:R2});if(D7.kind==="break")return"break";let dZ=yield*ZB(D7.result);if(dZ)return dZ;if(D7.result==="overflow")yield*WQ({config:z,checkpoint:j,compaction:G,prune:K},{sessionID:t,lastUser:Y2,model:r0,msgs:t2,isBoundedComputation:j7});return"continue"}).pipe(Y.ensuring(U.clear(e2.message.id))),vZ=yield*K8.check({lastUser:Y2,completedParts:p.parts(e2.message.id)});if(vZ==="terminate")break;if(vZ==="recovered")continue;if(rV==="break"){if(yield*CZ(Y2))continue;if(yield*SZ(Y2))continue;break}continue}let pV=yield*$();if(w0&&r2)yield*n0({model:w0,lastFinished:r2,promptOps:pV});let e8=yield*g(t,N2),iV=e8.info.role==="assistant"&&!!e8.info.error,kZ=yield*B.findMessage(t,(t2)=>t2.info.role==="user",{agentID:"*"});return yield*i0(iV?"error":"completed",Y0.isSome(kZ)?kZ.value.info.agent:e8.info.agent),e8}).pipe((s0)=>l9(t,J,s0),Y.onExit(N1),Y.orDie)}),lastAssistant:g}})}import rQ from"path";var QG=new TextEncoder,QZ=new TextDecoder,JG=($)=>`
|
|
511
|
+
`);function oQ($){return Y.gen(function*(){if(!$.enabled)return!1;let Z=$.intervalDays*$Z,X=yield*Y.sync(()=>a2.use((V)=>V.select({time_created:k0.time_created}).from(k0).where(G0(k0.title,$.title)).orderBy(E8(k0.time_created)).limit(1).get())),Q=Date.now(),J=X?Q-X.time_created:1/0;if(!X){let V=yield*Y.sync(()=>a2.use((B)=>B.select({time_created:k0.time_created}).from(k0).where(vQ(k0.parent_id)).orderBy(dQ(k0.time_created)).limit(1).get()));if(!V||Q-V.time_created<Z)return e9.info(`auto-${$.label} skipped \u2014 project too young`,{projectAge:V?Math.round((Q-V.time_created)/$Z)+"d":"empty",interval:$.intervalDays+"d"}),!1}if(J<Z)return e9.info(`auto-${$.label} skipped \u2014 last run too recent`,{lastRunAgo:Math.round(J/$Z)+"d",interval:$.intervalDays+"d"}),!1;return e9.info(`auto-${$.label} triggering`,{lastRun:X?new Date(X.time_created).toISOString():"never",interval:$.intervalDays+"d"}),!0})}function uQ($){let Z=$.dream?.auto!==!1;if(!Z)return Y.succeed(!1);let X=Date.now();if(X-fQ<mQ)return Y.succeed(!1);fQ=X;let Q=$.dream?.interval_days??eK;return oQ({enabled:Z,intervalDays:Q,title:ZZ,label:"dream"})}function pQ($){let Z=$.distill?.auto!==!1;if(!Z)return Y.succeed(!1);let X=Date.now();if(X-EQ<mQ)return Y.succeed(!1);EQ=X;let Q=$.distill?.interval_days??$G;return oQ({enabled:Z,intervalDays:Q,title:XZ,label:"distill"})}var iQ=Y.fnUntraced(function*($){let Z=yield*$.config.get(),X=yield*uQ(Z).pipe(Y.catch(()=>Y.succeed(!1))),Q=yield*pQ(Z).pipe(Y.catch(()=>Y.succeed(!1))),J={providerID:$.lastUser.model.providerID,modelID:$.lastUser.model.modelID};if(!X&&!Q)return;let{AppRuntime:V}=yield*Y.promise(()=>import("./chunk-mxzceza9.js"));if(X)V.runPromise(E2.use((B)=>Y.gen(function*(){let D=yield*B.create({title:ZZ});yield*(yield*$.promptServiceTag).prompt({sessionID:D.id,agent:"dream",model:J,parts:[{type:"text",text:lQ}]})}))).catch((B)=>$.log.error("auto-dream prompt failed",{error:String(B)}));if(Q)V.runPromise(E2.use((B)=>Y.gen(function*(){let D=yield*B.create({title:XZ});yield*(yield*$.promptServiceTag).prompt({sessionID:D.id,agent:"distill",model:J,parts:[{type:"text",text:cQ}]})}))).catch((B)=>$.log.error("auto-distill prompt failed",{error:String(B)}))});var XG=($)=>$.pipe(Y.catchDefect((Z)=>Z instanceof $0.BackendAuthRejectedError?Y.succeed(void 0):Y.die(Z))),YZ=($)=>XG(Y.promise(()=>$0.resolvePrompt($))).pipe(Y.map((Z)=>Z??"")),nQ=Y.gen(function*(){let $=yield*YZ("session/build-switch"),Z=yield*YZ("session/max-steps"),X=yield*YZ("session/compose");return{buildSwitch:$,maxSteps:Z,promptCompose:X}});var sQ=E0.create({service:"session.prompt"}),YG=s.create({service:"session.prompt"});function aQ($,Z,X,Q){return Y.gen(function*(){let{bus:J,status:V,sessions:B,agents:D,provider:H,processor:W,prune:K,checkpoint:j,compaction:G,config:z,plugin:O,permission:P,fsys:w,registry:L,scope:F,instruction:U,state:y,goal:S,taskGateState:I,taskRegistry:M,revert:f,summary:b,sys:k,llm:h,actorRegistry:N,inbox:A}=yield*S4,R=yield*nQ,C=R.buildSwitch,T=R.maxSteps,l=R.promptCompose,d=(t,N2,j2)=>DQ(H,J,t,N2,j2),g=(t,N2)=>OQ(B,t,N2),E=a9(B),m=1024,e=new class extends Set{add(t){if(super.add(t),this.size>1024){let N2=this.values().next().value;if(N2!==void 0)this.delete(N2)}return this}},n=(t)=>o9({getOps:$,...t}),a=qQ({agents:D,provider:H,llm:h,sessions:B,elog:sQ}),H2=NQ({sessions:B,fsys:w,buildSwitch:C,promptCompose:l});return{runLoop:Y.fn("SessionPrompt.run")(function*(t,N2,j2){let g0=yield*v.context,R2=sQ.with({sessionID:t}),X2,q2=0,b2=yield*B.get(t),r2,w0,D0=N2??"main",p0=GQ({sessionID:t,agentID:D0,task_id:j2,plugin:O,bus:J,prune:K,scope:F}),{cancellation:h0,agentMetrics:M$,publishAgentRequest:i0,schedulePrune:n0}=p0,N1=KQ({sessionID:t,agentID:D0,task_id:j2,session:b2,cancellation:h0,plugin:O});return yield*Y.gen(function*(){yield*p0.before;let s0=(t2,Y2)=>g4(sY(t2,Y2,p.parts(Y2.id))),s$=!1,K8=kQ({sessionID:t,bus:J,appendSyntheticUserTurn:E,slog:R2}),f0=SQ({sessionID:t,sessions:B,bus:J,appendSyntheticUserTurn:E,slog:R2}),{autoContinueOutputLength:G8,autoContinueInvalidOutput:_Z,autoRetryStructuredOutput:oV,handleTextRepeat:uV,writeContentFilterError:IZ,writeModelError:RZ}=f0,CZ=FQ({sessionID:t,agentID:N2,agents:D,taskGateState:I,taskRegistry:M,appendSyntheticUserTurn:E,slog:R2}),SZ=PQ({sessionID:t,agentID:N2,session:b2,goal:S,bus:J,appendSyntheticUserTurn:E,slog:R2});while(!0){if(!N2||N2==="main")yield*V.set(t,{type:"busy"});yield*A.drain(t,N2??"main").pipe(Y.ignore),yield*R2.info("loop",{step:q2});let t2=yield*p.filterCompactedEffect(t,{contextFrom:b2.contextFrom,contextWatermark:b2.contextWatermark,agentID:N2??"main"}),Y2,TZ,a0,H7,b0,gZ=[];for(let W2=t2.length-1;W2>=0;W2--){let K0=t2[W2];if(!Y2&&K0.info.role==="user")Y2=K0.info,TZ=K0;if(!a0&&K0.info.role==="assistant")a0=K0.info,H7=K0;if(!b0&&K0.info.role==="assistant"&&K0.info.finish)b0=K0.info;if(Y2&&b0)break;if(!b0){let $6=K0.parts.filter((a$)=>a$.type==="subtask");gZ.push(...$6)}}if(!Y2)throw Error("No user message found in stream. This should never happen.");yield*TQ({sessionID:t,msgs:t2,checkpoint:j,config:z});let nV=H7?.parts.some((W2)=>W2.type==="tool"&&!W2.metadata?.providerExecuted)??!1;if(a0?.finish==="length"&&!nV&&Y2.id<a0.id&&(yield*G8({lastUser:Y2,assistant:a0})))continue;if(a0){let W2=d9({phase:"existing-assistant",lastUser:Y2,assistant:a0,parts:H7?.parts??[]});if(W2.type==="filtered"){yield*IZ({assistant:a0}),yield*R2.info("exiting loop",{classification:W2.type});break}if(W2.type==="failed"){yield*RZ({assistant:a0,reason:W2.reason}),yield*R2.info("exiting loop",{classification:W2.type,reason:W2.reason});break}if(W2.type==="think-only"||W2.type==="invalid"){let K0=W2.type==="invalid"?W2.reason:"think-only";if(yield*_Z({lastUser:Y2,assistant:a0,reason:K0}))continue;yield*R2.info("exiting loop",{classification:W2.type});break}if(W2.type==="final"&&W2.degraded)yield*R2.warn("degraded final on abnormal finish",{finish:a0.finish});if(W2.type!=="continue"){if(yield*CZ(Y2))continue;if(yield*SZ(Y2))continue;yield*R2.info("exiting loop",{classification:W2.type});break}}if(q2++,q2===1)yield*a({session:b2,modelID:Y2.model.modelID,providerID:Y2.model.providerID,history:t2}).pipe(Y.ignore,Y.forkIn(F));if(q2===1&&!b2.parentID)yield*iQ({config:z,lastUser:Y2,promptServiceTag:Q,log:YG});let r0=yield*d(Y2.model.providerID,Y2.model.modelID,t);w0=r0,r2=b0;let hZ=gZ.pop();if(hZ?.type==="subtask"){yield*n({task:hZ,model:r0,lastUser:Y2,sessionID:t,session:b2,msgs:t2});continue}let fZ=TZ;if(fZ?.parts.some((W2)=>W2.type==="compaction")){let W2=fZ.parts.find((a$)=>a$.type==="compaction"),K0=yield*B.messages({sessionID:t,agentID:Y2.agentID??"main"});if((yield*G.process({parentID:Y2.id,messages:K0,sessionID:t,auto:W2?.auto??!1,overflow:W2?.overflow,agentID:Y2.agentID}))==="stop")break;continue}yield*gQ({sessionID:t,msgs:t2,lastFinished:b0,model:r0,config:z}),hQ({sessionID:t,msgs:t2,lastFinished:b0});let _$=yield*D.get(Y2.agent),j7=_$?.native===!0&&_$?.hidden===!0;if(!s$&&!j7&&b0&&b0.tokens){let W2=yield*$();yield*K.fireCheckpoints({sessionID:t,model:r0,tokens:b0.tokens,promptOps:W2,agentID:Y2.agentID}).pipe(Y.ignore)}if(!s$&&b0&&b0.tokens){if(yield*BQ({config:z,checkpoint:j,compaction:G,prune:K},{sessionID:t,lastFinished:b0,lastUser:Y2,model:r0,msgs:t2,isBoundedComputation:j7})){s$=!0;continue}}if(s$=!1,!_$)throw yield*m9(D,J,Y2.agent,t);let sV=_$.steps??1/0,aV=q2>=sV;t2=yield*H2({messages:t2,agent:_$,session:b2});let EZ=E4({sessionID:t,parentID:Y2.id,agentID:Y2.agentID,agent:_$.name,variant:Y2.model.variant,cwd:g0.directory,root:g0.worktree,modelID:r0.id,providerID:r0.providerID});yield*B.updateMessage(EZ);let e2=yield*W.create({assistantMessage:EZ,sessionID:t,model:r0,agentMetrics:M$}),rV=yield*Y.gen(function*(){let W2={value:X2},K0=yield*aY({sessionID:t,resolvedAgentID:D0,step:q2,task_id:j2,lastUser:Y2,lastFinished:b0,msgs:t2,agent:_$,session:b2,model:r0,handle:e2,structured:W2,resolveTools:Z,createStructuredOutputTool:X,summary:b,scope:F,plugin:O}),{tools:$6,format:a$,query:tV}=K0,{cancelledByPlugin:eV,withUserQueryPost:$B}=rY({sessionID:t,agentID:D0,step:q2,lastUser:Y2,msgs:t2,query:tV,handle:e2,plugin:O,sessions:B,cancellation:h0,trajectoryForStep:s0}),ZB=Y.fnUntraced(function*(Z6){if(Z6==="continue"&&(yield*G8({lastUser:Y2,assistant:e2.message})))return"continue";if(Z6==="text-repeat"){if(yield*uV({lastUser:Y2}))return"continue";return"break"}if(W2.value!==void 0)return X2=W2.value,e2.message.structured=W2.value,e2.message.finish=e2.message.finish??"stop",yield*B.updateMessage(e2.message),"break";let B$=d9({phase:"after-process",lastUser:Y2,assistant:e2.message,parts:p.parts(e2.message.id),processResult:Z6});if(B$.type==="filtered")return yield*IZ({assistant:e2.message}),"break";if(B$.type==="failed")return yield*RZ({assistant:e2.message,reason:B$.reason}),"break";if(B$.type!=="continue"&&!e2.message.error&&a$.type==="json_schema"){if(yield*oV({lastUser:Y2,assistant:e2.message}))return"continue";return"break"}if((B$.type==="think-only"||B$.type==="invalid")&&a$.type!=="json_schema"){let XB=B$.type==="invalid"?B$.reason:"think-only";if(yield*_Z({lastUser:Y2,assistant:e2.message,reason:XB}))return"continue";return"break"}if(B$.type==="final"&&B$.degraded)yield*R2.warn("degraded final on abnormal finish",{finish:e2.message.finish});if(Z6==="stop")return"break";return}),D7=yield*QQ({sessionID:t,lastUser:Y2,agent:_$,session:b2,model:r0,msgs:t2,tools:$6,format:a$,handle:e2,isLastStep:aV,task_id:j2,instructionsNotified:e,maxStepsText:T,actorRegistry:N,bus:J,config:z,instruction:U,llm:h,registry:L,status:V,sys:k,cancelledByPlugin:eV,withUserQueryPost:$B,slog:R2});if(D7.kind==="break")return"break";let dZ=yield*ZB(D7.result);if(dZ)return dZ;if(D7.result==="overflow")yield*WQ({config:z,checkpoint:j,compaction:G,prune:K},{sessionID:t,lastUser:Y2,model:r0,msgs:t2,isBoundedComputation:j7});return"continue"}).pipe(Y.ensuring(U.clear(e2.message.id))),vZ=yield*K8.check({lastUser:Y2,completedParts:p.parts(e2.message.id)});if(vZ==="terminate")break;if(vZ==="recovered")continue;if(rV==="break"){if(yield*CZ(Y2))continue;if(yield*SZ(Y2))continue;break}continue}let pV=yield*$();if(w0&&r2)yield*n0({model:w0,lastFinished:r2,promptOps:pV});let e8=yield*g(t,N2),iV=e8.info.role==="assistant"&&!!e8.info.error,kZ=yield*B.findMessage(t,(t2)=>t2.info.role==="user",{agentID:"*"});return yield*i0(iV?"error":"completed",Y0.isSome(kZ)?kZ.value.info.agent:e8.info.agent),e8}).pipe((s0)=>l9(t,J,s0),Y.onExit(N1),Y.orDie)}),lastAssistant:g}})}import rQ from"path";var QG=new TextEncoder,QZ=new TextDecoder,JG=($)=>`
|
|
512
512
|
|
|
513
513
|
[... QitQode truncated ${$} bytes of shell output ...]
|
|
514
514
|
|
|
@@ -539,7 +539,7 @@ ${O}
|
|
|
539
539
|
`).length},NG=Y.fnUntraced(function*($,Z,X){let Q=qG.join(Z,X);if(!(yield*$.exists(Q).pipe(Y.orDie)))return"";let J=yield*$.readFile(Q).pipe(Y.catch(()=>Y.succeed(new Uint8Array)));if(Buffer.from(J).includes(0))return"";return Buffer.from(J).toString("utf8")}),FJ=($)=>new Map($.map((Z)=>[Z.file,{additions:Z.additions,deletions:Z.deletions}])),xG=(...$)=>{let Z=new Map;return $.flat().forEach((X)=>{if(!Z.has(X.file))Z.set(X.file,X)}),[...Z.values()]},BZ=Y.fnUntraced(function*($,Z,X,Q,J,V){let B=Q?yield*Z.prefix(X):"",D=(W,K,j)=>OJ(yJ(W,W,K,j,"","",{context:Number.MAX_SAFE_INTEGER}));return(yield*Y.forEach(J,(W)=>Y.gen(function*(){let K=W.status==="added"||!Q?"":yield*Z.show(X,Q,W.file,B),j=W.status==="deleted"?"":yield*NG($,X,W.file),G=V.get(W.file);return{file:W.file,patch:D(W.file,K,j),additions:G?.additions??(W.status==="added"?DJ(j):0),deletions:G?.deletions??(W.status==="deleted"?DJ(K):0),status:W.status}}),{concurrency:8})).toSorted((W,K)=>W.file.localeCompare(K.file))}),wG=Y.fnUntraced(function*($,Z,X,Q){if(!Q)return yield*BZ($,Z,X,Q,yield*Z.status(X),new Map);let[J,V]=yield*Y.all([Z.status(X),Z.stats(X,Q)],{concurrency:2});return yield*BZ($,Z,X,Q,J,FJ(V))}),bG=Y.fnUntraced(function*($,Z,X,Q){let[J,V,B]=yield*Y.all([Z.diff(X,Q),Z.stats(X,Q),Z.status(X)],{concurrency:3});return yield*BZ($,Z,X,Q,xG(J,B.filter((D)=>D.code==="??")),FJ(V))}),LG=q.enum(["git","branch"]),PJ={BranchUpdated:D2.define("vcs.branch.updated",q.object({branch:q.string().optional()}))},UG=q.object({branch:q.string().optional(),default_branch:q.string().optional()}).meta({ref:"VcsInfo"}),AG=q.object({file:q.string(),patch:q.string(),additions:q.number(),deletions:q.number(),status:q.enum(["added","deleted","modified"]).optional()}).meta({ref:"VcsFileDiff"});class X8 extends Z2.Service()("@qitqode/Vcs"){}var zJ=_.effect(X8,Y.gen(function*(){let $=yield*n2.Service,Z=yield*l$.Service,X=yield*u.Service,Q=yield*d2.Scope,J=yield*v.make(Y.fn("Vcs.state")(function*(V){if(V.project.vcs!=="git")return{current:void 0,root:void 0};let B=Y.fnUntraced(function*(){return yield*Z.branch(V.directory)}),[D,H]=yield*Y.all([Z.branch(V.directory),Z.defaultBranch(V.directory)],{concurrency:2}),W={current:D,root:H};return jJ.info("initialized",{branch:W.current,default_branch:W.root?.name}),yield*X.subscribe(c$.Event.Updated).pipe(c2.filter((K)=>K.properties.file.endsWith("HEAD")),c2.runForEach((K)=>Y.gen(function*(){let j=yield*B();if(j!==W.current)jJ.info("branch changed",{from:W.current,to:j}),W.current=j,yield*X.publish(PJ.BranchUpdated,{branch:j})})),Y.forkScoped),W}));return X8.of({init:Y.fn("Vcs.init")(function*(){yield*v.get(J).pipe(Y.forkIn(Q))}),branch:Y.fn("Vcs.branch")(function*(){return yield*v.use(J,(V)=>V.current)}),defaultBranch:Y.fn("Vcs.defaultBranch")(function*(){return yield*v.use(J,(V)=>V.root?.name)}),diff:Y.fn("Vcs.diff")(function*(V){let B=yield*v.get(J),D=yield*v.context;if(D.project.vcs!=="git")return[];if(V==="git")return yield*wG($,Z,D.directory,(yield*Z.hasHead(D.directory))?"HEAD":void 0);if(!B.root)return[];if(B.current&&B.current===B.root.name)return[];let H=yield*Z.mergeBase(D.directory,B.root.ref);if(!H)return[];return yield*bG($,Z,D.directory,H)})})})),MG=zJ.pipe(_.provide(l$.defaultLayer),_.provide(n2.defaultLayer),_.provide(u.layer));var o$={};L2(o$,{layer:()=>dJ,defaultLayer:()=>dG,Worktree:()=>o$,StartCommandFailedError:()=>fG,Service:()=>X7,ResetInput:()=>hG,ResetFailedError:()=>T0,RemoveInput:()=>gG,RemoveFailedError:()=>q1,NotGitError:()=>Z7,NameGenerationFailedError:()=>EJ,Info:()=>fJ,Event:()=>$7,CreateInput:()=>TG,CreateFailedError:()=>vJ});var A$={};L2(A$,{layer:()=>bJ,defaultLayer:()=>GZ,Service:()=>Q8});var P1=s.create({service:"share-next"}),Y8=process.env.QITQODE_DISABLE_SHARE==="true"||process.env.QITQODE_DISABLE_SHARE==="1",_G=c0.Struct({id:c0.String,url:c0.String,secret:c0.String});class Q8 extends Z2.Service()("@qitqode/ShareNext"){}var WZ=($)=>Y.sync(()=>a2.use($));function wJ($){return{create:`/api/${$}`,sync:(Z)=>`/api/${$}/${Z}/sync`,remove:(Z)=>`/api/${$}/${Z}`,data:(Z)=>`/api/${$}/${Z}/data`}}var IG=wJ("share"),RG=wJ("shares");function qJ($){switch($.type){case"session":return"session";case"message":return`message/${$.data.id}`;case"part":return`part/${$.data.messageID}/${$.data.id}`;case"session_diff":return"session_diff";case"model":return"model"}}var bJ=_.effect(Q8,Y.gen(function*(){let $=yield*d8.Service,Z=yield*u.Service,X=yield*V2.Service,Q=yield*KZ.HttpClient,J=KZ.filterStatusOk(Q),V=yield*P2.Service,B=yield*J2.Service;function D(F,U){return Y.gen(function*(){if(Y8)return;if(!(yield*j(F)))return;let S=yield*v.get(H),I=S.queue.get(F);if(I){for(let f of U)I.set(qJ(f),f);return}let M=new Map(U.map((f)=>[qJ(f),f]));S.queue.set(F,M),yield*G(F).pipe(Y.delay(1000),Y.catchCause((f)=>Y.sync(()=>{P1.error("share flush failed",{sessionID:F,cause:f})})),Y.forkIn(S.scope))})}let H=yield*v.make(Y.fn("ShareNext.state")(function*(F){let U={queue:new Map,scope:yield*d2.make(),shared:new Map};if(yield*Y.addFinalizer(()=>d2.close(U.scope,u2.void).pipe(Y.andThen(Y.sync(()=>{U.queue.clear(),U.shared.clear()})))),Y8)return U;let y=(S,I)=>Z.subscribe(S).pipe(c2.runForEach((M)=>I(M).pipe(Y.catchCause((f)=>Y.sync(()=>{P1.error("share subscriber failed",{type:S.type,cause:f})})))),Y.forkScoped);return yield*y(J2.Event.Updated,(S)=>Y.gen(function*(){let I=yield*B.get(S.properties.sessionID);yield*D(I.id,[{type:"session",data:I}])})),yield*y(p.Event.Updated,(S)=>Y.gen(function*(){let I=S.properties.info;if(yield*D(I.sessionID,[{type:"message",data:I}]),I.role!=="user")return;let M=yield*V.getModel(I.model.providerID,I.model.modelID);yield*D(I.sessionID,[{type:"model",data:[M]}])})),yield*y(p.Event.PartUpdated,(S)=>S.properties.part.type==="compaction"?Y.void:D(S.properties.part.sessionID,[{type:"part",data:S.properties.part}])),yield*y(J2.Event.Diff,(S)=>D(S.properties.sessionID,[{type:"session_diff",data:S.properties.diff}])),yield*y(J2.Event.Deleted,(S)=>L(S.properties.sessionID)),U})),W=Y.fn("ShareNext.request")(function*(){let F={},U=yield*$.active();if(Y0.isNone(U)||!U.value.active_org_id){let S=(yield*X.get()).enterprise?.url??"https://opncd.ai";return{headers:F,api:IG,baseUrl:S}}let y=yield*$.token(U.value.id);if(Y0.isNone(y))throw Error("No active account token available for sharing");return F.authorization=`Bearer ${y.value}`,F["x-org-id"]=U.value.active_org_id,{headers:F,api:RG,baseUrl:U.value.url}}),K=Y.fnUntraced(function*(F){let U=yield*WZ((y)=>y.select().from(z1).where(G0(z1.session_id,F)).get());if(!U)return;return{id:U.id,secret:U.secret,url:U.url}}),j=Y.fnUntraced(function*(F){let U=yield*v.get(H);if(U.shared.has(F)){let S=U.shared.get(F);return S===null?void 0:S}let y=yield*K(F);return U.shared.set(F,y??null),y}),G=Y.fn("ShareNext.flush")(function*(F){if(Y8)return;let U=yield*v.get(H),y=U.queue.get(F);if(!y)return;let S=yield*j(F);if(!S){U.queue.delete(F);return}let I=yield*W(),M=yield*H$.post(`${I.baseUrl}${I.api.sync(S.id)}`).pipe(H$.setHeaders(I.headers),H$.bodyJson({secret:S.secret,data:Array.from(y.values())}),Y.flatMap((f)=>Q.execute(f)));if(M.status>=400){P1.warn("failed to sync share",{sessionID:F,shareID:S.id,status:M.status});return}U.queue.delete(F)}),z=Y.fn("ShareNext.full")(function*(F){P1.info("full sync",{sessionID:F});let U=yield*B.get(F),y=yield*B.diff(F),S=yield*Y.sync(()=>Array.from(p.stream(F,{agentID:"*"}))),I=yield*Y.forEach(Array.from(new Map(S.filter((M)=>M.info.role==="user").map((M)=>M.info.model).map((M)=>[`${M.providerID}/${M.modelID}`,M])).values()),(M)=>V.getModel($1.make(M.providerID),t0.make(M.modelID)),{concurrency:8});yield*D(F,[{type:"session",data:U},...S.map((M)=>({type:"message",data:M.info})),...S.flatMap((M)=>M.parts.filter((f)=>f.type!=="compaction").map((f)=>({type:"part",data:f}))),{type:"session_diff",data:y},{type:"model",data:I}])}),O=Y.fn("ShareNext.init")(function*(){if(Y8)return;yield*v.get(H)}),P=Y.fn("ShareNext.url")(function*(){return(yield*W()).baseUrl}),w=Y.fn("ShareNext.create")(function*(F){if(Y8)return{id:"",url:"",secret:""};P1.info("creating share",{sessionID:F});let U=yield*W(),y=yield*H$.post(`${U.baseUrl}${U.api.create}`).pipe(H$.setHeaders(U.headers),H$.bodyJson({sessionID:F}),Y.flatMap((I)=>J.execute(I)),Y.flatMap(NJ.schemaBodyJson(_G)));yield*WZ((I)=>I.insert(z1).values({session_id:F,id:y.id,secret:y.secret,url:y.url}).onConflictDoUpdate({target:z1.session_id,set:{id:y.id,secret:y.secret,url:y.url}}).run());let S=yield*v.get(H);return S.shared.set(F,y),yield*z(F).pipe(Y.catchCause((I)=>Y.sync(()=>{P1.error("share full sync failed",{sessionID:F,cause:I})})),Y.forkIn(S.scope)),y}),L=Y.fn("ShareNext.remove")(function*(F){if(Y8)return;P1.info("removing share",{sessionID:F});let U=yield*v.get(H),y=yield*j(F);if(!y){U.shared.delete(F),U.queue.delete(F);return}let S=yield*W();yield*H$.delete(`${S.baseUrl}${S.api.remove(y.id)}`).pipe(H$.setHeaders(S.headers),H$.bodyJson({secret:y.secret}),Y.flatMap((I)=>J.execute(I))),yield*WZ((I)=>I.delete(z1).where(G0(z1.session_id,F)).run()),U.shared.delete(F),U.queue.delete(F)});return Q8.of({init:O,url:P,request:W,create:w,remove:L})})),GZ=bJ.pipe(_.provide(u.layer),_.provide(d8.defaultLayer),_.provide(V2.defaultLayer),_.provide(xJ.layer),_.provide(P2.defaultLayer),_.provide(J2.defaultLayer));var n4={};L2(n4,{layer:()=>LJ,defaultLayer:()=>CG,Service:()=>i4});class i4 extends Z2.Service()("@qitqode/SessionShare"){}var LJ=_.effect(i4,Y.gen(function*(){let $=yield*V2.Service,Z=yield*J2.Service,X=yield*Q8,Q=yield*d2.Scope,J=Y.fn("SessionShare.share")(function*(D){if((yield*$.get()).share==="disabled")throw Error("Sharing is disabled in configuration");let W=yield*X.create(D);return yield*Y.sync(()=>A1.run(J2.Event.Updated,{sessionID:D,info:{share:{url:W.url}}})),W}),V=Y.fn("SessionShare.unshare")(function*(D){yield*X.remove(D),yield*Y.sync(()=>A1.run(J2.Event.Updated,{sessionID:D,info:{share:{url:null}}}))}),B=Y.fn("SessionShare.create")(function*(D){let H=yield*Z.create(D);if(H.parentID)return H;let W=yield*$.get();if(!(L0.QITQODE_AUTO_SHARE||W.share==="auto"))return H;return yield*J(H.id).pipe(Y.ignore,Y.forkIn(Q)),H});return i4.of({create:B,share:J,unshare:V})})),CG=LJ.pipe(_.provide(GZ),_.provide(J2.defaultLayer),_.provide(V2.defaultLayer));var SJ=MJ(function*(){s.Default.info("bootstrapping",{directory:S2.directory}),yield*V2.Service.use(($)=>$.get()),yield*K2.Service.use(($)=>$.init()),yield*UJ([J$.Service,A$.Service,J8.Service,V8.Service,c$.Service,X8,z0.Service,RJ,CJ].map(($)=>jZ($.use((Z)=>Z.init())))).pipe(HZ("InstanceBootstrap.init")),yield*y$.Service.use(($)=>$.reconcile()).pipe(_J(($)=>AJ(()=>s.Default.warn("memory reconcile failed",{error:String($)}))),jZ),yield*u.Service.use(($)=>$.subscribeCallback(x0.Event.Executed,async(Z)=>{if(Z.properties.name===x0.Default.INIT)IJ(S2.project.id)})),yield*C2.subscribe()}).pipe(HZ("InstanceBootstrap"));var kG=_.mergeAll(V2.defaultLayer,K2.defaultLayer,A$.defaultLayer,J8.defaultLayer,J$.defaultLayer,V8.defaultLayer,c$.defaultLayer,F1.defaultLayer,z0.defaultLayer,u.defaultLayer,y$.defaultLayer,t4.defaultLayer).pipe(_.provide(a4)),kJ=s4.make(kG,{memoMap:r4});var m8=s.create({service:"worktree"}),$7={Ready:D2.define("worktree.ready",q.object({name:q.string(),branch:q.string()})),Failed:D2.define("worktree.failed",q.object({message:q.string()}))},fJ=q.object({name:q.string(),branch:q.string(),directory:q.string()}).meta({ref:"Worktree"}),TG=q.object({name:q.string().optional(),startCommand:q.string().optional().describe("Additional startup script to run after the project's start command")}).meta({ref:"WorktreeCreateInput"}),gG=q.object({directory:q.string()}).meta({ref:"WorktreeRemoveInput"}),hG=q.object({directory:q.string()}).meta({ref:"WorktreeResetInput"}),Z7=w2.create("WorktreeNotGitError",q.object({message:q.string()})),EJ=w2.create("WorktreeNameGenerationFailedError",q.object({message:q.string()})),vJ=w2.create("WorktreeCreateFailedError",q.object({message:q.string()})),fG=w2.create("WorktreeStartCommandFailedError",q.object({message:q.string()})),q1=w2.create("WorktreeRemoveFailedError",q.object({message:q.string()})),T0=w2.create("WorktreeResetFailedError",q.object({message:q.string()}));function EG($){return $.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+/,"").replace(/-+$/,"")}function vG(...$){return $.filter(Boolean).flatMap((Z)=>Z.split(`
|
|
540
540
|
`).map((X)=>X.trim()).flatMap((X)=>{let Q=X.match(/^warning:\s+failed to remove\s+(.+):\s+/i);if(!Q)return[];let J=Q[1]?.trim().replace(/^['"]|['"]$/g,"");if(!J)return[];return[J]}))}class X7 extends Z2.Service()("@qitqode/Worktree"){}var dJ=_.effect(X7,Y.gen(function*(){let $=yield*d2.Scope,Z=yield*n2.Service,X=yield*TJ.Path,Q=yield*i1.ChildProcessSpawner,J=yield*l$.Service,V=yield*U$.Service,B=Y.fnUntraced(function*(A,R){return yield*hJ(Q,A,R)},Y.catch((A)=>Y.succeed({code:1,text:"",stderr:A instanceof Error?A.message:String(A)}))),D=26,H=Y.fn("Worktree.candidate")(function*(A,R){let C=yield*v.context;for(let T of Array.from({length:26},(l,d)=>d)){let l=R?T===0?R:`${R}-${yZ.create()}`:yZ.create(),d=`qitqode/${l}`,g=X.join(A,l);if(yield*Z.exists(g).pipe(Y.orDie))continue;let E=`refs/heads/${d}`;if((yield*B(["show-ref","--verify","--quiet",E],{cwd:C.worktree})).code===0)continue;return fJ.parse({name:l,branch:d,directory:g})}throw new EJ({message:"Failed to generate a unique worktree name"})}),W=Y.fn("Worktree.makeWorktreeInfo")(function*(A){let R=yield*v.context;if(R.project.vcs!=="git")throw new Z7({message:"Worktrees are only supported for git projects"});let C=X.join(q$.Path.data,"worktree",R.project.id);yield*Z.makeDirectory(C,{recursive:!0}).pipe(Y.orDie);let T=A?EG(A):"";return yield*H(C,T||void 0)}),K=Y.fnUntraced(function*(A){let R=yield*v.context,C=yield*B(["worktree","add","--no-checkout","-b",A.branch,A.directory],{cwd:R.worktree});if(C.code!==0)throw new vJ({message:C.stderr||C.text||"Failed to create git worktree"});yield*V.addSandbox(R.project.id,A.directory).pipe(Y.catch(()=>Y.void))}),j=Y.fnUntraced(function*(A,R){let C=yield*v.context,T=yield*v.workspaceID,l=C.project.id,d=R?.trim(),g=yield*B(["reset","--hard"],{cwd:A.directory});if(g.code!==0){let m=g.stderr||g.text||"Failed to populate worktree";m8.error("worktree checkout failed",{directory:A.directory,message:m}),e4.emit("event",{directory:A.directory,project:C.project.id,workspace:T,payload:{type:$7.Failed.type,properties:{message:m}}});return}if(!(yield*Y.promise(()=>S2.provide({directory:A.directory,init:()=>kJ.runPromise(SJ),fn:()=>{return}}).then(()=>!0).catch((m)=>{let e=O$(m);return m8.error("worktree bootstrap failed",{directory:A.directory,message:e}),e4.emit("event",{directory:A.directory,project:C.project.id,workspace:T,payload:{type:$7.Failed.type,properties:{message:e}}}),!1}))))return;e4.emit("event",{directory:A.directory,project:C.project.id,workspace:T,payload:{type:$7.Ready.type,properties:{name:A.name,branch:A.branch}}}),yield*M(A.directory,{projectID:l,extra:d})}),G=Y.fn("Worktree.createFromInfo")(function*(A,R){yield*K(A),yield*j(A,R)}),z=Y.fn("Worktree.create")(function*(A){let R=yield*W(A?.name);return yield*K(R),yield*j(R,A?.startCommand).pipe(Y.catchCause((C)=>Y.sync(()=>m8.error("worktree bootstrap failed",{cause:C}))),Y.forkIn($)),R}),O=Y.fnUntraced(function*(A){let R=X.resolve(A),C=yield*Z.realPath(R).pipe(Y.catch(()=>Y.succeed(R))),T=X.normalize(C);return process.platform==="win32"?T.toLowerCase():T});function P(A){return A.split(`
|
|
541
541
|
`).map((R)=>R.trim()).reduce((R,C)=>{if(!C)return R;if(C.startsWith("worktree "))return R.push({path:C.slice(9).trim()}),R;let T=R[R.length-1];if(!T)return R;if(C.startsWith("branch "))T.branch=C.slice(7).trim();return R},[])}let w=Y.fnUntraced(function*(A,R){for(let C of A){if(!C.path)continue;if((yield*O(C.path))===R)return C}return});function L(A){return Z.exists(A).pipe(Y.orDie,Y.flatMap((R)=>R?B(["fsmonitor--daemon","stop"],{cwd:A}):Y.void))}function F(A){return Y.promise(()=>import("fs/promises").then((R)=>R.rm(A,{recursive:!0,force:!0,maxRetries:5,retryDelay:100})).catch((R)=>{let C=O$(R);throw new q1({message:C||"Failed to remove git worktree directory"})}))}let U=Y.fn("Worktree.remove")(function*(A){let R=yield*v.context;if(R.project.vcs!=="git")throw new Z7({message:"Worktrees are only supported for git projects"});let C=yield*O(A.directory),T=yield*B(["worktree","list","--porcelain"],{cwd:R.worktree});if(T.code!==0)throw new q1({message:T.stderr||T.text||"Failed to read git worktrees"});let l=P(T.text),d=yield*w(l,C);if(!d?.path){if(!(yield*Z.exists(C).pipe(Y.orDie)))return!0;let e=yield*O(X.join(q$.Path.data,"worktree",R.project.id));if(C!==e&&!C.startsWith(`${e}${X.sep}`))throw new q1({message:"Directory is not a registered or managed worktree"});return yield*L(C),yield*F(C),!0}yield*L(d.path);let g=yield*B(["worktree","remove","--force",d.path],{cwd:R.worktree});if(g.code!==0){let m=yield*B(["worktree","list","--porcelain"],{cwd:R.worktree});if(m.code!==0)throw new q1({message:g.stderr||g.text||m.stderr||m.text||"Failed to remove git worktree"});if((yield*w(P(m.text),C))?.path)throw new q1({message:g.stderr||g.text||"Failed to remove git worktree"})}yield*F(d.path);let E=d.branch?.replace(/^refs\/heads\//,"");if(E){let m=yield*B(["branch","-D",E],{cwd:R.worktree});if(m.code!==0)throw new q1({message:m.stderr||m.text||"Failed to delete worktree branch"})}return!0}),y=Y.fnUntraced(function*(A,R,C){let T=yield*B(A,R);if(T.code!==0)throw C(T);return T}),S=Y.fnUntraced(function*(A,R){let[C,T]=process.platform==="win32"?["cmd",["/c",R]]:["bash",["-lc",R]],l=yield*Q.spawn(n1.make(C,T,{cwd:A,extendEnv:!0,stdin:"ignore"})),[,d]=yield*Y.all([c2.runDrain(l.stdout),c2.mkString(c2.decodeText(l.stderr))],{concurrency:2}).pipe(Y.orDie);return{code:yield*l.exitCode,stderr:d}},Y.scoped,Y.catch(()=>Y.succeed({code:1,stderr:""}))),I=Y.fnUntraced(function*(A,R,C){let T=R.trim();if(!T)return!0;let l=yield*S(A,T);if(l.code===0)return!0;return m8.error("worktree start command failed",{kind:C,directory:A,message:l.stderr}),!1}),M=Y.fnUntraced(function*(A,R){let C=yield*Y.sync(()=>a2.use((g)=>g.select().from(DZ).where(G0(DZ.id,R.projectID)).get())),l=(C?U$.fromRow(C):void 0)?.commands?.start?.trim()??"";if(!(yield*I(A,l,"project")))return!1;return yield*I(A,R.extra??"","worktree"),!0}),f=Y.fnUntraced(function*(A,R){let C=yield*O(A);yield*Y.forEach(R,(T)=>Y.gen(function*(){let l=yield*O(X.resolve(A,T));if(l===C)return;if(!l.startsWith(`${C}${X.sep}`))return;yield*Z.remove(l,{recursive:!0}).pipe(Y.ignore)}),{concurrency:8})}),b=Y.fnUntraced(function*(A){let R=yield*B(["clean","-ffdx"],{cwd:A});if(R.code===0)return R;let C=vG(R.stderr,R.text);if(!C.length)return R;return yield*f(A,C),yield*B(["clean","-ffdx"],{cwd:A})}),k=Y.fn("Worktree.reset")(function*(A){let R=yield*v.context;if(R.project.vcs!=="git")throw new Z7({message:"Worktrees are only supported for git projects"});let C=yield*O(A.directory),T=yield*O(R.worktree);if(C===T)throw new T0({message:"Cannot reset the primary workspace"});let l=yield*B(["worktree","list","--porcelain"],{cwd:R.worktree});if(l.code!==0)throw new T0({message:l.stderr||l.text||"Failed to read git worktrees"});let d=yield*w(P(l.text),C);if(!d?.path)throw new T0({message:"Worktree not found"});let g=d.path,E=yield*J.defaultBranch(R.worktree);if(!E)throw new T0({message:"Default branch not found"});let m=E.ref.indexOf("/");if(E.ref!==E.name&&m>0){let a=E.ref.slice(0,m),H2=E.ref.slice(m+1);yield*y(["fetch",a,H2],{cwd:R.worktree},(I2)=>new T0({message:I2.stderr||I2.text||`Failed to fetch ${E.ref}`}))}yield*y(["reset","--hard",E.ref],{cwd:g},(a)=>new T0({message:a.stderr||a.text||"Failed to reset worktree to target"}));let e=yield*b(g);if(e.code!==0)throw new T0({message:e.stderr||e.text||"Failed to clean worktree"});yield*y(["submodule","update","--init","--recursive","--force"],{cwd:g},(a)=>new T0({message:a.stderr||a.text||"Failed to update submodules"})),yield*y(["submodule","foreach","--recursive","git","reset","--hard"],{cwd:g},(a)=>new T0({message:a.stderr||a.text||"Failed to reset submodules"})),yield*y(["submodule","foreach","--recursive","git","clean","-fdx"],{cwd:g},(a)=>new T0({message:a.stderr||a.text||"Failed to clean submodules"}));let n=yield*B(["-c","core.fsmonitor=false","status","--porcelain=v1"],{cwd:g});if(n.code!==0)throw new T0({message:n.stderr||n.text||"Failed to read git status"});if(n.text.trim())throw new T0({message:`Worktree reset left local changes:
|
|
542
|
-
${n.text.trim()}`});return yield*M(g,{projectID:R.project.id}).pipe(Y.catchCause((a)=>Y.sync(()=>m8.error("worktree start task failed",{cause:a}))),Y.forkIn($)),!0}),h=Y.fn("Worktree.head")(function*(A){return(yield*B(["rev-parse","HEAD"],{cwd:A})).text.trim()}),N=Y.fn("Worktree.isPristine")(function*(A,R){let C=yield*B(["status","--porcelain"],{cwd:A});if(C.code!==0)return!1;if(C.text.trim()!=="")return!1;let T=yield*B(["rev-parse","HEAD"],{cwd:A});return T.code===0&&T.text.trim()===R});return X7.of({makeWorktreeInfo:W,createFromInfo:G,create:z,remove:U,reset:k,head:h,isPristine:N})})),dG=dJ.pipe(_.provide(l$.defaultLayer),_.provide(s1),_.provide(U$.defaultLayer),_.provide(n2.defaultLayer),_.provide(gJ.layer));var u8={};L2(u8,{layer:()=>pJ,defaultLayer:()=>iG,UpdateInput:()=>pG,Service:()=>Y7,Pty:()=>u8,Info:()=>FZ,Event:()=>o8,CreateInput:()=>uG});function mJ($){let Z,X=!1;return()=>{if(X)return Z;return X=!0,Z=$(),Z}}var mG=c0.String.annotate({[cJ]:B8.schema("pty")}).pipe(c0.brand("PtyID")),l8=mG.pipe(lJ(($)=>({ascending:(Z)=>$.make(B8.ascending("pty",Z)),zod:B8.schema("pty").pipe(q.custom())})));var c8=s.create({service:"pty"}),oJ=2097152,uJ=65536,lG=new TextEncoder,OZ=($)=>$.data&&typeof $.data==="object"?$.data:$,cG=($)=>{let Z=JSON.stringify({cursor:$}),X=lG.encode(Z),Q=new Uint8Array(X.length+1);return Q[0]=0,Q.set(X,1),Q},oG=mJ(()=>import("./chunk-
|
|
542
|
+
${n.text.trim()}`});return yield*M(g,{projectID:R.project.id}).pipe(Y.catchCause((a)=>Y.sync(()=>m8.error("worktree start task failed",{cause:a}))),Y.forkIn($)),!0}),h=Y.fn("Worktree.head")(function*(A){return(yield*B(["rev-parse","HEAD"],{cwd:A})).text.trim()}),N=Y.fn("Worktree.isPristine")(function*(A,R){let C=yield*B(["status","--porcelain"],{cwd:A});if(C.code!==0)return!1;if(C.text.trim()!=="")return!1;let T=yield*B(["rev-parse","HEAD"],{cwd:A});return T.code===0&&T.text.trim()===R});return X7.of({makeWorktreeInfo:W,createFromInfo:G,create:z,remove:U,reset:k,head:h,isPristine:N})})),dG=dJ.pipe(_.provide(l$.defaultLayer),_.provide(s1),_.provide(U$.defaultLayer),_.provide(n2.defaultLayer),_.provide(gJ.layer));var u8={};L2(u8,{layer:()=>pJ,defaultLayer:()=>iG,UpdateInput:()=>pG,Service:()=>Y7,Pty:()=>u8,Info:()=>FZ,Event:()=>o8,CreateInput:()=>uG});function mJ($){let Z,X=!1;return()=>{if(X)return Z;return X=!0,Z=$(),Z}}var mG=c0.String.annotate({[cJ]:B8.schema("pty")}).pipe(c0.brand("PtyID")),l8=mG.pipe(lJ(($)=>({ascending:(Z)=>$.make(B8.ascending("pty",Z)),zod:B8.schema("pty").pipe(q.custom())})));var c8=s.create({service:"pty"}),oJ=2097152,uJ=65536,lG=new TextEncoder,OZ=($)=>$.data&&typeof $.data==="object"?$.data:$,cG=($)=>{let Z=JSON.stringify({cursor:$}),X=lG.encode(Z),Q=new Uint8Array(X.length+1);return Q[0]=0,Q.set(X,1),Q},oG=mJ(()=>import("./chunk-0bbs01f0.js")),FZ=q.object({id:l8.zod,title:q.string(),command:q.string(),args:q.array(q.string()),cwd:q.string(),status:q.enum(["running","exited"]),pid:q.number()}).meta({ref:"Pty"}),uG=q.object({command:q.string().optional(),args:q.array(q.string()).optional(),cwd:q.string().optional(),title:q.string().optional(),env:q.record(q.string(),q.string()).optional()}),pG=q.object({title:q.string().optional(),size:q.object({rows:q.number(),cols:q.number()}).optional()}),o8={Created:D2.define("pty.created",q.object({info:FZ})),Updated:D2.define("pty.updated",q.object({info:FZ})),Exited:D2.define("pty.exited",q.object({id:l8.zod,exitCode:q.number()})),Deleted:D2.define("pty.deleted",q.object({id:l8.zod}))};class Y7 extends Z2.Service()("@qitqode/Pty"){}var pJ=_.effect(Y7,Y.gen(function*(){let $=yield*u.Service,Z=yield*K2.Service;function X(G){try{G.process.kill()}catch{}for(let[z,O]of G.subscribers.entries())try{if(OZ(O)===z)O.close()}catch{}G.subscribers.clear()}let Q=yield*v.make(Y.fn("Pty.state")(function*(G){let z={dir:G.directory,sessions:new Map};return yield*Y.addFinalizer(()=>Y.sync(()=>{for(let O of z.sessions.values())X(O);z.sessions.clear()})),z})),J=Y.fn("Pty.remove")(function*(G){let z=yield*v.get(Q),O=z.sessions.get(G);if(!O)return;z.sessions.delete(G),c8.info("removing session",{id:G}),X(O),yield*$.publish(o8.Deleted,{id:O.info.id})}),V=Y.fn("Pty.list")(function*(){let G=yield*v.get(Q);return Array.from(G.sessions.values()).map((z)=>z.info)}),B=Y.fn("Pty.get")(function*(G){return(yield*v.get(Q)).sessions.get(G)?.info}),D=Y.fn("Pty.create")(function*(G){let z=yield*v.get(Q),O=yield*P0.make(),P=l8.ascending(),w=G.command||y1.preferred(),L=G.args||[];if(y1.login(w))L.push("-l");let F=G.cwd||z.dir,U=yield*Z.trigger("shell.env",{cwd:F},{env:{}}),y={...q4(),...G.env,...U.env,TERM:"xterm-256color",QITQODE_TERMINAL:"1"};if(process.platform==="win32")y.LC_ALL="C.UTF-8",y.LC_CTYPE="C.UTF-8",y.LANG="C.UTF-8";c8.info("creating session",{id:P,cmd:w,args:L,cwd:F});let{spawn:S}=yield*Y.promise(()=>oG()),I=yield*Y.sync(()=>S(w,L,{name:"xterm-256color",cwd:F,env:y})),M={id:P,title:G.title||`Terminal ${P.slice(-4)}`,command:w,args:L,cwd:F,status:"running",pid:I.pid},f={info:M,process:I,buffer:"",bufferCursor:0,cursor:0,subscribers:new Map};return z.sessions.set(P,f),I.onData(S2.bind((b)=>{f.cursor+=b.length;for(let[h,N]of f.subscribers.entries()){if(N.readyState!==1){f.subscribers.delete(h);continue}if(OZ(N)!==h){f.subscribers.delete(h);continue}try{N.send(b)}catch{f.subscribers.delete(h)}}if(f.buffer+=b,f.buffer.length<=oJ)return;let k=f.buffer.length-oJ;f.buffer=f.buffer.slice(k),f.bufferCursor+=k})),I.onExit(S2.bind(({exitCode:b})=>{if(f.info.status==="exited")return;c8.info("session exited",{id:P,exitCode:b}),f.info.status="exited",O.fork($.publish(o8.Exited,{id:P,exitCode:b})),O.fork(J(P))})),yield*$.publish(o8.Created,{info:M}),M}),H=Y.fn("Pty.update")(function*(G,z){let P=(yield*v.get(Q)).sessions.get(G);if(!P)return;if(z.title)P.info.title=z.title;if(z.size)P.process.resize(z.size.cols,z.size.rows);return yield*$.publish(o8.Updated,{info:P.info}),P.info}),W=Y.fn("Pty.resize")(function*(G,z,O){let w=(yield*v.get(Q)).sessions.get(G);if(w&&w.info.status==="running")w.process.resize(z,O)}),K=Y.fn("Pty.write")(function*(G,z){let P=(yield*v.get(Q)).sessions.get(G);if(P&&P.info.status==="running")P.process.write(z)}),j=Y.fn("Pty.connect")(function*(G,z,O){let w=(yield*v.get(Q)).sessions.get(G);if(!w){z.close();return}c8.info("client connected to session",{id:G});let L=OZ(z);w.subscribers.delete(L),w.subscribers.set(L,z);let F=()=>{w.subscribers.delete(L)},U=w.bufferCursor,y=w.cursor,S=O===-1?y:typeof O==="number"&&Number.isSafeInteger(O)?Math.max(0,O):0,I=(()=>{if(!w.buffer)return"";if(S>=y)return"";let M=Math.max(0,S-U);if(M>=w.buffer.length)return"";return w.buffer.slice(M)})();if(I)try{for(let M=0;M<I.length;M+=uJ)z.send(I.slice(M,M+uJ))}catch{F(),z.close();return}try{z.send(cG(y))}catch{F(),z.close();return}return{onMessage:(M)=>{w.process.write(typeof M==="string"?M:new TextDecoder().decode(M))},onClose:()=>{c8.info("client disconnected from session",{id:G}),F()}}});return Y7.of({list:V,get:B,create:D,update:H,remove:J,resize:W,write:K,connect:j})})),iG=pJ.pipe(_.provide(u.layer),_.provide(K2.defaultLayer));var n8={};L2(n8,{layer:()=>aJ,defaultLayer:()=>rG,Service:()=>V7,MAX_PRE_REACT:()=>nJ,MAX_POST_REACT:()=>sJ,Actor:()=>n8});var Q7=($,Z,X)=>Y.uninterruptible(Y.gen(function*(){let Q=yield*M2.Service;yield*Q.updateStatus($,Z,{status:"running"}).pipe(Y.ignore);let J=yield*X.pipe(Y.interruptible,Y.exit);if(u2.isSuccess(J))return yield*Q.updateStatus($,Z,{status:"idle",lastOutcome:"success",lastError:void 0}).pipe(Y.ignore),J.value;let V=J.cause,B=G2.hasInterruptsOnly(V);return yield*Q.updateStatus($,Z,{status:"idle",lastOutcome:B?"cancelled":"failure",lastError:B?void 0:nG(V)}).pipe(Y.ignore),yield*Y.failCause(V)}));function nG($){return G2.pretty($)}var J7=s.create({service:"actor.spawn"}),nJ=3,sJ=3,aG=`
|
|
543
543
|
|
|
544
544
|
---
|
|
545
545
|
|
|
@@ -569,7 +569,7 @@ This format lets the spawning agent and the checkpoint writer extract your progr
|
|
|
569
569
|
`).join(""))});return u$.set($,Q),Q.finally(()=>{if(u$.get($)===Q)u$.delete($)})}var VH=/^wf_[0-9A-Za-z]+$/,BV=($)=>{if(!VH.test($))throw Error(`invalid workflow runID: ${JSON.stringify($)}`);return $},WV=($)=>xZ.join(s8(),`${BV($)}.js`),wZ=($)=>xZ.join(s8(),`${BV($)}.jsonl`);function KV($){return{runID:$.id,sessionID:$.session_id,name:$.name,status:$.status,running:$.running,succeeded:$.succeeded,failed:$.failed,...$.current_phase?{currentPhase:$.current_phase}:{},...$.parent_actor_id?{parentActorID:$.parent_actor_id}:{},...$.args!==null&&$.args!==void 0?{args:$.args}:{},...$.script_sha?{scriptSha:$.script_sha}:{},...$.agent_timeout_ms!==null&&$.agent_timeout_ms!==void 0?{agentTimeoutMs:$.agent_timeout_ms}:{},...$.error?{error:$.error}:{},createdAt:$.time_created,updatedAt:$.time_updated}}var BH=($)=>Y.sync(()=>a2.use((Z)=>Z.insert(j0).values({id:$.runID,session_id:$.sessionID,name:$.name,status:"running",running:0,succeeded:0,failed:0,parent_actor_id:$.parentActorID??null,args:$.args??null,script_sha:$.scriptSha??null,agent_timeout_ms:$.agentTimeoutMs??null}).onConflictDoUpdate({target:j0.id,set:{status:"running",running:0,succeeded:0,failed:0,script_sha:$.scriptSha??null,...$.agentTimeoutMs!==void 0?{agent_timeout_ms:$.agentTimeoutMs}:{}}}).run())),WH=($)=>Y.sync(()=>a2.use((Z)=>Z.update(j0).set({current_phase:$.phase}).where(G0(j0.id,$.runID)).run())),KH=($)=>Y.sync(()=>a2.use((Z)=>Z.update(j0).set({running:$.running,succeeded:$.succeeded,failed:$.failed}).where(G0(j0.id,$.runID)).run())),GH=($)=>Y.sync(()=>a2.use((Z)=>Z.update(j0).set({status:$.status,...$.error?{error:$.error}:{}}).where(G0(j0.id,$.runID)).run())),HH=($)=>Y.sync(()=>a2.use((Z)=>{return(($?.sessionID)?Z.select().from(j0).where(G0(j0.session_id,$.sessionID)).orderBy(E8(j0.time_created)).all():Z.select().from(j0).orderBy(E8(j0.time_created)).all()).map(KV)})),jH=($)=>Y.sync(()=>a2.use((Z)=>{let X=Z.select().from(j0).where(G0(j0.id,$)).get();return X?KV(X):void 0})),DH=($,Z)=>Y.promise(async()=>{await(await import("fs/promises")).mkdir(s8(),{recursive:!0}),await Bun.write(WV($),Z)}),yH=($)=>Y.promise(()=>Bun.file(WV($)).text()),OH=($,Z)=>Y.promise(()=>VV($,[Z])),FH=($,Z)=>Y.promise(()=>VV($,Z)),PH=($)=>Y.promise(async()=>{let Z=Bun.file(wZ($));if(!await Z.exists())return{results:new Map,pass:1};let X=await Z.text(),Q=new Map,J=0;for(let V of X.split(`
|
|
570
570
|
`)){if(!V)continue;let B;try{B=JSON.parse(V)}catch{continue}if(typeof B.pass==="number"&&B.pass>J)J=B.pass;if(B.t==="agent")Q.set(B.key,B.result)}return{results:Q,pass:J+1}}),zH=($)=>Y.promise(async()=>{let X=(u$.get($)??Promise.resolve()).catch(()=>{}).then(async()=>{await(await import("fs/promises")).mkdir(s8(),{recursive:!0}),await Bun.write(wZ($),"")});u$.set($,X);try{await X}finally{if(u$.get($)===X)u$.delete($)}}),v2={recordStart:BH,recordPhase:WH,flushCounters:KH,recordTerminal:GH,list:HH,load:jH,writeScript:DH,readScript:yH,appendJournal:OH,appendJournalSync:FH,loadJournal:PH,clearJournal:zH};class bZ{#$=new Map;get($){return this.#$.get($)}set($){return this.#$.set($.runID,$),$}values(){return this.#$.values()}clear(){this.#$.clear()}}function GV($){let Z=(V)=>Y.gen(function*(){if(V.status!=="running")return;if(yield*X(V),yield*$.flushNow(V),yield*v2.recordTerminal({runID:V.runID,status:"cancelled"}).pipe(Y.ignore),V.fiber)yield*i8.interrupt(V.fiber);V.status="cancelled",yield*$.bus.publish(B7,{sessionID:V.sessionID,runID:V.runID,status:"cancelled"}),yield*k2.succeed(V.deferred,{status:"cancelled"})}).pipe(Y.provideService(I0,V.instance)),X=(V)=>Y.gen(function*(){let B=Q$.current;if(B)yield*Y.forEach([...V.childActorIDs],(D)=>B.cancel(V.sessionID,D,"graceful").pipe(Y.ignore),{concurrency:"unbounded",discard:!0});yield*Y.forEach([...V.worktrees],(D)=>$.worktree.remove({directory:D}).pipe(Y.ignore),{concurrency:"unbounded",discard:!0}),V.worktrees.clear(),yield*Y.forEach([...V.childRunIDs],(D)=>Y.gen(function*(){let H=$.runs.get(D);if(H&&H.status==="running")yield*Z(H)}).pipe(Y.ignore),{concurrency:"unbounded",discard:!0})}).pipe(Y.provideService(I0,V.instance));return{reclaim:X,cancelEntry:Z,complete:(V)=>Y.gen(function*(){if(V.entry.status="completed",yield*$.flushNow(V.entry),yield*v2.recordTerminal({runID:V.entry.runID,status:"completed"}).pipe(Y.ignore),yield*$.bus.publish(B7,{sessionID:V.sessionID,runID:V.entry.runID,status:"completed"}),V.notifyOnTerminal!==!1)yield*$.inbox.send({receiverSessionID:V.sessionID,receiverActorID:V.parentActorID,senderSessionID:V.sessionID,senderActorID:"workflow",type:"actor_notification",content:`Workflow completed. run_id: ${V.entry.runID}
|
|
571
571
|
`+JSON.stringify(V.result??null).slice(0,4000)}).pipe(Y.ignore);yield*k2.succeed(V.entry.deferred,{status:"completed",result:V.result})}).pipe(Y.provideService(I0,V.entry.instance)),fail:(V)=>Y.gen(function*(){if(yield*X(V.entry),V.entry.status="failed",yield*$.flushNow(V.entry),yield*v2.recordTerminal({runID:V.entry.runID,status:"failed",error:V.error}).pipe(Y.ignore),yield*$.bus.publish(B7,{sessionID:V.sessionID,runID:V.entry.runID,status:"failed",error:V.error}),V.notifyOnTerminal!==!1)yield*$.inbox.send({receiverSessionID:V.sessionID,receiverActorID:V.parentActorID,senderSessionID:V.sessionID,senderActorID:"workflow",type:"actor_notification",content:`Workflow failed. run_id: ${V.entry.runID}
|
|
572
|
-
error: ${V.error}`}).pipe(Y.ignore);yield*k2.succeed(V.entry.deferred,{status:"failed",error:V.error})}).pipe(Y.provideService(I0,V.entry.instance))}}import qH from"os";function LZ($){let Z=0,X=[],Q=()=>{Z--;let J=X.shift();if(J)J()};return{run(J){return new Promise((V,B)=>{let D=()=>{Z++,J().then((H)=>{Q(),V(H)},(H)=>{Q(),B(H)})};if(Z<$)D();else X.push(D)})}}}function HV(){let $=qH.cpus().length;return Math.min(16,2*Math.max(1,$>0?$:4))}function jV($,Z){return Y.gen(function*(){if(Z)yield*v2.clearJournal($).pipe(Y.ignore);let X=yield*v2.loadJournal($);return{results:X.results,pass:X.pass,occurrences:new Map}})}function DV($,Z){let X=$.occurrences.get(Z)??0;return $.occurrences.set(Z,X+1),Z+":"+X}function yV($,Z,X,Q){return v2.appendJournalSync($,[{t:"agent",key:X,result:Q,pass:Z.pass}]).pipe(Y.ignore)}var OV=Symbol("straggler-timeout");function PV($){let Z=(H,W,K,j)=>{let G=W.timeoutMs??$.runAgentTimeoutMs;if(!G||G<=0)return K;return Y.raceFirst(K,Y.sleep(`${G} millis`).pipe(Y.as(OV))).pipe(Y.flatMap((z)=>z===OV?Y.gen(function*(){let O=$.getActor();if(O)yield*O.cancel($.sessionID,H,"graceful").pipe(Y.ignore);return yield*Y.sync(()=>{try{j?.()}catch{}}),null}):Y.succeed(z)))},X=(H,W,K={})=>{try{$.bridge.fork($.bus.publish(XV,{sessionID:$.sessionID,runID:$.runID,actorID:K.actorID,agentType:H.agentType??"general",label:H.label,phase:H.phase??$.entry.currentPhase,reason:W,errorMessage:K.errorMessage}).pipe(Y.ignore))}catch{}},Q=(H)=>H.label?H.phase?`[${H.phase}] ${H.label}`:H.label:H.phase?`[${H.phase}]`:void 0,J=(H,W,K)=>({mode:"subagent",sessionID:$.sessionID,agentType:H.agentType??"general",description:Q(H),task:W,context:"none",tools:H.tools?[...H.tools]:"INHERIT",background:!0,parentActorID:$.parentActorID,model:K,onActorID:(j)=>$.entry.childActorIDs.add(j),...H.schema?{format:{type:"json_schema",schema:H.schema,retryCount:2}}:{}}),V=async(H,W,K,j)=>{$.entry.running++,$.scheduleFlush($.entry);let G="actor-error",z,O,P=await $.bridge.promise(Y.gen(function*(){let w=yield*H.spawn(J(K,W,j));z=w.actorID;let L=yield*Z(w.actorID,K,k2.await(w.outcome).pipe(Y.map((F)=>{if(F.status!=="success")return G="actor-error",O=F.error,null;let U=K.schema?F.structured??null:F.structured??F.finalText??null;if(U===null)G="no-deliverable";return U})),()=>{G="timeout"});return $.entry.childActorIDs.delete(w.actorID),L})).catch((w)=>{return G="spawn-reject",O=w instanceof Error?w.message:String(w),null});if($.entry.running--,P!==null)$.entry.succeeded++;else $.entry.failed++,X(K,G,{actorID:z,errorMessage:O});return $.scheduleFlush($.entry),P},B=async(H,W,K,j)=>{let G="actor-error",z,O,P=await $.bridge.promise(Y.gen(function*(){let b=yield*$.worktree.makeWorktreeInfo();return yield*$.worktree.createFromInfo(b),b})).catch((b)=>{return O=b instanceof Error?b.message:String(b),null});if(!P)return X(K,"spawn-reject",{errorMessage:O}),null;$.entry.worktrees.add(P.directory);let w=await $.bridge.promise($.worktree.head(P.directory)).catch(()=>""),L=await S2.provide({directory:P.directory,fn:()=>Promise.resolve(S2.current)}),F=await $.bridge.promise(FV().pipe(Y.provideService(I0,L)));$.entry.running++,$.scheduleFlush($.entry);let U=await S2.provide({directory:P.directory,fn:()=>F.promise(Y.gen(function*(){let b=yield*H.spawn(J(K,W,j));z=b.actorID;let k=yield*Z(b.actorID,K,k2.await(b.outcome),()=>{G="timeout"});if($.entry.childActorIDs.delete(b.actorID),k===null)return null;if(k.status!=="success")G="actor-error",O=k.error;return{actorID:b.actorID,outcome:k}})).catch((b)=>{return G="spawn-reject",O=b instanceof Error?b.message:String(b),null})}).catch((b)=>{return G="spawn-reject",O=b instanceof Error?b.message:String(b),null}),y=!!U&&U.outcome.status==="success";if($.entry.running--,y)$.entry.succeeded++;else $.entry.failed++,X(K,G,{actorID:z,errorMessage:O});$.scheduleFlush($.entry);let S=U&&U.outcome.status==="success"?K.schema?U.outcome.structured??null:U.outcome.structured??U.outcome.finalText??null:null,I=w!==""&&await $.bridge.promise($.worktree.isPristine(P.directory,w)).catch(()=>!1);if(!(y&&!I))return await $.bridge.promise($.worktree.remove({directory:P.directory})).catch(()=>{return}),$.entry.worktrees.delete(P.directory),y?S:null;let f={branch:P.branch,directory:P.directory,changed:!0};if(S&&typeof S==="object"&&!Array.isArray(S))return{...S,_worktree:f};return{_worktree:f,result:S}},D=async(H,W,K)=>{if($.entry.agentCount>=$.lifecycleCap)return $.warnCapOnce(),X(H,"over-cap"),null;$.entry.agentCount++;let j=$.getActor();if(!j)throw Error("Actor service unavailable");let G=await $.bridge.promise($.resolveAgentModel(H.model,$.defaultModel,$.entry.warnedModelRefs));return K(j,W,H,G)};return(H,W)=>{let K=W??{},j=String(H);if(K.isolation!=="worktree"){let G=JV(j,{agentType:K.agentType,model:K.model,schema:K.schema,phase:K.phase}),z=DV($.journal,G);if($.journal.results.has(z))return $.entry.succeeded++,$.scheduleFlush($.entry),Promise.resolve($.journal.results.get(z));return(async()=>{let O=await $.semaphore.run(async()=>$.globalSemaphore.run(async()=>D(K,j,V)));if(O!==null)await Y.runPromise(yV($.runID,$.journal,z,O));return O})()}return $.semaphore.run(async()=>$.globalSemaphore.run(async()=>D(K,j,B)))}}async function zV($){let Z=UZ(await $),[X,Q,{QuickJSWASMModule:J}]=await Promise.all([Z.importModuleLoader().then(UZ),Z.importFFI(),import("./chunk-
|
|
572
|
+
error: ${V.error}`}).pipe(Y.ignore);yield*k2.succeed(V.entry.deferred,{status:"failed",error:V.error})}).pipe(Y.provideService(I0,V.entry.instance))}}import qH from"os";function LZ($){let Z=0,X=[],Q=()=>{Z--;let J=X.shift();if(J)J()};return{run(J){return new Promise((V,B)=>{let D=()=>{Z++,J().then((H)=>{Q(),V(H)},(H)=>{Q(),B(H)})};if(Z<$)D();else X.push(D)})}}}function HV(){let $=qH.cpus().length;return Math.min(16,2*Math.max(1,$>0?$:4))}function jV($,Z){return Y.gen(function*(){if(Z)yield*v2.clearJournal($).pipe(Y.ignore);let X=yield*v2.loadJournal($);return{results:X.results,pass:X.pass,occurrences:new Map}})}function DV($,Z){let X=$.occurrences.get(Z)??0;return $.occurrences.set(Z,X+1),Z+":"+X}function yV($,Z,X,Q){return v2.appendJournalSync($,[{t:"agent",key:X,result:Q,pass:Z.pass}]).pipe(Y.ignore)}var OV=Symbol("straggler-timeout");function PV($){let Z=(H,W,K,j)=>{let G=W.timeoutMs??$.runAgentTimeoutMs;if(!G||G<=0)return K;return Y.raceFirst(K,Y.sleep(`${G} millis`).pipe(Y.as(OV))).pipe(Y.flatMap((z)=>z===OV?Y.gen(function*(){let O=$.getActor();if(O)yield*O.cancel($.sessionID,H,"graceful").pipe(Y.ignore);return yield*Y.sync(()=>{try{j?.()}catch{}}),null}):Y.succeed(z)))},X=(H,W,K={})=>{try{$.bridge.fork($.bus.publish(XV,{sessionID:$.sessionID,runID:$.runID,actorID:K.actorID,agentType:H.agentType??"general",label:H.label,phase:H.phase??$.entry.currentPhase,reason:W,errorMessage:K.errorMessage}).pipe(Y.ignore))}catch{}},Q=(H)=>H.label?H.phase?`[${H.phase}] ${H.label}`:H.label:H.phase?`[${H.phase}]`:void 0,J=(H,W,K)=>({mode:"subagent",sessionID:$.sessionID,agentType:H.agentType??"general",description:Q(H),task:W,context:"none",tools:H.tools?[...H.tools]:"INHERIT",background:!0,parentActorID:$.parentActorID,model:K,onActorID:(j)=>$.entry.childActorIDs.add(j),...H.schema?{format:{type:"json_schema",schema:H.schema,retryCount:2}}:{}}),V=async(H,W,K,j)=>{$.entry.running++,$.scheduleFlush($.entry);let G="actor-error",z,O,P=await $.bridge.promise(Y.gen(function*(){let w=yield*H.spawn(J(K,W,j));z=w.actorID;let L=yield*Z(w.actorID,K,k2.await(w.outcome).pipe(Y.map((F)=>{if(F.status!=="success")return G="actor-error",O=F.error,null;let U=K.schema?F.structured??null:F.structured??F.finalText??null;if(U===null)G="no-deliverable";return U})),()=>{G="timeout"});return $.entry.childActorIDs.delete(w.actorID),L})).catch((w)=>{return G="spawn-reject",O=w instanceof Error?w.message:String(w),null});if($.entry.running--,P!==null)$.entry.succeeded++;else $.entry.failed++,X(K,G,{actorID:z,errorMessage:O});return $.scheduleFlush($.entry),P},B=async(H,W,K,j)=>{let G="actor-error",z,O,P=await $.bridge.promise(Y.gen(function*(){let b=yield*$.worktree.makeWorktreeInfo();return yield*$.worktree.createFromInfo(b),b})).catch((b)=>{return O=b instanceof Error?b.message:String(b),null});if(!P)return X(K,"spawn-reject",{errorMessage:O}),null;$.entry.worktrees.add(P.directory);let w=await $.bridge.promise($.worktree.head(P.directory)).catch(()=>""),L=await S2.provide({directory:P.directory,fn:()=>Promise.resolve(S2.current)}),F=await $.bridge.promise(FV().pipe(Y.provideService(I0,L)));$.entry.running++,$.scheduleFlush($.entry);let U=await S2.provide({directory:P.directory,fn:()=>F.promise(Y.gen(function*(){let b=yield*H.spawn(J(K,W,j));z=b.actorID;let k=yield*Z(b.actorID,K,k2.await(b.outcome),()=>{G="timeout"});if($.entry.childActorIDs.delete(b.actorID),k===null)return null;if(k.status!=="success")G="actor-error",O=k.error;return{actorID:b.actorID,outcome:k}})).catch((b)=>{return G="spawn-reject",O=b instanceof Error?b.message:String(b),null})}).catch((b)=>{return G="spawn-reject",O=b instanceof Error?b.message:String(b),null}),y=!!U&&U.outcome.status==="success";if($.entry.running--,y)$.entry.succeeded++;else $.entry.failed++,X(K,G,{actorID:z,errorMessage:O});$.scheduleFlush($.entry);let S=U&&U.outcome.status==="success"?K.schema?U.outcome.structured??null:U.outcome.structured??U.outcome.finalText??null:null,I=w!==""&&await $.bridge.promise($.worktree.isPristine(P.directory,w)).catch(()=>!1);if(!(y&&!I))return await $.bridge.promise($.worktree.remove({directory:P.directory})).catch(()=>{return}),$.entry.worktrees.delete(P.directory),y?S:null;let f={branch:P.branch,directory:P.directory,changed:!0};if(S&&typeof S==="object"&&!Array.isArray(S))return{...S,_worktree:f};return{_worktree:f,result:S}},D=async(H,W,K)=>{if($.entry.agentCount>=$.lifecycleCap)return $.warnCapOnce(),X(H,"over-cap"),null;$.entry.agentCount++;let j=$.getActor();if(!j)throw Error("Actor service unavailable");let G=await $.bridge.promise($.resolveAgentModel(H.model,$.defaultModel,$.entry.warnedModelRefs));return K(j,W,H,G)};return(H,W)=>{let K=W??{},j=String(H);if(K.isolation!=="worktree"){let G=JV(j,{agentType:K.agentType,model:K.model,schema:K.schema,phase:K.phase}),z=DV($.journal,G);if($.journal.results.has(z))return $.entry.succeeded++,$.scheduleFlush($.entry),Promise.resolve($.journal.results.get(z));return(async()=>{let O=await $.semaphore.run(async()=>$.globalSemaphore.run(async()=>D(K,j,V)));if(O!==null)await Y.runPromise(yV($.runID,$.journal,z,O));return O})()}return $.semaphore.run(async()=>$.globalSemaphore.run(async()=>D(K,j,B)))}}async function zV($){let Z=UZ(await $),[X,Q,{QuickJSWASMModule:J}]=await Promise.all([Z.importModuleLoader().then(UZ),Z.importFFI(),import("./chunk-zy9w1vkc.js").then(UZ)]),V=await X();V.type="sync";let B=new Q(V);return new J(V,B)}function UZ($){return $&&"default"in $&&$.default?$.default&&"default"in $.default&&$.default.default?$.default.default:$.default:$}function qV($){let Z=typeof $=="number"?$:$.getTime();return function(){return Date.now()>Z}}var NH={type:"sync",importFFI:()=>import("./chunk-xthkjax9.js").then(($)=>$.QuickJSFFI),importModuleLoader:()=>import("./chunk-pp6vhqrr.js").then(($)=>$.default)},NV=NH;var xH=zV(NV),xV=43200000,wH=67108864,bH=2654435769,LH=`
|
|
573
573
|
globalThis.parallel = (thunks) =>
|
|
574
574
|
Promise.all(thunks.map((t) => Promise.resolve().then(t)));
|
|
575
575
|
globalThis.pipeline = (items, ...stages) =>
|
|
@@ -613,4 +613,4 @@ globalThis.URL = class URL {
|
|
|
613
613
|
${$}
|
|
614
614
|
})()`,O=V.evalCode(z);if(O.error){let h=V.dump(O.error);throw O.error.dispose(),Error(`workflow script error: ${typeof h==="string"?h:JSON.stringify(h)}`)}let P=H(O.value),w=1,L=50,F=50,U,y=0,S=()=>{if(J.hasPendingJob())J.executePendingJobs(),y=0;else y++;U=setTimeout(S,y<F?w:L)};U=setTimeout(S,w);let I,M=Date.now()+(X.deadlineMs??xV),f=new Promise((h,N)=>{let A=()=>{if(X.signal?.aborted){N(Error("workflow script aborted"));return}if(Date.now()>=M){N(Error("workflow script deadline exceeded"));return}I=setTimeout(A,5)};I=setTimeout(A,5)}),b,k=new Promise((h,N)=>{if(!X.signal)return;if(X.signal.aborted)return N(Error("workflow script aborted"));if(b=()=>N(Error("workflow script aborted")),X.signal.addEventListener("abort",b,{once:!0}),X.signal.aborted)b()});try{W7("resolve begin");let h=await Promise.race([V.resolvePromise(P),f,k]);if(W7("resolve end"),h.error){let A=V.dump(h.error);throw h.error.dispose(),Error(`workflow script rejected: ${typeof A==="string"?A:JSON.stringify(A)}`)}let N=H(h.value);return V.dump(N)}finally{if(clearTimeout(U),clearTimeout(I),b&&X.signal)X.signal.removeEventListener("abort",b)}}finally{for(let W of D)if(W.alive)W.dispose();for(let W of B)if(W.alive)W.dispose();V.dispose(),J.dispose()}}function UH($,Z,X,Q){for(let[J,V]of Object.entries(Z)){let B=$.newFunction(J,(...D)=>{let H=D.map((K)=>$.dump(K)),W=V(...H);if(W instanceof Promise){let K=$.newPromise();return Q.push(K),W.then((j)=>{if(!$.alive)return;let G=AZ($,j);K.resolve(G),G.dispose(),$.runtime.executePendingJobs()},(j)=>{if(!$.alive)return;let G=$.newString(j instanceof Error?j.message:String(j));K.reject(G),G.dispose(),$.runtime.executePendingJobs()}),K.settled.then(()=>{if($.alive)$.runtime.executePendingJobs()}),K.handle}return AZ($,W)});$.setProp($.global,J,X(B))}}function AZ($,Z){if(Z===void 0||Z===null)return $.undefined;if(typeof Z==="string")return $.newString(Z);if(typeof Z==="number")return $.newNumber(Z);if(typeof Z==="boolean")return Z?$.true:$.false;let X=$.newString(JSON.stringify(Z));try{let Q=$.evalCode("JSON.parse"),J=$.unwrapResult(Q),V=$.callFunction(J,$.undefined,X);return J.dispose(),$.unwrapResult(V)}finally{X.dispose()}}import i$ from"path";import{lstat as AH,realpath as MH}from"fs/promises";async function bV($){let Z=$;while(!0)try{await AH(Z);break}catch{let Q=i$.dirname(Z);if(Q===Z)break;Z=Q}let X=await MH(Z);return i$.resolve(X,i$.relative(Z,$))}async function p$($,Z){let X=i$.resolve($,Z),[Q,J]=await Promise.all([bV(i$.resolve($)),bV(X)]);if(!V$.contains($,X)||!V$.contains(Q,J))throw Error(`workspace path escapes the workspace root: ${JSON.stringify(Z)}`);return X}function UV($){return{async readFile(Z){let X=await p$($,String(Z));if(!await V$.exists(X))return null;return V$.readText(X)},async writeFile(Z,X){let Q=await p$($,String(Z));await V$.write(Q,String(X))},async exists(Z){let X=await p$($,String(Z));return V$.exists(X)},async glob(Z){let X=await LV.scan(String(Z),{cwd:$,absolute:!0,include:"all",dot:!0});return(await Promise.all(X.map(async(J)=>{let V=i$.relative($,J);if(V===""||V===".."||V.startsWith(`..${i$.sep}`)||i$.isAbsolute(V))return;try{return await p$($,V),V}catch{return}}))).filter((J)=>J!==void 0).sort()}}}function AV($){let Z=UV($.workspaceRoot),X={...$.hooks,readFile:Z.readFile,writeFile:Z.writeFile,glob:Z.glob,exists:Z.exists};return{hooks:X,evaluate:(Q,J)=>wV(Q,X,{...J,signal:J.signal})}}import{createHash as _H}from"crypto";function _V($){return Y.fn("WorkflowRuntime.resume")(function*(Z){let X=yield*Y.promise(()=>MV.write("workflow-resume:"+Z.runID));return yield*Y.gen(function*(){let Q=$.runs.get(Z.runID);if(Q&&Q.status==="running")return{runID:Z.runID,resumed:!1};let J=yield*v2.load(Z.runID);if(!J)return{runID:Z.runID,resumed:!1};let V=yield*v2.readScript(Z.runID).pipe(Y.exit),B=u2.isSuccess(V)?V.value:"";if(!B)return{runID:Z.runID,resumed:!1};let D=_H("sha256").update(B).digest("hex"),H=J.scriptSha!==D;return yield*$.launch({script:B,sessionID:J.sessionID,parentActorID:J.parentActorID??"main",args:J.args,freshJournal:H,agentTimeoutMs:Z.agentTimeoutMs??J.agentTimeoutMs},Z.runID,J.name),{runID:Z.runID,resumed:!0}}).pipe(Y.ensuring(Y.sync(()=>X[Symbol.dispose]())))})}import{createHash as CV}from"crypto";import IV from"path";var IH=/export\s+const\s+meta\s*=/;function a8($){return IH.test($)}var RH=/^[A-Za-z0-9._-]+$/;async function RV($,Z,X){if(!RH.test($))throw Error(`invalid workflow name: ${JSON.stringify($)}`);let Q=[".qitqode/workflows",".claude/workflows"];for(let J of await CH($,Q,Z,X))return V$.readText(J);return null}async function CH($,Z,X,Q){if(!V$.contains(Q,X))return[];let J=[],V=X;for(;;){for(let D of Z){let H=IV.join(V,D,`${$}.js`);if(await V$.exists(H))J.push(H)}if(V===Q)break;let B=IV.dirname(V);if(B===V)break;V=B}return J}function SV($){let Z=(V)=>{let B=String(V);$.entry.currentPhase=B,$.entry.transcript.push({kind:"phase",text:B}),$.bridge.fork(v2.recordPhase({runID:$.runID,phase:B}).pipe(Y.ignore)),$.bridge.fork(v2.appendJournal($.runID,{t:"phase",title:B,pass:$.journal.pass}).pipe(Y.ignore)),$.bridge.fork($.bus.publish(eJ,{sessionID:$.sessionID,runID:$.runID,title:B}));return},X=(V)=>{let B=String(V);$.entry.transcript.push({kind:"log",text:B}),$.bridge.fork(v2.appendJournal($.runID,{t:"log",msg:B,pass:$.journal.pass}).pipe(Y.ignore)),$.bridge.fork($.bus.publish($V,{sessionID:$.sessionID,runID:$.runID,message:B}));return},Q=new Map;return{phase:Z,logHook:X,workflowHook:(V,B,D)=>{let H=String(V),W=D??{},K=CV("sha256").update(JSON.stringify({spec:H,args:B??null})).digest("hex"),j=Q.get(K)??0;Q.set(K,j+1);let G=K+":"+j;if($.journal.results.has("wf:"+G))return $.entry.succeeded++,$.scheduleFlush($.entry),Promise.resolve($.journal.results.get("wf:"+G));let z="wf_"+CV("sha256").update($.runID+G).digest("hex");return $.bridge.promise(Y.gen(function*(){let O=a8(H)?H:yield*Y.promise(()=>RV(H,$.workspaceRoot,S2.worktree));if(O===null)return yield*Y.die(Error(`${$.structuralError}: unknown workflow: ${JSON.stringify(H)}`));let P=a8(H)?"inline:"+K.slice(0,12):H;if($.depth+1>$.maxDepth)return yield*Y.die(Error(`${$.structuralError}: workflow nesting exceeds maxDepth (${$.maxDepth})`));if($.lineage.includes(P))return yield*Y.die(Error(`${$.structuralError}: workflow cycle detected: ${P} is already an ancestor`));$.entry.childRunIDs.add(z),yield*$.launch({script:O,sessionID:$.sessionID,parentActorID:$.parentActorID,args:B,model:$.model,workspace:W.workspace?yield*Y.promise(()=>p$($.workspaceRoot,String(W.workspace))):$.workspaceRoot,maxConcurrentAgents:W.maxConcurrentAgents,scriptDeadlineMs:$.scriptDeadlineMs,lineage:[...$.lineage,P],depth:$.depth+1,maxDepth:$.maxDepth,notifyOnTerminal:!1},z,a8(H)?"inline":H);let w=yield*$.waitFor(z);if(w.status==="failed"&&w.error.includes($.structuralError)){let F=w.error.indexOf($.structuralError);return yield*Y.die(Error(w.error.slice(F)))}if(w.status!=="completed")yield*$.bus.publish(YV,{sessionID:$.sessionID,runID:$.runID,childRunID:z,name:a8(H)?"inline":H,status:w.status,...w.status==="failed"?{error:w.error}:{}}).pipe(Y.ignore);let L=w.status==="completed"?w.result??null:null;if(L!==null)yield*v2.appendJournalSync($.runID,[{t:"agent",key:"wf:"+G,result:L,pass:$.journal.pass}]).pipe(Y.ignore);return L}))}}}var MZ=s.create({service:"workflow.runtime"}),n$=($)=>{if(process.env.QQ_WF_TRACE)process.stderr.write(`[wf ${new Date().toISOString()}] ${$}
|
|
615
615
|
`)},SH=43200000,kH=1000,TH="WorkflowStructuralError";class G7 extends Z2.Service()("@qitqode/WorkflowRuntime"){}var TV=_.effect(G7,Y.gen(function*(){let $=yield*u.Service,Z=yield*o0.Service,X=yield*o$.Service,Q=yield*P2.Service,J=yield*V2.Service,V=yield*d2.Scope,B=new bZ,D=(N,A,R)=>N===void 0?Y.succeed(A):Q.resolveModelRef(N).pipe(Y.map((C)=>({providerID:C.providerID,modelID:C.id})),Y.catchCause(()=>Y.sync(()=>{let C=typeof N==="string"?N:`{${Object.keys(N).sort().join(",")}}`;if(!R.has(C))R.add(C),MZ.warn("workflow agent model ref did not resolve \u2014 using run default",{ref:C});return A}))),H,W=0,K,j=Y.fn("WorkflowRuntime.ensureGlobal")(function*(){if(K)return K;return H??=yield*J.get(),W=Math.max(1,H.workflow?.maxConcurrentAgents??HV()),K??=LZ(W),K}),G=new Map,z=(N)=>{let A=G.get(N.runID);if(A)clearTimeout(A),G.delete(N.runID);return v2.flushCounters({runID:N.runID,running:N.running,succeeded:N.succeeded,failed:N.failed}).pipe(Y.ignore)},O=(N)=>{if(G.has(N.runID))return;G.set(N.runID,setTimeout(()=>{G.delete(N.runID),Y.runFork(v2.flushCounters({runID:N.runID,running:N.running,succeeded:N.succeeded,failed:N.failed}).pipe(Y.ignore))},250))},P=GV({runs:B,bus:$,inbox:Z,worktree:X,flushNow:z}),w=(N)=>Y.gen(function*(){let A=B.get(N);if(!A)return{status:"failed",error:"child run missing"};return yield*k2.await(A.deferred)}),L=Y.fn("WorkflowRuntime.launch")(function*(N,A,R){let C=zZ(N.script),T=C.ok?C.body:N.script,l=N.workspace?yield*Y.promise(()=>p$(S2.worktree,N.workspace)):S2.worktree,d=S2.current,g=yield*k2.make(),E={runID:A,sessionID:N.sessionID,instance:d,status:"running",deferred:g,fiber:void 0,childActorIDs:new Set,worktrees:new Set,childRunIDs:new Set,name:R,running:0,succeeded:0,failed:0,agentCount:0,capWarned:!1,warnedModelRefs:new Set,currentPhase:void 0,transcript:[]};B.set(E);let m=kV("sha256").update(N.script).digest("hex");n$(`launch begin ${A}`),yield*v2.recordStart({runID:A,sessionID:N.sessionID,name:R,parentActorID:N.parentActorID,args:N.args,scriptSha:m,agentTimeoutMs:N.agentTimeoutMs}).pipe(Y.ignore),yield*v2.writeScript(A,N.script).pipe(Y.ignore);let e=yield*jV(A,N.freshJournal??!1),n=yield*P0.make(),a=yield*j(),H2=N.lineage??[],I2=N.depth??0,t=N.maxDepth??H?.workflow?.maxDepth??8,N2=N.maxConcurrentAgents??W,j2=Math.max(1,Math.min(N2,W)),g0=LZ(j2),R2=N.maxLifecycleAgents??H?.workflow?.maxLifecycleAgents??kH,X2=()=>{if(E.capWarned)return;E.capWarned=!0,MZ.warn("workflow lifecycle agent cap reached \u2014 over-cap agents return null",{runID:A,cap:R2})},q2=N.agentTimeoutMs,b2=PV({runID:A,sessionID:N.sessionID,parentActorID:N.parentActorID,defaultModel:N.model,runAgentTimeoutMs:q2,lifecycleCap:R2,entry:E,bridge:n,bus:$,worktree:X,getActor:()=>Q$.current,resolveAgentModel:D,journal:e,semaphore:g0,globalSemaphore:a,scheduleFlush:O,warnCapOnce:X2});yield*$.publish(ZV,{sessionID:N.sessionID,runID:A,name:R});let r2=SV({runID:A,sessionID:N.sessionID,parentActorID:N.parentActorID,model:N.model,scriptDeadlineMs:N.scriptDeadlineMs,workspaceRoot:l,lineage:H2,depth:I2,maxDepth:t,entry:E,bridge:n,bus:$,journal:e,scheduleFlush:O,launch:L,waitFor:w,structuralError:TH}),{phase:w0,logHook:D0,workflowHook:p0}=r2,h0=AV({workspaceRoot:l,hooks:{agent:b2,phase:w0,log:D0,workflow:p0}}),M$=Y.gen(function*(){let i0=kV("sha1").update(A).digest().readUInt32BE(0);n$(`eval begin ${A}`);let n0=yield*Y.tryPromise({try:(s0)=>h0.evaluate(T,{deadlineMs:N.scriptDeadlineMs??SH,args:N.args,seed:i0,signal:s0}),catch:(s0)=>s0 instanceof Error?s0:Error(String(s0))}).pipe(Y.result);if(n$(`eval end ${A} ${n0._tag}`),n0._tag==="Success"){yield*P.complete({entry:E,sessionID:N.sessionID,parentActorID:N.parentActorID,result:n0.success,notifyOnTerminal:N.notifyOnTerminal}),n$(`flushed ${A}`),n$(`terminal-recorded ${A}`),n$(`published ${A}`),n$(`deferred-succeeded ${A}`);return}let N1=n0.failure instanceof Error?n0.failure.message:String(n0.failure);MZ.warn("workflow run failed",{runID:A,error:N1}),yield*P.fail({entry:E,sessionID:N.sessionID,parentActorID:N.parentActorID,error:N1,notifyOnTerminal:N.notifyOnTerminal})});return E.fiber=yield*M$.pipe(Y.provideService(I0,d),Y.forkIn(V)),n$(`launched ${A}`),{runID:A}}),F=Y.fn("WorkflowRuntime.start")(function*(N){let A=zZ(N.script);if(!A.ok)return yield*Y.die(A.error);let R=B8.descending("workflow");return yield*L(N,R,A.meta.name)}),U=Y.fn("WorkflowRuntime.status")(function*(N){let A=B.get(N.runID);if(!A)return{status:"unknown",agentCount:0};return{status:A.status,agentCount:A.agentCount,...A.currentPhase!==void 0?{currentPhase:A.currentPhase}:{}}}),y=Y.fn("WorkflowRuntime.transcript")(function*(N){let A=B.get(N.runID);return A?A.transcript.slice():[]}),S=Y.fn("WorkflowRuntime.wait")(function*(N){let A=B.get(N.runID);if(!A)return{status:"failed",error:`unknown runID ${N.runID}`};if(N.timeoutMs===void 0)return yield*k2.await(A.deferred);let R=yield*k2.await(A.deferred).pipe(Y.timeout(N.timeoutMs),Y.catchTag("TimeoutError",()=>Y.succeed(null)));if(R===null)return{status:"failed",error:"workflow wait timed out"};return R}),I=Y.fn("WorkflowRuntime.cancel")(function*(N){let A=B.get(N.runID);if(!A)return;yield*P.cancelEntry(A)}),M=Y.fn("WorkflowRuntime.list")(function*(N){return yield*v2.list(N)}),f=_V({runs:B,launch:L}),b=G7.of({start:F,status:U,wait:S,transcript:y,cancel:I,list:M,resume:f}),k=!1,h=Y.gen(function*(){if(k)return;k=!0,yield*Y.forEach([...B.values()],(N)=>(N.status==="running"?P.cancelEntry(N):Y.void).pipe(Y.ignore),{concurrency:1,discard:!0});for(let N of G.values())clearTimeout(N);G.clear(),B.clear()});return K7.current=b,yield*Y.addFinalizer(()=>h),yield*Y.addFinalizer(()=>Y.sync(()=>{if(K7.current===b)K7.current=void 0})),b})),gH=TV.pipe(_.provide(u.defaultLayer),_.provide(o0.defaultLayer),_.provide(o$.defaultLayer),_.provide(P2.defaultLayer),_.provide(V2.defaultLayer));var hH=_.suspend(()=>_.mergeAll(hV.defaultLayer,n2.defaultLayer,u.defaultLayer,I$.defaultLayer,d8.defaultLayer,V2.defaultLayer,l$.defaultLayer,fV.defaultLayer,V8.defaultLayer,c$.defaultLayer,R$.defaultLayer,z0.defaultLayer,K2.defaultLayer,P2.defaultLayer,cV.defaultLayer,h2.defaultLayer,j$.defaultLayer,EV.defaultLayer,w6.defaultLayer,O2.defaultLayer,mV.defaultLayer,J2.defaultLayer,y0.defaultLayer,O0.defaultLayer,F0.defaultLayer,d0.defaultLayer,F$.defaultLayer,z$.defaultLayer,$$.defaultLayer,q0.defaultLayer,m$.defaultLayer,P$.defaultLayer,G$.defaultLayer,f2.defaultLayer,J$.defaultLayer,N0.defaultLayer,T$.defaultLayer,x0.defaultLayer,j1.defaultLayer,W0.defaultLayer,J8.defaultLayer,U$.defaultLayer,F1.defaultLayer,o$.defaultLayer,u8.defaultLayer,lV.defaultLayer,A$.defaultLayer,n4.defaultLayer,M2.defaultLayer,dV.defaultLayer,n8.defaultLayer,_0.defaultLayer,r8.defaultLayer,y$.defaultLayer,t4.defaultLayer).pipe(_.provideMerge(a4),_.provideMerge(vV))),W8=s4.make(hH,{memoMap:r4}),t8=($)=>gV($),QR={runSync($){return W8.runSync(t8($))},runPromise($,Z){return W8.runPromise(t8($),Z)},runPromiseExit($,Z){return W8.runPromiseExit(t8($),Z)},runFork($){return W8.runFork(t8($))},runCallback($){return W8.runCallback(t8($))},dispose:()=>W8.dispose()};
|
|
616
|
-
export{F1 as
|
|
616
|
+
export{F1 as Lg,T$ as Mg,A8 as Ng,Z0 as Og,M8 as Pg,I8 as Qg,F4 as Rg,N0 as Sg,x0 as Tg,A$ as Ug,n4 as Vg,SJ as Wg,o$ as Xg,c5 as Yg,y0 as Zg,O0 as _g,q0 as $g,$$ as ah,F$ as bh,m$ as ch,l8 as dh,u8 as eh,hH as fh,QR as gh};
|