@qitqode/qitqode-android-arm64 0.1.22 → 0.1.23
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-mbmc1mg0.js → chunk-0136n3jt.js} +1 -1
- package/bundle/{chunk-wm3b050v.js → chunk-05badzhy.js} +1 -1
- package/bundle/{chunk-p64fb4rm.js → chunk-07szgr15.js} +1 -1
- package/bundle/{chunk-jtbf88gw.js → chunk-0svy8w30.js} +2 -2
- package/bundle/{chunk-c88rh38d.js → chunk-0vhsc0yh.js} +1 -1
- package/bundle/{chunk-y0fxwgrv.js → chunk-101y7ce2.js} +1 -1
- package/bundle/{chunk-x6gzygc3.js → chunk-12cd1yj9.js} +1 -1
- package/bundle/chunk-1by6y9tm.js +2 -0
- package/bundle/{chunk-fkdbba26.js → chunk-1eg8mr1q.js} +1 -1
- package/bundle/{chunk-cx0z3mm3.js → chunk-1gg4c0pq.js} +1 -1
- package/bundle/{chunk-cckshvkb.js → chunk-1gjh45v5.js} +1 -1
- package/bundle/chunk-1p7wqmxp.js +2 -0
- package/bundle/{chunk-th189x63.js → chunk-1v47v7vm.js} +1 -1
- package/bundle/{chunk-zt8kghd2.js → chunk-1vx26nt2.js} +1 -1
- package/bundle/{chunk-ee5r4h0v.js → chunk-1w8b88y5.js} +1 -1
- package/bundle/{chunk-mt8zem33.js → chunk-21hnx8rx.js} +1 -1
- package/bundle/chunk-22pvftx8.js +2 -0
- package/bundle/{chunk-j2k4wxsk.js → chunk-22tf95dw.js} +1 -1
- package/bundle/{chunk-hrnx60em.js → chunk-22vvjp4g.js} +2 -2
- package/bundle/{chunk-3nc9wy1m.js → chunk-24r5h0fx.js} +2 -2
- package/bundle/{chunk-kywg73qz.js → chunk-26m5yn5d.js} +1 -1
- package/bundle/{chunk-n4spe0sv.js → chunk-26mt118z.js} +1 -1
- package/bundle/{chunk-t2n6fmpy.js → chunk-29hmwttd.js} +2 -2
- package/bundle/{chunk-abc7ccfd.js → chunk-2adsn1ca.js} +1 -1
- package/bundle/chunk-2bce1njy.js +2 -0
- package/bundle/{chunk-6hkv9411.js → chunk-2e76kpa6.js} +1 -1
- package/bundle/{chunk-7276th89.js → chunk-2e9a9brg.js} +1 -1
- package/bundle/{chunk-ne8ftsv3.js → chunk-2es79khv.js} +3 -3
- package/bundle/{chunk-6v4mhtha.js → chunk-2qj66wf5.js} +1 -1
- package/bundle/{chunk-x1naayst.js → chunk-2qy760rf.js} +1 -1
- package/bundle/{chunk-3f6t3wde.js → chunk-2wcwbp3t.js} +152 -152
- package/bundle/{chunk-6pe3xzkk.js → chunk-338hbnza.js} +1 -1
- package/bundle/{chunk-5a80qybt.js → chunk-36c2avm4.js} +1 -1
- package/bundle/{chunk-9fdv5d8a.js → chunk-381j1hqf.js} +1 -1
- package/bundle/{chunk-y2tnzn1y.js → chunk-3cpqdake.js} +1 -1
- package/bundle/chunk-3gsvbfqz.js +2 -0
- package/bundle/chunk-3j6nrrva.js +4 -0
- package/bundle/{chunk-9g05wsae.js → chunk-3ne6j2h5.js} +1 -1
- package/bundle/{chunk-b5h8vd5n.js → chunk-3sem578c.js} +1 -1
- package/bundle/{chunk-cm31dbwq.js → chunk-3vgnqaem.js} +1 -1
- package/bundle/{chunk-c9afcdba.js → chunk-3w9k7yxx.js} +1 -1
- package/bundle/{chunk-xtjsfqam.js → chunk-3wzpdvpg.js} +1 -1
- package/bundle/{chunk-fyd31m33.js → chunk-3xf7q4ww.js} +1 -1
- package/bundle/chunk-3xrhxyz9.js +2 -0
- package/bundle/chunk-3zdyrnvp.js +2 -0
- package/bundle/{chunk-73d0dy03.js → chunk-44amvtcs.js} +1 -1
- package/bundle/chunk-4nhbgva1.js +2 -0
- package/bundle/{chunk-1zb95qfx.js → chunk-576zfh1s.js} +1 -1
- package/bundle/{chunk-n1wawwry.js → chunk-58w4dhb6.js} +1 -1
- package/bundle/chunk-5ch23jj3.js +2 -0
- package/bundle/{chunk-rvz05kxy.js → chunk-5d18fd4p.js} +1 -1
- package/bundle/{chunk-8x6x3g16.js → chunk-5dpev64z.js} +1 -1
- package/bundle/chunk-5hzkd9te.js +2 -0
- package/bundle/{chunk-t813v629.js → chunk-5vwhfa42.js} +1 -1
- package/bundle/{chunk-gzwcj7c9.js → chunk-5vyper2h.js} +1 -1
- package/bundle/{chunk-bjw39da9.js → chunk-5wr5gpaa.js} +1 -1
- package/bundle/{chunk-xjdxyeja.js → chunk-5x19yah0.js} +1 -1
- package/bundle/{chunk-zfw873yt.js → chunk-62yja34m.js} +1 -1
- package/bundle/{chunk-h9ftcgs2.js → chunk-63pvqy8n.js} +3 -3
- package/bundle/chunk-662x3gq6.js +2 -0
- package/bundle/{chunk-xa0f5g9z.js → chunk-6an0pk19.js} +1 -1
- package/bundle/{chunk-4gfryje2.js → chunk-6j07cgna.js} +1 -1
- package/bundle/chunk-6ybqwnp7.js +2 -0
- package/bundle/{chunk-4se8cbmb.js → chunk-70gfpkxv.js} +1 -1
- package/bundle/chunk-7365jzj1.js +2 -0
- package/bundle/{chunk-x1dfc7qd.js → chunk-799c17nk.js} +1 -1
- package/bundle/chunk-7amvpgng.js +2 -0
- package/bundle/{chunk-68jsyydc.js → chunk-7bxe5s20.js} +1 -1
- package/bundle/chunk-7dcz5ytp.js +2 -0
- package/bundle/chunk-7h7bwjmm.js +2 -0
- package/bundle/{chunk-ck65rcxb.js → chunk-7m4camry.js} +1 -1
- package/bundle/{chunk-vpp88hhd.js → chunk-7n994qss.js} +209 -209
- package/bundle/{chunk-s1mx3bkw.js → chunk-7pr4jxkn.js} +1 -1
- package/bundle/{chunk-98nh88th.js → chunk-7tb9fjvq.js} +2 -2
- package/bundle/{chunk-dgsg31vm.js → chunk-7tthc48p.js} +1 -1
- package/bundle/chunk-7vk5fhhv.js +2 -0
- package/bundle/chunk-7vqw9wge.js +2 -0
- package/bundle/chunk-7vxk5t11.js +2 -0
- package/bundle/{chunk-xz7dccwp.js → chunk-83fm5xcn.js} +1 -1
- package/bundle/{chunk-awdpkgxf.js → chunk-863s0tqa.js} +1 -1
- package/bundle/{chunk-3degq6rv.js → chunk-87pzwjjj.js} +3 -3
- package/bundle/{chunk-78wt9ad8.js → chunk-88kt6qmd.js} +1 -1
- package/bundle/chunk-8b644ae2.js +2 -0
- package/bundle/{chunk-mbkw9s6e.js → chunk-8e2wwdgb.js} +1 -1
- package/bundle/{chunk-hmm1m733.js → chunk-8hh5ejmr.js} +2 -2
- package/bundle/{chunk-y3x5m3e8.js → chunk-8k4mkrdw.js} +1 -1
- package/bundle/{chunk-j6cpsxva.js → chunk-9jjjzmvn.js} +1 -1
- package/bundle/{chunk-8r4xs1q9.js → chunk-9n6f9n1c.js} +1 -1
- package/bundle/{chunk-pp44xnd7.js → chunk-9tq5yt3t.js} +1 -1
- package/bundle/{chunk-qq9pvscd.js → chunk-9y65kbcf.js} +2 -2
- package/bundle/{chunk-vqxyph4q.js → chunk-9yaw0hbp.js} +1 -1
- package/bundle/{chunk-18xhxdsh.js → chunk-9zg3y89v.js} +1 -1
- package/bundle/{chunk-bbznk59q.js → chunk-a3te67a5.js} +2 -2
- package/bundle/{chunk-h7rxnbf0.js → chunk-ac69b9tm.js} +1 -1
- package/bundle/{chunk-50aznc8e.js → chunk-afpwjn78.js} +2 -2
- package/bundle/{chunk-6r4gn18m.js → chunk-agx5m1ev.js} +1 -1
- package/bundle/{chunk-en7nxqvn.js → chunk-agyxa9nj.js} +1 -1
- package/bundle/{chunk-61ndvjmm.js → chunk-an5sr6gw.js} +1 -1
- package/bundle/{chunk-2p6w3w8f.js → chunk-apv1v4tk.js} +2 -2
- package/bundle/{chunk-n9gzj085.js → chunk-ar1by07g.js} +1 -1
- package/bundle/chunk-av2q0ffj.js +2 -0
- package/bundle/{chunk-bn6mg34g.js → chunk-avk3wfch.js} +2 -2
- package/bundle/{chunk-n68xjm4p.js → chunk-ax9yyznf.js} +1 -1
- package/bundle/chunk-azna4wdf.js +2 -0
- package/bundle/chunk-b192q4m0.js +2 -0
- package/bundle/{chunk-b5x3zghc.js → chunk-b2k9yafd.js} +2 -2
- package/bundle/{chunk-fjtq8164.js → chunk-b8z4hgq0.js} +1 -1
- package/bundle/chunk-bh46627y.js +2 -0
- package/bundle/{chunk-6w15nfph.js → chunk-bkaprkf6.js} +1 -1
- package/bundle/{chunk-0ddhkapd.js → chunk-bqeyh2gx.js} +2 -2
- package/bundle/{chunk-tcp31yv0.js → chunk-brrtcqrc.js} +1 -1
- package/bundle/{chunk-m79gd4yt.js → chunk-bwgnmy92.js} +1 -1
- package/bundle/{chunk-1eqcgkyq.js → chunk-bwvjft74.js} +1 -1
- package/bundle/chunk-c267ggx2.js +2 -0
- package/bundle/{chunk-60dxyp37.js → chunk-c38ppnm8.js} +1 -1
- package/bundle/{chunk-4xpfmpjf.js → chunk-c546xxjk.js} +1 -1
- package/bundle/chunk-c6kxegws.js +2 -0
- package/bundle/{chunk-w8xaw2dv.js → chunk-c7dt464m.js} +1 -1
- package/bundle/{chunk-ha5qct06.js → chunk-cbfjjbfd.js} +1 -1
- package/bundle/chunk-cek3cfz4.js +2 -0
- package/bundle/{chunk-x8w2xgx6.js → chunk-cwkdc1cc.js} +1 -1
- package/bundle/{chunk-jrwfx6d8.js → chunk-cz8nnm2a.js} +1 -1
- package/bundle/{chunk-z9b0ydw1.js → chunk-dn1jryxz.js} +1 -1
- package/bundle/{chunk-s4epqtge.js → chunk-dq1wprmb.js} +1 -1
- package/bundle/{chunk-dhvwrrqx.js → chunk-dsny9dh8.js} +2 -2
- package/bundle/{chunk-db7hykjs.js → chunk-ecczet3b.js} +1 -1
- package/bundle/{chunk-qryeqw9s.js → chunk-ejy5404v.js} +1 -1
- package/bundle/{chunk-qwf258sw.js → chunk-eqed7tvt.js} +1 -1
- package/bundle/{chunk-ht1hqsaa.js → chunk-erh9y0sx.js} +1 -1
- package/bundle/{chunk-skjx57kv.js → chunk-ete0y35c.js} +1 -1
- package/bundle/{chunk-qe8zp79w.js → chunk-f1mmzzsn.js} +1 -1
- package/bundle/chunk-f66cvq2q.js +2 -0
- package/bundle/{chunk-bdzgtazc.js → chunk-f958hsha.js} +1 -1
- package/bundle/{chunk-2bbvvh0d.js → chunk-febbrhev.js} +1 -1
- package/bundle/{chunk-j1kqhxnq.js → chunk-fhjpfzjc.js} +1 -1
- package/bundle/{chunk-c2w3bqsa.js → chunk-fnect0ny.js} +1 -1
- package/bundle/{chunk-t7v8wzr9.js → chunk-fp5mvrrx.js} +2 -2
- package/bundle/chunk-fq4v97xn.js +2 -0
- package/bundle/{chunk-6nhgkw5r.js → chunk-fvwys8ej.js} +1 -1
- package/bundle/{chunk-dcyzpkww.js → chunk-fw1f6br4.js} +1 -1
- package/bundle/{chunk-jee9y4t0.js → chunk-fzzze6zd.js} +1 -1
- package/bundle/{chunk-8wzc27e3.js → chunk-g0vzdt58.js} +1 -1
- package/bundle/{chunk-hf0gny5t.js → chunk-g2ec45xj.js} +1 -1
- package/bundle/chunk-g3pb8rad.js +2 -0
- package/bundle/{chunk-3xbtg0hn.js → chunk-g5g9r3v5.js} +1 -1
- package/bundle/{chunk-yy91rm3y.js → chunk-g6gs7cc6.js} +1 -1
- package/bundle/{chunk-h5wh2d49.js → chunk-g6tw5dvr.js} +1 -1
- package/bundle/{chunk-b3x13ndd.js → chunk-g7742sqm.js} +1 -1
- package/bundle/{chunk-btjcs9ee.js → chunk-g7g3zm4v.js} +1 -1
- package/bundle/{chunk-ymv05pbt.js → chunk-g8zrn0at.js} +1 -1
- package/bundle/chunk-gc1yetqd.js +2 -0
- package/bundle/{chunk-67wvdfs5.js → chunk-gjsaw7wm.js} +1 -1
- package/bundle/chunk-gtckkn15.js +2 -0
- package/bundle/chunk-gtzreftf.js +2 -0
- package/bundle/{chunk-tepesp0b.js → chunk-gz8x3915.js} +1 -1
- package/bundle/{chunk-zy0zn8yx.js → chunk-gzse9pab.js} +1 -1
- package/bundle/{chunk-40vz0fhv.js → chunk-hg7kfd0t.js} +1 -1
- package/bundle/{chunk-43xq4p51.js → chunk-hk1ha5fj.js} +1 -1
- package/bundle/{chunk-jfy6bfvv.js → chunk-hqv0s6sw.js} +1 -1
- package/bundle/{chunk-xce77xex.js → chunk-hs8qwx4n.js} +1 -1
- package/bundle/{chunk-k19zvbzh.js → chunk-hvcdemxe.js} +1 -1
- package/bundle/chunk-j5vahbw1.js +2 -0
- package/bundle/{chunk-tq258v8s.js → chunk-jazpapb9.js} +1 -1
- package/bundle/chunk-jek1cnfk.js +3 -0
- package/bundle/chunk-jevrajsx.js +2 -0
- package/bundle/{chunk-m9bc5csy.js → chunk-jge74hh4.js} +1 -1
- package/bundle/{chunk-rpy4rgmm.js → chunk-jq6y56m5.js} +1 -1
- package/bundle/{chunk-6emme4kp.js → chunk-jvkqvgae.js} +1 -1
- package/bundle/chunk-jzdks7bv.js +2 -0
- package/bundle/{chunk-hzexvrnj.js → chunk-k0arcqnt.js} +1 -1
- package/bundle/{chunk-f72j5yx8.js → chunk-k0v37hc6.js} +1 -1
- package/bundle/chunk-k1e7w7w5.js +2 -0
- package/bundle/{chunk-5z8gpy3x.js → chunk-k1ht1sjr.js} +1 -1
- package/bundle/{chunk-thbjhgw0.js → chunk-k33xx2z9.js} +1 -1
- package/bundle/{chunk-496rb1e4.js → chunk-k3pvgwgc.js} +1 -1
- package/bundle/{chunk-1123xk5a.js → chunk-k5294ajv.js} +1 -1
- package/bundle/chunk-k6vf6vq6.js +2 -0
- package/bundle/{chunk-ah9cm91p.js → chunk-kbhby60s.js} +1 -1
- package/bundle/{chunk-01gtn79f.js → chunk-kdr6nxmk.js} +2 -2
- package/bundle/{chunk-ng85b73s.js → chunk-kfdqfha0.js} +1 -1
- package/bundle/{chunk-msqx5bb0.js → chunk-kktcccep.js} +1 -1
- package/bundle/chunk-kn391hb2.js +2 -0
- package/bundle/{chunk-aznbvrbm.js → chunk-kn9skc0g.js} +1 -1
- package/bundle/{chunk-q2weasmk.js → chunk-knmba0q6.js} +1 -1
- package/bundle/chunk-knnemqfm.js +3 -0
- package/bundle/{chunk-gvj8qg7x.js → chunk-kpkbyek5.js} +2 -2
- package/bundle/chunk-kx4b39v6.js +2 -0
- package/bundle/{chunk-qafcfb4x.js → chunk-ky840wjj.js} +1 -1
- package/bundle/{chunk-7yw60h8j.js → chunk-m34zrf70.js} +1 -1
- package/bundle/{chunk-pcctf3gs.js → chunk-m3gsrb1x.js} +1 -1
- package/bundle/{chunk-a3a9bbk7.js → chunk-m81z3zgm.js} +1 -1
- package/bundle/{chunk-30233h8f.js → chunk-m8njvpb8.js} +1 -1
- package/bundle/{chunk-x4c8drpe.js → chunk-m8tfv36b.js} +1 -1
- package/bundle/chunk-mah572rs.js +2 -0
- package/bundle/{chunk-0qmaxpkv.js → chunk-mg03szpz.js} +1 -1
- package/bundle/chunk-mg6nwfw3.js +2 -0
- package/bundle/{chunk-30p5pm3w.js → chunk-mj7rk4xs.js} +1 -1
- package/bundle/{chunk-jatba8z8.js → chunk-mt8btwrv.js} +1 -1
- package/bundle/{chunk-2bxy8zm1.js → chunk-mwbcmvmh.js} +2 -2
- package/bundle/{chunk-pqyds00j.js → chunk-mwjhyj53.js} +1 -1
- package/bundle/{chunk-0jv8r99k.js → chunk-my0kzcby.js} +6 -6
- package/bundle/{chunk-1d6ret10.js → chunk-n889mwgv.js} +1 -1
- package/bundle/{chunk-fa03gsff.js → chunk-naq602da.js} +1 -1
- package/bundle/{chunk-fssgbz70.js → chunk-nb0gc3sx.js} +1 -1
- package/bundle/{chunk-prrrw8t8.js → chunk-ntfh16rj.js} +1 -1
- package/bundle/{chunk-x4b0ywbs.js → chunk-p33fchnf.js} +1 -1
- package/bundle/chunk-pdgrang4.js +2 -0
- package/bundle/{chunk-cpkega70.js → chunk-px15ev1g.js} +1 -1
- package/bundle/{chunk-t4c0zy2s.js → chunk-q1472d56.js} +1 -1
- package/bundle/{chunk-f8xnn26j.js → chunk-q1nvfmrm.js} +1 -1
- package/bundle/{chunk-0vw5a7m9.js → chunk-qkn4039t.js} +1 -1
- package/bundle/{chunk-10qkxzhh.js → chunk-qr2ave8f.js} +1 -1
- package/bundle/{chunk-mqt5qh3t.js → chunk-qx9j6nz1.js} +1 -1
- package/bundle/{chunk-bwyf1bvf.js → chunk-qzd0q1jg.js} +1 -1
- package/bundle/{chunk-7hx0pza2.js → chunk-r0sjwtfc.js} +2 -2
- package/bundle/chunk-r3q82hz3.js +2 -0
- package/bundle/chunk-r4ygs0jv.js +2 -0
- package/bundle/chunk-r6xhxvjv.js +2 -0
- package/bundle/{chunk-djcsvcby.js → chunk-r79mz5kd.js} +1 -1
- package/bundle/chunk-r99pnfra.js +2 -0
- package/bundle/{chunk-qxrjbw22.js → chunk-rjjgnvdk.js} +1 -1
- package/bundle/{chunk-9hrpcnt8.js → chunk-rmmyjyr9.js} +1 -1
- package/bundle/chunk-rq4xdyst.js +2 -0
- package/bundle/chunk-rsd3v7cg.js +2 -0
- package/bundle/{chunk-n39gqxkz.js → chunk-rwanncah.js} +2 -2
- package/bundle/chunk-rxsgbdv0.js +2 -0
- package/bundle/chunk-s4x1jhj3.js +2 -0
- package/bundle/{chunk-ntmn6epc.js → chunk-s75chpxq.js} +1 -1
- package/bundle/{chunk-pkdk0ppc.js → chunk-s7sksztt.js} +2 -2
- package/bundle/{chunk-56cty7nr.js → chunk-scb48j07.js} +2 -2
- package/bundle/{chunk-fgtyrvan.js → chunk-sgq94p3x.js} +1 -1
- package/bundle/{chunk-meaa7wrs.js → chunk-shav33fq.js} +2 -2
- package/bundle/{chunk-zz192a31.js → chunk-shxny9x9.js} +1 -1
- package/bundle/{chunk-t1f7jeat.js → chunk-sjqgmp12.js} +2 -2
- package/bundle/chunk-sx760d9d.js +2 -0
- package/bundle/{chunk-351wfvhp.js → chunk-t42kh492.js} +2 -2
- package/bundle/{chunk-07b36w5g.js → chunk-t66hycva.js} +1 -1
- package/bundle/{chunk-1kje2a6g.js → chunk-t86vj45b.js} +1 -1
- package/bundle/{chunk-fzhgxcej.js → chunk-tfpwfczs.js} +1 -1
- package/bundle/chunk-tmjd3evp.js +8 -0
- package/bundle/chunk-tp1d856p.js +2 -0
- package/bundle/chunk-tpxs00p5.js +2 -0
- package/bundle/chunk-tqk12r89.js +2 -0
- package/bundle/chunk-tycgrqgq.js +2 -0
- package/bundle/{chunk-p20ft5mj.js → chunk-tydvpy1s.js} +2 -2
- package/bundle/{chunk-rry321tn.js → chunk-v1hvnq7y.js} +1 -1
- package/bundle/{chunk-khkv9s5c.js → chunk-v1y3pbfv.js} +1 -1
- package/bundle/chunk-v32cyrg2.js +2 -0
- package/bundle/chunk-v7pypmvk.js +2 -0
- package/bundle/{chunk-mgp034y0.js → chunk-vay29sqp.js} +1 -1
- package/bundle/chunk-vbqyddy8.js +2 -0
- package/bundle/chunk-vgx86f2r.js +2 -0
- package/bundle/{chunk-r8ddb02d.js → chunk-vxc5q0wk.js} +2 -2
- package/bundle/chunk-w0jvqdez.js +2 -0
- package/bundle/{chunk-2qy62cv4.js → chunk-w32tj884.js} +2 -2
- package/bundle/{chunk-8t1whx0k.js → chunk-w6t1qmeg.js} +1 -1
- package/bundle/{chunk-aftpj9fe.js → chunk-w6zgm4vn.js} +1 -1
- package/bundle/chunk-w79yek40.js +2 -0
- package/bundle/chunk-w7nxsfbd.js +3 -0
- package/bundle/{chunk-wfb9dwmc.js → chunk-w8r4gjea.js} +1 -1
- package/bundle/chunk-w9vv1whr.js +2 -0
- package/bundle/chunk-wcea06cr.js +2 -0
- package/bundle/chunk-wcx4bbvn.js +2 -0
- package/bundle/chunk-wdw183vh.js +2 -0
- package/bundle/{chunk-hkmx6w54.js → chunk-wf2mj6de.js} +1 -1
- package/bundle/{chunk-jyh2g13j.js → chunk-wk11xsdh.js} +1 -1
- package/bundle/chunk-wqd3svh6.js +2 -0
- package/bundle/chunk-wqe5spdq.js +2 -0
- package/bundle/chunk-wqww2byk.js +2 -0
- package/bundle/chunk-wybd806z.js +2 -0
- package/bundle/chunk-x1vb00hr.js +2 -0
- package/bundle/chunk-xafh07r3.js +2 -0
- package/bundle/chunk-xgzjcsad.js +2 -0
- package/bundle/{chunk-t8365msg.js → chunk-xjr0xy58.js} +1 -1
- package/bundle/{chunk-zbvf09bm.js → chunk-xn0xhd0w.js} +1 -1
- package/bundle/chunk-xnbfy5jy.js +2 -0
- package/bundle/{chunk-2epf5806.js → chunk-xqzbcs8x.js} +1 -1
- package/bundle/{chunk-h6htvj2y.js → chunk-xtj5qqsw.js} +1 -1
- package/bundle/chunk-xxed39zx.js +3 -0
- package/bundle/{chunk-7w01dxp9.js → chunk-y0qaz8db.js} +1 -1
- package/bundle/{chunk-s6qdtfty.js → chunk-y2h0adg5.js} +2 -2
- package/bundle/{chunk-adgrn60n.js → chunk-y3qf1kg9.js} +1 -1
- package/bundle/{chunk-h725tttx.js → chunk-y62tnk9q.js} +1 -1
- package/bundle/{chunk-4qegdkss.js → chunk-y68fp4kt.js} +1 -1
- package/bundle/chunk-y6pzag4n.js +2 -0
- package/bundle/chunk-y7w6fjwt.js +2 -0
- package/bundle/{chunk-a2ty2e0g.js → chunk-yccm7cfm.js} +2 -2
- package/bundle/{chunk-5mrjxapq.js → chunk-yffkcska.js} +1 -1
- package/bundle/{chunk-mr7ya5kc.js → chunk-ypff4a5n.js} +1 -1
- package/bundle/{chunk-anqjy235.js → chunk-yr4evt94.js} +1 -1
- package/bundle/{chunk-b1t8d1s8.js → chunk-yyarzhw3.js} +1 -1
- package/bundle/chunk-z195gv71.js +2 -0
- package/bundle/{chunk-v9sfzkg5.js → chunk-z1hd38wp.js} +1 -1
- package/bundle/{chunk-8rcpj28e.js → chunk-z65snfyw.js} +1 -1
- package/bundle/{chunk-h99n5rv7.js → chunk-zx90w4mt.js} +1 -1
- package/bundle/{chunk-er5q8nhp.js → chunk-zzdbrxkh.js} +1 -1
- package/bundle/index.js +3 -3
- package/bundle/parser.worker.js +2 -2
- package/bundle/worker.js +1 -1
- package/package.json +1 -1
- package/bundle/chunk-04ezvjjf.js +0 -2
- package/bundle/chunk-0msr85tj.js +0 -2
- package/bundle/chunk-0qrpg3n8.js +0 -2
- package/bundle/chunk-0w8ztgmg.js +0 -2
- package/bundle/chunk-0y2nwncb.js +0 -2
- package/bundle/chunk-0zh8tykf.js +0 -2
- package/bundle/chunk-21z1vfgm.js +0 -2
- package/bundle/chunk-2ec8msmq.js +0 -2
- package/bundle/chunk-2n5m61m9.js +0 -2
- package/bundle/chunk-362z696e.js +0 -2
- package/bundle/chunk-367rm03h.js +0 -2
- package/bundle/chunk-43k17qzb.js +0 -2
- package/bundle/chunk-4r574drd.js +0 -2
- package/bundle/chunk-6c2xn1ab.js +0 -2
- package/bundle/chunk-6rak9ez9.js +0 -2
- package/bundle/chunk-71dbq1d0.js +0 -2
- package/bundle/chunk-73r1zvgw.js +0 -2
- package/bundle/chunk-7az1bpy8.js +0 -2
- package/bundle/chunk-7bm1t462.js +0 -2
- package/bundle/chunk-7nq8126b.js +0 -2
- package/bundle/chunk-80a0d0js.js +0 -2
- package/bundle/chunk-9ac4h2d9.js +0 -2
- package/bundle/chunk-9zp746aj.js +0 -2
- package/bundle/chunk-a0vpemkf.js +0 -2
- package/bundle/chunk-atjzxp7b.js +0 -2
- package/bundle/chunk-ax4f4fbm.js +0 -2
- package/bundle/chunk-aybmm0jf.js +0 -2
- package/bundle/chunk-b2scgkye.js +0 -2
- package/bundle/chunk-bbpze4hq.js +0 -2
- package/bundle/chunk-c6wrjyep.js +0 -2
- package/bundle/chunk-ce3c03mh.js +0 -2
- package/bundle/chunk-cqaw6hka.js +0 -2
- package/bundle/chunk-cxbkhs5y.js +0 -2
- package/bundle/chunk-d9vs6zd0.js +0 -2
- package/bundle/chunk-dj3rct8v.js +0 -2
- package/bundle/chunk-ds162xgb.js +0 -3
- package/bundle/chunk-e1zv873k.js +0 -2
- package/bundle/chunk-eb0ksh4x.js +0 -2
- package/bundle/chunk-efxshjyz.js +0 -2
- package/bundle/chunk-enry018j.js +0 -2
- package/bundle/chunk-f03yje8k.js +0 -3
- package/bundle/chunk-fydd2nmw.js +0 -2
- package/bundle/chunk-g2bw2qf5.js +0 -2
- package/bundle/chunk-h9a4zzr4.js +0 -2
- package/bundle/chunk-hkqcpdmt.js +0 -3
- package/bundle/chunk-jx3kvzka.js +0 -2
- package/bundle/chunk-k6eyc1wv.js +0 -8
- package/bundle/chunk-k9m536te.js +0 -2
- package/bundle/chunk-kv58j3yk.js +0 -2
- package/bundle/chunk-m3sr6xdg.js +0 -2
- package/bundle/chunk-mmyhzhzt.js +0 -2
- package/bundle/chunk-mw60bmaf.js +0 -2
- package/bundle/chunk-nk42gy65.js +0 -2
- package/bundle/chunk-ps8xnz0h.js +0 -2
- package/bundle/chunk-pvn4dz8e.js +0 -2
- package/bundle/chunk-pw3tnt2j.js +0 -2
- package/bundle/chunk-pzajshbc.js +0 -2
- package/bundle/chunk-qvcnvqvf.js +0 -2
- package/bundle/chunk-qy9s3nmy.js +0 -2
- package/bundle/chunk-r0zsgad8.js +0 -4
- package/bundle/chunk-r4hkkcj4.js +0 -2
- package/bundle/chunk-r50kjthp.js +0 -2
- package/bundle/chunk-rbrkvj3x.js +0 -2
- package/bundle/chunk-rhgfyvth.js +0 -2
- package/bundle/chunk-rjdpw6at.js +0 -2
- package/bundle/chunk-s6c5c940.js +0 -2
- package/bundle/chunk-s79zd152.js +0 -2
- package/bundle/chunk-ssfgge5z.js +0 -2
- package/bundle/chunk-tdqbsbyb.js +0 -2
- package/bundle/chunk-tk6gjy9d.js +0 -3
- package/bundle/chunk-tsfpkwvr.js +0 -2
- package/bundle/chunk-v07wtbmt.js +0 -2
- package/bundle/chunk-v6kenrks.js +0 -2
- package/bundle/chunk-v7dfqwxx.js +0 -2
- package/bundle/chunk-vf7hhxsa.js +0 -2
- package/bundle/chunk-vmhq6cyz.js +0 -2
- package/bundle/chunk-vvs87e61.js +0 -2
- package/bundle/chunk-w6z123g2.js +0 -2
- package/bundle/chunk-wg0849tq.js +0 -2
- package/bundle/chunk-xj0ba60b.js +0 -2
- package/bundle/chunk-xtfcdgwe.js +0 -2
- package/bundle/chunk-ye6j8k26.js +0 -2
- package/bundle/chunk-zmqmccbc.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{rh as hM,sh as DR,th as B_,uh as H_,vh as j_,wh as O_,xh as vX,yh as U_,zh as S_}from"./chunk-
|
|
2
|
+
import{rh as hM,sh as DR,th as B_,uh as H_,vh as j_,wh as O_,xh as vX,yh as U_,zh as S_}from"./chunk-1v47v7vm.js";import{Ah as sP,Fh as M0}from"./chunk-tmjd3evp.js";import{xi as vW}from"./chunk-ntfh16rj.js";import{$j as LY,$k as QB,Ak as QU,Bk as XU,Cj as e,Ck as VU,Dj as x1,Ek as _A,Fk as zj,Gk as o4,Hj as sJ,Hk as W_,Ik as P0,Jj as i5,Kj as vE,Lj as aD,Mj as _9,Mk as kO,Nj as yB,Nk as KU,Ok as zM,Pk as oX,Qj as M$,Qk as K2,Rj as p7,Rk as $Y,Sj as g0,Sk as n0,Tj as W2,Tk as Q$,Uj as m0,Vk as s0,Wj as qV,Wk as $C,Xj as I2,Xk as O0,Yj as cZ,Yk as $y,_k as C2,ak as SY,al as pX,bk as q6,bl as LW,ck as p4,cl as E2,dk as W1,dl as D1,ek as n1,el as b0,fk as b1,fl as B0,gk as K_,hk as AX,ik as IX,jk as G_,kk as WQ,lk as BQ,mk as SO,nk as jf,ok as Of,pk as zQ,qk as o1,rk as oZ,sk as dK,tk as _7,uk as _Q,vk as lO,wk as rO,xk as aO,yk as tO,zk as eO}from"./chunk-2wcwbp3t.js";import{gl as GQ,hl as ew}from"./chunk-3sem578c.js";import{Al as P9,Cl as f9,Fl as w0,Gl as U1,Hl as wJ,Il as A6,Jl as A8,Ml as $w,Nl as V6,Pl as q0,Ql as u,Rl as kw,Sl as L2,Tl as dz,sl as H3,tl as Rj,vl as yw,wl as MB,xl as V2,yl as k2,zl as p1}from"./chunk-fzzze6zd.js";import{$l as S0,Ul as wY,Vl as m8,Wl as m$,Xl as u1,_l as Yw}from"./chunk-afpwjn78.js";import{Gn as W8,Hn as I8,Im as d8,cn as j$,dn as o0,en as w$,fn as G8,gn as hO,hm as gO,in as z0,kn as i2,ln as F7,nn as QQ,qn as FM,rn as DM,tn as pZ}from"./chunk-c4x99ayd.js";import{Qo as mZ}from"./chunk-cbfjjbfd.js";import{ip as e9,jp as s4,kp as $7,mp as V8}from"./chunk-jazpapb9.js";import{tp as Z9}from"./chunk-hqv0s6sw.js";import{up as H2}from"./chunk-apv1v4tk.js";import{gq as T8,hq as wM,sq as A9,tq as UP}from"./chunk-fp5mvrrx.js";import{Vq as $M,Wq as uP}from"./chunk-zzdbrxkh.js";import{or as m7}from"./chunk-t42kh492.js";import{sr as w1,xr as tw,yr as X7}from"./chunk-mwbcmvmh.js";import{Ar as N1,Br as W3,Er as B3}from"./chunk-9y65kbcf.js";import{Qr as o2,Rr as VX,Xr as P$,Yr as w8}from"./chunk-24r5h0fx.js";import{Fs as q2}from"./chunk-scb48j07.js";import{Hs as Tj}from"./chunk-k33xx2z9.js";import{$s as Z$,Is as S1,Ks as BX,Ps as ZH,Ss as lY,Ts as kX,Ys as lw,dt as FJ,et as a0,ft as h0,ot as Y0}from"./chunk-tydvpy1s.js";import{At as Z7,Dt as g8,Et as V0,It as z2,pt as mY,rt as t8,tt as V7,xt as K7}from"./chunk-b2k9yafd.js";import{Jt as av}from"./chunk-sjqgmp12.js";import{Kt as F}from"./chunk-jek1cnfk.js";import{Lt as wX,Ot as Ez,Pt as gz,Rt as U6,au as J_}from"./chunk-s7sksztt.js";import{Au as c_,Bu as pW,Cu as LP,Du as SP,Eu as B2,hu as d_,ju as m,ku as IP,lu as F2,mu as A2,nu as cW,ou as NP,pu as X$,qu as W0,ru as H0,su as q$,tu as x2,uu as uW,vu as lW,wu as v2,xu as k1,yu as A0,zu as V$}from"./chunk-22vvjp4g.js";import{$u as M5,Fu as AP}from"./chunk-a3te67a5.js";import{Kz as G3,Vz as hW}from"./chunk-kdr6nxmk.js";import{$F as ry,AF as b,CG as ey,CH as PB,CO as f0,DN as K0,HC as Y_,IE as p0,KJ as k8,MJ as rY,OO as XX,PE as H$,VF as MJ,WE as u0,aO as Q_,bI as V,bO as X_,cO as V_,dC as CX,dO as v7,eO as XO,fO as I_,gC as N2,gG as ay,hO as f7,jO as tY,kF as w2,kO as N_,lD as X0,lG as ty,qJ as y8,uO as n9,vO as $B,xD as h8,xO as L_,yH as _B,yO as Q3}from"./chunk-shav33fq.js";import{hP as CK}from"./chunk-bqeyh2gx.js";import{nP as a6,oP as D0,pP as R0,rP as d2,sP as i9,tP as s9}from"./chunk-naq602da.js";var DH=D0((Sc,IY)=>{function GH($){return Array.isArray($)?$:[$]}var sC=void 0,c3="",VH=" ",d3="\\",nC=/^\s+$/,rC=/(?:[^\\]|^)\\$/,aC=/^\\!/,tC=/^\\#/,eC=/\r?\n/g,$A=/^\.{0,2}\/|^\.{1,2}$/,ZA=/\/$/,p9="/",WH="node-ignore";if(typeof Symbol<"u")WH=Symbol.for("node-ignore");var BH=WH,o9=($,Z,J)=>{return Object.defineProperty($,Z,{value:J}),J},JA=/([0-z])-([0-z])/g,HH=()=>!1,YA=($)=>$.replace(JA,(Z,J,Y)=>J.charCodeAt(0)<=Y.charCodeAt(0)?Z:c3),QA=($)=>{let{length:Z}=$;return $.slice(0,Z-Z%2)},XA=[[/^\uFEFF/,()=>c3],[/((?:\\\\)*?)(\\?\s+)$/,($,Z,J)=>Z+(J.indexOf("\\")===0?VH:c3)],[/(\\+?)\s/g,($,Z)=>{let{length:J}=Z;return Z.slice(0,J-J%2)+VH}],[/[\\$.|*+(){^]/g,($)=>`\\${$}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return!/\/(?!$)/.test(this)?"(?:^|\\/)":"^"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,($,Z,J)=>Z+6<J.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,($,Z,J)=>{let Y=J.replace(/\\\*/g,"[^\\/]*");return Z+Y}],[/\\\\\\(?=[$.|*+(){^])/g,()=>d3],[/\\\\/g,()=>d3],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,($,Z,J,Y,Q)=>Z===d3?`\\[${J}${QA(Y)}${Q}`:Q==="]"?Y.length%2===0?`[${YA(J)}${Y}]`:"[]":"[]"],[/(?:[^*])$/,($)=>/\/$/.test($)?`${$}$`:`${$}(?=$|\\/$)`]],VA=/(^|\\\/)?\\\*$/,LZ="regex",CY="checkRegex",KH="_",KA={[LZ]($,Z){return`${Z?`${Z}[^/]+`:"[^/]*"}(?=$|\\/$)`},[CY]($,Z){return`${Z?`${Z}[^/]*`:"[^/]*"}(?=$|\\/$)`}},GA=($)=>XA.reduce((Z,[J,Y])=>Z.replace(J,Y.bind($)),$),AY=($)=>typeof $==="string",WA=($)=>$&&AY($)&&!nC.test($)&&!rC.test($)&&$.indexOf("#")!==0,BA=($)=>$.split(eC).filter(Boolean);class jH{constructor($,Z,J,Y,Q,X){this.pattern=$,this.mark=Z,this.negative=Q,o9(this,"body",J),o9(this,"ignoreCase",Y),o9(this,"regexPrefix",X)}get regex(){let $=KH+LZ;if(this[$])return this[$];return this._make(LZ,$)}get checkRegex(){let $=KH+CY;if(this[$])return this[$];return this._make(CY,$)}_make($,Z){let J=this.regexPrefix.replace(VA,KA[$]),Y=this.ignoreCase?new RegExp(J,"i"):new RegExp(J);return o9(this,Z,Y)}}var HA=({pattern:$,mark:Z},J)=>{let Y=!1,Q=$;if(Q.indexOf("!")===0)Y=!0,Q=Q.substr(1);Q=Q.replace(aC,"!").replace(tC,"#");let X=GA(Q);return new jH($,Z,Q,J,Y,X)};class OH{constructor($){this._ignoreCase=$,this._rules=[]}_add($){if($&&$[BH]){this._rules=this._rules.concat($._rules._rules),this._added=!0;return}if(AY($))$={pattern:$};if(WA($.pattern)){let Z=HA($,this._ignoreCase);this._added=!0,this._rules.push(Z)}}add($){return this._added=!1,GH(AY($)?BA($):$).forEach(this._add,this),this._added}test($,Z,J){let Y=!1,Q=!1,X;this._rules.forEach((G)=>{let{negative:B}=G;if(Q===B&&Y!==Q||B&&!Y&&!Q&&!Z)return;if(!G[J].test($))return;Y=!B,Q=B,X=B?sC:G});let K={ignored:Y,unignored:Q};if(X)K.rule=X;return K}}var jA=($,Z)=>{throw new Z($)},E8=($,Z,J)=>{if(!AY($))return J(`path must be a string, but got \`${Z}\``,TypeError);if(!$)return J("path must not be empty",TypeError);if(E8.isNotRelative($))return J(`path should be a \`path.relative()\`d string, but got "${Z}"`,RangeError);return!0},UH=($)=>$A.test($);E8.isNotRelative=UH;E8.convert=($)=>$;class qH{constructor({ignorecase:$=!0,ignoreCase:Z=$,allowRelativePaths:J=!1}={}){o9(this,BH,!0),this._rules=new OH(Z),this._strictPathCheck=!J,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add($){if(this._rules.add($))this._initCache();return this}addPattern($){return this.add($)}_test($,Z,J,Y){let Q=$&&E8.convert($);return E8(Q,$,this._strictPathCheck?jA:HH),this._t(Q,Z,J,Y)}checkIgnore($){if(!ZA.test($))return this.test($);let Z=$.split(p9).filter(Boolean);if(Z.pop(),Z.length){let J=this._t(Z.join(p9)+p9,this._testCache,!0,Z);if(J.ignored)return J}return this._rules.test($,!1,CY)}_t($,Z,J,Y){if($ in Z)return Z[$];if(!Y)Y=$.split(p9).filter(Boolean);if(Y.pop(),!Y.length)return Z[$]=this._rules.test($,J,LZ);let Q=this._t(Y.join(p9)+p9,Z,J,Y);return Z[$]=Q.ignored?Q:this._rules.test($,J,LZ)}ignores($){return this._test($,this._ignoreCache,!1).ignored}createFilter(){return($)=>!this.ignores($)}filter($){return GH($).filter(this.createFilter())}test($){return this._test($,this._testCache,!0)}}var u3=($)=>new qH($),OA=($)=>E8($&&E8.convert($),$,HH),FH=()=>{let $=(J)=>/^\\\\\?\\/.test(J)||/["<>|\u0000-\u001F]+/u.test(J)?J:J.replace(/\\/g,"/");E8.convert=$;let Z=/^[a-z]:\//i;E8.isNotRelative=(J)=>Z.test(J)||UH(J)};if(typeof process<"u"&&process.platform==="win32")FH();IY.exports=u3;u3.default=u3;IY.exports.isPathValid=OA;o9(IY.exports,Symbol.for("setupWindows"),FH)});var RY=D0((vA)=>{vA.isInteger=($)=>{if(typeof $==="number")return Number.isInteger($);if(typeof $==="string"&&$.trim()!=="")return Number.isInteger(Number($));return!1};vA.find=($,Z)=>$.nodes.find((J)=>J.type===Z);vA.exceedsLimit=($,Z,J=1,Y)=>{if(Y===!1)return!1;if(!vA.isInteger($)||!vA.isInteger(Z))return!1;return(Number(Z)-Number($))/Number(J)>=Y};vA.escapeNode=($,Z=0,J)=>{let Y=$.nodes[Z];if(!Y)return;if(J&&Y.type===J||Y.type==="open"||Y.type==="close"){if(Y.escaped!==!0)Y.value="\\"+Y.value,Y.escaped=!0}};vA.encloseBrace=($)=>{if($.type!=="brace")return!1;if($.commas>>0+$.ranges>>0===0)return $.invalid=!0,!0;return!1};vA.isInvalidBrace=($)=>{if($.type!=="brace")return!1;if($.invalid===!0||$.dollar)return!0;if($.commas>>0+$.ranges>>0===0)return $.invalid=!0,!0;if($.open!==!0||$.close!==!0)return $.invalid=!0,!0;return!1};vA.isOpenOrClose=($)=>{if($.type==="open"||$.type==="close")return!0;return $.open===!0||$.close===!0};vA.reduce=($)=>$.reduce((Z,J)=>{if(J.type==="text")Z.push(J.value);if(J.type==="range")J.type="text";return Z},[]);vA.flatten=(...$)=>{let Z=[],J=(Y)=>{for(let Q=0;Q<Y.length;Q++){let X=Y[Q];if(Array.isArray(X)){J(X);continue}if(X!==void 0)Z.push(X)}return Z};return J($),Z}});var TY=D0((ic,NH)=>{var IH=RY();NH.exports=($,Z={})=>{let J=(Y,Q={})=>{let X=Z.escapeInvalid&&IH.isInvalidBrace(Q),K=Y.invalid===!0&&Z.escapeInvalid===!0,G="";if(Y.value){if((X||K)&&IH.isOpenOrClose(Y))return"\\"+Y.value;return Y.value}if(Y.value)return Y.value;if(Y.nodes)for(let B of Y.nodes)G+=J(B);return G};return J($)}});var SH=D0((sc,LH)=>{/*!
|
|
3
3
|
* is-number <https://github.com/jonschlinkert/is-number>
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
@@ -79,7 +79,7 @@ Output: Creates directory 'foo'`)}),t4=F.object({filePath:F.string().describe("T
|
|
|
79
79
|
${F.prettifyError(Z)}`;return`The ${$} tool was called with invalid arguments: ${Z}.
|
|
80
80
|
Please rewrite the input so it satisfies the expected schema.`}function $L($,Z,J,Y){return()=>V.gen(function*(){let Q=typeof Z==="function"?{...yield*Z()}:{...Z},X=Q.execute;return Q.execute=(K,G)=>{let B={"tool.name":$,"session.id":G.sessionID,"message.id":G.messageID,...G.callID?{"tool.call_id":G.callID}:{}};return tN.info("tool call started",{...B}),V.gen(function*(){yield*V.try({try:()=>Q.parameters.parse(K),catch:(j)=>{if(j instanceof F.ZodError&&Q.formatValidationError)return new Z1(Q.formatValidationError(j),{cause:j});return new Z1(eN($,j),{cause:j})}});let H=yield*Q.timeout?X(K,G).pipe(V.timeoutOrElse({duration:h8.millis(Q.timeout),orElse:()=>V.die(new Z1(`The ${$} tool timed out after ${Q.timeout} ms. If this operation is expected to take longer, retry with a larger timeout value.`))})):X(K,G);if(H.metadata.truncated!==void 0)return H;let W=yield*Y.get(G.agent),O=yield*J.output(H.output,{},W);return{...H,output:O.content,metadata:{...H.metadata,truncated:O.truncated,...O.truncated&&{outputPath:O.outputPath}}}}).pipe(V.orDie,V.withSpan("Tool.execute",{attributes:B}))},Q})}function i0($,Z){return Object.assign(V.gen(function*(){let J=yield*Z,Y=yield*l1,Q=yield*X2.Service;return{id:$,init:$L($,J,Y,Q)}}),{id:$})}function c2($){return V.gen(function*(){return{...yield*$.init(),id:$.id}})}var J1={};R0(J1,{layer:()=>yj,defaultLayer:()=>ZL,Tool:()=>DK,Service:()=>uY,Request:()=>pY,Reply:()=>_j,RejectedError:()=>cY,Question:()=>J1,Prompt:()=>hZ,Option:()=>fY,Info:()=>FK,Event:()=>dY,Answer:()=>zK});var Q7=Y0.create({service:"question"});class FK extends K0.Class("QuestionInfo")({...qK,custom:K0.optional(K0.Boolean).annotate({description:"Allow typing a custom answer (default: true)"}),key:K0.optional(K0.String).annotate({description:"i18n key for client-side translation (e.g. plan_exit). When set, clients may translate question/options text using this key as a namespace."}),params:K0.optional(K0.Record(K0.String,K0.String)).annotate({description:"Template parameters for i18n interpolation (e.g. { plan: '.qitqode/plans/...' })"})}){static zod=V8(this)}class DK extends K0.Class("QuestionTool")({messageID:W2,callID:K0.String}){static zod=V8(this)}class pY extends K0.Class("QuestionRequest")({id:Y7,sessionID:g0,questions:K0.Array(FK).annotate({description:"Questions to ask"}),tool:K0.optional(DK)}){static zod=V8(this)}var zK=K0.Array(K0.String).annotate({identifier:"QuestionAnswer"}).pipe(e9(($)=>({zod:V8($)})));class _j extends K0.Class("QuestionReply")({answers:K0.Array(zK).annotate({description:"User answers in order of questions (each answer is an array of selected labels)"})}){static zod=V8(this)}class Pj extends K0.Class("QuestionReplied")({sessionID:g0,requestID:Y7,answers:K0.Array(zK)}){}class Mj extends K0.Class("QuestionRejected")({sessionID:g0,requestID:Y7}){}var dY={Asked:S0.define("question.asked",pY.zod),Replied:S0.define("question.replied",V8(Pj)),Rejected:S0.define("question.rejected",V8(Mj))};class cY extends K0.TaggedErrorClass()("QuestionRejectedError",{}){get message(){return"The user dismissed this question"}}class uY extends X0.Service()("@qitqode/Question"){}var yj=b.effect(uY,V.gen(function*(){let $=yield*e.Service,Z=yield*u.make(V.fn("Question.state")(function*(){let B={pending:new Map,neverAsk:!1};return yield*zj(B.pending,()=>new cY),B})),J=V.fn("Question.ask")(function*(B){let H=(yield*u.get(Z)).pending,W=Y7.ascending();Q7.info("asking",{id:W,questions:B.questions.length});let O=yield*u0.make(),j=K0.decodeUnknownSync(pY)({id:W,sessionID:B.sessionID,questions:B.questions,tool:B.tool});return H.set(W,{info:j,deferred:O}),yield*$.publish(dY.Asked,j),yield*lY.awaitDeferred(O,()=>{H.delete(W)})}),Y=V.fn("Question.reply")(function*(B){let H=(yield*u.get(Z)).pending,W=H.get(B.requestID);if(!W){Q7.warn("reply for unknown request",{requestID:B.requestID});return}H.delete(B.requestID),Q7.info("replied",{requestID:B.requestID,answers:B.answers}),yield*$.publish(dY.Replied,{sessionID:W.info.sessionID,requestID:W.info.id,answers:B.answers}),yield*u0.succeed(W.deferred,B.answers)}),Q=V.fn("Question.reject")(function*(B){let H=(yield*u.get(Z)).pending,W=H.get(B);if(!W){Q7.warn("reject for unknown request",{requestID:B});return}H.delete(B),Q7.info("rejected",{requestID:B}),yield*$.publish(dY.Rejected,{sessionID:W.info.sessionID,requestID:W.info.id}),yield*u0.fail(W.deferred,new cY)}),X=V.fn("Question.list")(function*(){let B=(yield*u.get(Z)).pending;return Array.from(B.values(),(H)=>H.info)}),K=V.fn("Question.neverAsk")(function*(){return(yield*u.get(Z)).neverAsk}),G=V.fn("Question.setNeverAsk")(function*(B){let H=yield*u.get(Z);H.neverAsk=B,Q7.info("never-ask",{enabled:B})});return uY.of({ask:J,reply:Y,reject:Q,list:X,neverAsk:K,setNeverAsk:G})})),ZL=yj.pipe(b.provide(e.layer));function YL($){for(let Z of O0.stream($,{agentID:"*"}))if(Z.info.role==="user"&&Z.info.model)return Z.info.model;return}var wj=V.fn("runPlanSwitch")(function*($,Z,J){let Y=yield*$.session.get(Z.sessionID),Q=JL.relative(q0.worktree,b0.plan(Y)),K=(yield*$.question.ask({sessionID:Z.sessionID,questions:[{key:J.key,params:{plan:Q},question:J.question(Q),header:"Plan",options:J.options}],tool:Z.callID?{messageID:Z.messageID,callID:Z.callID}:void 0}))[0]?.[0];if(K==="No")return yield*new J1.RejectedError;if(K!=="Yes")return{title:"User provided feedback",output:`User chose not to switch yet and provided feedback: ${K}`,metadata:{switched:!1,feedback:K}};let G=YL(Z.sessionID)??(yield*$.provider.defaultModel()),B={id:W2.ascending(),sessionID:Z.sessionID,role:"user",time:{created:Date.now()},agent:J.agent,model:G};return yield*$.session.updateMessage(B),yield*$.session.updatePart({id:m0.ascending(),messageID:B.id,sessionID:Z.sessionID,type:"text",text:J.text(Q),synthetic:!0}),{title:J.title,output:J.output,metadata:{switched:!0,feedback:""}}}),Cj=i0("plan_enter",V.gen(function*(){let $=(yield*M0.toolDescriptionEffect("plan_enter"))??"",Z=yield*b0.Service,J=yield*J1.Service,Y=yield*s0.Service;return{description:$,parameters:Hj,execute:(Q,X)=>V.gen(function*(){if(X.agent==="plan")return{title:"Already in plan mode",output:"You are already in plan mode. This tool is only effective outside of plan mode.",metadata:{switched:!1,feedback:""}};return yield*wj({session:Z,question:J,provider:Y},X,{key:"plan_enter",question:()=>"Would you like to switch to plan mode for structured planning?",options:[{label:"Yes",description:"Switch to plan agent for read-only planning"},{label:"No",description:"Stay in current mode"}],agent:"plan",text:(K)=>`Switched to plan mode. Create a plan at ${K}`,title:"Switching to plan agent",output:"User approved switching to plan agent. Wait for further instructions."})}).pipe(V.orDie)}})),Aj=i0("plan_exit",V.gen(function*(){let $=(yield*M0.toolDescriptionEffect("plan_exit"))??"",Z=yield*b0.Service,J=yield*J1.Service,Y=yield*s0.Service;return{description:$,parameters:jj,execute:(Q,X)=>V.gen(function*(){if(X.agent!=="plan")return{title:"Not in plan mode",output:"You are not in plan mode. This tool is only effective in plan mode.",metadata:{switched:!1,feedback:""}};return yield*wj({session:Z,question:J,provider:Y},X,{key:"plan_exit",question:(K)=>`Plan at ${K} is complete. Would you like to switch to the build agent and start implementing?`,options:[{label:"Yes",description:"Switch to build agent and start implementing the plan"},{label:"No",description:"Stay with plan agent to continue refining the plan"}],agent:"build",text:(K)=>`The plan at ${K} has been approved, you can now edit files. Execute the plan`,title:"Switching to build agent",output:"User approved switching to build agent. Wait for further instructions."})}).pipe(V.orDie)}}));var QL=r4,Ij=i0("question",V.gen(function*(){let $=(yield*M0.toolDescriptionEffect("question"))??"",Z=yield*J1.Service;return{description:$,parameters:QL,execute:(J,Y)=>V.gen(function*(){if(yield*Z.neverAsk())return{title:`Auto-resolved ${J.questions.length} question${J.questions.length>1?"s":""}`,output:"[Never-Ask] No user is available to answer (never-ask mode is on). "+"Re-evaluate the options you just proposed for unattended/headless execution \u2014 "+"prefer text-only, non-interactive, minimal-scope paths and avoid anything that needs a GUI or the user to be present. Pick the best option yourself and continue. "+"IMPORTANT: You MUST explicitly state which option you chose and why in your response text (not just in thinking) \u2014 "+"the user will review the conversation history later and needs to see what you decided without expanding thinking blocks. This applies only to this question; never-ask may be turned off later, so keep using the question tool at future decision points (the user may have returned).",metadata:{answers:J.questions.map(()=>["[Never-Ask] The model will decide autonomously"])}};let Q=yield*Z.ask({sessionID:Y.sessionID,questions:J.questions,tool:Y.callID?{messageID:Y.messageID,callID:Y.callID}:void 0}),X=J.questions.map((K,G)=>`"${K.question}"="${Q[G]?.length?Q[G].join(", "):"Unanswered"}"`).join(", ");return{title:`Asked ${J.questions.length} question${J.questions.length>1?"s":""}`,output:`User has answered your questions: ${X}. You can now continue with the user's answers in mind.`,metadata:{answers:Q}}}).pipe(V.orDie)}}));import AK from"os";import{createWriteStream as IL}from"fs";import{open as NL,stat as LL}from"fs/promises";import Y9 from"path";import{fileURLToPath as Ej}from"url";var q1={};R0(q1,{preferred:()=>qL,posix:()=>UL,name:()=>vZ,login:()=>OL,killTree:()=>WL,gitbash:()=>_K,acceptable:()=>FL,Shell:()=>q1});import oY from"path";import{spawn as XL}from"child_process";import{setTimeout as Nj}from"timers/promises";var Lj=200,VL=new Set(["fish","nu"]),KL=new Set(["bash","dash","fish","ksh","sh","zsh"]),GL=new Set(["bash","dash","ksh","sh","zsh"]);async function WL($,Z){let J=$.pid;if(!J||Z?.exited?.())return;if(process.platform==="win32"){await new Promise((Y)=>{let Q=XL("taskkill",["/pid",String(J),"/f","/t"],{stdio:"ignore",windowsHide:!0});Q.once("exit",()=>Y()),Q.once("error",()=>Y())});return}try{if(process.kill(-J,"SIGTERM"),await Nj(Lj),!Z?.exited?.())process.kill(-J,"SIGKILL")}catch(Y){if($.kill("SIGTERM"),await Nj(Lj),!Z?.exited?.())$.kill("SIGKILL")}}function BL($){if(process.platform!=="win32")return $;let Z=z2.windowsPath($);if(oY.win32.dirname(Z)!=="."){if(Z.startsWith("/")&&vZ(Z)==="bash")return _K()||Z;return Z}return H2(Z)||Z}function HL(){let $=H2("pwsh.exe");if($)return $;let Z=H2("powershell.exe");if(Z)return Z}function Sj($,Z){if($&&(!Z?.acceptable||!VL.has(vZ($))))return BL($);if(process.platform==="win32"){let J=HL();if(J)return J}return jL()}function _K(){if(process.platform!=="win32")return;if(h0.QITQODE_GIT_BASH_PATH)return h0.QITQODE_GIT_BASH_PATH;let $=H2("git");if(!$)return;let Z=oY.join($,"..","..","bin","bash.exe");if(z2.stat(Z)?.size)return Z}function jL(){if(process.platform==="win32"){let Z=_K();if(Z)return Z;return process.env.COMSPEC||"cmd.exe"}if(process.platform==="darwin")return"/bin/zsh";let $=H2("bash");if($)return $;return"/bin/sh"}function vZ($){if(process.platform==="win32")return oY.win32.parse(z2.windowsPath($)).name.toLowerCase();return oY.basename($).toLowerCase()}function OL($){return KL.has(vZ($))}function UL($){return GL.has(vZ($))}var qL=Z9(()=>Sj(process.env.SHELL)),FL=Z9(()=>Sj(process.env.SHELL,{acceptable:!0}));var T2={};R0(T2,{set:()=>PL,get:()=>_L,clear:()=>ML,SessionCwd:()=>T2,Event:()=>zL});var DL=1000,O6=new Map;Rj(async()=>{O6.clear()});var zL={Changed:S0.define("session.cwd",F.object({sessionID:g0.zod,cwd:F.string()}))};function _L($){return O6.get($)??q0.directory}function PL($,Z){if(O6.delete($),O6.set($,Z),O6.size>DL){let J=O6.keys().next().value;if(J!==void 0)O6.delete(J)}}function ML($){O6.delete($)}var fZ={};R0(fZ,{prefixWith:()=>yL,BashArity:()=>fZ});function yL($,Z){return Tj.bashPrefixWith($,Z)}import wL from"crypto";var PK=Y0.create({service:"bash-interactive"}),xj={Asked:S0.define("bash.interactive.asked",F.object({id:F.string(),command:F.string(),cwd:F.string(),env:F.record(F.string(),F.string()).optional(),description:F.string()})),Replied:S0.define("bash.interactive.replied",F.object({id:F.string(),output:F.string(),exitCode:F.number()}))};class bj extends Error{constructor($){super($);this.name="BashInteractiveError"}}class iY extends X0.Service()("@qitqode/BashInteractive"){}var CL=b.effect(iY,V.gen(function*(){let $=yield*e.Service,Z=yield*u.make(V.fn("BashInteractive.state")(function*(){let X={pending:new Map};return yield*V.addFinalizer(()=>V.gen(function*(){for(let K of X.pending.values())yield*u0.fail(K.deferred,new bj("Instance disposed"));X.pending.clear()})),X})),J=V.fn("BashInteractive.request")(function*(X){let K=(yield*u.get(Z)).pending,G=wL.randomUUID();PK.info("requesting interactive",{id:G,command:X.command});let B=yield*u0.make(),H={id:G,command:X.command,cwd:X.cwd,env:X.env,description:X.description};return K.set(G,{request:H,deferred:B}),yield*$.publish(xj.Asked,H),yield*lY.awaitDeferred(B,()=>{K.delete(G)})}),Y=V.fn("BashInteractive.reply")(function*(X){let K=(yield*u.get(Z)).pending,G=K.get(X.id);if(!G){PK.warn("reply for unknown request",{id:X.id});return}K.delete(X.id),PK.info("replied",{id:X.id,exitCode:X.exitCode}),yield*$.publish(xj.Replied,{id:G.request.id,output:X.output,exitCode:X.exitCode}),yield*u0.succeed(G.deferred,{output:X.output,exitCode:X.exitCode})}),Q=V.fn("BashInteractive.list")(function*(){let X=(yield*u.get(Z)).pending;return Array.from(X.values(),(K)=>K.request)});return iY.of({request:J,reply:Y,list:Q})})),MK=CL.pipe(b.provide(e.layer)),{runPromise:AL}=X7(iY,MK);function kj($){return AL((Z)=>Z.request($))}var gj=30000,SL=h0.QITQODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS||120000,dj=new Set(["powershell","pwsh"]),cj=new Set(["cd","push-location","set-location"]),RL=new Set([...cj,"rm","cp","mv","mkdir","touch","chmod","chown","cat","get-content","set-content","add-content","copy-item","move-item","remove-item","new-item","rename-item"]),TL=new Set(["-destination","-literalpath","-path"]),xL=new Set(["-confirm","-debug","-force","-nonewline","-recurse","-verbose","-whatif"]),IK=Y0.create({service:"bash-tool"}),wK=($)=>{if($.startsWith("file://"))return Ej($);if($.startsWith("/")||/^[a-z]:/i.test($))return $;let Z=new URL($,import.meta.url);return Ej(Z)};function bL($){let Z=[];for(let J=0;J<$.childCount;J++){let Y=$.child(J);if(!Y)continue;if(Y.type==="command_elements"){for(let Q=0;Q<Y.childCount;Q++){let X=Y.child(Q);if(!X||X.type==="command_argument_sep"||X.type==="redirection")continue;Z.push({type:X.type,text:X.text})}continue}if(Y.type!=="command_name"&&Y.type!=="command_name_expr"&&Y.type!=="word"&&Y.type!=="string"&&Y.type!=="raw_string"&&Y.type!=="concatenation")continue;Z.push({type:Y.type,text:Y.text})}return Z}function kL($){return($.parent?.type==="redirected_statement"?$.parent.text:$.text).trim()}function EL($){return $.descendantsOfType("command").filter((Z)=>Boolean(Z))}function uj($){if($.length<2)return $;let Z=$[0],J=$[$.length-1];if((Z==='"'||Z==="'")&&Z===J)return $.slice(1,-1);return $}function lj($){if($==="~")return AK.homedir();if($.startsWith("~/")||$.startsWith("~\\"))return Y9.join(AK.homedir(),$.slice(2));return $}function hj($){if(process.platform!=="win32")return process.env[$];let Z=Object.keys(process.env).find((J)=>J.toLowerCase()===$.toLowerCase());return Z?process.env[Z]:void 0}function gL($,Z,J){let Y=$.toUpperCase();if(Y==="HOME")return AK.homedir();if(Y==="PWD")return Z;if(Y==="PSHOME")return Y9.dirname(J)}function hL($,Z,J){let Y=uj($).replace(/\$\{env:([^}]+)\}/gi,(Q,X)=>hj(X)||"").replace(/\$env:([A-Za-z_][A-Za-z0-9_]*)/gi,(Q,X)=>hj(X)||"").replace(/\$(HOME|PWD|PSHOME)(?=$|[\\/])/gi,(Q,X)=>gL(X,Z,J)||"");return lj(Y)}function vL($){let Z=$.match(/^([A-Za-z]+)::(.*)$/);if(Z){if(Z[1].toLowerCase()!=="filesystem")return;return Z[2]}let J=$.match(/^([A-Za-z]+):(.*)$/);if(!J)return $;if(J[1].length===1)return $;return}function fL($,Z){if($.startsWith("(")||$.startsWith("@("))return!0;if($.includes("$(")||$.includes("${")||$.includes("`"))return!0;if(Z)return/\$(?!env:)/i.test($);return $.includes("$")}function mL($){let Z=/[?*[]/.exec($);if(!Z)return $;if(Z.index===0)return;return $.slice(0,Z.index)}function dL($,Z){if(!Z)return $.slice(1).filter((Q)=>!Q.text.startsWith("-")&&!($[0]?.text==="chmod"&&Q.text.startsWith("+"))).map((Q)=>Q.text);let J=[],Y=!1;for(let Q of $.slice(1)){if(Y){J.push(Q.text),Y=!1;continue}if(Q.type==="command_parameter"){let X=Q.text.toLowerCase();if(xL.has(X))continue;Y=TL.has(X);continue}J.push(Q.text)}return J}function vj($){if($.length<=gj)return $;return`...
|
|
81
81
|
|
|
82
|
-
`+$.slice(-gj)}var cL=/error|exception|failed|fatal|traceback|panic|exit code/i,fj=Math.floor(v8*0.7),mj=Math.floor(J7*0.7),uL=V.fn("BashTool.parse")(function*($,Z){let J=yield*V.promise(()=>oL().then((Y)=>(Z?Y.ps:Y.bash).parse($)).catch((Y)=>{return IK.warn("tree-sitter parse of command failed",{error:String(Y)}),null}));if(!J)throw Error("Failed to parse command");return J.rootNode}),lL=V.fn("BashTool.ask")(function*($,Z){if(Z.dirs.size>0){let J=Array.from(Z.dirs).map((Y)=>{if(process.platform==="win32")return V0.normalizePathPattern(Y9.join(Y,"*"));return Y9.join(Y,"*")});yield*$.ask({permission:"external_directory",patterns:J,always:J,metadata:{}})}if(Z.patterns.size===0)return;yield*$.ask({permission:"bash",patterns:Array.from(Z.patterns),always:Array.from(Z.always),metadata:{}})});function pL($,Z,J,Y,Q){if(process.platform==="win32"&&dj.has(Z))return m$.make($,["-NoLogo","-NoProfile","-NonInteractive","-Command",J],{cwd:Y,env:Q,stdin:"ignore",detached:!1});return m$.make(J,[],{shell:$,cwd:Y,env:Q,stdin:"ignore",detached:process.platform!=="win32"})}var oL=Z9(async()=>{let{Parser:$}=await import("./chunk-
|
|
82
|
+
`+$.slice(-gj)}var cL=/error|exception|failed|fatal|traceback|panic|exit code/i,fj=Math.floor(v8*0.7),mj=Math.floor(J7*0.7),uL=V.fn("BashTool.parse")(function*($,Z){let J=yield*V.promise(()=>oL().then((Y)=>(Z?Y.ps:Y.bash).parse($)).catch((Y)=>{return IK.warn("tree-sitter parse of command failed",{error:String(Y)}),null}));if(!J)throw Error("Failed to parse command");return J.rootNode}),lL=V.fn("BashTool.ask")(function*($,Z){if(Z.dirs.size>0){let J=Array.from(Z.dirs).map((Y)=>{if(process.platform==="win32")return V0.normalizePathPattern(Y9.join(Y,"*"));return Y9.join(Y,"*")});yield*$.ask({permission:"external_directory",patterns:J,always:J,metadata:{}})}if(Z.patterns.size===0)return;yield*$.ask({permission:"bash",patterns:Array.from(Z.patterns),always:Array.from(Z.always),metadata:{}})});function pL($,Z,J,Y,Q){if(process.platform==="win32"&&dj.has(Z))return m$.make($,["-NoLogo","-NoProfile","-NonInteractive","-Command",J],{cwd:Y,env:Q,stdin:"ignore",detached:!1});return m$.make(J,[],{shell:$,cwd:Y,env:Q,stdin:"ignore",detached:process.platform!=="win32"})}var oL=Z9(async()=>{let{Parser:$}=await import("./chunk-v7pypmvk.js"),{default:Z}=await import("./chunk-3zdyrnvp.js",{with:{type:"wasm"}}),J=wK(Z);await $.init({locateFile(){return J}});let{default:Y}=await import("./chunk-7vk5fhhv.js",{with:{type:"wasm"}}),{default:Q}=await import("./chunk-c6kxegws.js",{with:{type:"wasm"}}),X=wK(Y),K=wK(Q),[G,B]=await Promise.all([CK.load(X),CK.load(K)]),H=new $;H.setLanguage(G);let W=new $;return W.setLanguage(B),{bash:H,ps:W}}),pj=i0("bash",V.gen(function*(){let $=(yield*M0.toolDescriptionEffect("bash"))??"",Z=yield*wY,J=yield*V0.Service,Y=yield*l1,Q=yield*n0.Service,X=V.fn("BashTool.cygpath")(function*(O,j){let q=(yield*Z.lines(m$.make(O,["-lc",'cygpath -w -- "$1"',"_",j])).pipe(V.catch(()=>V.succeed([]))))[0]?.trim();if(!q)return;return V0.normalizePath(q)}),K=V.fn("BashTool.resolvePath")(function*(O,j,U){if(process.platform==="win32"){if(q1.posix(U)&&O.startsWith("/")&&V0.windowsPath(O)===O){let q=yield*X(U,O);if(q)return q}return V0.normalizePath(Y9.resolve(j,V0.windowsPath(O)))}return Y9.resolve(j,O)}),G=V.fn("BashTool.argPath")(function*(O,j,U,q){let z=U?hL(O,j,q):lj(uj(O)),A=z&&mL(z);if(!A||fL(A,U))return;let D=U?vL(A):A;if(!D)return;return yield*K(D,j,q)}),B=V.fn("BashTool.collect")(function*(O,j,U,q){let z={dirs:new Set,patterns:new Set,always:new Set},A=yield*V.promise(()=>M0.resolveBashArity());for(let D of EL(O)){let _=bL(D),w=_.map((N)=>N.text),P=U?w[0]?.toLowerCase():w[0];if(P&&RL.has(P))for(let N of dL(_,U)){let L=yield*G(N,j,U,q);if(IK.info("resolved path",{arg:N,resolved:L}),!L||q0.containsPath(L))continue;let T=(yield*J.isDir(L))?L:Y9.dirname(L);z.dirs.add(T)}if(w.length&&(!P||!cj.has(P)))z.patterns.add(kL(D)),z.always.add(fZ.prefixWith(A,w).join(" ")+" *")}return z}),H=V.fn("BashTool.shellEnv")(function*(O,j){let U=yield*Q.trigger("shell.env",{cwd:j,sessionID:O.sessionID,callID:O.callID},{env:{}});return{...V7(),...U.env}}),W=V.fn("BashTool.run")(function*(O,j){let U=v8,q=J7,z=U*2,A="",D="",_=[],w=0,P="",N,L=!1,T=!1,h=!1;yield*j.metadata({metadata:{output:"",description:O.description}});let x=yield*V.scoped(V.gen(function*(){let y=yield*Z.spawn(pL(O.shell,O.name,O.command,O.cwd,O.env));yield*V.forkScoped(f0.runForEach(f0.decodeText(y.all),(d)=>{let c=Buffer.byteLength(d,"utf-8");_.push({text:d,size:c}),w+=c;while(w>z&&_.length>1){let o=_.shift();if(!o)break;w-=o.size,L=!0}if(D=vj(D+d),P)N?.write(d);else if(A+=d,Buffer.byteLength(A,"utf-8")>U)return Y.write(A).pipe(V.andThen((o)=>V.sync(()=>{P=o,L=!0,N=IL(o,{flags:"a"}),A=""})),V.andThen(j.metadata({metadata:{output:D,description:O.description}})));return j.metadata({metadata:{output:D,description:O.description}})}));let R=V.callback((d)=>{if(j.abort.aborted)return d(V.void);let c=()=>d(V.void);if(j.abort.addEventListener("abort",c,{once:!0}),j.abort.aborted)c();return V.sync(()=>j.abort.removeEventListener("abort",c))}),k=V.sleep(`${O.timeout+100} millis`),i=yield*V.raceAll([y.exitCode.pipe(V.map((d)=>({kind:"exit",code:d}))),R.pipe(V.map(()=>({kind:"abort",code:null}))),k.pipe(V.map(()=>({kind:"timeout",code:null})))]);if(i.kind==="abort")h=!0,yield*y.kill({forceKillAfter:"3 seconds"}).pipe(V.orDie);if(i.kind==="timeout")T=!0,yield*y.kill({forceKillAfter:"3 seconds"}).pipe(V.orDie);return i.kind==="exit"?i.code:null})).pipe(V.orDie),v=[];if(T)v.push(`bash tool terminated command after exceeding timeout ${O.timeout} ms. If this command is expected to take longer and is not waiting for interactive input, retry with a larger timeout value in milliseconds.`);if(h)v.push("User aborted the command");let I=_.map((y)=>y.text).join(""),S=OK(I,q,U);if(S.cut)L=!0;if(!P&&S.cut)P=yield*Y.write(I);let E=S.text;if(!E)E="(no output)";if(L&&P){let y=S.text.length>2048?S.text.slice(-2048):S.text;if(cL.test(y)){let k=yield*V.promise(async()=>{try{let i=await LL(P),d=fj*2,c=await NL(P,"r");try{let o=Math.min(Number(i.size),d),p=Buffer.alloc(o);await c.read(p,0,o,0);let J0=p.toString("utf-8"),t=1;for(let a=0;a<J0.length;a++)if(J0.charCodeAt(a)===10)t++;let f=t<=mj+q;return{text:J0,overlaps:f}}finally{await c.close()}}catch{return}});if(k){let i=k.text;if(!k.overlaps){let d=jK(i,mj,fj);E=`...output truncated (head+tail shown due to errors)...
|
|
83
83
|
|
|
84
84
|
Full output saved to: ${P}
|
|
85
85
|
|
|
@@ -7531,7 +7531,7 @@ For full type signatures, all available fields, and more examples:
|
|
|
7531
7531
|
- Cannot modify the permission system
|
|
7532
7532
|
- Tool output truncated at 50KB / 2000 lines
|
|
7533
7533
|
- Prefer small, composable extensions over monolithic ones
|
|
7534
|
-
`}}}catch($){if($ instanceof ReferenceError)return Zz();throw $}}var pE=lE(),oE=Y0.create({service:"skill.builtin"}),Yz=V.fn("Skill.extractBuiltinBundle")(function*($){let Z=Jz.join(FJ.data,"builtin_skills",S1),J=Jz.join(Z,".extracted");return yield*GX({fsys:$,bundle:pE,root:Z,marker:J,markerContent:S1,skipIfPresent:!BX,onExtracted:(Y)=>oE.info("extracted builtin skills",{root:Y})})});var DJ=Y0.create({service:"skill"}),nE=[".claude",".agents",".codex",".opencode"],Qz="skills/**/SKILL.md",rE="{skill,skills}/**/SKILL.md",HX="**/SKILL.md",Xz=F.object({name:F.string(),description:F.string(),location:F.string(),content:F.string(),hidden:F.boolean().optional()}),aE=q2.create("SkillInvalidError",F.object({path:F.string(),message:F.string().optional(),issues:F.custom().optional()})),tE=q2.create("SkillNameMismatchError",F.object({path:F.string(),expected:F.string(),actual:F.string()})),eE=V.fnUntraced(function*($,Z,J){let Y=yield*V.tryPromise({try:()=>_9.parse(Z),catch:(X)=>X}).pipe(V.catch(V.fnUntraced(function*(X){let K=_9.FrontmatterError.isInstance(X)?X.data.message:`Failed to parse skill ${Z}`,{Session:G}=yield*V.promise(()=>import("./chunk-
|
|
7534
|
+
`}}}catch($){if($ instanceof ReferenceError)return Zz();throw $}}var pE=lE(),oE=Y0.create({service:"skill.builtin"}),Yz=V.fn("Skill.extractBuiltinBundle")(function*($){let Z=Jz.join(FJ.data,"builtin_skills",S1),J=Jz.join(Z,".extracted");return yield*GX({fsys:$,bundle:pE,root:Z,marker:J,markerContent:S1,skipIfPresent:!BX,onExtracted:(Y)=>oE.info("extracted builtin skills",{root:Y})})});var DJ=Y0.create({service:"skill"}),nE=[".claude",".agents",".codex",".opencode"],Qz="skills/**/SKILL.md",rE="{skill,skills}/**/SKILL.md",HX="**/SKILL.md",Xz=F.object({name:F.string(),description:F.string(),location:F.string(),content:F.string(),hidden:F.boolean().optional()}),aE=q2.create("SkillInvalidError",F.object({path:F.string(),message:F.string().optional(),issues:F.custom().optional()})),tE=q2.create("SkillNameMismatchError",F.object({path:F.string(),expected:F.string(),actual:F.string()})),eE=V.fnUntraced(function*($,Z,J){let Y=yield*V.tryPromise({try:()=>_9.parse(Z),catch:(X)=>X}).pipe(V.catch(V.fnUntraced(function*(X){let K=_9.FrontmatterError.isInstance(X)?X.data.message:`Failed to parse skill ${Z}`,{Session:G}=yield*V.promise(()=>import("./chunk-gtzreftf.js"));yield*J.publish(G.Event.Error,{error:new q2.Unknown({message:K}).toObject()}),DJ.error("failed to load skill",{skill:Z,err:X});return})));if(!Y)return;let Q=Xz.pick({name:!0,description:!0,hidden:!0}).safeParse(Y.data);if(!Q.success)return;if($.skills[Q.data.name])DJ.warn("duplicate skill name",{name:Q.data.name,existing:$.skills[Q.data.name].location,duplicate:Z});$.dirs.add(h7.dirname(Z)),$.skills[Q.data.name]={name:Q.data.name,description:Q.data.description,location:Z,content:Y.content,hidden:Q.data.hidden}}),z9=V.fnUntraced(function*($,Z,J,Y){let Q=yield*V.tryPromise({try:()=>g8.scan(J,{cwd:Z,absolute:!0,include:"file",symlink:!0,dot:Y?.dot}),catch:(X)=>X}).pipe(V.catch((X)=>{if(!Y?.scope)return V.die(X);return DJ.error(`failed to scan ${Y.scope} skills`,{dir:Z,error:X}),V.succeed([])}));for(let X of Q)$.matches.add(X),$.dirs.add(h7.dirname(X))}),$g=V.fnUntraced(function*($,Z,J,Y,Q){let X={matches:new Set,dirs:new Set};if(!h0.QITQODE_DISABLE_BUILTIN_SKILLS){let B=yield*Yz(J).pipe(V.catch(()=>V.succeed(void 0)));if(B&&(yield*J.isDir(B)))yield*z9(X,B,HX,{scope:"builtin"})}if(!h0.QITQODE_DISABLE_COMPOSE_SKILLS){let B=yield*eD(J).pipe(V.catch(()=>V.succeed(void 0)));if(B&&(yield*J.isDir(B)))yield*z9(X,B,HX,{scope:"compose"})}if(!h0.QITQODE_DISABLE_EXTERNAL_SKILLS){let B=nE.filter((W)=>{if(W===".claude"&&h0.QITQODE_DISABLE_CLAUDE_CODE_SKILLS)return!1;if(W===".codex"&&h0.QITQODE_DISABLE_CODEX_SKILLS)return!1;if(W===".opencode"&&h0.QITQODE_DISABLE_OPENCODE_SKILLS)return!1;return!0});for(let W of B){let O=h7.join(a0.Path.home,W);if(!(yield*J.isDir(O)))continue;yield*z9(X,O,Qz,{dot:!0,scope:"global"})}let H=yield*J.up({targets:B,start:Y,stop:Q}).pipe(V.catch(()=>V.succeed([])));for(let W of H)yield*z9(X,W,Qz,{dot:!0,scope:"project"})}let K=yield*$.directories();for(let B of K)yield*z9(X,B,rE);let G=yield*$.get();for(let B of G.skills?.paths??[]){let H=B.startsWith("~/")?h7.join(iE.homedir(),B.slice(2)):B,W=h7.isAbsolute(H)?H:h7.join(Y,H);if(!(yield*J.isDir(W))){DJ.warn("skill path not found",{path:W});continue}yield*z9(X,W,HX)}for(let B of G.skills?.urls??[]){let H=yield*Z.pull(B);for(let W of H)yield*z9(X,W,HX)}return{matches:Array.from(X.matches),dirs:Array.from(X.dirs)}}),Zg=V.fnUntraced(function*($,Z,J){yield*V.forEach(Z.matches,(Y)=>eE($,Y,J),{concurrency:16,discard:!0}),DJ.info("init",{count:Object.keys($.skills).length})});class jX extends X0.Service()("@qitqode/Skill"){}var Vz=b.effect(jX,V.gen(function*(){let $=yield*y6.Service,Z=yield*B0.Service,J=yield*e.Service,Y=yield*V0.Service,Q=yield*u.make(V.fn("Skill.discovery")(function*(O){return yield*$g(Z,$,Y,O.directory,O.worktree)})),X=yield*u.make(V.fn("Skill.state")(function*(O){let j={skills:{},dirs:new Set};return yield*Zg(j,yield*u.get(Q),J),j})),K=V.fn("Skill.get")(function*(O){return(yield*u.get(X)).skills[O]}),G=V.fn("Skill.all")(function*(){let O=yield*u.get(X);return Object.values(O.skills)}),B=V.fn("Skill.dirs")(function*(){return(yield*u.get(Q)).dirs}),H=V.fn("Skill.available")(function*(O){let j=yield*u.get(X),U=Object.values(j.skills).filter((q)=>!q.hidden);if(U=U.toSorted((q,z)=>q.name.localeCompare(z.name)),!O)return U;return U.filter((q)=>P0.evaluate("skill",q.name,O.permission).action!=="deny")}),W=V.fn("Skill.reload")(function*(){yield*u.invalidate(Q),yield*u.invalidate(X)});return jX.of({get:K,all:G,dirs:B,available:H,reload:W})})),Jg=Vz.pipe(b.provide(y6.defaultLayer),b.provide(B0.defaultLayer),b.provide(e.layer),b.provide(V0.defaultLayer));function Yg($,Z){if($.length===0)return"No skills are currently available.";if(Z.verbose)return["<available_skills>",...$.sort((J,Y)=>J.name.localeCompare(Y.name)).flatMap((J)=>[" <skill>",` <name>${J.name}</name>`,` <description>${J.description}</description>`,` <location>${sE(J.location).href}</location>`," </skill>"]),"</available_skills>"].join(`
|
|
7535
7535
|
`);return["## Available Skills",...$.toSorted((J,Y)=>J.name.localeCompare(Y.name)).map((J)=>`- **${J.name}**: ${J.description}`)].join(`
|
|
7536
7536
|
`)}var _W=i0("skill",V.gen(function*(){let $=(yield*M0.toolDescriptionEffect("skill"))??"",Z=yield*Y$.Service,J=yield*d$.Service;return{description:$,parameters:Kj,execute:(Y,Q)=>V.gen(function*(){let X=yield*Z.get(Y.name);if(!X){let O=(yield*Z.all()).map((j)=>j.name).join(", ");throw Error(`Skill "${Y.name}" not found. Available skills: ${O||"none"}`)}yield*Q.ask({permission:"skill",patterns:[Y.name],always:[Y.name],metadata:{}});let K=Kz.dirname(X.location),G=Qg(K).href,B=10,H=yield*J.files({cwd:K,follow:!1,hidden:!0,signal:Q.abort}).pipe(f7((W)=>!W.includes("SKILL.md")),v7((W)=>Kz.resolve(K,W)),tY(B),n9,V.map((W)=>[...W].map((O)=>`<file>${O}</file>`).join(`
|
|
7537
7537
|
`)));return{title:`Loaded skill: ${X.name}`,output:[`<skill_content name="${X.name}">`,`# Skill: ${X.name}`,"",X.content.trim(),"",`Base directory for this skill: ${G}`,"Relative paths in this skill (e.g., scripts/, reference/) are relative to this base directory.","Note: file list is sampled.","","<skill_files>",H,"</skill_files>","</skill_content>"].join(`
|
|
@@ -8089,7 +8089,7 @@ If you repeat the same output again, the session will be terminated.
|
|
|
8089
8089
|
`)})});function qy($){if(!$.lastFinished)return;let Z=[];for(let Q=$.msgs.length-1;Q>=0&&Z.length<KB;Q--){let X=$.msgs[Q];if(X.info.role!=="assistant"||!X.info.finish)continue;let K=oJ(X.parts);if(K===void 0)break;Z.push(K)}if(!(Z.length===KB&&Z.every((Q)=>Q===Z[0])))return;let Y=$.msgs.findLast((Q)=>Q.info.role==="user");if(!Y||Y.parts.some((Q)=>Q.type==="text"&&Q.text?.includes("repeating the same action")))return;Y.parts.push({id:m0.ascending(),messageID:Y.info.id,sessionID:$.sessionID,type:"text",synthetic:!0,text:["<system-reminder>",`Your last ${KB} 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(`
|
|
8090
8090
|
`)})}var GB=Y0.create({service:"auto-dream"}),WB=86400000,km=7,Em=30,zy=1e4,BB="Auto Dream",HB="Auto Distill",Fy=0,Dy=0,_y=["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(`
|
|
8091
8091
|
`),Py=["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(`
|
|
8092
|
-
`);function My($){return V.gen(function*(){if(!$.enabled)return!1;let Z=$.intervalDays*WB,J=yield*V.sync(()=>w0.use((X)=>X.select({time_created:V2.time_created}).from(V2).where(z0(V2.title,$.title)).orderBy(I8(V2.time_created)).limit(1).get())),Y=Date.now(),Q=J?Y-J.time_created:1/0;if(!J){let X=yield*V.sync(()=>w0.use((K)=>K.select({time_created:V2.time_created}).from(V2).where(pZ(V2.parent_id)).orderBy(W8(V2.time_created)).limit(1).get()));if(!X||Y-X.time_created<Z)return GB.info(`auto-${$.label} skipped \u2014 project too young`,{projectAge:X?Math.round((Y-X.time_created)/WB)+"d":"empty",interval:$.intervalDays+"d"}),!1}if(Q<Z)return GB.info(`auto-${$.label} skipped \u2014 last run too recent`,{lastRunAgo:Math.round(Q/WB)+"d",interval:$.intervalDays+"d"}),!1;return GB.info(`auto-${$.label} triggering`,{lastRun:J?new Date(J.time_created).toISOString():"never",interval:$.intervalDays+"d"}),!0})}function yy($){let Z=$.dream?.auto!==!1;if(!Z)return V.succeed(!1);let J=Date.now();if(J-Fy<zy)return V.succeed(!1);Fy=J;let Y=$.dream?.interval_days??km;return My({enabled:Z,intervalDays:Y,title:BB,label:"dream"})}function wy($){let Z=$.distill?.auto!==!1;if(!Z)return V.succeed(!1);let J=Date.now();if(J-Dy<zy)return V.succeed(!1);Dy=J;let Y=$.distill?.interval_days??Em;return My({enabled:Z,intervalDays:Y,title:HB,label:"distill"})}var Cy=V.fnUntraced(function*($){let Z=yield*$.config.get(),J=yield*yy(Z).pipe(V.catch(()=>V.succeed(!1))),Y=yield*wy(Z).pipe(V.catch(()=>V.succeed(!1))),Q={providerID:$.lastUser.model.providerID,modelID:$.lastUser.model.modelID};if(!J&&!Y)return;let{AppRuntime:X}=yield*V.promise(()=>import("./chunk-qy9s3nmy.js"));if(J)X.runPromise(E2.use((K)=>V.gen(function*(){let G=yield*K.create({title:BB});yield*(yield*$.promptServiceTag).prompt({sessionID:G.id,agent:"dream",model:Q,parts:[{type:"text",text:_y}]})}))).catch((K)=>$.log.error("auto-dream prompt failed",{error:String(K)}));if(Y)X.runPromise(E2.use((K)=>V.gen(function*(){let G=yield*K.create({title:HB});yield*(yield*$.promptServiceTag).prompt({sessionID:G.id,agent:"distill",model:Q,parts:[{type:"text",text:Py}]})}))).catch((K)=>$.log.error("auto-distill prompt failed",{error:String(K)}))});var hm=($)=>$.pipe(V.catchDefect((Z)=>Z instanceof M0.BackendAuthRejectedError?V.succeed(void 0):V.die(Z))),jB=($)=>hm(V.promise(()=>M0.resolvePrompt($))).pipe(V.map((Z)=>Z??"")),Ay=V.gen(function*(){let $=yield*jB("session/build-switch"),Z=yield*jB("session/max-steps"),J=yield*jB("session/compose");return{buildSwitch:$,maxSteps:Z,promptCompose:J}});var Iy=N1.create({service:"session.prompt"}),vm=Y0.create({service:"session.prompt"});function Ny($,Z,J,Y){return V.gen(function*(){let{bus:Q,status:X,sessions:K,agents:G,provider:B,processor:H,prune:W,checkpoint:O,compaction:j,config:U,plugin:q,permission:z,fsys:A,registry:D,scope:_,instruction:w,state:P,goal:N,taskGateState:L,taskRegistry:T,revert:h,summary:x,sys:v,llm:I,actorRegistry:S,inbox:E}=yield*rV,y=yield*Ay,R=y.buildSwitch,k=y.maxSteps,i=y.promptCompose,d=(G0,Q0,s)=>iM(B,Q,G0,Q0,s),c=(G0,Q0)=>nM(K,G0,Q0),o=VB(K),p=1024,J0=new class extends Set{add(G0){if(super.add(G0),this.size>1024){let Q0=this.values().next().value;if(Q0!==void 0)this.delete(Q0)}return this}},t=(G0)=>ZB({getOps:$,...G0}),f=tM({agents:G,provider:B,llm:I,sessions:K,elog:Iy}),a=eM({sessions:K,fsys:A,buildSwitch:R,promptCompose:i});return{runLoop:V.fn("SessionPrompt.run")(function*(G0,Q0,s){let j0=yield*u.context,r=Iy.with({sessionID:G0}),Z0,_0=0,C0=yield*K.get(G0),L0,$2,O2=Q0??"main",e2=lM({sessionID:G0,agentID:O2,task_id:s,plugin:q,bus:Q,prune:W,scope:_}),{cancellation:L$,agentMetrics:r$,publishAgentRequest:f$,schedulePrune:K$}=e2,e0=uM({sessionID:G0,agentID:O2,task_id:s,session:C0,cancellation:L$,plugin:q});return yield*V.gen(function*(){yield*e2.before;let C1=(y0,c0)=>eV(SM(y0,c0,O0.parts(c0.id))),G$=!1,v1=jy({sessionID:G0,bus:Q,appendSyntheticUserTurn:o,slog:r}),D$=Hy({sessionID:G0,sessions:K,bus:Q,appendSyntheticUserTurn:o,slog:r}),{autoContinueOutputLength:Z8,autoContinueInvalidOutput:VY,autoRetryStructuredOutput:J8,handleTextRepeat:y3,writeContentFilterError:KY,writeModelError:G2}=D$,l0=rM({sessionID:G0,agentID:Q0,agents:G,taskGateState:L,taskRegistry:T,appendSyntheticUserTurn:o,slog:r}),b2=aM({sessionID:G0,agentID:Q0,session:C0,goal:N,bus:Q,appendSyntheticUserTurn:o,slog:r});while(!0){if(!Q0||Q0==="main")yield*X.set(G0,{type:"busy"});yield*E.drain(G0,Q0??"main").pipe(V.ignore),yield*r.info("loop",{step:_0});let y0=yield*O0.filterCompactedEffect(G0,{contextFrom:C0.contextFrom,contextWatermark:C0.contextWatermark,agentID:Q0??"main"}),c0,d9,O1,G6,W$,u6=[];for(let t0=y0.length-1;t0>=0;t0--){let _$=y0[t0];if(!c0&&_$.info.role==="user")c0=_$.info,d9=_$;if(!O1&&_$.info.role==="assistant")O1=_$.info,G6=_$;if(!W$&&_$.info.role==="assistant"&&_$.info.finish)W$=_$.info;if(c0&&W$)break;if(!W$){let c9=_$.parts.filter((_8)=>_8.type==="subtask");u6.push(...c9)}}if(!c0)throw Error("No user message found in stream. This should never happen.");yield*Oy({sessionID:G0,msgs:y0,checkpoint:O,config:U});let w3=G6?.parts.some((t0)=>t0.type==="tool"&&!t0.metadata?.providerExecuted)??!1;if(O1?.finish==="length"&&!w3&&c0.id<O1.id&&(yield*Z8({lastUser:c0,assistant:O1})))continue;if(O1){let t0=a5({phase:"existing-assistant",lastUser:c0,assistant:O1,parts:G6?.parts??[]});if(t0.type==="filtered"){yield*KY({assistant:O1}),yield*r.info("exiting loop",{classification:t0.type});break}if(t0.type==="failed"){yield*G2({assistant:O1,reason:t0.reason}),yield*r.info("exiting loop",{classification:t0.type,reason:t0.reason});break}if(t0.type==="think-only"||t0.type==="invalid"){let _$=t0.type==="invalid"?t0.reason:"think-only";if(yield*VY({lastUser:c0,assistant:O1,reason:_$}))continue;yield*r.info("exiting loop",{classification:t0.type});break}if(t0.type==="final"&&t0.degraded)yield*r.warn("degraded final on abnormal finish",{finish:O1.finish});if(t0.type!=="continue"){if(yield*l0(c0))continue;if(yield*b2(c0))continue;yield*r.info("exiting loop",{classification:t0.type});break}}if(_0++,_0===1)yield*f({session:C0,modelID:c0.model.modelID,providerID:c0.model.providerID,history:y0}).pipe(V.ignore,V.forkIn(_));if(_0===1&&!C0.parentID)yield*Cy({config:U,lastUser:c0,promptServiceTag:Y,log:vm});let t$=yield*d(c0.model.providerID,c0.model.modelID,G0);$2=t$,L0=W$;let z$=u6.pop();if(z$?.type==="subtask"){yield*t({task:z$,model:t$,lastUser:c0,sessionID:G0,session:C0,msgs:y0});continue}let l6=d9;if(l6?.parts.some((t0)=>t0.type==="compaction")){let t0=l6.parts.find((_8)=>_8.type==="compaction"),_$=yield*K.messages({sessionID:G0,agentID:c0.agentID??"main"});if((yield*j.process({parentID:c0.id,messages:_$,sessionID:G0,auto:t0?.auto??!1,overflow:t0?.overflow,agentID:c0.agentID}))==="stop")break;continue}yield*Uy({sessionID:G0,msgs:y0,lastFinished:W$,model:t$,config:U}),qy({sessionID:G0,msgs:y0,lastFinished:W$});let z8=yield*G.get(c0.agent),MZ=z8?.native===!0&&z8?.hidden===!0;if(!G$&&!MZ&&W$&&W$.tokens){let t0=yield*$();yield*W.fireCheckpoints({sessionID:G0,model:t$,tokens:W$.tokens,promptOps:t0,agentID:c0.agentID}).pipe(V.ignore)}if(!G$&&W$&&W$.tokens){if(yield*dM({config:U,checkpoint:O,compaction:j,prune:W},{sessionID:G0,lastFinished:W$,lastUser:c0,model:t$,msgs:y0,isBoundedComputation:MZ})){G$=!0;continue}}if(G$=!1,!z8)throw yield*t5(G,Q,c0.agent,G0);let x8=z8.steps??1/0,I0=_0>=x8;y0=yield*a({messages:y0,agent:z8,session:C0});let r0=J3({sessionID:G0,parentID:c0.id,agentID:c0.agentID,agent:z8.name,variant:c0.model.variant,cwd:j0.directory,root:j0.worktree,modelID:t$.id,providerID:t$.providerID});yield*K.updateMessage(r0);let y2=yield*H.create({assistantMessage:r0,sessionID:G0,model:t$,agentMetrics:r$}),p6=yield*V.gen(function*(){let t0={value:Z0},_$=yield*RM({sessionID:G0,resolvedAgentID:O2,step:_0,task_id:s,lastUser:c0,lastFinished:W$,msgs:y0,agent:z8,session:C0,model:t$,handle:y2,structured:t0,resolveTools:Z,createStructuredOutputTool:J,summary:x,scope:_,plugin:q}),{tools:c9,format:_8,query:C3}=_$,{cancelledByPlugin:A3,withUserQueryPost:I3}=TM({sessionID:G0,agentID:O2,step:_0,lastUser:c0,msgs:y0,query:C3,handle:y2,plugin:q,sessions:K,cancellation:L$,trajectoryForStep:C1}),N3=V.fnUntraced(function*(u9){if(u9==="continue"&&(yield*Z8({lastUser:c0,assistant:y2.message})))return"continue";if(u9==="text-repeat"){if(yield*y3({lastUser:c0}))return"continue";return"break"}if(t0.value!==void 0)return Z0=t0.value,y2.message.structured=t0.value,y2.message.finish=y2.message.finish??"stop",yield*K.updateMessage(y2.message),"break";let m1=a5({phase:"after-process",lastUser:c0,assistant:y2.message,parts:O0.parts(y2.message.id),processResult:u9});if(m1.type==="filtered")return yield*KY({assistant:y2.message}),"break";if(m1.type==="failed")return yield*G2({assistant:y2.message,reason:m1.reason}),"break";if(m1.type!=="continue"&&!y2.message.error&&_8.type==="json_schema"){if(yield*J8({lastUser:c0,assistant:y2.message}))return"continue";return"break"}if((m1.type==="think-only"||m1.type==="invalid")&&_8.type!=="json_schema"){let L3=m1.type==="invalid"?m1.reason:"think-only";if(yield*VY({lastUser:c0,assistant:y2.message,reason:L3}))return"continue";return"break"}if(m1.type==="final"&&m1.degraded)yield*r.warn("degraded final on abnormal finish",{finish:y2.message.finish});if(u9==="stop")return"break";return}),yZ=yield*vM({sessionID:G0,lastUser:c0,agent:z8,session:C0,model:t$,msgs:y0,tools:c9,format:_8,handle:y2,isLastStep:I0,task_id:s,instructionsNotified:J0,maxStepsText:k,actorRegistry:S,bus:Q,config:U,instruction:w,llm:I,registry:D,status:X,sys:v,cancelledByPlugin:A3,withUserQueryPost:I3,slog:r});if(yZ.kind==="break")return"break";let GY=yield*N3(yZ.result);if(GY)return GY;if(yZ.result==="overflow")yield*cM({config:U,checkpoint:O,compaction:j,prune:W},{sessionID:G0,lastUser:c0,model:t$,msgs:y0,isBoundedComputation:MZ});return"continue"}).pipe(V.ensuring(w.clear(y2.message.id))),Q8=yield*v1.check({lastUser:c0,completedParts:O0.parts(y2.message.id)});if(Q8==="terminate")break;if(Q8==="recovered")continue;if(p6==="break"){if(yield*l0(c0))continue;if(yield*b2(c0))continue;break}continue}let f1=yield*$();if($2&&L0)yield*K$({model:$2,lastFinished:L0,promptOps:f1});let a$=yield*c(G0,Q0),c6=a$.info.role==="assistant"&&!!a$.info.error,Y8=yield*K.findMessage(G0,(y0)=>y0.info.role==="user",{agentID:"*"});return yield*f$(c6?"error":"completed",N2.isSome(Y8)?Y8.value.info.agent:a$.info.agent),a$}).pipe((C1)=>e5(G0,Q,C1),V.onExit(e0),V.orDie)}),lastAssistant:c}})}import Ly from"path";var fm=new TextEncoder,OB=new TextDecoder,mm=($)=>`
|
|
8092
|
+
`);function My($){return V.gen(function*(){if(!$.enabled)return!1;let Z=$.intervalDays*WB,J=yield*V.sync(()=>w0.use((X)=>X.select({time_created:V2.time_created}).from(V2).where(z0(V2.title,$.title)).orderBy(I8(V2.time_created)).limit(1).get())),Y=Date.now(),Q=J?Y-J.time_created:1/0;if(!J){let X=yield*V.sync(()=>w0.use((K)=>K.select({time_created:V2.time_created}).from(V2).where(pZ(V2.parent_id)).orderBy(W8(V2.time_created)).limit(1).get()));if(!X||Y-X.time_created<Z)return GB.info(`auto-${$.label} skipped \u2014 project too young`,{projectAge:X?Math.round((Y-X.time_created)/WB)+"d":"empty",interval:$.intervalDays+"d"}),!1}if(Q<Z)return GB.info(`auto-${$.label} skipped \u2014 last run too recent`,{lastRunAgo:Math.round(Q/WB)+"d",interval:$.intervalDays+"d"}),!1;return GB.info(`auto-${$.label} triggering`,{lastRun:J?new Date(J.time_created).toISOString():"never",interval:$.intervalDays+"d"}),!0})}function yy($){let Z=$.dream?.auto!==!1;if(!Z)return V.succeed(!1);let J=Date.now();if(J-Fy<zy)return V.succeed(!1);Fy=J;let Y=$.dream?.interval_days??km;return My({enabled:Z,intervalDays:Y,title:BB,label:"dream"})}function wy($){let Z=$.distill?.auto!==!1;if(!Z)return V.succeed(!1);let J=Date.now();if(J-Dy<zy)return V.succeed(!1);Dy=J;let Y=$.distill?.interval_days??Em;return My({enabled:Z,intervalDays:Y,title:HB,label:"distill"})}var Cy=V.fnUntraced(function*($){let Z=yield*$.config.get(),J=yield*yy(Z).pipe(V.catch(()=>V.succeed(!1))),Y=yield*wy(Z).pipe(V.catch(()=>V.succeed(!1))),Q={providerID:$.lastUser.model.providerID,modelID:$.lastUser.model.modelID};if(!J&&!Y)return;let{AppRuntime:X}=yield*V.promise(()=>import("./chunk-5ch23jj3.js"));if(J)X.runPromise(E2.use((K)=>V.gen(function*(){let G=yield*K.create({title:BB});yield*(yield*$.promptServiceTag).prompt({sessionID:G.id,agent:"dream",model:Q,parts:[{type:"text",text:_y}]})}))).catch((K)=>$.log.error("auto-dream prompt failed",{error:String(K)}));if(Y)X.runPromise(E2.use((K)=>V.gen(function*(){let G=yield*K.create({title:HB});yield*(yield*$.promptServiceTag).prompt({sessionID:G.id,agent:"distill",model:Q,parts:[{type:"text",text:Py}]})}))).catch((K)=>$.log.error("auto-distill prompt failed",{error:String(K)}))});var hm=($)=>$.pipe(V.catchDefect((Z)=>Z instanceof M0.BackendAuthRejectedError?V.succeed(void 0):V.die(Z))),jB=($)=>hm(V.promise(()=>M0.resolvePrompt($))).pipe(V.map((Z)=>Z??"")),Ay=V.gen(function*(){let $=yield*jB("session/build-switch"),Z=yield*jB("session/max-steps"),J=yield*jB("session/compose");return{buildSwitch:$,maxSteps:Z,promptCompose:J}});var Iy=N1.create({service:"session.prompt"}),vm=Y0.create({service:"session.prompt"});function Ny($,Z,J,Y){return V.gen(function*(){let{bus:Q,status:X,sessions:K,agents:G,provider:B,processor:H,prune:W,checkpoint:O,compaction:j,config:U,plugin:q,permission:z,fsys:A,registry:D,scope:_,instruction:w,state:P,goal:N,taskGateState:L,taskRegistry:T,revert:h,summary:x,sys:v,llm:I,actorRegistry:S,inbox:E}=yield*rV,y=yield*Ay,R=y.buildSwitch,k=y.maxSteps,i=y.promptCompose,d=(G0,Q0,s)=>iM(B,Q,G0,Q0,s),c=(G0,Q0)=>nM(K,G0,Q0),o=VB(K),p=1024,J0=new class extends Set{add(G0){if(super.add(G0),this.size>1024){let Q0=this.values().next().value;if(Q0!==void 0)this.delete(Q0)}return this}},t=(G0)=>ZB({getOps:$,...G0}),f=tM({agents:G,provider:B,llm:I,sessions:K,elog:Iy}),a=eM({sessions:K,fsys:A,buildSwitch:R,promptCompose:i});return{runLoop:V.fn("SessionPrompt.run")(function*(G0,Q0,s){let j0=yield*u.context,r=Iy.with({sessionID:G0}),Z0,_0=0,C0=yield*K.get(G0),L0,$2,O2=Q0??"main",e2=lM({sessionID:G0,agentID:O2,task_id:s,plugin:q,bus:Q,prune:W,scope:_}),{cancellation:L$,agentMetrics:r$,publishAgentRequest:f$,schedulePrune:K$}=e2,e0=uM({sessionID:G0,agentID:O2,task_id:s,session:C0,cancellation:L$,plugin:q});return yield*V.gen(function*(){yield*e2.before;let C1=(y0,c0)=>eV(SM(y0,c0,O0.parts(c0.id))),G$=!1,v1=jy({sessionID:G0,bus:Q,appendSyntheticUserTurn:o,slog:r}),D$=Hy({sessionID:G0,sessions:K,bus:Q,appendSyntheticUserTurn:o,slog:r}),{autoContinueOutputLength:Z8,autoContinueInvalidOutput:VY,autoRetryStructuredOutput:J8,handleTextRepeat:y3,writeContentFilterError:KY,writeModelError:G2}=D$,l0=rM({sessionID:G0,agentID:Q0,agents:G,taskGateState:L,taskRegistry:T,appendSyntheticUserTurn:o,slog:r}),b2=aM({sessionID:G0,agentID:Q0,session:C0,goal:N,bus:Q,appendSyntheticUserTurn:o,slog:r});while(!0){if(!Q0||Q0==="main")yield*X.set(G0,{type:"busy"});yield*E.drain(G0,Q0??"main").pipe(V.ignore),yield*r.info("loop",{step:_0});let y0=yield*O0.filterCompactedEffect(G0,{contextFrom:C0.contextFrom,contextWatermark:C0.contextWatermark,agentID:Q0??"main"}),c0,d9,O1,G6,W$,u6=[];for(let t0=y0.length-1;t0>=0;t0--){let _$=y0[t0];if(!c0&&_$.info.role==="user")c0=_$.info,d9=_$;if(!O1&&_$.info.role==="assistant")O1=_$.info,G6=_$;if(!W$&&_$.info.role==="assistant"&&_$.info.finish)W$=_$.info;if(c0&&W$)break;if(!W$){let c9=_$.parts.filter((_8)=>_8.type==="subtask");u6.push(...c9)}}if(!c0)throw Error("No user message found in stream. This should never happen.");yield*Oy({sessionID:G0,msgs:y0,checkpoint:O,config:U});let w3=G6?.parts.some((t0)=>t0.type==="tool"&&!t0.metadata?.providerExecuted)??!1;if(O1?.finish==="length"&&!w3&&c0.id<O1.id&&(yield*Z8({lastUser:c0,assistant:O1})))continue;if(O1){let t0=a5({phase:"existing-assistant",lastUser:c0,assistant:O1,parts:G6?.parts??[]});if(t0.type==="filtered"){yield*KY({assistant:O1}),yield*r.info("exiting loop",{classification:t0.type});break}if(t0.type==="failed"){yield*G2({assistant:O1,reason:t0.reason}),yield*r.info("exiting loop",{classification:t0.type,reason:t0.reason});break}if(t0.type==="think-only"||t0.type==="invalid"){let _$=t0.type==="invalid"?t0.reason:"think-only";if(yield*VY({lastUser:c0,assistant:O1,reason:_$}))continue;yield*r.info("exiting loop",{classification:t0.type});break}if(t0.type==="final"&&t0.degraded)yield*r.warn("degraded final on abnormal finish",{finish:O1.finish});if(t0.type!=="continue"){if(yield*l0(c0))continue;if(yield*b2(c0))continue;yield*r.info("exiting loop",{classification:t0.type});break}}if(_0++,_0===1)yield*f({session:C0,modelID:c0.model.modelID,providerID:c0.model.providerID,history:y0}).pipe(V.ignore,V.forkIn(_));if(_0===1&&!C0.parentID)yield*Cy({config:U,lastUser:c0,promptServiceTag:Y,log:vm});let t$=yield*d(c0.model.providerID,c0.model.modelID,G0);$2=t$,L0=W$;let z$=u6.pop();if(z$?.type==="subtask"){yield*t({task:z$,model:t$,lastUser:c0,sessionID:G0,session:C0,msgs:y0});continue}let l6=d9;if(l6?.parts.some((t0)=>t0.type==="compaction")){let t0=l6.parts.find((_8)=>_8.type==="compaction"),_$=yield*K.messages({sessionID:G0,agentID:c0.agentID??"main"});if((yield*j.process({parentID:c0.id,messages:_$,sessionID:G0,auto:t0?.auto??!1,overflow:t0?.overflow,agentID:c0.agentID}))==="stop")break;continue}yield*Uy({sessionID:G0,msgs:y0,lastFinished:W$,model:t$,config:U}),qy({sessionID:G0,msgs:y0,lastFinished:W$});let z8=yield*G.get(c0.agent),MZ=z8?.native===!0&&z8?.hidden===!0;if(!G$&&!MZ&&W$&&W$.tokens){let t0=yield*$();yield*W.fireCheckpoints({sessionID:G0,model:t$,tokens:W$.tokens,promptOps:t0,agentID:c0.agentID}).pipe(V.ignore)}if(!G$&&W$&&W$.tokens){if(yield*dM({config:U,checkpoint:O,compaction:j,prune:W},{sessionID:G0,lastFinished:W$,lastUser:c0,model:t$,msgs:y0,isBoundedComputation:MZ})){G$=!0;continue}}if(G$=!1,!z8)throw yield*t5(G,Q,c0.agent,G0);let x8=z8.steps??1/0,I0=_0>=x8;y0=yield*a({messages:y0,agent:z8,session:C0});let r0=J3({sessionID:G0,parentID:c0.id,agentID:c0.agentID,agent:z8.name,variant:c0.model.variant,cwd:j0.directory,root:j0.worktree,modelID:t$.id,providerID:t$.providerID});yield*K.updateMessage(r0);let y2=yield*H.create({assistantMessage:r0,sessionID:G0,model:t$,agentMetrics:r$}),p6=yield*V.gen(function*(){let t0={value:Z0},_$=yield*RM({sessionID:G0,resolvedAgentID:O2,step:_0,task_id:s,lastUser:c0,lastFinished:W$,msgs:y0,agent:z8,session:C0,model:t$,handle:y2,structured:t0,resolveTools:Z,createStructuredOutputTool:J,summary:x,scope:_,plugin:q}),{tools:c9,format:_8,query:C3}=_$,{cancelledByPlugin:A3,withUserQueryPost:I3}=TM({sessionID:G0,agentID:O2,step:_0,lastUser:c0,msgs:y0,query:C3,handle:y2,plugin:q,sessions:K,cancellation:L$,trajectoryForStep:C1}),N3=V.fnUntraced(function*(u9){if(u9==="continue"&&(yield*Z8({lastUser:c0,assistant:y2.message})))return"continue";if(u9==="text-repeat"){if(yield*y3({lastUser:c0}))return"continue";return"break"}if(t0.value!==void 0)return Z0=t0.value,y2.message.structured=t0.value,y2.message.finish=y2.message.finish??"stop",yield*K.updateMessage(y2.message),"break";let m1=a5({phase:"after-process",lastUser:c0,assistant:y2.message,parts:O0.parts(y2.message.id),processResult:u9});if(m1.type==="filtered")return yield*KY({assistant:y2.message}),"break";if(m1.type==="failed")return yield*G2({assistant:y2.message,reason:m1.reason}),"break";if(m1.type!=="continue"&&!y2.message.error&&_8.type==="json_schema"){if(yield*J8({lastUser:c0,assistant:y2.message}))return"continue";return"break"}if((m1.type==="think-only"||m1.type==="invalid")&&_8.type!=="json_schema"){let L3=m1.type==="invalid"?m1.reason:"think-only";if(yield*VY({lastUser:c0,assistant:y2.message,reason:L3}))return"continue";return"break"}if(m1.type==="final"&&m1.degraded)yield*r.warn("degraded final on abnormal finish",{finish:y2.message.finish});if(u9==="stop")return"break";return}),yZ=yield*vM({sessionID:G0,lastUser:c0,agent:z8,session:C0,model:t$,msgs:y0,tools:c9,format:_8,handle:y2,isLastStep:I0,task_id:s,instructionsNotified:J0,maxStepsText:k,actorRegistry:S,bus:Q,config:U,instruction:w,llm:I,registry:D,status:X,sys:v,cancelledByPlugin:A3,withUserQueryPost:I3,slog:r});if(yZ.kind==="break")return"break";let GY=yield*N3(yZ.result);if(GY)return GY;if(yZ.result==="overflow")yield*cM({config:U,checkpoint:O,compaction:j,prune:W},{sessionID:G0,lastUser:c0,model:t$,msgs:y0,isBoundedComputation:MZ});return"continue"}).pipe(V.ensuring(w.clear(y2.message.id))),Q8=yield*v1.check({lastUser:c0,completedParts:O0.parts(y2.message.id)});if(Q8==="terminate")break;if(Q8==="recovered")continue;if(p6==="break"){if(yield*l0(c0))continue;if(yield*b2(c0))continue;break}continue}let f1=yield*$();if($2&&L0)yield*K$({model:$2,lastFinished:L0,promptOps:f1});let a$=yield*c(G0,Q0),c6=a$.info.role==="assistant"&&!!a$.info.error,Y8=yield*K.findMessage(G0,(y0)=>y0.info.role==="user",{agentID:"*"});return yield*f$(c6?"error":"completed",N2.isSome(Y8)?Y8.value.info.agent:a$.info.agent),a$}).pipe((C1)=>e5(G0,Q,C1),V.onExit(e0),V.orDie)}),lastAssistant:c}})}import Ly from"path";var fm=new TextEncoder,OB=new TextDecoder,mm=($)=>`
|
|
8093
8093
|
|
|
8094
8094
|
[... QitQode truncated ${$} bytes of shell output ...]
|
|
8095
8095
|
|
|
@@ -8120,7 +8120,7 @@ ${q}
|
|
|
8120
8120
|
`).length},Zd=V.fnUntraced(function*($,Z,J){let Y=$d.join(Z,J);if(!(yield*$.exists(Y).pipe(V.orDie)))return"";let Q=yield*$.readFile(Y).pipe(V.catch(()=>V.succeed(new Uint8Array)));if(Buffer.from(Q).includes(0))return"";return Buffer.from(Q).toString("utf8")}),uy=($)=>new Map($.map((Z)=>[Z.file,{additions:Z.additions,deletions:Z.deletions}])),Jd=(...$)=>{let Z=new Map;return $.flat().forEach((J)=>{if(!Z.has(J.file))Z.set(J.file,J)}),[...Z.values()]},FB=V.fnUntraced(function*($,Z,J,Y,Q,X){let K=Y?yield*Z.prefix(J):"",G=(H,W,O)=>SY(LY(H,H,W,O,"","",{context:Number.MAX_SAFE_INTEGER}));return(yield*V.forEach(Q,(H)=>V.gen(function*(){let W=H.status==="added"||!Y?"":yield*Z.show(J,Y,H.file,K),O=H.status==="deleted"?"":yield*Zd($,J,H.file),j=X.get(H.file);return{file:H.file,patch:G(H.file,W,O),additions:j?.additions??(H.status==="added"?cy(O):0),deletions:j?.deletions??(H.status==="deleted"?cy(W):0),status:H.status}}),{concurrency:8})).toSorted((H,W)=>H.file.localeCompare(W.file))}),Yd=V.fnUntraced(function*($,Z,J,Y){if(!Y)return yield*FB($,Z,J,Y,yield*Z.status(J),new Map);let[Q,X]=yield*V.all([Z.status(J),Z.stats(J,Y)],{concurrency:2});return yield*FB($,Z,J,Y,Q,uy(X))}),Qd=V.fnUntraced(function*($,Z,J,Y){let[Q,X,K]=yield*V.all([Z.diff(J,Y),Z.stats(J,Y),Z.status(J)],{concurrency:3});return yield*FB($,Z,J,Y,Jd(Q,K.filter((G)=>G.code==="??")),uy(X))}),Xd=F.enum(["git","branch"]),ly={BranchUpdated:S0.define("vcs.branch.updated",F.object({branch:F.string().optional()}))},Vd=F.object({branch:F.string().optional(),default_branch:F.string().optional()}).meta({ref:"VcsInfo"}),Kd=F.object({file:F.string(),patch:F.string(),additions:F.number(),deletions:F.number(),status:F.enum(["added","deleted","modified"]).optional()}).meta({ref:"VcsFileDiff"});class DZ extends X0.Service()("@qitqode/Vcs"){}var py=b.effect(DZ,V.gen(function*(){let $=yield*V0.Service,Z=yield*U1.Service,J=yield*e.Service,Y=yield*w2.Scope,Q=yield*u.make(V.fn("Vcs.state")(function*(X){if(X.project.vcs!=="git")return{current:void 0,root:void 0};let K=V.fnUntraced(function*(){return yield*Z.branch(X.directory)}),[G,B]=yield*V.all([Z.branch(X.directory),Z.defaultBranch(X.directory)],{concurrency:2}),H={current:G,root:B};return dy.info("initialized",{branch:H.current,default_branch:H.root?.name}),yield*J.subscribe($1.Event.Updated).pipe(f0.filter((W)=>W.properties.file.endsWith("HEAD")),f0.runForEach((W)=>V.gen(function*(){let O=yield*K();if(O!==H.current)dy.info("branch changed",{from:H.current,to:O}),H.current=O,yield*J.publish(ly.BranchUpdated,{branch:O})})),V.forkScoped),H}));return DZ.of({init:V.fn("Vcs.init")(function*(){yield*u.get(Q).pipe(V.forkIn(Y))}),branch:V.fn("Vcs.branch")(function*(){return yield*u.use(Q,(X)=>X.current)}),defaultBranch:V.fn("Vcs.defaultBranch")(function*(){return yield*u.use(Q,(X)=>X.root?.name)}),diff:V.fn("Vcs.diff")(function*(X){let K=yield*u.get(Q),G=yield*u.context;if(G.project.vcs!=="git")return[];if(X==="git")return yield*Yd($,Z,G.directory,(yield*Z.hasHead(G.directory))?"HEAD":void 0);if(!K.root)return[];if(K.current&&K.current===K.root.name)return[];let B=yield*Z.mergeBase(G.directory,K.root.ref);if(!B)return[];return yield*Qd($,Z,G.directory,B)})})})),Gd=py.pipe(b.provide(U1.defaultLayer),b.provide(V0.defaultLayer),b.provide(e.layer));var h6={};R0(h6,{layer:()=>Kw,defaultLayer:()=>Md,Worktree:()=>h6,StartCommandFailedError:()=>zd,Service:()=>U3,ResetInput:()=>Dd,ResetFailedError:()=>h1,RemoveInput:()=>Fd,RemoveFailedError:()=>m9,NotGitError:()=>O3,NameGenerationFailedError:()=>Xw,Info:()=>Qw,Event:()=>j3,CreateInput:()=>qd,CreateFailedError:()=>Vw});var K6={};R0(K6,{layer:()=>sy,defaultLayer:()=>zB,Service:()=>_Z});var v9=Y0.create({service:"share-next"}),zZ=process.env.QITQODE_DISABLE_SHARE==="true"||process.env.QITQODE_DISABLE_SHARE==="1",Wd=K0.Struct({id:K0.String,url:K0.String,secret:K0.String});class _Z extends X0.Service()("@qitqode/ShareNext"){}var DB=($)=>V.sync(()=>w0.use($));function iy($){return{create:`/api/${$}`,sync:(Z)=>`/api/${$}/${Z}/sync`,remove:(Z)=>`/api/${$}/${Z}`,data:(Z)=>`/api/${$}/${Z}/data`}}var Bd=iy("share"),Hd=iy("shares");function oy($){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 sy=b.effect(_Z,V.gen(function*(){let $=yield*sJ.Service,Z=yield*e.Service,J=yield*B0.Service,Y=yield*P$.HttpClient,Q=P$.filterStatusOk(Y),X=yield*s0.Service,K=yield*b0.Service;function G(_,w){return V.gen(function*(){if(zZ)return;if(!(yield*O(_)))return;let N=yield*u.get(B),L=N.queue.get(_);if(L){for(let h of w)L.set(oy(h),h);return}let T=new Map(w.map((h)=>[oy(h),h]));N.queue.set(_,T),yield*j(_).pipe(V.delay(1000),V.catchCause((h)=>V.sync(()=>{v9.error("share flush failed",{sessionID:_,cause:h})})),V.forkIn(N.scope))})}let B=yield*u.make(V.fn("ShareNext.state")(function*(_){let w={queue:new Map,scope:yield*w2.make(),shared:new Map};if(yield*V.addFinalizer(()=>w2.close(w.scope,H$.void).pipe(V.andThen(V.sync(()=>{w.queue.clear(),w.shared.clear()})))),zZ)return w;let P=(N,L)=>Z.subscribe(N).pipe(f0.runForEach((T)=>L(T).pipe(V.catchCause((h)=>V.sync(()=>{v9.error("share subscriber failed",{type:N.type,cause:h})})))),V.forkScoped);return yield*P(b0.Event.Updated,(N)=>V.gen(function*(){let L=yield*K.get(N.properties.sessionID);yield*G(L.id,[{type:"session",data:L}])})),yield*P(O0.Event.Updated,(N)=>V.gen(function*(){let L=N.properties.info;if(yield*G(L.sessionID,[{type:"message",data:L}]),L.role!=="user")return;let T=yield*X.getModel(L.model.providerID,L.model.modelID);yield*G(L.sessionID,[{type:"model",data:[T]}])})),yield*P(O0.Event.PartUpdated,(N)=>N.properties.part.type==="compaction"?V.void:G(N.properties.part.sessionID,[{type:"part",data:N.properties.part}])),yield*P(b0.Event.Diff,(N)=>G(N.properties.sessionID,[{type:"session_diff",data:N.properties.diff}])),yield*P(b0.Event.Deleted,(N)=>D(N.properties.sessionID)),w})),H=V.fn("ShareNext.request")(function*(){let _={},w=yield*$.active();if(N2.isNone(w)||!w.value.active_org_id){let N=(yield*J.get()).enterprise?.url??"https://opncd.ai";return{headers:_,api:Bd,baseUrl:N}}let P=yield*$.token(w.value.id);if(N2.isNone(P))throw Error("No active account token available for sharing");return _.authorization=`Bearer ${P.value}`,_["x-org-id"]=w.value.active_org_id,{headers:_,api:Hd,baseUrl:w.value.url}}),W=V.fnUntraced(function*(_){let w=yield*DB((P)=>P.select().from(f9).where(z0(f9.session_id,_)).get());if(!w)return;return{id:w.id,secret:w.secret,url:w.url}}),O=V.fnUntraced(function*(_){let w=yield*u.get(B);if(w.shared.has(_)){let N=w.shared.get(_);return N===null?void 0:N}let P=yield*W(_);return w.shared.set(_,P??null),P}),j=V.fn("ShareNext.flush")(function*(_){if(zZ)return;let w=yield*u.get(B),P=w.queue.get(_);if(!P)return;let N=yield*O(_);if(!N){w.queue.delete(_);return}let L=yield*H(),T=yield*o2.post(`${L.baseUrl}${L.api.sync(N.id)}`).pipe(o2.setHeaders(L.headers),o2.bodyJson({secret:N.secret,data:Array.from(P.values())}),V.flatMap((h)=>Y.execute(h)));if(T.status>=400){v9.warn("failed to sync share",{sessionID:_,shareID:N.id,status:T.status});return}w.queue.delete(_)}),U=V.fn("ShareNext.full")(function*(_){v9.info("full sync",{sessionID:_});let w=yield*K.get(_),P=yield*K.diff(_),N=yield*V.sync(()=>Array.from(O0.stream(_,{agentID:"*"}))),L=yield*V.forEach(Array.from(new Map(N.filter((T)=>T.info.role==="user").map((T)=>T.info.model).map((T)=>[`${T.providerID}/${T.modelID}`,T])).values()),(T)=>X.getModel(n1.make(T.providerID),b1.make(T.modelID)),{concurrency:8});yield*G(_,[{type:"session",data:w},...N.map((T)=>({type:"message",data:T.info})),...N.flatMap((T)=>T.parts.filter((h)=>h.type!=="compaction").map((h)=>({type:"part",data:h}))),{type:"session_diff",data:P},{type:"model",data:L}])}),q=V.fn("ShareNext.init")(function*(){if(zZ)return;yield*u.get(B)}),z=V.fn("ShareNext.url")(function*(){return(yield*H()).baseUrl}),A=V.fn("ShareNext.create")(function*(_){if(zZ)return{id:"",url:"",secret:""};v9.info("creating share",{sessionID:_});let w=yield*H(),P=yield*o2.post(`${w.baseUrl}${w.api.create}`).pipe(o2.setHeaders(w.headers),o2.bodyJson({sessionID:_}),V.flatMap((L)=>Q.execute(L)),V.flatMap(VX.schemaBodyJson(Wd)));yield*DB((L)=>L.insert(f9).values({session_id:_,id:P.id,secret:P.secret,url:P.url}).onConflictDoUpdate({target:f9.session_id,set:{id:P.id,secret:P.secret,url:P.url}}).run());let N=yield*u.get(B);return N.shared.set(_,P),yield*U(_).pipe(V.catchCause((L)=>V.sync(()=>{v9.error("share full sync failed",{sessionID:_,cause:L})})),V.forkIn(N.scope)),P}),D=V.fn("ShareNext.remove")(function*(_){if(zZ)return;v9.info("removing share",{sessionID:_});let w=yield*u.get(B),P=yield*O(_);if(!P){w.shared.delete(_),w.queue.delete(_);return}let N=yield*H();yield*o2.delete(`${N.baseUrl}${N.api.remove(P.id)}`).pipe(o2.setHeaders(N.headers),o2.bodyJson({secret:P.secret}),V.flatMap((L)=>Q.execute(L))),yield*DB((L)=>L.delete(f9).where(z0(f9.session_id,_)).run()),w.shared.delete(_),w.queue.delete(_)});return _Z.of({init:q,url:z,request:H,create:A,remove:D})})),zB=sy.pipe(b.provide(e.layer),b.provide(sJ.defaultLayer),b.provide(B0.defaultLayer),b.provide(w8.layer),b.provide(s0.defaultLayer),b.provide(b0.defaultLayer));var K3={};R0(K3,{layer:()=>ny,defaultLayer:()=>jd,Service:()=>V3});class V3 extends X0.Service()("@qitqode/SessionShare"){}var ny=b.effect(V3,V.gen(function*(){let $=yield*B0.Service,Z=yield*b0.Service,J=yield*_Z,Y=yield*w2.Scope,Q=V.fn("SessionShare.share")(function*(G){if((yield*$.get()).share==="disabled")throw Error("Sharing is disabled in configuration");let H=yield*J.create(G);return yield*V.sync(()=>p7.run(b0.Event.Updated,{sessionID:G,info:{share:{url:H.url}}})),H}),X=V.fn("SessionShare.unshare")(function*(G){yield*J.remove(G),yield*V.sync(()=>p7.run(b0.Event.Updated,{sessionID:G,info:{share:{url:null}}}))}),K=V.fn("SessionShare.create")(function*(G){let B=yield*Z.create(G);if(B.parentID)return B;let H=yield*$.get();if(!(h0.QITQODE_AUTO_SHARE||H.share==="auto"))return B;return yield*Q(B.id).pipe(V.ignore,V.forkIn(Y)),B});return V3.of({create:K,share:Q,unshare:X})})),jd=ny.pipe(b.provide(zB),b.provide(b0.defaultLayer),b.provide(B0.defaultLayer));var Zw=ty(function*(){Y0.Default.info("bootstrapping",{directory:q0.directory}),yield*B0.Service.use(($)=>$.get()),yield*n0.Service.use(($)=>$.init()),yield*ry([I2.Service,K6.Service,R$.Service,A1.Service,$1.Service,DZ,W1.Service,H7,j7].map(($)=>PB($.use((Z)=>Z.init())))).pipe(_B("InstanceBootstrap.init")),yield*C$.Service.use(($)=>$.reconcile()).pipe(ey(($)=>ay(()=>Y0.Default.warn("memory reconcile failed",{error:String($)}))),PB),yield*e.Service.use(($)=>$.subscribeCallback(j1.Event.Executed,async(Z)=>{if(Z.properties.name===j1.Default.INIT)$w(q0.project.id)})),yield*h2.subscribe()}).pipe(_B("InstanceBootstrap"));var Ud=b.mergeAll(B0.defaultLayer,n0.defaultLayer,K6.defaultLayer,R$.defaultLayer,I2.defaultLayer,A1.defaultLayer,$1.defaultLayer,h9.defaultLayer,W1.defaultLayer,e.defaultLayer,C$.defaultLayer,N8.defaultLayer).pipe(b.provide(W3)),Jw=G3.make(Ud,{memoMap:B3});var nJ=Y0.create({service:"worktree"}),j3={Ready:S0.define("worktree.ready",F.object({name:F.string(),branch:F.string()})),Failed:S0.define("worktree.failed",F.object({message:F.string()}))},Qw=F.object({name:F.string(),branch:F.string(),directory:F.string()}).meta({ref:"Worktree"}),qd=F.object({name:F.string().optional(),startCommand:F.string().optional().describe("Additional startup script to run after the project's start command")}).meta({ref:"WorktreeCreateInput"}),Fd=F.object({directory:F.string()}).meta({ref:"WorktreeRemoveInput"}),Dd=F.object({directory:F.string()}).meta({ref:"WorktreeResetInput"}),O3=q2.create("WorktreeNotGitError",F.object({message:F.string()})),Xw=q2.create("WorktreeNameGenerationFailedError",F.object({message:F.string()})),Vw=q2.create("WorktreeCreateFailedError",F.object({message:F.string()})),zd=q2.create("WorktreeStartCommandFailedError",F.object({message:F.string()})),m9=q2.create("WorktreeRemoveFailedError",F.object({message:F.string()})),h1=q2.create("WorktreeResetFailedError",F.object({message:F.string()}));function _d($){return $.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+/,"").replace(/-+$/,"")}function Pd(...$){return $.filter(Boolean).flatMap((Z)=>Z.split(`
|
|
8121
8121
|
`).map((J)=>J.trim()).flatMap((J)=>{let Y=J.match(/^warning:\s+failed to remove\s+(.+):\s+/i);if(!Y)return[];let Q=Y[1]?.trim().replace(/^['"]|['"]$/g,"");if(!Q)return[];return[Q]}))}class U3 extends X0.Service()("@qitqode/Worktree"){}var Kw=b.effect(U3,V.gen(function*(){let $=yield*w2.Scope,Z=yield*V0.Service,J=yield*XX.Path,Y=yield*m8.ChildProcessSpawner,Q=yield*U1.Service,X=yield*V6.Service,K=V.fnUntraced(function*(E,y){return yield*Yw(Y,E,y)},V.catch((E)=>V.succeed({code:1,text:"",stderr:E instanceof Error?E.message:String(E)}))),G=26,B=V.fn("Worktree.candidate")(function*(E,y){let R=yield*u.context;for(let k of Array.from({length:26},(i,d)=>d)){let i=y?k===0?y:`${y}-${yB.create()}`:yB.create(),d=`qitqode/${i}`,c=J.join(E,i);if(yield*Z.exists(c).pipe(V.orDie))continue;let o=`refs/heads/${d}`;if((yield*K(["show-ref","--verify","--quiet",o],{cwd:R.worktree})).code===0)continue;return Qw.parse({name:i,branch:d,directory:c})}throw new Xw({message:"Failed to generate a unique worktree name"})}),H=V.fn("Worktree.makeWorktreeInfo")(function*(E){let y=yield*u.context;if(y.project.vcs!=="git")throw new O3({message:"Worktrees are only supported for git projects"});let R=J.join(a0.Path.data,"worktree",y.project.id);yield*Z.makeDirectory(R,{recursive:!0}).pipe(V.orDie);let k=E?_d(E):"";return yield*B(R,k||void 0)}),W=V.fnUntraced(function*(E){let y=yield*u.context,R=yield*K(["worktree","add","--no-checkout","-b",E.branch,E.directory],{cwd:y.worktree});if(R.code!==0)throw new Vw({message:R.stderr||R.text||"Failed to create git worktree"});yield*X.addSandbox(y.project.id,E.directory).pipe(V.catch(()=>V.void))}),O=V.fnUntraced(function*(E,y){let R=yield*u.context,k=yield*u.workspaceID,i=R.project.id,d=y?.trim(),c=yield*K(["reset","--hard"],{cwd:E.directory});if(c.code!==0){let p=c.stderr||c.text||"Failed to populate worktree";nJ.error("worktree checkout failed",{directory:E.directory,message:p}),H3.emit("event",{directory:E.directory,project:R.project.id,workspace:k,payload:{type:j3.Failed.type,properties:{message:p}}});return}if(!(yield*V.promise(()=>q0.provide({directory:E.directory,init:()=>Jw.runPromise(Zw),fn:()=>{return}}).then(()=>!0).catch((p)=>{let J0=t8(p);return nJ.error("worktree bootstrap failed",{directory:E.directory,message:J0}),H3.emit("event",{directory:E.directory,project:R.project.id,workspace:k,payload:{type:j3.Failed.type,properties:{message:J0}}}),!1}))))return;H3.emit("event",{directory:E.directory,project:R.project.id,workspace:k,payload:{type:j3.Ready.type,properties:{name:E.name,branch:E.branch}}}),yield*T(E.directory,{projectID:i,extra:d})}),j=V.fn("Worktree.createFromInfo")(function*(E,y){yield*W(E),yield*O(E,y)}),U=V.fn("Worktree.create")(function*(E){let y=yield*H(E?.name);return yield*W(y),yield*O(y,E?.startCommand).pipe(V.catchCause((R)=>V.sync(()=>nJ.error("worktree bootstrap failed",{cause:R}))),V.forkIn($)),y}),q=V.fnUntraced(function*(E){let y=J.resolve(E),R=yield*Z.realPath(y).pipe(V.catch(()=>V.succeed(y))),k=J.normalize(R);return process.platform==="win32"?k.toLowerCase():k});function z(E){return E.split(`
|
|
8122
8122
|
`).map((y)=>y.trim()).reduce((y,R)=>{if(!R)return y;if(R.startsWith("worktree "))return y.push({path:R.slice(9).trim()}),y;let k=y[y.length-1];if(!k)return y;if(R.startsWith("branch "))k.branch=R.slice(7).trim();return y},[])}let A=V.fnUntraced(function*(E,y){for(let R of E){if(!R.path)continue;if((yield*q(R.path))===y)return R}return});function D(E){return Z.exists(E).pipe(V.orDie,V.flatMap((y)=>y?K(["fsmonitor--daemon","stop"],{cwd:E}):V.void))}function _(E){return V.promise(()=>import("fs/promises").then((y)=>y.rm(E,{recursive:!0,force:!0,maxRetries:5,retryDelay:100})).catch((y)=>{let R=t8(y);throw new m9({message:R||"Failed to remove git worktree directory"})}))}let w=V.fn("Worktree.remove")(function*(E){let y=yield*u.context;if(y.project.vcs!=="git")throw new O3({message:"Worktrees are only supported for git projects"});let R=yield*q(E.directory),k=yield*K(["worktree","list","--porcelain"],{cwd:y.worktree});if(k.code!==0)throw new m9({message:k.stderr||k.text||"Failed to read git worktrees"});let i=z(k.text),d=yield*A(i,R);if(!d?.path){if(!(yield*Z.exists(R).pipe(V.orDie)))return!0;let J0=yield*q(J.join(a0.Path.data,"worktree",y.project.id));if(R!==J0&&!R.startsWith(`${J0}${J.sep}`))throw new m9({message:"Directory is not a registered or managed worktree"});return yield*D(R),yield*_(R),!0}yield*D(d.path);let c=yield*K(["worktree","remove","--force",d.path],{cwd:y.worktree});if(c.code!==0){let p=yield*K(["worktree","list","--porcelain"],{cwd:y.worktree});if(p.code!==0)throw new m9({message:c.stderr||c.text||p.stderr||p.text||"Failed to remove git worktree"});if((yield*A(z(p.text),R))?.path)throw new m9({message:c.stderr||c.text||"Failed to remove git worktree"})}yield*_(d.path);let o=d.branch?.replace(/^refs\/heads\//,"");if(o){let p=yield*K(["branch","-D",o],{cwd:y.worktree});if(p.code!==0)throw new m9({message:p.stderr||p.text||"Failed to delete worktree branch"})}return!0}),P=V.fnUntraced(function*(E,y,R){let k=yield*K(E,y);if(k.code!==0)throw R(k);return k}),N=V.fnUntraced(function*(E,y){let[R,k]=process.platform==="win32"?["cmd",["/c",y]]:["bash",["-lc",y]],i=yield*Y.spawn(m$.make(R,k,{cwd:E,extendEnv:!0,stdin:"ignore"})),[,d]=yield*V.all([f0.runDrain(i.stdout),f0.mkString(f0.decodeText(i.stderr))],{concurrency:2}).pipe(V.orDie);return{code:yield*i.exitCode,stderr:d}},V.scoped,V.catch(()=>V.succeed({code:1,stderr:""}))),L=V.fnUntraced(function*(E,y,R){let k=y.trim();if(!k)return!0;let i=yield*N(E,k);if(i.code===0)return!0;return nJ.error("worktree start command failed",{kind:R,directory:E,message:i.stderr}),!1}),T=V.fnUntraced(function*(E,y){let R=yield*V.sync(()=>w0.use((c)=>c.select().from(MB).where(z0(MB.id,y.projectID)).get())),i=(R?V6.fromRow(R):void 0)?.commands?.start?.trim()??"";if(!(yield*L(E,i,"project")))return!1;return yield*L(E,y.extra??"","worktree"),!0}),h=V.fnUntraced(function*(E,y){let R=yield*q(E);yield*V.forEach(y,(k)=>V.gen(function*(){let i=yield*q(J.resolve(E,k));if(i===R)return;if(!i.startsWith(`${R}${J.sep}`))return;yield*Z.remove(i,{recursive:!0}).pipe(V.ignore)}),{concurrency:8})}),x=V.fnUntraced(function*(E){let y=yield*K(["clean","-ffdx"],{cwd:E});if(y.code===0)return y;let R=Pd(y.stderr,y.text);if(!R.length)return y;return yield*h(E,R),yield*K(["clean","-ffdx"],{cwd:E})}),v=V.fn("Worktree.reset")(function*(E){let y=yield*u.context;if(y.project.vcs!=="git")throw new O3({message:"Worktrees are only supported for git projects"});let R=yield*q(E.directory),k=yield*q(y.worktree);if(R===k)throw new h1({message:"Cannot reset the primary workspace"});let i=yield*K(["worktree","list","--porcelain"],{cwd:y.worktree});if(i.code!==0)throw new h1({message:i.stderr||i.text||"Failed to read git worktrees"});let d=yield*A(z(i.text),R);if(!d?.path)throw new h1({message:"Worktree not found"});let c=d.path,o=yield*Q.defaultBranch(y.worktree);if(!o)throw new h1({message:"Default branch not found"});let p=o.ref.indexOf("/");if(o.ref!==o.name&&p>0){let f=o.ref.slice(0,p),a=o.ref.slice(p+1);yield*P(["fetch",f,a],{cwd:y.worktree},($0)=>new h1({message:$0.stderr||$0.text||`Failed to fetch ${o.ref}`}))}yield*P(["reset","--hard",o.ref],{cwd:c},(f)=>new h1({message:f.stderr||f.text||"Failed to reset worktree to target"}));let J0=yield*x(c);if(J0.code!==0)throw new h1({message:J0.stderr||J0.text||"Failed to clean worktree"});yield*P(["submodule","update","--init","--recursive","--force"],{cwd:c},(f)=>new h1({message:f.stderr||f.text||"Failed to update submodules"})),yield*P(["submodule","foreach","--recursive","git","reset","--hard"],{cwd:c},(f)=>new h1({message:f.stderr||f.text||"Failed to reset submodules"})),yield*P(["submodule","foreach","--recursive","git","clean","-fdx"],{cwd:c},(f)=>new h1({message:f.stderr||f.text||"Failed to clean submodules"}));let t=yield*K(["-c","core.fsmonitor=false","status","--porcelain=v1"],{cwd:c});if(t.code!==0)throw new h1({message:t.stderr||t.text||"Failed to read git status"});if(t.text.trim())throw new h1({message:`Worktree reset left local changes:
|
|
8123
|
-
${t.text.trim()}`});return yield*T(c,{projectID:y.project.id}).pipe(V.catchCause((f)=>V.sync(()=>nJ.error("worktree start task failed",{cause:f}))),V.forkIn($)),!0}),I=V.fn("Worktree.head")(function*(E){return(yield*K(["rev-parse","HEAD"],{cwd:E})).text.trim()}),S=V.fn("Worktree.isPristine")(function*(E,y){let R=yield*K(["status","--porcelain"],{cwd:E});if(R.code!==0)return!1;if(R.text.trim()!=="")return!1;let k=yield*K(["rev-parse","HEAD"],{cwd:E});return k.code===0&&k.text.trim()===y});return U3.of({makeWorktreeInfo:H,createFromInfo:j,create:U,remove:w,reset:v,head:I,isPristine:S})})),Md=Kw.pipe(b.provide(U1.defaultLayer),b.provide(u1),b.provide(V6.defaultLayer),b.provide(V0.defaultLayer),b.provide(Z7.layer));var eJ={};R0(eJ,{layer:()=>Hw,defaultLayer:()=>Ld,UpdateInput:()=>Nd,Service:()=>q3,Pty:()=>eJ,Info:()=>CB,Event:()=>tJ,CreateInput:()=>Id});function Gw($){let Z,J=!1;return()=>{if(J)return Z;return J=!0,Z=$(),Z}}var yd=K0.String.annotate({[$7]:M$.schema("pty")}).pipe(K0.brand("PtyID")),rJ=yd.pipe(e9(($)=>({ascending:(Z)=>$.make(M$.ascending("pty",Z)),zod:M$.schema("pty").pipe(F.custom())})));var aJ=Y0.create({service:"pty"}),Ww=2097152,Bw=65536,wd=new TextEncoder,wB=($)=>$.data&&typeof $.data==="object"?$.data:$,Cd=($)=>{let Z=JSON.stringify({cursor:$}),J=wd.encode(Z),Y=new Uint8Array(J.length+1);return Y[0]=0,Y.set(J,1),Y},Ad=Gw(()=>import("./chunk-
|
|
8123
|
+
${t.text.trim()}`});return yield*T(c,{projectID:y.project.id}).pipe(V.catchCause((f)=>V.sync(()=>nJ.error("worktree start task failed",{cause:f}))),V.forkIn($)),!0}),I=V.fn("Worktree.head")(function*(E){return(yield*K(["rev-parse","HEAD"],{cwd:E})).text.trim()}),S=V.fn("Worktree.isPristine")(function*(E,y){let R=yield*K(["status","--porcelain"],{cwd:E});if(R.code!==0)return!1;if(R.text.trim()!=="")return!1;let k=yield*K(["rev-parse","HEAD"],{cwd:E});return k.code===0&&k.text.trim()===y});return U3.of({makeWorktreeInfo:H,createFromInfo:j,create:U,remove:w,reset:v,head:I,isPristine:S})})),Md=Kw.pipe(b.provide(U1.defaultLayer),b.provide(u1),b.provide(V6.defaultLayer),b.provide(V0.defaultLayer),b.provide(Z7.layer));var eJ={};R0(eJ,{layer:()=>Hw,defaultLayer:()=>Ld,UpdateInput:()=>Nd,Service:()=>q3,Pty:()=>eJ,Info:()=>CB,Event:()=>tJ,CreateInput:()=>Id});function Gw($){let Z,J=!1;return()=>{if(J)return Z;return J=!0,Z=$(),Z}}var yd=K0.String.annotate({[$7]:M$.schema("pty")}).pipe(K0.brand("PtyID")),rJ=yd.pipe(e9(($)=>({ascending:(Z)=>$.make(M$.ascending("pty",Z)),zod:M$.schema("pty").pipe(F.custom())})));var aJ=Y0.create({service:"pty"}),Ww=2097152,Bw=65536,wd=new TextEncoder,wB=($)=>$.data&&typeof $.data==="object"?$.data:$,Cd=($)=>{let Z=JSON.stringify({cursor:$}),J=wd.encode(Z),Y=new Uint8Array(J.length+1);return Y[0]=0,Y.set(J,1),Y},Ad=Gw(()=>import("./chunk-yyarzhw3.js")),CB=F.object({id:rJ.zod,title:F.string(),command:F.string(),args:F.array(F.string()),cwd:F.string(),status:F.enum(["running","exited"]),pid:F.number()}).meta({ref:"Pty"}),Id=F.object({command:F.string().optional(),args:F.array(F.string()).optional(),cwd:F.string().optional(),title:F.string().optional(),env:F.record(F.string(),F.string()).optional()}),Nd=F.object({title:F.string().optional(),size:F.object({rows:F.number(),cols:F.number()}).optional()}),tJ={Created:S0.define("pty.created",F.object({info:CB})),Updated:S0.define("pty.updated",F.object({info:CB})),Exited:S0.define("pty.exited",F.object({id:rJ.zod,exitCode:F.number()})),Deleted:S0.define("pty.deleted",F.object({id:rJ.zod}))};class q3 extends X0.Service()("@qitqode/Pty"){}var Hw=b.effect(q3,V.gen(function*(){let $=yield*e.Service,Z=yield*n0.Service;function J(j){try{j.process.kill()}catch{}for(let[U,q]of j.subscribers.entries())try{if(wB(q)===U)q.close()}catch{}j.subscribers.clear()}let Y=yield*u.make(V.fn("Pty.state")(function*(j){let U={dir:j.directory,sessions:new Map};return yield*V.addFinalizer(()=>V.sync(()=>{for(let q of U.sessions.values())J(q);U.sessions.clear()})),U})),Q=V.fn("Pty.remove")(function*(j){let U=yield*u.get(Y),q=U.sessions.get(j);if(!q)return;U.sessions.delete(j),aJ.info("removing session",{id:j}),J(q),yield*$.publish(tJ.Deleted,{id:q.info.id})}),X=V.fn("Pty.list")(function*(){let j=yield*u.get(Y);return Array.from(j.sessions.values()).map((U)=>U.info)}),K=V.fn("Pty.get")(function*(j){return(yield*u.get(Y)).sessions.get(j)?.info}),G=V.fn("Pty.create")(function*(j){let U=yield*u.get(Y),q=yield*L2.make(),z=rJ.ascending(),A=j.command||q1.preferred(),D=j.args||[];if(q1.login(A))D.push("-l");let _=j.cwd||U.dir,w=yield*Z.trigger("shell.env",{cwd:_},{env:{}}),P={...V7(),...j.env,...w.env,TERM:"xterm-256color",QITQODE_TERMINAL:"1"};if(process.platform==="win32")P.LC_ALL="C.UTF-8",P.LC_CTYPE="C.UTF-8",P.LANG="C.UTF-8";aJ.info("creating session",{id:z,cmd:A,args:D,cwd:_});let{spawn:N}=yield*V.promise(()=>Ad()),L=yield*V.sync(()=>N(A,D,{name:"xterm-256color",cwd:_,env:P})),T={id:z,title:j.title||`Terminal ${z.slice(-4)}`,command:A,args:D,cwd:_,status:"running",pid:L.pid},h={info:T,process:L,buffer:"",bufferCursor:0,cursor:0,subscribers:new Map};return U.sessions.set(z,h),L.onData(q0.bind((x)=>{h.cursor+=x.length;for(let[I,S]of h.subscribers.entries()){if(S.readyState!==1){h.subscribers.delete(I);continue}if(wB(S)!==I){h.subscribers.delete(I);continue}try{S.send(x)}catch{h.subscribers.delete(I)}}if(h.buffer+=x,h.buffer.length<=Ww)return;let v=h.buffer.length-Ww;h.buffer=h.buffer.slice(v),h.bufferCursor+=v})),L.onExit(q0.bind(({exitCode:x})=>{if(h.info.status==="exited")return;aJ.info("session exited",{id:z,exitCode:x}),h.info.status="exited",q.fork($.publish(tJ.Exited,{id:z,exitCode:x})),q.fork(Q(z))})),yield*$.publish(tJ.Created,{info:T}),T}),B=V.fn("Pty.update")(function*(j,U){let z=(yield*u.get(Y)).sessions.get(j);if(!z)return;if(U.title)z.info.title=U.title;if(U.size)z.process.resize(U.size.cols,U.size.rows);return yield*$.publish(tJ.Updated,{info:z.info}),z.info}),H=V.fn("Pty.resize")(function*(j,U,q){let A=(yield*u.get(Y)).sessions.get(j);if(A&&A.info.status==="running")A.process.resize(U,q)}),W=V.fn("Pty.write")(function*(j,U){let z=(yield*u.get(Y)).sessions.get(j);if(z&&z.info.status==="running")z.process.write(U)}),O=V.fn("Pty.connect")(function*(j,U,q){let A=(yield*u.get(Y)).sessions.get(j);if(!A){U.close();return}aJ.info("client connected to session",{id:j});let D=wB(U);A.subscribers.delete(D),A.subscribers.set(D,U);let _=()=>{A.subscribers.delete(D)},w=A.bufferCursor,P=A.cursor,N=q===-1?P:typeof q==="number"&&Number.isSafeInteger(q)?Math.max(0,q):0,L=(()=>{if(!A.buffer)return"";if(N>=P)return"";let T=Math.max(0,N-w);if(T>=A.buffer.length)return"";return A.buffer.slice(T)})();if(L)try{for(let T=0;T<L.length;T+=Bw)U.send(L.slice(T,T+Bw))}catch{_(),U.close();return}try{U.send(Cd(P))}catch{_(),U.close();return}return{onMessage:(T)=>{A.process.write(typeof T==="string"?T:new TextDecoder().decode(T))},onClose:()=>{aJ.info("client disconnected from session",{id:j}),_()}}});return q3.of({list:X,get:K,create:G,update:B,remove:Q,resize:H,write:W,connect:O})})),Ld=Hw.pipe(b.provide(e.layer),b.provide(n0.defaultLayer));var ZY={};R0(ZY,{layer:()=>Uw,defaultLayer:()=>xd,Service:()=>z3,MAX_PRE_REACT:()=>jw,MAX_POST_REACT:()=>Ow,Actor:()=>ZY});var F3=($,Z,J)=>V.uninterruptible(V.gen(function*(){let Y=yield*K2.Service;yield*Y.updateStatus($,Z,{status:"running"}).pipe(V.ignore);let Q=yield*J.pipe(V.interruptible,V.exit);if(H$.isSuccess(Q))return yield*Y.updateStatus($,Z,{status:"idle",lastOutcome:"success",lastError:void 0}).pipe(V.ignore),Q.value;let X=Q.cause,K=p0.hasInterruptsOnly(X);return yield*Y.updateStatus($,Z,{status:"idle",lastOutcome:K?"cancelled":"failure",lastError:K?void 0:Sd(X)}).pipe(V.ignore),yield*V.failCause(X)}));function Sd($){return p0.pretty($)}var D3=Y0.create({service:"actor.spawn"}),jw=3,Ow=3,Td=`
|
|
8124
8124
|
|
|
8125
8125
|
---
|
|
8126
8126
|
|
|
@@ -8150,7 +8150,7 @@ This format lets the spawning agent and the checkpoint writer extract your progr
|
|
|
8150
8150
|
`).join(""))});return v6.set($,Y),Y.finally(()=>{if(v6.get($)===Y)v6.delete($)})}var dd=/^wf_[0-9A-Za-z]+$/,Aw=($)=>{if(!dd.test($))throw Error(`invalid workflow runID: ${JSON.stringify($)}`);return $},Iw=($)=>SB.join(JY(),`${Aw($)}.js`),RB=($)=>SB.join(JY(),`${Aw($)}.jsonl`);function Nw($){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 cd=($)=>V.sync(()=>w0.use((Z)=>Z.insert(n$).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:n$.id,set:{status:"running",running:0,succeeded:0,failed:0,script_sha:$.scriptSha??null,...$.agentTimeoutMs!==void 0?{agent_timeout_ms:$.agentTimeoutMs}:{}}}).run())),ud=($)=>V.sync(()=>w0.use((Z)=>Z.update(n$).set({current_phase:$.phase}).where(z0(n$.id,$.runID)).run())),ld=($)=>V.sync(()=>w0.use((Z)=>Z.update(n$).set({running:$.running,succeeded:$.succeeded,failed:$.failed}).where(z0(n$.id,$.runID)).run())),pd=($)=>V.sync(()=>w0.use((Z)=>Z.update(n$).set({status:$.status,...$.error?{error:$.error}:{}}).where(z0(n$.id,$.runID)).run())),od=($)=>V.sync(()=>w0.use((Z)=>{return(($?.sessionID)?Z.select().from(n$).where(z0(n$.session_id,$.sessionID)).orderBy(I8(n$.time_created)).all():Z.select().from(n$).orderBy(I8(n$.time_created)).all()).map(Nw)})),id=($)=>V.sync(()=>w0.use((Z)=>{let J=Z.select().from(n$).where(z0(n$.id,$)).get();return J?Nw(J):void 0})),sd=($,Z)=>V.promise(async()=>{await(await import("fs/promises")).mkdir(JY(),{recursive:!0}),await Bun.write(Iw($),Z)}),nd=($)=>V.promise(()=>Bun.file(Iw($)).text()),rd=($,Z)=>V.promise(()=>Cw($,[Z])),ad=($,Z)=>V.promise(()=>Cw($,Z)),td=($)=>V.promise(async()=>{let Z=Bun.file(RB($));if(!await Z.exists())return{results:new Map,pass:1};let J=await Z.text(),Y=new Map,Q=0;for(let X of J.split(`
|
|
8151
8151
|
`)){if(!X)continue;let K;try{K=JSON.parse(X)}catch{continue}if(typeof K.pass==="number"&&K.pass>Q)Q=K.pass;if(K.t==="agent")Y.set(K.key,K.result)}return{results:Y,pass:Q+1}}),ed=($)=>V.promise(async()=>{let J=(v6.get($)??Promise.resolve()).catch(()=>{}).then(async()=>{await(await import("fs/promises")).mkdir(JY(),{recursive:!0}),await Bun.write(RB($),"")});v6.set($,J);try{await J}finally{if(v6.get($)===J)v6.delete($)}}),t2={recordStart:cd,recordPhase:ud,flushCounters:ld,recordTerminal:pd,list:od,load:id,writeScript:sd,readScript:nd,appendJournal:rd,appendJournalSync:ad,loadJournal:td,clearJournal:ed};class TB{#$=new Map;get($){return this.#$.get($)}set($){return this.#$.set($.runID,$),$}values(){return this.#$.values()}clear(){this.#$.clear()}}function Lw($){let Z=(X)=>V.gen(function*(){if(X.status!=="running")return;if(yield*J(X),yield*$.flushNow(X),yield*t2.recordTerminal({runID:X.runID,status:"cancelled"}).pipe(V.ignore),X.fiber)yield*y8.interrupt(X.fiber);X.status="cancelled",yield*$.bus.publish(_3,{sessionID:X.sessionID,runID:X.runID,status:"cancelled"}),yield*u0.succeed(X.deferred,{status:"cancelled"})}).pipe(V.provideService(w1,X.instance)),J=(X)=>V.gen(function*(){let K=X1.current;if(K)yield*V.forEach([...X.childActorIDs],(G)=>K.cancel(X.sessionID,G,"graceful").pipe(V.ignore),{concurrency:"unbounded",discard:!0});yield*V.forEach([...X.worktrees],(G)=>$.worktree.remove({directory:G}).pipe(V.ignore),{concurrency:"unbounded",discard:!0}),X.worktrees.clear(),yield*V.forEach([...X.childRunIDs],(G)=>V.gen(function*(){let B=$.runs.get(G);if(B&&B.status==="running")yield*Z(B)}).pipe(V.ignore),{concurrency:"unbounded",discard:!0})}).pipe(V.provideService(w1,X.instance));return{reclaim:J,cancelEntry:Z,complete:(X)=>V.gen(function*(){if(X.entry.status="completed",yield*$.flushNow(X.entry),yield*t2.recordTerminal({runID:X.entry.runID,status:"completed"}).pipe(V.ignore),yield*$.bus.publish(_3,{sessionID:X.sessionID,runID:X.entry.runID,status:"completed"}),X.notifyOnTerminal!==!1)yield*$.inbox.send({receiverSessionID:X.sessionID,receiverActorID:X.parentActorID,senderSessionID:X.sessionID,senderActorID:"workflow",type:"actor_notification",content:`Workflow completed. run_id: ${X.entry.runID}
|
|
8152
8152
|
`+JSON.stringify(X.result??null).slice(0,4000)}).pipe(V.ignore);yield*u0.succeed(X.entry.deferred,{status:"completed",result:X.result})}).pipe(V.provideService(w1,X.entry.instance)),fail:(X)=>V.gen(function*(){if(yield*J(X.entry),X.entry.status="failed",yield*$.flushNow(X.entry),yield*t2.recordTerminal({runID:X.entry.runID,status:"failed",error:X.error}).pipe(V.ignore),yield*$.bus.publish(_3,{sessionID:X.sessionID,runID:X.entry.runID,status:"failed",error:X.error}),X.notifyOnTerminal!==!1)yield*$.inbox.send({receiverSessionID:X.sessionID,receiverActorID:X.parentActorID,senderSessionID:X.sessionID,senderActorID:"workflow",type:"actor_notification",content:`Workflow failed. run_id: ${X.entry.runID}
|
|
8153
|
-
error: ${X.error}`}).pipe(V.ignore);yield*u0.succeed(X.entry.deferred,{status:"failed",error:X.error})}).pipe(V.provideService(w1,X.entry.instance))}}import $c from"os";function xB($){let Z=0,J=[],Y=()=>{Z--;let Q=J.shift();if(Q)Q()};return{run(Q){return new Promise((X,K)=>{let G=()=>{Z++,Q().then((B)=>{Y(),X(B)},(B)=>{Y(),K(B)})};if(Z<$)G();else J.push(G)})}}}function Sw(){let $=$c.cpus().length;return Math.min(16,2*Math.max(1,$>0?$:4))}function Rw($,Z){return V.gen(function*(){if(Z)yield*t2.clearJournal($).pipe(V.ignore);let J=yield*t2.loadJournal($);return{results:J.results,pass:J.pass,occurrences:new Map}})}function Tw($,Z){let J=$.occurrences.get(Z)??0;return $.occurrences.set(Z,J+1),Z+":"+J}function xw($,Z,J,Y){return t2.appendJournalSync($,[{t:"agent",key:J,result:Y,pass:Z.pass}]).pipe(V.ignore)}var bw=Symbol("straggler-timeout");function Ew($){let Z=(B,H,W,O)=>{let j=H.timeoutMs??$.runAgentTimeoutMs;if(!j||j<=0)return W;return V.raceFirst(W,V.sleep(`${j} millis`).pipe(V.as(bw))).pipe(V.flatMap((U)=>U===bw?V.gen(function*(){let q=$.getActor();if(q)yield*q.cancel($.sessionID,B,"graceful").pipe(V.ignore);return yield*V.sync(()=>{try{O?.()}catch{}}),null}):V.succeed(U)))},J=(B,H,W={})=>{try{$.bridge.fork($.bus.publish(Pw,{sessionID:$.sessionID,runID:$.runID,actorID:W.actorID,agentType:B.agentType??"general",label:B.label,phase:B.phase??$.entry.currentPhase,reason:H,errorMessage:W.errorMessage}).pipe(V.ignore))}catch{}},Y=(B)=>B.label?B.phase?`[${B.phase}] ${B.label}`:B.label:B.phase?`[${B.phase}]`:void 0,Q=(B,H,W)=>({mode:"subagent",sessionID:$.sessionID,agentType:B.agentType??"general",description:Y(B),task:H,context:"none",tools:B.tools?[...B.tools]:"INHERIT",background:!0,parentActorID:$.parentActorID,model:W,onActorID:(O)=>$.entry.childActorIDs.add(O),...B.schema?{format:{type:"json_schema",schema:B.schema,retryCount:2}}:{}}),X=async(B,H,W,O)=>{$.entry.running++,$.scheduleFlush($.entry);let j="actor-error",U,q,z=await $.bridge.promise(V.gen(function*(){let A=yield*B.spawn(Q(W,H,O));U=A.actorID;let D=yield*Z(A.actorID,W,u0.await(A.outcome).pipe(V.map((_)=>{if(_.status!=="success")return j="actor-error",q=_.error,null;let w=W.schema?_.structured??null:_.structured??_.finalText??null;if(w===null)j="no-deliverable";return w})),()=>{j="timeout"});return $.entry.childActorIDs.delete(A.actorID),D})).catch((A)=>{return j="spawn-reject",q=A instanceof Error?A.message:String(A),null});if($.entry.running--,z!==null)$.entry.succeeded++;else $.entry.failed++,J(W,j,{actorID:U,errorMessage:q});return $.scheduleFlush($.entry),z},K=async(B,H,W,O)=>{let j="actor-error",U,q,z=await $.bridge.promise(V.gen(function*(){let x=yield*$.worktree.makeWorktreeInfo();return yield*$.worktree.createFromInfo(x),x})).catch((x)=>{return q=x instanceof Error?x.message:String(x),null});if(!z)return J(W,"spawn-reject",{errorMessage:q}),null;$.entry.worktrees.add(z.directory);let A=await $.bridge.promise($.worktree.head(z.directory)).catch(()=>""),D=await q0.provide({directory:z.directory,fn:()=>Promise.resolve(q0.current)}),_=await $.bridge.promise(kw().pipe(V.provideService(w1,D)));$.entry.running++,$.scheduleFlush($.entry);let w=await q0.provide({directory:z.directory,fn:()=>_.promise(V.gen(function*(){let x=yield*B.spawn(Q(W,H,O));U=x.actorID;let v=yield*Z(x.actorID,W,u0.await(x.outcome),()=>{j="timeout"});if($.entry.childActorIDs.delete(x.actorID),v===null)return null;if(v.status!=="success")j="actor-error",q=v.error;return{actorID:x.actorID,outcome:v}})).catch((x)=>{return j="spawn-reject",q=x instanceof Error?x.message:String(x),null})}).catch((x)=>{return j="spawn-reject",q=x instanceof Error?x.message:String(x),null}),P=!!w&&w.outcome.status==="success";if($.entry.running--,P)$.entry.succeeded++;else $.entry.failed++,J(W,j,{actorID:U,errorMessage:q});$.scheduleFlush($.entry);let N=w&&w.outcome.status==="success"?W.schema?w.outcome.structured??null:w.outcome.structured??w.outcome.finalText??null:null,L=A!==""&&await $.bridge.promise($.worktree.isPristine(z.directory,A)).catch(()=>!1);if(!(P&&!L))return await $.bridge.promise($.worktree.remove({directory:z.directory})).catch(()=>{return}),$.entry.worktrees.delete(z.directory),P?N:null;let h={branch:z.branch,directory:z.directory,changed:!0};if(N&&typeof N==="object"&&!Array.isArray(N))return{...N,_worktree:h};return{_worktree:h,result:N}},G=async(B,H,W)=>{if($.entry.agentCount>=$.lifecycleCap)return $.warnCapOnce(),J(B,"over-cap"),null;$.entry.agentCount++;let O=$.getActor();if(!O)throw Error("Actor service unavailable");let j=await $.bridge.promise($.resolveAgentModel(B.model,$.defaultModel,$.entry.warnedModelRefs));return W(O,H,B,j)};return(B,H)=>{let W=H??{},O=String(B);if(W.isolation!=="worktree"){let j=ww(O,{agentType:W.agentType,model:W.model,schema:W.schema,phase:W.phase}),U=Tw($.journal,j);if($.journal.results.has(U))return $.entry.succeeded++,$.scheduleFlush($.entry),Promise.resolve($.journal.results.get(U));return(async()=>{let q=await $.semaphore.run(async()=>$.globalSemaphore.run(async()=>G(W,O,X)));if(q!==null)await V.runPromise(xw($.runID,$.journal,U,q));return q})()}return $.semaphore.run(async()=>$.globalSemaphore.run(async()=>G(W,O,K)))}}async function gw($){let Z=bB(await $),[J,Y,{QuickJSWASMModule:Q}]=await Promise.all([Z.importModuleLoader().then(bB),Z.importFFI(),import("./chunk-
|
|
8153
|
+
error: ${X.error}`}).pipe(V.ignore);yield*u0.succeed(X.entry.deferred,{status:"failed",error:X.error})}).pipe(V.provideService(w1,X.entry.instance))}}import $c from"os";function xB($){let Z=0,J=[],Y=()=>{Z--;let Q=J.shift();if(Q)Q()};return{run(Q){return new Promise((X,K)=>{let G=()=>{Z++,Q().then((B)=>{Y(),X(B)},(B)=>{Y(),K(B)})};if(Z<$)G();else J.push(G)})}}}function Sw(){let $=$c.cpus().length;return Math.min(16,2*Math.max(1,$>0?$:4))}function Rw($,Z){return V.gen(function*(){if(Z)yield*t2.clearJournal($).pipe(V.ignore);let J=yield*t2.loadJournal($);return{results:J.results,pass:J.pass,occurrences:new Map}})}function Tw($,Z){let J=$.occurrences.get(Z)??0;return $.occurrences.set(Z,J+1),Z+":"+J}function xw($,Z,J,Y){return t2.appendJournalSync($,[{t:"agent",key:J,result:Y,pass:Z.pass}]).pipe(V.ignore)}var bw=Symbol("straggler-timeout");function Ew($){let Z=(B,H,W,O)=>{let j=H.timeoutMs??$.runAgentTimeoutMs;if(!j||j<=0)return W;return V.raceFirst(W,V.sleep(`${j} millis`).pipe(V.as(bw))).pipe(V.flatMap((U)=>U===bw?V.gen(function*(){let q=$.getActor();if(q)yield*q.cancel($.sessionID,B,"graceful").pipe(V.ignore);return yield*V.sync(()=>{try{O?.()}catch{}}),null}):V.succeed(U)))},J=(B,H,W={})=>{try{$.bridge.fork($.bus.publish(Pw,{sessionID:$.sessionID,runID:$.runID,actorID:W.actorID,agentType:B.agentType??"general",label:B.label,phase:B.phase??$.entry.currentPhase,reason:H,errorMessage:W.errorMessage}).pipe(V.ignore))}catch{}},Y=(B)=>B.label?B.phase?`[${B.phase}] ${B.label}`:B.label:B.phase?`[${B.phase}]`:void 0,Q=(B,H,W)=>({mode:"subagent",sessionID:$.sessionID,agentType:B.agentType??"general",description:Y(B),task:H,context:"none",tools:B.tools?[...B.tools]:"INHERIT",background:!0,parentActorID:$.parentActorID,model:W,onActorID:(O)=>$.entry.childActorIDs.add(O),...B.schema?{format:{type:"json_schema",schema:B.schema,retryCount:2}}:{}}),X=async(B,H,W,O)=>{$.entry.running++,$.scheduleFlush($.entry);let j="actor-error",U,q,z=await $.bridge.promise(V.gen(function*(){let A=yield*B.spawn(Q(W,H,O));U=A.actorID;let D=yield*Z(A.actorID,W,u0.await(A.outcome).pipe(V.map((_)=>{if(_.status!=="success")return j="actor-error",q=_.error,null;let w=W.schema?_.structured??null:_.structured??_.finalText??null;if(w===null)j="no-deliverable";return w})),()=>{j="timeout"});return $.entry.childActorIDs.delete(A.actorID),D})).catch((A)=>{return j="spawn-reject",q=A instanceof Error?A.message:String(A),null});if($.entry.running--,z!==null)$.entry.succeeded++;else $.entry.failed++,J(W,j,{actorID:U,errorMessage:q});return $.scheduleFlush($.entry),z},K=async(B,H,W,O)=>{let j="actor-error",U,q,z=await $.bridge.promise(V.gen(function*(){let x=yield*$.worktree.makeWorktreeInfo();return yield*$.worktree.createFromInfo(x),x})).catch((x)=>{return q=x instanceof Error?x.message:String(x),null});if(!z)return J(W,"spawn-reject",{errorMessage:q}),null;$.entry.worktrees.add(z.directory);let A=await $.bridge.promise($.worktree.head(z.directory)).catch(()=>""),D=await q0.provide({directory:z.directory,fn:()=>Promise.resolve(q0.current)}),_=await $.bridge.promise(kw().pipe(V.provideService(w1,D)));$.entry.running++,$.scheduleFlush($.entry);let w=await q0.provide({directory:z.directory,fn:()=>_.promise(V.gen(function*(){let x=yield*B.spawn(Q(W,H,O));U=x.actorID;let v=yield*Z(x.actorID,W,u0.await(x.outcome),()=>{j="timeout"});if($.entry.childActorIDs.delete(x.actorID),v===null)return null;if(v.status!=="success")j="actor-error",q=v.error;return{actorID:x.actorID,outcome:v}})).catch((x)=>{return j="spawn-reject",q=x instanceof Error?x.message:String(x),null})}).catch((x)=>{return j="spawn-reject",q=x instanceof Error?x.message:String(x),null}),P=!!w&&w.outcome.status==="success";if($.entry.running--,P)$.entry.succeeded++;else $.entry.failed++,J(W,j,{actorID:U,errorMessage:q});$.scheduleFlush($.entry);let N=w&&w.outcome.status==="success"?W.schema?w.outcome.structured??null:w.outcome.structured??w.outcome.finalText??null:null,L=A!==""&&await $.bridge.promise($.worktree.isPristine(z.directory,A)).catch(()=>!1);if(!(P&&!L))return await $.bridge.promise($.worktree.remove({directory:z.directory})).catch(()=>{return}),$.entry.worktrees.delete(z.directory),P?N:null;let h={branch:z.branch,directory:z.directory,changed:!0};if(N&&typeof N==="object"&&!Array.isArray(N))return{...N,_worktree:h};return{_worktree:h,result:N}},G=async(B,H,W)=>{if($.entry.agentCount>=$.lifecycleCap)return $.warnCapOnce(),J(B,"over-cap"),null;$.entry.agentCount++;let O=$.getActor();if(!O)throw Error("Actor service unavailable");let j=await $.bridge.promise($.resolveAgentModel(B.model,$.defaultModel,$.entry.warnedModelRefs));return W(O,H,B,j)};return(B,H)=>{let W=H??{},O=String(B);if(W.isolation!=="worktree"){let j=ww(O,{agentType:W.agentType,model:W.model,schema:W.schema,phase:W.phase}),U=Tw($.journal,j);if($.journal.results.has(U))return $.entry.succeeded++,$.scheduleFlush($.entry),Promise.resolve($.journal.results.get(U));return(async()=>{let q=await $.semaphore.run(async()=>$.globalSemaphore.run(async()=>G(W,O,X)));if(q!==null)await V.runPromise(xw($.runID,$.journal,U,q));return q})()}return $.semaphore.run(async()=>$.globalSemaphore.run(async()=>G(W,O,K)))}}async function gw($){let Z=bB(await $),[J,Y,{QuickJSWASMModule:Q}]=await Promise.all([Z.importModuleLoader().then(bB),Z.importFFI(),import("./chunk-ete0y35c.js").then(bB)]),X=await J();X.type="sync";let K=new Y(X);return new Q(X,K)}function bB($){return $&&"default"in $&&$.default?$.default&&"default"in $.default&&$.default.default?$.default.default:$.default:$}function hw($){let Z=typeof $=="number"?$:$.getTime();return function(){return Date.now()>Z}}var Zc={type:"sync",importFFI:()=>import("./chunk-58w4dhb6.js").then(($)=>$.QuickJSFFI),importModuleLoader:()=>import("./chunk-ac69b9tm.js").then(($)=>$.default)},vw=Zc;var Jc=gw(vw),fw=43200000,Yc=67108864,Qc=2654435769,Xc=`
|
|
8154
8154
|
globalThis.parallel = (thunks) =>
|
|
8155
8155
|
Promise.all(thunks.map((t) => Promise.resolve().then(t)));
|
|
8156
8156
|
globalThis.pipeline = (items, ...stages) =>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-naq602da.js";var D=Object.defineProperty,x=(J,Q,W)=>(Q in J)?D(J,Q,{enumerable:!0,configurable:!0,writable:!0,value:W}):J[Q]=W,B=(J,Q,W)=>x(J,typeof Q!=="symbol"?Q+"":Q,W),I="CF_TEMP_TOKEN",L=[{name:"openai",regex:/^https:\/\/api\.openai\.com\//,transformEndpoint:(J)=>J.replace(/^https:\/\/api\.openai\.com\//,"")},{name:"deepseek",regex:/^https:\/\/api\.deepseek\.com\//,transformEndpoint:(J)=>J.replace(/^https:\/\/api\.deepseek\.com\//,"")},{name:"anthropic",regex:/^https:\/\/api\.anthropic\.com\//,transformEndpoint:(J)=>J.replace(/^https:\/\/api\.anthropic\.com\//,""),headerKey:"x-api-key"},{name:"google-ai-studio",regex:/^https:\/\/generativelanguage\.googleapis\.com\//,headerKey:"x-goog-api-key",transformEndpoint:(J)=>J.replace(/^https:\/\/generativelanguage\.googleapis\.com\//,"")},{name:"google-vertex-ai",regex:/aiplatform\.googleapis\.com/,transformEndpoint:(J)=>J.replace(/https:\/\/(.*)[-]?aiplatform\.googleapis\.com\//,"")},{name:"grok",regex:/^https:\/\/api\.x\.ai\//,transformEndpoint:(J)=>J.replace(/^https:\/\/api\.x\.ai\//,"")},{name:"mistral",regex:/^https:\/\/api\.mistral\.ai\//,transformEndpoint:(J)=>J.replace(/^https:\/\/api\.mistral\.ai\//,"")},{name:"perplexity-ai",regex:/^https:\/\/api\.perplexity\.ai\//,transformEndpoint:(J)=>J.replace(/^https:\/\/api\.perplexity\.ai\//,"")},{name:"replicate",regex:/^https:\/\/api\.replicate\.com\//,transformEndpoint:(J)=>J.replace(/^https:\/\/api\.replicate\.com\//,"")},{name:"groq",regex:/^https:\/\/api\.groq\.com\/openai\/v1\//,transformEndpoint:(J)=>J.replace(/^https:\/\/api\.groq\.com\/openai\/v1\//,"")},{name:"google-vertex-ai",regex:/^https:\/\/(?:[a-z0-9]+-)*aiplatform\.googleapis\.com\//,transformEndpoint:(J)=>J.replace(/^https:\/\/(?:[a-z0-9]+-)*aiplatform\.googleapis\.com\//,""),headerKey:"authorization"},{name:"azure-openai",regex:/^https:\/\/(?<resource>[^.]+)\.openai\.azure\.com\/openai\/deployments\/(?<deployment>[^/]+)\/(?<rest>.*)$/,transformEndpoint:(J)=>{let Q=J.match(/^https:\/\/(?<resource>[^.]+)\.openai\.azure\.com\/openai\/deployments\/(?<deployment>[^/]+)\/(?<rest>.*)$/);if(!Q||!Q.groups)return J;let{resource:W,deployment:X,rest:Z}=Q.groups;if(!W||!X||!Z)throw Error("Failed to parse Azure OpenAI endpoint URL.");return`${W}/${X}/${Z}`},headerKey:"api-key"},{name:"openrouter",regex:/^https:\/\/openrouter\.ai\/api\//,transformEndpoint:(J)=>J.replace(/^https:\/\/openrouter\.ai\/api\//,"")},{name:"compat",regex:/^https:\/\/gateway\.ai\.cloudflare\.com\/v1\/compat\//,transformEndpoint:(J)=>J.replace(/^https:\/\/gateway\.ai\.cloudflare\.com\/v1\/compat\//,"")}],z=class extends Error{},P=class extends Error{},T=class extends Error{};async function U(J){return await new Response(J).json()}var H=class{constructor(J,Q){B(this,"specificationVersion","v3"),B(this,"defaultObjectGenerationMode","json"),B(this,"supportedUrls",{}),B(this,"models"),B(this,"config"),this.models=J,this.config=Q}get modelId(){if(!this.models[0])throw Error("models cannot be empty array");return this.models[0].modelId}get provider(){if(!this.models[0])throw Error("models cannot be empty array");return this.models[0].provider}async processModelRequest(J,Q){let W=[];for(let S of this.models){if(!S.config||!Object.keys(S.config).includes("fetch"))throw Error(`Sorry, but provider "${S.provider}" is currently not supported, please open a issue in the github repo!`);S.config.fetch=(V,$)=>{throw W.push({modelProvider:S.provider,request:$,url:V}),new z("Stopping provider execution...")};try{await S[Q](J)}catch(V){if(!(V instanceof z))throw V}}let X=await Promise.all(W.map(async(S)=>{let V=null;for(let R of L)if(R.regex.test(S.url))V=R;if(!V)throw Error(`Sorry, but provider "${S.modelProvider}" is currently not supported, please open a issue in the github repo!`);if(!S.request.body)throw Error("Ai Gateway provider received an unexpected empty body");let $=V.headerKey??"authorization";if(("get"in S.request.headers?S.request.headers.get($):S.request.headers[$])?.indexOf(I)!==-1)if("delete"in S.request.headers)S.request.headers.delete($);else delete S.request.headers[$];return{endpoint:V.transformEndpoint(S.url),headers:S.request.headers,provider:V.name,query:await U(S.request.body)}})),Z=N(this.config.options??{}),Y;if("binding"in this.config){let S=X.map((V)=>({...V,headers:{...V.headers??{},...Object.fromEntries(Z.entries())}}));Y=await this.config.binding.run(S,{signal:J.abortSignal})}else Z.set("Content-Type","application/json"),Z.set("cf-aig-authorization",`Bearer ${this.config.apiKey}`),Y=await fetch(`https://gateway.ai.cloudflare.com/v1/${this.config.accountId}/${this.config.gateway}`,{body:JSON.stringify(X),headers:Z,method:"POST",signal:J.abortSignal});if(Y.status===400){let V=await Y.clone().json();if(V.success===!1&&V.error&&V.error.length>0&&V.error[0]?.code===2001)throw new P("This AI gateway does not exist")}else if(Y.status===401){let V=await Y.clone().json();if(V.success===!1&&V.error&&V.error.length>0&&V.error[0]?.code===2009)throw new T("Your AI Gateway has authentication active, but you didn't provide a valid apiKey")}let K=Number.parseInt(Y.headers.get("cf-aig-step")??"0",10);if(!this.models[K])throw Error("Unexpected AI Gateway Error");return this.models[K].config={...this.models[K].config,fetch:(S,V)=>Y},this.models[K][Q](J)}async doStream(J){return this.processModelRequest(J,"doStream")}async doGenerate(J){return this.processModelRequest(J,"doGenerate")}};function f(J){let Q=(X)=>{return new H(Array.isArray(X)?X:[X],J)},W=(X)=>Q(X);return W.chat=Q,W}function N(J){let Q=new Headers;if(J.skipCache===!0)Q.set("cf-skip-cache","true");if(J.cacheTtl)Q.set("cf-cache-ttl",J.cacheTtl.toString());if(J.metadata)Q.set("cf-aig-metadata",JSON.stringify(J.metadata));if(J.cacheKey)Q.set("cf-aig-cache-key",J.cacheKey);if(J.collectLog!==void 0)Q.set("cf-aig-collect-log",J.collectLog===!0?"true":"false");if(J.eventId!==void 0)Q.set("cf-aig-event-id",J.eventId);if(J.requestTimeoutMs!==void 0)Q.set("cf-aig-request-timeout",J.requestTimeoutMs.toString());if(J.retries!==void 0){if(J.retries.maxAttempts!==void 0)Q.set("cf-aig-max-attempts",J.retries.maxAttempts.toString());if(J.retries.retryDelayMs!==void 0)Q.set("cf-aig-retry-delay",J.retries.retryDelayMs.toString());if(J.retries.backoff!==void 0)Q.set("cf-aig-backoff",J.retries.backoff)}return Q}export{N as parseAiGatewayOptions,f as createAiGateway,T as AiGatewayUnauthorizedError,z as AiGatewayInternalFetchError,P as AiGatewayDoesNotExist,H as AiGatewayChatLanguageModel};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var j=Object.create;var{getPrototypeOf:k,defineProperty:i,getOwnPropertyNames:l}=Object;var m=Object.prototype.hasOwnProperty;function n(a){return this[a]}var o,p,s=(a,b,c)=>{var d=a!=null&&typeof a==="object";if(d){var g=b?o??=new WeakMap:p??=new WeakMap,e=g.get(a);if(e)return e}c=a!=null?j(k(a)):{};let h=b||!a||!a.__esModule?i(c,"default",{value:a,enumerable:!0}):c;for(let f of l(a))if(!m.call(h,f))i(h,f,{get:n.bind(a,f),enumerable:!0});if(d)g.set(a,h);return h};var t=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var q=(a)=>a;function r(a,b){this[a]=q.bind(null,b)}var u=(a,b)=>{for(var c in b)i(a,c,{get:b[c],enumerable:!0,configurable:!0,set:r.bind(b,c)})};var v=(a,b)=>()=>(a&&(b=a(a=0)),b);var w=import.meta.require,x=(a,b,c)=>{if(b!=null){if(typeof b!=="object"&&typeof b!=="function")throw TypeError('Object expected to be assigned to "using" declaration');let d;if(c)d=b[Symbol.asyncDispose];if(d===void 0)d=b[Symbol.dispose];if(typeof d!=="function")throw TypeError("Object not disposable");a.push([c,d,b])}else if(c)a.push([c]);return b},y=(a,b,c)=>{let d=(e)=>b=c?new SuppressedError(e,b,"An error was suppressed during disposal"):(c=!0,e),g=(e)=>{while(e=a.pop())try{var h=e[1]&&e[1].call(e[2]);if(e[0])return Promise.resolve(h).then(g,(f)=>(d(f),g()))}catch(f){d(f)}if(c)throw b};return g()};
|
|
3
|
-
export{s as
|
|
3
|
+
export{s as nP,t as oP,u as pP,v as qP,w as rP,x as sP,y as tP};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{h as P,i as g,j as b,k as h,l as O}from"./chunk-
|
|
2
|
+
import{h as P,i as g,j as b,k as h,l as O}from"./chunk-k0v37hc6.js";import"./chunk-3ne6j2h5.js";import"./chunk-799c17nk.js";import{Od as u}from"./chunk-wmmck56g.js";import{Sf as s}from"./chunk-s75chpxq.js";import{qh as f}from"./chunk-my0kzcby.js";import"./chunk-1v47v7vm.js";import{Ah as E}from"./chunk-tmjd3evp.js";import"./chunk-q6x5bmc3.js";import"./chunk-n1m5qdf5.js";import"./chunk-zeh3mjgp.js";import"./chunk-ntfh16rj.js";import"./chunk-tz8qhbk9.js";import"./chunk-hvcdemxe.js";import{Gj as S,Hj as p}from"./chunk-2wcwbp3t.js";import"./chunk-3sem578c.js";import"./chunk-fzzze6zd.js";import"./chunk-afpwjn78.js";import"./chunk-c4x99ayd.js";import"./chunk-44amvtcs.js";import"./chunk-cbfjjbfd.js";import"./chunk-c7dt464m.js";import"./chunk-jazpapb9.js";import"./chunk-knnemqfm.js";import"./chunk-hqv0s6sw.js";import"./chunk-apv1v4tk.js";import"./chunk-7tb9fjvq.js";import"./chunk-fp5mvrrx.js";import"./chunk-zzdbrxkh.js";import"./chunk-cqtkxwd8.js";import"./chunk-xtj5qqsw.js";import"./chunk-w32tj884.js";import"./chunk-29hmwttd.js";import"./chunk-2qy760rf.js";import"./chunk-kfdqfha0.js";import"./chunk-t42kh492.js";import"./chunk-8hh5ejmr.js";import"./chunk-mwbcmvmh.js";import"./chunk-9y65kbcf.js";import"./chunk-24r5h0fx.js";import"./chunk-vxc5q0wk.js";import"./chunk-dsny9dh8.js";import"./chunk-scb48j07.js";import"./chunk-k33xx2z9.js";import"./chunk-tydvpy1s.js";import"./chunk-b2k9yafd.js";import"./chunk-sjqgmp12.js";import"./chunk-jek1cnfk.js";import"./chunk-s7sksztt.js";import"./chunk-22vvjp4g.js";import"./chunk-a3te67a5.js";import{Lz as I}from"./chunk-kdr6nxmk.js";import{bI as l,gC as d,xD as D}from"./chunk-shav33fq.js";import"./chunk-bqeyh2gx.js";import"./chunk-kpkbyek5.js";import"./chunk-naq602da.js";var A=(o)=>l.promise(()=>E(o)),m=(o)=>l.sync(()=>s.println(o)),v=(o)=>s.Style.TEXT_DIM+o+s.Style.TEXT_NORMAL,L=(o)=>o?v(" (active)"):"",w=(o,e)=>`${o.email} ${v(o.url)}${L(e)}`,x=(o,e,t)=>`${e.name} (${o.email})${L(t)}`,C=(o,e,t)=>{let n=t?s.Style.TEXT_SUCCESS+"\u25CF"+s.Style.TEXT_NORMAL:" ",c=t?s.Style.TEXT_HIGHLIGHT_BOLD+e.name+s.Style.TEXT_NORMAL:e.name;return` ${n} ${c} ${v(o.email)} ${v(o.url)} ${v(e.id)}`},T=(o,e)=>d.isSome(o)&&o.value.id===e.accountID&&o.value.active_org_id===e.orgID,_=l.fn("login")(function*(o){let e=yield*p.Service;yield*P("Log in");let t=yield*e.login(o);yield*b.info("Go to: "+t.url),yield*b.info("Enter code: "+t.user),yield*A(t.url);let n=O();yield*n.start("Waiting for authorization...");let c=(r)=>l.gen(function*(){yield*l.sleep(r);let i=yield*e.poll(t);if(i._tag==="PollPending")return yield*c(r);if(i._tag==="PollSlow")return yield*c(D.sum(r,D.seconds(5)));return i}),a=yield*c(t.interval).pipe(l.timeout(t.expiry),l.catchTag("TimeoutError",()=>l.succeed(new S)));yield*I.valueTags(a,{PollSuccess:(r)=>l.gen(function*(){yield*n.stop("Logged in as "+r.email),yield*g("Done")}),PollExpired:()=>n.stop("Device code expired",1),PollDenied:()=>n.stop("Authorization denied",1),PollError:(r)=>n.stop("Error: "+String(r.cause),1),PollPending:()=>n.stop("Unexpected state",1),PollSlow:()=>n.stop("Unexpected state",1)})}),N=l.fn("logout")(function*(o){let e=yield*p.Service,t=yield*e.list();if(t.length===0)return yield*m("Not logged in");if(o){let i=t.find((y)=>y.email===o);if(!i)return yield*m("Account not found: "+o);yield*e.remove(i.id),yield*g("Logged out from "+o);return}let n=yield*e.active(),c=d.map(n,(i)=>i.id);yield*P("Log out");let a=t.map((i)=>{let y=d.isSome(c)&&c.value===i.id;return{value:i,label:w(i,y)}}),r=yield*h({message:"Select account to log out",options:a});if(d.isNone(r))return;yield*e.remove(r.value.id),yield*g("Logged out from "+r.value.email)}),$=l.fn("switch")(function*(){let o=yield*p.Service,e=yield*o.orgsByAccount();if(e.length===0)return yield*m("Not logged in");let t=yield*o.active(),n=e.flatMap((r)=>r.orgs.map((i)=>{let y=T(t,{accountID:r.account.id,orgID:i.id});return{value:{orgID:i.id,accountID:r.account.id,label:i.name},label:x(r.account,i,y)}}));if(n.length===0)return yield*m("No orgs found");yield*P("Switch org");let c=yield*h({message:"Select org",options:n});if(d.isNone(c))return;let a=c.value;yield*o.use(a.accountID,d.some(a.orgID)),yield*g("Switched to "+a.label)}),R=l.fn("orgs")(function*(){let o=yield*p.Service,e=yield*o.orgsByAccount();if(e.length===0)return yield*m("No accounts found");if(!e.some((n)=>n.orgs.length>0))return yield*m("No orgs found");let t=yield*o.active();for(let n of e)for(let c of n.orgs){let a=T(t,{accountID:n.account.id,orgID:c.id});yield*m(C(n.account,c,a))}}),M=l.fn("open")(function*(){let e=yield*(yield*p.Service).active();if(d.isNone(e))return yield*m("No active account");let t=e.value.url;yield*A(t),yield*g("Opened "+t)}),X=u({command:"login <url>",describe:!1,builder:(o)=>o.positional("url",{describe:"server URL",type:"string",demandOption:!0}),async handler(o){s.empty(),await f.runPromise(_(o.url))}}),B=u({command:"logout [email]",describe:!1,builder:(o)=>o.positional("email",{describe:"account email to log out from",type:"string"}),async handler(o){s.empty(),await f.runPromise(N(o.email))}}),U=u({command:"switch",describe:!1,async handler(){s.empty(),await f.runPromise($())}}),G=u({command:"orgs",describe:!1,async handler(){s.empty(),await f.runPromise(R())}}),H=u({command:"open",describe:!1,async handler(){s.empty(),await f.runPromise(M())}}),Y=u({command:"console",describe:!1,builder:(o)=>o.command({...X,describe:"log in to console"}).command({...B,describe:"log out from console"}).command({...U,describe:"switch active org"}).command({...G,describe:"list orgs"}).command({...H,describe:"open active console account"}).demandCommand(),async handler(){}});export{C as formatOrgLine,w as formatAccountLabel,U as SwitchCommand,G as OrgsCommand,H as OpenCommand,B as LogoutCommand,X as LoginCommand,Y as ConsoleCommand};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{pP as d3,rP as P5}from"./chunk-naq602da.js";function R($,X,Y,J,Q){if(J==="m")throw TypeError("Private method is not writable");if(J==="a"&&!Q)throw TypeError("Private accessor was defined without a setter");if(typeof X==="function"?$!==X||!Q:!X.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return J==="a"?Q.call($,Y):Q?Q.value=Y:X.set($,Y),Y}function M($,X,Y,J){if(Y==="a"&&!J)throw TypeError("Private accessor was defined without a getter");if(typeof X==="function"?$!==X||!J:!X.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return Y==="m"?J:Y==="a"?J.call($):J?J.value:X.get($)}var t4=function(){let{crypto:$}=globalThis;if($?.randomUUID)return t4=$.randomUUID.bind($),$.randomUUID();let X=new Uint8Array(1),Y=$?()=>$.getRandomValues(X)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(J)=>(+J^Y()&15>>+J/4).toString(16))};function e$($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var M8=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let X=Error($.message,$.cause?{cause:$.cause}:{});if($.stack)X.stack=$.stack;if($.cause&&!X.cause)X.cause=$.cause;if($.name)X.name=$.name;return X}}catch{}try{return Error(JSON.stringify($))}catch{}}return Error($)};class f extends Error{}class X$ extends f{constructor($,X,Y,J){super(`${X$.makeMessage($,X,Y)}`);this.status=$,this.headers=J,this.requestID=J?.get("request-id"),this.error=X}static makeMessage($,X,Y){let J=X?.message?typeof X.message==="string"?X.message:JSON.stringify(X.message):X?JSON.stringify(X):Y;if($&&J)return`${$} ${J}`;if($)return`${$} status code (no body)`;if(J)return J;return"(no status code or body)"}static generate($,X,Y,J){if(!$||!J)return new f0({message:Y,cause:M8(X)});let Q=X;if($===400)return new E8($,Q,Y,J);if($===401)return new L8($,Q,Y,J);if($===403)return new Z8($,Q,Y,J);if($===404)return new S8($,Q,Y,J);if($===409)return new A8($,Q,Y,J);if($===422)return new C8($,Q,Y,J);if($===429)return new D8($,Q,Y,J);if($>=500)return new R8($,Q,Y,J);return new X$($,Q,Y,J)}}class q$ extends X${constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}}class f0 extends X${constructor({message:$,cause:X}){super(void 0,void 0,$||"Connection error.",void 0);if(X)this.cause=X}}class O8 extends f0{constructor({message:$}={}){super({message:$??"Request timed out."})}}class E8 extends X${}class L8 extends X${}class Z8 extends X${}class S8 extends X${}class A8 extends X${}class C8 extends X${}class D8 extends X${}class R8 extends X${}var o5=/^[a-z][a-z0-9+.-]*:/i,E7=($)=>{return o5.test($)},o4=($)=>(o4=Array.isArray,o4($)),e4=o4;function c6($){if(typeof $!=="object")return{};return $??{}}function L7($){if(!$)return!0;for(let X in $)return!1;return!0}function Z7($,X){return Object.prototype.hasOwnProperty.call($,X)}var S7=($,X)=>{if(typeof X!=="number"||!Number.isInteger(X))throw new f(`${$} must be an integer`);if(X<0)throw new f(`${$} must be a positive integer`);return X};var l6=($)=>{try{return JSON.parse($)}catch(X){return}};var A7=($)=>new Promise((X)=>setTimeout(X,$));var w0="0.71.2";var T7=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"};function e5(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}var $Y=()=>{let $=e5();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":w0,"X-Stainless-OS":D7(Deno.build.os),"X-Stainless-Arch":C7(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":w0,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if($==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":w0,"X-Stainless-OS":D7(globalThis.process.platform??"unknown"),"X-Stainless-Arch":C7(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let X=XY();if(X)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":w0,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${X.browser}`,"X-Stainless-Runtime-Version":X.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":w0,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function XY(){if(typeof navigator>"u"||!navigator)return null;let $=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:X,pattern:Y}of $){let J=Y.exec(navigator.userAgent);if(J){let Q=J[1]||0,W=J[2]||0,z=J[3]||0;return{browser:X,version:`${Q}.${W}.${z}`}}}return null}var C7=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},D7=($)=>{if($=$.toLowerCase(),$.includes("ios"))return"iOS";if($==="android")return"Android";if($==="darwin")return"MacOS";if($==="win32")return"Windows";if($==="freebsd")return"FreeBSD";if($==="openbsd")return"OpenBSD";if($==="linux")return"Linux";if($)return`Other:${$}`;return"Unknown"},R7,_7=()=>{return R7??(R7=$Y())};function P7(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function $X(...$){let X=globalThis.ReadableStream;if(typeof X>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new X(...$)}function p6($){let X=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return $X({start(){},async pull(Y){let{done:J,value:Q}=await X.next();if(J)Y.close();else Y.enqueue(Q)},async cancel(){await X.return?.()}})}function T8($){if($[Symbol.asyncIterator])return $;let X=$.getReader();return{async next(){try{let Y=await X.read();if(Y?.done)X.releaseLock();return Y}catch(Y){throw X.releaseLock(),Y}},async return(){let Y=X.cancel();return X.releaseLock(),await Y,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function j7($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let X=$.getReader(),Y=X.cancel();X.releaseLock(),await Y}var k7=({headers:$,body:X})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(X)}};function b7($){let X=0;for(let Q of $)X+=Q.length;let Y=new Uint8Array(X),J=0;for(let Q of $)Y.set(Q,J),J+=Q.length;return Y}var x7;function _8($){let X;return(x7??(X=new globalThis.TextEncoder,x7=X.encode.bind(X)))($)}var f7;function XX($){let X;return(f7??(X=new globalThis.TextDecoder,f7=X.decode.bind(X)))($)}var Z$,S$;class N0{constructor(){Z$.set(this,void 0),S$.set(this,void 0),R(this,Z$,new Uint8Array,"f"),R(this,S$,null,"f")}decode($){if($==null)return[];let X=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?_8($):$;R(this,Z$,b7([M(this,Z$,"f"),X]),"f");let Y=[],J;while((J=QY(M(this,Z$,"f"),M(this,S$,"f")))!=null){if(J.carriage&&M(this,S$,"f")==null){R(this,S$,J.index,"f");continue}if(M(this,S$,"f")!=null&&(J.index!==M(this,S$,"f")+1||J.carriage)){Y.push(XX(M(this,Z$,"f").subarray(0,M(this,S$,"f")-1))),R(this,Z$,M(this,Z$,"f").subarray(M(this,S$,"f")),"f"),R(this,S$,null,"f");continue}let Q=M(this,S$,"f")!==null?J.preceding-1:J.preceding,W=XX(M(this,Z$,"f").subarray(0,Q));Y.push(W),R(this,Z$,M(this,Z$,"f").subarray(J.index),"f"),R(this,S$,null,"f")}return Y}flush(){if(!M(this,Z$,"f").length)return[];return this.decode(`
|
|
3
3
|
`)}}Z$=new WeakMap,S$=new WeakMap;N0.NEWLINE_CHARS=new Set([`
|
|
4
4
|
`,"\r"]);N0.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function QY($,X){for(let Q=X??0;Q<$.length;Q++){if($[Q]===10)return{preceding:Q,index:Q+1,carriage:!1};if($[Q]===13)return{preceding:Q,index:Q+1,carriage:!0}}return null}function I7($){for(let J=0;J<$.length-1;J++){if($[J]===10&&$[J+1]===10)return J+2;if($[J]===13&&$[J+1]===13)return J+2;if($[J]===13&&$[J+1]===10&&J+3<$.length&&$[J+2]===13&&$[J+3]===10)return J+4}return-1}var n6={off:0,error:200,warn:300,info:400,debug:500},YX=($,X,Y)=>{if(!$)return;if(Z7(n6,$))return $;G$(Y).warn(`${X} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(n6))}`);return};function P8(){}function i6($,X,Y){if(!X||n6[$]>n6[Y])return P8;else return X[$].bind(X)}var WY={error:P8,warn:P8,info:P8,debug:P8},v7=new WeakMap;function G$($){let X=$.logger,Y=$.logLevel??"off";if(!X)return WY;let J=v7.get(X);if(J&&J[0]===Y)return J[1];let Q={error:i6("error",X,Y),warn:i6("warn",X,Y),info:i6("info",X,Y),debug:i6("debug",X,Y)};return v7.set(X,[Y,Q]),Q}var $0=($)=>{if($.options)$.options={...$.options},delete $.options.headers;if($.headers)$.headers=Object.fromEntries(($.headers instanceof Headers?[...$.headers]:Object.entries($.headers)).map(([X,Y])=>[X,X.toLowerCase()==="x-api-key"||X.toLowerCase()==="authorization"||X.toLowerCase()==="cookie"||X.toLowerCase()==="set-cookie"?"***":Y]));if("retryOfRequestLogID"in $){if($.retryOfRequestLogID)$.retryOf=$.retryOfRequestLogID;delete $.retryOfRequestLogID}return $};var j8;class A${constructor($,X,Y){this.iterator=$,j8.set(this,void 0),this.controller=X,R(this,j8,Y,"f")}static fromSSEResponse($,X,Y){let J=!1,Q=Y?G$(Y):console;async function*W(){if(J)throw new f("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");J=!0;let z=!1;try{for await(let G of zY($,X)){if(G.event==="completion")try{yield JSON.parse(G.data)}catch(V){throw Q.error("Could not parse message into JSON:",G.data),Q.error("From chunk:",G.raw),V}if(G.event==="message_start"||G.event==="message_delta"||G.event==="message_stop"||G.event==="content_block_start"||G.event==="content_block_delta"||G.event==="content_block_stop")try{yield JSON.parse(G.data)}catch(V){throw Q.error("Could not parse message into JSON:",G.data),Q.error("From chunk:",G.raw),V}if(G.event==="ping")continue;if(G.event==="error")throw new X$(void 0,l6(G.data)??G.data,void 0,$.headers)}z=!0}catch(G){if(e$(G))return;throw G}finally{if(!z)X.abort()}}return new A$(W,X,Y)}static fromReadableStream($,X,Y){let J=!1;async function*Q(){let z=new N0,G=T8($);for await(let V of G)for(let H of z.decode(V))yield H;for(let V of z.flush())yield V}async function*W(){if(J)throw new f("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");J=!0;let z=!1;try{for await(let G of Q()){if(z)continue;if(G)yield JSON.parse(G)}z=!0}catch(G){if(e$(G))return;throw G}finally{if(!z)X.abort()}}return new A$(W,X,Y)}[(j8=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let $=[],X=[],Y=this.iterator(),J=(Q)=>{return{next:()=>{if(Q.length===0){let W=Y.next();$.push(W),X.push(W)}return Q.shift()}}};return[new A$(()=>J($),this.controller,M(this,j8,"f")),new A$(()=>J(X),this.controller,M(this,j8,"f"))]}toReadableStream(){let $=this,X;return $X({async start(){X=$[Symbol.asyncIterator]()},async pull(Y){try{let{value:J,done:Q}=await X.next();if(Q)return Y.close();let W=_8(JSON.stringify(J)+`
|
|
5
5
|
`);Y.enqueue(W)}catch(J){Y.error(J)}},async cancel(){await X.return?.()}})}}async function*zY($,X){if(!$.body){if(X.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new f("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new f("Attempted to iterate over a response with no body")}let Y=new y7,J=new N0,Q=T8($.body);for await(let W of GY(Q))for(let z of J.decode(W)){let G=Y.decode(z);if(G)yield G}for(let W of J.flush()){let z=Y.decode(W);if(z)yield z}}async function*GY($){let X=new Uint8Array;for await(let Y of $){if(Y==null)continue;let J=Y instanceof ArrayBuffer?new Uint8Array(Y):typeof Y==="string"?_8(Y):Y,Q=new Uint8Array(X.length+J.length);Q.set(X),Q.set(J,X.length),X=Q;let W;while((W=I7(X))!==-1)yield X.slice(0,W),X=X.slice(W)}if(X.length>0)yield X}class y7{constructor(){this.event=null,this.data=[],this.chunks=[]}decode($){if($.endsWith("\r"))$=$.substring(0,$.length-1);if(!$){if(!this.event&&!this.data.length)return null;let Q={event:this.event,data:this.data.join(`
|